:root {
  --bg: #07080c;
  --bg-2: #0b0c11;
  --panel: #0f1016;
  --panel-2: #14161e;
  --line: rgba(255, 255, 255, .07);
  --line-2: rgba(255, 255, 255, .12);
  --text: #eef1f6;
  --muted: #8890a0;
  --red: #f5162f;
  --red-soft: rgba(245, 22, 47, .14);
  --amber: #f5a524;
  --amber-soft: rgba(245, 165, 36, .14);
  --green: #23d99a;
  --green-soft: rgba(35, 217, 154, .13);
  --blue: #4c9dff;
  --blue-soft: rgba(76, 157, 255, .14);
  --violet: #a78bfa;
  --violet-soft: rgba(167, 139, 250, .14);
  --radius: 12px;
  --mono: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text);
  font: 14px/1.45 Inter, "Segoe UI Variable", "Segoe UI", system-ui, Arial, sans-serif; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: .01em; }
h2 { font-size: 15px; margin-bottom: 12px; }
h3 { font-size: 13px; margin: 16px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
p { margin: 6px 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); font-size: 12px; }
.code { font-family: var(--mono); font-size: 12px; font-weight: 600; letter-spacing: .02em; }
.wrap { word-break: break-all; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

/* boot */
#app.booting { display: grid; place-items: center; min-height: 100vh; }
.boot img { opacity: .8; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }

/* layout */
#app:not(.booting) { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px; padding: 18px 12px;
  background: linear-gradient(180deg, #0a0b10, #08090d); border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; text-decoration: none; font-size: 18px; letter-spacing: .14em; }
.brand strong { font-weight: 900; }
.brand img { filter: drop-shadow(0 0 10px rgba(245, 22, 47, .3)); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; text-decoration: none; color: #c3c9d4; }
.nav-item:hover { background: rgba(255, 255, 255, .04); color: var(--text); }
.nav-item.active { background: var(--red-soft); color: #fff; box-shadow: inset 2px 0 0 var(--red); }
.nav-icon { width: 18px; text-align: center; opacity: .8; }
.nav-label { flex: 1; }
.nav-badge { min-width: 20px; padding: 1px 6px; border-radius: 10px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; text-align: center; }
.sidebar-foot { margin-top: auto; padding: 8px; font-size: 11px; }

.content { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 14px; padding: 14px 24px;
  background: rgba(7, 8, 12, .86); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.page-title { font-size: 18px; flex: 1; }
.topbar-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.main { padding: 22px 24px 48px; display: flex; flex-direction: column; gap: 16px; outline: none; }
.menu-btn { display: none; }

/* pills */
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, .03); font-size: 12px; color: #c9cfd9; white-space: nowrap; }
button.pill { cursor: pointer; }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.pill.ok .dot { background: var(--green); box-shadow: 0 0 10px rgba(35, 217, 154, .6); }
.pill.warn .dot { background: var(--amber); }
.pill.bad .dot { background: var(--red); }
.pill.live.ok .dot { background: var(--green); }
.pill.mode.shadow-mode { border-color: rgba(245, 165, 36, .45); background: var(--amber-soft); color: #ffd28a; font-weight: 700; letter-spacing: .04em; }
.pill.mode.live-mode { border-color: rgba(245, 22, 47, .6); background: var(--red-soft); color: #ff8b98; font-weight: 700; letter-spacing: .04em; }
.user-chip { display: flex; align-items: center; gap: 8px; padding-left: 8px; border-left: 1px solid var(--line); }
.user-name { display: flex; flex-direction: column; text-decoration: none; font-weight: 600; line-height: 1.15; }
.user-name small { color: var(--muted); font-weight: 400; font-size: 11px; }

/* cards & grids */
.card { background: linear-gradient(180deg, var(--panel), var(--bg-2)); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; min-width: 0; }
.card + .card { margin-top: 0; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); align-items: start; }
.grid.two > div { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.narrow { max-width: 520px; }

.stat { text-decoration: none; display: block; transition: border-color .15s; }
a.stat:hover { border-color: rgba(245, 22, 47, .45); }
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.stat-value { font-size: 28px; font-weight: 800; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.stat-hint { font-size: 12px; color: var(--muted); }

.mode-card { display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.mode-card.shadow { border-color: rgba(245, 165, 36, .35); }
.mode-card.live { border-color: rgba(245, 22, 47, .45); }
.mode-name { font-size: 26px; font-weight: 900; letter-spacing: .12em; margin: 4px 0; }
.mode-card.shadow .mode-name { color: var(--amber); }
.mode-card.live .mode-name { color: var(--red); }

.profile-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.profile-head h2 { font-size: 18px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* tables */
.table-wrap { overflow-x: auto; }
.table-wrap.tall { max-height: 520px; overflow-y: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600;
  padding: 8px 10px; border-bottom: 1px solid var(--line-2); position: sticky; top: 0; background: var(--panel); }
.table td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table.compact td { padding: 6px 8px; }
.table tbody tr:last-child td { border-bottom: 0; }
.row-link { cursor: pointer; }
.row-link:hover td { background: rgba(255, 255, 255, .025); }
.disabled-row td { opacity: .5; }
.actions { white-space: nowrap; text-align: right; }
.policy .desc { max-width: 520px; margin-top: 2px; }

/* badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; letter-spacing: .02em;
  background: rgba(255, 255, 255, .06); color: #c7cdd8; border: 1px solid transparent; margin: 1px 4px 1px 0; white-space: nowrap; }
.badge.ok { background: var(--green-soft); color: #7ff0c6; }
.action-log { background: rgba(255, 255, 255, .06); color: #aab1bd; }
.action-review { background: var(--blue-soft); color: #9cc8ff; }
.action-kick { background: var(--amber-soft); color: #ffd28a; }
.action-ban { background: var(--red-soft); color: #ff8b98; }
.badge.would { background: transparent; border: 1px dashed currentColor; }
.ev-server { background: var(--violet-soft); color: #cbbaff; }
.ev-client { background: rgba(255, 255, 255, .05); color: #9aa2b1; }
.status-open { background: var(--blue-soft); color: #9cc8ff; }
.status-confirmed { background: var(--red-soft); color: #ff8b98; }
.status-dismissed { background: rgba(255, 255, 255, .05); color: #8a91a0; }
.sev { font-family: var(--mono); font-size: 10px; padding: 1px 6px; border-radius: 5px; letter-spacing: .04em; }
.sev-critical { background: var(--red-soft); color: #ff8b98; }
.sev-high { background: var(--amber-soft); color: #ffd28a; }
.sev-medium { background: var(--blue-soft); color: #9cc8ff; }
.sev-low, .sev-info { background: rgba(255, 255, 255, .06); color: #aab1bd; }
.score { font-family: var(--mono); font-weight: 700; }
.score.warm { color: var(--amber); }
.score.hot { color: var(--red); }

/* buttons & forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: 9px; border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, .04); cursor: pointer; font-weight: 600; text-decoration: none; white-space: nowrap; }
.btn:hover:not(:disabled) { background: rgba(255, 255, 255, .08); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: #e8ecf2; color: #0b0c11; border-color: #e8ecf2; }
.btn.primary:hover:not(:disabled) { background: #fff; }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.danger:hover:not(:disabled) { background: #ff2a42; }
.btn.warn { border-color: rgba(245, 165, 36, .5); color: #ffd28a; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn-row { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.icon-btn { border: 0; background: transparent; cursor: pointer; font-size: 18px; line-height: 1; padding: 4px 6px; color: var(--muted); }
.icon-btn:hover { color: var(--text); }

input, select, textarea { background: #0a0b10; border: 1px solid var(--line-2); border-radius: 9px; padding: 8px 10px; min-width: 0; }
input:focus, select:focus, textarea:focus { border-color: rgba(245, 22, 47, .6); outline: none; box-shadow: 0 0 0 3px var(--red-soft); }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--red); padding: 0; }
textarea { resize: vertical; width: 100%; }
.form { display: flex; flex-direction: column; gap: 12px; }
.form label, .label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); font-weight: 600; }
.form label input, .form label select, .form label textarea { color: var(--text); font-weight: 400; font-size: 14px; }
.form label.check, label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-weight: 400; font-size: 13px; }
.form-error { color: #ff8b98; margin: 0; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.filters input[type="search"] { min-width: 220px; }
.card-head .filters { margin-bottom: 0; }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 12px; margin-top: 6px; }

.switch { position: relative; display: inline-block; width: 36px; height: 20px; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: #262833; transition: background .15s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #c9ced8; transition: transform .15s; }
.switch input:checked + span { background: var(--red); }
.switch input:checked + span::after { transform: translateX(16px); background: #fff; }
.switch input:focus-visible + span { outline: 2px solid var(--red); outline-offset: 2px; }
.switch input:disabled + span { opacity: .5; cursor: not-allowed; }
select.act-ban { border-color: rgba(245, 22, 47, .6); }
select.act-kick { border-color: rgba(245, 165, 36, .6); }

.tabs { display: flex; gap: 4px; background: #0a0b10; padding: 4px; border-radius: 10px; border: 1px solid var(--line); max-width: 100%; overflow-x: auto; }
.tab { white-space: nowrap; border: 0; background: transparent; padding: 6px 12px; border-radius: 7px; cursor: pointer; color: var(--muted); font-weight: 600; }
.tab.active { background: var(--panel-2); color: var(--text); box-shadow: inset 0 -2px 0 var(--red); }
.bulk { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }

/* dashboard */
.chart { width: 100%; height: auto; }
.chart .bar { fill: var(--red); opacity: .85; }
.chart .bar:hover { opacity: 1; }
.chart .axis { stroke: var(--line-2); }
.chart .tick, .chart .bar-label { fill: var(--muted); font-size: 10px; text-anchor: middle; font-family: var(--mono); }
.chart .bar-label { fill: #d8dce4; }
.hbars { display: flex; flex-direction: column; gap: 8px; }
.hbar { display: grid; grid-template-columns: 140px 1fr 44px; align-items: center; gap: 10px; text-decoration: none; font-size: 12px; }
.hbar-label { font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; }
.hbar-track { position: relative; height: 10px; border-radius: 6px; background: rgba(255, 255, 255, .05); overflow: hidden; }
.hbar-fill { position: absolute; inset: 0 auto 0 0; background: rgba(245, 22, 47, .55); border-radius: 6px; }
.hbar-server { position: absolute; inset: 0 auto 0 0; background: var(--violet); border-radius: 6px; opacity: .9; }
.hbar-n { text-align: right; font-family: var(--mono); color: var(--muted); }
.hbar:hover .hbar-label { color: #fff; }
.legend { display: flex; align-items: center; gap: 6px; margin-top: 12px; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.swatch.fill { background: rgba(245, 22, 47, .55); }
.swatch.server { background: var(--violet); margin-left: 8px; }
.feed { display: flex; flex-direction: column; gap: 6px; max-height: 360px; overflow-y: auto; }
.feed-item { display: flex; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 9px; background: rgba(255, 255, 255, .025);
  border-left: 3px solid var(--line-2); text-decoration: none; font-size: 13px; animation: slide .25s ease-out; }
.feed-meta { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.sev-edge-critical { border-left-color: var(--red); }
.sev-edge-high { border-left-color: var(--amber); }
.sev-edge-medium { border-left-color: var(--blue); }
.feed-join { border-left-color: var(--green); }
.feed-ban, .feed-evasion, .feed-denied { border-left-color: var(--red); }
@keyframes slide { from { transform: translateY(-4px); opacity: 0; } }

/* profile */
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.shot { display: flex; flex-direction: column; gap: 4px; text-decoration: none; }
.shot img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; border: 1px solid var(--line-2); background: #000; }
.notes { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.notes li { padding: 10px 12px; border-radius: 9px; background: rgba(255, 255, 255, .03); }
.note-body { white-space: pre-wrap; margin-top: 2px; }
.note-form { display: flex; gap: 8px; align-items: flex-end; }
.json { margin: 0; padding: 12px; border-radius: 9px; background: #06070a; border: 1px solid var(--line); font-family: var(--mono); font-size: 12px;
  overflow: auto; max-height: 420px; white-space: pre-wrap; word-break: break-word; }
.dl { display: grid; grid-template-columns: 120px 1fr; gap: 8px 14px; margin: 0; }
.dl dt { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.dl dd { margin: 0; }
.dl.roles { margin-top: 18px; }
.bullets { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; color: #c9cfd9; }

.empty { padding: 26px 12px; text-align: center; color: var(--muted); }
.empty.error { color: #ff8b98; }
.loading { display: flex; gap: 6px; justify-content: center; padding: 40px; }
.loading span { width: 8px; height: 8px; border-radius: 50%; background: var(--red); animation: pulse 1s infinite; }
.loading span:nth-child(2) { animation-delay: .15s; }
.loading span:nth-child(3) { animation-delay: .3s; }

/* auth */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(600px 400px at 70% 20%, rgba(245, 22, 47, .1), transparent 70%), var(--bg); grid-column: 1 / -1; }
.auth-card { width: min(400px, 100%); padding: 28px; border-radius: 16px; border: 1px solid rgba(245, 22, 47, .4);
  background: linear-gradient(180deg, #101118, #0a0b10); box-shadow: 0 24px 80px rgba(0, 0, 0, .5); }
.auth-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.auth-title { font-size: 22px; letter-spacing: .16em; }
.auth-title strong { font-weight: 900; }
.auth-foot { margin-top: 18px; font-size: 12px; text-align: center; }
#app:has(.auth-wrap) { display: block; }

/* modal & toast */
.overlay { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .6); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 16px; }
.modal { width: min(480px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: 0 30px 80px rgba(0, 0, 0, .6); }
.modal.wide { width: min(760px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; text-transform: none; letter-spacing: 0; font-size: 15px; color: var(--text); }
.modal-body { padding: 16px 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); }
#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.toast { padding: 10px 14px; border-radius: 10px; background: #1a1c25; border: 1px solid var(--line-2); box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
  border-left: 3px solid var(--green); transition: opacity .4s, transform .4s; }
.toast-warn { border-left-color: var(--amber); }
.toast-error { border-left-color: var(--red); }
.toast.out { opacity: 0; transform: translateY(6px); }

/* responsive */
@media (max-width: 900px) {
  #app:not(.booting) { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 40; width: 250px; transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .sidebar { transform: none; box-shadow: 20px 0 60px rgba(0, 0, 0, .6); }
  .menu-btn { display: inline-block; }
  .topbar { padding: 10px 16px; flex-wrap: wrap; }
  .topbar-tools { width: 100%; justify-content: flex-start; }
  .user-chip { margin-left: auto; }
  .main { padding: 16px 16px 40px; }
  .grid.two { grid-template-columns: 1fr; }
  .hbar { grid-template-columns: 110px 1fr 36px; }
  .filters input[type="search"] { min-width: 0; flex: 1 1 100%; }
  .note-form { flex-direction: column; align-items: stretch; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---- Hydra Hub additions ---- */
.server-select { padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--panel-2); font-size: 12px; max-width: 220px; }
.server-tag { display: inline-block; padding: 1px 7px; border-radius: 6px; background: var(--blue-soft); color: #a9cdff; font-size: 11px; font-weight: 600; white-space: nowrap; }
.scope-global { background: var(--violet-soft); color: #cdbdff; }
.server-cards { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.server-card { display: flex; flex-direction: column; gap: 6px; text-decoration: none; cursor: pointer; }
.server-card.selected { border-color: rgba(245, 22, 47, .55); }
.server-card .server-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.server-card .server-card-head strong { font-size: 15px; }
.key-box { display: flex; gap: 8px; align-items: center; }
.key-box input { flex: 1; font-family: var(--mono); font-size: 12px; }
.warn-text { color: var(--amber); }
.hint-card { border-style: dashed; }
