/* =============================================================
   app-shell.css — shared paper / navy / mint theme for profile,
   book-consult, and food-diary pages. Mirrors the design tokens
   in templates/dashboard.html. Dashboard keeps its own inline copy.
   ============================================================= */

:root {
  --navy-950: #07162C;
  --navy-900: #0B1F3A;
  --navy-800: #102A4C;
  --navy-700: #1B3866;
  --navy-500: #3A5B8C;
  --navy-300: #8AA0BE;

  --ink:    #1A1F2B;
  --ink-2:  #4A5566;
  --ink-3:  #7A8493;

  --paper:   #F6F4EE;
  --paper-2: #EFECE3;
  --paper-3: #E6E2D6;

  --line:   #DCD6C6;
  --line-2: #C9C2AE;

  --mint-50:  #E6F7EF;
  --mint-200: #B8ECD2;
  --mint-400: #5ED3A3;
  --mint-500: #10B981;
  --mint-700: #047857;

  --coral:    #E8795A;
  --coral-50: #FBEFE9;
  --butter:   #F2C879;
  --sky:      #B5D1E8;

  --r-sm: 8px;
  --r:    12px;
  --r-lg: 18px;
  --r-xl: 24px;

  --pad: 32px;
  --gap: 20px;

  --font-display: "Inter Tight", "Inter", system-ui, sans-serif;
  --font-ui:      "Inter", system-ui, sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, monospace;
}

/* -------------------------------------------------------------
   Reset & defaults
   ------------------------------------------------------------- */
* { box-sizing: border-box; }
html, body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
input, select, textarea { font: inherit; color: inherit; }

.mono    { font-family: var(--font-mono); font-feature-settings: "tnum" 1, "zero" 1; }
.display { font-family: var(--font-display); letter-spacing: -0.02em; }
.kicker  { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }

/* -------------------------------------------------------------
   App shell grid
   ------------------------------------------------------------- */
.app        { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.side-w     { width: 260px; }
.side {
  position: sticky; top: 0; align-self: start; height: 100vh;
  background: #FBFAF5; color: var(--ink);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 22px 18px; gap: 18px;
}

/* Brand */
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 14px; border-bottom: 1px solid var(--paper-3); }
.brand-mark {
  width: 34px; height: 34px; border-radius: 50%;
  object-fit: cover; flex-shrink: 0; display: block;
}
.brand-name { font-family: var(--font-display); font-weight: 600; font-size: 15.5px; letter-spacing: -0.01em; color: var(--navy-900); line-height: 1.1; }
.brand-sub  { font-size: 11px; color: var(--ink-3); letter-spacing: .04em; text-transform: uppercase; margin-top: 2px; }

/* Nav */
.nav-group-title { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); padding: 6px 10px 2px; font-weight: 600; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; color: var(--ink-2); font-size: 13.5px; }
.nav a svg { width: 17px; height: 17px; opacity: .75; flex: 0 0 17px; }
.nav a:hover { background: rgba(11, 31, 58, .05); color: var(--navy-900); }
.nav a:hover svg { opacity: 1; }
.nav a.active { background: var(--mint-50); color: var(--mint-700); box-shadow: inset 0 0 0 1px rgba(16, 185, 129, .22); }
.nav a.active svg { color: var(--mint-700); opacity: 1; }
.nav a .badge { margin-left: auto; font-family: var(--font-mono); font-size: 10.5px; background: var(--mint-50); color: var(--mint-700); padding: 2px 7px; border-radius: 999px; border: 1px solid rgba(16, 185, 129, .18); }
.nav a.active .badge { background: #fff; }
.nav a .dot { margin-left: auto; width: 7px; height: 7px; border-radius: 50%; background: var(--coral); }

/* Sidebar footer */
.side-footer { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--paper-3); display: flex; flex-direction: column; gap: 10px; }
.consult {
  background: linear-gradient(165deg, #0E264A, #0B1F3A);
  border: 1px solid rgba(94, 211, 163, .22);
  border-radius: 14px; padding: 14px; color: #E7ECF3;
}
.consult .lbl { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: #5ED3A3; font-weight: 600; }
.consult .txt { margin: 6px 0 10px; font-family: var(--font-display); font-size: 14.5px; line-height: 1.35; color: #E7ECF3; }
.consult .cta { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: #A7F3D0; }

.billing-card {
  display: block; padding: 12px 14px; border-radius: 12px;
  background: var(--navy-900); color: #E7ECF3;
  border: 1px solid #16325E; text-decoration: none;
  transition: border-color .15s ease;
}
.billing-card:hover { border-color: var(--mint-500); }
.billing-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.billing-lbl  { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: #5ED3A3; font-weight: 600; }
.billing-plan {
  font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  background: rgba(255,255,255,.08); color: #E7ECF3; letter-spacing: .02em;
}
.billing-plan-pro   { background: color-mix(in srgb, var(--mint-500) 28%, transparent); color: #A7F3D0; }
.billing-plan-elite { background: linear-gradient(135deg,#17E2A1,#10B981); color: #06281E; }
.billing-sub { margin: 6px 0 8px; font-family: var(--font-display); font-size: 13.5px; color: #E7ECF3; }
.billing-cta { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: #A7F3D0; }
.profile-card { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; border: 1px solid var(--paper-3); background: #fff; }
.profile-card:hover { border-color: var(--line-2); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, #F2C879, #E8795A);
  display: grid; place-items: center;
  color: #0B1F3A; font-weight: 700; font-family: var(--font-display);
}
.profile-card .meta { line-height: 1.2; }
.profile-card .n    { font-weight: 600; font-size: 13.5px; color: var(--navy-900); }
.profile-card .p    { font-size: 11.5px; color: var(--ink-3); }

/* -------------------------------------------------------------
   Main content column
   ------------------------------------------------------------- */
.main { padding: var(--pad) var(--pad) 48px; max-width: 1260px; margin: 0 auto; width: 100%; }

.topbar { display: flex; align-items: center; gap: 16px; margin-bottom: 26px; }
.nav-toggle {
  display: none;
  width: 40px; height: 40px; border-radius: 12px;
  background: #fff; border: 1px solid var(--line); color: var(--ink-2);
  place-items: center;
}
.nav-toggle:hover { border-color: var(--line-2); color: var(--ink); }
.search {
  flex: 1; max-width: 420px; background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 14px; display: flex; align-items: center; gap: 10px; color: var(--ink-3); font-size: 13px;
}
.search kbd { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); background: var(--paper-2); border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; }
.topbar .spacer { flex: 1; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px;
  background: #fff; border: 1px solid var(--line);
  display: grid; place-items: center; color: var(--ink-2); position: relative;
}
.icon-btn:hover { border-color: var(--line-2); color: var(--ink); }
.icon-btn .dot-r { position: absolute; top: 9px; right: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--coral); box-shadow: 0 0 0 2px #fff; }

/* Buttons */
.btn        { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 10px; font-size: 13px; font-weight: 500; border: 1px solid transparent; white-space: nowrap; }
.btn-primary { background: var(--navy-900); color: #fff; }
.btn-primary:hover { background: var(--navy-800); }
.btn-ghost  { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--line-2); }
.btn-mint   { background: var(--mint-500); color: #06281E; }
.btn-mint:hover { background: #0EA971; }
.btn-danger { background: #fff; border-color: var(--line); color: var(--coral); }
.btn-danger:hover { background: var(--coral-50); border-color: var(--coral); }
.btn-logout {
  width: 100%; justify-content: center; cursor: pointer;
  background: var(--coral); border-color: var(--coral); color: #fff;
}
.btn-logout:hover { background: #D26648; border-color: #D26648; }

/* Cards */
.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 22px; position: relative;
}
.card-hd { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-hd h3 { font-family: var(--font-display); font-weight: 600; font-size: 15px; margin: 0; letter-spacing: -0.005em; color: var(--navy-900); }
.card-hd .meta { font-size: 12px; color: var(--ink-3); }

/* Page header (kicker + h1 + meta row) */
.page-hd { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: end; margin-bottom: 22px; }
.page-hd h1 { font-family: var(--font-display); font-weight: 600; font-size: 40px; letter-spacing: -0.025em; margin: 10px 0 0; color: var(--navy-900); line-height: 1.1; }
.page-hd p.lede { margin: 10px 0 0; color: var(--ink-2); font-size: 14.5px; max-width: 560px; line-height: 1.5; }
.page-hd .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Two-column content grid (main + rail) */
.content-grid { display: grid; grid-template-columns: 1fr 320px; gap: var(--gap); }

/* Generic input defaults */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 600; color: var(--ink-2); letter-spacing: .02em; display: flex; align-items: center; gap: 6px; }
.field .hint { font-size: 11.5px; color: var(--ink-3); }
.input,
.select,
.textarea {
  width: 100%;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 10px 12px;
  font-size: 13.5px;
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder,
.textarea::placeholder { color: var(--ink-3); }
.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--mint-500);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, .12);
}
.input:disabled { background: var(--paper-2); color: var(--ink-3); cursor: not-allowed; }
.textarea { min-height: 88px; resize: vertical; line-height: 1.45; }

/* Pill chip (display + selectable) */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--paper-2);
  color: var(--ink-2);
  border: 1px solid transparent;
  font-size: 12.5px; font-weight: 500;
  transition: background .15s, color .15s, border-color .15s, transform .15s;
  user-select: none;
}
.chip:hover { background: var(--paper-3); }
.chip.selected {
  background: var(--mint-50);
  color: var(--mint-700);
  border-color: rgba(16, 185, 129, .25);
  box-shadow: inset 0 0 0 1px rgba(16, 185, 129, .15);
}
button.chip { cursor: pointer; }

/* Toast */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 2500;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 3px solid var(--mint-500);
  color: var(--ink);
  padding: 12px 16px;
  border-radius: var(--r);
  box-shadow: 0 10px 30px -10px rgba(11, 31, 58, .25);
  font-size: 13.5px; font-weight: 500;
  transform: translateY(16px);
  opacity: 0;
  pointer-events: none;
  transition: transform .25s ease, opacity .25s ease;
  max-width: 360px;
}
.toast.show { transform: translateY(0); opacity: 1; pointer-events: auto; }
.toast.error   { border-left-color: var(--coral); }
.toast.success { border-left-color: var(--mint-500); }

/* Sidebar scrim (mobile drawer) */
.side-scrim {
  position: fixed; inset: 0; background: rgba(11, 31, 58, .45);
  z-index: 40; opacity: 0; pointer-events: none;
  transition: opacity .2s ease;
}
body.side-open .side-scrim { opacity: 1; pointer-events: auto; }

/* -------------------------------------------------------------
   Responsive — sidebar collapses to drawer below 1100px
   ------------------------------------------------------------- */
@media (max-width: 1100px) {
  .app { grid-template-columns: 1fr; }
  .side-w {
    position: fixed; top: 0; left: 0; z-index: 50;
    height: 100vh; width: 272px;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: 0 20px 40px -20px rgba(11, 31, 58, .3);
  }
  body.side-open .side-w { transform: translateX(0); }
  .nav-toggle { display: grid; }
  .main { padding: 24px 20px 48px; }
  .content-grid { grid-template-columns: 1fr; }
  .page-hd { grid-template-columns: 1fr; }
  .page-hd .actions { justify-self: start; }
}

@media (max-width: 640px) {
  .page-hd h1 { font-size: 28px; }
  .card { padding: 18px; border-radius: var(--r); }
  .main { padding: 16px 14px 48px; }
  .topbar { gap: 10px; margin-bottom: 18px; }
  .search { display: none; }
  .toast { right: 12px; left: 12px; max-width: none; }
}

/* -------------------------------------------------------------
   Auth screens (login, register) — centered card layout
   ------------------------------------------------------------- */
.auth-topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 32px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.auth-topbar .brand { padding: 0; border: 0; }
.auth-topbar .spacer { flex: 1; }
.auth-topbar .actions { display: flex; gap: 8px; align-items: center; }
.auth-topbar .meta { font-size: 12.5px; color: var(--ink-3); }
.auth-topbar .meta a { color: var(--mint-700); font-weight: 500; }
.auth-topbar .meta a:hover { text-decoration: underline; }

.auth-main {
  min-height: calc(100vh - 73px); /* minus the topbar height */
  display: flex; align-items: center; justify-content: center;
  padding: 48px 20px;
}

.auth-card {
  width: 100%; max-width: 440px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  padding: 40px 36px 32px;
  box-shadow: 0 30px 80px -30px rgba(11, 31, 58, .18);
}
.auth-card .kicker { display: inline-block; margin-bottom: 10px; }
.auth-card h1 {
  font-family: var(--font-display); font-weight: 600;
  font-size: 28px; letter-spacing: -0.02em; line-height: 1.15;
  color: var(--navy-900);
  margin: 0 0 10px;
}
.auth-card .lede {
  margin: 0 0 24px;
  font-size: 13.5px; color: var(--ink-2); line-height: 1.55;
}
.auth-card form { display: flex; flex-direction: column; gap: 14px; }
.auth-card .field { gap: 6px; }

.auth-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 18px 0;
  color: var(--ink-3); font-size: 11.5px; text-transform: uppercase; letter-spacing: .14em; font-weight: 600;
}
.auth-divider::before,
.auth-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--paper-3);
}

.auth-error {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: var(--r);
  background: var(--coral-50);
  border: 1px solid rgba(232, 121, 90, .3);
  border-left: 3px solid var(--coral);
  color: #9C4B34;
  font-size: 13px; line-height: 1.4;
}
.auth-error.hidden { display: none; }

.auth-success {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: var(--r);
  background: var(--mint-50);
  border: 1px solid rgba(16, 185, 129, .3);
  border-left: 3px solid var(--mint-500);
  color: var(--mint-700);
  font-size: 13px; line-height: 1.4;
}
.auth-success.hidden { display: none; }

.auth-foot {
  margin-top: 22px; padding-top: 18px;
  border-top: 1px solid var(--paper-3);
  text-align: center;
  font-size: 12.5px; color: var(--ink-3);
}
.auth-foot a { color: var(--mint-700); font-weight: 500; }
.auth-foot a:hover { text-decoration: underline; }

.btn-block { width: 100%; justify-content: center; }

.field-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.google-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--r);
  background: #fff; border: 1px solid var(--line); color: var(--ink);
  font-size: 14px; font-weight: 500;
  transition: border-color .15s, background .15s;
}
.google-btn:hover { border-color: var(--line-2); background: var(--paper-2); }
.google-btn svg { width: 18px; height: 18px; flex-shrink: 0; }

@media (max-width: 480px) {
  .auth-topbar { padding: 14px 16px; }
  .auth-topbar .meta { display: none; }
  .auth-card { padding: 32px 24px 24px; border-radius: var(--r-lg); }
  .auth-card h1 { font-size: 24px; }
  .field-grid-2 { grid-template-columns: 1fr; gap: 14px; }
}
