/* Raven Admin — тёмная тема по дизайн-макету (IBM Plex, cyan→violet). */
:root {
  --bg: #0b0d12;
  --panel: #12151c;
  --panel-2: #0d1016;
  --sidebar: #0f1218;
  --border: #232a37;
  --border-soft: #1e2430;
  --border-input: #2a3140;
  --row-line: #191e28;
  --text: #e8eaf0;
  --text-2: #c9cfdb;
  --muted: #8b93a5;
  --muted-2: #aeb6c6;
  --dim: #5a6274;
  --accent: oklch(75% 0.15 210);
  --accent-2: oklch(66% 0.18 280);
  --grad: linear-gradient(135deg, oklch(76% 0.15 210), oklch(66% 0.18 280));
  --grad-90: linear-gradient(90deg, oklch(76% 0.15 210), oklch(66% 0.18 280));
  --green-bg: oklch(30% 0.07 150 / 0.8);
  --green-fg: oklch(82% 0.16 150);
  --amber-bg: oklch(32% 0.07 85 / 0.8);
  --amber-fg: oklch(85% 0.14 85);
  --red-bg: oklch(28% 0.09 20 / 0.8);
  --red-fg: oklch(76% 0.17 20);
  --blue-bg: oklch(28% 0.06 230 / 0.8);
  --blue-fg: oklch(78% 0.11 220);
  --violet-bg: oklch(28% 0.08 300 / 0.8);
  --violet-fg: oklch(80% 0.13 300);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--text);
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  font-size: 14px;
}
.mono { font-family: 'IBM Plex Mono', ui-monospace, monospace; }
a { color: var(--accent); text-decoration: none; }
button, input, select, textarea { font-family: inherit; }
input::placeholder, textarea::placeholder { color: var(--dim); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2a3140; border-radius: 5px; }
::-webkit-scrollbar-track { background: transparent; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.35} }
@keyframes spin { to { transform: rotate(360deg); } }
[hidden] { display: none !important; }

/* --- login --- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(700px 420px at 25% 20%, oklch(30% 0.09 280 / 0.5) 0%, transparent 65%),
    radial-gradient(700px 500px at 80% 85%, oklch(28% 0.08 200 / 0.5) 0%, transparent 65%),
    var(--bg);
}
.login-card {
  width: 370px;
  background: linear-gradient(180deg, #161a22 0%, #12151c 100%);
  border: 1px solid #262d3a; border-radius: 14px; padding: 34px 30px;
  display: flex; flex-direction: column; gap: 18px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.5);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand .logo {
  width: 38px; height: 38px; border-radius: 10px; background: var(--grad);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 18px; color: var(--bg);
  box-shadow: 0 0 22px oklch(70% 0.16 240 / 0.45); flex-shrink: 0;
}
.brand .title { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.brand .subtitle { font-size: 12px; color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; color: var(--muted); font-weight: 500; }
.input {
  background: var(--panel-2); border: 1px solid var(--border-input);
  border-radius: 8px; padding: 10px 12px; color: var(--text);
  font-size: 13.5px; outline: none; transition: border-color .12s;
}
.input:focus { border-color: var(--accent); }
textarea.input { resize: vertical; }
.btn {
  border: none; border-radius: 8px; padding: 11px; font-size: 13.5px;
  font-weight: 700; cursor: pointer; transition: filter .12s, border-color .12s;
}
.btn-primary { background: var(--grad); color: var(--bg); box-shadow: 0 4px 18px oklch(70% 0.16 240 / 0.35); }
.btn-primary:hover { filter: brightness(1.12); }
.btn-ghost { background: transparent; color: var(--muted-2); border: 1px solid var(--border-input); font-weight: 500; }
.btn-ghost:hover { border-color: #3a4152; }
.btn-sm { padding: 8px 15px; font-size: 12.5px; }
.hint { font-size: 11.5px; color: var(--dim); text-align: center; }
.login-error { font-size: 12px; color: var(--red-fg); text-align: center; min-height: 14px; }

/* --- app shell --- */
.app {
  display: flex; height: 100vh; overflow: hidden;
  background: radial-gradient(900px 500px at 70% -10%, oklch(24% 0.06 260 / 0.55) 0%, transparent 60%), var(--bg);
}
.sidebar { width: 216px; flex-shrink: 0; background: var(--sidebar); border-right: 1px solid var(--border-soft); display: flex; flex-direction: column; }
.sidebar-head { display: flex; align-items: center; gap: 10px; padding: 16px 16px 14px; }
.sidebar-head .logo {
  width: 30px; height: 30px; border-radius: 8px; background: var(--grad);
  display: flex; align-items: center; justify-content: center; font-weight: 700;
  font-size: 15px; color: var(--bg); box-shadow: 0 0 16px oklch(70% 0.16 240 / 0.4);
}
.sidebar-head .name { font-size: 14px; font-weight: 600; }
.dot-online { width: 7px; height: 7px; border-radius: 50%; background: oklch(78% 0.17 150); box-shadow: 0 0 8px oklch(78% 0.17 150); animation: blink 2.4s infinite; }
.nav { display: flex; flex-direction: column; gap: 2px; padding: 6px 8px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  cursor: pointer; font-size: 13px; font-weight: 500; color: var(--muted);
  border: 1px solid transparent; transition: background .12s;
}
.nav-item:hover { background: #1a2029; }
.nav-item .chip {
  width: 22px; height: 22px; border-radius: 6px; background: #1a2029; color: #6b7385;
  display: flex; align-items: center; justify-content: center; font-size: 11px;
  font-family: 'IBM Plex Mono', monospace;
}
.nav-item .label { flex: 1; }
.nav-item .badge { font-size: 10.5px; font-family: 'IBM Plex Mono', monospace; background: #262d3a; color: var(--muted-2); border-radius: 9px; padding: 1px 7px; font-weight: 600; }
.nav-item.active { color: var(--text); }
.nav-item.active.h210 { background: linear-gradient(90deg, oklch(26% 0.06 210 / 0.55), transparent); border-color: oklch(40% 0.08 210 / 0.5); }
.nav-item.active.h210 .chip { background: oklch(30% 0.07 210 / 0.7); color: oklch(80% 0.13 210); }
.nav-item.active.h150 { background: linear-gradient(90deg, oklch(26% 0.06 150 / 0.55), transparent); border-color: oklch(40% 0.08 150 / 0.5); }
.nav-item.active.h150 .chip { background: oklch(30% 0.07 150 / 0.7); color: oklch(80% 0.13 150); }
.nav-item.active.h250 { background: linear-gradient(90deg, oklch(26% 0.06 250 / 0.55), transparent); border-color: oklch(40% 0.08 250 / 0.5); }
.nav-item.active.h250 .chip { background: oklch(30% 0.07 250 / 0.7); color: oklch(80% 0.13 250); }

.sidebar-foot { border-top: 1px solid var(--border-soft); padding: 12px 16px; display: flex; align-items: center; gap: 10px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg, oklch(60% 0.16 300), oklch(55% 0.15 250)); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; color: var(--text); }
.sidebar-foot .who { font-size: 12.5px; font-weight: 500; }
.sidebar-foot .logout { font-size: 11px; color: var(--muted); cursor: pointer; }
.sidebar-foot .logout:hover { color: var(--accent); }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 54px; flex-shrink: 0; border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: center; gap: 14px; padding: 0 20px;
  background: rgba(15,18,24,0.7); backdrop-filter: blur(8px);
}
.topbar .page-title { font-size: 15px; font-weight: 600; }
.badge-online { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 9px; background: oklch(28% 0.07 150 / 0.8); color: oklch(80% 0.16 150); display: flex; align-items: center; gap: 6px; }
.badge-online .dot { width: 6px; height: 6px; border-radius: 50%; background: oklch(78% 0.17 150); animation: blink 2.4s infinite; }
.spacer { flex: 1; }
.content { flex: 1; overflow: auto; padding: 20px; }

/* --- cards / stats --- */
.stats-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 16px; }
@media (max-width: 1100px) { .stats-grid { grid-template-columns: repeat(3, 1fr); } }
.stat {
  position: relative; overflow: hidden; background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 7px;
}
.stat .glow { position: absolute; inset: 0; pointer-events: none; }
.stat .row1 { display: flex; align-items: center; gap: 8px; position: relative; }
.stat .ico { width: 24px; height: 24px; border-radius: 7px; display: flex; align-items: center; justify-content: center; font-size: 12px; }
.stat .lbl { font-size: 12px; color: var(--muted); font-weight: 500; }
.stat .val { font-size: 25px; font-weight: 600; font-family: 'IBM Plex Mono', monospace; letter-spacing: -0.02em; position: relative; }

.card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; }
.card-pad { padding: 16px; }
.card-title { font-size: 13px; font-weight: 600; }

/* --- toolbar --- */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.select {
  background: var(--panel); border: 1px solid var(--border-input); border-radius: 8px;
  padding: 7px 10px; color: var(--muted-2); font-size: 12.5px; outline: none;
}
.toolbar .input { background: var(--panel); font-size: 12.5px; padding: 7px 12px; }

/* --- table --- */
.tbl-wrap { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.tbl-head-title { padding: 13px 16px; font-size: 13px; font-weight: 600; border-bottom: 1px solid var(--border); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.tbl th {
  text-align: left; padding: 10px 14px; color: var(--dim); font-weight: 600;
  border-bottom: 1px solid var(--border); font-size: 12px; white-space: nowrap;
}
table.tbl th.r, table.tbl td.r { text-align: right; }
table.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--row-line); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tr.clickable:hover td { background: #151922; cursor: pointer; }
.svc-ico { width: 28px; height: 28px; border-radius: 7px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 700; color: var(--bg); }
.acc-name { display: flex; align-items: center; gap: 11px; }
.acc-name .sub { font-size: 11px; color: var(--dim); font-family: 'IBM Plex Mono', monospace; }
.json-preview { font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--muted); max-width: 320px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.badge { font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 9px; display: inline-flex; align-items: center; gap: 5px; }
.badge .d { width: 5px; height: 5px; border-radius: 50%; }
.st-active { background: var(--green-bg); color: var(--green-fg); }
.st-cooling { background: var(--amber-bg); color: var(--amber-fg); }
.st-locked { background: var(--blue-bg); color: var(--blue-fg); }
.st-dead { background: var(--red-bg); color: var(--red-fg); }
.st-disabled { background: #262d3a; color: var(--muted-2); }
.scope-full { background: var(--violet-bg); color: var(--violet-fg); }
.scope-write { background: var(--blue-bg); color: var(--blue-fg); }
.scope-read { background: var(--green-bg); color: var(--green-fg); }

.usage-bar { height: 4px; border-radius: 2px; background: var(--border-soft); overflow: hidden; width: 110px; margin-top: 4px; }
.usage-bar > div { height: 100%; border-radius: 2px; background: var(--grad-90); }

.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.icon-btn { background: transparent; border: 1px solid var(--border-input); border-radius: 6px; color: var(--muted-2); cursor: pointer; font-size: 11px; padding: 4px 8px; }
.icon-btn:hover { border-color: #3a4152; color: var(--text); }
.icon-btn.danger:hover { border-color: var(--red-fg); color: var(--red-fg); }

.pagination { display: flex; align-items: center; gap: 12px; justify-content: flex-end; padding: 12px 4px 0; font-size: 12px; color: var(--muted); }

.empty { padding: 40px; text-align: center; color: var(--dim); font-size: 13px; }

/* --- modal --- */
.overlay { position: fixed; inset: 0; background: rgba(6,8,12,0.66); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal { width: 560px; max-width: calc(100vw - 40px); max-height: calc(100vh - 60px); overflow: auto; background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 22px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 30px 70px rgba(0,0,0,0.55); }
.modal .m-title { font-size: 14px; font-weight: 600; }
.modal .m-foot { display: flex; gap: 8px; justify-content: flex-end; border-top: 1px solid var(--border-soft); padding-top: 14px; }
.code-box { background: var(--panel-2); border: 1px solid var(--border-input); border-radius: 8px; padding: 12px; font-family: 'IBM Plex Mono', monospace; font-size: 12.5px; color: var(--accent); word-break: break-all; }
.mono-input { font-family: 'IBM Plex Mono', monospace; }

/* --- toast --- */
.toast-wrap { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--panel); border: 1px solid var(--border); border-left-width: 3px; border-radius: 8px; padding: 10px 14px; font-size: 12.5px; box-shadow: 0 12px 30px rgba(0,0,0,0.5); max-width: 340px; }
.toast.ok { border-left-color: var(--green-fg); }
.toast.err { border-left-color: var(--red-fg); }
.toast.info { border-left-color: var(--accent); }

.loading { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--border-input); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
.center-load { display: flex; align-items: center; justify-content: center; padding: 40px; }
