/* GRADUS Coach & Nutri — shared panel styles. Same tokens as the app and the landing. */
:root {
  --void: #0b0d10; --carbon: #11151a; --surface: #15181d; --surface2: #1b2027; --surface3: #20262e;
  --line: #242b34; --line2: #2c3440; --snow: #f7f9fc; --mist: #9aa4b2; --dim: #6d7683;
  --volt: #b8ff3d; --ember: #ff9f1c; --purple: #8b5cf6; --blue: #48cfea; --success: #3ddc97; --danger: #ff5c5c; --warning: #f5b700;
  --role: var(--volt);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--void); color: var(--snow); font: 14px/1.5 Inter, system-ui, -apple-system, 'Segoe UI', sans-serif; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { display: block; }
:focus-visible { outline: 2px solid var(--volt); outline-offset: 2px; border-radius: 6px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--mist); }
.dim { color: var(--dim); }
.hide { display: none !important; }

/* layout */
.app { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px; padding: 22px 14px; border-right: 1px solid var(--line); background: var(--carbon); }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 800; letter-spacing: 0.16em; font-size: 15px; }
.side-brand svg { width: 26px; height: 26px; }
.side-brand small { margin-left: auto; letter-spacing: 0.08em; font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 99px; background: color-mix(in srgb, var(--role) 16%, transparent); color: var(--role); }
.side a.nav { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: var(--mist); font-weight: 500; transition: background 0.15s, color 0.15s; }
.side a.nav svg { width: 19px; height: 19px; }
.side a.nav:hover { background: rgba(255, 255, 255, 0.04); color: var(--snow); }
.side a.nav.on { background: var(--surface2); color: var(--snow); box-shadow: inset 2px 0 0 var(--role); }
.side a.nav .badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--ember); color: var(--void); font-size: 11px; font-weight: 800; display: grid; place-items: center; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.me { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.me b { display: block; font-size: 13px; }
.me small { color: var(--mist); font-size: 11.5px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 14px; padding: 18px 32px; background: rgba(11, 13, 16, 0.85); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.top h1 { font-size: 22px; letter-spacing: -0.03em; font-weight: 800; }
.top .sub { color: var(--mist); font-size: 13px; }
.top-actions { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }
.content { padding: 28px 32px 64px; display: flex; flex-direction: column; gap: 24px; }
.demo-bar { display: flex; align-items: center; gap: 12px; padding: 10px 32px; font-size: 12.5px; color: var(--mist); background: color-mix(in srgb, var(--warning) 10%, var(--void)); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.demo-bar b { color: var(--warning); }
.demo-bar > svg { width: 16px; height: 16px; flex: none; color: var(--warning); }
.demo-bar .btn-s { margin-left: auto; }
.btn.menu-btn { display: none; }

/* grid helpers */
.grid { display: grid; gap: 20px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.row { display: flex; align-items: center; gap: 12px; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-sm { display: flex; flex-direction: column; gap: 6px; }

/* cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 22px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.card-h { display: flex; align-items: center; gap: 12px; justify-content: space-between; flex-wrap: wrap; }
.card-h h2, .card-h h3 { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.card-h .sub { color: var(--mist); font-size: 12.5px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 20px; display: flex; flex-direction: column; gap: 6px; }
.kpi .lbl { color: var(--mist); font-size: 12.5px; font-weight: 500; }
.kpi .val { font-size: 34px; font-weight: 900; letter-spacing: -0.04em; line-height: 1.05; }
.kpi .delta { font-size: 12px; color: var(--mist); }
.kpi .delta.up { color: var(--success); }
.kpi .delta.down { color: var(--ember); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 12px; border: 1px solid transparent; font-weight: 700; font-size: 13.5px; cursor: pointer; background: transparent; white-space: nowrap; transition: transform 0.15s, background 0.15s, border-color 0.15s; }
.btn svg { width: 17px; height: 17px; }
.btn:active { transform: translateY(1px); }
.btn-p { background: var(--volt); color: var(--void); }
.btn-p:hover { filter: brightness(1.05); }
.btn-s { background: var(--surface2); border-color: var(--line2); color: var(--snow); }
.btn-s:hover { border-color: var(--mist); }
.btn-g { color: var(--mist); }
.btn-g:hover { color: var(--snow); background: rgba(255, 255, 255, 0.05); }
.btn-d { background: rgba(255, 92, 92, 0.12); border-color: rgba(255, 92, 92, 0.5); color: var(--danger); }
.btn-sm { min-height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 10px; }
.btn-icon { width: 36px; min-height: 36px; padding: 0; }
.btn[disabled] { opacity: 0.5; pointer-events: none; }

/* tags & avatars */
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 700; white-space: nowrap; background: var(--surface3); color: var(--mist); }
.tag svg { width: 12px; height: 12px; }
.t-volt { background: rgba(184, 255, 61, 0.14); color: var(--volt); }
.t-ember { background: rgba(255, 159, 28, 0.14); color: var(--ember); }
.t-danger { background: rgba(255, 92, 92, 0.14); color: var(--danger); }
.t-success { background: rgba(61, 220, 151, 0.14); color: var(--success); }
.t-warning { background: rgba(245, 183, 0, 0.14); color: var(--warning); }
.t-blue { background: rgba(72, 207, 234, 0.14); color: var(--blue); }
.t-purple { background: rgba(139, 92, 246, 0.16); color: var(--purple); }
.av { width: 38px; height: 38px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: var(--void); }
.av.lg { width: 64px; height: 64px; font-size: 22px; }
.av.sm { width: 30px; height: 30px; font-size: 11px; }

/* lists / tables */
.list { display: flex; flex-direction: column; }
.li { display: flex; align-items: center; gap: 14px; padding: 13px 4px; border-top: 1px solid var(--line); min-width: 0; }
.li:first-child { border-top: 0; }
a.li:hover, button.li:hover { background: rgba(255, 255, 255, 0.025); }
button.li { width: 100%; text-align: left; background: none; border: 0; border-top: 1px solid var(--line); cursor: pointer; border-radius: 0; }
.li b { font-weight: 600; }
.li small { display: block; color: var(--mist); font-size: 12.5px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 18px; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th { text-align: left; font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); font-weight: 700; padding: 12px 16px; background: var(--carbon); border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr { cursor: pointer; transition: background 0.12s; }
tbody tr:hover { background: rgba(255, 255, 255, 0.025); }
.cell-person { display: flex; align-items: center; gap: 12px; }
.cell-person b { display: block; }
.cell-person small { color: var(--mist); font-size: 12px; }

/* bars, rings, charts */
.bar { height: 7px; border-radius: 7px; background: var(--surface3); overflow: hidden; min-width: 60px; }
.bar i { display: block; height: 100%; border-radius: 7px; background: var(--role); }
.meter { display: flex; align-items: center; gap: 10px; }
.meter .bar { flex: 1; }
.meter b { width: 40px; text-align: right; font-size: 12.5px; }
.chart { width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--dim); font-size: 10px; font-family: inherit; }
.heat { max-width: 440px; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.heat i { aspect-ratio: 1; border-radius: 5px; background: var(--surface3); }
.heat i.l1 { background: color-mix(in srgb, var(--role) 30%, var(--surface3)); }
.heat i.l2 { background: color-mix(in srgb, var(--role) 65%, var(--surface3)); }
.heat i.l3 { background: var(--role); }
.heat i.rest { background: transparent; border: 1px dashed var(--line2); }
.heat i.frozen { background: rgba(72, 207, 234, 0.4); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--mist); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* attention */
.attn { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 16px; background: var(--carbon); border: 1px solid var(--line); }
.attn .ic { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.attn .ic svg { width: 19px; height: 19px; }

/* tabs & segmented */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 11px 14px; color: var(--mist); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.on { color: var(--snow); border-color: var(--role); }
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.seg button { border: 0; background: transparent; color: var(--mist); font-weight: 600; font-size: 12.5px; padding: 6px 12px; border-radius: 9px; cursor: pointer; }
.seg button.on { background: var(--surface3); color: var(--snow); }

/* forms */
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--mist); }
.input, .select, .textarea { width: 100%; min-height: 42px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--line2); background: var(--surface2); color: var(--snow); font-size: 14px; font-weight: 500; }
.textarea { padding: 10px 12px; min-height: 90px; resize: vertical; line-height: 1.5; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--volt); }
.input.sm { min-height: 34px; padding: 0 8px; font-size: 13px; border-radius: 9px; }
.search { position: relative; }
.search svg { position: absolute; left: 12px; top: 50%; width: 17px; height: 17px; transform: translateY(-50%); color: var(--dim); }
.search .input { padding-left: 38px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--snow); font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--volt); }

/* lock (scope not shared) */
.lock { display: flex; align-items: center; gap: 14px; padding: 18px; border-radius: 16px; border: 1px dashed var(--line2); color: var(--mist); }
.lock svg { width: 22px; height: 22px; flex: none; }

/* chat */
.chat { display: grid; grid-template-columns: 300px minmax(0, 1fr); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; min-height: 560px; background: var(--surface); }
.chat-list { border-right: 1px solid var(--line); overflow-y: auto; max-height: 72vh; }
.chat-list a { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.chat-list a.on { background: var(--surface2); }
.chat-list a small { display: block; color: var(--mist); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-thread { display: flex; flex-direction: column; min-width: 0; }
.chat-msgs { flex: 1; padding: 20px; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; max-height: 60vh; }
.bubble { max-width: 72%; padding: 10px 14px; border-radius: 16px; background: var(--surface2); border: 1px solid var(--line); align-self: flex-start; }
.bubble.me { align-self: flex-end; background: color-mix(in srgb, var(--role) 14%, var(--surface2)); border-color: color-mix(in srgb, var(--role) 35%, var(--line)); }
.bubble small { display: block; font-size: 11px; color: var(--dim); margin-top: 4px; }
.chat-form { display: flex; gap: 10px; padding: 14px; border-top: 1px solid var(--line); }

/* builder */
.ex-row { display: grid; grid-template-columns: 28px minmax(0, 1.6fr) repeat(5, minmax(60px, 0.6fr)) 196px; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 14px; background: var(--carbon); border: 1px solid var(--line); }
.ex-head { display: grid; grid-template-columns: 28px minmax(0, 1.6fr) repeat(5, minmax(60px, 0.6fr)) 196px; gap: 10px; padding: 0 12px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--dim); font-weight: 700; }
.ex-row .n { color: var(--dim); font-weight: 700; text-align: center; }
.pick { max-height: 380px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.pick button { display: flex; align-items: center; gap: 12px; text-align: left; padding: 10px 12px; border-radius: 12px; background: var(--surface2); border: 1px solid var(--line); cursor: pointer; }
.pick button:hover { border-color: var(--line2); }

/* meal plan */
.meal { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.meal-h { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--carbon); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.meal-h b { font-size: 14px; }
.food { display: grid; grid-template-columns: minmax(0, 1.6fr) 90px repeat(4, minmax(56px, 0.5fr)) auto; gap: 10px; align-items: center; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 13px; }
.food:first-of-type { border-top: 0; }
.food .sub-swap { grid-column: 1 / -1; font-size: 12px; color: var(--mist); padding-left: 2px; }

/* timeline / audit */
.tl { display: flex; flex-direction: column; gap: 0; }
.tl div { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 13px; }
.tl div:first-child { border-top: 0; }
.tl time { color: var(--dim); width: 128px; flex: none; font-size: 12px; }

/* modal & toast */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, 0.62); display: grid; place-items: center; padding: 20px; animation: fade 0.18s ease; }
.modal { width: min(560px, 100%); max-height: 88vh; overflow-y: auto; background: var(--surface); border: 1px solid var(--line2); border-radius: 24px; padding: 26px; display: flex; flex-direction: column; gap: 16px; box-shadow: 0 40px 80px -30px #000; animation: rise 0.22s cubic-bezier(0.2, 1, 0.3, 1); }
.modal.wide { width: min(760px, 100%); }
.modal h2 { font-size: 20px; letter-spacing: -0.02em; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.code { font: 800 34px/1 ui-monospace, 'SFMono-Regular', Menlo, monospace; letter-spacing: 0.12em; padding: 18px; text-align: center; border-radius: 16px; background: var(--void); border: 1px dashed var(--line2); color: var(--volt); }
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 60; display: flex; flex-direction: column; gap: 10px; }
.toast { min-width: 260px; max-width: 380px; padding: 14px 16px; border-radius: 14px; background: var(--surface3); border: 1px solid var(--line2); box-shadow: 0 20px 40px -20px #000; font-size: 13.5px; animation: rise 0.22s cubic-bezier(0.2, 1, 0.3, 1); }
.toast b { display: block; }
.empty { padding: 36px 20px; text-align: center; color: var(--mist); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty svg { width: 30px; height: 30px; color: var(--dim); }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

/* embed: preview inside the landing page */
.embed .demo-bar, .embed .menu-btn { display: none !important; }
.embed body, .embed .app { pointer-events: none; }

/* responsive */
@media (max-width: 1180px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main, .g3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; z-index: 40; left: 0; top: 0; width: 272px; transform: translateX(-100%); transition: transform 0.25s; box-shadow: 30px 0 60px -30px #000; }
  .nav-open .side { transform: none; }
  .btn.menu-btn { display: inline-flex; }
  .top, .content, .demo-bar { padding-left: 18px; padding-right: 18px; }
  .g2 { grid-template-columns: minmax(0, 1fr); }
  .chat { grid-template-columns: minmax(0, 1fr); }
  .chat-list { max-height: 220px; border-right: 0; border-bottom: 1px solid var(--line); }
  .ex-head { display: none; }
  .ex-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ex-row .n { display: none; }
  .ex-row .ex-name { grid-column: 1 / -1; }
  .food { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .food .food-name { grid-column: 1 / -1; }
}
@media (max-width: 560px) {
  .g4 { grid-template-columns: minmax(0, 1fr); }
  .kpi .val { font-size: 28px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* small-screen polish */
.row.wrap > .search { flex: 1 1 240px; }
.seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg button { white-space: nowrap; }
.cell-person b, .cell-person small { white-space: nowrap; }

/* ───────── login & account (real mode) ───────── */
.account { display: flex; gap: 6px; }
.account .btn { flex: 1; justify-content: center; padding-left: 6px; padding-right: 6px; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(60% 50% at 50% 0%, color-mix(in srgb, var(--role) 10%, transparent), transparent 70%), var(--void); }
.login-card { width: min(420px, 100%); display: flex; flex-direction: column; gap: 14px; padding: 32px; border-radius: 24px; background: var(--surface); border: 1px solid var(--line); }
.login-card h1 { margin: 6px 0 0; font-size: 24px; letter-spacing: -0.02em; }
.login-card p { margin: 0; }
.login-brand { display: flex; align-items: center; gap: 10px; font-weight: 900; letter-spacing: 0.04em; }
.login-brand svg { width: 28px; height: 28px; }
.login-brand small { margin-left: 4px; font-size: 10px; font-weight: 700; letter-spacing: 0.08em; padding: 3px 8px; border-radius: 99px; background: color-mix(in srgb, var(--role) 16%, transparent); color: var(--role); }
.login-error { min-height: 18px; color: var(--ember); font-size: 13px; }
.login-card .btn-p { justify-content: center; }
.login-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 12.5px; }
.login-foot a { color: var(--mist); display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.login-foot a:hover { color: var(--snow); }
.login-foot svg { width: 14px; height: 14px; }
@media (max-width: 480px) { .login-card { padding: 24px 20px; } }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* accessibility */
.skip { position: absolute; left: 8px; top: -60px; z-index: 100; padding: 10px 14px; border-radius: 10px; background: var(--volt); color: var(--void); font-weight: 800; }
.skip:focus { top: 8px; }
.side a.nav:focus-visible, .btn:focus-visible, tbody tr:focus-visible { outline: 2px solid var(--volt); outline-offset: 2px; }
.btn, .input, .select { min-height: 40px; }
.dim { color: var(--mist); }
.measure-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.measure-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--mist); }
.measure-grid .input { width: 100%; }
.delta-up { color: var(--success); } .delta-down { color: var(--ember); }
