:root {
  --bg: #f6f7f9; --panel: #ffffff; --ink: #141a22; --mute: #5a6574; --faint: #8e96a3; --line: #e6e9ee;
  --accent: #141a22; --accent-ink: #ffffff; --good: #1f7a4d; --warn: #a86400; --bad: #b23b3b; --chip: #eef1f5;
  --argus: #3b6fd8; --hermes: #0f8f86; --kairos: #8a56d8; --themis: #b0603a; --athena: #c2417a; --plutus: #3d8a2f;
  --radius: 14px; --shadow: 0 1px 2px rgba(20,26,34,.05), 0 4px 18px rgba(20,26,34,.04);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1117; --panel: #151b23; --ink: #e8ecf1; --mute: #a1abb8; --faint: #6f7a88; --line: #263040;
    --accent: #e8ecf1; --accent-ink: #0d1117; --chip: #1e2631; --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1117; --panel: #151b23; --ink: #e8ecf1; --mute: #a1abb8; --faint: #6f7a88; --line: #263040;
  --accent: #e8ecf1; --accent-ink: #0d1117; --chip: #1e2631; --shadow: none;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 Inter, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
.app { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
nav.side { position: sticky; top: 0; height: 100vh; padding: 22px 14px; border-right: 1px solid var(--line); background: var(--panel); }
.brand { font-weight: 700; letter-spacing: .28em; font-size: 12px; margin: 0 10px 22px; }
.brand small { display: block; letter-spacing: .1em; font-weight: 500; color: var(--faint); margin-top: 3px; }
nav.side a { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; border-radius: 10px; text-decoration: none; color: var(--mute); margin-bottom: 2px; }
nav.side a.on, nav.side a:hover { background: var(--chip); color: var(--ink); }
nav.side .n { font-size: 12px; background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 0 7px; min-width: 20px; text-align: center; }
main { padding: 28px 32px 80px; max-width: 1180px; width: 100%; min-width: 0; }
.card { min-width: 0; }
.email, td { overflow-wrap: anywhere; }
h1 { font-size: 24px; font-weight: 600; margin: 0 0 4px; }
h2 { font-size: 16px; font-weight: 600; margin: 28px 0 10px; }
h3 { font-size: 14px; font-weight: 600; margin: 0 0 6px; }
.sub { color: var(--mute); margin: 0 0 20px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); margin-bottom: 12px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 8px; }
.tile .k { font-size: 12px; color: var(--mute); }
.tile .v { font-size: 22px; font-weight: 600; margin-top: 2px; font-variant-numeric: tabular-nums; }
.muted { color: var(--mute); } .faint { color: var(--faint); font-size: 13px; }
.good { color: var(--good); } .warn { color: var(--warn); } .bad { color: var(--bad); }
.chip { display: inline-block; font-size: 12px; padding: 2px 9px; border-radius: 999px; background: var(--chip); color: var(--mute); white-space: nowrap; }
.chip.on { background: var(--accent); color: var(--accent-ink); }
.agent { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.a-argus { color: var(--argus); } .a-hermes { color: var(--hermes); } .a-kairos { color: var(--kairos); }
.a-themis { color: var(--themis); } .a-athena { color: var(--athena); } .a-plutus { color: var(--plutus); } .a-owner, .a-client, .a-public { color: var(--mute); }
.btn { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 7px 15px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--faint); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.danger { color: var(--bad); }
.btn.small { padding: 4px 11px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
input[type=text], input[type=email], input[type=number], input[type=date], input[type=password], input[type=url], select, textarea {
  border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 8px 10px; width: 100%; }
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
label { display: block; font-size: 13px; color: var(--mute); margin: 10px 0 4px; }
.form { display: grid; gap: 0 14px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.form .wide { grid-column: 1 / -1; }
.email { white-space: pre-wrap; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font-size: 14px; margin: 10px 0; max-height: 420px; overflow: auto; }
.meta { font-size: 13px; color: var(--mute); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 500; color: var(--faint); font-size: 12px; padding: 6px 8px; border-bottom: 1px solid var(--line); }
td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tablewrap { overflow-x: auto; }
.list > div { padding: 10px 0; border-bottom: 1px solid var(--line); }
.list > div:last-child { border-bottom: 0; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; }
.check input { margin-top: 4px; }
.bar { height: 6px; background: var(--chip); border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--accent); color: var(--accent-ink); padding: 10px 18px; border-radius: 999px; z-index: 9; max-width: calc(100% - 32px); }
.login { max-width: 380px; margin: 12vh auto; padding: 0 16px; }
.empty { color: var(--faint); padding: 18px 0; }
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.brief { border-left: 3px solid var(--athena); }
.stages { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.stages .chip { cursor: pointer; }
.topbar { display: none; }
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  nav.side { display: none; position: fixed; inset: 0; z-index: 8; height: auto; }
  nav.side.open { display: block; }
  .topbar { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 7; }
  main { padding: 18px 16px 80px; }
}
