:root {
  --bg: #f5f6f8; --panel: #ffffff; --ink: #1c2430; --muted: #5d6b7a; --line: #e2e6eb;
  --green: #1f8a4c; --green-bg: #e8f5ec; --yellow: #b7791f; --yellow-bg: #fdf3df;
  --red: #b3261e; --red-bg: #fbe9e7; --accent: #1f4e79; --accent-bg: #e8eff6;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: var(--ink); background: var(--bg); }
header { background: var(--panel); border-bottom: 1px solid var(--line); padding: 0 24px; display: flex; align-items: center; height: 56px; gap: 28px; }
.brand { font-weight: 700; font-size: 16px; letter-spacing: .2px; color: var(--ink); text-decoration: none; }
.brand:hover { text-decoration: underline; text-decoration-color: var(--accent); }
.brand span { color: var(--accent); }
.brand small { font-weight: 500; color: var(--muted); }
nav a { color: var(--muted); text-decoration: none; padding: 18px 4px; margin-right: 18px; border-bottom: 2px solid transparent; display: inline-block; cursor: pointer; }
nav a.active { color: var(--ink); border-color: var(--accent); font-weight: 600; }
.tenant { margin-left: auto; color: var(--muted); font-size: 13px; }
.tenant b { color: var(--ink); }
.sample { position: fixed; top: 10px; right: 14px; background: #333; color: #fff; font-size: 11px; padding: 3px 8px; border-radius: 3px; letter-spacing: .5px; opacity: .85; z-index: 9; }
main { max-width: 1240px; margin: 0 auto; padding: 22px 24px 60px; }
.pagehead { display: flex; align-items: baseline; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.pagehead h1 { font-size: 20px; margin: 0; }
.pagehead .when { color: var(--muted); }
.summary { display: flex; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 10px 14px; min-width: 150px; }
.stat .n { font-size: 20px; font-weight: 700; }
.stat .l { color: var(--muted); font-size: 12px; }
.filters { display: flex; gap: 8px; margin-bottom: 12px; align-items: center; }
.chip { border: 1px solid var(--line); background: var(--panel); border-radius: 14px; padding: 3px 10px; font-size: 12px; color: var(--muted); }
.chip.on { border-color: var(--accent); color: var(--accent); background: var(--accent-bg); font-weight: 600; }
.chip .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fafbfc; font-weight: 600; }
td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
.lane { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 3px; letter-spacing: .4px; }
.lane.g { color: var(--green); background: var(--green-bg); }
.lane.y { color: var(--yellow); background: var(--yellow-bg); }
.lane.r { color: var(--red); background: var(--red-bg); }
.cust { font-weight: 600; }
.sub { color: var(--muted); font-size: 12px; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.drivers { margin: 0; padding-left: 16px; color: var(--ink); }
.drivers li { margin: 1px 0; }
.action { font-weight: 600; }
.action .cond { font-weight: 400; color: var(--muted); display: block; font-size: 12px; }
.btns { white-space: nowrap; }
button { font: inherit; font-size: 12px; padding: 5px 10px; border-radius: 4px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; margin-right: 4px; }
button.ok { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }
button.ok.hold { background: var(--red); border-color: var(--red); }
.expand { background: var(--accent-bg); }
.expand td { padding: 14px 16px 16px 44px; }
.exp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.exp-grid h4 { margin: 0 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.exposure { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.5; background: var(--panel); border: 1px solid var(--line); padding: 10px 12px; border-radius: 4px; }
.exposure .tot { font-weight: 700; }
.exposure .neg { color: var(--green); }
.kv { font-size: 13px; }
.kv div { margin-bottom: 5px; }
.kv b { display: inline-block; min-width: 150px; color: var(--muted); font-weight: 500; }
.note { margin-top: 12px; display: flex; gap: 8px; align-items: center; }
.note input { flex: 1; font: inherit; padding: 6px 8px; border: 1px solid var(--line); border-radius: 4px; }
.toggle { color: var(--accent); cursor: pointer; font-size: 12px; text-decoration: none; }
/* audit */
.log { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; }
.log .row { display: grid; grid-template-columns: 150px 140px 1fr 130px; gap: 14px; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 13px; }
.log .row:last-child { border-bottom: 0; }
.log .t { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.log .ev { font-weight: 600; }
.log .who { color: var(--muted); text-align: right; }
.log .d { color: var(--ink); }
.log .d code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; background: var(--bg); padding: 1px 5px; border-radius: 3px; }
.search { display: flex; gap: 8px; margin-bottom: 12px; }
.search input { font: inherit; padding: 7px 10px; border: 1px solid var(--line); border-radius: 4px; width: 320px; }
.hidden { display: none; }
footer { max-width: 1240px; margin: 0 auto; padding: 0 24px; color: var(--muted); font-size: 12px; }
/* live app additions */
.live { position: fixed; top: 10px; right: 14px; background: var(--green); color: #fff; font-size: 11px; padding: 3px 8px; border-radius: 3px; letter-spacing: .5px; z-index: 9; }
.chip a, a.chip { text-decoration: none; color: inherit; }
details summary { cursor: pointer; color: var(--accent); font-size: 12px; list-style: none; }
details summary::-webkit-details-marker { display: none; }
details[open] summary { margin-bottom: 8px; }
form.decide { display: flex; flex-direction: column; gap: 6px; min-width: 210px; }
form.decide input[type=text] { font: inherit; font-size: 12px; padding: 5px 7px; border: 1px solid var(--line); border-radius: 4px; }
button.no { color: var(--red); border-color: var(--red); }
.decided { font-size: 12px; }
.decided b { text-transform: capitalize; }
.decided.approved b { color: var(--green); }
.decided.rejected b { color: var(--red); }
.gone { opacity: .6; }
.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; border: 1px solid var(--line); background: var(--panel); }
.flash.err { border-color: var(--red); color: var(--red); background: var(--red-bg); }
.flash.ok { border-color: var(--green); color: var(--green); background: var(--green-bg); }
.empty { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 28px; text-align: center; color: var(--muted); }
.login { max-width: 360px; margin: 80px auto; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 26px; }
.login h1 { font-size: 18px; margin: 0 0 16px; }
.login label { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 4px; }
.login input { width: 100%; font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 4px; }
.login button { margin-top: 16px; width: 100%; padding: 9px; background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; font-size: 14px; }
.who-form { display: inline; margin-left: 10px; }
.who-form button { font-size: 11px; padding: 2px 8px; }
.chain { font-size: 12px; margin-bottom: 10px; }
.chain.ok { color: var(--green); } .chain.bad { color: var(--red); font-weight: 600; }
.log .row.head { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); background: #fafbfc; font-weight: 600; }
@media (max-width: 800px) { .log .row { grid-template-columns: 1fr; } .log .who { text-align: left; } table { font-size: 12px; } }
.modify { display: flex; gap: 4px; }
.modify select { font: inherit; font-size: 12px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 4px; flex: 1; min-width: 0; background: var(--panel); color: var(--ink); }
button.mod { color: var(--yellow); border-color: var(--yellow); margin-right: 0; }
.decided.modified b { color: var(--yellow); }
.decided .chosen { text-transform: none; }
