/* ──────────────────────────────────────────────────────────────────────
   Findiesel Copilot — shared stylesheet for the dashboard family.
   Every page in the dashboard family (dashboard, guidance, learn, history,
   debt) reads from this file to keep design tokens and component styles
   in one place. Page-specific tweaks stay inline on the template.
   ────────────────────────────────────────────────────────────────────── */

:root {
    --bg: #f7f7f5;
    --surface: #ffffff;
    --ink: #1a1a1a;
    --muted: #6b6b6b;
    --line: #e5e5e2;
    --accent: #2f6f4f;
    --accent-soft: #e8f1ec;
    --warn: #b06b00;
    --warn-soft: #fbf1de;
    --critical: #b03030;
    --critical-soft: #fbe5e3;
    --info: #2a5d8f;
    --info-soft: #e3eef8;
    --base: #4a5fc1;
    --variable-low: #b8c6f0;
    --variable-expected: #6e88e0;
    --variable-high: #2f4cb3;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

/* ── Layout ── */
.container { max-width: 1080px; margin: 0 auto; padding: 36px 24px 100px; }

/* ── Typography ── */
h1 { font-size: 26px; font-weight: 700; margin: 0 0 4px; letter-spacing: -0.02em; }
h2 { font-size: 17px; font-weight: 700; margin: 0; letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; }
p { margin: 0 0 8px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.lede { color: var(--muted); font-size: 14px; margin: 0 0 28px; }

/* ── Drill-down nav (back link + page-context bar at top of subpages) ── */
.subpage-nav {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
    font-size: 13px;
}
.subpage-nav a { color: var(--muted); }
.subpage-nav a:hover { color: var(--ink); text-decoration: none; }

/* ── Section headers ── */
.section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin: 40px 0 16px;
}
.section-meta { font-size: 13px; color: var(--muted); }

/* ── Cards ── */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 22px 24px;
}
.card + .card { margin-top: 12px; }

/* ── Grid layouts ── */
.grid { display: grid; gap: 14px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: 1.4fr 1fr; }
@media (max-width: 900px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 680px) { .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; } }

/* ── Stat cards ── */
.stat-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 20px 22px;
}
.stat-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin-bottom: 8px;
}
.stat-value {
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1;
}
.stat-sub { font-size: 13px; color: var(--muted); margin-top: 6px; }
.stat-card.featured {
    border-color: #c5ddd0;
    background: var(--accent-soft);
}
.stat-card.featured .stat-label { color: var(--accent); }
.stat-card.featured .stat-value { color: var(--accent); }
.stat-card.caution {
    border-color: #edd9a3;
    background: var(--warn-soft);
}
.stat-card.caution .stat-label { color: var(--warn); }
.stat-card.caution .stat-value { color: var(--warn); }

/* ── Philosophy banner ── */
.philosophy {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px 18px;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 32px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.philosophy strong { color: var(--ink); }

/* ── Action items ── */
.action-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 20px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    margin-bottom: 10px;
}
.action-item.primary {
    border-color: #c5ddd0;
    border-left: 3px solid var(--accent);
}
.action-icon { font-size: 20px; flex-shrink: 0; margin-top: 1px; }
.action-body { flex: 1; min-width: 0; }
.action-body strong { font-weight: 600; display: block; margin-bottom: 3px; }
.action-body p { font-size: 14px; color: var(--muted); margin: 0; line-height: 1.5; }
.action-tag {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.06em;
    padding: 3px 8px;
    border-radius: 6px;
    white-space: nowrap;
    flex-shrink: 0;
    align-self: flex-start;
    margin-top: 2px;
}
.tag-now    { background: var(--critical-soft); color: var(--critical); }
.tag-soon   { background: var(--warn-soft);     color: var(--warn); }
.tag-watch  { background: var(--info-soft);     color: var(--info); }
.tag-always { background: var(--accent-soft);   color: var(--accent); }

/* ── Scenario bars ── */
.scenario { display: flex; align-items: center; gap: 12px; margin: 12px 0; }
.scenario-label { width: 90px; font-size: 13px; color: var(--muted); flex-shrink: 0; }
.scenario-bar {
    flex: 1;
    height: 22px;
    background: var(--bg);
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    min-width: 160px;
}
.scenario-bar .seg-base { background: var(--base); }
.scenario-bar .seg-low  { background: var(--variable-low); }
.scenario-bar .seg-mid  { background: var(--variable-expected); }
.scenario-bar .seg-high { background: var(--variable-high); }
.scenario-amount {
    width: 110px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    font-size: 15px;
    flex-shrink: 0;
}
.scenario-legend {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--muted);
    margin-top: 14px;
    flex-wrap: wrap;
}
.scenario-legend .swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    vertical-align: middle;
    margin-right: 5px;
}

/* ── Bonus split bar ── */
.split-bar {
    display: flex;
    height: 26px;
    border-radius: 8px;
    overflow: hidden;
    margin: 10px 0 16px;
}
.split-bar > div {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: white;
}
.split-legend {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 24px;
    font-size: 13px;
}
.split-legend .row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.split-legend .swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    margin-right: 6px;
    vertical-align: middle;
}

/* ── Progress bar ── */
.progress {
    background: var(--bg);
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin: 8px 0;
}
.progress-fill { height: 100%; background: var(--accent); border-radius: 4px; }
.progress-fill.deficit { background: var(--warn); }

/* ── Pills ── */
.pill {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
}
.pill-confidence-high   { background: var(--accent-soft); color: var(--accent); }
.pill-confidence-medium { background: var(--warn-soft);   color: var(--warn); }
.pill-confidence-low    { background: var(--critical-soft); color: var(--critical); }
.pill-volatility-low    { background: var(--accent-soft); color: var(--accent); }
.pill-volatility-medium { background: var(--warn-soft);   color: var(--warn); }
.pill-volatility-high   { background: var(--critical-soft); color: var(--critical); }

/* ── Big number ── */
.big-number { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.big-number .unit { font-size: 18px; color: var(--muted); margin-left: 3px; font-weight: 500; }

/* ── Divider with label ── */
.labeled-divider {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 52px 0 32px;
}
.labeled-divider-line { flex: 1; height: 1px; background: var(--line); }
.labeled-divider-text {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    white-space: nowrap;
}

/* ── Dive-deeper tile grid (bottom of front page) ── */
.deeper-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 28px;
}
.deeper-tile {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 22px 20px 20px;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s, transform 0.1s;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.deeper-tile:hover {
    border-color: var(--accent);
    text-decoration: none;
    transform: translateY(-1px);
}
.deeper-tile .icon { font-size: 22px; line-height: 1; }
.deeper-tile .title { font-size: 15px; font-weight: 600; }
.deeper-tile .blurb { font-size: 12px; color: var(--muted); line-height: 1.5; }
.deeper-tile .arrow {
    font-size: 13px;
    color: var(--accent);
    margin-top: auto;
    padding-top: 6px;
    font-weight: 500;
}

/* ── Learn cards ── */
.learn-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 12px;
}
.learn-card h3 {
    font-size: 15px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
    color: var(--ink);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.learn-card p {
    font-size: 14px;
    color: var(--muted);
    line-height: 1.6;
    margin-bottom: 12px;
}
.learn-card p:last-child { margin-bottom: 0; }
.learn-card .highlight {
    background: var(--accent-soft);
    border-left: 3px solid var(--accent);
    padding: 12px 16px;
    border-radius: 0 8px 8px 0;
    font-size: 13px;
    color: var(--ink);
    line-height: 1.6;
    margin-top: 10px;
}
.learn-tag {
    display: inline-block;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 600;
}
.tag-basics       { background: var(--accent-soft); color: var(--accent); }
.tag-intermediate { background: var(--info-soft);   color: var(--info); }
.tag-advanced     { background: var(--warn-soft);   color: var(--warn); }

/* ── Quiz ── */
.quiz-item {
    border: 1px solid var(--line);
    border-radius: 10px;
    margin-bottom: 10px;
    overflow: hidden;
    background: var(--surface);
}
.quiz-question {
    padding: 14px 18px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    user-select: none;
}
.quiz-question:hover { background: var(--bg); }
.q-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--warn);
    margin-bottom: 3px;
}
.quiz-chevron { font-size: 11px; color: var(--muted); transition: transform 0.2s; flex-shrink: 0; }
.quiz-question.open .quiz-chevron { transform: rotate(180deg); }
.quiz-answer {
    padding: 14px 18px;
    font-size: 14px;
    color: var(--muted);
    border-top: 1px solid var(--line);
    background: var(--bg);
    display: none;
    line-height: 1.6;
}
.quiz-answer.visible { display: block; }

/* ── History ── */
details {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 16px 20px;
}
details + details { margin-top: 8px; }
summary { cursor: pointer; font-weight: 500; font-size: 14px; }
details dl {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 4px 12px;
    margin: 14px 0 0;
    font-size: 13px;
}
details dt { color: var(--muted); }
details dd { margin: 0; }

/* ── Bottom actions ── */
.actions { margin-top: 48px; display: flex; gap: 12px; }
.button {
    display: inline-block;
    background: var(--ink);
    color: var(--surface);
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
}
.button.secondary {
    background: var(--surface);
    color: var(--ink);
    border: 1px solid var(--line);
}
.button:hover { text-decoration: none; opacity: 0.88; }

/* ── Misc ── */
.secondary { color: var(--muted); font-size: 13px; }
.empty {
    background: var(--surface);
    border: 1px dashed var(--line);
    border-radius: 14px;
    padding: 48px;
    text-align: center;
    color: var(--muted);
}
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.flash.error   { background: var(--critical-soft); color: var(--critical); }
.flash.info    { background: var(--info-soft);     color: var(--info); }
.flash.success { background: var(--accent-soft);   color: var(--accent); }

/* ── Floating feedback button ── */
.feedback-fab {
    position: fixed;
    bottom: 22px;
    right: 22px;
    background: var(--ink);
    color: var(--surface);
    padding: 10px 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
    text-decoration: none;
    z-index: 1000;
    transition: transform 0.1s ease, box-shadow 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}
.feedback-fab:hover {
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
    color: var(--surface);
}

/* ── Debt-strategy specific ── */
.debt-row {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    align-items: center;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
    font-size: 14px;
}
.debt-row:last-child { border-bottom: none; }
.debt-label-cell .debt-label-name { font-weight: 600; }
.debt-label-cell .debt-meta { font-size: 12px; color: var(--muted); }
.debt-cell-rate {
    font-variant-numeric: tabular-nums;
    color: var(--muted);
    font-size: 13px;
    min-width: 56px;
    text-align: right;
}
.debt-cell-balance {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    min-width: 90px;
    text-align: right;
}
.debt-priority-pill {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 3px 8px;
    border-radius: 6px;
    white-space: nowrap;
}
.priority-attack   { background: var(--critical-soft); color: var(--critical); }
.priority-keep     { background: var(--info-soft);     color: var(--info); }
.priority-hold     { background: var(--bg);            color: var(--muted); }
.priority-strategy { background: var(--warn-soft);     color: var(--warn); }
