/* Rishuu Panel — dark, simple, responsive */
:root {
  --bg: #080a0f;
  --surface: #10131b;
  --surface-2: #151a25;
  --surface-3: #1c2231;
  --border: #242c3e;
  --border-soft: #1a2030;
  --text: #e9ecf5;
  --muted: #96a0b6;
  --faint: #6a7488;
  --accent: #7c8cff;
  --accent-soft: rgba(124, 140, 255, .14);
  --accent-2: #4fd1c5;
  --ok: #57d38c;
  --warn: #ffc46b;
  --bad: #ff6b81;
  --info: #66b8ff;
  --radius: 15px;
  --radius-sm: 10px;
  --shadow: 0 12px 34px rgba(0, 0, 0, .38);
  --shadow-sm: 0 1px 0 rgba(255, 255, 255, .035) inset, 0 10px 26px rgba(0, 0, 0, .3);
  --ring: 0 0 0 3px rgba(124, 140, 255, .22);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background:
    radial-gradient(820px 460px at 8% -8%, rgba(124, 140, 255, .16), transparent 62%),
    radial-gradient(680px 400px at 102% -2%, rgba(79, 209, 197, .10), transparent 58%),
    radial-gradient(900px 600px at 50% 118%, rgba(124, 140, 255, .06), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: rgba(124, 140, 255, .32); color: #fff; }

a { color: var(--accent); text-decoration: none; transition: color .15s; }
a:hover { text-decoration: underline; }

h1, h2 { margin: 0; font-weight: 640; letter-spacing: -.017em; }
h1 { font-size: 23px; line-height: 1.25; }
h2 { font-size: 14.5px; }

.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.hint { color: var(--faint); font-size: 12px; margin: 8px 0 0; }

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 244px;
  display: flex;
  flex-direction: column;
  padding: 20px 14px 16px;
  background: linear-gradient(180deg, rgba(16, 20, 29, .94), rgba(10, 13, 19, .96));
  border-right: 1px solid var(--border-soft);
  backdrop-filter: blur(14px);
  z-index: 40;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 2px 8px 20px; }
.brand-mark {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 12px;
  font-weight: 800; font-size: 17px; color: #fff;
  background: linear-gradient(135deg, var(--accent), #5a6cff 55%, var(--accent-2));
  box-shadow: 0 8px 22px rgba(124, 140, 255, .38), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: .01em; }
.brand-sub { font-size: 11.5px; color: var(--faint); }

.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 2px; }
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--muted);
  font-weight: 520;
  font-size: 13.5px;
  transition: background .16s, color .16s, transform .16s;
}
.nav-item svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-item.active {
  background: linear-gradient(90deg, rgba(124, 140, 255, .19), rgba(124, 140, 255, .045));
  color: #e3e7ff;
  box-shadow: inset 0 0 0 1px rgba(124, 140, 255, .2);
}
.nav-item.active svg { opacity: 1; color: var(--accent); }
.nav-item.active::before {
  content: "";
  position: absolute; left: -14px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding-top: 18px; }
.bot-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: rgba(21, 26, 37, .5);
  color: var(--muted);
  font-size: 12.5px;
}
.bot-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); transition: background .2s; }
.bot-pill.is-ok .dot { background: var(--ok); box-shadow: 0 0 0 4px rgba(87, 211, 140, .13); }
.bot-pill.is-bad .dot { background: var(--bad); box-shadow: 0 0 0 4px rgba(255, 107, 129, .13); }

.logout {
  width: 100%;
  display: flex; align-items: center; gap: 9px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font: inherit; font-size: 13px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.logout:hover { background: var(--surface-2); color: var(--text); }

/* ---------- Main ---------- */
.main { margin-left: 244px; padding: 22px 32px 64px; max-width: 1480px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 18px;
  margin: -22px -32px 20px;
  padding: 20px 32px 14px;
  background: linear-gradient(180deg, rgba(8, 10, 15, .93) 55%, rgba(8, 10, 15, .72));
  backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s, box-shadow .2s;
}
.topbar .sub { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.pill-ok { color: #bff3d2; border-color: rgba(87, 211, 140, .3); background: rgba(87, 211, 140, .1); }
.pill-ok .dot { background: var(--ok); box-shadow: 0 0 0 3px rgba(87, 211, 140, .14); }
.pill-bad { color: #ffd0d6; border-color: rgba(255, 107, 129, .3); background: rgba(255, 107, 129, .1); }
.pill-bad .dot { background: var(--bad); box-shadow: 0 0 0 3px rgba(255, 107, 129, .14); }

/* ---------- Cards & grids ---------- */
.card {
  position: relative;
  background: linear-gradient(180deg, rgba(22, 27, 39, .9), rgba(15, 19, 27, .92));
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.card + .card, .card + section, section + section, .filters + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2 { letter-spacing: -.01em; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.stat {
  position: relative;
  overflow: hidden;
  padding: 16px 17px 15px;
  border-radius: var(--radius);
  border: 1px solid var(--border-soft);
  background: linear-gradient(180deg, rgba(24, 29, 42, .95), rgba(16, 20, 28, .95));
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.stat::before {
  content: "";
  position: absolute; inset: 0 0 auto 0; height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2) 60%, transparent);
  opacity: .75;
}
.stat::after {
  content: "";
  position: absolute; right: -30px; top: -40px;
  width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(circle, rgba(124, 140, 255, .16), transparent 70%);
  pointer-events: none;
}
.stat:hover { transform: translateY(-2px); border-color: rgba(124, 140, 255, .3); box-shadow: 0 16px 34px rgba(0, 0, 0, .4); }
.stat-label { display: block; color: var(--muted); font-size: 12px; letter-spacing: .01em; }
.stat-value {
  display: block;
  font-size: 28px; font-weight: 700;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
  margin: 5px 0 1px;
}
.stat-sub { color: var(--faint); font-size: 11.5px; }
.text-ok { color: var(--ok); }
.text-bad { color: var(--bad); }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 16px; margin-top: 16px; }
.grid-2 > .card { margin-top: 0; }

/* ---------- Chart ---------- */
.chart { display: flex; align-items: flex-end; gap: 7px; height: 172px; padding: 10px 2px 0; }
.chart-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 6px; }
.chart-bar {
  width: 100%;
  border-radius: 6px 6px 3px 3px;
  background: linear-gradient(180deg, rgba(124, 140, 255, .95), rgba(124, 140, 255, .22));
  min-height: 3px;
  transition: filter .15s, transform .15s;
  transform-origin: bottom;
}
.chart-col:hover .chart-bar { filter: brightness(1.3); transform: scaleY(1.02); }
.chart-label { font-size: 10.5px; color: var(--faint); white-space: nowrap; }

/* ---------- Attribution ---------- */
.attribution { display: flex; flex-direction: column; gap: 11px; }
.attr-row { display: grid; grid-template-columns: 120px 1fr 46px; align-items: center; gap: 10px; }
.attr-label { color: var(--muted); font-size: 12.5px; }
.attr-track { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.attr-fill {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, var(--accent), #98a5ff);
  transition: width .4s ease;
}
.attr-fill.bar-ok { background: linear-gradient(90deg, var(--ok), #7ee3a8); }
.attr-fill.bar-warn { background: linear-gradient(90deg, var(--warn), #ffd894); }
.attr-fill.bar-muted { background: var(--faint); }
.attr-value { font-family: var(--mono); font-size: 12px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Feed ---------- */
.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.feed-item { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border-soft); }
.feed-item:last-child { border-bottom: 0; }
.feed-icon {
  flex: none; width: 25px; height: 25px; display: grid; place-items: center;
  border-radius: 8px; font-size: 12px; font-weight: 700;
  background: var(--surface-3); color: var(--muted);
}
.feed-join .feed-icon { background: rgba(87, 211, 140, .14); color: var(--ok); }
.feed-leave .feed-icon { background: rgba(255, 107, 129, .14); color: var(--bad); }
.feed-warning .feed-icon { background: rgba(255, 196, 107, .14); color: var(--warn); }
.feed-text { flex: 1; min-width: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-time { color: var(--faint); font-size: 11.5px; white-space: nowrap; }

/* ---------- Forms & buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 15px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: inherit; font-size: 13.5px; font-weight: 550;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s, border-color .15s, transform .06s, box-shadow .15s;
}
.btn:hover { background: var(--surface-3); border-color: #2c3549; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible,
.logout:focus-visible, .nav-item:focus-visible, .tab:focus-visible, .lang:focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-color: rgba(124, 140, 255, .6);
}
.btn-primary {
  background: linear-gradient(135deg, #7c8cff, #6272ff);
  border-color: transparent; color: #fff;
  box-shadow: 0 8px 20px rgba(98, 114, 255, .3), inset 0 1px 0 rgba(255, 255, 255, .2);
}
.btn-primary:hover { background: linear-gradient(135deg, #8f9dff, #7381ff); }
.btn-danger { background: rgba(255, 107, 129, .13); border-color: rgba(255, 107, 129, .32); color: #ffc2cb; }
.btn-danger:hover { background: rgba(255, 107, 129, .21); border-color: rgba(255, 107, 129, .45); }
.btn-warn { background: rgba(255, 196, 107, .13); border-color: rgba(255, 196, 107, .32); color: #ffe0b0; }
.btn-warn:hover { background: rgba(255, 196, 107, .21); border-color: rgba(255, 196, 107, .45); }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn.disabled, .btn:disabled { opacity: .4; pointer-events: none; }

.filters {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr)) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 16px;
}
.filter { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.filter label, .stack label { color: var(--muted); font-size: 11.5px; font-weight: 550; letter-spacing: .01em; }
input, select, textarea {
  width: 100%;
  padding: 9px 11px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: rgba(12, 15, 22, .75);
  color: var(--text);
  font: inherit;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover, select:hover, textarea:hover { border-color: #2c3549; }
input:focus, select:focus, textarea:focus {
  outline: none;
  background: rgba(12, 15, 22, .95);
  border-color: rgba(124, 140, 255, .6);
}
textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2396a0b6' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  padding-right: 32px;
}
.filter-actions { flex-direction: row; align-items: center; gap: 8px; }
.form-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.stack .btn { align-self: flex-start; }
.inline-form { margin-top: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---------- Tables ---------- */
.table-card { padding: 0; overflow: hidden; }
.table-wrap { overflow: auto; max-height: 70vh; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  position: sticky; top: 0; z-index: 1;
  padding: 11px 15px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--faint);
  background: rgba(21, 26, 37, .97);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td { padding: 11px 15px; border-bottom: 1px solid var(--border-soft); vertical-align: top; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: rgba(124, 140, 255, .055); }
.table tbody tr:last-child td { border-bottom: 0; }
.table-compact td, .table-compact th { padding: 8px 11px; }
.row-deleted td { background: rgba(255, 107, 129, .04); }
.row-deleted:hover td { background: rgba(255, 107, 129, .08); }
.col-time { white-space: nowrap; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.col-content { max-width: 560px; word-break: break-word; }
.col-status { white-space: nowrap; }
.content-link { color: var(--text); }
.content-link:hover { color: #fff; text-decoration: underline; text-underline-offset: 2px; }
.user-name { display: block; font-weight: 550; }
.user-id { display: block; font-family: var(--mono); font-size: 11px; color: var(--faint); }
.empty { text-align: center; color: var(--muted); padding: 38px 12px !important; }

/* ---------- Badges, chips, tabs, pager ---------- */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge-ok { color: #bff3d2; background: rgba(87, 211, 140, .12); border-color: rgba(87, 211, 140, .26); }
.badge-bad { color: #ffc2cb; background: rgba(255, 107, 129, .12); border-color: rgba(255, 107, 129, .26); }
.badge-warn { color: #ffe0b0; background: rgba(255, 196, 107, .12); border-color: rgba(255, 196, 107, .26); }
.badge-info { color: #c6e5ff; background: rgba(102, 184, 255, .12); border-color: rgba(102, 184, 255, .26); }
.badge-muted { color: var(--muted); background: var(--surface-3); border-color: var(--border-soft); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-3);
  border: 1px solid var(--border-soft);
  color: var(--muted);
  font-size: 11.5px;
}

.tabs {
  display: flex; gap: 4px;
  margin-bottom: 16px;
  padding: 4px;
  flex-wrap: wrap;
  border-radius: 12px;
  background: rgba(16, 20, 29, .6);
  border: 1px solid var(--border-soft);
  width: fit-content;
  max-width: 100%;
}
.tab {
  padding: 7px 14px;
  border-radius: 9px;
  color: var(--muted);
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 550;
  transition: background .15s, color .15s;
}
.tab:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.tab.active {
  background: var(--surface-3);
  border-color: var(--border);
  color: var(--text);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .25);
}

.pager {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  padding: 14px;
  border-top: 1px solid var(--border-soft);
  font-size: 13px;
  color: var(--muted);
}

/* ---------- Key/value ---------- */
.kv { display: grid; grid-template-columns: 132px 1fr; gap: 8px 16px; margin: 0 0 16px; }
.kv dt { color: var(--muted); font-size: 12.5px; }
.kv dd { margin: 0; }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.message-body {
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(10, 13, 19, .7);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 13.5px;
  line-height: 1.6;
  min-height: 80px;
}

/* ---------- Flashes ---------- */
.flashes { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.flash {
  padding: 11px 15px;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 13px;
  box-shadow: var(--shadow-sm);
}
.flash-ok { border-color: rgba(87, 211, 140, .3); background: rgba(87, 211, 140, .09); color: #c9f5da; }
.flash-error { border-color: rgba(255, 107, 129, .3); background: rgba(255, 107, 129, .09); color: #ffd0d6; }
.flash-warn { border-color: rgba(255, 197, 107, .3); background: rgba(255, 197, 107, .09); color: #ffe7bf; }

/* ---------- Login ---------- */
body.centered { display: grid; place-items: center; min-height: 100vh; padding: 24px 16px; }
.login-shell { width: 100%; max-width: 404px; }
.login-card {
  position: relative;
  background: linear-gradient(180deg, rgba(22, 27, 39, .96), rgba(13, 16, 23, .98));
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 28px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .05);
  overflow: hidden;
}
.login-card::before {
  content: "";
  position: absolute; inset: -1px -1px auto -1px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--accent-2), transparent);
  opacity: .9;
}
.login-brand { padding: 0 0 20px; }
.login-form { display: flex; flex-direction: column; gap: 9px; }
.login-form label { color: var(--muted); font-size: 12px; font-weight: 550; }
.login-form .btn { margin-top: 6px; padding: 11px 15px; }
.login-hint { margin: 16px 0 0; color: var(--faint); font-size: 11.5px; text-align: center; }
.error-code { font-size: 52px; font-weight: 800; letter-spacing: -.04em; color: var(--accent); line-height: 1; }
.error-message { color: var(--muted); margin: 8px 0 22px; }

/* ---------- Language switch + 2FA ---------- */
.lang-switch { display: flex; gap: 4px; justify-content: center; }
.lang-switch .lang {
  padding: 4px 9px;
  border-radius: 8px;
  border: 1px solid transparent;
  color: var(--faint);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .06em;
  transition: color .15s, background .15s, border-color .15s;
}
.lang-switch .lang:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.lang-switch .lang.active {
  background: var(--surface-3);
  color: var(--text);
  border-color: var(--border);
}
.lang-switch-login { margin-bottom: 14px; }
.login-step-title { font-size: 18px; margin: 2px 0 6px; }
.qr-code {
  display: block; margin: 16px auto;
  background: #fff; padding: 9px; border-radius: 14px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .35);
}
.secret-box {
  display: block;
  padding: 11px 12px;
  border-radius: 10px;
  background: rgba(10, 13, 19, .8);
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 13.5px;
  letter-spacing: .14em;
  word-break: break-all;
  text-align: center;
}
.recovery-codes {
  list-style: none; padding: 0; margin: 14px 0 18px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.recovery-codes code {
  display: block; padding: 9px; text-align: center;
  border-radius: 9px;
  background: rgba(10, 13, 19, .8);
  border: 1px solid var(--border);
  font-size: 12.5px;
  letter-spacing: .06em;
}
.login-back { margin-top: 14px; text-align: center; }
.linklike {
  background: none; border: none; color: var(--muted);
  font: inherit; font-size: 12.5px; cursor: pointer; text-decoration: underline;
}
.linklike:hover { color: var(--text); }

/* ---------- Scrollbars ---------- */
* { scrollbar-width: thin; scrollbar-color: #2b3448 transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #242c3e;
  border-radius: 99px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: #33405c; background-clip: content-box; }

/* ---------- Mobile ---------- */
.menu-toggle {
  display: none;
  position: fixed; top: 14px; left: 14px; z-index: 60;
  width: 40px; height: 40px;
  align-items: center; justify-content: center;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: rgba(21, 26, 37, .95);
  backdrop-filter: blur(8px);
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.overlay { display: none; }

@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
  .filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .menu-toggle { display: flex; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform .22s ease;
    width: 262px;
    box-shadow: 0 0 60px rgba(0, 0, 0, .6);
  }
  .main { margin-left: 0; padding: 64px 16px 44px; }
  .topbar {
    margin: -64px -16px 16px;
    padding: 62px 16px 12px;
  }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters { grid-template-columns: 1fr 1fr; }
  .topbar { flex-direction: column; align-items: flex-start; gap: 10px; }
  .attr-row { grid-template-columns: 96px 1fr 40px; }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .overlay {
    display: block;
    position: fixed; inset: 0; z-index: 30;
    background: rgba(0, 0, 0, .55);
    backdrop-filter: blur(2px);
  }
  .table-wrap { max-height: none; }
}

@media (max-width: 520px) {
  .stat-grid { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 108px 1fr; }
  .card { padding: 15px 16px; }
  .tabs { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .stat:hover { transform: none; }
}
