:root {
  --ink: #17212b; --muted: #5d6b78; --line: #e3e7eb; --bg: #f5f6f4; --card: #fff;
  --brand: #1f4d3f; --brand-2: #2f6b57; --brand-soft: #e7f0ec; --accent: #b8892e;
  --red: #b4362f; --red-soft: #fbeceb; --amber: #9a6a00; --amber-soft: #fdf4e1; --green: #1e7a4c; --green-soft: #e6f4ec; --blue: #2457a6; --blue-soft: #e8eef9;
  --r: 8px; --shadow: 0 1px 2px rgba(16,24,32,.06), 0 1px 1px rgba(16,24,32,.04);
}
* { box-sizing: border-box }
html, body { margin: 0; height: 100% }
body { font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: var(--ink); background: var(--bg) }
a { color: var(--blue); text-decoration: none } a:hover { text-decoration: underline }
.layout { display: grid; grid-template-columns: 228px 1fr; min-height: 100vh }
.side { background: #12271f; color: #d9e4de; padding: 14px 10px; position: sticky; top: 0; height: 100vh; overflow-y: auto }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 14px; border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 8px }
.brand .logo { width: 32px; height: 32px; border-radius: 8px; background: var(--accent); color: #12271f; display: grid; place-items: center; font-weight: 800 }
.brand b { display: block; color: #fff; font-size: 14px } .brand span { font-size: 11px; opacity: .7 }
.side h6 { margin: 14px 8px 4px; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: #8fa89c; font-weight: 600 }
.side a { display: flex; justify-content: space-between; align-items: center; color: #d9e4de; padding: 6px 10px; border-radius: 6px; font-size: 13.5px }
.side a:hover { background: rgba(255,255,255,.06); text-decoration: none }
.side a.on { background: rgba(255,255,255,.12); color: #fff; font-weight: 600 }
.side .pill { background: var(--accent); color: #12271f; border-radius: 10px; padding: 0 7px; font-size: 11px; font-weight: 700 }
.side .me { margin-top: 18px; padding: 10px; border-top: 1px solid rgba(255,255,255,.08); font-size: 12px; color: #a9bdb3 }
.side .me button { background: none; border: 0; color: #d9e4de; padding: 0; cursor: pointer; font-size: 12px; text-decoration: underline }
main { padding: 22px 28px 60px; min-width: 0 }
.sample-banner { background: var(--amber-soft); color: #6b4a00; border: 1px solid #f0dca8; padding: 8px 12px; border-radius: var(--r); margin-bottom: 16px; font-size: 13px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap }
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap }
.head h1 { margin: 0; font-size: 21px; letter-spacing: -.01em } .head .sub { color: var(--muted); font-size: 13px; margin-top: 2px }
.crumb { font-size: 12.5px; color: var(--muted); margin-bottom: 2px }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center }
button, .btn { font: inherit; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 7px 13px; border-radius: 7px; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px }
button:hover, .btn:hover { border-color: #c9d0d6; text-decoration: none }
button.primary, .btn.primary { background: var(--brand); border-color: var(--brand); color: #fff } button.primary:hover { background: var(--brand-2) }
button.danger { color: var(--red); border-color: #efc9c6 } button.small { padding: 4px 9px; font-size: 12.5px }
button.link { border: 0; background: none; color: var(--blue); padding: 0 } button:disabled { opacity: .5; cursor: default }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px }
.card h3 { margin: 0 0 10px; font-size: 14.5px } .card h3 small { color: var(--muted); font-weight: 400 }
.grid { display: grid; gap: 16px } .g2 { grid-template-columns: repeat(2, minmax(0,1fr)) } .g3 { grid-template-columns: repeat(3, minmax(0,1fr)) } .g4 { grid-template-columns: repeat(4, minmax(0,1fr)) }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, 1fr) } .g3 { grid-template-columns: 1fr 1fr } }
@media (max-width: 760px) { .layout { grid-template-columns: 1fr } .side { position: static; height: auto } .g2, .g3, .g4 { grid-template-columns: 1fr } main { padding: 16px } }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; box-shadow: var(--shadow) }
.stat .lbl { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em } .stat .val { font-size: 22px; font-weight: 650; margin-top: 4px; font-variant-numeric: tabular-nums }
.stat .note { font-size: 12.5px; color: var(--muted); margin-top: 2px } .stat a { font-size: 12.5px }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px }
table.t th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; padding: 8px 10px; border-bottom: 1px solid var(--line); background: #fafbfa; position: sticky; top: 0; z-index: 1; cursor: default; white-space: nowrap }
table.t th.sort { cursor: pointer } table.t th.sort:hover { color: var(--ink) }
table.t td { padding: 8px 10px; border-bottom: 1px solid #eff1f3; vertical-align: top }
table.t tr.click:hover td { background: #f7faf8; cursor: pointer }
table.t tr.void td { color: #9aa5ae; text-decoration: line-through }
table.t tr.total td { font-weight: 650; border-top: 2px solid var(--line); background: #fafbfa }
table.t tr.sub td { font-weight: 600; background: #fcfcfb }
table.t td.indent { padding-left: 28px }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap }
.neg { color: var(--red) }
.tablewrap { overflow: auto; max-height: 70vh; border: 1px solid var(--line); border-radius: var(--r); background: #fff }
.tablewrap table.t td:first-child, .tablewrap table.t th:first-child { padding-left: 14px }
.tag { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11.5px; font-weight: 600; background: #eef1f3; color: #44525e; white-space: nowrap }
.tag.green { background: var(--green-soft); color: var(--green) } .tag.red { background: var(--red-soft); color: var(--red) } .tag.amber { background: var(--amber-soft); color: var(--amber) } .tag.blue { background: var(--blue-soft); color: var(--blue) }
.muted { color: var(--muted) } .small { font-size: 12.5px }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px }
input, select, textarea { font: inherit; border: 1px solid #cfd6dc; border-radius: 6px; padding: 7px 9px; background: #fff; color: var(--ink); min-width: 0 }
input:focus, select:focus, textarea:focus { outline: 2px solid #b7d3c6; border-color: var(--brand-2) }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--brand) }
.field { display: flex; flex-direction: column; gap: 4px } .field label { font-size: 12.5px; font-weight: 600; color: #3b4853 }
.field .hint { font-size: 12px; color: var(--muted) }
.form { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)) } .form .wide { grid-column: 1 / -1 }
.lines { width: 100%; border-collapse: collapse; margin-top: 4px } .lines th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 4px } .lines td { padding: 3px 4px }
.lines input, .lines select { width: 100% } .lines td.amt { width: 130px } .lines td.x { width: 30px }
.totalbar { display: flex; justify-content: flex-end; gap: 24px; padding: 10px 4px; font-weight: 650; font-variant-numeric: tabular-nums }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; flex-wrap: wrap }
.tabs a { padding: 8px 12px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500 }
.tabs a.on { color: var(--ink); border-color: var(--brand); text-decoration: none } .tabs a:hover { text-decoration: none; color: var(--ink) }
.modal-bg { position: fixed; inset: 0; background: rgba(15,23,30,.42); display: flex; justify-content: flex-end; z-index: 50 }
.modal { background: #fff; width: min(760px, 100%); height: 100%; overflow-y: auto; padding: 22px 24px 90px; box-shadow: -6px 0 24px rgba(0,0,0,.12); position: relative }
.modal.narrow { width: min(480px, 100%) } .modal.wide { width: min(1040px, 100%) }
.modal h2 { margin: 0 0 14px; font-size: 18px } .modal .close { position: absolute; right: 16px; top: 16px }
.modal .foot { position: fixed; bottom: 0; right: 0; width: inherit; max-width: 100%; background: #fff; border-top: 1px solid var(--line); padding: 12px 24px; display: flex; gap: 8px; justify-content: flex-end }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #17212b; color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 99; font-size: 13.5px; box-shadow: 0 6px 20px rgba(0,0,0,.2) }
.toast.err { background: var(--red) }
.empty { padding: 30px; text-align: center; color: var(--muted) }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 12px; font-size: 13.5px } .kv div:nth-child(odd) { color: var(--muted) }
.bar-chart { display: flex; align-items: flex-end; gap: 10px; height: 150px; padding: 6px 4px 0; border-bottom: 1px solid var(--line) }
.bar-chart .m { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100% ; justify-content: flex-end }
.bar-chart .pair { display: flex; gap: 3px; align-items: flex-end; height: 100%; width: 100% ; justify-content: center }
.bar-chart .b { width: 40%; max-width: 22px; border-radius: 3px 3px 0 0; min-height: 1px }
.bar-chart .b.in { background: var(--brand-2) } .bar-chart .b.out { background: #c9a35b }
.bar-labels { display: flex; gap: 10px; padding: 4px } .bar-labels span { flex: 1; text-align: center; font-size: 11.5px; color: var(--muted) }
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 6px } .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px }
.login { min-height: 100vh; display: grid; place-items: center; background: #12271f }
.login .box { background: #fff; padding: 28px; border-radius: 12px; width: min(400px, 92vw); display: grid; gap: 12px }
.login h1 { margin: 0; font-size: 20px } .login p { margin: 0; color: var(--muted); font-size: 13px }
.err { color: var(--red); font-size: 13px }
.callout { background: var(--blue-soft); color: #1d3f78; border-radius: var(--r); padding: 10px 12px; font-size: 13px; margin-bottom: 12px }
.callout.warn { background: var(--amber-soft); color: #6b4a00 } .callout.ok { background: var(--green-soft); color: #145c38 }
.diff { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px } @media (max-width: 900px) { .split { grid-template-columns: 1fr } }
.feed-row { display: grid; grid-template-columns: 90px 1fr 110px; gap: 10px; align-items: center }
details.box { border: 1px solid var(--line); border-radius: var(--r); background: #fff; margin-bottom: 10px }
details.box summary { padding: 10px 14px; cursor: pointer; font-weight: 600 } details.box > div { padding: 0 14px 12px }
.check-preview { border: 1px dashed #c9d0d6; border-radius: 6px; padding: 10px; background: #fcfcf8; font-size: 12.5px }
@media print { .side, .no-print, .sample-banner, .toolbar, .actions { display: none !important } .layout { display: block } main { padding: 0 } .tablewrap { max-height: none; border: 0 } .card { box-shadow: none; border: 0 } }
