:root {
  --bg: #f4f6f5; --panel: #ffffff; --panel-2: #f8faf9; --line: #e3e8e6; --text: #17211e; --muted: #5d6b66; --faint: #8a9692;
  --brand: #1f6f5c; --brand-2: #2a8b74; --brand-soft: #e3f1ec; --accent: #c2410c;
  --red: #c0392b; --red-soft: #fbe9e7; --amber: #b7791f; --amber-soft: #fdf3e1; --green: #2f855a; --green-soft: #e6f4ec;
  --blue: #2b6cb0; --blue-soft: #e7f0fa; --shadow: 0 1px 2px rgba(16,24,22,.05), 0 4px 16px rgba(16,24,22,.05);
  --radius: 12px; color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1513; --panel: #161e1b; --panel-2: #1b2522; --line: #273330; --text: #e6eeeb; --muted: #a2b1ac; --faint: #75847f;
    --brand: #4fb39a; --brand-2: #63c4ab; --brand-soft: #1b3a32; --accent: #f08a54;
    --red: #ef7b6e; --red-soft: #3a1f1c; --amber: #e3b25b; --amber-soft: #3a2f19; --green: #6cc795; --green-soft: #1b3326;
    --blue: #79aee6; --blue-soft: #1a2b3d; --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1513; --panel: #161e1b; --panel-2: #1b2522; --line: #273330; --text: #e6eeeb; --muted: #a2b1ac; --faint: #75847f;
  --brand: #4fb39a; --brand-2: #63c4ab; --brand-soft: #1b3a32; --accent: #f08a54;
  --red: #ef7b6e; --red-soft: #3a1f1c; --amber: #e3b25b; --amber-soft: #3a2f19; --green: #6cc795; --green-soft: #1b3326;
  --blue: #79aee6; --blue-soft: #1a2b3d; --shadow: none; color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 14px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 22px; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
.boot { padding: 40px; color: var(--muted); }
.muted { color: var(--muted); } .faint { color: var(--faint); } .small { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }

/* layout */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 18px 12px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 16px; }
.logo { width: 32px; height: 32px; border-radius: 9px; background: var(--brand); display: grid; place-items: center; color: #fff; flex: none; }
.brand b { display: block; font-size: 15px; } .brand span { font-size: 12px; color: var(--muted); }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--muted); font-weight: 520; }
.nav a:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.nav a.on { background: var(--brand-soft); color: var(--brand); }
.nav svg { width: 18px; height: 18px; flex: none; }
.side-foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.who { display: flex; align-items: center; gap: 8px; }
.foot-links { display: flex; gap: 16px; font-size: 13px; }
.main { padding: 26px 32px 60px; max-width: 1240px; width: 100%; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.head p { margin: 4px 0 0; color: var(--muted); }
.topbar { display: none; }

/* cards */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card + .card { margin-top: 16px; }
.card-h { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.tile .v { font-size: 26px; font-weight: 680; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tile .l { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.tile.red .v { color: var(--red); } .tile.green .v { color: var(--green); } .tile.amber .v { color: var(--amber); }
.hero { display: flex; gap: 18px; align-items: center; }
.avatar { width: 56px; height: 56px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-size: 22px; font-weight: 700; flex: none; }
.hero p { margin: 6px 0 0; color: var(--muted); max-width: 760px; }

/* chips */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 560; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.chip.brand { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.chip.red { background: var(--red-soft); color: var(--red); border-color: transparent; }
.chip.amber { background: var(--amber-soft); color: var(--amber); border-color: transparent; }
.chip.green { background: var(--green-soft); color: var(--green); border-color: transparent; }
.chip.blue { background: var(--blue-soft); color: var(--blue); border-color: transparent; }
.status-pill { display: inline-block; padding: 4px 12px; border-radius: 8px; font-weight: 700; color: #fff; letter-spacing: .02em; }

/* forms */
input, select, textarea, button { font: inherit; color: inherit; }
input[type=text], input[type=date], input[type=number], input[type=password], input[type=url], input[type=search], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
textarea { min-height: 84px; resize: vertical; }
label.f { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--muted); font-weight: 560; }
.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.row > * { flex: 1 1 140px; }
.check { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); flex: 0 0 auto !important; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel); cursor: pointer; font-weight: 580; white-space: nowrap; flex: 0 0 auto !important; }
.btn:hover { background: var(--panel-2); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); }
.btn.danger { color: var(--red); }
.btn.sm { padding: 4px 10px; font-size: 12.5px; }
.btn:disabled { opacity: .55; cursor: default; }
.link { background: none; border: 0; padding: 0; color: var(--brand); cursor: pointer; font-weight: 560; }
.link.danger { color: var(--red); }

/* tables */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--panel-2); font-weight: 650; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover { background: var(--panel-2); }

/* bars */
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar { display: grid; grid-template-columns: 150px 1fr 44px; gap: 10px; align-items: center; font-size: 13px; }
.bar .track { height: 10px; background: var(--panel-2); border-radius: 99px; overflow: hidden; border: 1px solid var(--line); }
.bar .fill { height: 100%; background: var(--brand); border-radius: 99px; }
.bar .fill.red { background: var(--red); }
.bar .lab { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stack { display: flex; height: 14px; border-radius: 99px; overflow: hidden; background: var(--panel-2); }
.stack span { display: block; height: 100%; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.cols { display: flex; align-items: flex-end; gap: 6px; height: 120px; padding-top: 8px; }
.cols .c { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.cols .c b { font-size: 11px; color: var(--muted); font-weight: 600; }
.cols .c span { width: 100%; max-width: 38px; background: var(--brand); border-radius: 5px 5px 0 0; min-height: 2px; }
.cols .c em { font-style: normal; font-size: 11px; color: var(--faint); white-space: nowrap; }

/* lists */
.list { display: flex; flex-direction: column; }
.item { padding: 12px 0; border-bottom: 1px solid var(--line); display: flex; gap: 12px; }
.item:last-child { border-bottom: 0; }
.item .when { width: 92px; flex: none; color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.item .body { flex: 1; min-width: 0; }
.item .body p { margin: 2px 0 0; white-space: pre-wrap; word-break: break-word; }
.item .acts { display: flex; gap: 10px; flex: none; align-items: flex-start; }
.daygrp { margin-top: 14px; font-weight: 650; color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; }
.timeline { position: relative; padding-left: 22px; }
.timeline:before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.tl { position: relative; padding: 0 0 18px; }
.tl:before { content: ""; position: absolute; left: -21px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--panel); border: 3px solid var(--brand); }
.tl p { margin: 4px 0 0; color: var(--muted); }
.mod-card { display: flex; flex-direction: column; gap: 10px; }
.mod-card p { margin: 0; color: var(--muted); flex: 1; }
.mod-stats { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.mod-stats b { color: var(--text); font-variant-numeric: tabular-nums; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.empty { padding: 28px; text-align: center; color: var(--muted); }
.note { padding: 10px 12px; border-radius: 8px; background: var(--amber-soft); color: var(--amber); font-size: 13px; margin-bottom: 14px; }
.err { padding: 10px 12px; border-radius: 8px; background: var(--red-soft); color: var(--red); font-size: 13px; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .card { width: 100%; max-width: 380px; padding: 28px; }
.login form { display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }

/* modal / toast */
.modal { position: fixed; inset: 0; background: rgba(10,16,14,.45); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal[hidden] { display: none; }
.modal .box { background: var(--panel); border-radius: 14px; width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; padding: 22px; border: 1px solid var(--line); }
.modal form { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.modal .acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; z-index: 60; font-weight: 560; }
.toast[hidden] { display: none; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 250px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .shell.open .side { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.25); }
  .topbar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
  .main { padding: 18px 16px 50px; }
  .g2, .g3 { grid-template-columns: 1fr; }
  .bar { grid-template-columns: 110px 1fr 36px; }
  .item { flex-wrap: wrap; }
  .item .when { width: auto; }
}
.grid > .card + .card { margin-top: 0; }
.mod-card .card-h h2 { flex: 1; min-width: 0; }
.topbar svg { width: 20px; height: 20px; }
.status-pill { flex: 0 0 auto !important; }
