:root {
  --bg: #0d120c; --bg2: #131a12; --panel: #182116; --panel2: #1e2a1b; --line: #2a3a26; --line2: #344832;
  --text: #e9f1e4; --muted: #9db199; --faint: #6f8469;
  --accent: #8bc34a; --accent2: #c0e57f; --gold: #ffc94d; --red: #ef5350; --orange: #ffa040; --blue: #64b5f6; --purple: #b388ff;
  --radius: 14px; --shadow: 0 10px 30px rgba(0,0,0,.35);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: radial-gradient(1200px 600px at 10% -10%, #1c2a17 0%, var(--bg) 55%) fixed; color: var(--text); font: 14px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif; }
a { color: var(--accent2); text-decoration: none; } a:hover { text-decoration: underline; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
h1, h2, h3 { margin: 0; line-height: 1.2; } h1 { font-size: 24px; } h2 { font-size: 18px; } h3 { font-size: 15px; }
.boot { display: grid; place-items: center; height: 100%; color: var(--muted); } .boot-logo { font-size: 48px; }

/* layout */
.layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100vh; width: 100%; }
.sidebar { background: rgba(13,18,12,.85); border-right: 1px solid var(--line); padding: 18px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 16px; } .brand .logo { font-size: 26px; } .brand b { font-size: 16px; display: block; } .brand small { color: var(--muted); }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: var(--muted); font-weight: 500; }
.nav a:hover { background: var(--panel); color: var(--text); text-decoration: none; }
.nav a.active { background: linear-gradient(90deg, rgba(139,195,74,.22), rgba(139,195,74,.06)); color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }
.nav .ico { width: 22px; text-align: center; font-size: 16px; }
.sidebar .spacer { flex: 1; }
.me { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); }
.me img { width: 34px; height: 34px; border-radius: 50%; } .me div { min-width: 0; } .me b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .me small { color: var(--muted); }
.main { padding: 26px 30px 60px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { color: var(--muted); margin: 4px 0 0; }
.content { min-width: 0; }
.topbar { display: none; padding: 12px 16px 0; }
.btn.menu-btn { display: none; }

/* tabs */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.tabs button { background: transparent; border: 1px solid transparent; color: var(--muted); padding: 7px 12px; border-radius: 9px; cursor: pointer; font: inherit; font-weight: 500; }
.tabs button:hover { color: var(--text); background: var(--panel); }
.tabs button.active { color: var(--text); background: var(--panel2); border-color: var(--line2); }

/* cards & grids */
.grid { display: grid; gap: 16px; } .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: linear-gradient(180deg, var(--panel2), var(--panel)); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); min-width: 0; }
.card > h3 { margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card > h3 small { color: var(--muted); font-weight: 400; }
.stat { display: flex; flex-direction: column; gap: 2px; } .stat .label { color: var(--muted); font-size: 12.5px; } .stat .value { font-size: 26px; font-weight: 700; letter-spacing: -.5px; } .stat .sub { color: var(--faint); font-size: 12.5px; }
.stat .ico { float: right; font-size: 22px; opacity: .85; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; } .kv dt { color: var(--muted); } .kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.list { display: flex; flex-direction: column; gap: 8px; } .row { display: flex; align-items: center; gap: 10px; min-width: 0; } .row .grow { flex: 1; min-width: 0; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .ok { color: var(--accent); } .bad { color: var(--red); } .warn { color: var(--orange); }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--line); color: var(--text); white-space: nowrap; }
.badge.green { background: rgba(139,195,74,.18); color: var(--accent2); } .badge.red { background: rgba(239,83,80,.18); color: #ff8a80; } .badge.orange { background: rgba(255,160,64,.18); color: #ffc58a; } .badge.blue { background: rgba(100,181,246,.18); color: #9fd2ff; } .badge.gold { background: rgba(255,201,77,.18); color: var(--gold); } .badge.purple { background: rgba(179,136,255,.18); color: #d4bfff; }
.avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; background: var(--line); } .avatar.lg { width: 64px; height: 64px; border-radius: 16px; }
.empty { color: var(--faint); padding: 16px; text-align: center; }
.sep { height: 1px; background: var(--line); margin: 14px 0; }

/* tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; } th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12.5px; background: rgba(0,0,0,.18); position: sticky; top: 0; } tr:last-child td { border-bottom: 0; } tbody tr:hover { background: rgba(255,255,255,.02); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* forms */
form, .form { display: flex; flex-direction: column; gap: 12px; }
.fields { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
label.field { display: flex; flex-direction: column; gap: 5px; color: var(--muted); font-size: 12.5px; font-weight: 600; }
input, select, textarea { width: 100%; background: #0f160e; border: 1px solid var(--line2); color: var(--text); border-radius: 10px; padding: 9px 11px; font: inherit; }
textarea { min-height: 90px; resize: vertical; } input:focus, select:focus, textarea:focus { outline: 2px solid rgba(139,195,74,.5); border-color: var(--accent); }
input[type=checkbox] { width: auto; accent-color: var(--accent); } label.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 500; font-size: 14px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
button.btn, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line2); background: var(--panel2); color: var(--text); padding: 8px 14px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer; }
.btn:hover { border-color: var(--accent); } .btn:disabled { opacity: .55; cursor: wait; }
.btn.primary { background: linear-gradient(180deg, #8bc34a, #6a9f33); border-color: #6a9f33; color: #0d160b; } .btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: rgba(239,83,80,.15); border-color: rgba(239,83,80,.5); color: #ffb4b1; } .btn.danger:hover { background: rgba(239,83,80,.25); }
.btn.small { padding: 4px 10px; font-size: 12.5px; border-radius: 8px; } .btn.ghost { background: transparent; }
.switch { position: relative; display: inline-block; vertical-align: middle; width: 42px; height: 24px; flex: none; } .switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line2); border-radius: 99px; cursor: pointer; transition: .2s; } .switch span::after { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; border-radius: 50%; background: #dfe9da; transition: .2s; }
.switch input:checked + span { background: var(--accent); } .switch input:checked + span::after { transform: translateX(18px); }

/* misc */
.bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; } .bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); }
pre.log { background: #090d08; border: 1px solid var(--line); border-radius: 12px; padding: 12px; max-height: 65vh; overflow: auto; white-space: pre-wrap; word-break: break-word; font-size: 12px; line-height: 1.45; margin: 0; }
pre.log .w { color: #ffc58a; } pre.log .e { color: #ff8a80; }
pre.json { background: #090d08; border: 1px solid var(--line); border-radius: 12px; padding: 12px; max-height: 60vh; overflow: auto; font-size: 12px; margin: 0; white-space: pre-wrap; word-break: break-word; }
.chip-list { display: flex; gap: 6px; flex-wrap: wrap; }
.role-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.embed-preview { border-left: 4px solid var(--accent); background: #2b2d31; border-radius: 6px; padding: 10px 14px; color: #dbdee1; } .embed-preview b { color: #fff; } .embed-preview img { max-width: 100%; border-radius: 6px; margin-top: 8px; }
.hero { display: flex; align-items: center; gap: 16px; } .hero img { width: 72px; height: 72px; border-radius: 18px; } .hero h2 { font-size: 22px; }
.pill-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* toasts & modal */
#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 50; }
.toast { background: var(--panel2); border: 1px solid var(--line2); border-left: 4px solid var(--accent); padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow); max-width: 380px; animation: pop .2s ease; }
.toast.error { border-left-color: var(--red); } @keyframes pop { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 40; padding: 16px; }
.modal { background: var(--panel); border: 1px solid var(--line2); border-radius: 16px; padding: 20px; width: min(560px, 100%); max-height: 90vh; overflow: auto; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .card { width: min(420px, 100%); padding: 28px; } .login .logo { font-size: 44px; } .login h1 { margin: 8px 0 4px; } .login p { color: var(--muted); margin: 0 0 18px; }

@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; } .sidebar { position: fixed; z-index: 30; width: 260px; transform: translateX(-100%); transition: .2s; } .sidebar.open { transform: none; }
  .topbar { display: block; } .btn.menu-btn { display: inline-flex; } .main { padding: 16px; } .g2, .g3, .g4 { grid-template-columns: 1fr; }
}
