:root {
  --bg: #0b0d10; --panel: #14171c; --panel2: #1b1f26; --line: #262b33; --text: #e8eaed; --muted: #8b929c;
  --accent: #38c9b4; --accent-ink: #062b26; --danger: #e5484d; --warn: #f5a524; --ok: #30a46c; --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
.layout { display: flex; min-height: 100vh; }
.side { width: 220px; background: #0e1014; border-right: 1px solid var(--line); padding: 16px 10px; position: sticky; top: 0; height: 100vh; }
.brand { font-weight: 700; font-size: 18px; padding: 4px 10px 16px; }
.brand span { color: var(--accent); }
.nav a { display: block; padding: 9px 12px; border-radius: 8px; color: var(--text); text-decoration: none; margin-bottom: 2px; }
.nav a.on { background: #12302b; color: var(--accent); }
.nav a:hover { background: var(--panel2); }
.side .foot { position: absolute; bottom: 14px; left: 10px; right: 10px; font-size: 12px; color: var(--muted); }
main { flex: 1; padding: 24px 28px 80px; min-width: 0; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 20px 0 10px; }
.sub { color: var(--muted); margin: 0 0 18px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grid { display: grid; gap: 12px; }
.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)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.kpi .l { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.kpi .v { font-size: 24px; font-weight: 700; margin-top: 6px; }
.btn { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #3a414b; }
.btn.pri { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.danger { color: var(--danger); }
.btn.sm { padding: 5px 9px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
input, select, textarea { background: #0f1216; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; }
textarea { min-height: 220px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; resize: vertical; }
label.f { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 4px; }
.chk { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.chk input { width: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
td.num, th.num { text-align: right; }
.tbl { overflow-x: auto; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; background: var(--panel2); border: 1px solid var(--line); }
.pill.ok { color: var(--ok); border-color: #1d4d36; }
.pill.bad { color: var(--danger); border-color: #5a2326; }
.pill.warn { color: var(--warn); border-color: #5a4313; }
.tabs { display: flex; gap: 4px; background: var(--panel2); padding: 4px; border-radius: 10px; width: fit-content; margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { background: none; border: 0; padding: 7px 12px; border-radius: 7px; cursor: pointer; color: var(--muted); }
.tabs button.on { background: var(--panel); color: var(--text); }
.group { margin-bottom: 18px; }
.group > .h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; font-weight: 600; }
.item { display: grid; grid-template-columns: auto 1fr auto auto auto; gap: 12px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 6px; }
.item .name { font-weight: 600; cursor: pointer; }
.item .meta { color: var(--muted); font-size: 12px; }
.toggle { position: relative; width: 36px; height: 20px; background: #2a3038; border-radius: 99px; cursor: pointer; border: 0; padding: 0; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; background: #fff; border-radius: 50%; transition: .15s; }
.toggle.on { background: var(--accent); }
.toggle.on::after { left: 19px; }
.editor { display: grid; grid-template-columns: 240px 1fr; gap: 16px; }
.parts .p { padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 6px; cursor: pointer; display: flex; justify-content: space-between; gap: 8px; }
.parts .p.on { border-color: var(--accent); background: #0f2622; }
.bubble { background: #005c4b; color: #e9edef; border-radius: 10px 10px 10px 2px; padding: 10px 12px; white-space: pre-wrap; font-size: 13.5px; max-width: 520px; margin-bottom: 8px; }
.wa { background: #0b141a; border-radius: 10px; padding: 14px; border: 1px solid var(--line); }
.picker { position: relative; }
.picker .pop { position: absolute; right: 0; top: 38px; z-index: 20; width: 380px; max-width: 90vw; max-height: 360px; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px; box-shadow: 0 10px 30px #0008; }
.picker .opt { padding: 6px 8px; border-radius: 6px; cursor: pointer; display: flex; justify-content: space-between; gap: 8px; }
.picker .opt:hover { background: var(--panel2); }
.picker .opt code { color: var(--muted); font-size: 11px; }
.cat { color: var(--muted); font-size: 11px; text-transform: uppercase; margin: 8px 8px 4px; }
.muted { color: var(--muted); }
.err { color: var(--danger); }
.toast { position: fixed; bottom: 18px; right: 18px; background: var(--panel2); border: 1px solid var(--line); padding: 10px 14px; border-radius: 10px; z-index: 50; max-width: 360px; }
.login { max-width: 360px; margin: 12vh auto; }
.wd { display: flex; gap: 6px; flex-wrap: wrap; }
.wd button { min-width: 44px; }
.wd button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.bar { height: 6px; background: #2a3038; border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); }
.mobile-top { display: none; }

@media (max-width: 820px) {
  .layout { flex-direction: column; }
  .side { width: auto; height: auto; position: static; padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .side .foot { display: none; }
  .brand { padding: 4px 0 8px; }
  .nav { display: flex; gap: 4px; overflow-x: auto; }
  .nav a { white-space: nowrap; }
  main { padding: 16px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr 1fr; }
  .editor { grid-template-columns: 1fr; }
  .item { grid-template-columns: auto 1fr auto; }
  .item .hide-m { display: none; }
}

