/* Synergy Optima • local-only interface */
:root {
    color-scheme: light;
    --canvas: #f7f4ef;
    --paper: #fffdfa;
    --ink: #282b33;
    --muted: #545c69;
    --line: #e0d9d1;
    --navy: #334965;
    --navy-link: #435a77;
    --accent: #e4c9b2;
    --tint: #e9edf3;
    --sand: #eee4d9;
    --radius: 20px;
    --rail: 222px;
    font: 16px/1.5 "Inter", "Aptos", "Segoe UI", Arial, sans-serif;
    color: var(--ink);
    background: var(--canvas);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 280px; }
a { color: var(--navy-link); text-underline-offset: .18em; }
a:hover { color: #392820; }
button, input, textarea, select { font: inherit; }
button, .btn, .button, input[type="submit"] {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    cursor: pointer; min-height: 42px; padding: .57rem 1rem; border: 1px solid transparent;
    border-radius: 10px; background: var(--navy); color: white; text-decoration: none;
    font-weight: 650; font-size: .91rem; line-height: 1.35; text-align: center;
}
button:hover, .btn:hover, .button:hover, input[type="submit"]:hover { background: #526985; color: white; }
button:disabled { opacity: .55; cursor: default; }
button.secondary, .btn.secondary, .button.secondary, .btn-outline, .secondary-button {
    background: var(--paper); border-color: #c9cfd8; color: var(--navy-link);
}
button.secondary:hover, .btn.secondary:hover, .button.secondary:hover { background: var(--tint); }
.btn-primary, .primary { background: var(--navy); color: white; }
.danger, .btn-danger { color: #87352e; background: #fff0e9; border-color: #e4b8a8; }
button.danger:hover, .btn-danger:hover { color: #702f25; background: #ffdfd4; }
:focus-visible { outline: 3px solid #526985; outline-offset: 4px; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline-offset: 1px; }
.icon { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.visually-hidden, .sr-only { position: absolute !important; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }
[hidden] { display: none !important; }
.skip-link { position: fixed; left: 1rem; top: -6rem; padding: .8rem 1.25rem; border-radius: 8px; background: white; z-index: 100; }
.skip-link:focus { top: 1rem; }
.site-sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 30; width: var(--rail);
    display: flex; flex-direction: column; overflow-y: auto;
    padding: 34px 15px 20px; border-right: 1px solid var(--line); background: #f3f0eb;
}
.brand {
    display: inline-flex; align-items: center; gap: 10px; white-space: nowrap;
    color: var(--navy); text-decoration: none; font-size: 1.13rem; font-weight: 460;
    line-height: 1; letter-spacing: -.055em;
}
.brand b { font-weight: 760; }
.brand-mark { width: 34px; height: 34px; padding: 3px; object-fit: contain; flex-shrink: 0; }
.nav-head { display: flex; align-items: center; justify-content: space-between; padding: 0 7px; }
.primary-nav { display: grid; gap: 5px; margin-top: 43px; }
.nav-link {
    color: #424c5a; width: 100%; min-height: 44px; border-radius: 10px;
    display: flex; align-items: center; justify-content: flex-start; gap: 12px;
    text-align: left; padding: 10px 14px; text-decoration: none; background: transparent; border: 0;
    font-size: .94rem; line-height: 1.4; font-weight: 550;
}
.nav-link .icon { width: 19px; height: 19px; }
.nav-link:hover { color: var(--navy); background: #eaedf2; }
.nav-link.active { color: var(--navy); font-weight: 740; background: #dce4ee; }
.nav-foot { margin-top: auto; padding-top: 32px; }
.nav-foot > a { border-top: 1px solid var(--line); border-radius: 0; padding-top: 15px; }
.nav-foot form { margin: 2px 0 0; }
.mobile-head, .menu-close, .menu-scrim { display: none; }
.main-panel {
    max-width: 1640px; padding: clamp(28px, 3.7vw, 61px) clamp(22px, 4.15vw, 78px) 65px;
    margin-left: var(--rail); outline: none; min-height: 100vh;
}
.guest-head { max-width: 1280px; margin: 0 auto; padding: 32px clamp(20px, 6vw, 80px); }
.guest-panel { max-width: 1040px; margin: clamp(12px, 4vw, 60px) auto; padding: 0 clamp(20px, 4vw, 60px) 54px; }
.guest-panel > form, .guest-panel > .card { max-width: 570px; }
h1, h2, h3, h4, p { margin: 0 0 .75rem; }
h1, h2, h3, h4 { text-wrap: balance; color: var(--ink); }
h1 { font-size: clamp(2rem, 4.1vw, 3.45rem); line-height: 1.04; font-weight: 600; letter-spacing: -.055em; }
h2 { font-size: clamp(1.28rem, 2vw, 1.65rem); line-height: 1.18; font-weight: 640; letter-spacing: -.035em; }
h3 { font-size: 1.08rem; line-height: 1.25; font-weight: 660; letter-spacing: -.015em; }
h4 { font-size: 1rem; line-height: 1.35; }
small { color: var(--muted); }
strong { font-weight: 680; }
.eyebrow, .kicker, .overline, .eyeline { display: block; color: #684d41; font-size: .69rem; font-weight: 760; letter-spacing: .135em; line-height: 1.4; text-transform: uppercase; }
.muted, .subtle, .help, .hint, .small, .help-text, .field-hint { color: var(--muted); }
.help, .hint, .small, .help-text, .field-hint { font-size: .86rem; }
.lead { color: var(--muted); font-size: 1.05rem; max-width: 65ch; }
.page-header, .page-head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 16px; margin-bottom: 25px; }
.page-header > :last-child, .page-head > :last-child { margin-bottom: 0; }
.page-header p:last-child, .page-head p:last-child { margin-bottom: 0; }
.card, .panel, .surface {
    min-width: 0; padding: clamp(18px, 2.1vw, 32px);
    border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper);
}
.card > :last-child, .panel > :last-child { margin-bottom: 0; }
.main-panel > .card + .card, .main-panel > section + section,
.guest-panel > .card + .card { margin-top: 18px; }
.grid, .card-grid, .two-column, .two-col, .dashboard-grid { display: grid; gap: 18px; }
.grid, .card-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.two-column, .two-col, .dashboard-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
.stack { display: grid; gap: 14px; }
.actions, .toolbar, .button-row, .form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.section-head, .card-head, .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 17px; }
.section-head > *, .card-head > *, .section-heading > * { margin: 0; }
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="submit"]), select, textarea {
    width: 100%; min-width: 0; padding: .67rem .77rem; border: 1px solid #b7bfc9;
    border-radius: 8px; background: #fff; color: var(--ink); line-height: 1.4;
}
input[type="checkbox"], input[type="radio"] { accent-color: var(--navy-link); width: 1.05em; height: 1.05em; vertical-align: middle; margin-right: .38em; }
textarea { min-height: 88px; resize: vertical; }
label { font-size: .91rem; font-weight: 600; }
label:has(> input:not([type="checkbox"]):not([type="radio"])), label:has(> textarea), label:has(> select) { display: grid; gap: 6px; }
fieldset { min-width: 0; margin: 12px 0; padding: 18px; border: 1px solid var(--line); border-radius: 12px; }
legend { font-weight: 700; padding: 0 5px; }
.form-grid, .fields { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,210px),1fr)); gap: 14px; }
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-block: 12px; }
.inline-form label { flex: 1 1 125px; }
.inline-form button { margin-top: 0 !important; }
.list-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 7px 14px; padding-block: 13px; border-bottom: 1px solid var(--line); }
.list-row:last-child { border: 0; }
.list-row div > small, td strong + small { display: block; }
.main-panel > .actions + .grid, .main-panel > .grid + section, .main-panel > .grid + .grid, .main-panel > .card + .grid { margin-top: 18px; }
.stack { align-content: start; }
.stack > p, .stack > h2, .stack > h3, .stack > h4 { margin: 0; }
.stack article + article { border-top: 1px solid var(--line); padding-top: 12px; }
details[open] > summary { margin-bottom: 14px; }
.field, .form-group { display: grid; gap: 6px; margin-bottom: 15px; }
.full, .full-width, .span-all { grid-column: 1/-1; }
input[readonly] { background: #eeece8 !important; }
input[type=file] { font-size: .85rem; }
input[type=file]::file-selector-button { border: 0; background: var(--tint); color: var(--navy-link); border-radius: 5px; padding: 5px 9px; margin-right: 10px; }
form > button:last-child:not(:only-child) { margin-top: 8px; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; font-variant-numeric: tabular-nums; }
thead th { color: var(--muted); font-size: .78rem; font-weight: 670; }
th, td { text-align: left; vertical-align: top; padding: 12px 8px; border-bottom: 1px solid var(--line); }
td:first-child, th:first-child { padding-left: 0; }
td:last-child, th:last-child { padding-right: 0; }
tbody tr:last-child td { border-bottom: 0; }
.table-wrap, .table-scroll { overflow-x: auto; max-width: 100%; }
details { margin: 12px 0; }
summary { cursor: pointer; color: var(--navy-link); font-weight: 650; }
.notice, .alert, .flash, .callout, .validation-summary-errors { padding: 13px 16px; border: 1px solid #c8d4e0; border-radius: 10px; background: #eef2f7; color: #344e6a; }
.validation-summary-errors, .field-validation-error, .error { color: #863c32; }
.validation-summary-errors { border-color: #eac5bc; background: #fdf0ea; }
.validation-summary-errors ul { margin: 0; padding-left: 1.1rem; }
.validation-summary-valid, .field-validation-valid { display: none; }
.input-validation-error { border-color: #a13d38 !important; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
img { max-width: 100%; }
.text-link { display: inline-flex; align-items: center; gap: 7px; color: var(--navy); font-weight: 690; font-size: .84rem; text-decoration: none; }
.text-link:hover { text-decoration: underline; }
.text-link .icon { width: 15px; height: 15px; }
.today-header { margin-bottom: 23px; }
.today-header .eyebrow { display: flex; align-items: center; gap: 7px; margin-bottom: 8px; }
.today-header .eyebrow .icon { width: 14px; height: 14px; }
.today-header h1 { margin-bottom: 8px; }
.today-header .briefing { color: var(--muted); margin-bottom: 0; }
.trajectory {
    position: relative; overflow: hidden; display: grid; grid-template-columns: minmax(180px,.7fr) minmax(220px,1.3fr); gap: clamp(18px,3.2vw,55px);
    padding: clamp(22px,3.45vw,52px); border-radius: var(--radius);
    background: linear-gradient(111deg, #293b53 0%, #405775 65%, #526985 100%); color: #fff8ef;
}
.trajectory .eyebrow { color: #e4c9b2; }
.trajectory h2 { color: white; margin: 8px 0 1px; font-size: clamp(1.4rem,2.3vw,2rem); font-weight: 530; }
.hero-number { display: flex; align-items: baseline; gap: 7px; font-variant-numeric: tabular-nums; letter-spacing: -.075em; font-size: clamp(3.3rem,5.6vw,6rem); line-height: 1.11; font-weight: 510; }
.hero-number small { font-size: clamp(1.1rem,1.8vw,1.5rem); color: #e1e7ef; font-weight: 470; letter-spacing: -.02em; }
.hero-when { color: #e1e7ef; margin: 3px 0 0; font-size: .79rem; }
.hero-target { display: inline-flex; align-items: center; gap: 6px; margin: 14px 0 0; color: #f1d9c4; font-size: .85rem; font-weight: 600; }
.hero-target .icon { width: 16px; height: 16px; }
.trend-figure { align-self: stretch; display: flex; flex-direction: column; justify-content: flex-end; min-width: 0; margin: 0; }
.trend-figure figcaption { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 5px; padding-bottom: 8px; color: #e6edf7; font-size: .78rem; }
.trend-figure figcaption span:first-child { display: inline-flex; align-items: center; gap: 6px; }
.chart-key { display: inline-block; width: 13px; height: 3px; border-radius: 2px; background: var(--accent); }
.trend-chart { width: 100%; height: clamp(112px,10vw,160px); display: block; overflow: visible; }
.chart-dates { display: flex; justify-content: space-between; color: #e1e7ef; margin-top: 5px; font-size: .72rem; }
.chart-empty { display: grid; align-content: center; height: 130px; padding: 16px; border-block: 1px dashed #a3afbd; color: #ebeff4; font-size: .9rem; }
.metrics-row { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; margin-top: 15px; }
.metric-tile { display: flex; align-items: center; gap: clamp(9px,1.25vw,18px); padding: clamp(13px,1.5vw,22px); background: var(--paper); border: 1px solid var(--line); border-radius: 15px; }
.metric-icon, .schedule-icon { display: inline-grid; flex: none; place-items: center; width: 41px; height: 41px; border-radius: 13px; background: var(--tint); color: #405775; }
.metric-icon.sleep { background: #ece7f3; color: #65577b; }
.metric-icon.water { background: #e0e8f0; color: #3a5470; }
.metric-icon.steps { background: #eee3d8; color: #624637; }
.metric-label { margin: 0 0 1px; color: var(--muted); font-size: .77rem; font-weight: 610; }
.metric-value { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: 5px; font-size: clamp(1.2rem,2vw,1.7rem); font-weight: 640; line-height: 1.2; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.metric-value small { font-size: .78rem; font-weight: 450; letter-spacing: 0; }
.metric-value.missing { font-size: .98rem; font-weight: 530; line-height: 1.65; letter-spacing: -.015em; color: var(--muted); }
.today-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 17px; margin-top: 20px; align-items: stretch; }
.today-card { background: var(--paper); position: relative; }
.today-card h2 { margin-bottom: 0; }
.today-card .eyebrow { margin-bottom: 7px; }
.card-titlebar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.card-titlebar .icon { stroke-width: 1.7; color: #667990; }
.task-list, .schedule-list { margin: 0; padding: 0; list-style: none; }
.task-list li, .schedule-list li { border-bottom: 1px solid var(--line); }
.task-list li:last-child, .schedule-list li:last-child { border: 0; }
.task-toggle { width: 100%; border: 0; padding: 12px 0; background: transparent; color: var(--ink); text-align: left; justify-content: flex-start; gap: 11px; font-weight: 500; }
.task-toggle:hover { background: transparent; color: #526985; }
.task-toggle.checked .task-name { text-decoration: line-through; color: #5b6573; }
.task-box { display: grid; place-items: center; width: 22px; height: 22px; border: 1.5px solid #aab4c2; color: #fff; border-radius: 7px; flex: none; }
.task-box .icon { width: 15px; height: 15px; }
.checked .task-box { background: #526985; border-color: #526985; }
.task-list form, .task-toggle { margin: 0 !important; }
.schedule-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; }
.schedule-icon { width: 37px; height: 37px; border-radius: 11px; }
.schedule-icon.meal { background: #eee3d8; color: #654838; }
.schedule-item small, .schedule-item strong { display: block; }
.schedule-item small { font-size: .75rem; }
.schedule-item strong { font-size: .91rem; }
.card-bottom-link { display: inline-flex; margin-top: 15px; }
.count-label { font-size: .77rem; color: var(--muted); font-weight: 600; white-space: nowrap; }
.coach-note { background: #f0e9e1; border-color: #e3d6c9; }
.coach-note h2 { margin-bottom: 8px; }
.coach-note .kicker-row, .milestone .kicker-row { display: flex; gap: 7px; align-items: center; margin-bottom: 12px; }
.kicker-row .eyebrow { margin: 0; }
.kicker-row .icon { width: 17px; height: 17px; color: var(--navy-link); }
.coach-note p, .milestone p { color: #51463f; font-size: .92rem; }
.today-notice { display: flex; align-items: flex-start; gap: 12px; margin-top: 19px; }
.today-notice > div { flex: 1; }
.today-notice strong, .today-notice span { display: block; }
.today-notice span { font-size: .88rem; }
.today-notice form { flex: none; }
.today-notice button { min-height: 34px; padding: 5px 8px; margin: 0 !important; }
.today-notice .icon { width: 17px; height: 17px; }
@media (min-width: 1600px) { .main-panel { max-width: 1480px; } }
@media (max-width: 1080px) and (min-width:821px) { :root { --rail: 192px; } .main-panel { padding-inline:26px; } .site-sidebar { padding-inline:10px; } }
@media (max-width: 820px) {
    .mobile-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; background: #f3f0eb; border-bottom: 1px solid var(--line); }
    .main-panel { margin: 0 auto; padding: 25px clamp(15px,4vw,34px) 48px; }
    .site-sidebar { width: min(278px,87vw); transform: translateX(-101%); visibility: hidden; transition: transform .15s ease,visibility .15s; padding: 20px 15px; }
    .menu-open .site-sidebar { transform: none; visibility: visible; }
    .menu-open { overflow: hidden; }
    .menu-toggle, .menu-close { display:grid; place-items:center; min-height:38px; width:38px; padding:6px; color:var(--navy); background:transparent; }
    .menu-toggle:hover, .menu-close:hover { color:var(--navy); background:var(--tint); }
    .menu-scrim:not([hidden]) { position:fixed; inset:0; z-index:25; border:0; border-radius:0; width:100%; height:100%; background:rgba(36,45,61,.39); display:block; }
    .primary-nav { margin-top:26px; }
    .guest-head { padding: 22px; }
}
@media (max-width: 620px) {
    .trajectory { grid-template-columns: 1fr; gap: 16px; }
    .trend-chart { height: 105px; }
    .trend-chart text { font-size: 12px; }
    .hero-when { display: inline; }
    .hero-target { display: flex; margin-top: 8px; }
    .today-grid, .two-column, .two-col, .dashboard-grid { grid-template-columns:1fr; }
    .metrics-row { gap: 7px; }
    .metric-tile { align-items:flex-start; flex-direction:column; gap:8px; padding:12px 9px; border-radius:12px; }
    .metric-icon { width:31px; height:31px; border-radius:9px; }
    .metric-icon .icon { width:17px; height:17px; }
    .metric-value { font-size:1.25rem; }
    .metric-value.missing { font-size:.85rem; }
    .metric-value small { font-size:.68rem; }
    .today-header { gap:12px; }
    .today-header .btn { min-height:38px; font-size:.84rem; padding:.45rem .8rem; }
    .main-panel { overflow-wrap: anywhere; }
    .main-panel table { display:block; overflow-x:auto; max-width:100%; }
    .table-wrap table, .table-scroll table { display:table; }
    .card{ border-radius:15px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior:auto!important; transition-duration:0s!important; } }
@media print { .site-sidebar,.mobile-head,.menu-scrim,.skip-link,.guest-head,.btn,button { display:none!important; } .main-panel { margin:0; padding:0; } body { background:#fff; } .card,.trajectory { break-inside:avoid; } }

.trend-chart #chart-fill stop { stop-color: var(--accent); }
.trend-chart g[stroke] { stroke: #a3afbd; }
.trend-chart g[fill]:not([stroke]) { fill: #e1e7ef; }
.trend-chart polyline { stroke: var(--accent); }
.trend-chart circle { fill: #f1d9c4; stroke: var(--navy); }
