/* Signed-in app. Builds on /style.css tokens; effects stay on actions, never on dense data. */
#app { min-height: 100vh; }
.view { padding-block: 2.2rem 4rem; }
.view h1 { font-size: clamp(1.7rem, 3.4vw, 2.3rem); font-weight: 300; letter-spacing: -0.01em; margin: 0 0 1.2rem; }
.view h2 { font-size: 1.25rem; font-weight: 600; margin: 2rem 0 .8rem; max-width: none; }
.view h3 { margin-top: 1.4rem; }
.muted { color: var(--muted); }
.note { color: var(--muted); font-size: .9rem; margin-top: 1.4rem; max-width: 60ch; }
code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; background: var(--bg-raised); padding: .1em .4em; border-radius: 6px; overflow-wrap: anywhere; }
nav.main a[aria-current="page"] { color: var(--ink); box-shadow: 0 2px 0 var(--gold); padding-bottom: 4px; }
.btn { white-space: nowrap; }
.btn.small { min-height: 2.4rem; padding: .3rem 1rem; font-size: .92rem; }
.btn.danger { color: #ff9b8a; border-color: rgba(255, 155, 138, .5); }
:root[data-theme="light"] .btn.danger { color: #9b2c1b; border-color: rgba(155, 44, 27, .5); }
button:disabled { opacity: .6; cursor: progress; }

/* auth */
.auth { max-width: 26rem; padding-block: 3rem 4rem; }
.auth .brand { margin-bottom: 2rem; }
.auth h1 { font-size: 1.9rem; font-weight: 300; margin: 0 0 1.4rem; }
.field { margin-bottom: 1.1rem; }
.field label { display: block; margin-bottom: .35rem; font-size: .95rem; }
.field .hint { margin: .3rem 0 0; color: var(--muted); font-size: .88rem; }
input, select {
  width: 100%; min-height: 2.8rem; padding: .5rem .8rem; font: inherit; color: var(--ink); background: var(--bg-raised);
  border: 1px solid var(--line-strong); border-radius: 10px;
}
input:focus-visible, select:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.field + .field, form > .btn { margin-top: 0; }
form > .btn { margin-top: .6rem; }
.switch { margin-top: 1.4rem; color: var(--muted); }
.notice { margin: .8rem 0; padding: .7rem 1rem; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-raised); font-size: .95rem; }
.notice.error { border-color: rgba(255, 130, 110, .6); }
.notice.success { border-color: var(--gold); }
.notice p { margin: .2rem 0; }
#toast { position: fixed; inset-block-end: 1.2rem; inset-inline: 1rem; z-index: 70; display: grid; justify-items: center; pointer-events: none; }
#toast .notice { background: var(--bg); box-shadow: 0 10px 40px rgba(0,0,0,.5); }

/* dashboard */
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 999px; overflow: hidden; margin: .4rem 0 1.2rem; }
.seg button { background: transparent; color: var(--muted); border: 0; padding: .45rem 1rem; font: inherit; cursor: pointer; min-height: 2.4rem; }
.seg button[aria-pressed="true"] { color: #1a1304; background: linear-gradient(180deg, #ffe58a, #d4af37); font-weight: 600; }
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.kpi { padding: 1.1rem 1.2rem; border-inline-end: 1px solid var(--line); min-width: 0; }
.kpi:last-child { border-inline-end: 0; }
.kpi-label { margin: 0; color: var(--muted); font-size: .9rem; }
.kpi-value { margin: .2rem 0; font-size: clamp(1.35rem, 2.4vw, 1.9rem); font-weight: 300; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi-change { margin: 0; color: var(--gold-text); font-size: .82rem; }
.chart-box { border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem; background: var(--bg-raised); }
.chart { width: 100%; height: auto; }
.chart .bar { fill: var(--gold); }
.chart .bar:hover { fill: var(--gold-hi); }
.chart .axis { fill: var(--muted); font-size: 11px; }
.chart .axis-line { stroke: var(--line-strong); }
.empty { border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 2rem; max-width: 40rem; }
.empty h2 { margin-top: 0; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; min-width: 640px; font-variant-numeric: tabular-nums; }
th, td { padding: .7rem .9rem; text-align: start; border-bottom: 1px solid var(--line); }
tbody tr:last-child > * { border-bottom: 0; }
thead th { color: var(--muted); font-weight: 500; font-size: .88rem; }
tbody th { font-weight: 600; }
.num { text-align: end; }
.pill { display: inline-block; padding: .1rem .7rem; border: 1px solid var(--line-strong); border-radius: 999px; font-size: .82rem; color: var(--muted); }
.pill.active { color: var(--gold-text); border-color: var(--gold); }
.pill.error { color: #ff9b8a; border-color: rgba(255,155,138,.6); }

/* sources, settings */
.source { border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem 1.4rem; margin-top: 1.2rem; }
.source h2 { margin: 0 0 .2rem; }
.source-head { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; flex-wrap: wrap; }
.actions { display: flex; gap: .7rem; flex-wrap: wrap; margin-top: .8rem; }
.rows.plain { list-style: none; padding: 0; margin: 0; }
.rows.plain > li { display: flex; justify-content: space-between; gap: 1rem; align-items: center; flex-wrap: wrap; padding: .8rem 0; border-top: 1px solid var(--line); }
.block { max-width: 36rem; padding-block: 1rem 1.4rem; border-bottom: 1px solid var(--line); }
.block:last-child { border-bottom: 0; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1.2rem; margin: 1.2rem 0 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.codes { background: var(--bg-raised); border: 1px solid var(--line); padding: 1rem; border-radius: 10px; font-size: 1.05rem; }

@media (max-width: 880px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { border-block-end: 1px solid var(--line); }
  .top .wrap { flex-wrap: wrap; padding-block: .6rem; }
  nav.main { order: 3; width: 100%; margin: 0; gap: 1.2rem; }
  nav.main a:not(.keep) { display: inline; }
}
