:root {
  /* My Legal Basement navy (#0b2c3e, from the logo) on a light theme */
  --bg: #f5f7f9; --panel: #ffffff; --ink: #0f2533; --muted: #5b6b77; --line: #dde3e8; --line2: #eef2f5;
  --brand: #0b2c3e; --brand2: #14435c; --accent: #1b5d7e; --tint: #e8f0f4; --good: #1f7a4d; --bad: #b42318; --warn: #9a5b00;
  --goodbg: #e8f5ee; --badbg: #fdecea; --warnbg: #fff4e0; --sel: #e8f0f4;
  --radius: 10px; --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif; font-size: 14px; color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 20px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0 0 10px; }
h3 { font-size: 14px; margin: 14px 0 6px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.boot { padding: 40px; color: var(--muted); }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: #fff; color: var(--ink); border-right: 1px solid var(--line); padding: 12px 10px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brandtile { display: block; background: var(--brand); border-radius: 10px; padding: 10px 12px 8px; margin-bottom: 4px; }
.brandtile img { display: block; width: 100%; height: auto; }
.side .co { font-size: 11px; padding: 4px 10px 12px; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.side a { display: block; color: #2c4352; padding: 8px 10px; border-radius: 7px; margin: 1px 0; }
.side a:hover { background: var(--tint); color: var(--brand); text-decoration: none; }
.side a.on { background: var(--brand); color: #fff; font-weight: 600; }
.side .sep { border-top: 1px solid var(--line); margin: 10px 4px; }
.side .me { font-size: 12px; padding: 8px 10px; color: var(--muted); }
.main { padding: 20px 24px 60px; min-width: 0; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.menu-btn { display: none; }
.demo { background: var(--warnbg); color: var(--warn); border: 1px solid #f0d29a; padding: 8px 12px; border-radius: 8px; margin-bottom: 14px; font-size: 13px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px; }
.grid { display: grid; gap: 12px; }
.kpis { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); margin-bottom: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.kpi .l { font-size: 12px; color: var(--muted); }
.kpi .v { font-size: 20px; font-weight: 650; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.two { grid-template-columns: 1fr 1fr; }

/* ---------- controls ---------- */
.bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
input, select, textarea { font: inherit; color: var(--ink); border: 1px solid #c9d1db; border-radius: 7px; padding: 7px 9px; background: #fff; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid #9cc0ea; border-color: var(--accent); }
input[type=checkbox] { width: 16px; height: 16px; padding: 0; }
button, .btn { font: inherit; border: 1px solid #c9d1db; background: #fff; color: var(--ink); border-radius: 7px; padding: 7px 12px; cursor: pointer; white-space: nowrap; }
button:hover { background: #f3f6fa; }
button.primary { background: var(--brand2); color: #fff; border-color: var(--brand2); }
button.primary:hover { background: var(--brand); }
button.danger { color: var(--bad); border-color: #e9b4ae; }
button.link { border: 0; background: none; color: var(--accent); padding: 2px 4px; }
button:disabled { opacity: .5; cursor: default; }
.formgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }

/* ---------- tables ---------- */
.tw { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; background: #fff; }
th, td { padding: 6px 9px; border-bottom: 1px solid var(--line2); text-align: left; vertical-align: top; }
th { background: #f7f9fb; font-weight: 600; font-size: 12px; color: #3b4a5c; position: sticky; top: 0; z-index: 1; white-space: nowrap; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.sub td { font-weight: 600; background: #fafbfc; }
tr.tot td { font-weight: 700; border-top: 2px solid #9aa7b6; background: #f3f6fa; }
tr.grp td { font-weight: 700; background: #eef2f7; color: var(--brand); }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--sel); }
tr.dupe td { color: var(--muted); text-decoration: line-through; }
td .desc { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.neg { color: var(--bad); }
.tag { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 99px; background: #eef2f7; color: #3b4a5c; white-space: nowrap; }
.tag.good { background: var(--goodbg); color: var(--good); }
.tag.bad { background: var(--badbg); color: var(--bad); }
.tag.warn { background: var(--warnbg); color: var(--warn); }
.ok { color: var(--good); font-weight: 600; }
.bad { color: var(--bad); font-weight: 600; }
.statement { display: grid; grid-template-columns: 1fr auto; gap: 4px 20px; max-width: 640px; }
.statement div:nth-child(even) { text-align: right; font-variant-numeric: tabular-nums; }
.statement .b { font-weight: 700; }
.statement .line { border-top: 1px solid #9aa7b6; padding-top: 4px; }
.alert { padding: 9px 12px; border-radius: 8px; margin: 6px 0; font-size: 13px; }
.alert.bad { background: var(--badbg); color: var(--bad); font-weight: 400; }
.alert.warn { background: var(--warnbg); color: var(--warn); }
.alert.good { background: var(--goodbg); color: var(--good); font-weight: 400; }

/* ---------- modal / toast / login ---------- */
.modal { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 50; overflow-y: auto; }
.modal[hidden] { display: none; }
.dialog { background: #fff; border-radius: 12px; width: 100%; max-width: 620px; padding: 18px 20px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.dialog .acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.seg { display: inline-flex; border: 1px solid #c9d1db; border-radius: 8px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; border-right: 1px solid #c9d1db; }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--brand2); color: #fff; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: #14202e; color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 60; max-width: 90vw; }
.toast.err { background: var(--bad); }
.login { max-width: 380px; margin: 10vh auto; }
.login .card { padding: 0; overflow: hidden; }
.login .card > .brandtile { border-radius: 0; margin: 0; padding: 22px 60px 18px; }
.login .card > .inner { padding: 20px 24px 24px; }
.login h1 { margin-bottom: 2px; color: var(--brand); }
h1 { color: var(--brand); }
th { color: var(--brand2); }
.kpi { border-top: 3px solid var(--brand); }
tr.grp td { background: var(--tint); }
.login form { display: grid; gap: 12px; margin-top: 16px; }
.err { color: var(--bad); font-size: 13px; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 30% 0 0; z-index: 40; transform: translateX(-100%); transition: transform .2s; height: 100%; }
  .side.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  .menu-btn { display: inline-block; }
  .main { padding: 14px 16px 60px; }
  .two { grid-template-columns: 1fr; }
}
@media print {
  .side, .bar, .no-print, .menu-btn, .demo { display: none !important; }
  .shell { display: block; }
  .card { box-shadow: none; border: 0; padding: 0; }
  .tw { overflow: visible; border: 0; }
  body { background: #fff; }
}
