/* EdgeBook — app-shell and page-specific styles on top of the design system (app.css). */
.auth { position: fixed; inset: 0; background: var(--c-page-bg); display: flex; align-items: flex-start; justify-content: center; padding-top: 12vh; z-index: 100; }
.auth__box { width: 420px; }
.auth__box .panel__title { font-size: var(--fs-md); }
#app[hidden], #auth[hidden], #toast[hidden] { display: none; }
body.has-ticker { padding-bottom: 22px; }

.subnav__models { display: flex; align-items: flex-end; gap: 2px; height: 100%; }
.subnav__models a { font-weight: 700; }
.subnav__models a.subnav__add { font-weight: 400; color: var(--c-text-muted); }
.subnav__right label { color: var(--c-text-muted); }
.subnav__right select { height: 18px; line-height: 16px; font-size: var(--fs-sm); }
.subnav__right .seg .btn { height: 18px; line-height: 16px; font-size: var(--fs-xs); padding: 0 6px; }

.toast { position: fixed; right: 12px; bottom: 30px; z-index: 120; padding: 5px 10px; font-size: var(--fs-sm); background: var(--c-warn-bg); border: 1px solid var(--c-warn-border); box-shadow: var(--shadow-pop); }
.toast--error { background: var(--c-neg-bg); border-color: var(--c-neg); color: var(--c-neg); }
.toast--ok { background: var(--c-pos-bg); border-color: var(--c-pos); }

.page-head { display: flex; align-items: baseline; gap: var(--sp-4); margin-bottom: var(--sp-4); }
.page-head h1 { font-size: var(--fs-lg); }
.page-head .scope { color: var(--c-text-muted); font-size: var(--fs-sm); }
.page-head .spacer { flex: 1; }

/* checklists grouped by heading (mistakes, confluences) */
.check-groups { display: block; }
.check-group + .check-group { margin-top: var(--sp-3); }
.check-group__title { font-size: var(--fs-xs); font-weight: 700; color: var(--c-text-muted); text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px dotted var(--c-border-strong); margin-bottom: 2px; }
.check-group .check-list { column-gap: var(--sp-4); }
.check-group .check { line-height: 17px; }

/* trade form */
.tform th { width: 150px; }
.tform .form__section th { font-size: var(--fs-md); padding-top: var(--sp-5); }
.tform .calc { display: inline-block; margin-left: var(--sp-4); color: var(--c-text-muted); font-size: var(--fs-sm); }
.tform .calc b { color: var(--c-text); }
.tform .exits td { padding: 1px 4px 1px 0; }
.tform .shot { display: inline-block; margin: 0 6px 6px 0; border: 1px solid var(--c-border-strong); padding: 2px; background: #fff; vertical-align: top; }
.tform .shot img { display: block; max-height: 90px; }
.tform .shot .small { display: block; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tform .sticky-actions { position: sticky; bottom: 22px; background: var(--c-sunken); border-top: 1px solid var(--c-border-strong); padding: var(--sp-3) var(--sp-4); display: flex; gap: var(--sp-3); align-items: center; }
.err-list { color: var(--c-neg); font-size: var(--fs-sm); margin: 0; padding-left: 16px; }

/* trade detail */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gutter); align-items: start; }
.shots img { max-width: 100%; border: 1px solid var(--c-border-strong); display: block; margin-bottom: var(--sp-2); }
.shots figcaption { font-size: var(--fs-xs); color: var(--c-text-muted); margin-bottom: var(--sp-3); }

/* insight cards */
.insight__head { display: flex; gap: var(--sp-3); align-items: baseline; }
.insight__meta { font-size: var(--fs-xs); color: var(--c-text-faint); }
.insight__actions { margin-top: 2px; font-size: var(--fs-xs); }
.insight__actions a { margin-right: var(--sp-3); }
.insight--pos .chip--kind { background: var(--c-pos); border-color: var(--c-pos); color: #fff; }
.insight--info .chip--kind { background: var(--c-link); border-color: var(--c-link); color: #fff; }

/* habit grid */
.habit-table td.cell { width: 22px; text-align: center; padding: 0; cursor: pointer; user-select: none; }
.habit-table td.cell span { display: block; width: 18px; height: 16px; margin: 1px auto; border: 1px solid var(--c-border-strong); background: #fff; }
.habit-table td.cell.done span { background: var(--heat-p3); border-color: var(--heat-p4); }
.habit-table td.cell.miss span { background: var(--heat-n2); border-color: var(--heat-n3); }
.habit-table td.cell.skip span { background: repeating-linear-gradient(45deg, var(--c-sunken) 0 2px, #fff 2px 4px); }
.habit-table td.cell.na span { background: var(--c-sunken); border-color: var(--c-border); cursor: default; }
.habit-table td.cell.today span { outline: 1px solid var(--c-link); outline-offset: 1px; }
.habit-table th.day { font-size: var(--fs-xs); text-align: center; padding: 0 2px; }
.habit-table th.day.weekend { color: var(--c-text-faint); }

/* year heatmap for habits (53 week columns) */
.year-heat { border-collapse: separate; border-spacing: 1px; }
.year-heat td { width: 10px; height: 10px; padding: 0; background: var(--c-sunken); }
.year-heat td.l1 { background: var(--heat-p1); } .year-heat td.l2 { background: var(--heat-p2); } .year-heat td.l3 { background: var(--heat-p3); } .year-heat td.l4 { background: var(--heat-p4); }
.year-heat td.m { background: var(--heat-n2); }

/* charts */
.chart-box--sm { height: 160px; } .chart-box--lg { height: 300px; }
.chart-note { font-size: var(--fs-xs); color: var(--c-text-muted); padding: var(--sp-2) 0 0; }

/* misc */
.empty { color: var(--c-text-muted); padding: var(--sp-5); text-align: center; }
.cols--3-1 { grid-template-columns: 3fr minmax(0, 1fr); }
.mono-num { font-family: var(--font-mono); }
.grade { display: inline-block; min-width: 18px; text-align: center; font-weight: 700; border: 1px solid var(--c-border-strong); padding: 0 3px; font-size: var(--fs-xs); background: #fff; }
.dot { display: inline-block; width: 8px; height: 8px; border: 1px solid rgba(0,0,0,.3); vertical-align: middle; margin-right: 3px; }
td.actions a { margin-right: var(--sp-3); }
.filter-bar { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; padding: var(--sp-2) var(--sp-4); background: var(--c-sunken); border-bottom: 1px solid var(--c-border-mid); font-size: var(--fs-sm); }
.filter-bar select, .filter-bar input { height: 18px; line-height: 16px; font-size: var(--fs-sm); }
.four-box th, .four-box td { text-align: center; }
.four-box td.big { font-size: var(--fs-md); font-weight: 700; }

/* settings & models pages (tabs inside a flush panel, DOM-edited tables, checklist editor) */
.tabbody { padding: var(--sp-4); }
.tabbody h3 { font-size: var(--fs-base); margin: var(--sp-5) 0 var(--sp-2); padding-bottom: 2px; border-bottom: 1px solid var(--c-border-strong); }
.tabbody h3:first-child, .tabbody form > h3:first-child { margin-top: 0; }
.tabbody h3 .btn--xs { margin-left: var(--sp-3); vertical-align: 1px; }
.tabbody .tbl-wrap { border: 1px solid var(--c-border-mid); margin-bottom: var(--sp-3); }
.tabbody .cols { margin-bottom: 0; }
.sform th, .mform th { width: 190px; }
.edit-tbl input[type="text"] { height: 18px; line-height: 16px; font-size: var(--fs-sm); }
.edit-tbl tbody td { padding: 1px var(--sp-3); }
.edit-tbl .btn--xs + .btn--xs { margin-left: 2px; }
.pl-list a.is-active { font-weight: 700; color: var(--c-text); text-decoration: none; }
.pl-add { margin-top: var(--sp-2); }
.rules { border-collapse: collapse; margin-bottom: var(--sp-2); width: 100%; }
.rules td { padding: 1px 4px 1px 0; vertical-align: middle; }
.rules td:first-child { width: 22px; }
.rules td:last-child { width: 150px; white-space: nowrap; }
.rules .btn--xs + .btn--xs { margin-left: 2px; }
.version-detail { background: var(--c-sunken); }
.version-detail ol { margin: 2px 0 2px 18px; padding: 0; }
.version-detail p { margin: 0 0 2px; }
.dot--c0 { background: var(--c-border-strong); } .dot--c1 { background: #0e5094; } .dot--c2 { background: #9a430f; } .dot--c3 { background: #008000; } .dot--c4 { background: #cc0000; }
.dot--c5 { background: #758ab4; } .dot--c6 { background: #d39b5e; } .dot--c7 { background: #4e5262; } .dot--c8 { background: #e87e04; }

/* ---- trades pages (trades.js / trade-form.js) ---- */
.tbl tr[data-id] { cursor: pointer; }
.filter-chips { padding: var(--sp-2) var(--sp-4); border-bottom: 1px solid var(--c-border-mid); font-size: var(--fs-sm); }
.filter-chips .chip { margin: 0 3px 2px 0; }
.chips-wrap .chip { margin: 0 3px 2px 0; white-space: normal; }
.detail-head { display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--c-border-mid); font-size: var(--fs-md); }
.detail-head .big { font-size: var(--fs-lg); font-weight: 700; }
.detail-head .spacer { flex: 1; }
.detail-grid .panel { margin-bottom: var(--gutter); }
.rule-list { list-style: none; margin: 0; padding: 0; font-size: var(--fs-sm); }
.rule-list li { padding: 2px 0; border-bottom: 1px dotted var(--c-border-mid); }
.na::before { content: "\2013\00a0"; color: var(--c-text-faint); }
.kv td.left { text-align: left; white-space: normal; }
.shots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-4); }
.shots figure { margin: 0; }
.prewrap { white-space: pre-wrap; font-size: var(--fs-sm); margin: 0 0 var(--sp-3); }
.h-small { font-size: var(--fs-sm); font-weight: 700; color: var(--c-text-muted); margin: 0 0 var(--sp-2); }
.w-dt { width: 176px; display: inline-block; }
.tform-cols { align-items: start; }
.tform-side { position: sticky; top: var(--sp-4); }
.tform .num-in { text-align: right; }
.tform .exit-leg { margin-top: 2px; }
.tform .exit-leg .right { text-align: right; display: inline-block; }
.tform .rules { width: auto; }
.tform .rules th, .tform .rules td { width: auto; text-align: left; white-space: normal; padding: 2px var(--sp-4) 2px 0; line-height: 18px; color: var(--c-text); }
.tform .rules td { white-space: nowrap; }
.tform .seg--xs .btn { height: 16px; line-height: 14px; font-size: var(--fs-xs); padding: 0 5px; }
.tform .sticky-actions .btn + .btn { margin-left: var(--sp-2); }
.tform .sticky-actions .spacer { flex: 1; }
.tform .shot .field-row { margin: 2px 0; }
.live .kv th { width: 48%; }
.live .kv td b { font-size: var(--fs-md); }

/* ---- insights page (js/pages/insights.js) ---- */
.insight--watch { border-left-color: var(--c-text-disabled); }
.insight--warn { border-left-color: var(--c-impact-med); }
.insight .chip--kind { min-width: 36px; text-align: center; }
.insight__evidence { margin: 2px 0; font-size: var(--fs-xs); }
.insight__evidence summary { cursor: pointer; color: var(--c-link); }
.insight__evidence .tbl-wrap { margin-top: 2px; } .insight__evidence .tbl { width: auto; min-width: 320px; }
.insight__evidence .kv { width: auto; min-width: 320px; } .insight__evidence .kv th { width: auto; padding-right: var(--sp-5); } .insight__evidence .kv td.left { text-align: left; white-space: normal; }
.findings-panel .cards { padding: var(--sp-4); }
.findings-panel .tabs { border-bottom: 1px solid var(--c-border-strong); }
.bot-intro p { margin-bottom: var(--sp-3); }
.detector-panels .kv th { width: 62%; white-space: normal; }
.detector-panels .panel__body { padding: var(--sp-3) var(--sp-4); }

/* ---- habits pages (js/pages/habits.js) ---- */
.habit-table td.name { white-space: nowrap; } .habit-table td.name a { font-weight: 700; text-decoration: none; }
.habit-table th.day.today { background: var(--c-nav-active-bg); }
.habit-table td.cell.today { background: var(--c-row-selected); }
.habit-table td.cell.auto span { background: var(--heat-p2); border-color: var(--heat-p3); }
.habit-table td.cell.pending span { background: var(--heat-n1); border-color: var(--c-border-strong); }
.habit-table td.score { text-align: center; padding: 0; font-size: 9px; color: var(--c-text-muted); font-weight: 400; }
.habit-table td.score.perfect { color: var(--c-pos); font-weight: 700; }
.habit-table tfoot td { font-weight: 400; }
.wdbars { vertical-align: middle; } .wdbars rect { fill: var(--c-link); } .wdbars rect.low { fill: var(--c-neg); } .wdbars rect.na { fill: var(--c-border-strong); }
.year-heat th { font-size: 9px; font-weight: 400; color: var(--c-text-faint); padding: 0 3px 0 0; text-align: left; white-space: nowrap; line-height: 10px; height: 10px; }
.year-heat td.s { background: repeating-linear-gradient(45deg, var(--c-sunken) 0 2px, #fff 2px 4px); }
.year-heat td.m0 { background: var(--heat-n1); }
.year-heat td.today { outline: 1px solid var(--c-link); outline-offset: -1px; }
.streak-bars .meter { width: 100px; }
.notes-list td.note { white-space: normal; }

/* dashboard & reports (pages/dashboard.js, pages/reports.js) */
[data-go], [data-href] { cursor: pointer; }
.chart-box--click canvas { cursor: pointer; }
.pf-mid { color: var(--c-impact-med); }
.panel__title .spark { vertical-align: middle; margin-left: var(--sp-3); height: 14px; }
.panel__title .badge-n { color: inherit; opacity: .8; font-weight: 400; }
.report-tabs .tabs { flex-wrap: wrap; }
.subtabs { margin-bottom: var(--sp-4); } .subtabs .tabs { background: transparent; border-bottom: 1px solid var(--c-border-mid); }
.sim-controls { display: flex; flex-wrap: wrap; gap: var(--sp-3); align-items: center; margin-bottom: var(--sp-3); font-size: var(--fs-sm); }
.sim-controls label, .sim-controls b { color: var(--c-text-muted); } .sim-controls b { color: var(--c-text); }
.heat { border-collapse: collapse; font-size: var(--fs-xs); }
.heat th { font-size: var(--fs-xs); font-weight: 400; color: var(--c-text-muted); padding: 1px 3px; text-align: center; white-space: nowrap; }
.heat td { min-width: 26px; height: 18px; } .heat td[data-go]:hover { outline: 1px solid var(--c-link); outline-offset: -1px; }
.heat td.low-n { color: var(--c-text-faint); background-image: repeating-linear-gradient(45deg, transparent 0 3px, rgba(0,0,0,.06) 3px 4px); }
.year-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-3); }
.year-grid .mini-cal { cursor: pointer; } .year-grid .cal-head { font-size: var(--fs-xs); gap: var(--sp-2); } .year-grid .cal-head b { font-size: var(--fs-xs); }
.year-grid table.cal th { font-size: 8px; padding: 0; } .year-grid table.cal td.wk { width: 10%; }
.tbl.monthly td { line-height: 1.25; padding: 3px 5px; } .tbl.monthly td b { font-weight: 700; }
.four-box caption { text-align: left; font-size: var(--fs-xs); }
.kv td .chip { vertical-align: middle; }
.stat .stat__sub .chip { vertical-align: middle; }
.thresholds .kv th, .habit-head .kv th { width: 42%; white-space: normal; }
.thresholds .kv td, .habit-head .kv td { white-space: normal; text-align: left; }
