/* FZ Admin Panel — warm dark theme */
:root {
  --bg: #0a0705;
  --surface: #17100b;
  --surface-2: #1f160f;
  --surface-3: #2a1d14;
  --line: rgba(255, 170, 110, .09);
  --line-2: rgba(255, 170, 110, .17);
  --text: #f7efe8;
  --text-2: #c4b3a5;
  --muted: #8d796b;
  --accent: #ff7a1a;
  --accent-2: #ffa458;
  --accent-ink: #1a0d04;
  --accent-soft: rgba(255, 122, 26, .14);
  --good: #3ec28f;
  --good-soft: rgba(62, 194, 143, .14);
  --warn: #f5b041;
  --warn-soft: rgba(245, 176, 65, .14);
  --bad: #f2545b;
  --bad-soft: rgba(242, 84, 91, .14);
  --info: #6f9bff;
  --info-soft: rgba(111, 155, 255, .14);
  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 24px 60px rgba(0, 0, 0, .5);
  /* Vazirmatn only loads when a player name contains Arabic/Kurdish letters */
  --font: 'Plus Jakarta Sans', 'Vazirmatn', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --sidebar: 252px;
  --tabbar: 68px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    radial-gradient(900px 500px at 12% -10%, rgba(255, 110, 20, .16), transparent 60%),
    radial-gradient(700px 500px at 100% 0%, rgba(255, 150, 60, .07), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--accent-2); text-decoration: none; }
::selection { background: rgba(255, 122, 26, .35); }
.hidden { display: none !important; }
.ic { width: 18px; height: 18px; flex: none; }
.num, .ltr { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12.5px; direction: ltr; unicode-bidi: isolate; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.small { font-size: 12.5px; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; }
.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
[dir="rtl"] .ic.flip { transform: scaleX(-1); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- boot / login ---------- */
.boot { min-height: 100vh; display: grid; place-items: center; }
.loader { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--surface-3); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(420px, 100%); padding: 34px 28px 28px; border-radius: 28px; background: linear-gradient(180deg, rgba(36, 24, 16, .92), rgba(20, 13, 9, .92)); border: 1px solid var(--line-2); box-shadow: var(--shadow), 0 0 120px rgba(255, 110, 20, .08); }
.login-card h1 { margin: 18px 0 4px; font-size: 26px; }
.login-card p { margin: 0 0 22px; color: var(--text-2); }
.login-foot { margin-top: 18px; display: flex; justify-content: center; }

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; font-weight: 800; font-size: 16px; letter-spacing: .5px; color: var(--accent-ink); background: linear-gradient(135deg, #ffb062, #ff6a00); box-shadow: 0 8px 26px rgba(255, 110, 20, .45); direction: ltr; }
.brand-name { font-weight: 800; font-size: 17px; line-height: 1.2; }
.brand-sub { font-size: 12px; color: var(--muted); }

/* ---------- layout ---------- */
.app { min-height: 100vh; }
.sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: var(--sidebar); padding: 22px 16px; display: flex; flex-direction: column; gap: 22px; background: linear-gradient(180deg, rgba(26, 17, 11, .9), rgba(14, 9, 6, .95)); border-inline-end: 1px solid var(--line); z-index: 20; }
.nav { display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.nav-item { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 14px; color: var(--text-2); cursor: pointer; border: 0; background: none; text-align: start; width: 100%; transition: background .15s, color .15s; }
.nav-item:hover { background: rgba(255, 255, 255, .03); color: var(--text); }
.nav-item.active { color: var(--accent-ink); background: linear-gradient(135deg, #ffab5c, #ff7a1a); font-weight: 700; box-shadow: 0 8px 22px rgba(255, 110, 20, .3); }
.nav-item .count { margin-inline-start: auto; font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); }
.nav-item.active .count { background: rgba(0, 0, 0, .18); color: var(--accent-ink); }
.side-user { margin-top: auto; padding: 12px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }

.main { margin-inline-start: var(--sidebar); min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 15; display: flex; align-items: center; gap: 14px; padding: 16px 28px; background: rgba(10, 7, 5, .72); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.topbar h1 { margin: 0; font-size: 20px; font-weight: 800; }
.topbar .brand { display: none; }
.page { padding: 24px 28px 40px; width: 100%; max-width: 1480px; margin: 0 auto; }

.tabbar { display: none; }

.conn { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; color: var(--text-2); white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.on { background: var(--good); box-shadow: 0 0 0 4px rgba(62, 194, 143, .15); animation: pulse 2s infinite; }
.dot.off { background: var(--bad); box-shadow: 0 0 0 4px rgba(242, 84, 91, .15); }
.dot.wait { background: var(--warn); }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(62, 194, 143, .05); } }

/* ---------- cards ---------- */
.card { position: relative; background: linear-gradient(180deg, rgba(34, 23, 15, .88), rgba(21, 14, 10, .9)); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); min-width: 0; }
.card.glow::before { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: radial-gradient(400px 160px at 15% 0%, rgba(255, 122, 26, .12), transparent 70%); }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.card-head h2, .card-head h3 { margin: 0; font-size: 16px; font-weight: 700; }
.card-head .sub { font-size: 12.5px; color: var(--muted); }
.card-head .tools { margin-inline-start: auto; display: flex; gap: 8px; align-items: center; }
.icon-pill { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-2); flex: none; }

.grid { display: grid; gap: 18px; }
.g-kpi { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-dash { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-cards { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.span-2 { grid-column: span 2; }

.hero { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.hero h2 { margin: 0; font-size: 30px; line-height: 1.25; font-weight: 800; }
.hero .meta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; color: var(--text-2); font-size: 13.5px; }
.hero .actions { margin-inline-start: auto; display: flex; gap: 10px; flex-wrap: wrap; }

.kpi { display: flex; flex-direction: column; gap: 10px; }
.kpi-top { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 13.5px; }
.kpi-value { font-size: 34px; font-weight: 800; line-height: 1.1; letter-spacing: -.5px; }
.kpi-value small { font-size: 16px; color: var(--muted); font-weight: 600; letter-spacing: 0; }
.kpi-foot { font-size: 12.5px; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.meter { height: 8px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #ff6a00, #ffb062); box-shadow: 0 0 14px rgba(255, 122, 26, .6); transition: width .5s; }
.meter.good > i { background: var(--good); box-shadow: none; }
.meter.warn > i { background: var(--warn); box-shadow: none; }
.meter.bad > i { background: var(--bad); box-shadow: none; }
.meter.info > i { background: var(--info); box-shadow: none; }
.meter.thin { height: 5px; }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text); cursor: pointer; font-weight: 600; font-size: 14px; white-space: nowrap; transition: transform .08s, background .15s, border-color .15s, opacity .15s; }
.btn:hover { background: var(--surface-3); border-color: rgba(255, 170, 110, .28); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.primary { border: 0; color: var(--accent-ink); background: linear-gradient(135deg, #ffb062, #ff7a1a); box-shadow: 0 8px 22px rgba(255, 110, 20, .3); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { border-color: rgba(242, 84, 91, .35); background: var(--bad-soft); color: #ff9da1; }
.btn.danger:hover { background: rgba(242, 84, 91, .22); }
.btn.good { border-color: rgba(62, 194, 143, .35); background: var(--good-soft); color: #7fe0bb; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: rgba(255, 255, 255, .04); color: var(--text); }
.btn.sm { min-height: 32px; padding: 4px 12px; font-size: 13px; }
.btn.icon { width: 40px; padding: 0; }
.btn.icon.sm { width: 32px; }
.btn.block { width: 100%; }
.btn .ic { width: 17px; height: 17px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 13px; color: var(--text-2); font-weight: 600; }
.field .hint { font-size: 12px; color: var(--muted); }
.input, .textarea, .select { width: 100%; min-height: 44px; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--line-2); background: rgba(8, 5, 3, .55); color: var(--text); outline: none; transition: border-color .15s, box-shadow .15s; }
.textarea { min-height: 90px; resize: vertical; line-height: 1.6; }
.input:focus, .textarea:focus, .select:focus { border-color: rgba(255, 122, 26, .6); box-shadow: 0 0 0 4px rgba(255, 122, 26, .12); }
.input::placeholder, .textarea::placeholder { color: #6d5d52; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .ic { position: absolute; inset-inline-start: 14px; color: var(--muted); pointer-events: none; }
.input-wrap .input { padding-inline-start: 42px; }
.form-error { color: #ff9da1; font-size: 13px; min-height: 18px; }

.seg { display: inline-flex; padding: 4px; gap: 4px; border-radius: 999px; background: rgba(8, 5, 3, .55); border: 1px solid var(--line); flex-wrap: wrap; }
.seg button { border: 0; background: none; color: var(--text-2); padding: 6px 14px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 13px; display: inline-flex; gap: 6px; align-items: center; }
.seg button.active { background: var(--surface-3); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.seg button .count { font-size: 11.5px; color: var(--muted); }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 13px; border-radius: 999px; border: 1px solid var(--line-2); background: transparent; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-2); }
.chip.active { border-color: transparent; background: var(--accent); color: var(--accent-ink); }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; line-height: 1.7; white-space: nowrap; background: var(--surface-3); color: var(--text-2); }
.badge .ic { width: 13px; height: 13px; }
.badge.good { background: var(--good-soft); color: #7fe0bb; }
.badge.warn { background: var(--warn-soft); color: #ffd18a; }
.badge.bad { background: var(--bad-soft); color: #ff9da1; }
.badge.accent { background: var(--accent-soft); color: var(--accent-2); }
.badge.info { background: var(--info-soft); color: #a9c2ff; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { width: 40px; height: 23px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--line-2); position: relative; transition: background .15s; flex: none; }
.switch .track::after { content: ''; position: absolute; top: 2px; inset-inline-start: 2px; width: 17px; height: 17px; border-radius: 50%; background: #8d796b; transition: transform .18s, background .18s; }
.switch input:checked + .track { background: var(--accent); border-color: transparent; }
.switch input:checked + .track::after { background: #fff; transform: translateX(17px); }
[dir="rtl"] .switch input:checked + .track::after { transform: translateX(-17px); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 4px rgba(255, 122, 26, .2); }

/* ---------- avatar & lists ---------- */
.avatar { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 15px; color: #1a0d04; flex: none; position: relative; text-transform: uppercase; }
.avatar.sm { width: 34px; height: 34px; font-size: 13px; }
.avatar.lg { width: 60px; height: 60px; font-size: 22px; }
.avatar .st { position: absolute; bottom: 0; inset-inline-end: 0; width: 12px; height: 12px; border-radius: 50%; border: 2px solid #1a120d; background: var(--good); }

.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line); min-width: 0; }
.list-row:last-child { border-bottom: 0; }
.list-row.click { cursor: pointer; border-radius: 14px; padding-inline: 10px; margin-inline: -6px; }
.list-row.click:hover { background: rgba(255, 255, 255, .03); }
.list-row .title { font-weight: 700; }
.list-row .sub { font-size: 12.5px; color: var(--muted); }

.empty { padding: 34px 16px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty .ic { width: 34px; height: 34px; color: #5d4a3d; }
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 16px; background: var(--warn-soft); border: 1px solid rgba(245, 176, 65, .25); color: #ffd9a0; font-size: 14px; }
.notice.bad { background: var(--bad-soft); border-color: rgba(242, 84, 91, .25); color: #ffb3b6; }
.notice.info { background: var(--info-soft); border-color: rgba(111, 155, 255, .25); color: #c8d7ff; }
.notice .ic { margin-top: 2px; }

/* ---------- players ---------- */
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar .input-wrap { flex: 1; min-width: 220px; }
.pcard { display: flex; flex-direction: column; gap: 12px; cursor: pointer; transition: transform .12s, border-color .15s; }
.pcard:hover { border-color: rgba(255, 140, 60, .28); transform: translateY(-2px); }
.pcard .head { display: flex; gap: 12px; align-items: center; min-width: 0; }
.pcard .name { font-weight: 800; font-size: 15.5px; }
.pcard .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pstat { background: rgba(8, 5, 3, .45); border: 1px solid var(--line); border-radius: 12px; padding: 7px 10px; display: flex; flex-direction: column; gap: 4px; }
.pstat .k { font-size: 11px; color: var(--muted); }
.pstat .v { font-weight: 700; font-size: 13.5px; }
.idchip { display: inline-flex; padding: 2px 9px; border-radius: 8px; background: var(--surface-3); color: var(--text-2); font-size: 12px; font-weight: 700; }

.ping-good { color: #7fe0bb; } .ping-mid { color: #ffd18a; } .ping-bad { color: #ff9da1; }

/* ---------- player sheet ---------- */
.psheet-head { display: flex; gap: 14px; align-items: center; margin-bottom: 16px; }
.psheet-head h2 { margin: 0; font-size: 21px; }
.pmeta { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
.actions-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.act { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 12px 6px; border-radius: 16px; border: 1px solid var(--line-2); background: var(--surface-2); cursor: pointer; font-weight: 700; font-size: 12.5px; color: var(--text); transition: background .15s, border-color .15s, transform .08s; }
.act:hover { background: var(--surface-3); }
.act:active { transform: scale(.96); }
.act .ic { width: 21px; height: 21px; color: var(--accent-2); }
.act.danger .ic { color: #ff8b90; }
.act.selected { border-color: var(--accent); background: var(--accent-soft); }
.subform { margin-top: 14px; padding: 16px; border-radius: 18px; background: rgba(8, 5, 3, .5); border: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 12px; }
.ids { display: flex; flex-direction: column; gap: 6px; }
.idrow { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 10px; background: rgba(8, 5, 3, .45); border: 1px solid var(--line); cursor: pointer; }
.idrow:hover { border-color: var(--line-2); }
.idrow .k { font-size: 11.5px; font-weight: 800; color: var(--accent-2); min-width: 58px; text-transform: uppercase; direction: ltr; }
.idrow .v { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
details.box { border: 1px solid var(--line); border-radius: 16px; padding: 4px 14px; background: rgba(8, 5, 3, .3); }
details.box > summary { cursor: pointer; padding: 10px 0; font-weight: 700; list-style: none; display: flex; align-items: center; gap: 8px; }
details.box > summary::-webkit-details-marker { display: none; }
details.box > summary .ic { transition: transform .15s; }
details.box[open] > summary .ic.chev { transform: rotate(90deg); }
[dir="rtl"] details.box > summary .ic.chev { transform: scaleX(-1); }
[dir="rtl"] details.box[open] > summary .ic.chev { transform: rotate(90deg); }
details.box .inner { padding-bottom: 12px; }

/* ---------- charts ---------- */
.chart { position: relative; }
.bars { position: relative; height: 210px; display: flex; align-items: flex-end; gap: 4px; padding-top: 10px; direction: ltr; }
.bars .grid-line { position: absolute; left: 0; right: 0; z-index: 2; border-top: 1px dashed rgba(255, 170, 110, .1); pointer-events: none; }
.bars .grid-line span { position: absolute; top: -9px; right: 0; font-size: 10.5px; color: var(--muted); background: var(--surface); padding: 0 4px; border-radius: 4px; }
.bar { flex: 1; height: 100%; display: flex; align-items: flex-end; position: relative; cursor: default; min-width: 0; }
.bar i { display: block; width: 100%; border-radius: 4px 4px 0 0; background: linear-gradient(180deg, #ffad5e 0%, rgba(255, 122, 26, .55) 40%, rgba(255, 122, 26, .12) 100%); transition: height .5s; position: relative; }
.bar i::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; border-radius: 4px 4px 0 0; background: #ffd2a6; box-shadow: 0 0 12px rgba(255, 150, 70, .9); }
.bar.now i { background: linear-gradient(180deg, #ffd0a0 0%, #ff8a2e 45%, rgba(255, 122, 26, .25) 100%); }
.bar.empty i { background: repeating-linear-gradient(45deg, rgba(255, 170, 110, .06) 0 3px, transparent 3px 6px); }
.bar.empty i::before { display: none; }
.bar:hover i { filter: brightness(1.2); }
.bars-x { display: flex; gap: 4px; margin-top: 8px; direction: ltr; }
.bars-x span { flex: 1; text-align: center; font-size: 10.5px; color: var(--muted); min-width: 0; }

.heat { display: grid; gap: 4px; direction: ltr; }
.heat-row { display: grid; grid-template-columns: 44px repeat(24, minmax(0, 1fr)); gap: 4px; align-items: center; }
.heat-row .lbl { font-size: 11px; color: var(--muted); text-align: right; padding-right: 6px; }
.cell { aspect-ratio: 1; border-radius: 5px; background: rgba(255, 170, 110, .05); }
.cell.l1 { background: rgba(255, 122, 26, .2); }
.cell.l2 { background: rgba(255, 122, 26, .4); }
.cell.l3 { background: rgba(255, 122, 26, .65); }
.cell.l4 { background: #ff8a2e; box-shadow: 0 0 10px rgba(255, 122, 26, .5); }
.cell:hover { outline: 2px solid #ffd2a6; outline-offset: 1px; }
.heat-legend { display: flex; gap: 6px; align-items: center; font-size: 11.5px; color: var(--muted); margin-top: 12px; justify-content: flex-end; }
.heat-legend .cell { width: 14px; height: 14px; aspect-ratio: auto; }

.tooltip { position: fixed; z-index: 200; pointer-events: none; padding: 8px 12px; border-radius: 12px; background: #2d1f15; border: 1px solid var(--line-2); box-shadow: var(--shadow); font-size: 12.5px; line-height: 1.5; transform: translate(-50%, calc(-100% - 10px)); white-space: nowrap; }
.tooltip b { font-size: 15px; }

/* ---------- feed / logs ---------- */
.feed { display: flex; flex-direction: column; }
.ev { display: flex; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--line); align-items: flex-start; }
.ev:last-child { border-bottom: 0; }
.ev-ic { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex: none; background: var(--surface-3); color: var(--text-2); }
.ev-ic .ic { width: 16px; height: 16px; }
.ev-ic.good { background: var(--good-soft); color: #7fe0bb; }
.ev-ic.bad { background: var(--bad-soft); color: #ff9da1; }
.ev-ic.warn { background: var(--warn-soft); color: #ffd18a; }
.ev-ic.accent { background: var(--accent-soft); color: var(--accent-2); }
.ev-ic.info { background: var(--info-soft); color: #a9c2ff; }
.ev-body { flex: 1; min-width: 0; }
.ev-text { font-size: 14px; word-break: break-word; }
.ev-sub { font-size: 12px; color: var(--muted); margin-top: 2px; word-break: break-word; }
.ev-time { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.scroll { max-height: 460px; overflow-y: auto; margin-inline: -4px; padding-inline: 4px; }
.scroll::-webkit-scrollbar, .terminal::-webkit-scrollbar { width: 8px; }
.scroll::-webkit-scrollbar-thumb, .terminal::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 8px; }

/* ---------- console ---------- */
.terminal { height: min(62vh, 640px); overflow-y: auto; padding: 14px 16px; border-radius: 18px; background: #070504; border: 1px solid var(--line); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12.5px; line-height: 1.6; direction: ltr; text-align: left; white-space: pre-wrap; word-break: break-word; color: #e9ddd2; }
.terminal .ln { min-height: 1em; }
.c1 { color: #ff6b6b; } .c2 { color: #69db7c; } .c3 { color: #ffd43b; } .c4 { color: #74c0fc; } .c5 { color: #66d9e8; }
.c6 { color: #da77f2; } .c7 { color: #e9ddd2; } .c8 { color: #ff922b; } .c9 { color: #adb5bd; } .c0 { color: #e9ddd2; }
.cmdbar { display: flex; gap: 10px; margin-top: 12px; }
.cmdbar .input { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; direction: ltr; text-align: left; }

/* ---------- table-ish rows ---------- */
.res-row { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.res-row:last-child { border-bottom: 0; }
.res-name { font-weight: 700; direction: ltr; text-align: start; unicode-bidi: isolate; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; font-size: 14px; }
.kv .k { color: var(--muted); }
.kv .v { font-weight: 600; text-align: end; min-width: 0; overflow-wrap: anywhere; }

.perm-group { margin-bottom: 14px; }
.perm-group h4 { margin: 0 0 8px; font-size: 13px; color: var(--accent-2); }
.perm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.perm { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(8, 5, 3, .4); cursor: pointer; font-size: 13.5px; }
.perm:hover { border-color: var(--line-2); }
.perm input { accent-color: var(--accent); width: 17px; height: 17px; flex: none; }
.perm.disabled { opacity: .45; cursor: not-allowed; }
.perm-chips { display: flex; gap: 6px; flex-wrap: wrap; }

.ucard { display: flex; flex-direction: column; gap: 12px; }
.ucard .head { display: flex; gap: 12px; align-items: center; }
.ucard .foot { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }

.secret { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; background: #070504; border: 1px dashed rgba(255, 140, 60, .4); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 15px; direction: ltr; }
.secret span { flex: 1; overflow-wrap: anywhere; }

/* ---------- modal / sheet ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(5, 3, 2, .66); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: fade .15s ease; }
.modal { width: min(560px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; border-radius: 26px; background: linear-gradient(180deg, #24180f, #160f0a); border: 1px solid var(--line-2); box-shadow: var(--shadow); padding: 22px; animation: pop .18s ease; }
.modal.wide { width: min(760px, 100%); }
.modal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.modal-head h3 { margin: 0; font-size: 18px; }
.modal-head .btn { margin-inline-start: auto; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.grabber { display: none; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } }
@keyframes up { from { transform: translateY(100%); } }

.toasts { position: fixed; z-index: 300; top: 18px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; width: min(420px, calc(100% - 32px)); pointer-events: none; }
.toast { display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-radius: 16px; background: #2d1f15; border: 1px solid var(--line-2); box-shadow: var(--shadow); font-size: 14px; animation: pop .2s ease; pointer-events: auto; }
.toast.good .ic { color: var(--good); }
.toast.bad { border-color: rgba(242, 84, 91, .4); }
.toast.bad .ic { color: var(--bad); }

.skeleton { border-radius: 12px; background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- responsive ---------- */
@media (max-width: 1200px) {
  .g-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-dash { grid-template-columns: minmax(0, 1fr); }
  .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .sidebar { display: none; }
  .main { margin-inline-start: 0; padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom)); }
  .topbar { padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top)); }
  .topbar h1 { display: none; }
  .topbar .brand { display: flex; }
  .topbar .brand-mark { width: 36px; height: 36px; border-radius: 12px; font-size: 14px; }
  .page { padding: 18px 16px 28px; }
  .hero { gap: 14px; margin-bottom: 16px; }
  .hero > .grow { flex-basis: 100%; }
  .hero h2 { font-size: 24px; }
  .hero .actions { margin-inline-start: 0; width: 100%; }
  .hero .actions .btn { flex: 1; }
  .kpi { gap: 8px; }
  .kpi-top { font-size: 12.5px; gap: 8px; line-height: 1.3; }
  .kpi-top .icon-pill { width: 30px; height: 30px; border-radius: 10px; }
  .kpi-top .icon-pill .ic { width: 16px; height: 16px; }
  .kpi-foot .sep { display: none; }
  .kpi-foot { flex-direction: column; align-items: flex-start; gap: 2px; }
  .kpi-foot:has(.avatar) { flex-direction: row; }
  .grid { gap: 14px; }
  .g-2, .g-3 { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .card { padding: 16px; border-radius: 20px; }
  .kpi-value { font-size: 28px; }
  .tabbar { display: flex; position: fixed; z-index: 30; inset-inline: 0; bottom: 0; height: calc(var(--tabbar) + env(safe-area-inset-bottom)); padding: 6px 8px env(safe-area-inset-bottom); background: rgba(16, 10, 7, .92); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--line); }
  .tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; background: none; color: var(--muted); font-size: 11px; font-weight: 600; cursor: pointer; border-radius: 14px; position: relative; }
  .tab .ic { width: 22px; height: 22px; }
  .tab.active { color: var(--accent-2); }
  .tab.active::before { content: ''; position: absolute; top: -6px; width: 26px; height: 3px; border-radius: 0 0 4px 4px; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
  .tab .count { position: absolute; top: 2px; inset-inline-end: calc(50% - 22px); font-size: 10px; min-width: 17px; height: 17px; display: grid; place-items: center; padding: 0 4px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-weight: 800; }

  .modal-wrap { place-items: end center; padding: 0; }
  .modal, .modal.wide { width: 100%; max-height: 92vh; border-radius: 26px 26px 0 0; padding: 14px 16px calc(20px + env(safe-area-inset-bottom)); animation: up .22s ease; }
  .grabber { display: block; width: 42px; height: 5px; border-radius: 999px; background: var(--surface-3); margin: 0 auto 12px; }
  .pmeta { grid-template-columns: repeat(2, 1fr); }
  .actions-grid { grid-template-columns: repeat(4, 1fr); }
  .perm-grid { grid-template-columns: minmax(0, 1fr); }
  .terminal { height: 58vh; font-size: 11.5px; padding: 12px; }
  .heat-row { grid-template-columns: 34px repeat(24, minmax(0, 1fr)); gap: 2px; }
  .heat { gap: 2px; }
  .cell { border-radius: 3px; }
  .bars { height: 170px; gap: 3px; }
  .bars-x { gap: 3px; }
  .hide-m { display: none !important; }
}

@media (max-width: 420px) {
  .g-kpi { gap: 10px; }
  .kpi-value { font-size: 24px; }
  .actions-grid { grid-template-columns: repeat(3, 1fr); }
  .pcard .stats { gap: 6px; }
}

@media (min-width: 901px) {
  .show-m { display: none !important; }
}

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