:root {
  --bg: #f4f6f9; --panel: #ffffff; --ink: #18202b; --muted: #5d6b7c; --line: #dde3ea; --soft: #eef2f6;
  --brand: #0b5cad; --brand-ink: #ffffff; --ok: #15803d; --warn: #b45309; --bad: #b91c1c;
  --rw: #0b5cad; --ug: #d97706; --ke: #15803d; --shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --radius: 10px; color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141a; --panel: #171e26; --ink: #e6ebf1; --muted: #9aa8b8; --line: #2a3440; --soft: #1e2731;
    --brand: #4a9eff; --brand-ink: #06121f; --ok: #22c55e; --warn: #f59e0b; --bad: #f87171;
    --rw: #4a9eff; --ug: #f59e0b; --ke: #22c55e; --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 20px; margin: 0 0 14px; }
h2 { font-size: 16px; margin: 0 0 10px; }
h3 { font-size: 14px; margin: 0 0 8px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }

.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px; padding: 10px 20px;
  background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--ink); white-space: nowrap; }
.logo { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: var(--brand);
  color: var(--brand-ink); font-weight: 800; }
nav { display: flex; gap: 4px; overflow-x: auto; flex: 1; }
nav a { padding: 6px 12px; border-radius: 8px; color: var(--muted); white-space: nowrap; }
nav a.on { background: var(--soft); color: var(--ink); font-weight: 600; }
nav a:hover { text-decoration: none; color: var(--ink); }
.me { display: flex; align-items: center; gap: 10px; color: var(--muted); white-space: nowrap; }

main { max-width: 1280px; margin: 0 auto; padding: 20px; }
.loading { padding: 40px; text-align: center; color: var(--muted); }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow); }
.grid { display: grid; gap: 14px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-bottom: 14px; }
.kpi .n { font-size: 26px; font-weight: 700; }
.kpi .l { color: var(--muted); font-size: 13px; }
.two { grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); }
.stack > * + * { margin-top: 14px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }

.btn { appearance: none; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 8px;
  padding: 7px 12px; font: inherit; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--soft); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 4px 9px; font-size: 12.5px; }
.btn:disabled { opacity: .55; cursor: default; }

input, select, textarea { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 9px; min-width: 0; }
textarea { width: 100%; min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); }
label.f > input, label.f > select, label.f > textarea { color: var(--ink); font-size: 14px; }
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.form .wide { grid-column: 1 / -1; }
.check { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.filters input[type=search] { flex: 1 1 220px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--soft); }
.table-wrap { overflow-x: auto; }
.t-title { font-weight: 600; max-width: 520px; }

.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; background: var(--soft);
  color: var(--muted); white-space: nowrap; }
.pill.rw { background: color-mix(in srgb, var(--rw) 15%, transparent); color: var(--rw); }
.pill.ug { background: color-mix(in srgb, var(--ug) 18%, transparent); color: var(--ug); }
.pill.ke { background: color-mix(in srgb, var(--ke) 15%, transparent); color: var(--ke); }
.pill.hot { background: color-mix(in srgb, var(--bad) 15%, transparent); color: var(--bad); }
.pill.warm { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }
.pill.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.due-bad { color: var(--bad); font-weight: 600; }
.due-warn { color: var(--warn); font-weight: 600; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; }
.tabs a { padding: 8px 14px; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--ink); border-bottom-color: var(--brand); font-weight: 600; }
.tabs a:hover { text-decoration: none; color: var(--ink); }

.bar { height: 8px; border-radius: 99px; background: var(--soft); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--brand); }
.stage-row { display: grid; grid-template-columns: 130px 1fr 120px; gap: 10px; align-items: center; margin: 6px 0; }

.feed { list-style: none; margin: 0; padding: 0; }
.feed li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.feed li:last-child { border-bottom: 0; }
.feed .meta { font-size: 12px; color: var(--muted); }

.checklist .sec { margin-top: 14px; }
.ci { display: grid; grid-template-columns: 1fr 120px 150px 140px 40px; gap: 8px; align-items: center; padding: 6px 0;
  border-bottom: 1px solid var(--line); }
.ci.done .ttl { color: var(--muted); text-decoration: line-through; }
.ci select, .ci input { padding: 4px 6px; font-size: 13px; }

.folder { margin-top: 10px; }
.folder > summary { cursor: pointer; font-weight: 600; padding: 8px 0; }
.file { display: flex; gap: 10px; justify-content: space-between; align-items: flex-start; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 8px; margin: 6px 0; }
.file .v { font-size: 12px; color: var(--muted); }
.drop { border: 2px dashed var(--line); border-radius: var(--radius); padding: 18px; text-align: center; color: var(--muted); }
.drop.over { border-color: var(--brand); color: var(--brand); }
.progress { height: 6px; background: var(--soft); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.progress > i { display: block; height: 100%; width: 0; background: var(--brand); transition: width .2s; }

.modal { position: fixed; inset: 0; background: rgba(10, 15, 20, .45); display: grid; place-items: center; z-index: 50;
  padding: 16px; }
.modal-box { background: var(--panel); border-radius: 12px; width: min(720px, 100%); max-height: 90vh; overflow: auto;
  padding: 20px; border: 1px solid var(--line); }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg);
  padding: 10px 16px; border-radius: 8px; z-index: 60; max-width: 90vw; }
.toast.err { background: var(--bad); color: #fff; }

.login { max-width: 420px; margin: 10vh auto; }
.login .logo { width: 44px; height: 44px; font-size: 22px; border-radius: 10px; margin-bottom: 12px; }
.empty { padding: 24px; text-align: center; color: var(--muted); }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 10px; }
dl.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; overflow-wrap: anywhere; }

@media (max-width: 760px) {
  main { padding: 12px 16px; }
  .top { padding: 8px 12px; gap: 10px; flex-wrap: wrap; }
  .me span { display: none; }
  .two { grid-template-columns: 1fr; }
  .ci { grid-template-columns: 1fr 1fr; }
  .ci .ttl { grid-column: 1 / -1; }
  dl.kv { grid-template-columns: 110px 1fr; }
  .hide-sm { display: none; }
  .stage-row { grid-template-columns: 100px 1fr 80px; }
}
