/* FuMarco — Mobile-first Gas Price Dashboard */

:root {
    --bg: #0f1117;
    --surface: #1a1d27;
    --surface-2: #242836;
    --border: #2e3345;
    --text: #e4e7f0;
    --text-muted: #8b92a8;
    --accent: #4ade80;
    --accent-dim: #22c55e;
    --danger: #f87171;
    --warning: #fbbf24;
    --brand: #60a5fa;
    --radius: 12px;
    --radius-sm: 8px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: -0.5px;
}

.tagline {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: 8px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.user-name {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.logout-btn {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.8rem;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.logout-btn:hover { color: var(--text); border-color: var(--text-muted); }

/* Dashboard */
.dashboard {
    max-width: 800px;
    margin: 0 auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Stream Health Pills */
.pill-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.pill {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 600;
}

.pill.ok { background: #052e16; color: var(--accent); }
.pill.degraded { background: #422006; color: var(--warning); }
.pill.down { background: #450a0a; color: var(--danger); }
.pill.loading { background: var(--surface-2); color: var(--text-muted); }

/* Price Grid */
.price-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

@media (min-width: 600px) {
    .price-grid { grid-template-columns: 1fr 1fr; }
}

.station-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
}

.station-card .station-name {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.station-card .station-brand {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.station-card .price-big {
    font-size: 2rem;
    font-weight: 800;
    color: var(--accent);
}

.station-card .price-unit {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.station-card .price-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.grade-secondary {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.staleness {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 6px;
}
.staleness-fresh { color: var(--accent); }
.staleness-stale { color: var(--warning); }

.empty-state {
    background: var(--surface-2);
    border-radius: 12px;
    padding: 40px 24px;
    text-align: center;
    grid-column: 1 / -1;
}
.empty-icon { font-size: 2.5rem; margin-bottom: 12px; }
.empty-headline { margin: 0 0 8px; font-size: 1.1rem; }
.empty-hint { color: var(--text-muted); font-size: 0.9rem; margin: 0 0 20px; }
.empty-chips { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 20px; }
.empty-chip {
    background: var(--surface-3, var(--surface-2));
    border: 1px solid var(--border, #2a2f45);
    border-radius: 20px;
    color: var(--text);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 6px 16px;
    transition: background 0.15s;
}
.empty-chip:hover { background: var(--accent-dim); color: #fff; border-color: var(--accent-dim); }
.empty-scroll-cue {
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.8rem;
    margin-top: 4px;
}
.empty-scroll-cue:hover { color: var(--text); }

.station-card .grades {
    display: flex;
    gap: 12px;
    margin-top: 8px;
    font-size: 0.8rem;
}

.station-card .grade-item {
    color: var(--text-muted);
}

.station-card .grade-item .grade-price {
    color: var(--text);
    font-weight: 600;
}

/* Trend arrows */
.trend-up { color: var(--danger); }
.trend-down { color: var(--accent); }
.trend-flat { color: var(--text-muted); }

/* Add Station */
.add-station { background: var(--surface); border-radius: var(--radius); padding: 16px; }
.add-station h3 { font-size: 0.95rem; margin-bottom: 12px; }

.search-bar input {
    width: 100%;
    padding: 10px 14px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.9rem;
}

.search-bar input::placeholder { color: var(--text-muted); }
.search-bar input:focus { outline: none; border-color: var(--brand); }

#search-results {
    margin-top: 8px;
}

.search-result {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    border-bottom: 1px solid var(--border);
}

.search-result:last-child { border-bottom: none; }

.search-result .sr-info { flex: 1; }
.search-result .sr-name { font-weight: 600; font-size: 0.9rem; }
.search-result .sr-addr { font-size: 0.75rem; color: var(--text-muted); }
.search-result .sr-price { font-weight: 700; color: var(--accent); margin-right: 12px; }

.btn {
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
}

.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary { background: var(--accent-dim); color: #000; border-color: var(--accent-dim); }
.btn-primary:hover { background: var(--accent); }

/* History */
.history-section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
}

.history-section h3 { font-size: 0.95rem; margin-bottom: 12px; }

.chart-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.chart-controls button {
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.8rem;
}

.chart-controls button.active { border-color: var(--accent); color: var(--accent); }

.chart-grade-filters {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.chart-grade-filters button {
    padding: 3px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.75rem;
}
.chart-grade-filters button.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #000;
}

/* Centered message */
.centered-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
    text-align: center;
    gap: 12px;
}

.centered-message h1 { color: var(--danger); }
.centered-message p { color: var(--text-muted); }

.loading { color: var(--text-muted); font-style: italic; }

/* Chart wrapper — constrain height */
.chart-wrapper {
    position: relative;
    max-height: 350px;
}

/* App logo */
.logo-img {
    height: 40px;
    width: 40px;
    max-width: 40px;
    object-fit: contain;
}

/* ============================================================
 * Homepage (index.html) — public-facing regional summary
 * ============================================================ */

.homepage {
    max-width: 960px;
    margin: 0 auto;
    padding: 24px 20px 48px;
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.section-head h2 {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.3px;
    color: var(--text);
}

.section-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.section-link {
    font-size: 0.85rem;
    color: var(--brand);
    text-decoration: none;
    font-weight: 600;
}

.section-link:hover { text-decoration: underline; }

.empty-state {
    color: var(--text-muted);
    font-style: italic;
    padding: 16px;
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px dashed var(--border);
}

/* Stream health badge in header */
.health-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    margin-left: 8px;
    line-height: 1.4;
}

.health-badge .health-detail {
    font-weight: 500;
    opacity: 0.85;
}

.health-live { background: #052e16; color: var(--accent); border: 1px solid #14532d; }
.health-stale { background: #422006; color: var(--warning); border: 1px solid #78350f; }
.health-down { background: #450a0a; color: var(--danger); border: 1px solid #7f1d1d; }

/* Regional grade grid */
.grade-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
}

.grade-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 18px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.grade-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 600;
}

.grade-price {
    font-size: 2.1rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text);
    line-height: 1.1;
}

.grade-unit {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-left: 4px;
}

.grade-delta {
    font-size: 0.82rem;
    font-weight: 600;
    margin-top: 2px;
}

.grade-delta-label {
    color: var(--text-muted);
    font-weight: 500;
    margin-left: 4px;
}

.delta-down { color: var(--accent); }
.delta-up { color: var(--danger); }
.delta-flat { color: var(--text-muted); font-weight: 500; }

/* Top deals strip */
.deals-list {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.deal-row {
    display: grid;
    grid-template-columns: 36px 1fr auto;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}

.deal-row:last-child { border-bottom: none; }

.deal-rank {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-muted);
    text-align: center;
}

.deal-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
}

.deal-meta {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.deal-price-block {
    text-align: right;
}

.deal-price {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    line-height: 1;
}

.deal-age {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.price-below { color: var(--accent); }
.price-above { color: var(--danger); }
.price-flat { color: var(--text); }

.deal-stale { opacity: 0.5; }
.deal-stale .deal-price { color: var(--text-muted); }

.legend {
    margin-top: 10px;
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.legend-swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    margin-right: 4px;
    vertical-align: middle;
}

.swatch-below { background: var(--accent); }
.swatch-above { background: var(--danger); }

/* Secondary streams row */
.streams-row {
    margin-top: -8px;
}

.streams-row h3 {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 600;
}

.stream-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.stream-pill {
    font-size: 0.74rem;
    padding: 5px 12px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-muted);
}

.stream-pill strong {
    color: var(--text);
    font-weight: 700;
    margin-right: 4px;
}

.stream-ok { border-color: #14532d; }
.stream-ok strong { color: var(--accent); }
.stream-degraded { border-color: #78350f; }
.stream-degraded strong { color: var(--warning); }
.stream-down { border-color: #7f1d1d; }
.stream-down strong { color: var(--danger); }

/* Personalization (below fold) */
.fold-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 20px 0 8px;
}

.personal-section {
    margin-top: 8px;
}

.cta-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.cta-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
}

.cta-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    max-width: 480px;
}

/* Header tweaks for new badge layout */
.header-left { flex-wrap: wrap; }

@media (max-width: 540px) {
    .health-badge .health-detail { display: none; }
    .section-head h2 { font-size: 1.2rem; }
    .grade-price { font-size: 1.8rem; }
    .deal-row { grid-template-columns: 28px 1fr auto; gap: 10px; padding: 12px; }
    .deal-price { font-size: 1.2rem; }
}

/* ============================================================
 * Dashboard Phase 2 — station cards, savings, preferences
 * ============================================================ */

.station-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 4px;
}

.remove-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    padding: 0 4px;
    opacity: 0.5;
    flex-shrink: 0;
}

.remove-btn:hover { color: var(--danger); opacity: 1; }

.station-card.is-default { border-color: #14532d; }

.default-badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--accent);
    background: #052e16;
    border: 1px solid #14532d;
    border-radius: 4px;
    padding: 2px 7px;
}

.set-default-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.72rem;
    padding: 2px 7px;
}

.set-default-btn:hover { border-color: var(--accent); color: var(--accent); }

.savings-badge {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--accent);
    margin-top: 6px;
}

.savings-badge.pricier { color: var(--text-muted); font-weight: 500; }

.card-footer { margin-top: 8px; }

/* Preferences panel */
.prefs-panel {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
}

.prefs-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    cursor: pointer;
    user-select: none;
}

.prefs-header:hover { background: var(--surface-2); }
.prefs-header h3 { font-size: 0.95rem; }
#prefs-toggle-icon { font-size: 0.7rem; color: var(--text-muted); }

.prefs-body {
    padding: 0 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.prefs-body.hidden { display: none; }

.prefs-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.prefs-row > label:first-child {
    width: 210px;
    font-size: 0.85rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.prefs-row input[type="number"] {
    width: 90px;
    padding: 6px 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.9rem;
}

.prefs-row input[type="number"]:focus { outline: none; border-color: var(--brand); }

.checkbox-group {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text);
    cursor: pointer;
}

.prefs-actions { margin-top: 4px; }

.prefs-msg {
    font-size: 0.8rem;
    color: var(--accent);
}

@media (max-width: 540px) {
    .prefs-row > label:first-child { width: 100%; margin-bottom: -4px; }
}

/* ============================================================
 * Dashboard Phase 3 — fillup form, ledger
 * ============================================================ */

/* Ledger */
.ledger-panel {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 16px;
}

.ledger-panel h3 { font-size: 0.95rem; margin-bottom: 12px; }

.ledger-stats {
    display: flex;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: 12px;
}

.ledger-stat {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 8px;
    border-right: 1px solid var(--border);
}

.ledger-stat:last-child { border-right: none; }

.stat-val {
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1.1;
    color: var(--text);
}

.savings-val { color: var(--accent); }

.stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 4px;
    text-align: center;
}

.ledger-recent { display: flex; flex-direction: column; gap: 6px; }

.ledger-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.82rem;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
}

.ledger-row:last-child { border-bottom: none; }
.lr-station { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lr-detail { color: var(--text-muted); white-space: nowrap; }
.lr-age { color: var(--text-muted); font-size: 0.75rem; white-space: nowrap; }

/* Fillup panel */
.fillup-panel {
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
}

.fillup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    cursor: pointer;
    user-select: none;
}

.fillup-header:hover { background: var(--surface-2); }
.fillup-header h3 { font-size: 0.95rem; }
#fillup-toggle-icon { font-size: 0.7rem; color: var(--text-muted); }

.fillup-body {
    padding: 0 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.fillup-body.hidden { display: none; }

/* Photo upload row */
.photo-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.photo-input {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.photo-input label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.photo-input input[type="file"] {
    font-size: 0.8rem;
    color: var(--text-muted);
    max-width: 200px;
}

.photo-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* Fillup form fields */
.fillup-fields {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.fillup-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.fillup-row label {
    width: 160px;
    font-size: 0.85rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.fillup-input, .fillup-select {
    padding: 7px 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.9rem;
}

.fillup-input { width: 150px; }
.fillup-select { width: 200px; }
.fillup-date { width: 210px; }

.fillup-input:focus, .fillup-select:focus { outline: none; border-color: var(--brand); }
.fillup-select option { background: var(--surface-2); }

.fillup-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 4px;
}

@media (max-width: 540px) {
    .fillup-row { flex-direction: column; align-items: flex-start; }
    .fillup-row label { width: auto; }
    .fillup-input, .fillup-select, .fillup-date { width: 100%; }
    .ledger-stats { flex-direction: column; }
    .ledger-stat { border-right: none; border-bottom: 1px solid var(--border); }
    .ledger-stat:last-child { border-bottom: none; }
}

/* Advice banner */
.advice-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    background: linear-gradient(135deg, #1a3a2a 0%, #1e3040 100%);
    border: 1px solid #2e7d52;
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 8px;
}

.advice-banner.hidden { display: none; }

.advice-icon { font-size: 1.4rem; flex-shrink: 0; }

.advice-body {
    flex: 1;
    font-size: 0.92rem;
    color: var(--text);
    line-height: 1.4;
}

.advice-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.advice-cta { font-size: 0.82rem; padding: 6px 12px; }

.advice-dismiss {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    line-height: 1;
}

.advice-dismiss:hover { color: var(--text); background: var(--surface-2); }

.advice-note { font-size: 0.8rem; color: var(--text-muted); }

@media (max-width: 540px) {
    .advice-banner { flex-wrap: wrap; }
    .advice-actions { width: 100%; justify-content: flex-end; }
}

/* Ledger missed savings + month-to-date */
.missed-val { color: #ef9a9a; }

.ledger-month {
    font-size: 0.85rem;
    color: var(--text-muted);
    padding: 6px 0 2px;
    border-top: 1px solid var(--border);
    margin-top: 4px;
}

.ledger-summary { margin-bottom: 12px; }
.ledger-summary-main {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.ledger-savings-big {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--accent);
}
.ledger-mtd-chip {
    font-size: 0.8rem;
    color: var(--text-muted);
    background: var(--surface-2);
    border-radius: 12px;
    padding: 3px 10px;
}

/* Recommendation history panel */
.rec-history-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0 4px;
    margin-top: 8px;
    border-top: 1px solid var(--border);
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-muted);
    user-select: none;
}

.rec-history-toggle:hover { color: var(--text); }

.rec-row {
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}

.rec-row:last-child { border-bottom: none; }

.rec-row-top {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 2px;
}

.rec-action-icon { font-size: 1rem; flex-shrink: 0; }
.rec-reasoning { flex: 1; color: var(--text-muted); font-size: 0.82rem; }
.rec-station { color: var(--text-muted); font-size: 0.78rem; }
.rec-age { color: var(--text-muted); font-size: 0.8rem; white-space: nowrap; }
.rec-row-bottom { display: flex; align-items: center; gap: 8px; margin-top: 3px; flex-wrap: wrap; }
.rec-row-detail { color: var(--text-muted); font-size: 0.8rem; padding-left: 2px; }

.outcome-badge {
    font-size: 0.75rem;
    padding: 1px 6px;
    border-radius: 10px;
    font-weight: 600;
    white-space: nowrap;
}

.outcome-followed     { background: #1b4332; color: #6ee7b7; }
.outcome-not-followed { background: #3b1f1f; color: #fca5a5; }
.outcome-skipped      { background: #422006; color: var(--warning); }
.outcome-pending      { background: #2a2a2a; color: var(--text-muted); }

/* Historical Context panel */
.regional-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 16px;
}

.regional-controls { margin-bottom: 10px; }

.regional-range-btns {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.regional-range-btns button {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    padding: 4px 12px;
    font-size: 0.8rem;
    cursor: pointer;
}

.regional-range-btns button.active {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
}

.regional-current {
    font-size: 0.82rem;
    color: #ef9a9a;
    font-weight: 500;
    margin-bottom: 6px;
    min-height: 1.1em;
}

/* Day-of-week heatmap panel */
.dow-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 16px;
}

.dow-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.dow-select {
    padding: 6px 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.85rem;
    flex: 1;
    min-width: 160px;
}

.dow-select option { background: var(--surface-2); }

.dow-day-btns {
    display: flex;
    gap: 4px;
}

.dow-day-btns button {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    font-size: 0.8rem;
    cursor: pointer;
}

.dow-day-btns button.active {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
}

.dow-cheapest {
    font-size: 0.85rem;
    color: #66bb6a;
    font-weight: 500;
    margin-bottom: 8px;
    min-height: 1.2em;
}

/* Geolocation row in prefs */
.geo-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.geo-btn { font-size: 0.82rem; padding: 6px 12px; }

/* ============================================================
 * Mobile: < 480px narrow phone breakpoint
 * ============================================================ */
@media (max-width: 480px) {
    /* Header: hide tagline, constrain user-name */
    .tagline { display: none; }
    .user-name { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

    /* Station cards: ensure no horizontal overflow */
    .price-grid { grid-template-columns: 1fr; }
    .station-card { min-width: 0; box-sizing: border-box; }

    /* Advice banner: wrap actions below body on very narrow screens */
    .advice-actions { flex-wrap: wrap; width: 100%; justify-content: flex-end; }
    .advice-fill-anyway { flex: 1; }

    /* Ledger summary: stack savings + MTD chip vertically */
    .ledger-summary-main { flex-direction: column; align-items: flex-start; gap: 6px; }
    .ledger-savings-big { font-size: 1.3rem; }
    .ledger-stats { flex-direction: column; }
    .ledger-stat { border-right: none; border-bottom: 1px solid var(--border); }
    .ledger-stat:last-child { border-bottom: none; }

    /* DOW controls: select takes full width, day buttons wrap below */
    .dow-controls { flex-direction: column; align-items: stretch; }
    .dow-select { min-width: 0; width: 100%; }
    .dow-day-btns { justify-content: flex-start; }

    /* Chart grade filters: smaller text */
    .chart-grade-filters button { font-size: 0.7rem; padding: 2px 8px; }
}
