/* PowerUp Nutrition — admin stylesheet
   Hand-written, no build step, no CDN. Palette mirrors the storefront so the
   dashboard feels like the same shop rather than a bolted-on tool. */

:root {
  --ink: #1b1917;
  --ink-soft: #3b3733;
  --stone: #6f6a63;
  --muted: #918b83;
  --line: #e4ded4;
  --linen: #efe9df;
  --parchment: #f6f2ea;
  --cream: #fbf8f3;
  --white: #ffffff;
  --gold: #b98f52;
  --gold-deep: #8f6a34;
  --gold-soft: #f0e3cd;
  --green: #2f6b4f;
  --green-soft: #e2efe7;
  --red: #9b3b32;
  --red-soft: #f7e6e3;
  --amber: #8a6117;
  --amber-soft: #fbf0d9;

  --radius: 2px;
  --shadow-sm: 0 1px 2px rgba(27, 25, 23, 0.06);
  --shadow-md: 0 12px 30px -18px rgba(27, 25, 23, 0.4);
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: "Cormorant Garamond", "Iowan Old Style", Georgia, serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--parchment);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; }
img { max-width: 100%; display: block; }

/* ---------- shell ---------- */

.shell {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 28px 22px;
  background: var(--ink);
  color: var(--cream);
}

.brand { display: flex; flex-direction: column; gap: 4px; }
.brand__name {
  font-family: var(--serif);
  font-size: 24px;
  letter-spacing: 0.02em;
  line-height: 1.1;
}
.brand__meta {
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(251, 248, 243, 0.55);
}

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav__label {
  margin: 18px 0 8px;
  font-size: 9px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(251, 248, 243, 0.4);
}
.nav__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: rgba(251, 248, 243, 0.72);
  font-size: 13px;
  transition: background 140ms ease, color 140ms ease;
}
.nav__link:hover { background: rgba(251, 248, 243, 0.07); color: var(--cream); }
.nav__link.is-active {
  background: rgba(185, 143, 82, 0.18);
  color: var(--cream);
  box-shadow: inset 2px 0 0 var(--gold);
}
.nav__count {
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(251, 248, 243, 0.14);
  font-size: 10px;
  text-align: center;
}

.sidebar__foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 11px;
  color: rgba(251, 248, 243, 0.45);
}
.sidebar__foot a { color: rgba(251, 248, 243, 0.7); }
.sidebar__foot a:hover { color: var(--cream); }

.main { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 32px;
  background: rgba(251, 248, 243, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.crumbs { font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); }
.crumbs strong { color: var(--ink); font-weight: 500; }

.topbar__actions { display: flex; align-items: center; gap: 10px; }
.who { text-align: right; line-height: 1.3; }
.who__name { font-size: 12px; font-weight: 600; }
.who__role { font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }

.content { padding: 32px; display: flex; flex-direction: column; gap: 26px; max-width: 1400px; width: 100%; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.page-title { margin: 0; font-family: var(--serif); font-size: 34px; line-height: 1.1; font-weight: 500; }
.page-sub { margin: 6px 0 0; color: var(--stone); max-width: 66ch; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- cards ---------- */

.card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.card__title { margin: 0; font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--stone); }
.card__body { padding: 20px; }
.card__body--flush { padding: 0; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.stat { padding: 18px 20px; background: var(--white); border: 1px solid var(--line); }
.stat__label { font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }
.stat__value { margin-top: 8px; font-family: var(--serif); font-size: 30px; line-height: 1; }
.stat__hint { margin-top: 6px; font-size: 11px; color: var(--stone); }
.stat--accent { background: var(--ink); color: var(--cream); border-color: var(--ink); }
.stat--accent .stat__label { color: rgba(251, 248, 243, 0.55); }
.stat--accent .stat__hint { color: rgba(251, 248, 243, 0.6); }

/* ---------- tables ---------- */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--parchment);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
tbody td { padding: 14px 16px; border-bottom: 1px solid var(--linen); vertical-align: middle; }
tbody tr:hover { background: var(--cream); }
tbody tr.is-dim td { opacity: 0.55; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.cell-product { display: flex; align-items: center; gap: 12px; min-width: 260px; }
.thumb {
  width: 42px;
  height: 52px;
  object-fit: cover;
  background: var(--parchment);
  border: 1px solid var(--line);
  flex: none;
}
.cell-product__name { font-weight: 600; }
.cell-product__meta { font-size: 11px; color: var(--muted); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid transparent;
  white-space: nowrap;
}
.badge--live { background: var(--green-soft); color: var(--green); border-color: rgba(47, 107, 79, 0.2); }
.badge--hidden { background: var(--linen); color: var(--stone); border-color: var(--line); }
.badge--new { background: var(--amber-soft); color: var(--amber); border-color: rgba(138, 97, 23, 0.2); }
.badge--closed { background: var(--green-soft); color: var(--green); }
.badge--contacted { background: var(--gold-soft); color: var(--gold-deep); }
.badge--gold { background: var(--gold-soft); color: var(--gold-deep); }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--cream);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity 140ms ease, background 140ms ease, color 140ms ease;
  white-space: nowrap;
}
.btn:hover { opacity: 0.88; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { border-color: var(--ink); opacity: 1; }
.btn--gold { background: var(--gold); border-color: var(--gold); color: var(--ink); }
.btn--danger { background: transparent; border-color: rgba(155, 59, 50, 0.4); color: var(--red); }
.btn--danger:hover { background: var(--red-soft); }
.btn--sm { padding: 6px 10px; font-size: 10px; letter-spacing: 0.1em; }
.btn--link { background: none; border: none; padding: 0; color: var(--gold-deep); text-transform: none; letter-spacing: 0; font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- forms ---------- */

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.form-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field--full { grid-column: 1 / -1; }
.field label, .label {
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--stone);
}
.field .hint { font-size: 11px; color: var(--muted); }
.field .error { font-size: 11px; color: var(--red); }

input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
input[type="search"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--ink);
  font: inherit;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(185, 143, 82, 0.16);
}
input.is-invalid, textarea.is-invalid { border-color: var(--red); }
textarea { min-height: 110px; resize: vertical; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--stone) 50%), linear-gradient(135deg, var(--stone) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 34px; }

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--white);
}
.toolbar__grow { flex: 1 1 240px; min-width: 180px; }
.toolbar input[type="search"] { padding: 9px 12px; }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 12px; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch__track {
  width: 38px; height: 22px; border-radius: 999px; background: var(--line);
  position: relative; transition: background 140ms ease; flex: none;
}
.switch__track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  border-radius: 999px; background: var(--white); transition: transform 140ms ease;
  box-shadow: var(--shadow-sm);
}
.switch input:checked + .switch__track { background: var(--green); }
.switch input:checked + .switch__track::after { transform: translateX(16px); }
.switch input:focus-visible + .switch__track { box-shadow: 0 0 0 3px rgba(185, 143, 82, 0.3); }

/* ---------- repeater rows (nutrition, faq) ---------- */

.repeater { display: flex; flex-direction: column; gap: 8px; }
.repeater__row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: start; }
.repeater__row--faq { grid-template-columns: 1fr 2fr auto; }
.repeater__row .btn { height: 38px; }

/* ---------- misc ---------- */

.empty { padding: 48px 24px; text-align: center; color: var(--stone); }
.empty h3 { margin: 0 0 6px; font-family: var(--serif); font-size: 22px; color: var(--ink); font-weight: 500; }
.empty p { margin: 0; font-size: 13px; }

.pill-row { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  padding: 6px 12px; border: 1px solid var(--line); background: var(--white);
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer; color: var(--stone);
}
.pill.is-active { background: var(--ink); color: var(--cream); border-color: var(--ink); }

.muted { color: var(--muted); }
.small { font-size: 11px; }
.mono { font-family: var(--mono); font-size: 11px; }
.nowrap { white-space: nowrap; }
.row { display: flex; align-items: center; gap: 10px; }
.row--between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 20px; align-items: start; }

.timeline { display: flex; flex-direction: column; }
.timeline__item { display: flex; gap: 14px; padding: 12px 20px; border-bottom: 1px solid var(--linen); }
.timeline__item:last-child { border-bottom: none; }
.timeline__dot { width: 7px; height: 7px; border-radius: 999px; background: var(--gold); margin-top: 7px; flex: none; }
.timeline__body { font-size: 12px; }
.timeline__meta { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-top: 2px; }

/* ---------- toast ---------- */

.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast {
  min-width: 240px;
  max-width: 380px;
  padding: 12px 16px;
  background: var(--ink);
  color: var(--cream);
  font-size: 12px;
  box-shadow: var(--shadow-md);
  animation: toast-in 160ms ease-out;
}
.toast--error { background: var(--red); }
.toast--success { background: var(--green); }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- modal ---------- */

.modal[hidden] { display: none; }
.modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(27, 25, 23, 0.5);
}
.modal__panel {
  width: min(440px, 100%);
  background: var(--white);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.modal__title { margin: 0; font-family: var(--serif); font-size: 22px; font-weight: 500; }
.modal__actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- login ---------- */

.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  background: var(--parchment);
}
.auth__aside {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 44px;
  background: var(--ink);
  color: var(--cream);
  overflow: hidden;
}
.auth__aside::after {
  content: "";
  position: absolute;
  inset: auto -20% -40% 30%;
  height: 70%;
  background: radial-gradient(circle at 30% 30%, rgba(185, 143, 82, 0.4), transparent 62%);
  pointer-events: none;
}
.auth__brand { font-family: var(--serif); font-size: 30px; }
.auth__kicker { font-size: 10px; letter-spacing: 0.24em; text-transform: uppercase; color: rgba(251, 248, 243, 0.5); }
.auth__copy { max-width: 34ch; font-family: var(--serif); font-size: 30px; line-height: 1.25; margin: 0; position: relative; z-index: 1; }
.auth__note { font-size: 11px; color: rgba(251, 248, 243, 0.45); position: relative; z-index: 1; }

.auth__main { display: grid; place-items: center; padding: 40px; }
.auth__card { width: min(420px, 100%); display: flex; flex-direction: column; gap: 20px; }
.auth__title { margin: 0; font-family: var(--serif); font-size: 32px; font-weight: 500; }
.auth__sub { margin: -10px 0 0; color: var(--stone); font-size: 13px; }
.auth__form { display: flex; flex-direction: column; gap: 16px; }
.auth__error { display: none; padding: 10px 12px; background: var(--red-soft); border-left: 2px solid var(--red); color: var(--red); font-size: 12px; }
.auth__error.is-visible { display: block; }
.auth__advanced { border-top: 1px solid var(--line); padding-top: 14px; }
.auth__advanced summary { cursor: pointer; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.auth__advanced .field { margin-top: 12px; }

@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth__aside { display: none; }
}

/* ---------- responsive ---------- */

@media (max-width: 1080px) {
  .grid-2 { grid-template-columns: 1fr; }
  .form-grid, .form-grid--3 { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    gap: 18px;
    padding: 14px 16px;
    overflow-x: auto;
  }
  .brand__meta, .nav__label, .sidebar__foot { display: none; }
  .nav { flex-direction: row; gap: 4px; }
  .nav__link { white-space: nowrap; padding: 7px 10px; }
  .topbar { position: static; padding: 12px 16px; }
  .content { padding: 18px 16px 40px; gap: 18px; }
  .page-title { font-size: 26px; }
}
