:root {
  --ink: #1c1712;
  --muted: #746b5e;
  --paper: #fbf8f0;
  --surface: #ffffff;
  --line: #e8ddc9;
  --sage: #7f9580;
  --sage-deep: #38533f;
  --clay: #a66f4d;
  --gold: #c6a461;
  --gold-soft: #ead8ae;
  --champagne: #f4ead7;
  --sky: #e9efed;
  --danger: #9f3d35;
  --shadow: 0 26px 70px rgba(39, 30, 20, 0.15);
  --shadow-soft: 0 12px 34px rgba(39, 30, 20, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 18%, rgba(234, 216, 174, 0.36), transparent 32%),
    linear-gradient(145deg, #f7efe1 0%, #fbf8f0 42%, #e8eee7 100%),
    repeating-linear-gradient(90deg, rgba(198, 164, 97, 0.05) 0 1px, transparent 1px 64px);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
}

.boot-screen,
.login-screen,
.state-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 18px;
}

.boot-screen {
  color: var(--muted);
  gap: 16px;
  align-content: center;
  justify-items: center;
  text-align: center;
}

.brand-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--paper);
  border-radius: 8px;
  font-family: "Fraunces", serif;
  font-weight: 700;
  letter-spacing: 0;
}

.brand-logo {
  display: block;
  width: 132px;
  height: auto;
  object-fit: contain;
}

.brand-logo.login-logo {
  width: min(230px, 70vw);
  margin: 0 auto;
  filter: drop-shadow(0 14px 24px rgba(39, 30, 20, 0.12));
}

.brand-logo.sidebar-logo {
  width: 72px;
  flex: 0 0 auto;
}

.login-panel,
.state-panel {
  width: min(100%, 460px);
  min-height: min(680px, calc(100vh - 64px));
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(251, 248, 240, 0.94)),
    var(--surface);
  border: 1px solid rgba(198, 164, 97, 0.36);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: clamp(28px, 6vh, 48px) clamp(22px, 5vw, 38px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.login-panel::before,
.state-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-top: 4px solid var(--gold);
  pointer-events: none;
}

.login-panel::after,
.state-panel::after {
  content: "";
  width: 82px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  margin: 22px auto 0;
  order: 2;
}

.login-panel h1,
.state-panel h1 {
  font-family: "Fraunces", serif;
  font-size: clamp(36px, 6vw, 48px);
  line-height: 0.96;
  margin: 26px auto 12px;
  letter-spacing: 0;
  max-width: 360px;
}

.login-panel p,
.state-panel p {
  color: var(--muted);
  line-height: 1.65;
  margin: 0 auto 24px;
  max-width: 360px;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 14px;
  text-align: left;
}

.field span {
  font-size: 12px;
  font-weight: 800;
  color: #8f7b55;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.field input {
  width: 100%;
  border: 1px solid #e5d8bf;
  border-radius: 8px;
  padding: 14px 15px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  outline: none;
}

.field input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(198, 164, 97, 0.18);
}

.primary-btn,
.secondary-btn,
.text-btn {
  border: 0;
  border-radius: 8px;
  min-height: 44px;
  padding: 0 16px;
  font-weight: 800;
}

.primary-btn {
  width: 100%;
  background: linear-gradient(135deg, #1f2d25, #38533f);
  color: white;
  box-shadow: 0 14px 28px rgba(31, 45, 37, 0.18);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.primary-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 18px 34px rgba(31, 45, 37, 0.22);
}

.primary-btn:disabled {
  opacity: 0.58;
  cursor: wait;
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  color: var(--ink);
}

.text-btn {
  background: transparent;
  color: #8b6f35;
  padding-inline: 0;
}

.login-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
  align-items: center;
  margin-top: 14px;
}

.notice {
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.5;
  margin: 14px 0;
}

.notice.error {
  background: #fff0ed;
  color: var(--danger);
  border: 1px solid #edc2bb;
}

.notice.success {
  background: #eef6ef;
  color: var(--sage-deep);
  border: 1px solid #cfe1d1;
}

.portal-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 292px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 26px 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.68), rgba(251, 248, 240, 0.94)),
    var(--paper);
  border-right: 1px solid rgba(198, 164, 97, 0.24);
  display: flex;
  flex-direction: column;
  gap: 22px;
  box-shadow: 10px 0 34px rgba(39, 30, 20, 0.05);
}

.sidebar-head {
  display: flex;
  gap: 12px;
  align-items: center;
}

.sidebar-title {
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  color: #8b6f35;
  letter-spacing: 0.12em;
}

.sidebar-client {
  font-family: "Fraunces", serif;
  font-size: 27px;
  line-height: 1.05;
}

.nav-tabs {
  display: grid;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid rgba(198, 164, 97, 0.24);
}

.nav-tab {
  min-height: 44px;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 8px;
  padding: 0 12px;
  color: var(--muted);
  font-weight: 800;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.nav-tab.active {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(198, 164, 97, 0.38);
  box-shadow: var(--shadow-soft);
}

.nav-tab:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.52);
}

.sidebar-foot {
  margin-top: auto;
  display: grid;
  gap: 10px;
}

.portal-main {
  min-width: 0;
  padding: 30px;
}

.mobile-topbar {
  display: none;
}

.hero-band {
  min-height: 238px;
  border-radius: 8px;
  padding: 30px;
  background:
    linear-gradient(135deg, rgba(28, 23, 18, 0.96), rgba(56, 83, 63, 0.9)),
    linear-gradient(90deg, rgba(198, 164, 97, 0.34), transparent);
  color: white;
  display: grid;
  align-content: end;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(198, 164, 97, 0.32);
}

.hero-kicker,
.section-kicker {
  margin: 0 0 9px;
  font-size: 11px;
  text-transform: uppercase;
  font-weight: 900;
  letter-spacing: 0.14em;
  color: var(--gold);
}

.hero-band h1 {
  margin: 0;
  font-family: "Fraunces", serif;
  font-size: clamp(35px, 5vw, 60px);
  line-height: 0.95;
  letter-spacing: 0;
  max-width: 830px;
}

.hero-band p {
  max-width: 790px;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.65;
}

.content-grid {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.grid-two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.section-panel,
.item-card,
.wide-panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(251, 248, 240, 0.8));
  border: 1px solid rgba(232, 221, 201, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow-soft);
}

.section-panel,
.wide-panel {
  padding: 20px;
}

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
  margin-bottom: 14px;
}

.section-title h2 {
  font-family: "Fraunces", serif;
  font-size: 27px;
  line-height: 1.05;
  margin: 0;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 12px;
  line-height: 1.5;
}

.prose {
  color: #3f382f;
  line-height: 1.75;
  margin: 0;
}

.stack {
  display: grid;
  gap: 12px;
}

.timing-row,
.check-row,
.timeline-row,
.food-row,
.support-row {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.timing-row:first-child,
.check-row:first-child,
.timeline-row:first-child,
.food-row:first-child,
.support-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.timing-time {
  font-weight: 900;
  color: #8b6f35;
}

.pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 8px;
  padding: 0 10px;
  background: #f4ead7;
  color: #6d5426;
  font-size: 12px;
  font-weight: 800;
}

.category-pill {
  align-items: flex-start;
  min-height: auto;
  padding: 8px 11px;
  line-height: 1.35;
  white-space: normal;
}

.category-pill.category-peptide,
.category-badge.category-peptide {
  background: #efe5cf;
  color: #72572a;
}

.category-pill.category-supplement,
.category-badge.category-supplement {
  background: #eaf1e7;
  color: #38533f;
}

.category-pill.category-nutrition,
.category-badge.category-nutrition {
  background: #f7e7dc;
  color: #8a4f32;
}

.category-pill.category-lifestyle,
.category-badge.category-lifestyle {
  background: #e9efed;
  color: #415c5a;
}

.category-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 8px;
  padding: 0 8px;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.info-pill {
  appearance: none;
  border: 1px solid rgba(198, 164, 97, 0.38);
  background: rgba(255, 250, 242, 0.9);
  color: #72572a;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}

.info-pill:hover {
  background: #f4ead7;
  border-color: rgba(198, 164, 97, 0.64);
}

.item-card {
  padding: 16px;
  display: grid;
  gap: 12px;
}

.item-card h3 {
  margin: 0;
  font-size: 18px;
}

.peptide-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.metric {
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid #eadfc9;
  border-radius: 8px;
  padding: 10px;
}

.metric span {
  display: block;
  font-size: 10px;
  font-weight: 900;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.metric strong {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  line-height: 1.35;
}

.check-row {
  grid-template-columns: 28px 1fr;
  align-items: start;
  cursor: pointer;
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.66);
  border: 1px solid #eadfc9;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.progress-track + .stack,
.section-title + .stack {
  margin-top: 16px;
}

.timing-row .stack {
  margin-top: 10px;
  padding-top: 2px;
}

.timing-row .check-row:first-child {
  border-top: 1px solid #eadfc9;
  padding-top: 12px;
}

.check-row:hover {
  border-color: rgba(198, 164, 97, 0.5);
}

.check-row.is-checked {
  background: #eef6ef;
  border-color: #cfe1d1;
}

.check-row.is-checked strong {
  color: var(--sage-deep);
}

.check-input {
  width: 20px;
  height: 20px;
  accent-color: var(--sage-deep);
  margin: 2px 0 0;
}

.check-heading {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.info-panel {
  margin-top: 18px;
  padding: 16px 18px;
  border: 1px solid rgba(198, 164, 97, 0.34);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(244, 234, 215, 0.72), rgba(255, 255, 255, 0.68));
}

.info-panel strong {
  display: block;
  margin-bottom: 6px;
}

.meal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.meal-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid #eadfc9;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(251, 248, 240, 0.78));
  box-shadow: var(--shadow-soft);
  touch-action: pan-y;
}

.meal-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.meal-card h3 {
  margin: 0;
  font-family: "Fraunces", serif;
  font-size: 24px;
  line-height: 1.05;
}

.meal-check {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-height: 38px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid #eadfc9;
  background: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.meal-check.is-checked {
  background: #eef6ef;
  border-color: #cfe1d1;
  color: var(--sage-deep);
}

.meal-option-body {
  display: grid;
  gap: 10px;
}

.food-pill-list .pill {
  background: #fff7e8;
  color: #654b20;
}

.checklist-foods {
  margin-top: 10px;
}

.meal-nav {
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.inline-meal-nav {
  margin-top: 10px;
  justify-content: flex-start;
  flex-wrap: wrap;
}

.compact-btn {
  min-height: 36px;
  padding: 0 12px;
  font-size: 12px;
}

.fake-check {
  width: 20px;
  height: 20px;
  border: 2px solid var(--gold);
  border-radius: 6px;
  margin-top: 2px;
  background: white;
}

.adherence-panel {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px;
  background: linear-gradient(135deg, #f8f1e4, #eef6ef);
  border: 1px solid #eadfc9;
  border-radius: 8px;
  margin-bottom: 12px;
}

.adherence-ring {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--ink), var(--sage-deep));
  color: white;
  font-size: 15px;
  font-weight: 900;
}

.progress-track {
  height: 9px;
  border-radius: 999px;
  background: #eadfc9;
  overflow: hidden;
  margin-bottom: 14px;
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--sage-deep), var(--gold));
  transition: width 0.25s ease;
}

.not-due-list {
  display: grid;
  gap: 7px;
  padding: 10px 12px;
  background: rgba(246, 247, 243, 0.72);
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.muted-pill {
  background: #f4f5f1;
  color: var(--muted);
}

.food-rank {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--ink), #4d3823);
  color: white;
  font-size: 12px;
  font-weight: 900;
}

.food-row {
  grid-template-columns: 34px 1fr;
}

.empty {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.7);
}

.footer-note {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
  margin-top: 24px;
  text-align: center;
}

@media (max-width: 900px) {
  .portal-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: none;
  }

  .mobile-topbar {
    display: grid;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(251, 248, 240, 0.95);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(198, 164, 97, 0.25);
    padding: 12px;
    margin: -26px -14px 18px;
  }

  .mobile-topbar-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
  }

  .mobile-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 12px;
    margin-bottom: 2px;
  }

  .mobile-tabs .nav-tab {
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(198, 164, 97, 0.24);
  }

  .grid-two,
  .grid-three {
    grid-template-columns: 1fr;
  }

  .meal-grid {
    grid-template-columns: 1fr;
  }

  .hero-band {
    min-height: 190px;
    padding: 20px;
  }

  .portal-main {
    padding: 26px 14px;
  }
}

@media (max-width: 560px) {
  .login-panel,
  .state-panel {
    min-height: min(620px, calc(100vh - 36px));
    padding: 24px 20px;
  }

  .login-panel h1,
  .state-panel h1 {
    font-size: 32px;
  }

  .brand-logo.login-logo {
    width: min(200px, 74vw);
  }

  .brand-logo.sidebar-logo {
    width: 60px;
  }

  .peptide-meta {
    grid-template-columns: 1fr;
  }

  .section-title {
    display: grid;
  }

  .meal-card-head,
  .meal-nav {
    display: grid;
  }

  .inline-meal-nav {
    grid-template-columns: 1fr;
  }

  .category-pill {
    width: 100%;
  }

  .meal-check,
  .compact-btn {
    width: 100%;
    justify-content: center;
  }
}
