:root {
    color-scheme: light;
    --ink: #17221d;
    --ink-soft: #506059;
    --canvas: #f2f0e9;
    --paper: #fbfaf6;
    --paper-strong: #ffffff;
    --line: rgba(23, 34, 29, 0.11);
    --green: #1d7553;
    --green-soft: #dcecdf;
    --green-pale: #edf5ee;
    --blue: #4f75d8;
    --blue-soft: #dfe6fb;
    --orange: #d9934f;
    --orange-soft: #f6e4d2;
    --amber: #8b6522;
    --amber-soft: #f4e8c8;
    --shadow: 0 24px 70px rgba(31, 46, 38, 0.08);
    font-family:
        "Avenir Next", Avenir, Inter, ui-sans-serif, system-ui, -apple-system,
        BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-synthesis: none;
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    background: var(--canvas);
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at 78% -10%, rgba(91, 140, 108, 0.16), transparent 29rem),
        var(--canvas);
}

button,
input {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
    outline: 3px solid rgba(79, 117, 216, 0.35);
    outline-offset: 2px;
}

button {
    color: inherit;
}

.app-shell {
    width: min(100%, 1540px);
    margin: 0 auto;
}

.topbar {
    min-height: 82px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 38px;
    border-bottom: 1px solid var(--line);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--ink);
    font-size: 18px;
    font-weight: 750;
    letter-spacing: -0.04em;
    text-decoration: none;
}

.brand-mark {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    border-radius: 10px 10px 10px 3px;
    color: #f8fbf8;
    background: var(--ink);
    font-family: Georgia, serif;
    font-size: 20px;
    font-style: italic;
    font-weight: 600;
}

.brand-large {
    font-size: 21px;
}

.brand-large .brand-mark {
    width: 36px;
    height: 36px;
    font-size: 24px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mode-switch,
.period-switch {
    display: flex;
    align-items: center;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.48);
}

.mode-button,
.period-button {
    min-height: 34px;
    padding: 0 13px;
    border: 0;
    border-radius: 9px;
    color: var(--ink-soft);
    background: transparent;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    transition: color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.mode-button.is-active,
.period-button.is-active {
    color: var(--ink);
    background: var(--paper-strong);
    box-shadow: 0 5px 15px rgba(31, 46, 38, 0.08);
}

.profile-chip {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #15583e;
    background: #d8eadf;
    font-size: 13px;
    font-weight: 800;
}

.logout-form {
    margin: 0;
}

.logout-button {
    min-height: 36px;
    padding: 0 8px;
    border: 0;
    color: var(--ink-soft);
    background: transparent;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
}

.section-nav {
    position: sticky;
    z-index: 12;
    top: 0;
    padding: 8px 38px;
    border-bottom: 1px solid var(--line);
    background: rgba(242, 240, 233, 0.88);
    backdrop-filter: blur(18px);
}

.section-nav-inner {
    display: flex;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
}

.section-nav-inner::-webkit-scrollbar {
    display: none;
}

.section-nav-link {
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    padding: 0 12px;
    border-radius: 9px;
    color: var(--ink-soft);
    font-size: 11px;
    font-weight: 750;
    text-decoration: none;
    transition: color 160ms ease, background 160ms ease;
}

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

.section-nav-link.is-active {
    color: #15583e;
    background: var(--green-soft);
}

.section-anchor {
    scroll-margin-top: 62px;
}

.dashboard {
    padding: 36px 38px 56px;
}

.freshness-alert {
    min-height: 48px;
    margin-bottom: 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 10px 12px 10px 16px;
    border: 1px solid rgba(139, 101, 34, 0.15);
    border-radius: 14px;
    color: #674b1b;
    background: var(--amber-soft);
    font-size: 13px;
}

.freshness-alert[hidden] {
    display: none;
}

.freshness-alert > div {
    display: flex;
    align-items: center;
    gap: 8px;
}

.freshness-alert button {
    min-height: 30px;
    padding: 0 12px;
    border: 1px solid rgba(103, 75, 27, 0.18);
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.38);
    cursor: pointer;
    font-size: 12px;
    font-weight: 750;
}

.alert-dot {
    width: 7px;
    height: 7px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: #ad7b23;
    box-shadow: 0 0 0 5px rgba(173, 123, 35, 0.1);
}

.hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 32px;
    margin-bottom: 30px;
}

.eyebrow,
.panel-kicker {
    margin: 0 0 8px;
    color: var(--green);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.hero h1 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(39px, 4vw, 58px);
    font-weight: 500;
    letter-spacing: -0.052em;
    line-height: 1;
}

.hero-summary {
    max-width: 690px;
    margin: 12px 0 0;
    color: var(--ink-soft);
    font-size: 15px;
    line-height: 1.55;
}

.period-switch {
    flex: 0 0 auto;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.metric-card,
.panel {
    border: 1px solid rgba(23, 34, 29, 0.09);
    background: rgba(251, 250, 246, 0.88);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset;
    backdrop-filter: blur(18px);
}

.metric-card {
    min-height: 153px;
    padding: 22px;
    border-radius: 18px;
}

.metric-card-primary {
    color: #f7fbf8;
    border-color: transparent;
    background:
        radial-gradient(circle at 90% 10%, rgba(255, 255, 255, 0.15), transparent 8rem),
        #1d6d4f;
}

.metric-meta {
    min-height: 20px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}

.metric-label {
    color: var(--ink-soft);
    font-size: 12px;
    font-weight: 700;
}

.kicker-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 8px;
}

.kicker-row .panel-kicker {
    margin: 0;
}

.scope-label {
    min-height: 19px;
    display: inline-flex;
    align-items: center;
    padding: 0 7px;
    border: 1px solid rgba(23, 34, 29, 0.08);
    border-radius: 20px;
    color: #69766f;
    background: rgba(23, 34, 29, 0.035);
    font-size: 8px;
    font-weight: 750;
    letter-spacing: 0.025em;
    line-height: 1;
    white-space: nowrap;
}

.scope-label-count {
    color: #345bb7;
    border-color: rgba(79, 117, 216, 0.12);
    background: rgba(79, 117, 216, 0.08);
}

.scope-label-inverse {
    color: rgba(255, 255, 255, 0.72);
    border-color: rgba(255, 255, 255, 0.13);
    background: rgba(255, 255, 255, 0.08);
}

.metric-card-primary .metric-label,
.metric-card-primary .metric-foot {
    color: rgba(255, 255, 255, 0.7);
}

.metric-value {
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(28px, 3vw, 41px);
    letter-spacing: -0.04em;
    line-height: 1;
    white-space: nowrap;
}

.metric-value-small {
    font-size: clamp(26px, 2.5vw, 35px);
}

.metric-foot {
    margin-top: 12px;
    color: var(--ink-soft);
    font-size: 12px;
    line-height: 1.35;
}

.focus-panel {
    display: grid;
    grid-template-columns: minmax(310px, 1.05fr) minmax(0, 1.45fr);
    gap: 12px;
    margin-bottom: 12px;
    padding: 12px;
    border: 1px solid rgba(23, 34, 29, 0.09);
    border-radius: 20px;
    background:
        radial-gradient(circle at 90% 0%, rgba(79, 117, 216, 0.09), transparent 24rem),
        rgba(251, 250, 246, 0.88);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset;
    backdrop-filter: blur(18px);
}

.focus-lead {
    min-height: 128px;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    align-items: center;
    gap: 15px;
    padding: 20px;
    border-radius: 15px;
    color: #f8fbf8;
    background:
        radial-gradient(circle at 100% 0%, rgba(255, 255, 255, 0.12), transparent 11rem),
        var(--ink);
}

.focus-lead.is-attention {
    color: #3f2c0d;
    background:
        radial-gradient(circle at 100% 0%, rgba(255, 255, 255, 0.36), transparent 12rem),
        #ecd9a8;
}

.focus-lead.is-positive {
    background:
        radial-gradient(circle at 100% 0%, rgba(255, 255, 255, 0.14), transparent 11rem),
        #236447;
}

.focus-icon {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.08);
    font-size: 21px;
    font-weight: 500;
}

.focus-lead.is-attention .focus-icon {
    border-color: rgba(63, 44, 13, 0.12);
    background: rgba(255, 255, 255, 0.3);
}

.focus-lead .panel-kicker {
    margin-bottom: 5px;
    color: #9dceb0;
}

.focus-lead.is-attention .panel-kicker {
    color: #76571d;
}

.focus-lead h2 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(22px, 2vw, 29px);
    font-weight: 500;
    letter-spacing: -0.035em;
    line-height: 1.08;
}

.focus-lead p:last-child {
    max-width: 470px;
    margin: 8px 0 0;
    color: rgba(248, 251, 248, 0.65);
    font-size: 11px;
    line-height: 1.5;
}

.focus-lead.is-attention p:last-child {
    color: rgba(63, 44, 13, 0.7);
}

.focus-signals {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.focus-signal {
    min-width: 0;
    min-height: 128px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 17px;
    border: 1px solid rgba(23, 34, 29, 0.07);
    border-radius: 15px;
    background: rgba(255, 255, 255, 0.46);
}

.focus-signal::before {
    content: "";
    width: 8px;
    height: 8px;
    margin-bottom: 16px;
    border-radius: 50%;
    background: #98a19d;
    box-shadow: 0 0 0 5px rgba(152, 161, 157, 0.1);
}

.focus-signal.is-positive::before {
    background: var(--green);
    box-shadow: 0 0 0 5px rgba(29, 117, 83, 0.1);
}

.focus-signal.is-attention::before {
    background: #ad7b23;
    box-shadow: 0 0 0 5px rgba(173, 123, 35, 0.1);
}

.focus-signal > span,
.focus-signal > strong,
.focus-signal > small {
    display: block;
}

.focus-signal > span {
    color: var(--ink-soft);
    font-size: 9px;
    font-weight: 750;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.focus-signal > strong {
    margin-top: 5px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 19px;
    font-weight: 500;
    letter-spacing: -0.025em;
}

.focus-signal > small {
    margin-top: 5px;
    color: var(--ink-soft);
    font-size: 9px;
    line-height: 1.35;
}

.main-grid {
    display: grid;
    grid-template-columns: minmax(0, 2.05fr) minmax(300px, 0.95fr);
    gap: 12px;
    margin-bottom: 12px;
}

.panel {
    border-radius: 20px;
}

.chart-panel {
    min-width: 0;
    padding: 25px 25px 18px;
}

.panel-header,
.detail-header,
.week-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 22px;
}

.panel h2 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 24px;
    font-weight: 500;
    letter-spacing: -0.035em;
}

.chart-legend {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 14px;
    color: var(--ink-soft);
    font-size: 11px;
    font-weight: 650;
}

.chart-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.chart-legend i {
    display: inline-block;
    flex: 0 0 auto;
}

.legend-line {
    width: 17px;
    height: 2px;
    border-radius: 9px;
    background: var(--green);
}

.legend-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #9bb7a9;
}

.legend-bar {
    width: 7px;
    height: 9px;
    border-radius: 2px;
    background: var(--blue-soft);
}

.chart-wrap {
    position: relative;
    min-height: 356px;
    margin-top: 16px;
}

#progressChart {
    width: 100%;
    height: 356px;
    display: block;
}

.chart-empty {
    position: absolute;
    inset: 0;
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 6px;
    color: var(--ink-soft);
    text-align: center;
}

.chart-empty[hidden] {
    display: none;
}

.chart-empty strong {
    color: var(--ink);
}

.chart-empty span {
    font-size: 13px;
}

.chart-tooltip {
    position: absolute;
    z-index: 5;
    top: 8px;
    min-width: 160px;
    padding: 10px 12px;
    border: 1px solid rgba(23, 34, 29, 0.1);
    border-radius: 11px;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 10px 30px rgba(23, 34, 29, 0.12);
    pointer-events: none;
}

.chart-tooltip[hidden] {
    display: none;
}

.chart-tooltip strong,
.chart-tooltip span {
    display: block;
    white-space: nowrap;
}

.chart-tooltip strong {
    margin-bottom: 4px;
    font-size: 11px;
}

.chart-tooltip span {
    color: var(--ink-soft);
    font-size: 9px;
}

.chart-footer {
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding-top: 13px;
    border-top: 1px solid var(--line);
    color: var(--ink-soft);
    font-size: 11px;
}

.insight-pill {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0 10px;
    border-radius: 20px;
    color: #1d654a;
    background: var(--green-pale);
    font-weight: 750;
}

.energy-panel {
    display: flex;
    flex-direction: column;
    padding: 25px;
    overflow: hidden;
}

.balance-block {
    margin: 32px 0 23px;
}

.balance-value {
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(37px, 4vw, 53px);
    letter-spacing: -0.05em;
    line-height: 1;
}

.balance-caption {
    margin-top: 7px;
    color: var(--ink-soft);
    font-size: 13px;
}

.balance-track {
    position: relative;
    height: 8px;
    margin: 7px 0 22px;
    border-radius: 20px;
    background:
        linear-gradient(
            90deg,
            rgba(79, 117, 216, 0.17),
            rgba(23, 34, 29, 0.07) 49%,
            rgba(217, 147, 79, 0.19)
        );
    overflow: hidden;
}

.balance-center {
    position: absolute;
    z-index: 2;
    top: -2px;
    bottom: -2px;
    left: 50%;
    width: 2px;
    border-radius: 4px;
    background: var(--ink);
    opacity: 0.56;
}

.balance-fill {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 0;
    border-radius: 20px;
    background: var(--green);
    transition: left 350ms ease, width 350ms ease, background 350ms ease;
}

.energy-numbers {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.energy-numbers > div {
    min-height: 73px;
    padding: 13px;
    border-radius: 13px;
    background: rgba(23, 34, 29, 0.035);
}

.energy-numbers span,
.energy-numbers strong {
    display: block;
}

.energy-numbers span {
    margin-bottom: 6px;
    color: var(--ink-soft);
    font-size: 10px;
    font-weight: 700;
}

.energy-numbers strong {
    font-size: 17px;
    font-weight: 750;
}

.confidence-note {
    margin-top: auto;
    padding-top: 18px;
    color: var(--ink-soft);
    font-size: 11px;
    line-height: 1.5;
}

.calories-panel {
    margin-bottom: 12px;
    padding: 25px;
}

.calories-header,
.relationship-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
}

.view-switch,
.relation-switch {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    border-radius: 12px;
    background: rgba(23, 34, 29, 0.05);
}

.view-button,
.relation-button {
    min-height: 32px;
    padding: 0 12px;
    border: 0;
    border-radius: 9px;
    color: var(--ink-soft);
    background: transparent;
    cursor: pointer;
    font-size: 10px;
    font-weight: 750;
    transition: color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.view-button.is-active,
.relation-button.is-active {
    color: var(--ink);
    background: var(--paper-strong);
    box-shadow: 0 4px 12px rgba(31, 46, 38, 0.08);
}

.calories-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 250px;
    gap: 24px;
    margin-top: 20px;
}

.calories-chart-wrap {
    position: relative;
    min-width: 0;
    min-height: 286px;
}

#caloriesChart {
    width: 100%;
    height: 286px;
    display: block;
    cursor: crosshair;
}

.day-detail {
    min-height: 286px;
    display: flex;
    flex-direction: column;
    padding: 20px;
    border-radius: 17px;
    color: #f8fbf8;
    background:
        radial-gradient(circle at 90% 8%, rgba(255, 255, 255, 0.14), transparent 8rem),
        #234b3c;
}

.day-detail .panel-kicker {
    color: #9dceb0;
}

.day-detail h3 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 20px;
    font-weight: 500;
}

.day-calories {
    margin-top: 23px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 37px;
    letter-spacing: -0.04em;
    line-height: 1;
}

.day-balance {
    min-height: 18px;
    margin-top: 7px;
    color: rgba(248, 251, 248, 0.62);
    font-size: 10px;
}

.day-macros {
    display: grid;
    gap: 8px;
    margin-top: 22px;
}

.day-macros > div {
    display: grid;
    grid-template-columns: 7px 1fr auto;
    align-items: center;
    gap: 8px;
    font-size: 10px;
}

.day-macros i {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.day-macros span {
    color: rgba(248, 251, 248, 0.63);
}

.day-activity {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: auto;
    padding-top: 13px;
    border-top: 1px solid rgba(255, 255, 255, 0.13);
    font-size: 9px;
}

.day-activity span {
    color: rgba(248, 251, 248, 0.58);
}

.day-activity strong {
    font-size: 10px;
    text-align: right;
}

.calories-footer {
    min-height: 31px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    color: var(--ink-soft);
    font-size: 10px;
}

.calorie-color-legend {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 13px;
}

.calorie-color-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.calorie-color-legend i {
    width: 8px;
    height: 8px;
    border-radius: 3px;
}

.calorie-low {
    background: var(--blue);
}

.calorie-near {
    background: var(--green);
}

.calorie-high {
    background: var(--orange);
}

.analytics-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.9fr) minmax(270px, 0.8fr);
    gap: 12px;
    margin-bottom: 12px;
}

.relationship-panel,
.weekday-panel {
    min-width: 0;
    min-height: 330px;
    padding: 23px;
}

.relation-switch {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.relationship-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px;
    gap: 22px;
    align-items: stretch;
    margin-top: 18px;
}

#relationshipChart {
    width: 100%;
    height: 220px;
    display: block;
}

.relationship-story {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 20px;
    border-radius: 15px;
    background:
        linear-gradient(145deg, rgba(79, 117, 216, 0.09), transparent 70%),
        rgba(23, 34, 29, 0.035);
}

.relation-strength {
    align-self: flex-start;
    min-height: 25px;
    display: inline-flex;
    align-items: center;
    padding: 0 9px;
    border-radius: 20px;
    color: #345bb7;
    background: var(--blue-soft);
    font-size: 9px;
    font-weight: 800;
}

.relationship-story strong {
    margin-top: 16px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 19px;
    font-weight: 500;
    letter-spacing: -0.025em;
}

.relationship-story p {
    margin: 8px 0 0;
    color: var(--ink-soft);
    font-size: 11px;
    line-height: 1.5;
}

.weekday-panel header h2 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 24px;
    font-weight: 500;
    letter-spacing: -0.035em;
}

.weekday-bars {
    height: 178px;
    display: flex;
    align-items: flex-end;
    gap: 7px;
    margin: 24px 0 14px;
}

.weekday-column {
    min-width: 18px;
    height: 100%;
    display: grid;
    grid-template-rows: 1fr auto;
    align-items: end;
    flex: 1 1 0;
    gap: 8px;
}

.weekday-bar-track {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: flex-end;
    border-radius: 7px;
    background: rgba(23, 34, 29, 0.035);
    overflow: hidden;
}

.weekday-bar-fill {
    width: 100%;
    min-height: 4px;
    border-radius: 7px 7px 2px 2px;
    transition: height 260ms ease, background 260ms ease;
}

.weekday-column small {
    color: var(--ink-soft);
    font-size: 8px;
    font-weight: 750;
    text-align: center;
}

.weekday-summary {
    min-height: 33px;
    margin: 0;
    color: var(--ink-soft);
    font-size: 10px;
    line-height: 1.45;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.detail-panel {
    min-width: 0;
    min-height: 285px;
    padding: 23px;
}

.comparison-badge {
    min-height: 25px;
    display: inline-flex;
    align-items: center;
    padding: 0 9px;
    border-radius: 20px;
    color: #1a6749;
    background: var(--green-pale);
    font-size: 10px;
    font-weight: 800;
    white-space: nowrap;
}

.comparison-badge.is-down {
    color: #79531a;
    background: var(--amber-soft);
}

.comparison-badge.neutral {
    color: var(--ink-soft);
    background: rgba(23, 34, 29, 0.06);
}

.detail-main {
    margin: 27px 0 16px;
}

.detail-main strong {
    display: block;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 38px;
    font-weight: 500;
    letter-spacing: -0.04em;
    line-height: 1;
}

.detail-main span {
    display: block;
    margin-top: 6px;
    color: var(--ink-soft);
    font-size: 11px;
}

.mini-bars {
    height: 60px;
    display: flex;
    align-items: flex-end;
    gap: 7px;
    padding: 8px 0;
    border-bottom: 1px solid var(--line);
}

.mini-bar {
    position: relative;
    min-width: 5px;
    flex: 1 1 0;
    border-radius: 4px 4px 1px 1px;
    background: var(--blue-soft);
    transition: height 250ms ease;
}

.mini-bar:last-child {
    background: var(--blue);
}

.mini-bar::after {
    content: attr(data-label);
    position: absolute;
    left: 50%;
    bottom: -22px;
    transform: translateX(-50%);
    color: var(--ink-soft);
    font-size: 8px;
    opacity: 0;
    transition: opacity 150ms ease;
}

.mini-bar:hover::after {
    opacity: 1;
}

.detail-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 22px;
    color: var(--ink-soft);
    font-size: 11px;
}

.detail-footer strong {
    color: var(--ink);
    font-size: 13px;
}

.macro-stack {
    height: 13px;
    display: flex;
    margin: 35px 0 25px;
    border-radius: 10px;
    background: rgba(23, 34, 29, 0.06);
    overflow: hidden;
}

.macro-stack span {
    display: block;
    height: 100%;
    transition: width 300ms ease;
}

.macro-protein,
.protein-color {
    background: var(--green);
}

.macro-fat,
.fat-color {
    background: var(--orange);
}

.macro-carbs,
.carbs-color {
    background: var(--blue);
}

.macro-legend {
    display: grid;
    gap: 13px;
}

.macro-legend > div {
    display: grid;
    grid-template-columns: 8px 1fr auto;
    align-items: center;
    gap: 9px;
    font-size: 11px;
}

.macro-legend i {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.macro-legend span {
    color: var(--ink-soft);
}

.macro-legend strong {
    font-size: 13px;
}

.quality-panel {
    display: grid;
    grid-template-columns: 126px 1fr;
    grid-template-rows: auto 1fr;
    gap: 15px 20px;
}

.quality-panel .detail-header {
    grid-column: 1 / -1;
}

.quality-ring {
    --quality: 0deg;
    width: 126px;
    height: 126px;
    display: grid;
    place-items: center;
    align-self: center;
    border-radius: 50%;
    background: conic-gradient(var(--green) var(--quality), rgba(23, 34, 29, 0.07) 0);
}

.quality-ring::before {
    content: "";
    width: 96px;
    height: 96px;
    grid-area: 1 / 1;
    border-radius: 50%;
    background: var(--paper);
}

.quality-ring > div {
    z-index: 1;
    grid-area: 1 / 1;
    text-align: center;
}

.quality-ring strong,
.quality-ring span {
    display: block;
}

.quality-ring strong {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 27px;
    font-weight: 500;
}

.quality-ring span {
    margin-top: 2px;
    color: var(--ink-soft);
    font-size: 9px;
}

.quality-list {
    display: grid;
    align-content: center;
    gap: 13px;
}

.quality-list > div {
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
}

.quality-list > div:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.quality-list span,
.quality-list strong {
    display: block;
}

.quality-list span {
    margin-bottom: 4px;
    color: var(--ink-soft);
    font-size: 9px;
}

.quality-list strong {
    font-size: 12px;
}

.week-panel {
    padding: 23px;
}

.week-header {
    align-items: flex-end;
    margin-bottom: 22px;
}

.week-header > span {
    color: var(--ink-soft);
    font-size: 11px;
}

.week-comparison {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border-top: 1px solid var(--line);
}

.week-comparison > div {
    padding: 20px 20px 4px;
    border-right: 1px solid var(--line);
}

.week-comparison > div:first-child {
    padding-left: 0;
}

.week-comparison > div:last-child {
    border-right: 0;
}

.week-comparison span,
.week-comparison strong,
.week-comparison small {
    display: block;
}

.week-comparison span {
    margin-bottom: 9px;
    color: var(--ink-soft);
    font-size: 10px;
}

.week-comparison strong {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 25px;
    font-weight: 500;
    letter-spacing: -0.03em;
}

.week-comparison small {
    margin-top: 5px;
    color: var(--green);
    font-size: 10px;
    font-weight: 750;
}

.week-comparison small.is-down {
    color: #9a6924;
}

/* Login */

.login-page {
    display: grid;
    place-items: center;
    padding: 28px;
}

.login-shell {
    width: min(1120px, 100%);
    min-height: min(700px, calc(100vh - 56px));
    display: grid;
    grid-template-columns: 1.25fr 0.75fr;
    border: 1px solid rgba(23, 34, 29, 0.1);
    border-radius: 28px;
    background: var(--paper);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.login-story {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 44px 50px;
    color: #f8fbf8;
    background:
        radial-gradient(circle at 70% 75%, rgba(141, 199, 159, 0.38), transparent 20rem),
        #173f31;
    overflow: hidden;
}

.login-story .brand {
    color: #f8fbf8;
}

.login-story .brand-mark {
    color: var(--ink);
    background: #f8fbf8;
}

.login-story .eyebrow {
    color: #9fceb0;
}

.login-story h1 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(45px, 5vw, 67px);
    font-weight: 500;
    letter-spacing: -0.055em;
    line-height: 0.98;
}

.login-story p:not(.eyebrow) {
    max-width: 490px;
    margin: 20px 0 0;
    color: rgba(248, 251, 248, 0.66);
    font-size: 15px;
    line-height: 1.6;
}

.login-preview {
    position: absolute;
    right: -70px;
    bottom: -65px;
    width: 340px;
    height: 340px;
    display: grid;
    place-content: center;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 50%;
}

.preview-orbit {
    position: absolute;
    border: 1px solid rgba(255, 255, 255, 0.11);
    border-radius: 50%;
}

.orbit-one {
    inset: 38px;
}

.orbit-two {
    inset: 84px;
}

.preview-number,
.preview-trend {
    position: relative;
    z-index: 1;
    text-align: center;
}

.preview-number {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 43px;
}

.preview-number small {
    font-family: inherit;
    font-size: 16px;
}

.preview-trend {
    margin-top: 5px;
    color: #a8d7b9;
    font-size: 11px;
}

.login-card {
    display: grid;
    align-content: center;
    padding: 50px;
    background: var(--paper);
}

.login-card h2 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 37px;
    font-weight: 500;
    letter-spacing: -0.045em;
}

.login-card > div > p:not(.eyebrow) {
    margin: 9px 0 0;
    color: var(--ink-soft);
    font-size: 13px;
    line-height: 1.5;
}

.login-card form {
    display: grid;
    gap: 10px;
    margin-top: 32px;
}

.login-card label {
    font-size: 11px;
    font-weight: 800;
}

.login-card input {
    width: 100%;
    min-height: 50px;
    padding: 0 14px;
    border: 1px solid rgba(23, 34, 29, 0.18);
    border-radius: 12px;
    color: var(--ink);
    background: #fff;
}

.login-card input::placeholder {
    color: #9ba49f;
}

.form-message {
    min-height: 17px;
    margin: 0;
    color: var(--ink-soft);
    font-size: 10px;
}

.form-message.error {
    color: #a43d32;
}

.primary-button {
    min-height: 50px;
    margin-top: 6px;
    border: 0;
    border-radius: 12px;
    color: white;
    background: var(--ink);
    cursor: pointer;
    font-size: 13px;
    font-weight: 800;
    transition: transform 160ms ease, background 160ms ease;
}

.primary-button:hover {
    transform: translateY(-1px);
    background: #254337;
}

@media (max-width: 1050px) {
    .focus-panel {
        grid-template-columns: 1fr;
    }

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

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

    .energy-panel {
        min-height: 360px;
    }

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

    .weekday-panel {
        min-height: 300px;
    }

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

    .quality-panel {
        grid-column: 1 / -1;
        grid-template-columns: 150px 1fr;
    }

    .login-shell {
        grid-template-columns: 1fr 0.75fr;
    }
}

@media (max-width: 760px) {
    .topbar {
        min-height: 70px;
        padding: 0 18px;
    }

    .topbar-actions {
        gap: 6px;
    }

    .mode-button {
        min-height: 32px;
        padding: 0 8px;
        font-size: 11px;
    }

    .profile-chip {
        display: none;
    }

    .logout-button {
        padding: 0 4px;
        font-size: 11px;
    }

    .section-nav {
        padding: 7px 12px;
    }

    .section-nav-link {
        min-height: 30px;
        padding: 0 10px;
        font-size: 10px;
    }

    .section-anchor {
        scroll-margin-top: 52px;
    }

    .dashboard {
        padding: 26px 16px 40px;
    }

    .freshness-alert {
        align-items: flex-start;
    }

    .freshness-alert > div {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .freshness-alert button {
        display: none;
    }

    .hero {
        align-items: flex-start;
        flex-direction: column;
        gap: 20px;
    }

    .hero h1 {
        font-size: 40px;
    }

    .period-switch {
        width: 100%;
    }

    .period-button {
        flex: 1;
    }

    .metric-grid,
    .detail-grid {
        grid-template-columns: 1fr;
    }

    .metric-card {
        min-height: 135px;
    }

    .focus-panel {
        padding: 8px;
    }

    .focus-lead {
        min-height: 145px;
        padding: 18px;
    }

    .focus-signals {
        grid-template-columns: 1fr;
    }

    .focus-signal {
        min-height: 94px;
        display: grid;
        grid-template-columns: 12px minmax(0, 1fr);
        grid-template-rows: auto auto auto;
        column-gap: 12px;
        padding: 14px 16px;
    }

    .focus-signal::before {
        grid-column: 1;
        grid-row: 1 / -1;
        align-self: center;
        margin: 0;
    }

    .focus-signal > span,
    .focus-signal > strong,
    .focus-signal > small {
        grid-column: 2;
    }

    .focus-signal > strong {
        margin-top: 3px;
    }

    .focus-signal > small {
        margin-top: 2px;
    }

    .panel-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .chart-legend {
        justify-content: flex-start;
    }

    .chart-panel,
    .energy-panel,
    .detail-panel,
    .week-panel {
        padding: 19px;
    }

    .chart-wrap,
    #progressChart {
        min-height: 310px;
        height: 310px;
    }

    .calories-header,
    .relationship-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .view-switch,
    .relation-switch {
        width: 100%;
    }

    .view-button,
    .relation-button {
        flex: 1 1 auto;
    }

    .calories-layout,
    .relationship-layout {
        grid-template-columns: 1fr;
    }

    .calories-chart-wrap,
    #caloriesChart {
        min-height: 260px;
        height: 260px;
    }

    .day-detail {
        min-height: 245px;
    }

    .relationship-story {
        min-height: 165px;
    }

    .calories-footer {
        align-items: flex-start;
        flex-direction: column;
    }

    .quality-panel {
        grid-column: auto;
        grid-template-columns: 115px 1fr;
    }

    .quality-ring {
        width: 110px;
        height: 110px;
    }

    .quality-ring::before {
        width: 84px;
        height: 84px;
    }

    .week-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .week-comparison {
        grid-template-columns: 1fr 1fr;
    }

    .week-comparison > div,
    .week-comparison > div:first-child {
        padding: 17px 12px;
        border-bottom: 1px solid var(--line);
    }

    .week-comparison > div:nth-child(2) {
        border-right: 0;
    }

    .week-comparison > div:nth-child(3),
    .week-comparison > div:nth-child(4) {
        border-bottom: 0;
    }

    .login-page {
        padding: 14px;
    }

    .login-shell {
        min-height: calc(100vh - 28px);
        grid-template-columns: 1fr;
    }

    .login-story {
        min-height: 330px;
        padding: 30px;
    }

    .login-story h1 {
        font-size: 42px;
    }

    .login-story p:not(.eyebrow) {
        display: none;
    }

    .login-preview {
        right: -125px;
        bottom: -150px;
    }

    .login-card {
        padding: 36px 30px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
