/* Ledger demo. Palette and buttons come from ../_shared/demo.css.
   No overscroll-behavior on the panes: once a pane reaches its end, the wheel or swipe has to
   carry on to the project page that embeds this iframe, or a phone visitor gets stuck here. */
:root { --warn: #fbbf24; --pass: #4ade80; --fail: #fb7185; }
html, body { height: 100%; }
body { overflow: hidden; }
.app { height: 100vh; height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; padding: 12px 16px 10px; gap: 10px; }
.top { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 8px 16px; }
.brand h1 { margin: 2px 0 0; }
.brand .label { margin: 0; }
.tabs button[aria-selected="true"] { background: var(--accent); color: #140f24; }
.body { min-height: 0; min-width: 0; position: relative; }
.foot-short, .short { display: none; }
.demo-foot { margin-top: 0; font-size: 11px; line-height: 1.45; max-height: 7.5em; overflow: auto; }
button { font-family: inherit; }
.view { height: 100%; min-height: 0; }
[hidden] { display: none !important; }

/* Poster */
.poster { height: 100%; overflow: auto; place-items: start center; }
.poster-in { max-width: 640px; display: grid; gap: 12px; justify-items: center; margin: auto 0; }
.poster h2 { margin: 0; font: 700 clamp(20px, 3.2vw, 30px)/1.15 var(--sans); letter-spacing: -0.025em; }
.poster .lede { margin: 0; color: var(--text-2); font-size: 14px; }
.poster .facts { margin: 4px 0 0; padding: 0; list-style: none; display: grid; gap: 4px; font: 12px/1.5 var(--mono); color: var(--muted); }
.poster .size { max-width: 520px; margin: 0; }

/* Deal browser */
.browser { height: 100%; display: grid; grid-template-columns: minmax(250px, 320px) minmax(0, 1fr); gap: 12px; min-height: 0; }
.list-pane { display: grid; grid-template-rows: auto auto minmax(0, 1fr); gap: 6px; min-height: 0; }
.filters { display: grid; gap: 6px; }
.filter-seg { flex-wrap: wrap; border-radius: 12px; }
.filter-seg button { padding: 6px 9px; font-size: 11px; }
input[type="search"], .edit input, .edit select, .edit textarea {
  width: 100%; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 10px; font: 13px/1.3 var(--sans);
}
input[type="search"]:focus, .edit :is(input, select, textarea):focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 2px rgba(167, 139, 250, 0.3); }
.list-count { margin: 0; }
.deal-list { list-style: none; margin: 0; padding: 0; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.deal-list li { border-bottom: 1px solid var(--line); }
.deal-list li:last-child { border-bottom: 0; }
.deal-list button { all: unset; box-sizing: border-box; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; width: 100%; padding: 8px 10px; cursor: pointer; }
.deal-list button:hover { background: var(--surface-2); }
.deal-list button[aria-current="true"] { background: rgba(167, 139, 250, 0.14); box-shadow: inset 3px 0 0 var(--accent); }
.deal-list button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.deal-list .nm { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deal-list .sub { grid-column: 1; font: 11px/1.3 var(--mono); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deal-list .marks { grid-row: 1 / span 2; grid-column: 2; align-self: center; display: flex; gap: 3px; flex-wrap: wrap; justify-content: end; max-width: 110px; }

.detail-pane { overflow: auto; min-height: 0; padding-right: 4px; }
.detail-pane:focus { outline: none; }
.back { display: none; }

/* Marks and chips */
.mk { font: 600 10px/1 var(--mono); padding: 3px 5px; border-radius: 5px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.mk.tp { color: var(--pass); border-color: rgba(74, 222, 128, 0.4); }
.mk.fn { color: var(--warn); border-color: rgba(251, 191, 36, 0.45); }
.mk.fp { color: var(--fail); border-color: rgba(251, 113, 133, 0.5); }
.mk.ed { color: var(--accent-hi); border-color: rgba(167, 139, 250, 0.5); }
.chip { display: inline-flex; align-items: center; gap: 5px; font: 500 11px/1.2 var(--mono); padding: 3px 7px; border-radius: var(--radius-pill); border: 1px solid var(--line); color: var(--text-2); background: var(--surface); }
.chip.pass { color: var(--pass); border-color: rgba(74, 222, 128, 0.35); }
.chip.fail { color: var(--fail); border-color: rgba(251, 113, 133, 0.45); }
.chip.skipped { color: var(--muted); }
.chip.kept { color: var(--pass); border-color: rgba(74, 222, 128, 0.35); }
.chip.dropped { color: var(--fail); border-color: rgba(251, 113, 133, 0.45); }
.chip.derived, .chip.no-quote { color: var(--muted); }

/* Deal detail */
.d-head { display: grid; gap: 4px; margin-bottom: 10px; }
.d-head h2 { margin: 0; font: 700 clamp(17px, 2vw, 21px)/1.2 var(--sans); letter-spacing: -0.015em; }
.d-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font: 12px/1.4 var(--mono); color: var(--muted); }
.d-meta b { color: var(--text-2); font-weight: 500; }
.verdict { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12.5px; color: var(--text-2); }
.tries { display: grid; gap: 8px; margin: 10px 0; padding: 10px 12px; border: 1px dashed rgba(167, 139, 250, 0.45); border-radius: var(--radius); background: rgba(139, 92, 246, 0.06); }
.tries .row { display: flex; flex-wrap: wrap; gap: 6px; }
.tries .btn { padding: 7px 12px; font-size: 12px; }
.tries .hint { margin: 0; font-size: 12px; color: var(--muted); }
.result { margin: 0; padding: 9px 11px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12.5px; color: var(--text-2); }
.result b { color: var(--text); }
.result.bad { border-color: rgba(251, 113, 133, 0.45); }
.result.good { border-color: rgba(74, 222, 128, 0.4); }
.result ul { margin: 4px 0 0; padding-left: 18px; }
.busy { opacity: 0.6; pointer-events: none; }

.cols { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 10px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; min-width: 0; }
.card h3 { margin: 0 0 8px; font: 500 11px/1.4 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.card h3 em { font-style: normal; color: var(--accent); }
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 3px 10px; margin: 0; font-size: 12.5px; }
.kv dt { color: var(--muted); font: 12px/1.5 var(--mono); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.contacts { margin: 8px 0 0; padding: 0; list-style: none; font-size: 12px; color: var(--text-2); display: grid; gap: 2px; }
.contacts .role { font: 11px/1 var(--mono); color: var(--muted); }

.slots { display: grid; gap: 6px; }
.slot { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.slot:last-child { border-bottom: 0; }
.slot .nm { font: 12px/1.4 var(--mono); color: var(--muted); overflow-wrap: anywhere; }
.slot .val { font-weight: 600; font-size: 13px; color: var(--text); }
.slot .val.null { color: var(--muted); font-weight: 400; font-style: italic; }
.slot .val s { color: var(--fail); text-decoration-thickness: 1.5px; }
.slot q { grid-column: 1 / -1; font-size: 12.5px; color: var(--text-2); quotes: "\201C" "\201D"; }
.slot .why { grid-column: 1 / -1; font: 11px/1.4 var(--mono); color: var(--muted); }
.slot .why.dropped { color: var(--fail); }
.slot .status { grid-row: 1; grid-column: 2; align-self: start; }
.empties { font: 11px/1.5 var(--mono); color: var(--muted); margin: 6px 0 0; }

.edit { display: grid; gap: 8px; }
.edit .f { display: grid; gap: 4px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.edit label { font: 12px/1.4 var(--mono); color: var(--muted); }
.edit textarea { min-height: 2.6em; resize: vertical; font-size: 12.5px; }
.edit .two { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: 6px; }
.edit .acts { display: flex; gap: 8px; flex-wrap: wrap; position: sticky; bottom: 0; background: var(--surface); padding: 6px 0 2px; }

.findings { display: grid; gap: 8px; }
.finding { border-left: 3px solid var(--fail); padding: 4px 0 4px 10px; }
.finding.planted { border-left-color: var(--pass); }
.finding .t { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; font-weight: 600; font-size: 13px; }
.finding .t .mk { font-weight: 500; }
.finding p { margin: 2px 0 0; font-size: 12.5px; color: var(--text-2); }
.finding q { color: var(--text); }
.finding .act { color: var(--muted); font-size: 12px; }
.missed { border-left: 3px solid var(--warn); padding: 4px 0 4px 10px; font-size: 12.5px; color: var(--text-2); }

.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px 10px; margin: 0; padding: 0; list-style: none; }
.checks li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px; align-items: baseline; font-size: 12px; padding: 3px 0; }
.checks .r { color: var(--muted); font-size: 11.5px; overflow-wrap: anywhere; }
.checks .ty { color: var(--text-2); }

.record { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.record li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px 10px; font-size: 12.5px; }
.record .n { font: 11px/1.6 var(--mono); color: var(--muted); }
.record .who { font: 11px/1.4 var(--mono); color: var(--muted); }
.record .who .role { color: var(--text-2); }
.record .who .role.buyer { color: var(--accent-hi); }
.record .who .role.system { color: var(--warn); }
.record .tx { grid-column: 2; white-space: pre-wrap; color: var(--text-2); overflow-wrap: anywhere; }
.record mark { background: rgba(167, 139, 250, 0.22); color: var(--text); border-radius: 3px; padding: 0 2px; }
.stack { display: grid; gap: 10px; margin-top: 10px; }
.day { font-size: 12.5px; color: var(--text-2); }
.day p { margin: 4px 0 0; }

/* Scoreboard and forecast */
.view-score, .view-forecast { overflow: auto; }
.sb-intro { margin: 0 0 10px; color: var(--text-2); font-size: 13px; max-width: 880px; }
.repro { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
th, td { text-align: right; padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; white-space: normal; min-width: 150px; }
thead th { font: 500 11px/1.3 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); vertical-align: bottom; }
tbody tr:last-child td { border-bottom: 0; }
td.hi { color: var(--accent-hi); font-weight: 700; }
td .pub { display: block; font: 11px/1.3 var(--mono); color: var(--muted); font-weight: 400; }
td .pub.ok { color: var(--pass); }
td .pub.no { color: var(--fail); }
.big { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 0 0 12px; }
.big .card b { display: block; font: 700 clamp(20px, 2.6vw, 28px)/1.1 var(--sans); letter-spacing: -0.02em; color: var(--text); }
.big .card span { font: 11px/1.4 var(--mono); color: var(--muted); }
.note { font-size: 12px; color: var(--muted); max-width: 880px; }
details { margin-top: 12px; }
summary { cursor: pointer; font: 500 12px/1.4 var(--mono); color: var(--accent); }
.excl button { all: unset; cursor: pointer; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.excl button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.excl td:nth-child(4) { white-space: normal; text-align: left; }
h3.sec { margin: 16px 0 8px; font: 500 11px/1.4 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

/* Narrow: list and detail become two screens */
@media (max-width: 899px) {
  .app { padding: 10px 12px 8px; gap: 8px; }
  .browser { grid-template-columns: minmax(0, 1fr); }
  .app[data-view="list"] .detail-pane { display: none; }
  .app[data-view="detail"] .list-pane { display: none; }
  .back { display: inline-flex; margin-bottom: 8px; }
  .cols { grid-template-columns: minmax(0, 1fr); }
  .edit .two { grid-template-columns: minmax(0, 1fr); }
  .demo-foot { max-height: none; font-size: 10px; gap: 2px 12px; padding-top: 6px; }
  th, td { padding: 6px 7px; }
  th:first-child, td:first-child { min-width: 104px; }
  .long { display: none; }
  .foot-long { display: none; }
  .foot-short, .short { display: inline; }
}
@media (max-width: 420px) {
  .tabs button { padding: 7px 10px; }
  .poster { padding: 14px 12px; }
  .poster-in { gap: 9px; }
  .poster .lede { font-size: 13px; }
  .poster .facts { font-size: 11px; }
}
