/* Theme tokens live in theme.css — the real dashboard's Dracula/Alucard palette (theme.js drives the toggle). */

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
    color: var(--fg); font-family: var(--font-ui);
    background:
      linear-gradient(rgba(49, 51, 65, .30) 1px, transparent 1px),
      linear-gradient(90deg, rgba(49, 51, 65, .30) 1px, transparent 1px),
      var(--bg-deep);
    background-size: 42px 42px;
    display: flex; flex-direction: column; overflow: hidden;
}
::-webkit-scrollbar { width: 10px; height: 10px; } ::-webkit-scrollbar-thumb { background: var(--cur-line); border-radius: 8px; }

/* ── Header ── */
.topbar {
    flex-shrink: 0; position: relative;
    display: flex; align-items: center; gap: 22px; padding: 12px 26px;
    background: var(--header-bg); backdrop-filter: blur(14px); border-bottom: 1px solid var(--bg-line);
}
/* the real dashboard's header accent strip (header::after at :8905) */
.topbar::after {
    content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
    background: linear-gradient(90deg, var(--red) 0%, color-mix(in srgb, var(--purple) 60%, transparent) 45%, transparent 90%);
    pointer-events: none;
}
.brand { font-family: var(--font-mono); font-weight: 700; font-size: .8rem; letter-spacing: .1em; color: var(--comment); white-space: nowrap; }
.brand-v { color: var(--pink); }
.today-date { margin-left: 14px; color: var(--fg); font-weight: 600; letter-spacing: 0; font-size: .74rem; }
.status-sentence { flex: 1; font-size: 1.08rem; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status-sentence.ok { color: var(--green); }
.status-sentence.attention { color: var(--red); }
/* ── Full-screen grid ── */
.screen {
    flex: 1; min-height: 0; width: 100%; max-width: 1900px; margin: 0 auto;
    display: grid; gap: 16px; padding: 16px 24px 20px;
    grid-template-columns: minmax(220px, 260px) minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto minmax(190px, 24vh);
    grid-template-areas:
        "head kpis"
        "head rhythm"
        "fixed rhythm"
        "drop mix";
}
.cell { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.headlines-zone { grid-area: head; }
.fixed-zone { grid-area: fixed; }
.money-zone { grid-area: kpis; }
.rhythm-zone { grid-area: rhythm; }
.mix-zone { grid-area: mix; }
.drop-zone { grid-area: drop; }

.zone-label {
    font-size: .68rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
    color: var(--comment); margin-bottom: 10px; flex-shrink: 0;
}

/* ── Jump bar (redirect to the real financial dashboard) ── */
.jump-bar {
    display: flex; align-items: center; gap: 10px; text-decoration: none; flex-shrink: 0;
    background: var(--bg-card); border: 1px solid var(--bg-line); border-radius: 14px;
    padding: 10px 18px; margin-bottom: 14px; color: var(--fg);
    box-shadow: 0 4px 18px var(--shadow-color);
}
.jump-bar:hover { border-color: var(--green); }
.jump-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px rgba(80, 250, 123, .6); flex-shrink: 0; }
.jump-text { font-family: var(--font-mono); font-size: .72rem; font-weight: 700; letter-spacing: .08em; color: var(--green); }
.jump-sub { font-size: .68rem; color: var(--comment); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jump-go { margin-left: auto; color: var(--comment); }
.jump-bar:hover .jump-go { color: var(--green); }

/* ── Headlines ── */
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.headlines {
    background: var(--bg-card); border: 1px solid var(--bg-line); border-radius: 14px;
    box-shadow: 0 4px 18px var(--shadow-color); overflow-y: auto;
}
.hl-line {
    display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
    background: none; border: none; border-bottom: 1px solid var(--bg-line);
    padding: 12px 18px; cursor: pointer; color: var(--fg);
    font-family: var(--font-ui); font-size: .8rem;
}
.hl-line:last-child { border-bottom: none; }
.hl-line:hover { background: rgba(139, 233, 253, .05); }
.hl-line.active { box-shadow: inset 3px 0 0 var(--cyan); background: rgba(139, 233, 253, .04); }
.hl-icon { width: 20px; text-align: center; font-size: .85rem; flex-shrink: 0; }
.hl-icon.up { color: var(--green); }
.hl-icon.down { color: var(--orange); }
.hl-icon.star { color: var(--yellow); }
.hl-icon.mix { color: var(--purple); }
.hl-icon.warn { color: var(--red); }
.hl-icon.note { color: var(--purple); }
.hl-text b { font-family: var(--font-mono); font-weight: 700; font-size: .76rem; }
.hl-go { margin-left: auto; color: var(--comment); opacity: 0; }
.hl-line:hover .hl-go { opacity: 1; }

/* ── Fixed issues (handled notes from the monitor, via localStorage) ── */
.fixed-list {
    background: var(--bg-card); border: 1px solid var(--bg-line); border-radius: 14px;
    box-shadow: 0 4px 18px var(--shadow-color); overflow-y: auto; max-height: 168px;
}
.fi-line {
    display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
    background: none; border: none; border-bottom: 1px solid var(--bg-line);
    padding: 10px 18px; cursor: default; color: var(--fg);
    font-family: var(--font-ui); font-size: .76rem;
}
.fi-line:last-child { border-bottom: none; }
.fi-line[data-day] { cursor: pointer; }
.fi-line[data-day]:hover { background: color-mix(in srgb, var(--green) 7%, transparent); }
.fi-icon { width: 18px; text-align: center; font-size: .8rem; flex-shrink: 0; color: var(--green); }
.fi-text { min-width: 0; }
.fi-text b { font-family: var(--font-mono); font-weight: 700; font-size: .72rem; }
.fi-go { margin-left: auto; color: var(--comment); opacity: 0; flex-shrink: 0; }
.fi-line[data-day]:hover .fi-go { opacity: 1; }
.fi-empty { padding: 12px 18px; font-size: .74rem; font-style: italic; color: var(--comment); }

/* ── KPI cards ── */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kpi {
    background: var(--bg-card); border: 1px solid var(--bg-line); border-radius: 14px;
    padding: 12px 16px 10px; box-shadow: 0 4px 18px var(--shadow-color);
    display: flex; flex-direction: column; gap: 4px; min-width: 0;
}
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 20px; }
.kpi-name { font-family: var(--font-mono); font-size: .62rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--comment); }
.kpi-badge { font-family: var(--font-mono); font-size: .6rem; font-weight: 700; padding: 2px 7px; border-radius: 99px; border: 1px solid var(--cur-line); color: var(--comment); white-space: nowrap; }
.kpi-badge.up { color: var(--green); border-color: rgba(80, 250, 123, .45); }
.kpi-badge.down { color: var(--red); border-color: rgba(255, 85, 85, .45); }
.kpi-value { font-family: var(--font-mono); font-weight: 700; font-size: 1.28rem; letter-spacing: -.01em; white-space: nowrap; }
.kpi-value.red { color: var(--red); }
.kpi-value.cyan { color: var(--cyan); }
.kpi-value.green { color: var(--green); }
.kpi-value.orange { color: var(--orange); }
.kpi-sub { font-size: .66rem; color: var(--comment); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sparkline { width: 100%; height: 34px; margin-top: 3px; }

/* period toggle (lives in the topbar here) — fin-v1's official pill-group look */
.period-toggle {
    display: flex; gap: 2px; align-items: center;
    border: 1px solid var(--bg-line); border-radius: 9px; padding: 3px;
}
.period-btn {
    background: none; border: none; color: var(--comment);
    padding: .32rem .85rem; border-radius: 7px;
    font-family: var(--font-mono); font-size: .72rem; font-weight: 600;
    cursor: pointer; transition: all .15s ease;
}
.period-btn:hover { color: var(--fg); }
.qbtn {
    font-family: var(--font-mono); font-size: .64rem; font-weight: 600; padding: .35rem .7rem; border-radius: 7px;
    border: 1px solid var(--cur-line); background: var(--control-bg); color: var(--fg); cursor: pointer;
}
.qbtn:hover { border-color: var(--cyan); }
.qbtn:disabled { opacity: .45; cursor: default; }
.qbtn.save { color: var(--green); border-color: rgba(80, 250, 123, .45); }
.period-btn.active {
    background: var(--red); color: #1e2029; font-weight: 700;
    box-shadow: 0 2px 10px rgba(255, 85, 85, .3);
}

/* ── Rhythm bars (flexible height) ── */
.rhythm-card {
    background: var(--bg-card); border: 1px solid var(--bg-line); border-radius: 14px;
    padding: 26px 18px 10px; box-shadow: 0 4px 18px var(--shadow-color);
    flex: 1; min-height: 0; display: flex; flex-direction: column;
}
.bar-area { flex: 1; min-height: 0; display: flex; gap: 4px; }
.bar-col { flex: 1 1 0; min-width: 0; cursor: pointer; display: flex; flex-direction: column; }
.bar-track { flex: 1; min-height: 0; display: flex; align-items: flex-end; }
.bar { position: relative; width: 100%; min-height: 2px; border-radius: 4px 4px 0 0; background: rgba(139, 233, 253, .5); }
.bar-col:hover .bar { background: rgba(139, 233, 253, .85); }
.bar.is-best { background: rgba(189, 147, 249, .75); }
.bar.is-low { background: rgba(255, 85, 85, .7); }
.bar.active { outline: 2px solid var(--cyan); outline-offset: 1px; }
.bar-peak {
    position: absolute; left: 50%; transform: translateX(-50%); bottom: 100%; padding-bottom: 3px;
    font-family: var(--font-mono); font-size: .6rem; font-weight: 700; color: var(--purple); white-space: nowrap;
}
.bar-peak.low { color: var(--red); }
.bar-flag { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(100% + 15px); font-size: .6rem; }
.bar-label { margin-top: 6px; text-align: center; font-family: var(--font-mono); font-size: .56rem; color: var(--comment); white-space: nowrap; overflow: hidden; min-height: 12px; flex-shrink: 0; }
.bar-tooltip {
    position: fixed; transform: translateX(-50%); z-index: 60;
    background: var(--tooltip-bg); border: 1px solid var(--cur-line); border-radius: 8px;
    padding: 6px 10px; font-family: var(--font-mono); font-size: .66rem; color: var(--fg);
    pointer-events: none; opacity: 0; transition: opacity .12s; white-space: nowrap;
}
.bar-tooltip.show { opacity: 1; }
.q-empty { color: var(--comment); font-size: .8rem; padding: 12px 6px; }

/* ── Inline detail panel (expands inside the rhythm zone) ── */
#rhythmDetail { flex-shrink: 0; }
.log-inline {
    margin-top: 12px; background: var(--tooltip-bg); border: 1px solid var(--cur-line);
    border-radius: 12px; overflow: hidden; animation: unfold .22s ease;
}
@keyframes unfold { from { opacity: 0; transform: translateY(-8px); } }
.li-head {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    padding: 8px 18px; border-bottom: 1px solid var(--bg-line); background: rgba(0, 0, 0, .16);
}
.li-title { font-family: var(--font-mono); font-size: .74rem; font-weight: 700; color: var(--cyan); letter-spacing: .04em; }
.li-meta { color: var(--comment); font-weight: 500; font-size: .72rem; margin-left: auto; }
.li-body { max-height: 28vh; overflow-y: auto; padding: 10px 18px 14px; }
.li-foot { margin-top: 10px; font-family: var(--font-mono); font-size: .64rem; color: var(--comment); }

.ml-line { display: flex; gap: 14px; font-family: var(--font-mono); font-size: .76rem; line-height: 1.7; align-items: baseline; padding: 1px 6px; }
.ml-line.err { background: rgba(255, 85, 85, .1); border-radius: 4px; margin-bottom: 8px; }
.ml-level { font-weight: 700; flex-shrink: 0; color: var(--comment); }
.ml-level.err { color: var(--red); }
.ml-msg { color: var(--fg); word-break: break-word; }

.bd-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 30px; padding: 4px 0 4px; }
.day-chips { display: flex; flex-wrap: wrap; gap: 7px; padding: 10px 0 2px; border-top: 1px dashed var(--bg-line); margin-top: 10px; }
.day-chip {
    font-family: var(--font-mono); font-size: .62rem; padding: 3px 9px; border-radius: 99px;
    border: 1px solid var(--cur-line); background: var(--control-bg); color: var(--fg); cursor: pointer;
}
.day-chip:hover { border-color: var(--cyan); }
.day-chip.bad { color: var(--orange); border-color: rgba(255, 184, 108, .5); }

/* ── Payment mix (compact) ── */
.mix-card {
    background: var(--bg-card); border: 1px solid var(--bg-line); border-radius: 14px;
    padding: 12px 20px; box-shadow: 0 4px 18px var(--shadow-color);
    display: flex; gap: 26px; align-items: center;
    flex: 1; min-height: 0; overflow: hidden;
}
.donut-wrap { position: relative; width: 148px; height: 148px; flex-shrink: 0; }
.donut-wrap svg { width: 100%; height: 100%; }
.donut-seg { opacity: .92; }
.donut-center {
    position: absolute; inset: 0; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 1px; pointer-events: none;
}
.donut-total { font-family: var(--font-mono); font-weight: 700; font-size: .78rem; }
.donut-sub { font-size: .56rem; color: var(--comment); text-transform: uppercase; letter-spacing: .1em; }
.mix-legend {
    flex: 1; min-width: 0; max-height: 100%; overflow-y: auto; align-content: center;
    display: grid; grid-template-columns: 1fr 1fr; gap: 7px 22px;
}
.lg-top { display: flex; align-items: center; gap: 7px; min-width: 0; }
.lg-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.lg-name { font-family: var(--font-mono); font-size: .6rem; font-weight: 600; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lg-pct { margin-left: auto; font-family: var(--font-mono); font-size: .58rem; color: var(--comment); flex-shrink: 0; }
.lg-amt { font-family: var(--font-mono); font-size: .62rem; font-weight: 600; flex-shrink: 0; min-width: 80px; text-align: right; }
.lg-row.negative .lg-amt { color: var(--red); }
.lg-bar { height: 4px; margin-top: 3px; background: rgba(0, 0, 0, .3); border-radius: 99px; overflow: hidden; }
.lg-fill { height: 100%; border-radius: 99px; }

/* ── Drop zone (compact) ── */
.q-tray {
    border: 2px dashed var(--cur-line); border-radius: 14px; padding: 12px;
    background: rgba(0, 0, 0, .14);
}
#dropTray {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 5px; min-height: 84px; cursor: pointer; text-align: center; flex-shrink: 0;
}
#dropTray.dragover { border-color: var(--cyan); background: rgba(139, 233, 253, .05); }
.drop-title { font-size: .8rem; font-weight: 600; }
.drop-sub { font-size: .68rem; color: var(--comment); }
.drop-sub .browse { color: var(--cyan); text-decoration: underline; cursor: pointer; }
.file-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.file-chip {
    display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: .64rem;
    padding: 4px 11px; border-radius: 99px; border: 1px solid var(--cur-line); background: var(--bg-card);
}
.file-chip.sending { border-color: rgba(255, 184, 108, .6); color: var(--orange); animation: blink 1.2s ease-in-out infinite; }
.chip-size { color: var(--comment); }
.chip-x { cursor: pointer; color: var(--comment); font-weight: 700; }
.chip-x:hover { color: var(--red); }
.drop-foot { display: flex; align-items: center; gap: 14px; margin-top: 10px; flex-shrink: 0; }
.drop-foot .qbtn { font-size: .7rem; padding: .45rem .9rem; }
.upload-note { font-size: .7rem; color: var(--comment); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upload-note.ok { color: var(--green); }
.received { margin-top: 8px; overflow-y: auto; min-height: 0; }
.rc-line { font-family: var(--font-mono); font-size: .64rem; color: var(--comment); padding: 2px 0; }
.rc-line b { color: var(--fg); font-weight: 600; }

/* ── Fallback: small windows scroll like v1 ── */
@media (max-width: 1080px), (max-height: 600px) {
    body { overflow: auto; display: block; height: auto; }
    .screen { display: block; padding: 20px; max-width: 1200px; }
    .cell { margin-bottom: 30px; }
    .topbar { flex-wrap: wrap; gap: 10px; position: sticky; top: 0; z-index: 5; }
    .status-sentence { font-size: .95rem; white-space: normal; }
    .rhythm-card { flex: none; }
    .bar-track { height: 150px; flex: none; }
    .headlines { overflow: visible; }
    .mix-card { flex: none; }
    .donut-wrap { width: 200px; height: 200px; }
    .li-body { max-height: 340px; }
    .kpi-row { grid-template-columns: 1fr 1fr; }
    .mix-legend { grid-template-columns: 1fr; }
}

/* ── Theme-aware accent tints (readable in both Dracula and Alucard) ── */
/* keep the Flow-Board grid paper in light mode too (beats theme.css's cream-gradient !important) */
html:root[data-theme="alucard"] body {
    background:
        linear-gradient(rgba(108, 102, 75, .16) 1px, transparent 1px),
        linear-gradient(90deg, rgba(108, 102, 75, .16) 1px, transparent 1px),
        var(--bg-deep) !important;
    background-size: 42px 42px !important;
}
.bar { background: color-mix(in srgb, var(--cyan) 55%, transparent); }
.bar-col:hover .bar { background: color-mix(in srgb, var(--cyan) 85%, transparent); }
.bar.is-best { background: color-mix(in srgb, var(--purple) 75%, transparent); }
.bar.is-low { background: color-mix(in srgb, var(--red) 70%, transparent); }
.hl-line:hover { background: color-mix(in srgb, var(--cyan) 7%, transparent); }
.hl-line.active { background: color-mix(in srgb, var(--cyan) 6%, transparent); }
.period-btn.active { box-shadow: 0 2px 10px color-mix(in srgb, var(--red) 30%, transparent); }
#dropTray.dragover { background: color-mix(in srgb, var(--cyan) 7%, transparent); }
.file-chip.sending { border-color: color-mix(in srgb, var(--orange) 60%, transparent); }
.kpi-badge.up { border-color: color-mix(in srgb, var(--green) 45%, transparent); }
.kpi-badge.down { border-color: color-mix(in srgb, var(--red) 45%, transparent); }
.qbtn.save { border-color: color-mix(in srgb, var(--green) 45%, transparent); }
.day-chip.bad { border-color: color-mix(in srgb, var(--orange) 50%, transparent); }
.ml-line.err { background: color-mix(in srgb, var(--red) 10%, transparent); }
.jump-dot { box-shadow: 0 0 8px color-mix(in srgb, var(--green) 60%, transparent); }

/* ── Sign out (topbar, mock) ── */
.logout-btn {
    border-radius: 99px; padding: .4rem .9rem; font-size: .7rem;
    color: var(--red); border-color: color-mix(in srgb, var(--red) 45%, transparent);
}
.logout-btn:hover { border-color: var(--red); background: color-mix(in srgb, var(--red) 9%, transparent); }
.logout-btn:disabled { opacity: .6; cursor: wait; }

/* RESPONSIVE PHONE — the standalone demo remains usable outside the landing preview. */
@media (max-width: 640px) {
    .topbar { align-items: center; padding: 10px 12px; }
    .brand { flex: 1 0 100%; }
    .period-toggle {
        order: 3; width: 100%; overflow-x: auto;
        scrollbar-width: thin; -webkit-overflow-scrolling: touch;
    }
    .period-btn, .theme-toggle, .logout-btn { min-height: 44px; }
    .screen { padding: 14px 12px; }
    .cell { margin-bottom: 24px; }
    .kpi-row { grid-template-columns: 1fr; }
    .jump-bar, .hl-line, .fi-line, .day-chip, .qbtn { min-height: 44px; }
}
