:root {
  --ink: #15241f;
  --muted: #6f7e78;
  --soft: #f4f6f3;
  --paper: #fff;
  --line: #dfe6e1;
  --green: #1a7b5c;
  --green-dark: #105b43;
  --green-soft: #e8f3ee;
  --amber: #b8771c;
  --amber-soft: #fff4df;
  --red: #b84a49;
  --nav: #10251e;
  --shadow: 0 16px 45px rgba(17, 41, 33, .08);
}

* { box-sizing: border-box; }
html { background: var(--soft); color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { margin: 0; min-height: 100vh; background: var(--soft); }
button, input { font: inherit; }
button, summary, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
.positive { color: var(--green-dark) !important; }
.negative { color: var(--red) !important; }
.neutral { color: var(--ink) !important; }
.eyebrow { margin: 0 0 7px; color: var(--green-dark); font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 224px; display: flex; flex-direction: column; padding: 26px 18px 20px; background: var(--nav); color: #f4fbf7; z-index: 10; }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 16px; letter-spacing: -.01em; }
.brand small { margin-top: 1px; color: #96aca3; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.brand-mark { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 15px; color: #fff; background: linear-gradient(145deg, #21916d, #0f5c43); font-size: 21px; font-weight: 900; box-shadow: 0 10px 22px rgba(12, 87, 62, .25); }
.brand-mark.small { width: 38px; height: 38px; border-radius: 11px; font-size: 17px; }
.sidebar nav { margin-top: 46px; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 11px 12px; border-radius: 10px; color: #b8c9c2; text-decoration: none; font-size: 14px; font-weight: 650; }
.nav-item.active { color: #fff; background: rgba(255,255,255,.09); }
.nav-icon { font-size: 18px; color: #72ba9e; }
.sidebar-foot { margin-top: auto; padding: 14px 8px 0; border-top: 1px solid rgba(255,255,255,.1); }
.phase-label { display: block; margin-bottom: 10px; color: #829a90; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.signout-button { border: 0; padding: 0; color: #c8d5d0; background: none; cursor: pointer; font-size: 13px; }
.signout-button:hover { color: #fff; }
.mobile-header { display: none; }

.content { margin-left: 224px; padding: 26px 38px 34px; }
.quality-strip { min-height: 38px; display: flex; align-items: center; gap: 10px; padding: 8px 13px; border: 1px solid; border-radius: 10px; font-size: 12px; }
.quality-strip.normal { color: #235f49; border-color: #c8e4d8; background: #edf7f2; }
.quality-strip.degraded { color: #7d5115; border-color: #eed3a3; background: var(--amber-soft); }
.quality-strip .status-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.quality-spacer { flex: 1; }

.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; padding: 34px 2px 22px; }
.page-heading h1 { margin: 0; font-size: clamp(27px, 3vw, 38px); letter-spacing: -.04em; }
.heading-note { max-width: 680px; margin: 9px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.as-of { text-align: right; white-space: nowrap; }
.as-of span, .as-of strong { display: block; }
.as-of span { color: var(--muted); font-size: 11px; }
.as-of strong { margin-top: 3px; font-size: 13px; }

.hero-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 28px; padding: 29px 32px; border-radius: 18px; color: #f7fcf9; background: linear-gradient(125deg, #122a22 0%, #164837 60%, #1a6b50 100%); box-shadow: var(--shadow); }
.hero-main > p, .hero-profit > span { margin: 0; color: #b9d0c6; font-size: 12px; font-weight: 700; }
.hero-value { margin-top: 8px; font-size: clamp(34px, 5vw, 54px); font-weight: 760; letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.hero-meta { display: flex; gap: 8px; margin-top: 10px; color: #a9c2b7; font-size: 12px; }
.hero-profit { min-width: 205px; align-self: center; padding: 4px 0 4px 28px; border-left: 1px solid rgba(255,255,255,.2); }
.hero-profit strong, .hero-profit small { display: block; }
.hero-profit strong { margin-top: 8px; color: #a8e2ca !important; font-size: 25px; font-variant-numeric: tabular-nums; }
.hero-profit strong.negative { color: #ffc1bd !important; }
.hero-profit small { margin-top: 4px; color: #a9c2b7; font-size: 11px; }

.period-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 14px; }
.period-card { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--paper); box-shadow: 0 5px 18px rgba(19, 48, 39, .035); }
.card-label { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; color: var(--muted); }
.card-label span { color: var(--ink); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.card-label small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; }
.period-value { display: block; margin-top: 12px; font-size: clamp(21px, 2.2vw, 29px); font-variant-numeric: tabular-nums; letter-spacing: -.025em; }
.period-composition { display: flex; flex-wrap: wrap; gap: 7px 15px; margin-top: 15px; color: var(--muted); font-size: 11px; }
.period-composition span { white-space: nowrap; }
.legend-dot { display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; vertical-align: 1px; }
.legend-dot.capital { background: var(--green); }
.legend-dot.income { background: #c38a2e; }

.section-block, .chart-card { margin-top: 28px; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin: 0 2px 13px; }
.section-heading h2 { margin: 0; font-size: 21px; letter-spacing: -.025em; }
.section-heading > p { max-width: 350px; margin: 0 0 2px; color: var(--muted); font-size: 12px; text-align: right; }
.strategy-list { border: 1px solid var(--line); border-radius: 16px; overflow: hidden; background: var(--paper); box-shadow: 0 5px 18px rgba(19, 48, 39, .035); }
.strategy-card { border-bottom: 1px solid var(--line); }
.strategy-card:last-child { border-bottom: 0; }
.strategy-card.warning { background: #fffbf4; }
.strategy-card summary { position: relative; min-height: 90px; display: grid; grid-template-columns: minmax(185px, 1.25fr) minmax(160px, .9fr) minmax(360px, 1.7fr) 18px; align-items: center; gap: 20px; padding: 17px 20px; cursor: pointer; list-style: none; }
.strategy-card summary::-webkit-details-marker { display: none; }
.strategy-card summary:hover { background: rgba(244, 247, 244, .72); }
.strategy-card[open] summary { background: #f7f9f7; }
.strategy-identity { display: flex; align-items: center; gap: 12px; min-width: 0; }
.strategy-identity strong, .strategy-identity small { display: block; }
.strategy-identity strong { font-size: 14px; }
.strategy-identity small, .strategy-value small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.strategy-swatch { width: 9px; height: 38px; flex: 0 0 auto; border-radius: 6px; background: #79958a; }
.strategy-income { background: #1a7b5c; }
.strategy-growth { background: #3375a8; }
.strategy-individual { background: #9462a6; }
.strategy-cash { background: #c28a2f; }
.strategy-diversifier { background: #688079; }
.strategy-unclassified { background: #d06b45; }
.strategy-value strong, .strategy-value small { display: block; }
.strategy-value strong { font-size: 16px; font-variant-numeric: tabular-nums; }
.strategy-periods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.strategy-periods div { min-width: 0; padding: 9px 10px; border-radius: 9px; background: #f6f8f6; }
.strategy-periods span, .strategy-periods strong { display: block; }
.strategy-periods span { color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: .05em; text-transform: uppercase; }
.strategy-periods strong { overflow: hidden; margin-top: 3px; font-size: 12px; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.disclosure { width: 8px; height: 8px; border-right: 2px solid #728079; border-bottom: 2px solid #728079; transform: rotate(45deg) translateY(-2px); transition: transform .18s ease; }
.strategy-card[open] .disclosure { transform: rotate(225deg) translate(-2px, -2px); }
.strategy-detail { padding: 4px 20px 22px 61px; background: #f7f9f7; }
.strategy-detail > p { margin: 0 0 14px; color: var(--muted); font-size: 12px; }
.breakdown-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; }
.breakdown-grid section { padding: 14px; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.breakdown-grid h3 { margin: 0 0 9px; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.breakdown-grid dl { margin: 0; }
.breakdown-grid dl div { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; color: var(--muted); font-size: 10px; }
.breakdown-grid dt, .breakdown-grid dd { margin: 0; }
.breakdown-grid dd { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.breakdown-grid .submetric { padding-left: 10px; border-left: 2px solid #e4e9e5; }

.chart-card { padding: 22px 24px 17px; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); box-shadow: 0 5px 18px rgba(19, 48, 39, .035); }
.chart-heading { margin: 0 0 12px; }
.range-switch { display: flex; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: #f4f6f4; }
.range-switch button { min-width: 48px; min-height: 30px; border: 0; border-radius: 6px; color: var(--muted); background: transparent; cursor: pointer; font-size: 11px; font-weight: 700; }
.range-switch button.active { color: var(--ink); background: #fff; box-shadow: 0 1px 5px rgba(20, 45, 37, .1); }
.chart-wrap { position: relative; height: 340px; }
.chart-note { margin: 10px 0 0; padding-top: 11px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; line-height: 1.5; }
.page-footer { display: flex; justify-content: space-between; gap: 20px; margin-top: 22px; padding: 0 3px; color: #7a8781; font-size: 10px; }

.auth-page { display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 20% 20%, #edf7f2 0, transparent 38%), linear-gradient(145deg, #f5f7f4, #e8efeb); }
.auth-shell, .error-shell { width: 100%; display: grid; place-items: center; min-height: calc(100vh - 48px); }
.auth-card, .error-card { width: min(100%, 420px); padding: 36px; border: 1px solid rgba(22, 65, 50, .12); border-radius: 20px; background: rgba(255,255,255,.94); box-shadow: var(--shadow); }
.auth-card .brand-mark, .error-card .brand-mark { margin-bottom: 26px; }
.auth-card h1, .error-card h1 { margin: 0; font-size: 30px; letter-spacing: -.035em; }
.auth-intro, .error-card p { margin: 9px 0 24px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.auth-form { display: grid; gap: 15px; }
.auth-form label span { display: block; margin-bottom: 6px; color: #475b53; font-size: 11px; font-weight: 750; }
.auth-form input { width: 100%; min-height: 47px; padding: 11px 13px; border: 1px solid #cfd9d3; border-radius: 10px; color: var(--ink); background: #fbfcfb; outline: none; }
.auth-form input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(26,123,92,.12); }
.primary-button { min-height: 48px; border: 0; border-radius: 10px; color: #fff; background: var(--green); cursor: pointer; font-weight: 750; }
.primary-button:hover { background: var(--green-dark); }
.link-button { display: inline-grid; place-items: center; min-width: 130px; padding: 0 18px; text-decoration: none; }
.text-button { border: 0; margin-top: 16px; padding: 0; color: var(--muted); background: none; cursor: pointer; }
.auth-footnote { margin: 18px 0 0; color: #84918c; font-size: 10px; text-align: center; }
.form-alert { margin: -7px 0 15px; padding: 10px 12px; border: 1px solid #efd0ce; border-radius: 9px; color: #8b3331; background: #fff2f1; font-size: 11px; }
.error-shell { min-height: 100vh; padding: 24px; }
.setup-shell { padding-block: 24px; }
.setup-card { width: min(100%, 620px); }
.totp-setup { display: grid; grid-template-columns: 190px minmax(0, 1fr); align-items: center; gap: 24px; margin: 0 0 22px; padding: 18px; border: 1px solid var(--line); border-radius: 13px; background: #f7f9f7; }
.totp-qr { display: grid; place-items: center; padding: 8px; border-radius: 10px; background: #fff; }
.totp-qr svg { width: 100%; height: auto; display: block; }
.totp-setup strong, .totp-setup small { display: block; }
.totp-setup p { margin: 7px 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.totp-setup code { display: block; overflow-wrap: anywhere; padding: 9px; border-radius: 7px; color: var(--green-dark); background: #e8f3ee; font-size: 11px; letter-spacing: .08em; }
.totp-setup small { margin-top: 9px; color: var(--muted); font-size: 10px; line-height: 1.45; }

@media (max-width: 1050px) {
  .sidebar { width: 196px; }
  .content { margin-left: 196px; padding-inline: 24px; }
  .strategy-card summary { grid-template-columns: 1fr 1fr 18px; }
  .strategy-periods { grid-column: 1 / -1; grid-row: 2; }
  .strategy-card summary { padding-block: 14px; }
  .strategy-detail { padding-left: 20px; }
}

@media (max-width: 760px) {
  .sidebar { display: none; }
  .mobile-header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; padding: 12px 17px; color: #fff; background: rgba(16,37,30,.97); box-shadow: 0 4px 14px rgba(15, 42, 33, .12); }
  .mobile-header .signout-button.compact { padding: 8px; min-height: 40px; }
  .content { margin-left: 0; padding: 14px 14px 28px; }
  .quality-strip { flex-wrap: wrap; gap: 5px 9px; }
  .quality-spacer { display: none; }
  .page-heading { align-items: flex-start; padding: 27px 2px 17px; }
  .page-heading h1 { font-size: 29px; }
  .heading-note { font-size: 12px; }
  .as-of { display: none; }
  .hero-card { grid-template-columns: 1fr; gap: 20px; padding: 24px 21px; }
  .hero-value { font-size: 39px; }
  .hero-profit { min-width: 0; padding: 16px 0 0; border-top: 1px solid rgba(255,255,255,.2); border-left: 0; }
  .period-grid { grid-template-columns: 1fr; gap: 9px; }
  .period-card { padding: 17px; }
  .period-card .period-value { font-size: 24px; }
  .period-composition { margin-top: 11px; }
  .section-block, .chart-card { margin-top: 24px; }
  .section-heading { align-items: flex-start; }
  .section-heading > p { display: none; }
  .strategy-list { border: 0; border-radius: 0; overflow: visible; background: transparent; box-shadow: none; }
  .strategy-card { margin-bottom: 10px; border: 1px solid var(--line) !important; border-radius: 13px; overflow: hidden; background: #fff; box-shadow: 0 4px 14px rgba(19,48,39,.035); }
  .strategy-card summary { min-height: 0; grid-template-columns: minmax(0, 1fr) auto 15px; gap: 10px; padding: 15px; }
  .strategy-swatch { height: 34px; }
  .strategy-value { text-align: right; }
  .strategy-value strong { font-size: 14px; }
  .strategy-periods { grid-column: 1 / -1; grid-row: 2; gap: 5px; }
  .strategy-periods div { padding: 8px; }
  .strategy-periods strong { font-size: 11px; }
  .strategy-detail { padding: 3px 14px 15px; }
  .breakdown-grid { grid-template-columns: 1fr; }
  .chart-card { padding: 18px 13px 14px; }
  .chart-heading { align-items: center; }
  .chart-heading .eyebrow { display: none; }
  .chart-heading h2 { font-size: 17px; }
  .chart-wrap { height: 285px; }
  .page-footer { display: grid; gap: 5px; }
  .setup-card { padding: 25px 19px; }
  .totp-setup { grid-template-columns: 1fr; }
  .totp-qr { width: min(100%, 230px); margin-inline: auto; }
}

@media (max-width: 390px) {
  .content { padding-inline: 10px; }
  .hero-value { font-size: 34px; }
  .strategy-card summary { padding-inline: 12px; }
  .strategy-identity { gap: 8px; }
  .strategy-identity strong { font-size: 13px; }
  .strategy-value strong { font-size: 12px; }
}

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