/* Same design language as kabirkenth.me: near-black ground, bone text, one amber accent. */
:root {
    color-scheme: dark;
    --ink-000: #08080a;
    --ink-050: #0d0d10;
    --ink-100: #131317;
    --ink-200: #1b1b21;
    --ink-300: #26262e;
    --bone: #eceae4;
    --bone-dim: #a8a49b;
    --bone-mut: #8a867e;
    --amber: #e0a253;
    --edge: rgba(236, 234, 228, 0.09);
    --edge-hi: rgba(236, 234, 228, 0.18);

    /* chart roles (validated on --ink-100: see README) */
    --series-price: #e0a253;
    --div-bull: #3987e5;
    --div-bear: #d95926;
    --div-mid: #383835;
    --good: #0ca30c;
    --bad: #d03b3b;
    --pending: #4a4a52;
    --grid: rgba(236, 234, 228, 0.07);
    --axis: rgba(236, 234, 228, 0.16);

    --serif: "Instrument Serif", Georgia, serif;
    --sans: "Instrument Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    --gut: clamp(1rem, 4vw, 3rem);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--ink-000);
    color: var(--bone);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}
a { color: inherit; }
b, strong { font-weight: 600; }
code { font-family: var(--mono); font-size: 0.88em; color: var(--bone-dim); }
.wrap { width: 100%; max-width: 1180px; margin-inline: auto; padding-inline: var(--gut); }

/* nav */
.nav { border-bottom: 1px solid var(--edge); }
.nav-inner { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding-block: 1rem; }
.nav-mark { font-family: var(--mono); font-size: 0.85rem; text-decoration: none; letter-spacing: 0.02em; }
.nav-mark span { color: var(--amber); }
.nav-link { font-family: var(--mono); font-size: 0.78rem; color: var(--bone-dim); text-decoration: none; }
.nav-link:hover { color: var(--amber); }

/* header */
.head { padding-block: clamp(2rem, 6vw, 3.5rem) 1.5rem; }
.label {
    font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.16em; text-transform: uppercase;
    color: var(--amber); margin: 0 0 0.9rem;
}
h1, h2, h3 { font-weight: 400; margin: 0; }
h1 { font-family: var(--serif); font-size: clamp(2.3rem, 6vw, 3.8rem); line-height: 1.02; letter-spacing: -0.015em; }
h2 { font-family: var(--serif); font-size: clamp(1.5rem, 3vw, 2rem); line-height: 1.1; }
h3 { font-family: var(--sans); font-size: 0.95rem; font-weight: 500; }
.lede { color: var(--bone-dim); max-width: 64ch; font-size: clamp(1rem, 1.5vw, 1.12rem); margin: 1rem 0 1.25rem; }
.lede b { color: var(--bone); font-family: var(--mono); font-size: 0.9em; font-weight: 500; }
.sub { color: var(--bone-mut); font-size: 0.85rem; margin: 0.25rem 0 0; max-width: 80ch; }
.sub b { color: var(--bone-dim); font-weight: 500; }

.runline {
    display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.45rem 0.9rem; margin: 0;
    font-family: var(--mono); font-size: 0.78rem; color: var(--bone-dim);
    border: 1px solid var(--edge); border-radius: 999px; padding: 0.4rem 0.9rem;
}
.runline .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--bone-mut); flex: none; }
.runline.is-ok .dot { background: var(--good); box-shadow: 0 0 0 4px rgba(12, 163, 12, 0.18); }
.runline.is-warn .dot { background: #fab219; }
.runline.is-bad .dot { background: var(--bad); }
.runline .sep { color: var(--ink-300); }

.notice {
    border: 1px solid rgba(208, 59, 59, 0.45); background: rgba(208, 59, 59, 0.08);
    padding: 0.9rem 1.1rem; border-radius: 6px; color: var(--bone); margin-bottom: 1.5rem;
}

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--edge); border: 1px solid var(--edge); border-radius: 8px; overflow: hidden; margin-block: 1rem 2.5rem; }
.kpi { background: var(--ink-050); padding: 1.1rem 1.2rem 1.2rem; min-width: 0; }
.kpi-label { font-size: 0.8rem; color: var(--bone-dim); margin: 0 0 0.35rem; }
.kpi-value { font-family: var(--sans); font-weight: 600; font-size: clamp(1.6rem, 3.2vw, 2.1rem); line-height: 1.1; margin: 0; }
.kpi-value small { font-size: 0.5em; font-weight: 500; color: var(--bone-dim); margin-left: 0.3rem; }
.kpi-note { font-size: 0.78rem; color: var(--bone-mut); margin: 0.4rem 0 0; }
.kpi-note b { color: var(--bone-dim); font-weight: 500; }
@media (max-width: 820px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* blocks */
.block { margin-bottom: 3rem; }
.block-head { margin-bottom: 1rem; }

/* tables */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--edge); border-radius: 8px; }
table.grid { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.grid th {
    text-align: left; font-family: var(--mono); font-size: 0.68rem; font-weight: 500; letter-spacing: 0.08em;
    text-transform: uppercase; color: var(--bone-mut); padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--edge);
    background: var(--ink-050); white-space: nowrap;
}
.grid td { padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--edge); vertical-align: top; }
#runs td:first-child, #calls-table td:first-child { white-space: nowrap; }
.grid tr:last-child td { border-bottom: 0; }
.grid .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.grid .why { min-width: 18rem; }
.grid td.why { color: var(--bone-dim); }
.grid tbody tr[data-symbol] { cursor: pointer; }
.grid tbody tr[data-symbol]:hover { background: var(--ink-050); }
.grid tbody tr.is-selected { background: rgba(224, 162, 83, 0.06); }
.tick { font-family: var(--mono); font-weight: 500; }
.call { font-family: var(--mono); font-weight: 500; white-space: nowrap; }
.muted { color: var(--bone-mut); }
.pill { display: inline-flex; align-items: center; gap: 0.35rem; font-family: var(--mono); font-size: 0.75rem; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--bone-mut); }
.pill.is-ok::before { background: var(--good); }
.pill.is-warn::before { background: #fab219; }
.pill.is-bad::before { background: var(--bad); }
.res-good, .res-bad { font-family: var(--mono); white-space: nowrap; }

/* sentiment mini-bar in the latest table */
.sbar { display: inline-flex; align-items: center; gap: 0.5rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sbar svg { display: block; }

/* filters */
.filters { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 1rem; }
.seg { display: inline-flex; border: 1px solid var(--edge-hi); border-radius: 6px; overflow: hidden; }
.seg button {
    appearance: none; background: transparent; color: var(--bone-dim); border: 0; border-right: 1px solid var(--edge);
    font-family: var(--mono); font-size: 0.8rem; padding: 0.45rem 0.8rem; cursor: pointer; min-height: 36px;
}
.seg button:last-child { border-right: 0; }
.seg button:hover { color: var(--bone); background: var(--ink-100); }
.seg button[aria-checked="true"] { background: var(--amber); color: var(--ink-000); font-weight: 500; }
.seg button:focus-visible { outline: 2px solid var(--amber); outline-offset: -2px; }

/* panels + charts */
.panel { background: var(--ink-100); border: 1px solid var(--edge); border-radius: 8px; padding: 1rem 1.1rem 1.1rem; margin-bottom: 1rem; min-width: 0; }
.panel-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.25rem 1rem; margin-bottom: 0.6rem; }
.panel-head .sub { margin: 0; }
.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; }
@media (max-width: 900px) { .two { grid-template-columns: minmax(0, 1fr); } }
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .empty { color: var(--bone-mut); font-size: 0.85rem; padding: 1.5rem 0; }
.axis-text { fill: var(--bone-mut); font-family: var(--mono); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.gridline { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.baseline { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.crosshair { stroke: var(--edge-hi); stroke-width: 1; shape-rendering: crispEdges; }
.is-loading .chart, .is-loading .record { opacity: 0.45; transition: opacity 0.2s; }

.legend { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; font-size: 0.78rem; color: var(--bone-dim); margin-bottom: 0.7rem; }
.legend span { display: inline-flex; align-items: center; gap: 0.4rem; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.sw-good { background: var(--good); }
.sw-bad { background: var(--bad); }
.sw-pend { background: var(--pending); }
.sw-bt { background: transparent; box-shadow: inset 0 0 0 1.5px var(--bone-dim); }
.sw-bull { background: var(--div-bull); }
.sw-bear { background: var(--div-bear); }

/* call record strip */
.record { display: flex; flex-wrap: wrap; gap: 2px; }
.cell {
    width: 20px; height: 20px; border-radius: 3px; border: 0; padding: 0; cursor: default;
    display: grid; place-items: center; font-size: 11px; line-height: 1; color: #fff; font-family: var(--sans);
}
.cell.good { background: var(--good); }
.cell.bad { background: var(--bad); }
.cell.pend { background: var(--pending); color: var(--bone); }
.cell.bt { background: transparent; box-shadow: inset 0 0 0 1.5px currentColor; }
.cell.bt.good { color: var(--good); }
.cell.bt.bad { color: var(--bad); }
.cell:hover, .cell:focus-visible { outline: 2px solid var(--bone); outline-offset: 1px; }
.record-empty { color: var(--bone-mut); font-size: 0.85rem; }

.headlines { margin-top: 0.9rem; border-top: 1px solid var(--edge); padding-top: 0.8rem; }
.headlines p { margin: 0 0 0.4rem; font-size: 0.8rem; color: var(--bone-mut); }
.headlines ul { margin: 0; padding: 0; list-style: none; }
.headlines li { font-size: 0.86rem; padding: 0.3rem 0; border-bottom: 1px solid var(--edge); }
.headlines li:last-child { border-bottom: 0; }
.headlines a { text-decoration: none; }
.headlines a:hover { color: var(--amber); }
.headlines .pub { color: var(--bone-mut); font-size: 0.78rem; margin-left: 0.35rem; }

details.tableview { margin-top: 0.5rem; }
details.tableview summary { cursor: pointer; color: var(--bone-dim); font-size: 0.88rem; padding: 0.5rem 0; }
details.tableview summary:hover { color: var(--amber); }
details.tableview .table-scroll { max-height: 420px; overflow-y: auto; }

/* notes */
.notes ul { padding-left: 1.1rem; color: var(--bone-dim); max-width: 78ch; }
.notes li { margin-bottom: 0.7rem; }
.notes li b { color: var(--bone); }
.notes h2 { margin-bottom: 1rem; }

.foot { border-top: 1px solid var(--edge); padding-block: 1.5rem 2.5rem; font-family: var(--mono); font-size: 0.75rem; color: var(--bone-mut); }
.foot .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem; }
.foot a:hover { color: var(--amber); }

/* tooltip */
.tip {
    position: fixed; z-index: 10; pointer-events: none; max-width: 280px;
    background: var(--ink-200); border: 1px solid var(--edge-hi); border-radius: 6px;
    padding: 0.55rem 0.7rem; font-size: 0.8rem; line-height: 1.45; box-shadow: 0 8px 24px rgba(0,0,0,0.45);
}
.tip .t-date { font-family: var(--mono); font-size: 0.7rem; color: var(--bone-mut); margin-bottom: 0.2rem; }
.tip .t-val { font-weight: 600; font-size: 0.95rem; }
.tip .t-row { display: flex; align-items: center; gap: 0.45rem; color: var(--bone-dim); }
.tip .t-key { width: 12px; height: 2px; border-radius: 1px; flex: none; }
.tip .t-note { color: var(--bone-dim); margin-top: 0.25rem; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
