/* NexorVM Console — design system.
   Tokens follow the Market client portal (docs/UI_DESIGN_SYSTEM.md): 280px rail, 70px header,
   #2563eb primary, light default with saved dark preference, logical properties for RTL. */

:root,
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #eef3fa;
  --surface-3: #e3ebf6;
  --fg: #0c1322;
  --fg-2: #2b3750;
  --muted: #59677d;
  --faint: #8b97aa;
  --border: rgba(30, 58, 95, 0.12);
  --border-strong: rgba(30, 58, 95, 0.22);
  --focus: rgba(37, 99, 235, 0.45);
  --rail-bg: #ffffff;
  --header-bg: rgba(255, 255, 255, 0.86);
  --shadow-card: 0 1px 2px rgba(20, 38, 70, 0.04), 0 14px 40px rgba(36, 55, 86, 0.07);
  --shadow-pop: 0 24px 70px rgba(15, 30, 60, 0.22);
  --primary-soft: rgba(37, 99, 235, 0.09);
  --success-soft: rgba(34, 197, 94, 0.12);
  --warning-soft: rgba(245, 158, 11, 0.14);
  --danger-soft: rgba(239, 68, 68, 0.1);
  --info-soft: rgba(14, 165, 233, 0.12);
  --success-ink: #15803d;
  --warning-ink: #b45309;
  --danger-ink: #c62828;
  --info-ink: #0369a1;
  --grid-line: rgba(30, 58, 95, 0.07);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #071b29;
  --surface: #0d2335;
  --surface-2: #112b40;
  --surface-3: #163550;
  --fg: #f1f5f9;
  --fg-2: #cbd5e1;
  --muted: #94a3b8;
  --faint: #64748b;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.18);
  --focus: rgba(96, 165, 250, 0.55);
  --rail-bg: #061622;
  --header-bg: rgba(7, 27, 41, 0.86);
  --shadow-card: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 20px 60px rgba(0, 0, 0, 0.35);
  --shadow-pop: 0 30px 90px rgba(0, 0, 0, 0.6);
  --primary-soft: rgba(59, 130, 246, 0.16);
  --success-soft: rgba(34, 197, 94, 0.15);
  --warning-soft: rgba(245, 158, 11, 0.16);
  --danger-soft: rgba(239, 68, 68, 0.16);
  --info-soft: rgba(56, 189, 248, 0.15);
  --success-ink: #4ade80;
  --warning-ink: #fbbf24;
  --danger-ink: #f87171;
  --info-ink: #7dd3fc;
  --grid-line: rgba(255, 255, 255, 0.06);
}

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #3b82f6;
  --cyan: #22d3ee;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --violet: #8b5cf6;
  --rail-w: 272px;
  --header-h: 68px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --font: "Inter", "Noto Sans Arabic", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Consolas, "Liberation Mono", monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { scrollbar-gutter: stable; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, p { margin: 0; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
code, .mono { font-family: var(--mono); font-size: 0.92em; }
[hidden] { display: none !important; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }

/* ───────── Shell ───────── */
.shell { display: flex; min-height: 100dvh; }
.rail {
  position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 60;
  width: var(--rail-w); background: var(--rail-bg);
  border-inline-end: 1px solid var(--border);
  display: flex; flex-direction: column;
  transition: transform .26s cubic-bezier(.2,.8,.2,1);
}
.rail-head { display: flex; align-items: center; gap: 12px; padding: 20px 20px 18px; border-block-end: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 12px; color: var(--fg); min-width: 0; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; flex: none;
  border: 1px solid color-mix(in srgb, var(--primary) 35%, transparent);
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  box-shadow: 0 0 25px color-mix(in srgb, var(--primary) 16%, transparent);
}
.brand-mark i { width: 14px; height: 14px; border-radius: 3.5px; transform: rotate(45deg); background: linear-gradient(135deg, #67e8f9, var(--primary)); }
.brand-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.brand-text b { font-size: 15px; letter-spacing: .12em; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-text span { font-size: 10.5px; letter-spacing: .12em; color: var(--muted); font-weight: 700; text-transform: uppercase; margin-block-start: 3px; }

.rail-nav { flex: 1; overflow-y: auto; padding: 10px 12px 14px; scrollbar-width: thin; }
.nav-title { font-size: 10.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); padding: 16px 12px 6px; }
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; margin-block: 1px;
  color: var(--fg-2); font-weight: 550; font-size: 13.5px; position: relative;
}
.nav-link:hover { background: var(--surface-2); text-decoration: none; }
.nav-link.active { background: var(--primary-soft); color: var(--primary); }
:root[data-theme="dark"] .nav-link.active { color: #93c5fd; }
.nav-link.active::before { content: ""; position: absolute; inset-inline-start: -12px; inset-block: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--primary); }
[dir="rtl"] .nav-link.active::before { border-radius: 3px 0 0 3px; }
.nav-link .count { margin-inline-start: auto; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 99px; background: var(--surface-3); color: var(--muted); }
.nav-link .count.warn { background: var(--warning-soft); color: var(--warning-ink); }
.nav-link .count.bad { background: var(--danger-soft); color: var(--danger-ink); }

.rail-foot { padding: 12px; border-block-start: 1px solid var(--border); display: grid; gap: 10px; }
.license-pill { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); font-size: 12px; color: var(--muted); }
.license-pill strong { color: var(--fg); display: block; font-size: 12.5px; }
.license-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); flex: none; }
.license-pill .dot.warn { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-soft); }
.license-pill .dot.bad { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.rail-ver { font-size: 11px; color: var(--faint); text-align: center; }

.main { flex: 1; min-width: 0; margin-inline-start: var(--rail-w); display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 40; height: var(--header-h); padding-inline: 32px;
  display: flex; align-items: center; gap: 16px;
  background: var(--header-bg); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-block-end: 1px solid var(--border);
}
.topbar .menu-btn { display: none; }
.crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 13px; color: var(--muted); }
.crumbs a { color: var(--muted); }
.crumbs .sep { color: var(--faint); }
.crumbs b { color: var(--fg); font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; }
.search-trigger {
  display: flex; align-items: center; gap: 10px; min-width: 260px; height: 38px; padding-inline: 12px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--muted); cursor: pointer; font-size: 13px;
}
.search-trigger:hover { border-color: var(--border-strong); }
.search-trigger kbd { margin-inline-start: auto; font: 600 11px var(--font); padding: 2px 6px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); }
.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--fg-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.icon-btn .badge-dot { position: absolute; top: 7px; inset-inline-end: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); border: 2px solid var(--surface); }
.lang-btn { width: auto; padding-inline: 10px; gap: 6px; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; background: linear-gradient(135deg, var(--primary), var(--violet)); flex: none; }
.menu { position: absolute; z-index: 90; inset-block-start: calc(100% + 8px); inset-inline-end: 0; min-width: 220px; padding: 6px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-pop); }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: none; border-radius: 9px; text-align: start; cursor: pointer; font-size: 13px; color: var(--fg-2); }
.menu-item:hover { background: var(--surface-2); text-decoration: none; }
.menu-item.danger { color: var(--danger-ink); }
.menu-item.on { color: var(--primary); font-weight: 650; }
.menu-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.menu-head { padding: 8px 10px 10px; }
.menu-head b { display: block; font-size: 13.5px; }
.menu-head span { font-size: 12px; color: var(--muted); }
.rel { position: relative; }

.content { padding: 28px 32px 56px; width: 100%; max-width: 1560px; margin-inline: auto; flex: 1; }
.page { display: grid; gap: 22px; animation: rise .28s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.page-head { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.page-head .titles { flex: 1 1 320px; min-width: 0; }
.page-head h1 { font-size: 24px; letter-spacing: -.01em; font-weight: 700; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-head p { color: var(--muted); margin-block-start: 4px; font-size: 13.5px; max-width: 72ch; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ───────── Surfaces ───────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-card); min-width: 0; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-block-end: 1px solid var(--border); flex-wrap: wrap; }
.card-head h2, .card-head h3 { font-size: 14.5px; font-weight: 650; }
.card-head .sub { font-size: 12.5px; color: var(--muted); }
.card-head .spacer { margin-inline-start: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.card-body { padding: 20px; }
.card-body.flush { padding: 0; }
.grid { display: grid; gap: 18px; }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 18px; align-items: start; }
.stack { display: grid; gap: 18px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.stat-card { padding: 18px 20px; display: grid; gap: 10px; position: relative; overflow: hidden; }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stat-label { font-size: 12px; font-weight: 650; letter-spacing: .02em; color: var(--muted); }
.stat-icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.stat-icon.cyan { background: var(--info-soft); color: var(--info-ink); }
.stat-icon.green { background: var(--success-soft); color: var(--success-ink); }
.stat-icon.amber { background: var(--warning-soft); color: var(--warning-ink); }
.stat-icon.red { background: var(--danger-soft); color: var(--danger-ink); }
.stat-icon.violet { background: rgba(139,92,246,.14); color: #8b5cf6; }
.stat-value { font-size: 30px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.stat-value small { font-size: 14px; font-weight: 600; color: var(--muted); margin-inline-start: 4px; letter-spacing: 0; }
.stat-foot { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 8px; min-height: 18px; }
.spark { position: absolute; inset-inline: 0; inset-block-end: 0; height: 38px; opacity: .55; pointer-events: none; }

/* ───────── Buttons & forms ───────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 8px 14px;
  border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--fg);
  font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 8px 20px rgba(37,99,235,.22); }
.btn.primary:hover { background: var(--primary-hover); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { background: #dc2626; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--fg-2); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.soft-danger { color: var(--danger-ink); border-color: color-mix(in srgb, var(--danger) 35%, transparent); background: var(--danger-soft); }
.btn.soft-danger:hover { background: color-mix(in srgb, var(--danger) 20%, transparent); }
.btn.sm { min-height: 32px; padding: 5px 10px; font-size: 12.5px; border-radius: 9px; }
.btn.icon { width: 34px; padding: 0; }
.btn.loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.loading::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-color: #fff #fff transparent transparent; animation: spin .7s linear infinite; }
.btn:not(.primary):not(.danger).loading::after { border-color: var(--primary) var(--primary) transparent transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

.field { display: grid; gap: 6px; min-width: 0; align-content: start; }
.field > label, .field .label { font-size: 12.5px; font-weight: 650; color: var(--fg-2); display: flex; justify-content: space-between; gap: 8px; }
.field > label.check { justify-content: flex-start; font-weight: 550; color: var(--fg); }
.field .hint { font-size: 12px; color: var(--muted); font-weight: 400; }
.field .err { font-size: 12px; color: var(--danger-ink); }
.input, .select, .textarea {
  width: 100%; min-height: 40px; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--fg); transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 92px; resize: vertical; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.select { appearance: none; padding-inline-end: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
[dir="rtl"] .select { background-position: left 10px center; padding-inline: 12px 34px; }
.input-group { display: flex; gap: 8px; }
.input-affix { position: relative; }
.input-affix .input { padding-inline-end: 44px; }
.input-affix .affix { position: absolute; inset-inline-end: 6px; inset-block-start: 50%; transform: translateY(-50%); }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; cursor: pointer; }
.check input { margin-block-start: 3px; accent-color: var(--primary); width: 16px; height: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .wide { grid-column: 1 / -1; }
.seg { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--border); gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.seg button.on { background: var(--surface); color: var(--fg); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.seg button .n { font-size: 11px; padding: 0 6px; border-radius: 99px; background: var(--surface-3); color: var(--muted); }

/* ───────── Badges ───────── */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 650; background: var(--surface-3); color: var(--muted); white-space: nowrap; line-height: 1.5; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge.plain::before { display: none; }
.badge.ok { background: var(--success-soft); color: var(--success-ink); }
.badge.warn { background: var(--warning-soft); color: var(--warning-ink); }
.badge.bad { background: var(--danger-soft); color: var(--danger-ink); }
.badge.info { background: var(--info-soft); color: var(--info-ink); }
.badge.primary { background: var(--primary-soft); color: var(--primary); }
.badge.live::before { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); font-size: 11.5px; color: var(--muted); font-weight: 600; }

/* ───────── Tables ───────── */
.table-wrap { overflow-x: auto; max-width: 100%; scrollbar-width: thin; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: start; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 11px 16px; background: var(--surface-2); white-space: nowrap; border-block-end: 1px solid var(--border); }
.tbl th.sort { cursor: pointer; user-select: none; }
.tbl th.sort:hover { color: var(--fg); }
.tbl td { padding: 13px 16px; border-block-end: 1px solid var(--border); vertical-align: middle; }
.tbl tbody tr:last-child td { border-block-end: 0; }
.tbl tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
.tbl tr.clickable { cursor: pointer; }
.tbl td.num, .tbl th.num { text-align: end; font-variant-numeric: tabular-nums; }
.tbl td.act { text-align: end; white-space: nowrap; width: 1%; }
.cell-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cell-main .t { font-weight: 650; color: var(--fg); display: block; max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-main .s { font-size: 12px; color: var(--muted); display: block; }
.os-ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border); flex: none; overflow: hidden; color: var(--muted); }
.os-ico img { width: 22px; height: 22px; object-fit: contain; }
.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-block-start: 1px solid var(--border); font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 14px 18px; border-block-end: 1px solid var(--border); }
.toolbar .search { position: relative; flex: 1 1 240px; max-width: 380px; }
.toolbar .search .input { padding-inline-start: 38px; min-height: 38px; }
.toolbar .search svg { position: absolute; inset-inline-start: 12px; inset-block-start: 10px; color: var(--faint); }

/* ───────── Meter / bars ───────── */
.meter { height: 8px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), var(--cyan)); transition: width .5s ease; }
.meter.warn > span { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.meter.bad > span { background: linear-gradient(90deg, #ef4444, #f87171); }
.meter.green > span { background: linear-gradient(90deg, #16a34a, #4ade80); }
.meter.violet > span { background: linear-gradient(90deg, #7c3aed, #a78bfa); }
.meter-row { display: grid; gap: 6px; }
.meter-row .top { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); gap: 8px; }
.meter-row .top b { color: var(--fg); font-weight: 650; }
.stacked { display: flex; height: 10px; border-radius: 99px; overflow: hidden; background: var(--surface-3); gap: 2px; }
.stacked span { display: block; height: 100%; min-width: 3px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-inline-end: 6px; }
.ring { position: relative; width: 112px; height: 112px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .v { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; font-weight: 700; font-size: 20px; line-height: 1.1; }
.ring .v small { display: block; font-size: 11px; color: var(--muted); font-weight: 600; }

/* ───────── Charts ───────── */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis { fill: var(--faint); font-size: 10.5px; font-family: var(--font); }
.chart .grid-l { stroke: var(--grid-line); stroke-width: 1; }
.chart-tip { position: absolute; pointer-events: none; z-index: 5; padding: 6px 9px; border-radius: 8px; background: var(--fg); color: var(--bg); font-size: 11.5px; line-height: 1.4; white-space: nowrap; transform: translate(-50%, -110%); opacity: 0; transition: opacity .1s; }
.chart-empty { display: grid; place-items: center; min-height: 140px; color: var(--muted); font-size: 13px; }

/* ───────── Tabs ───────── */
.tabs { display: flex; gap: 4px; overflow-x: auto; border-block-end: 1px solid var(--border); scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: inline-flex; align-items: center; gap: 8px; padding: 12px 14px; border: 0; background: none; color: var(--muted); font-weight: 600; font-size: 13.5px; cursor: pointer; border-block-end: 2px solid transparent; margin-block-end: -1px; white-space: nowrap; }
.tab:hover { color: var(--fg); text-decoration: none; }
.tab:disabled { opacity: .45; cursor: not-allowed; }
.tab:disabled:hover { color: var(--muted); }
.tab.on { color: var(--primary); border-block-end-color: var(--primary); }
:root[data-theme="dark"] .tab.on { color: #93c5fd; border-block-end-color: #60a5fa; }

/* ───────── Detail lists ───────── */
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 20px 28px; }
.kv > div { min-width: 0; }
.kv dt { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); margin-block-end: 4px; }
.kv dd { margin: 0; font-size: 14px; font-weight: 550; overflow-wrap: anywhere; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.list { display: grid; }
.list-item { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-block-end: 1px solid var(--border); min-width: 0; }
.list-item:last-child { border-block-end: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .t { font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .s { font-size: 12.5px; color: var(--muted); display: block; }
.icon-chip { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); flex: none; }
.icon-chip.green { background: var(--success-soft); color: var(--success-ink); }
.icon-chip.amber { background: var(--warning-soft); color: var(--warning-ink); }
.icon-chip.red { background: var(--danger-soft); color: var(--danger-ink); }
.icon-chip.cyan { background: var(--info-soft); color: var(--info-ink); }

/* ───────── Hero (VM detail) ───────── */
.hero { padding: 22px 24px; display: flex; gap: 20px; align-items: center; flex-wrap: wrap; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; inset-inline-end: -80px; inset-block-start: -80px; width: 260px; height: 260px; background: radial-gradient(closest-side, var(--primary-soft), transparent); pointer-events: none; }
.hero .os-ico { width: 56px; height: 56px; border-radius: 16px; }
.hero .os-ico img { width: 34px; height: 34px; }
.hero h1 { font-size: 22px; font-weight: 700; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.hero .meta { display: flex; gap: 8px 18px; flex-wrap: wrap; color: var(--muted); font-size: 13px; margin-block-start: 6px; align-items: center; }
.hero .meta span { display: inline-flex; gap: 6px; align-items: center; }
.hero .power { margin-inline-start: auto; display: flex; gap: 8px; flex-wrap: wrap; position: relative; z-index: 1; }

/* ───────── Alerts / empty ───────── */
.note { display: flex; gap: 12px; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); font-size: 13px; align-items: flex-start; }
.note svg { margin-block-start: 1px; }
.note.warn { background: var(--warning-soft); border-color: color-mix(in srgb, var(--warning) 35%, transparent); color: var(--warning-ink); }
.note.bad { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, transparent); color: var(--danger-ink); }
.note.ok { background: var(--success-soft); border-color: color-mix(in srgb, var(--success) 35%, transparent); color: var(--success-ink); }
.note.info { background: var(--info-soft); border-color: color-mix(in srgb, #0ea5e9 30%, transparent); color: var(--info-ink); }
.note p { color: inherit; opacity: .92; }
.note b { display: block; margin-block-end: 2px; }
.empty { display: grid; place-items: center; text-align: center; gap: 10px; padding: 52px 24px; color: var(--muted); }
.empty .ico { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--surface-2); color: var(--faint); border: 1px dashed var(--border-strong); }
.empty h3 { color: var(--fg); font-size: 15px; }
.empty p { max-width: 46ch; font-size: 13px; }
.skel { border-radius: 8px; background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ───────── Overlays ───────── */
.overlay { position: fixed; inset: 0; z-index: 100; background: rgba(5, 14, 24, .55); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 20px; animation: fade .15s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal { width: min(560px, 100%); max-height: calc(100dvh - 40px); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-pop); animation: pop .2s cubic-bezier(.2,.8,.2,1); }
.modal.wide { width: min(760px, 100%); }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-head { padding: 20px 24px 8px; display: flex; gap: 12px; align-items: flex-start; }
.modal-head h2 { font-size: 17px; font-weight: 700; flex: 1; }
.modal-head p { color: var(--muted); font-size: 13px; margin-block-start: 4px; }
.modal-body { padding: 12px 24px 8px; overflow-y: auto; display: grid; gap: 16px; }
.modal-foot { padding: 16px 24px 20px; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.modal-ico { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; flex: none; background: var(--primary-soft); color: var(--primary); }
.modal-ico.danger { background: var(--danger-soft); color: var(--danger-ink); }
.drawer-wrap { place-items: stretch end; padding: 0; }
.drawer { width: min(520px, 100%); height: 100%; background: var(--surface); border-inline-start: 1px solid var(--border); box-shadow: var(--shadow-pop); display: flex; flex-direction: column; animation: slide .22s cubic-bezier(.2,.8,.2,1); }
[dir="rtl"] .drawer { animation-name: slide-rtl; }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slide-rtl { from { transform: translateX(-30px); opacity: 0; } to { transform: none; opacity: 1; } }
.toasts { position: fixed; inset-block-end: 20px; inset-inline-end: 20px; z-index: 200; display: grid; gap: 10px; width: min(380px, calc(100vw - 40px)); }
.toast { display: flex; gap: 12px; padding: 13px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-pop); font-size: 13px; align-items: flex-start; animation: pop .22s ease; }
.toast .icon-chip { width: 30px; height: 30px; border-radius: 9px; }
.toast b { display: block; }
.toast span { color: var(--muted); }
.palette { width: min(640px, 100%); align-self: start; margin-block-start: 12vh; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-pop); overflow: hidden; }
.palette input { width: 100%; border: 0; border-block-end: 1px solid var(--border); background: none; padding: 18px 20px; font-size: 15px; outline: none; }
.palette ul { list-style: none; margin: 0; padding: 8px; max-height: 50vh; overflow-y: auto; }
.palette li a, .palette li button { display: flex; gap: 12px; align-items: center; width: 100%; padding: 10px 12px; border-radius: 10px; color: var(--fg-2); border: 0; background: none; cursor: pointer; text-align: start; font-size: 13.5px; }
.palette li.on a, .palette li.on button { background: var(--primary-soft); color: var(--primary); text-decoration: none; }
.palette .grp { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); font-weight: 700; padding: 10px 12px 4px; }
.palette .foot { padding: 10px 16px; border-block-start: 1px solid var(--border); display: flex; gap: 16px; font-size: 11.5px; color: var(--muted); }

/* ───────── Wizard ───────── */
.steps { display: flex; gap: 0; counter-reset: s; overflow-x: auto; }
.step { flex: 1; min-width: 130px; display: flex; align-items: center; gap: 10px; padding: 14px 16px; color: var(--muted); font-weight: 600; font-size: 13px; border-block-end: 2px solid var(--border); white-space: nowrap; }
.step::before { counter-increment: s; content: counter(s); width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); font-size: 12px; font-weight: 700; flex: none; }
.step.on { color: var(--primary); border-color: var(--primary); }
.step.on::before { background: var(--primary); color: #fff; }
.step.done { color: var(--success-ink); border-color: var(--success); }
.step.done::before { content: "✓"; background: var(--success); color: #fff; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.choice { display: grid; gap: 8px; padding: 14px; border-radius: 14px; border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; text-align: start; position: relative; transition: border-color .15s, box-shadow .15s; }
.choice:hover { border-color: var(--primary-light); }
.choice.on { border-color: var(--primary); box-shadow: 0 0 0 3px var(--focus); background: var(--primary-soft); }
.choice .ttl { font-weight: 650; font-size: 13.5px; }
.choice .sub { font-size: 12px; color: var(--muted); }
.choice.disabled, .choice:disabled { opacity: .5; pointer-events: none; cursor: not-allowed; }
.summary { position: sticky; top: calc(var(--header-h) + 20px); }
.summary dl { display: grid; gap: 10px; margin: 0; }
.summary dl > div { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; font-weight: 600; text-align: end; overflow-wrap: anywhere; }

/* ───────── Console / terminal-ish ───────── */
.console-frame { background: #000; border-radius: 14px; overflow: hidden; min-height: 460px; position: relative; border: 1px solid var(--border); }
.console-bar { display: flex; gap: 8px; align-items: center; padding: 10px 14px; background: var(--surface-2); border-block-end: 1px solid var(--border); flex-wrap: wrap; }
.console-screen { height: min(68vh, 640px); background: #0b0f14; }
.codeblock { font-family: var(--mono); font-size: 12.5px; padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); overflow: auto; white-space: pre-wrap; word-break: break-all; }
.copy-field { display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); font-family: var(--mono); font-size: 12.5px; min-width: 0; }
.copy-field span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress-line { height: 4px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.progress-line > span { display: block; height: 100%; background: var(--primary); transition: width .4s; }
.timeline { display: grid; gap: 0; }
.tl-item { display: grid; grid-template-columns: 22px 1fr; gap: 12px; padding-block-end: 18px; position: relative; }
.tl-item::before { content: ""; position: absolute; inset-inline-start: 10px; top: 20px; bottom: 0; width: 1px; background: var(--border); }
.tl-item:last-child::before { display: none; }
.tl-dot { width: 21px; height: 21px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); }
.tl-dot.ok { background: var(--success-soft); color: var(--success-ink); }
.tl-dot.bad { background: var(--danger-soft); color: var(--danger-ink); }
.tl-dot.info { background: var(--primary-soft); color: var(--primary); }
.tl-dot svg { width: 12px; height: 12px; }
.tl-dot.run { background: var(--primary-soft); position: relative; }
.tl-dot.run::after { content: ""; width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--primary); border-color: var(--primary) var(--primary) transparent transparent; animation: spin .8s linear infinite; }
.tl-dot.wait { opacity: .6; }
@media (prefers-reduced-motion: reduce) { .tl-dot.run::after { animation-duration: 3s; } }
.tl-item .t { font-weight: 600; font-size: 13.5px; }
.tl-item .s { font-size: 12px; color: var(--muted); }
.kbd { font: 600 11px var(--font); padding: 2px 6px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--surface-2); }

/* ───────── Login ───────── */
.auth { min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--bg); }
.auth-art { position: relative; overflow: hidden; padding: 44px 56px; display: flex; flex-direction: column; justify-content: space-between; color: #e6eef8; background: radial-gradient(1200px 600px at 10% -10%, #123a63 0%, transparent 60%), radial-gradient(900px 500px at 100% 110%, #0a4a5a 0%, transparent 55%), #061622; }
.auth-art::after { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.04) 1px, transparent 1px); background-size: 44px 44px; mask-image: radial-gradient(ellipse at 30% 40%, #000 20%, transparent 75%); pointer-events: none; }
.auth-art .brand { color: #fff; position: relative; z-index: 1; }
.auth-art .brand-text span { color: #94a3b8; }
.auth-copy { position: relative; z-index: 1; max-width: 520px; }
.auth-copy h2 { font-size: 40px; line-height: 1.1; letter-spacing: -.02em; font-weight: 700; white-space: pre-line; }
.auth-copy h2 em { font-style: normal; background: linear-gradient(90deg, #67e8f9, #60a5fa); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-copy p { margin-block-start: 16px; color: #a9b8cb; font-size: 16px; line-height: 1.6; }
.auth-points { display: grid; gap: 14px; margin-block-start: 32px; padding-block-start: 28px; border-block-start: 1px solid rgba(255,255,255,.1); }
.auth-points div { display: flex; gap: 14px; align-items: center; color: #cbd5e1; font-size: 14px; line-height: 1.45; }
.auth-points .icon-chip { background: rgba(103,232,249,.12); color: #67e8f9; width: 34px; height: 34px; flex: none; border-radius: 10px; display: grid; place-items: center; }
.auth-points .icon-chip .i { width: 18px; height: 18px; }
.auth-art small { position: relative; z-index: 1; color: #64748b; }
.auth-form-wrap { display: grid; place-items: center; padding: 32px; position: relative; }
.auth-tools { position: absolute; inset-block-start: 20px; inset-inline-end: 24px; display: flex; gap: 8px; }
.auth-panel { width: min(420px, 100%); display: grid; gap: 22px; }
.auth-brand-sm { display: none; justify-self: center; }
.auth-card { display: grid; gap: 20px; padding: 32px; border-radius: 20px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-card); }
.auth-head h1 { font-size: 24px; line-height: 1.2; letter-spacing: -.02em; font-weight: 700; }
.auth-head .lead { color: var(--muted); margin-block-start: 8px; font-size: 14px; line-height: 1.55; }
.auth-head.center { text-align: center; display: grid; justify-items: center; }
.auth-head.center h1 { margin-block-start: 16px; }
.auth-badge { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.auth-badge .i { width: 26px; height: 26px; }
.input-lead { position: relative; }
.input-lead > .i { position: absolute; inset-inline-start: 13px; inset-block-start: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--faint); pointer-events: none; }
.input-lead > .input { padding-inline-start: 40px; }
.input-lead:focus-within > .i { color: var(--primary); }
.input-lead .affix .i { position: static; transform: none; width: 18px; height: 18px; color: inherit; }
.auth-card .input { min-height: 44px; }
.auth-submit { min-height: 46px; width: 100%; font-size: 14.5px; font-weight: 650; justify-content: center; }
.auth-help { color: var(--muted); font-size: 12.5px; text-align: center; }
.auth-secure { display: flex; gap: 8px; align-items: center; justify-content: center; color: var(--muted); font-size: 12.5px; }
.auth-secure .i { width: 15px; height: 15px; flex: none; }
.auth-back { display: inline-flex; gap: 6px; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; font-weight: 550; }
.auth-back:hover { color: var(--fg); text-decoration: none; }
.auth-back .i { width: 16px; height: 16px; }
[dir="rtl"] .auth-back .i.flip { transform: scaleX(-1); }
.code-input { text-align: center; font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace); font-size: 24px; letter-spacing: .4em; padding-inline: 12px; min-height: 54px !important; }
.code-input::placeholder { letter-spacing: .4em; }

/* ───────── Responsive ───────── */
@media (max-width: 1280px) {
  .cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split { grid-template-columns: minmax(0, 1fr); }
  .summary { position: static; }
}
@media (max-width: 980px) {
  .rail { transform: translateX(-100%); box-shadow: var(--shadow-pop); }
  [dir="rtl"] .rail { transform: translateX(100%); }
  .shell.nav-open .rail { transform: none; }
  .scrim { position: fixed; inset: 0; z-index: 55; background: rgba(5,14,24,.5); }
  .main { margin-inline-start: 0; }
  .topbar { padding-inline: 16px; }
  .topbar .menu-btn { display: inline-grid; }
  .search-trigger { min-width: 0; width: 38px; padding: 0; justify-content: center; }
  .search-trigger span, .search-trigger kbd { display: none; }
  .content { padding: 20px 16px 48px; }
  .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .auth-brand-sm { display: flex; }
}
@media (max-width: 640px) {
  .auth-form-wrap { padding: 72px 16px 24px; place-items: start center; }
  .auth-card { padding: 24px 20px; border-radius: 16px; }
  .cols-2, .cols-3, .cols-4, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .page-head h1 { font-size: 21px; }
  .hero .power { margin-inline-start: 0; width: 100%; }
  .crumbs .hide-sm { display: none; }
  .tbl th, .tbl td { padding-inline: 12px; }
  .modal-foot .btn { flex: 1; }
  .lang-btn span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print { .rail, .topbar { display: none; } .main { margin: 0; } }

.stat-card:has(.spark) { padding-block-end: 50px; }
.tbl td.act .row { min-width: 76px; }

.spark { width: 100%; }
/* Mixed Arabic text with numbers/units must resolve direction per run, not per paragraph. */
[dir="rtl"] .stat-foot, [dir="rtl"] .kv dd, [dir="rtl"] .meter-row .top, [dir="rtl"] .cell-main .s, [dir="rtl"] small, [dir="rtl"] .hero .meta, [dir="rtl"] .list-item .s, [dir="rtl"] .legend { unicode-bidi: plaintext; }
[dir="rtl"] .mono, [dir="rtl"] code { direction: ltr; unicode-bidi: isolate; }
