:root {
    --bg: #0a0c10;
    --surface: #12151c;
    --surface2: #1a1e28;
    --surface3: #222733;
    --border: #2a3040;
    --text: #e8ecf4;
    --text2: #8b93a7;
    --text3: #545c70;
    --accent: #3b82f6;
    --accent2: #60a5fa;
    --green: #22c55e;
    --green-dim: rgba(34, 197, 94, .15);
    --red: #ef4444;
    --red-dim: rgba(239, 68, 68, .12);
    --orange: #f59e0b;
    --orange-dim: rgba(245, 158, 11, .12);
    --purple: #a78bfa;
    --cyan: #22d3ee;
    --pink: #f472b6;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* Lucide icons — default sizing + alignment */
.lucide {
    width: 16px;
    height: 16px;
    stroke-width: 2;
    vertical-align: -3px;
}
.icon-12 { width: 12px; height: 12px; vertical-align: -2px; }
.icon-14 { width: 14px; height: 14px; vertical-align: -2px; }
.icon-18 { width: 18px; height: 18px; vertical-align: -4px; }
.icon-24 { width: 24px; height: 24px; vertical-align: -6px; }
.icon-inline { display: inline-block; vertical-align: -2px; margin-right: 4px; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.45;
    overflow-x: hidden;
}
.mono { font-family: 'JetBrains Mono', ui-monospace, SF Mono, monospace; }

a { color: var(--accent2); text-decoration: none; }
a:hover { color: var(--accent); }

/* Header */
.app-header {
    padding: 22px 32px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 16px;
}
.app-title { min-width: 0; }

/* Hamburger toggle — hidden on desktop, shown on mobile */
.nav-toggle {
    display: none;
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    padding: 0;
}
.nav-toggle:hover, .nav-toggle[aria-expanded="true"] {
    background: var(--surface3);
    border-color: var(--accent);
}
.nav-toggle .lucide { width: 22px; height: 22px; stroke-width: 2; }
.app-header h1 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--text), var(--accent2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.app-header h1 a { color: inherit; -webkit-text-fill-color: transparent; }
.header-sub { color: var(--text2); font-size: 12px; margin-top: 4px; }
.header-stats { display: flex; gap: 28px; }
.header-stat { text-align: right; }
.header-stat .val { font-size: 20px; font-weight: 700; font-family: 'JetBrains Mono', monospace; }
.header-stat .val.green { color: var(--green); }
.header-stat .lbl {
    font-size: 10px;
    color: var(--text3);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 2px;
}

/* Navigation */
.nav {
    display: flex;
    gap: 4px;
    padding: 12px 32px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    flex-wrap: wrap;
    align-items: center;
}
.nav-btn, .nav-btn-form button {
    padding: 7px 14px;
    border: none;
    background: transparent;
    color: var(--text2);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    border-radius: 8px;
    cursor: pointer;
    transition: all .2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.nav-btn .lucide, .nav-btn-form button .lucide {
    width: 15px;
    height: 15px;
    stroke-width: 2;
    vertical-align: baseline;
    flex-shrink: 0;
}
.nav-btn:hover, .nav-btn-form button:hover { background: var(--surface2); color: var(--text); }
.nav-btn.active { background: var(--accent); color: #fff; }
.nav-sep { flex: 1; }

/* Main layout */
.main { padding: 20px 32px; }

.flash {
    background: var(--green-dim);
    color: var(--green);
    padding: 10px 14px;
    border-radius: 10px;
    margin-bottom: 16px;
    border: 1px solid rgba(34, 197, 94, .25);
    font-size: 13px;
}

/* Cards */
.grid { display: grid; gap: 20px; }
.grid > * { min-width: 0; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px;
    transition: border-color .2s;
    overflow: hidden;
    min-width: 0;
}
.card:hover { border-color: var(--surface3); }
.card.overflow-visible { overflow: visible; }
.card-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text3);
    margin-bottom: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}
.badge {
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 6px;
    letter-spacing: 0;
    text-transform: none;
    font-weight: 500;
}
.badge-green { background: var(--green-dim); color: var(--green); }
.badge-red { background: var(--red-dim); color: var(--red); }
.badge-orange { background: var(--orange-dim); color: var(--orange); }
.badge-blue { background: rgba(59,130,246,.15); color: var(--accent2); }
.badge-purple { background: rgba(167,139,250,.15); color: var(--purple); }

/* KPI boxes */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.kpi {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 18px;
}
.kpi-label { font-size: 10px; color: var(--text3); text-transform: uppercase; letter-spacing: 1px; }
.kpi-value { font-size: 26px; font-weight: 700; margin-top: 6px; font-family: 'JetBrains Mono', monospace; letter-spacing: -0.5px; }
.kpi-sub { font-size: 11px; color: var(--text2); margin-top: 4px; }

/* Bar chart */
.chart-container { position: relative; }
.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 220px;
    padding-top: 24px;
    position: relative;
}
.bar-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
    position: relative;
    cursor: pointer;
}
.bar {
    width: 100%;
    max-width: 48px;
    border-radius: 6px 6px 2px 2px;
    transition: all .3s ease;
    position: relative;
    min-height: 3px;
    background: linear-gradient(180deg, var(--accent2), var(--accent));
}
.bar.weak { background: linear-gradient(180deg, #fca5a5, var(--red)); }
.bar.strong { background: linear-gradient(180deg, #86efac, var(--green)); }
.bar.bar-current { background: linear-gradient(180deg, var(--accent2), var(--accent)); box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.3); }
.bar-split {
    background: linear-gradient(180deg, var(--accent2), var(--accent));
    position: relative;
    box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.3);
}
.bar-paid {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(180deg, #86efac, var(--green));
    border-radius: 0 0 2px 2px;
}
.bar:hover { filter: brightness(1.3); }
.bar-label {
    font-size: 10px;
    color: var(--text3);
    margin-top: 8px;
    text-align: center;
    font-family: 'JetBrains Mono', monospace;
}
.bar-value {
    position: absolute;
    top: -22px;
    font-size: 10px;
    color: var(--text2);
    font-family: 'JetBrains Mono', monospace;
    white-space: nowrap;
    opacity: 0;
    transition: opacity .2s;
}
.bar-wrapper:hover .bar-value { opacity: 1; }

.avg-line {
    position: absolute;
    left: 0;
    right: 0;
    border-top: 1.5px dashed var(--orange);
    opacity: .5;
    z-index: 2;
    pointer-events: none;
}
.avg-line::after {
    content: attr(data-label);
    position: absolute;
    right: 0;
    top: -16px;
    font-size: 9px;
    color: var(--orange);
    font-family: 'JetBrains Mono', monospace;
}

/* Weak rows */
.weak-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    gap: 8px;
}
.weak-row:last-child { border: none; }
.weak-row-left { min-width: 0; flex: 1; }
.weak-row-name { font-weight: 600; font-size: 13px; }
.weak-row-sum { font-size: 11px; color: var(--text2); margin-top: 2px; font-family: 'JetBrains Mono', monospace; }
.weak-row-right { text-align: right; flex-shrink: 0; }
.weak-row-pct { font-size: 13px; font-weight: 600; color: var(--red); font-family: 'JetBrains Mono', monospace; }
.weak-row-lbl { font-size: 10px; color: var(--text3); margin-top: 2px; }

/* Weekday chart */
.week-chart { display: flex; gap: 8px; align-items: flex-end; height: 120px; }
.week-bar-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
}
.week-bar {
    width: 100%;
    border-radius: 4px 4px 0 0;
    background: linear-gradient(180deg, var(--accent2), var(--accent));
    transition: all .3s;
}
.week-label { font-size: 10px; color: var(--text3); margin-top: 6px; font-family: 'JetBrains Mono', monospace; }

/* Issuer rows */
.issuer-row {
    display: flex;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    gap: 12px;
    font-size: 13px;
}
.issuer-row:last-child { border: none; }
.issuer-name {
    flex: 1;
    color: var(--text);
    font-weight: 500;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.issuer-total { font-family: 'JetBrains Mono', monospace; color: var(--text2); min-width: 100px; text-align: right; font-size: 12px; }
.issuer-count { font-family: 'JetBrains Mono', monospace; color: var(--text3); font-size: 11px; min-width: 60px; text-align: center; }
.issuer-bar-bg { width: 120px; height: 6px; background: var(--surface3); border-radius: 3px; overflow: hidden; }
.issuer-bar-fill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    transition: width .5s ease;
}

/* Heatmap Calendar */
.cal-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}
.cal-month-card {
    background: var(--surface2);
    border-radius: 10px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    position: relative;
}
.cal-month-card.weak { border-left: 3px solid var(--red); }
.cal-month-card.strong { border-left: 3px solid var(--green); }
.cal-month-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 10px;
}
.cal-month-name { font-size: 13px; font-weight: 600; }
.cal-month-total { font-size: 11px; color: var(--text2); font-family: 'JetBrains Mono', monospace; }
.cal-month-total.weak { color: var(--red); }
.cal-month-total.strong { color: var(--green); }
.cal-month-split {
    display: flex;
    justify-content: space-between;
    font-size: 10.5px;
    font-family: 'JetBrains Mono', monospace;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px dashed var(--border);
}

.cal-dow {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
    margin-bottom: 4px;
}
.cal-dow-cell {
    font-size: 9px;
    color: var(--text3);
    text-align: center;
    font-family: 'JetBrains Mono', monospace;
}
.cal-days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
}
.cal-day {
    aspect-ratio: 1;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text3);
    position: relative;
    cursor: default;
    transition: all .12s;
}
.cal-day.empty { visibility: hidden; }
.cal-day.past { opacity: 0.35; }
.cal-day.today { outline: 2px solid var(--cyan); outline-offset: 1px; }
.cal-day:not(.empty):hover {
    z-index: 100;
}
.cal-day.has-events:hover {
    box-shadow: 0 0 0 2px var(--accent2);
}

/* Structured tooltip */
.cal-tip {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    max-width: 280px;
    background: linear-gradient(180deg, #1c2130, #141821);
    border: 1px solid var(--surface3);
    border-radius: 10px;
    padding: 10px 12px;
    z-index: 200;
    color: var(--text);
    box-shadow: 0 12px 40px rgba(0, 0, 0, .6), 0 0 0 1px rgba(96, 165, 250, 0.08);
    pointer-events: none;
    text-align: left;
    font-family: 'Outfit', sans-serif;
    font-weight: 400;
    font-size: 12px;
}
.cal-tip::after {
    /* little arrow down to the day cell */
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 10px;
    height: 10px;
    background: #141821;
    border-right: 1px solid var(--surface3);
    border-bottom: 1px solid var(--surface3);
}
.cal-day[data-align="right"] .cal-tip {
    left: auto;
    right: -4px;
    transform: none;
}
.cal-day[data-align="right"] .cal-tip::after {
    left: auto;
    right: 14px;
    transform: rotate(45deg);
}
.cal-day[data-align="left"] .cal-tip {
    left: -4px;
    right: auto;
    transform: none;
}
.cal-day[data-align="left"] .cal-tip::after {
    left: 14px;
    right: auto;
    transform: rotate(45deg);
}
.cal-day:hover .cal-tip { display: block; }

.cal-tip-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 6px;
}
.cal-tip-date {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--accent2);
    font-weight: 500;
}
.cal-tip-total {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 700;
    color: var(--green);
}
.cal-tip-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.cal-tip-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 11.5px;
    line-height: 1.35;
}
.cal-tip-name {
    color: var(--text2);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1;
}
.cal-tip-amt {
    font-family: 'JetBrains Mono', monospace;
    color: var(--text);
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}
/* heatmap levels */
.cd-0 { background: var(--surface3); }
.cd-1 { background: #14332a; color: #86efac; }
.cd-2 { background: #1a4d35; color: #86efac; }
.cd-3 { background: #1f6b3f; color: #fff; }
.cd-4 { background: #26914c; color: #fff; }
.cd-5 { background: #2dd55b; color: #0a0c10; font-weight: 700; }

.cal-legend {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 14px;
    font-size: 11px;
    color: var(--text3);
    flex-wrap: wrap;
}
.cal-legend-item { display: flex; align-items: center; gap: 5px; }
.cal-legend-swatch { width: 12px; height: 12px; border-radius: 3px; }

/* Density timeline */
.streak-timeline {
    display: flex;
    height: 32px;
    border-radius: 6px;
    overflow: hidden;
    background: var(--surface2);
    border: 1px solid var(--border);
}
.streak-seg {
    height: 100%;
    flex: 1;
    min-width: 2px;
    transition: all .2s;
}
.streak-seg.has-payment { background: var(--green); opacity: .75; }
.streak-seg.no-payment { background: transparent; }
.streak-seg.long-gap { background: rgba(239,68,68,.4); }
.streak-seg:hover { filter: brightness(1.4); }

/* Gap cards */
.gap-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: var(--surface2);
    border-radius: 8px;
    border-left: 3px solid var(--red);
    margin-bottom: 8px;
}
.gap-dates { font-size: 12px; font-family: 'JetBrains Mono', monospace; }
.gap-days { font-size: 14px; font-weight: 700; color: var(--red); font-family: 'JetBrains Mono', monospace; }

/* Progress ring */
.progress-ring-wrap {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 16px;
}
.ring-svg { transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--surface3); }
.ring-fill { fill: none; stroke: var(--green); stroke-linecap: round; transition: stroke-dashoffset .8s ease; }
.ring-label { text-align: left; }
.ring-pct { font-size: 32px; font-weight: 700; font-family: 'JetBrains Mono', monospace; }
.ring-sub { font-size: 12px; color: var(--text2); margin-top: 2px; }

/* Target input */
.target-input-group {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}
.target-input-group label { font-size: 13px; color: var(--text2); }
.target-input {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: 8px 14px;
    font-size: 14px;
    font-family: 'JetBrains Mono', monospace;
    width: 160px;
    outline: none;
    transition: border-color .2s;
}
.target-input:focus { border-color: var(--accent); }
.target-btn {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 18px;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
}

.gap-analysis {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}
.gap-analysis-card {
    background: var(--surface2);
    border-radius: 10px;
    padding: 14px 16px;
    border-left: 3px solid transparent;
}
.gap-analysis-card.surplus { border-left-color: var(--green); }
.gap-analysis-card.deficit { border-left-color: var(--red); }
.gap-month-name { font-size: 13px; font-weight: 600; }
.gap-current { font-size: 11px; color: var(--text2); margin-top: 4px; font-family: 'JetBrains Mono', monospace; }
.gap-diff { font-size: 13px; font-weight: 600; margin-top: 6px; font-family: 'JetBrains Mono', monospace; }
.gap-diff.pos { color: var(--green); }
.gap-diff.neg { color: var(--red); }

/* Portfolio table */
table.grid-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--surface);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border);
    font-size: 13px;
}
table.grid-table th, table.grid-table td {
    padding: 9px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
table.grid-table tbody tr:last-child td { border-bottom: none; }
table.grid-table thead th {
    background: var(--surface2);
    color: var(--text3);
    font-weight: 500;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}
table.grid-table tbody tr:hover { background: var(--surface2); }
table.grid-table .num { text-align: right; font-family: 'JetBrains Mono', monospace; }
table.grid-table .mono { font-family: 'JetBrains Mono', monospace; font-size: 11.5px; color: var(--text3); }

.tag {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .5px;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
}
.tag-tinkoff { background: rgba(255, 221, 45, .12); color: #ffd43b; }
.tag-sber { background: rgba(34, 197, 94, .15); color: var(--green); }

/* Stacked horizontal bar (sectors/risk breakdown) */
.stack-bar {
    display: flex;
    width: 100%;
    height: 16px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--surface3);
}
.stack-seg {
    height: 100%;
    transition: filter .15s;
    min-width: 2px;
    cursor: default;
}
.stack-seg:hover { filter: brightness(1.3); }

/* Maturity profile */
.mat-grid {
    display: grid;
    grid-template-columns: 140px 1fr 140px 110px;
    gap: 10px 14px;
    align-items: center;
}
.mat-bucket { display: contents; }
.mat-bucket-label { font-size: 13px; font-weight: 600; }
.mat-bucket-bar {
    height: 18px;
    background: var(--surface3);
    border-radius: 4px;
    overflow: hidden;
}
.mat-bucket-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    border-radius: 4px;
    transition: width .5s ease;
}
.mat-bucket-val { font-size: 13px; text-align: right; color: var(--text); }
.mat-bucket-pct { font-size: 11px; text-align: right; color: var(--text3); }

/* Flag pills */
.flag-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 12px;
}
.flag-pill.empty { opacity: 0.4; }

/* Risk dot */
.risk-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}

/* Login */
.login-wrap {
    max-width: 360px;
    margin: 80px auto;
    padding: 32px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
}
.login-wrap h1 {
    margin: 0 0 22px 0;
    font-size: 22px;
    letter-spacing: -0.5px;
    text-align: center;
    background: linear-gradient(135deg, var(--text), var(--accent2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.login-form { display: flex; flex-direction: column; gap: 12px; }
.login-form label { display: flex; flex-direction: column; font-size: 11px; color: var(--text3); gap: 4px; text-transform: uppercase; letter-spacing: 1px; }
.login-form input {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 14px;
    outline: none;
    transition: border-color .2s;
    font-family: inherit;
}
.login-form input:focus { border-color: var(--accent); }
.login-form button {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 11px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    margin-top: 6px;
    font-family: inherit;
}
.login-form button:hover { background: var(--accent2); }
.error { color: var(--red); font-size: 13px; margin: 0; }

/* Upload */
.upload-form {
    display: flex;
    gap: 12px;
    align-items: center;
    background: var(--surface);
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--border);
    margin: 12px 0;
}
.upload-form input[type=file] { color: var(--text2); font-size: 13px; }
.upload-form button {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 9px 18px;
    cursor: pointer;
    font-weight: 500;
    font-family: inherit;
    font-size: 13px;
}
.upload-form button:hover { background: var(--accent2); }
.muted { color: var(--text2); font-size: 12px; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 3px; }

/* Animations */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate { animation: fadeUp .4s ease forwards; }

/* Responsive */
@media (max-width: 1000px) {
    .kpi-grid { grid-template-columns: 1fr 1fr; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .cal-grid { grid-template-columns: 1fr 1fr; }
    .app-header {
        padding: 14px 16px;
        flex-wrap: wrap;
        gap: 10px;
        align-items: center;
    }
    .main { padding: 16px; }

    /* Hamburger visible on mobile; nav becomes a vertical drawer */
    .nav-toggle { display: inline-flex; order: 2; }
    .app-title { order: 1; flex: 1 1 auto; min-width: 0; }
    .header-stats { order: 3; width: 100%; justify-content: space-between; gap: 10px; }
    .header-stat { text-align: left; }

    .nav {
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
        padding: 8px 10px;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
    }
    .nav.open { display: flex; }
    .nav-btn, .nav-btn-form { width: 100%; }
    .nav-btn, .nav-btn-form button {
        width: 100%;
        justify-content: flex-start;
        padding: 11px 14px;
        font-size: 14px;
        border-radius: 8px;
        gap: 10px;
    }
    .nav-btn .lucide, .nav-btn-form button .lucide { width: 18px; height: 18px; }
    .nav-sep { display: none; }
    .nav-btn-form { border-top: 1px solid var(--border); margin-top: 4px; padding-top: 4px; }

    /* Planner progress ring stacks vertically on narrow */
    .progress-ring-wrap { flex-direction: column; align-items: flex-start; }
    .ring-label { text-align: left; }

    /* Maturity grid — collapse 4-col layout into per-bucket cards */
    .mat-grid { display: flex; flex-direction: column; gap: 8px; }
    .mat-bucket {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto auto;
        gap: 4px 10px;
        padding: 10px 12px;
        background: var(--surface2);
        border-radius: 8px;
        align-items: center;
    }
    .mat-bucket-label { grid-column: 1; grid-row: 1; font-size: 13px; }
    .mat-bucket-pct { grid-column: 2; grid-row: 1; text-align: right; }
    .mat-bucket-bar { grid-column: 1 / 3; grid-row: 2; }
    .mat-bucket-val { grid-column: 1 / 3; grid-row: 3; text-align: left; font-size: 13px; }

    /* Gap analysis — ensure single column for readability */
    .gap-analysis { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 700px) {
    .nav-btn, .nav-btn-form button { padding: 6px 10px; font-size: 12px; }
    .nav-btn .lucide, .nav-btn-form button .lucide { width: 14px; height: 14px; }
    .bar-chart { height: 180px; gap: 3px; padding-top: 20px; }
    .bar { max-width: 36px; }
    .bar-label { font-size: 9px; }
    .bar-value { font-size: 9px; top: -18px; }
    .cal-tip { max-width: calc(100vw - 32px); font-size: 11px; }
    .cal-tip-row { font-size: 11px; }
    .gap-analysis { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
    .kpi-grid { gap: 10px; }
    .kpi { padding: 12px; }
    .kpi-value { font-size: 20px; }
    .kpi-sub { display: flex; flex-wrap: wrap; gap: 4px 8px; }
    .cal-grid { grid-template-columns: 1fr; }
    .card { padding: 14px; }
    .main { padding: 12px; }
    .app-header { padding: 14px 12px; }
    .app-header h1 { font-size: 18px; }
    .header-sub { font-size: 11px; }
    .header-stat .val { font-size: 15px; }
    .header-stat .lbl { font-size: 9px; }

    table.grid-table { font-size: 11px; }
    table.grid-table th, table.grid-table td { padding: 6px 8px; }

    .bar-chart { height: 150px; gap: 2px; padding-top: 18px; }
    .bar { max-width: 28px; }
    .bar-label { font-size: 8px; }

    .week-chart { height: 90px; gap: 4px; }
    .week-label { font-size: 9px; }

    .issuer-bar-bg { width: 60px; }
    .issuer-total { min-width: 70px; font-size: 11px; }
    .issuer-count { min-width: 36px; font-size: 10px; }

    .target-input-group { flex-wrap: wrap; }
    .target-input { width: 100%; }

    .upload-form { flex-wrap: wrap; gap: 8px; }
    .upload-form input[type=file] { flex: 1 1 100%; }

    .ring-pct { font-size: 26px; }
    .cal-day { font-size: 8px; }
    .cal-dow-cell { font-size: 8px; }
}

@media (max-width: 400px) {
    .kpi-grid { grid-template-columns: 1fr; }
    .app-header h1 { font-size: 16px; }
    .header-sub { font-size: 10px; }
    .header-stat .val { font-size: 14px; }
    .nav-toggle { width: 36px; height: 36px; }
}
