/* ===========================================================
   OmidCloud — Design System v4  "Packet"
   Dual theme (dark default + light) on CSS custom properties.
   Signature: teal -> sky "signal" gradient on deep navy, like
   packets lighting up a switch. Self-hosted fonts, no CDN.
   All v3 class names are preserved so every template upgrades.
   =========================================================== */

/* Vazirmatn v33.003 font-face rules are generated at startup by app/core/fonts.py
   (checked files + content-hashed URLs) and inlined in <head>. */

/* ---------------- tokens: dark (default) ---------------- */
:root, html[data-theme="dark"] {
  color-scheme: dark;

  --bg: #060a13;
  --bg-2: #0a0f1c;
  --surface: #0e1524;
  --surface-2: #131c2f;
  --surface-3: #1b263d;
  --border: #1f2b44;
  --border-soft: #172238;

  --text: #eef3fb;
  --text-dim: #9fb0cc;
  --text-faint: #8592ad;     /* ≥4.8:1 on every surface (WCAG AA for small text) */

  --accent: #2dd4bf;          /* teal signal */
  --accent-2: #38bdf8;        /* sky */
  --accent-3: #a3e635;        /* lime "link up" */
  --accent-ink: #03121a;      /* dark ink on bright buttons (AA contrast) */
  --accent-soft: rgba(45,212,191,.12);
  --accent-line: rgba(45,212,191,.32);
  --accent-glow: rgba(45,212,191,.38);

  --danger: #fb7185;
  --warn: #fbbf24;
  --ok: #34d399;
  --info: #38bdf8;

  --grad-accent: linear-gradient(135deg, #2dd4bf 0%, #38bdf8 100%);
  --grad-accent-soft: linear-gradient(135deg, rgba(45,212,191,.14), rgba(56,189,248,.08));
  --grad-violet: linear-gradient(135deg, #a3e635, #2dd4bf);
  --grad-surface: linear-gradient(170deg, rgba(255,255,255,.028), rgba(255,255,255,0) 55%);

  --radius: 16px;
  --radius-lg: 22px;
  --radius-sm: 11px;
  --radius-xs: 8px;
  --shadow: 0 24px 60px -18px rgba(0,0,0,.6);
  --shadow-sm: 0 8px 24px -10px rgba(0,0,0,.5);
  --shadow-glow: 0 14px 38px -12px var(--accent-glow);
  --ring: 0 0 0 1px rgba(255,255,255,.05);

  --mono: ui-monospace, 'SF Mono', 'Cascadia Mono', 'Consolas', 'Vazirmatn', monospace;
  --code: ui-monospace, 'SF Mono', 'Cascadia Mono', 'Consolas', 'Vazirmatn', monospace;  /* real code only */
  --sans: 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;

  --sidebar-w: 264px;
  --ease: cubic-bezier(.4,0,.2,1);
}

/* ---------------- tokens: light ---------------- */
html[data-theme="light"] {
  color-scheme: light;

  --bg: #f3f6fb;
  --bg-2: #eaf0f7;
  --surface: #ffffff;
  --surface-2: #f5f8fc;
  --surface-3: #e8eef6;
  --border: #d9e2ee;
  --border-soft: #e6ecf4;

  --text: #0d1726;
  --text-dim: #4b5b74;
  --text-faint: #5a6880;     /* ≥4.8:1 on every light surface */

  --accent: #0f766e;          /* ≥4.7:1 as text on light surfaces; buttons use --grad-accent */
  --accent-2: #0284c7;
  --accent-3: #65a30d;
  --accent-ink: #ffffff;
  --accent-soft: rgba(13,148,136,.09);
  --accent-line: rgba(13,148,136,.30);
  --accent-glow: rgba(13,148,136,.28);

  --danger: #e11d48;
  --warn: #d97706;
  --ok: #059669;
  --info: #0284c7;

  --grad-accent: linear-gradient(135deg, #0d9488 0%, #0284c7 100%);
  --grad-accent-soft: linear-gradient(135deg, rgba(13,148,136,.10), rgba(2,132,199,.06));
  --grad-surface: linear-gradient(170deg, rgba(255,255,255,.7), rgba(255,255,255,0));
  --shadow: 0 24px 60px -24px rgba(13,23,38,.20);
  --shadow-sm: 0 6px 20px -10px rgba(13,23,38,.14);
  --ring: 0 0 0 1px rgba(13,23,38,.05);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0; padding: 0;
  color: var(--text);
  font-family: var(--sans);
  font-variant-numeric: tabular-nums;
  direction: rtl;
  font-size: 15px;
  line-height: 1.75;
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
}
img, svg { max-width: 100%; }
button, input, select, textarea { font: inherit; }

body::before {
  content: '';
  position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(820px 520px at 92% -8%, rgba(45,212,191,.09), transparent 62%),
    radial-gradient(700px 480px at -6% 14%, rgba(56,189,248,.07), transparent 60%),
    var(--bg);
}
html[data-theme="light"] body::before {
  background:
    radial-gradient(820px 520px at 92% -8%, rgba(13,148,136,.07), transparent 62%),
    radial-gradient(700px 480px at -6% 14%, rgba(2,132,199,.05), transparent 60%),
    var(--bg);
}

::selection { background: var(--accent); color: var(--accent-ink); }

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

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

h1, h2, h3, h4 { line-height: 1.45; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
code, kbd, pre { font-family: var(--code); }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: embed; letter-spacing: -.2px; }
.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; }
.skip-link { position:absolute; top:-60px; right:12px; z-index:999; background:var(--accent); color:var(--accent-ink); padding:8px 16px; border-radius:10px; font-weight:700; }
.skip-link:focus { top:12px; color:var(--accent-ink); }

/* ---------- brand ---------- */
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 10px 20px; color: var(--text); }
.brand:hover { color: var(--text); }
.brand-logo {
  width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0;
  background: var(--grad-accent);
  display: grid; place-items: center; color: var(--accent-ink); font-weight: 800;
  font-family: var(--mono); font-size: 18px;
  box-shadow: 0 8px 22px -8px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,.3);
}
.brand-logo svg { width: 58%; height: 58%; display: block; }
.brand-name { font-weight: 800; font-size: 16px; letter-spacing: -.3px; line-height: 1.35; }
.brand-name span { color: var(--accent); }
.brand-sub { font-size: 11px; color: var(--text-faint); letter-spacing: .2px; }
.brand-logo.admin { background: linear-gradient(135deg,#f59e0b,#ef4444); color:#fff; }

/* ---------- layout ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  padding: 20px 14px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--surface);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-left: 1px solid var(--border-soft);
  display: flex; flex-direction: column;
}
.content { flex: 1; padding: 22px clamp(16px, 3vw, 36px) 56px; max-width: 100%; min-width: 0; }
.content-inner { max-width: 1320px; margin: 0 auto; }

.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; padding-bottom: 16px; }
.nav-label {
  font-size: 10.5px; color: var(--text-faint); padding: 16px 14px 6px;
  letter-spacing: 1px; font-weight: 700;
}
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 13px;
  border-radius: var(--radius-sm); color: var(--text-dim); font-size: 14px;
  transition: background .18s var(--ease), color .18s var(--ease); text-decoration: none;
  position: relative; font-weight: 500;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active {
  background: var(--grad-accent-soft);
  color: var(--text); font-weight: 700;
  box-shadow: inset 0 0 0 1px var(--accent-line);
}
.nav a.active .ic { color: var(--accent); }
.nav a.active::before {
  content: ''; position: absolute; right: -14px; top: 50%; transform: translateY(-50%);
  width: 3.5px; height: 20px; border-radius: 4px; background: var(--grad-accent);
  box-shadow: 0 0 12px var(--accent-glow);
}
.nav a .ic { width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.nav a .ic svg { width: 18px; height: 18px; display: block; }
.nav a .badge { margin-right: auto; }
.nav-link.active { background: var(--grad-accent-soft); border: 1px solid var(--accent-line); color: var(--text); }

.side-card {
  margin-top: auto; padding: 14px; border-radius: var(--radius);
  background: var(--grad-accent-soft); border: 1px solid var(--accent-line);
  font-size: 13px;
}
.side-card b { display: block; margin-bottom: 4px; }
.side-card p { margin: 0 0 10px; color: var(--text-dim); font-size: 12.5px; line-height: 1.9; }

/* user chip in sidebar */
.user-chip { display:flex; align-items:center; gap:10px; padding:10px; border-radius:var(--radius-sm);
  background: var(--surface-2); border:1px solid var(--border); margin: 0 4px 10px; }
.avatar { width:36px; height:36px; border-radius:50%; display:grid; place-items:center; flex-shrink:0;
  background: var(--grad-accent); color: var(--accent-ink); font-weight:800; font-size:14px; }
.user-chip .u-name { font-size:13.5px; font-weight:700; line-height:1.4; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.user-chip .u-sub { font-size:11.5px; color:var(--text-faint); }

/* ---------- mobile top header + drawer ---------- */
.mobilebar { display: none; }
.scrim {
  display: none; position: fixed; inset: 0; z-index: 90;
  background: rgba(3,6,12,.6); backdrop-filter: blur(2px);
}
body.nav-open .scrim { display: block; animation: fadeIn .2s ease; }

/* ---------- topbar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  position: sticky; top: 0; z-index: 40;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  padding: 12px 0 14px; margin-bottom: 22px;
  border-bottom: 1px solid var(--border-soft);
}
.topbar h1 { font-size: 23px; margin: 0; letter-spacing: -.5px; font-weight: 800; }
.topbar .sub { color: var(--text-dim); font-size: 13.5px; margin-top: 1px; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.balance-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  padding: 7px 14px; border-radius: 999px; font-size: 13px; color: var(--text-dim);
}
.balance-chip b { color: var(--text); font-family: var(--mono); font-weight: 700; }
.balance-chip:hover { border-color: var(--accent); color: var(--text-dim); }

.search-trigger {
  display: inline-flex; align-items: center; gap: 10px; height: 38px; padding: 0 12px;
  border-radius: 11px; border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text-faint); cursor: pointer; font-size: 13px; min-width: 200px; transition: .18s;
}
.search-trigger:hover { border-color: var(--accent); color: var(--text-dim); }
.search-trigger svg { width: 16px; height: 16px; }
.search-trigger kbd { margin-right: auto; font-size: 11px; background: var(--surface-3); border-radius: 6px; padding: 1px 7px; direction: ltr; color: var(--text-dim); }

.theme-btn, .bell-btn, .menu-btn, .icon-square {
  width: 38px; height: 38px; border-radius: 11px; position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-2); color: var(--text-dim); border: 1px solid var(--border);
  cursor: pointer; transition: all .18s; flex-shrink: 0;
}
.theme-btn:hover, .bell-btn:hover, .menu-btn:hover, .icon-square:hover { color: var(--accent); border-color: var(--accent); }
.theme-btn svg, .menu-btn svg, .icon-square svg { width: 17px; height: 17px; }
/* icon wrappers: no line box, so the icon sits dead-center */
.theme-btn .ic-sun, .theme-btn .ic-moon { display: none; line-height: 0; }
.theme-btn .ic-sun svg, .theme-btn .ic-moon svg { display: block; }
html[data-theme="dark"] .theme-btn .ic-sun, html:not([data-theme]) .theme-btn .ic-sun { display: grid; place-items: center; }
html[data-theme="light"] .theme-btn .ic-moon { display: grid; place-items: center; }
.theme-btn:hover svg { transform: rotate(-15deg); transition: transform .2s; }
.menu-btn { display: none; }
.menu-close { display: none; }
.bell-badge {
  position: absolute; top: -6px; left: -6px; min-width: 18px; height: 18px;
  padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 2px var(--bg);
}

/* ---------- grid + cards ---------- */
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.grid-aside { grid-template-columns: minmax(0,1fr) 360px; align-items: start; }

.card {
  position: relative;
  background: var(--grad-surface), var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: border-color .2s, transform .2s, box-shadow .2s;
  min-width: 0;
}
.card h3 { margin: 0 0 16px; font-size: 15.5px; font-weight: 800; letter-spacing: -.2px; }
.card-head { display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:14px; flex-wrap:wrap; }
.card-head h3 { margin: 0; }
.card.hover:hover, a.card:hover { border-color: var(--accent-line); transform: translateY(-2px); box-shadow: var(--shadow-glow); }
a.card { color: inherit; display: block; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > .card-head { padding: 18px 20px 0; }

.card.kpi { padding: 18px 20px; overflow: hidden; }
.kpi .label { color: var(--text-dim); font-size: 13px; font-weight: 500; display:flex; align-items:center; gap:8px; }
.kic { width:32px; height:32px; border-radius:10px; display:grid; place-items:center; background: var(--accent-soft); color: var(--accent); flex-shrink:0; }
.kic svg { width:16px; height:16px; }
.kpi .label .kic { width:30px; height:30px; border-radius:9px; }
.kpi .value { font-size: 26px; font-weight: 800; margin-top: 10px; font-family: var(--mono); letter-spacing: -1px; line-height: 1.3; }
.kpi .value.accent { color: var(--accent); }
.kpi .foot { font-size: 12px; color: var(--text-faint); margin-top: 4px; }
.kpi.balance-card { border-color: var(--accent-line); background: radial-gradient(420px 160px at 100% 0%, var(--accent-soft), transparent 70%), var(--surface); }
.kpi.balance-card .value { font-size: 30px; }
.balance-card .value { margin: 8px 0; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px; min-height: 42px; border-radius: var(--radius-sm); border: 1px solid transparent;
  font-family: var(--sans); font-size: 14px; font-weight: 700; cursor: pointer; line-height: 1.4;
  transition: all .18s var(--ease); text-decoration: none; white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; filter: grayscale(.3); }
.btn-primary {
  background: var(--grad-accent); color: var(--accent-ink);
  box-shadow: 0 8px 22px -10px var(--accent-glow), inset 0 1px 0 rgba(255,255,255,.25);
}
.btn-primary:hover { filter: brightness(1.06); box-shadow: 0 12px 30px -10px var(--accent-glow); transform: translateY(-1px); color: var(--accent-ink); }
.btn-ghost { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-3); border-color: var(--accent); color: var(--text); }
.btn-outline { background: transparent; color: var(--accent); border-color: var(--accent-line); }
.btn-outline:hover { background: var(--accent-soft); color: var(--accent); }
.btn-danger { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); border-color: var(--danger); color: var(--danger); }
.btn-sm { padding: 6px 14px; min-height: 34px; font-size: 13px; }
.btn-lg { padding: 13px 28px; min-height: 50px; font-size: 15.5px; border-radius: 14px; }
.btn-block { width: 100%; }
.btn.loading { pointer-events: none; opacity: .8; }
.btn.loading::after { content: ''; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-top-color: transparent; animation: spin .7s linear infinite; }

/* ---------- forms ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 7px; font-weight: 600; }
.input, select.input, textarea.input {
  width: 100%; padding: 11px 14px; min-height: 44px; background: var(--bg-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); font-family: var(--sans); font-size: 14.5px; transition: border-color .18s, box-shadow .18s;
}
textarea.input { min-height: 96px; resize: vertical; line-height: 1.8; }
.input::placeholder { color: var(--text-faint); }
select.input {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%2362718f' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: left 14px center;
  padding-left: 40px; cursor: pointer;
}
select.input:hover { border-color: var(--accent-line); }
select.input option { background: var(--surface); color: var(--text); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.ltr { direction: ltr; text-align: left; font-family: var(--mono); }
/* Persian placeholders in LTR inputs: show them RTL until the user types */
.input.ltr:placeholder-shown { direction: rtl; text-align: right; font-family: var(--sans); }
.input[aria-invalid="true"] { border-color: var(--danger); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 16px; height: 16px; }
input[type="file"].input { padding: 9px; }
input[type="file"]::file-selector-button { border:0; border-radius:8px; padding:6px 12px; margin-left:10px; background: var(--surface-3); color: var(--text); font-family: var(--sans); cursor:pointer; }
.row { display: flex; gap: 14px; }
.row > * { flex: 1; min-width: 0; }
.hint { font-size: 12px; color: var(--text-faint); margin-top: 6px; line-height: 1.8; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-left: 46px; }
.pw-toggle { position:absolute; left:6px; top:50%; transform:translateY(-50%); width:34px; height:34px; border:0; background:none; color: var(--text-faint); cursor:pointer; border-radius:8px; display:grid; place-items:center; }
.pw-toggle:hover { color: var(--accent); }
.pw-toggle svg { width: 18px; height: 18px; }

/* stepper input */
.qty { display:flex; align-items:stretch; border:1px solid var(--border); border-radius: var(--radius-sm); overflow:hidden; background: var(--bg-2); }
.qty button { width:42px; border:0; background: var(--surface-2); color: var(--text); font-size:18px; cursor:pointer; }
.qty button:hover { background: var(--surface-3); color: var(--accent); }
.qty input { flex:1; min-width:0; border:0; background:transparent; text-align:center; color:var(--text); font-family: var(--mono); font-size:15px; }
.qty input:focus { outline: none; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: right; color: var(--text-faint); font-weight: 700; padding: 11px 14px;
  border-bottom: 1px solid var(--border); font-size: 12px; white-space: nowrap;
}
.table td { padding: 13px 14px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.table td.mono { white-space: nowrap; }
.table tbody tr { transition: background .15s; }
.table tbody tr:hover td { background: var(--accent-soft); }
.table tbody tr:last-child td { border-bottom: none; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items:center; gap:6px; padding: 3px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; line-height: 1.6; white-space: nowrap; }
.badge.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ok) 28%, transparent); }
.badge.warn { background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--warn) 28%, transparent); }
.badge.danger { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--danger) 28%, transparent); }
.badge.info { background: color-mix(in srgb, var(--info) 14%, transparent); color: var(--info); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--info) 28%, transparent); }
.badge.muted { background: var(--surface-2); color: var(--text-dim); box-shadow: inset 0 0 0 1px var(--border); }
.badge .pulse { width:7px; height:7px; border-radius:50%; background: currentColor; box-shadow: 0 0 8px currentColor; animation: pulseDot 1.8s infinite; }

/* ---------- alerts ---------- */
.alert { padding: 13px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 14px; border: 1px solid transparent; line-height: 1.9; }
.alert.error { background: color-mix(in srgb, var(--danger) 9%, transparent); border-color: color-mix(in srgb, var(--danger) 30%, transparent); color: var(--danger); }
.alert.ok { background: color-mix(in srgb, var(--ok) 9%, transparent); border-color: color-mix(in srgb, var(--ok) 30%, transparent); color: var(--ok); }
.alert.info { background: color-mix(in srgb, var(--info) 9%, transparent); border-color: color-mix(in srgb, var(--info) 30%, transparent); color: var(--info); }
.alert.warn { background: color-mix(in srgb, var(--warn) 9%, transparent); border-color: color-mix(in srgb, var(--warn) 30%, transparent); color: var(--warn); }
.alert.muted { background: var(--surface-2); border-color: var(--border); color: var(--text-dim); }
.alert a:not(.btn) { color: inherit; text-decoration: underline; font-weight: 700; }
.alert ul { margin: 6px 0 0; padding-right: 18px; }

.alert.danger { background: color-mix(in srgb, var(--danger) 9%, transparent); border-color: color-mix(in srgb, var(--danger) 30%, transparent); color: var(--danger); }

/* ---------- admin: attention strip, legend, stacked bar, filters ---------- */
.attn { display:grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap:10px; }
.attn-item { display:flex; align-items:center; gap:10px; padding:12px 14px; border-radius: var(--radius-sm);
  background: var(--surface); border:1px solid var(--border); color: var(--text); font-size:13.5px; transition:.18s; }
.attn-item:hover { color: var(--text); transform: translateY(-2px); }
.attn-item b { font-size:18px; }
.attn-item span:not(.kic) { flex:1; color: var(--text-dim); }
.attn-item > svg { color: var(--text-faint); }
.attn-item.danger { border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.attn-item.danger .kic { color: var(--danger); background: color-mix(in srgb, var(--danger) 13%, transparent); }
.attn-item.danger b { color: var(--danger); }
.attn-item.warn { border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.attn-item.warn .kic { color: var(--warn); background: color-mix(in srgb, var(--warn) 13%, transparent); }
.attn-item.warn b { color: var(--warn); }
.legend-dot { width:10px; height:10px; border-radius:3px; display:inline-block; flex-shrink:0; }
.stack-bar { display:flex; height:12px; border-radius:999px; overflow:hidden; background: var(--surface-3); gap:2px; }
.stack-bar span { display:block; height:100%; min-width:4px; }
.filters { display:flex; gap:8px; flex-wrap:wrap; align-items:center; margin-bottom:14px; }
.filters .input { min-height:40px; }
.chip-link { display:inline-flex; align-items:center; gap:6px; padding:6px 13px; border-radius:999px; font-size:13px; font-weight:600;
  border:1px solid var(--border); background: var(--surface-2); color: var(--text-dim); }
.chip-link:hover { color: var(--text); border-color: var(--accent-line); }
.chip-link.on { background: var(--accent-soft); color: var(--text); border-color: var(--accent); }
.chip-link .n { font-family: var(--mono); font-size:11.5px; color: var(--text-faint); }
.cell-user { display:flex; align-items:center; gap:10px; min-width:0; }
.cell-user .avatar { width:32px; height:32px; font-size:13px; }
.cell-user b { display:block; font-size:13.5px; line-height:1.4; }
.cell-user small { display:block; color: var(--text-faint); font-size:12px; }
.row-actions { display:flex; gap:6px; flex-wrap:wrap; justify-content:flex-end; }
.kv { display:grid; grid-template-columns: auto 1fr; gap:6px 14px; font-size:13px; }
.kv dt { color: var(--text-faint); }
.kv dd { margin:0; font-family: var(--mono); word-break: break-all; }
.chat { display:flex; flex-direction:column; gap:12px; }
.msg { max-width: 82%; padding:12px 14px; border-radius:14px; border:1px solid var(--border); background: var(--surface-2); }
.msg.staff { align-self:flex-start; background: var(--accent-soft); border-color: var(--accent-line); }
.msg.customer { align-self:flex-end; }
.msg .m-head { display:flex; justify-content:space-between; gap:12px; font-size:12px; color: var(--text-faint); margin-bottom:6px; }
.msg .m-head b { color: var(--text); }
.msg.staff .m-head b { color: var(--accent); }
.msg .m-body { white-space: pre-wrap; line-height:2; font-size:14px; }
@media (max-width: 640px){ .msg { max-width: 100%; } }

/* ---------- empty state ---------- */
.empty { text-align:center; padding: 38px 16px; }
.empty .e-ic { width:64px; height:64px; border-radius:20px; margin:0 auto 14px; display:grid; place-items:center; background: var(--accent-soft); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent-line); }
.empty .e-ic svg { width:30px; height:30px; }
.empty h4 { margin: 0 0 4px; font-size: 16px; }
.empty p { margin: 0 0 16px; color: var(--text-dim); font-size: 13.5px; }

/* ---------- auth ---------- */
.auth-wrap { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: 1fr; }
.auth-split { display:grid; grid-template-columns: minmax(0,1fr) minmax(0,1.05fr); min-height: 100dvh; }
.auth-side {
  position: relative; overflow: hidden; padding: 48px clamp(28px,4vw,64px);
  display:flex; flex-direction:column; justify-content:space-between; gap: 30px;
  background:
    radial-gradient(520px 360px at 20% 20%, rgba(45,212,191,.16), transparent 70%),
    radial-gradient(520px 360px at 90% 90%, rgba(56,189,248,.14), transparent 70%),
    var(--surface);
  border-left: 1px solid var(--border-soft);
}
.auth-side::before { content:''; position:absolute; inset:0; opacity:.5; pointer-events:none;
  background-image: linear-gradient(var(--border-soft) 1px, transparent 1px), linear-gradient(90deg, var(--border-soft) 1px, transparent 1px);
  background-size: 44px 44px; -webkit-mask-image: radial-gradient(600px 400px at 40% 40%, #000 20%, transparent 75%); mask-image: radial-gradient(600px 400px at 40% 40%, #000 20%, transparent 75%); }
.auth-side > * { position: relative; }
.auth-side h2 { font-size: clamp(26px, 2.8vw, 36px); margin: 0 0 12px; letter-spacing: -.6px; font-weight: 800; }
.auth-side p { color: var(--text-dim); margin: 0; line-height: 2; }
.auth-points { list-style:none; padding:0; margin: 26px 0 0; display:flex; flex-direction:column; gap:12px; }
.auth-points li { display:flex; gap:12px; align-items:center; font-size: 14px; }
.auth-points li i { width:32px; height:32px; border-radius:10px; display:grid; place-items:center; background: var(--accent-soft); color: var(--accent); flex-shrink:0; font-style:normal; }
.auth-points li i svg { width:16px; height:16px; }
.auth-main { display:grid; place-items:center; padding: 32px 20px; }
.auth-card {
  width: 100%; max-width: 440px;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 34px 32px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  position: relative; overflow: hidden;
  animation: riseIn .45s cubic-bezier(.2,.8,.25,1);
  margin: auto;
}
.auth-wrap > .auth-card { margin: 32px auto; align-self: center; }
.auth-card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--grad-accent); }
.auth-card.wide { max-width: 640px; }
.auth-head { text-align: center; margin-bottom: 24px; }
.auth-head .brand-logo { margin: 0 auto 16px; width: 52px; height: 52px; font-size: 22px; border-radius: 16px; }
.auth-head h2, .auth-head h1 { margin: 0 0 6px; font-size: 22px; letter-spacing: -.4px; }
.auth-head p { margin: 0; color: var(--text-dim); font-size: 14px; }
.auth-foot { text-align: center; margin-top: 20px; font-size: 14px; color: var(--text-dim); line-height: 2.2; }
.auth-back { position:absolute; top:18px; left:18px; font-size:13px; color: var(--text-dim); display:inline-flex; align-items:center; gap:6px; }

.divider { display: flex; align-items: center; gap: 12px; color: var(--text-faint); font-size: 12px; margin: 20px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ---------- utilities ---------- */
.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.accent { color: var(--accent); }
.center { text-align: center; }
.mt-0{margin-top:0}.mt-1{margin-top:8px}.mt-2{margin-top:16px}.mt-3{margin-top:24px}.mt-4{margin-top:36px}
.mb-0{margin-bottom:0}.mb-1{margin-bottom:8px}.mb-2{margin-bottom:16px}.mb-3{margin-bottom:24px}
.flex { display: flex; } .between { justify-content: space-between; } .items-center{align-items:center;}
.gap-1{gap:6px;} .gap-2{gap:12px;} .gap-3{gap:18px;} .wrap{flex-wrap:wrap;}
.grow { flex: 1; min-width: 0; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hide-mobile {} .show-mobile { display: none !important; }

@keyframes riseIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from{opacity:0;} to{opacity:1;} }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulseDot { 0%,100%{opacity:1;} 50%{opacity:.4;} }
@keyframes shimmer { 100% { transform: translateX(-100%); } }

.skeleton { position:relative; overflow:hidden; background: var(--surface-2); border-radius: 8px; min-height: 14px; }
.skeleton::after { content:''; position:absolute; inset:0; transform: translateX(100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.05), transparent); animation: shimmer 1.4s infinite; }

/* copy button */
.copyable { display:inline-flex; align-items:center; gap:8px; }
.copy-btn { cursor:pointer; border:1px solid var(--border); background:var(--surface-2);
  color:var(--accent); border-radius:7px; padding:3px 9px; font-size:12px; transition:.15s;
  font-family:var(--sans); flex-shrink:0; }
.copy-btn:hover { background:var(--surface-3); border-color:var(--accent); }

/* ========================================================
   Server list cards
   ======================================================== */
.srv-grid { display:grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
/* `a.card{display:block}` is more specific than a single class — match it so the flex gaps apply */
a.srv-card, .srv-card { display:flex; flex-direction:column; gap:14px; padding:18px 18px 16px; color: inherit; }
.srv-card .sc-foot { margin-top:auto; }
.srv-card:hover { color: inherit; }
.srv-card .sc-top { display:flex; align-items:center; gap:12px; }
.srv-card .os-logo { width:42px; height:42px; border-radius:12px; }
.srv-card .os-logo svg { width:24px; height:24px; }
.srv-card .sc-name { font-weight:800; font-size:15px; line-height:1.4; }
.srv-card .sc-ip { font-family: var(--mono); font-size:13px; color: var(--text-dim); direction:ltr; text-align:right; }
/* one tidy bar with dividers instead of three floating boxes */
.srv-card .sc-specs { display:grid; grid-template-columns: repeat(3,1fr); background: var(--surface-2); border:1px solid var(--border); border-radius:12px; overflow:hidden; }
.srv-card .sc-specs > div { padding:9px 6px; text-align:center; min-width:0; }
.srv-card .sc-specs > div + div { border-right:1px solid var(--border); }
.srv-card .sc-specs b { display:block; font-family: var(--mono); font-size:14.5px; line-height:1.5; }
.srv-card .sc-specs span { display:block; font-size:11.5px; color: var(--text-faint); line-height:1.5; }
.srv-card .sc-top .badge { align-self:flex-start; }
.srv-card .sc-foot { display:flex; align-items:center; justify-content:space-between; gap:8px; font-size:12.5px; color: var(--text-faint); border-top:1px dashed var(--border); padding-top:12px; }
.status-dot { width:9px; height:9px; border-radius:50%; background: var(--text-faint); display:inline-block; flex-shrink:0; }
.status-dot.on { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.status-dot.off { background: var(--danger); }
.status-dot.wait { background: var(--warn); animation: pulseDot 1.2s infinite; }

.toolbar { display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin-bottom: 16px; }
.toolbar .input { min-height: 40px; }
.seg { display:inline-flex; gap:3px; padding:4px; background: var(--surface-2); border:1px solid var(--border); border-radius: 12px; }
.seg button, .seg a { border:0; background:none; color: var(--text-dim); font: 600 13px var(--sans); padding: 6px 14px; border-radius: 9px; cursor:pointer; }
.seg .on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ========================================================
   Server Management
   ======================================================== */
.srv-hero {
  background: radial-gradient(520px 200px at 100% 0%, var(--accent-soft), transparent 70%), var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px 24px; margin-bottom: 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.srv-hero::before { content:''; position:absolute; inset:0 0 0 auto; width:4px; background: var(--grad-accent); }
.srv-hero .id { display:flex; align-items:center; gap:14px; min-width:0; }
.srv-hero .dot { width:12px; height:12px; border-radius:50%; flex-shrink:0; background: var(--text-faint); }
.srv-hero .dot.on { background: var(--ok); box-shadow:0 0 16px var(--ok), 0 0 0 4px color-mix(in srgb, var(--ok) 16%, transparent); }
.srv-hero .dot.off { background: var(--danger); box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 14%, transparent); }
.srv-hero .dot.unknown { background: var(--text-faint); }
.srv-hero h1 { margin:0; font-size: 22px; letter-spacing:-.4px; }
.srv-hero .meta { color: var(--text-dim); font-size: 13px; margin-top:2px; }
.srv-hero .ip-big { font-family: var(--mono); font-size: 20px; color: var(--accent); direction:ltr; }

.srv-hero .os-logo { border-radius: 15px; }
.srv-hero .os-logo svg { width: 58%; height: 58%; }
.srv-hero h1 .badge { font-size: 12px; font-weight: 700; }
.hero-ip { text-align: left; }
/* power + console actions, docked at the bottom of the server hero */
.hero-actions { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 8px;
  padding-top: 16px; border-top: 1px dashed var(--border); }
.hact { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px;
  border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; transition: .16s; white-space: nowrap; }
.hact svg { flex-shrink: 0; display: block; }
.hact:hover:not(:disabled) { border-color: var(--accent); background: var(--surface-3); transform: translateY(-1px); }
.hact.on:hover:not(:disabled) { border-color: var(--ok); color: var(--ok); }
.hact.off:hover:not(:disabled), .hact.kill:hover:not(:disabled) { border-color: var(--danger); color: var(--danger); }
.hact.kill { color: color-mix(in srgb, var(--danger) 80%, var(--text)); }
.hact.vnc { margin-inline-start: auto; background: var(--grad-accent); color: var(--accent-ink); border: 0;
  box-shadow: 0 6px 18px -8px var(--accent-glow); }
/* same specificity as .hact:hover:not(:disabled) + .vnc, so the gradient isn't
   replaced by the grey hover surface (which left dark text on a dark button) */
.hact.vnc:hover:not(:disabled) { background: var(--grad-accent); color: var(--accent-ink); border: 0;
  filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 10px 24px -8px var(--accent-glow); }
.hact:disabled { opacity: .55; cursor: progress; }
.hact.busy svg { animation: spin 1s linear infinite; }
.hact:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hero-msg { flex-basis: 100%; margin-top: -8px; font-size: 13px; }
.hero-msg:has(#powerMsg:empty) { display: none; }
.spec-grid { display:grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap:10px; }
.spec-tile { display:flex; align-items:center; gap:12px; padding:12px 14px; border-radius: var(--radius-sm);
  background: var(--surface); border:1px solid var(--border); min-width:0; }
.spec-tile > div { min-width:0; display:flex; flex-direction:column; }
.spec-tile span:not(.kic) { font-size:12px; color: var(--text-faint); line-height:1.6; }
.spec-tile b { font-family: var(--mono); font-size:14.5px; line-height:1.5; white-space:nowrap; }
@media (max-width: 560px){
  .spec-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .hero-ip { text-align: right; width: 100%; padding-top: 12px; border-top: 1px dashed var(--border); }
}
/* section titles with a leading icon: keep icon and text on one baseline */
/* icon + title side by side - only when there IS an icon, so centred titles
   (empty states, dialogs) keep their text-align */
.card h3:has(> svg) { display:flex; align-items:center; gap:8px; }
.card h3 > svg { flex-shrink:0; color: var(--accent); }
.spec-row { display:flex; gap:8px; flex-wrap:wrap; margin-top:4px; }
.spec-chip {
  background: var(--surface-2); border:1px solid var(--border); border-radius:999px;
  padding:5px 13px; font-size:13px; display:inline-flex; align-items:center; gap:7px;
}
.spec-chip b { font-family: var(--mono); color: var(--text); }
.spec-chip .ic { color: var(--accent); display:inline-flex; align-items:center; }
.spec-chip .ic svg { display:block; }

.tabs {
  display:flex; gap:4px; margin-bottom:20px; overflow-x:auto; scrollbar-width:none;
  background: var(--surface-2); border:1px solid var(--border);
  padding:5px; border-radius: 13px; width: max-content; max-width: 100%;
}
.tabs::-webkit-scrollbar { display:none; }
.tab {
  padding:8px 16px; cursor:pointer; color:var(--text-dim); font-size:13.5px; font-weight:700;
  border:0; background:none; border-radius: 9px; transition:.18s; font-family:inherit; white-space:nowrap; flex-shrink:0;
}
.tab:hover { color:var(--text); }
.tab.active { color: var(--accent-ink); background: var(--grad-accent); box-shadow: 0 6px 16px -8px var(--accent-glow); }
.tab-panel { display:none; }
.tab-panel.active { display:block; animation: riseIn .3s ease; }

.power-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:12px; }
.power-btn {
  display:flex; flex-direction:column; align-items:center; gap:8px; padding:16px 8px;
  border:1px solid var(--border); border-radius:var(--radius-sm); background:var(--surface-2);
  color:var(--text); cursor:pointer; transition:.18s; font-family:inherit; font-size:13px; font-weight:700;
}
.power-btn .pic { display:inline-flex; align-items:center; justify-content:center; }
.power-btn .pic svg { display:block; }
.power-btn:hover { border-color:var(--accent); background:var(--surface-3); transform:translateY(-2px); }
.power-btn.on:hover { border-color:var(--ok); color:var(--ok); }
.power-btn.off:hover, .power-btn.kill:hover { border-color:var(--danger); color:var(--danger); }
.power-btn.vnc { background: var(--grad-accent); color:var(--accent-ink); border:0; box-shadow: 0 6px 18px -8px var(--accent-glow); }
.power-btn.vnc:hover { filter:brightness(1.06); transform:translateY(-2px); color: var(--accent-ink); }

.gauge-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:18px; }
.gauge { text-align:center; }
.gauge svg { transform:rotate(-90deg); }
.gauge .track { stroke: var(--surface-3); }
.gauge .fill { stroke-linecap:round; transition:stroke-dashoffset .7s ease; }
.gauge .pct { font-family:var(--mono); font-size:18px; font-weight:700; }
.gauge .lbl { color:var(--text-dim); font-size:13px; margin-top:6px; }
.gauge .sub { color:var(--text-faint); font-size:12px; font-family:var(--mono); direction:ltr; }

.meter { background:var(--surface-3); border-radius:999px; height:9px; overflow:hidden; }
.meter > span { display:block; height:100%; border-radius:999px; transition:width .7s ease; background: var(--grad-accent); }
.meter.warn > span { background: var(--warn); }
.meter.danger > span { background: var(--danger); }

.input-row { display:flex; gap:8px; align-items:stretch; }
.input-row .input { flex:1; min-width:0; }
.icon-btn {
  border:1px solid var(--border); background:var(--surface-2); color:var(--accent);
  border-radius:var(--radius-sm); padding:0 14px; cursor:pointer; font-size:16px; flex-shrink:0;
  transition:.15s; display:inline-flex; align-items:center; justify-content:center; min-height:44px;
}
.icon-btn svg { display:block; }
.icon-btn:hover { background:var(--surface-3); border-color:var(--accent); }

.ip-list { display:flex; flex-direction:column; gap:8px; }
.ip-item {
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  background:var(--surface-2); border:1px solid var(--border); border-radius:var(--radius-sm);
  padding:10px 14px; font-family:var(--mono); direction:ltr;
}
.ip-item .tag { font-family:var(--sans); font-size:11px; color:var(--text-faint); }
.ip-item.primary { border-color: var(--accent-line); background: var(--accent-soft); }
.ip-item.primary .tag { color: var(--accent); }
.inline-msg { font-size:13px; margin-top:8px; min-height:18px; }

/* ---------- order flow ---------- */
.steps-bar { display:flex; gap:8px; margin-bottom:18px; overflow-x:auto; scrollbar-width:none; }
.steps-bar::-webkit-scrollbar { display:none; }
.steps-bar .st { display:flex; align-items:center; gap:8px; padding:7px 14px 7px 16px; border-radius:999px; font-size:13px; font-weight:700; color: var(--text-faint); background: var(--surface-2); border:1px solid var(--border); white-space:nowrap; }
.steps-bar .st i { width:22px; height:22px; border-radius:50%; display:grid; place-items:center; font-style:normal; font-size:12px; background: var(--surface-3); }
.steps-bar .st.done { color: var(--text); border-color: var(--accent-line); }
.steps-bar .st.done i { background: var(--grad-accent); color: var(--accent-ink); }

.choice-grid { display:grid; grid-template-columns: repeat(auto-fill, minmax(190px,1fr)); gap:10px; }
.choice {
  position:relative; display:flex; flex-direction:column; gap:4px; padding:14px 16px;
  background: var(--surface-2); border:1.5px solid var(--border); border-radius: var(--radius-sm);
  cursor:pointer; transition: border-color .18s, background .18s, transform .18s; text-align:right; color: var(--text);
  font-family: var(--sans);
}
.choice:hover { border-color: var(--accent-line); transform: translateY(-1px); }
.choice:disabled { opacity: .5; cursor: not-allowed; transform: none; border-style: dashed; }
.choice.selected, .choice[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px var(--accent-soft); }
.choice { padding-left: 42px; } /* keep text clear of the check circle */
.choice .c-title { font-weight:800; font-size:14.5px; display:flex; align-items:center; gap:10px; line-height:1.5; }
.choice .c-sub { font-size:12.5px; color: var(--text-dim); }
.choice .c-check { position:absolute; top:12px; left:12px; width:20px; height:20px; border-radius:50%; border:2px solid var(--border); display:grid; place-items:center; }
.choice.selected .c-check, .choice[aria-checked="true"] .c-check { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.choice .c-check svg { width:12px; height:12px; opacity:0; }
.choice.selected .c-check svg, .choice[aria-checked="true"] .c-check svg { opacity:1; }
.os-logo { width:30px; height:30px; border-radius:9px; display:grid; place-items:center; flex-shrink:0; background:#fff; box-shadow: 0 1px 2px rgba(0,0,0,.25), inset 0 0 0 1px rgba(13,23,38,.08); }
.os-logo svg { width:64%; height:64%; display:block; }

.plan-grid { display:grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap:12px; }
.plan-card {
  position:relative; display:flex; flex-direction:column; gap:12px;
  background:var(--surface-2); border:1.5px solid var(--border); border-radius:var(--radius);
  padding:16px 16px 14px; cursor:pointer; transition: border-color .18s, transform .18s, background .18s;
}
.plan-card:hover { border-color:var(--accent-line); transform: translateY(-2px); }
.plan-card.selected { border-color:var(--accent); background:var(--accent-soft); box-shadow:0 0 0 3px var(--accent-soft); }
.plan-card .pc-title { display:inline-flex; align-items:center; gap:8px; min-width:0; flex-wrap:wrap; }
/* most-popular plan: accented card + a pill beside the plan name */
.plan-card.popular { border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  background: radial-gradient(260px 110px at 50% -30%, var(--accent-soft), transparent 70%), var(--surface-2); }
.plan-card.popular.selected { background: var(--accent-soft); }
.plan-card .pc-hot { display:inline-flex; align-items:center; gap:4px; padding:3px 9px 3px 8px; border-radius:999px; white-space:nowrap;
  font-size:11px; font-weight:800; line-height:1.2; color:var(--accent-ink); background:var(--grad-accent);
  box-shadow: 0 4px 12px -6px var(--accent-glow); }
.plan-card .pc-hot svg { display:block; flex-shrink:0; }
.plan-card .pc-left { display:flex; align-items:center; gap:14px; }
.plan-card .pc-head { display:flex; align-items:center; justify-content:space-between; }
.plan-card .pc-code { font-family:var(--mono); font-weight:800; font-size:18px; color:var(--accent); }
.plan-card .pc-specs { font-size:13px; color:var(--text-dim); line-height:1.6; }
.plan-card .pc-list { list-style:none; margin:0; padding:0; display:grid; grid-template-columns:1fr 1fr; gap:6px 10px; font-size:12.5px; color: var(--text-dim); }
.plan-card .pc-list b { color: var(--text); font-family: var(--mono); }
.plan-card .pc-price { border-top:1px dashed var(--border); padding-top:10px; display:flex; align-items:baseline; gap:6px; }
.plan-card .pc-price b { font-size:18px; font-family: var(--mono); }
.plan-card .pc-price span { font-size:12px; color: var(--text-faint); }
.plan-card .pc-radio {
  width:20px; height:20px; border-radius:50%; border:2px solid var(--border);
  flex-shrink:0; position:relative; transition:.18s;
}
.plan-card.selected .pc-radio { border-color:var(--accent); }
.plan-card.selected .pc-radio::after { content:''; position:absolute; inset:3px; border-radius:50%; background: var(--accent); }

.summary-line { display:flex; justify-content:space-between; gap:10px; font-size:13.5px; margin-bottom:8px; }
.summary-line span:first-child { color: var(--text-dim); }
.summary-total { display:flex; justify-content:space-between; align-items:baseline; font-size:15px; padding-top:12px; border-top:1px dashed var(--border); margin-top:8px; }
.summary-total b.mono { font-size:22px; color: var(--accent); }

/* mobile sticky checkout bar */
.checkout-bar { display:none; }

/* ---------- logs & backup lists ---------- */
.log-list { display:flex; flex-direction:column; gap:7px; max-height:340px; overflow-y:auto; }
.log-row {
  display:flex; justify-content:space-between; align-items:center; gap:10px;
  padding:10px 13px; background:var(--surface-2); border:1px solid var(--border);
  border-radius:var(--radius-sm); font-size:13px;
}
.log-row .hint { font-size:12px; margin:0; }

/* ---------- notifications ---------- */
.notif-row { display:flex; gap:13px; align-items:flex-start; padding:15px 16px; border-bottom:1px solid var(--border-soft); }
.notif-row:last-child { border-bottom:none; }
.notif-row.unread { background: var(--accent-soft); }
.notif-ic { flex-shrink:0; width:40px; height:40px; border-radius:12px; display:flex; align-items:center; justify-content:center; }
.notif-body { flex:1; min-width:0; }
.notif-info    { background: color-mix(in srgb, var(--info) 14%, transparent);  color: var(--info); }
.notif-success { background: color-mix(in srgb, var(--ok) 14%, transparent);  color: var(--ok); }
.notif-warning { background: color-mix(in srgb, var(--warn) 14%, transparent);  color: var(--warn); }
.notif-danger  { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.pager { display:flex; align-items:center; justify-content:center; gap:14px; }
.pager-info { font-size:13px; color:var(--text-dim); }

/* ---------- quick actions ---------- */
.qa-grid { display:grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap:12px; }
.qa { display:flex; align-items:center; gap:12px; padding:14px; border-radius: var(--radius); background: var(--surface); border:1px solid var(--border); color: var(--text); transition:.18s; }
.qa:hover { border-color: var(--accent-line); color: var(--text); transform: translateY(-2px); }
.qa i { width:38px; height:38px; border-radius:11px; display:grid; place-items:center; background: var(--accent-soft); color: var(--accent); flex-shrink:0; }
.qa i svg { width:18px; height:18px; }
.qa b { display:block; font-size:14px; }
.qa span { font-size:12px; color: var(--text-faint); }

.list { display:flex; flex-direction:column; }
.list-item { display:flex; align-items:center; gap:12px; padding:12px 4px; border-bottom:1px solid var(--border-soft); color: var(--text); }
.list-item:last-child { border-bottom:0; }
a.list-item:hover { color: var(--text); background: var(--accent-soft); border-radius: 10px; }

/* ---------- command palette ---------- */
.cmdk { position:fixed; inset:0; z-index:200; display:none; align-items:flex-start; justify-content:center; padding: 12vh 16px 16px; background: rgba(3,6,12,.55); backdrop-filter: blur(4px); }
.cmdk.open { display:flex; animation: fadeIn .15s ease; }
.cmdk-box { width:100%; max-width:560px; background: var(--surface); border:1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow); overflow:hidden; }
.cmdk-in { display:flex; align-items:center; gap:10px; padding: 0 16px; border-bottom:1px solid var(--border); }
.cmdk-in svg { width:18px; height:18px; color: var(--text-faint); flex-shrink:0; }
.cmdk-in input { flex:1; border:0; background:transparent; color: var(--text); padding: 16px 0; font-size:15px; outline:none; font-family: var(--sans); }
.cmdk-list { max-height: 50vh; overflow-y:auto; padding: 6px; }
.cmdk-item { display:flex; align-items:center; gap:12px; padding:10px 12px; border-radius:10px; color: var(--text); cursor:pointer; font-size:14px; }
.cmdk-item .ci { width:30px; height:30px; border-radius:9px; display:grid; place-items:center; background: var(--surface-2); color: var(--accent); flex-shrink:0; }
.cmdk-item .ci svg { width:15px; height:15px; }
.cmdk-item small { margin-right:auto; color: var(--text-faint); font-size:11.5px; }
.cmdk-item.on, .cmdk-item:hover { background: var(--accent-soft); color: var(--text); }
.cmdk-empty { padding: 26px; text-align:center; color: var(--text-faint); font-size:13.5px; }
.cmdk-foot { display:flex; gap:14px; padding: 8px 14px; border-top:1px solid var(--border); font-size:11.5px; color: var(--text-faint); }
.cmdk-foot kbd { background: var(--surface-2); border:1px solid var(--border); border-radius:5px; padding:0 5px; }

/* ---------- toasts ---------- */
.toasts { position:fixed; bottom:20px; left:50%; transform:translateX(-50%); z-index:9999; display:flex; flex-direction:column; gap:8px; align-items:center; pointer-events:none; width: max-content; max-width: calc(100vw - 32px); }
.toast { pointer-events:auto; display:flex; align-items:center; gap:10px; padding:10px 18px; border-radius:999px; font-size:14px; font-weight:700; background: var(--surface); border:1px solid var(--border); color: var(--text); box-shadow: var(--shadow); animation: riseIn .25s ease; }
.toast.ok { border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.toast.ok::before { content:'✓'; color: var(--ok); }
.toast.error { border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.toast.error::before { content:'!'; color: var(--danger); font-weight:900; }
#copyToast { display:none !important; }

/* ---------- modal ---------- */
.modal { position:fixed; inset:0; z-index:150; display:none; align-items:center; justify-content:center; padding:16px; background: rgba(3,6,12,.6); backdrop-filter: blur(3px); }
.modal.open { display:flex; animation: fadeIn .15s ease; }
.modal .card { width:100%; max-width:460px; box-shadow: var(--shadow); }

/* ---------- mobile bottom nav ---------- */
.bottom-nav { display:none; }

/* ---------- scrollbar ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); background-clip: padding-box; }

/* ---------- legacy landing bits (kb pages etc.) ---------- */
.hero-badge { display:inline-flex; align-items:center; gap:8px; background: var(--surface); border:1px solid var(--border); padding:6px 14px; border-radius:999px; font-size:13px; color:var(--text-dim); margin-bottom:20px; }
.hero-badge .dot { width:7px; height:7px; border-radius:50%; background:var(--ok); box-shadow:0 0 10px var(--ok); animation: pulseDot 2s infinite; }
.hero-title { font-size:48px; margin:0 0 18px; letter-spacing:-1.4px; line-height:1.25; font-weight:800; }
.hero-grad { background: var(--grad-accent); -webkit-background-clip:text; background-clip:text; -webkit-text-fill-color:transparent; }
.feature-card { text-align:right; transition:transform .2s, border-color .2s, box-shadow .2s; }
.feature-card:hover { transform:translateY(-4px); border-color: var(--accent-line); box-shadow: var(--shadow-glow); }
.feature-ic { width:46px; height:46px; border-radius:14px; display:grid; place-items:center; background: var(--grad-accent-soft); color: var(--accent); margin-bottom:14px; box-shadow: inset 0 0 0 1px var(--accent-line); }
.feature-ic svg { width:24px; height:24px; }
.stat-strip { display:grid; grid-template-columns:repeat(3,1fr); gap:14px; margin-top:56px; }
.stat-strip .stat { background: var(--surface); border:1px solid var(--border); border-radius: var(--radius); padding:18px 12px; text-align:center; }
.stat-strip b { display:block; font-size:24px; font-weight:800; font-family:var(--mono); color: var(--accent); }
.stat-strip span { font-size:12.5px; color:var(--text-dim); }
.landing-nav { display:flex; align-items:center; justify-content:space-between; gap:14px; max-width:1160px; margin:0 auto; padding:18px 20px 0; }
.landing-nav .brand { padding: 0; }

/* ---------- page enter ---------- */
main.content > .content-inner > * { animation: riseIn .35s cubic-bezier(.2,.8,.25,1) both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* ======================= responsive ======================= */
@media (min-width: 981px) and (max-width: 1200px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .qa-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid-aside { grid-template-columns: minmax(0,1fr) 320px; }
}
@media (max-width: 980px) {
  .mobilebar {
    display:flex; align-items:center; justify-content:space-between; gap:12px;
    position:sticky; top:0; z-index:60;
    background: var(--bg);
    background: color-mix(in srgb, var(--bg) 84%, transparent);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border-bottom:1px solid var(--border-soft);
    padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top));
  }
  .mobilebar .mb-actions { display:flex; gap:8px; }
  .menu-btn { display:inline-flex; }
  .sidebar {
    position:fixed; inset:0 0 0 auto; right:0; left:auto;
    width:min(300px, 86vw); height:100dvh; z-index:100;
    transform: translateX(100%); transition: transform .3s var(--ease);
    background: var(--surface); border-left: none; border-right: 1px solid var(--border-soft);
    padding-top: 14px; visibility: hidden;
  }
  body.nav-open .sidebar { transform: translateX(0); box-shadow: var(--shadow); visibility: visible; }
  body.nav-open { overflow: hidden; }
  .menu-close {
    display:inline-flex; align-items:center; justify-content:center;
    width:34px; height:34px; border-radius:10px; cursor:pointer;
    background:var(--surface-2); color:var(--text-dim); border:1px solid var(--border);
  }
  .layout { flex-direction: column; }
  .content { padding: 16px 16px calc(84px + env(safe-area-inset-bottom)); }
  /* minmax(0,1fr), not 1fr: a plain 1fr track can't shrink below its widest
     child, so one long word / nowrap row would push the page sideways */
  .grid-3, .grid-4, .grid-2, .grid-aside { grid-template-columns: minmax(0, 1fr); }
  /* inline-styled grids in older templates must collapse too */
  .grid[style*="grid-template-columns"] { grid-template-columns: minmax(0, 1fr) !important; }
  .card[style*="sticky"] { position: static !important; }
  .qa-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .topbar { position: static; padding-top: 4px; margin-bottom: 16px; }
  .topbar h1 { font-size: 20px; }
  .topbar .topbar-actions .theme-btn, .topbar .topbar-actions .bell-btn, .topbar .search-trigger { display: none; }
  .stat-strip { grid-template-columns: 1fr; }
  .hero-title { font-size: 34px; }
  .hide-mobile { display: none !important; }
  .show-mobile { display: initial !important; }

  /* tables scroll horizontally inside cards instead of breaking the page */
  .card > .table, .card > form > .table, .card .table:not(.table-wrap .table) { display:block; overflow-x:auto; -webkit-overflow-scrolling: touch; }
  .table th, .table td { white-space: nowrap; }

  .bottom-nav {
    display:grid; grid-template-columns: repeat(5, 1fr);
    position: fixed; inset: auto 0 0 0; z-index: 70;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-nav a { display:flex; flex-direction:column; align-items:center; gap:2px; padding:6px 2px; border-radius:12px; color: var(--text-faint); font-size: 11px; font-weight: 600; position: relative; }
  .bottom-nav a svg { width: 21px; height: 21px; }
  .bottom-nav a.active { color: var(--accent); }
  .bottom-nav a.fab span.fi { width:46px; height:46px; margin-top:-22px; border-radius:15px; display:grid; place-items:center; background: var(--grad-accent); color: var(--accent-ink); box-shadow: 0 10px 24px -8px var(--accent-glow); }
  .bottom-nav .bn-badge { position:absolute; top:2px; left:calc(50% - 20px); min-width:16px; height:16px; border-radius:8px; background: var(--danger); color:#fff; font-size:9.5px; display:grid; place-items:center; padding: 0 4px; }

  .checkout-bar {
    display:flex; align-items:center; justify-content:space-between; gap:12px;
    position: fixed; inset: auto 0 calc(62px + env(safe-area-inset-bottom)) 0; z-index: 65;
    background: var(--surface); border-top: 1px solid var(--border); padding: 10px 16px;
    box-shadow: 0 -10px 30px -12px rgba(0,0,0,.4);
  }
  .checkout-bar b { font-family: var(--mono); font-size: 17px; color: var(--accent); }
  .auth-split { grid-template-columns: 1fr; }
  .auth-side { display: none; }
}
@media (max-width: 880px) {
  .power-grid { grid-template-columns: repeat(2,1fr); }
  /* three compact rings side by side instead of three tall rows */
  .gauge-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .gauge svg { width: 100%; max-width: 92px; height: auto; }
  .gauge .pct { font-size: 15px; }
  .gauge .lbl { font-size: 12px; margin-top: 2px; }
  .gauge .sub { font-size: 10.5px; }
}
@media (max-width: 560px) {
  .row { flex-direction: column; gap: 0; }
  .card { padding: 18px 16px; }
  .auth-card { padding: 28px 20px; border-radius: 18px; }
  .srv-grid { grid-template-columns: 1fr; }
  .srv-hero { padding: 18px; }
  .srv-hero .ip-big { font-size: 17px; }
  .hero-actions { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); }
  .hact { justify-content: center; }
  .hact.vnc { grid-column: 1 / -1; margin: 0; }
  .kpi .value { font-size: 22px; }
  .btn { white-space: normal; }
  .toolbar { gap: 8px; }
  .toolbar > .input { flex: 1 1 100%; max-width: none !important; }
  .toolbar > .seg { flex: 1 1 0; min-width: 0; display: flex; }
  .toolbar > .seg button { padding-inline: 6px; }
  .toolbar > .seg button { flex: 1; }
  .toolbar > .btn { flex: 0 0 auto; margin-right: 0 !important; }
}


/* ---------------- responsive safety net (phones / tablets) ---------------- */
.grid > *, .grid-aside > *, .row > * { min-width: 0; }
canvas, img, video { max-width: 100%; }
.content { min-width: 0; }
@media (max-width: 380px) {
  .landing-nav { gap: 8px; padding-inline: 12px; }
  .landing-nav .theme-btn, .lp-cta .theme-btn { display: none; }
  .landing-nav .btn-sm, .lp-cta .btn-sm { padding-inline: 10px; }
  .lp-nav .brand-name { font-size: 15px; }
}

/* KPI grids: two compact cards per row on phones/tablets instead of one tall card each */
@media (max-width: 980px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .grid-4 > .card.kpi { padding: 14px; }
  .grid-4 .kpi .value { font-size: 20px; margin-top: 6px; letter-spacing: -.5px; }
  .grid-4 .kpi .label { font-size: 12px; }
}
@media (max-width: 360px) { .grid-4 { grid-template-columns: minmax(0, 1fr); } }

/* ---------------- touch screens: comfortable tap targets (≈40–44px) ----------------
   Only for coarse pointers, so the desktop keeps its compact density. */
@media (pointer: coarse) {
  .btn-sm, .chip-link, .an-range a, .tab { min-height: 40px; }
  .btn-sm { padding-block: 8px; }
  .icon-square, .copy-btn, .menu-btn, .theme-btn, .bell-btn { min-width: 40px; min-height: 40px; }
  .btn:not(.btn-sm) { min-height: 44px; }
  input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; }
  .input, select.input { min-height: 44px; }
  .an-range a { display: inline-flex; align-items: center; }
  /* purchase page: sort chips + quantity stepper */
  .seg button { min-height: 40px; }
  .qty button, .stepper button { min-width: 44px; min-height: 44px; }
  .qty input, .stepper input { min-height: 44px; }
}

/* the stepper input drops its own outline: show focus on the whole control instead */
.qty:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* headings shifted one level for a correct outline (h1 → h2 → h3, axe heading-order):
   card titles are now <h2>, sub-titles <h3> — same look as before */
.card h2 { margin: 0 0 16px; font-size: 15.5px; font-weight: 800; letter-spacing: -.2px; }
.card h2:has(> svg) { display: flex; align-items: center; gap: 8px; }
.card h2 > svg { flex-shrink: 0; color: var(--accent); }
.card-head h2 { margin: 0; }
.empty h2, .empty h3, .empty h4 { margin: 0 0 4px; font-size: 16px; display: block; text-align: center; }

/* links inside running text are underlined, not just coloured (WCAG 1.4.1) */
:where(p, .sub, .hint, .muted, .an-note, .alert, li, dd) > a:not(.btn):not(.chip-link):not(.brand) {
  text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px;
}
