/* AgamiCloud client panel — design tokens, layout, components */
:root {
  --bg: #0a0d14;
  --bg-2: #0e121b;
  --surface: #121723;
  --surface-2: #171d2b;
  --surface-3: #1e2536;
  --border: #242c3f;
  --border-strong: #313b52;
  --text: #e8ecf5;
  --text-2: #aab3c7;
  --text-3: #6f7a92;
  --accent: #7c6cff;
  --accent-2: #5b8cff;
  --accent-soft: rgba(124, 108, 255, 0.14);
  --accent-text: #b4abff;
  --cyan: #38d6f5;
  --green: #34d399;
  --green-soft: rgba(52, 211, 153, 0.13);
  --amber: #fbbf24;
  --amber-soft: rgba(251, 191, 36, 0.13);
  --red: #f87171;
  --red-soft: rgba(248, 113, 113, 0.13);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.5);
  --radius: 14px;
  --radius-sm: 9px;
  --sidebar: 256px;
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, 'JetBrains Mono', 'SFMono-Regular', Menlo, Consolas, monospace;
  --chart-1: #7c6cff;
  --chart-2: #38d6f5;
  color-scheme: dark;
}

:root[data-theme='light'] {
  --bg: #f4f6fb;
  --bg-2: #eef1f8;
  --surface: #ffffff;
  --surface-2: #f7f8fc;
  --surface-3: #eef1f7;
  --border: #e1e5ef;
  --border-strong: #cfd5e3;
  --text: #121826;
  --text-2: #4a5468;
  --text-3: #8590a6;
  --accent: #5b4dff;
  --accent-2: #3f74ff;
  --accent-soft: rgba(91, 77, 255, 0.1);
  --accent-text: #4a3de0;
  --cyan: #0ea5c6;
  --green: #059669;
  --green-soft: rgba(5, 150, 105, 0.1);
  --amber: #b7791f;
  --amber-soft: rgba(217, 119, 6, 0.12);
  --red: #dc2626;
  --red-soft: rgba(220, 38, 38, 0.09);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 6px 20px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 24px 64px rgba(16, 24, 40, 0.18);
  --chart-1: #5b4dff;
  --chart-2: #0ea5c6;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--accent-text); 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; }
::selection { background: var(--accent-soft); }
svg { flex-shrink: 0; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  padding: 18px 14px;
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 22px; font-weight: 700; font-size: 16px; letter-spacing: -0.01em; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--cyan));
  box-shadow: 0 6px 18px rgba(124, 108, 255, 0.35);
  color: #fff;
}
.brand small { display: block; font-size: 11px; font-weight: 500; color: var(--text-3); letter-spacing: 0.02em; }
.nav-section { margin: 18px 10px 6px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; margin: 2px 0; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent-text); }
.nav a .badge { margin-left: auto; }
.nav a svg { width: 18px; height: 18px; opacity: 0.9; }
.sidebar-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius-sm); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  background: linear-gradient(135deg, #3b3f8f, #1f6f8b); color: #fff; font-weight: 700; font-size: 13px;
}
.user-chip .meta { min-width: 0; flex: 1; }
.user-chip .meta b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip .meta span { display: block; font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 32px; min-height: 64px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar .crumbs { display: flex; align-items: center; gap: 8px; color: var(--text-3); font-size: 13px; min-width: 0; }
.topbar .crumbs a { color: var(--text-3); }
.topbar .crumbs b { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1; }
.btn.menu-btn { display: none; }
.content { padding: 28px 32px 64px; max-width: 1320px; width: 100%; margin: 0 auto; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 26px; letter-spacing: -0.02em; font-weight: 700; }
.page-head p { margin: 4px 0 0; color: var(--text-2); }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- components ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head h2, .card-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.card-head p { margin: 2px 0 0; color: var(--text-3); font-size: 13px; }
.card-body { padding: 20px; }
.stack > * + * { margin-top: 18px; }

.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-auto { grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 15px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  font-weight: 550; cursor: pointer; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, transform 0.05s, opacity 0.15s;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; color: #fff; box-shadow: 0 4px 14px rgba(124, 108, 255, 0.3); }
.btn-primary:hover { background: linear-gradient(135deg, var(--accent), var(--accent-2)); filter: brightness(1.08); }
.btn-success { background: var(--green-soft); border-color: transparent; color: var(--green); }
.btn-success:hover { background: color-mix(in srgb, var(--green) 22%, transparent); }
.btn-danger { background: var(--red-soft); border-color: transparent; color: var(--red); }
.btn-danger:hover { background: color-mix(in srgb, var(--red) 22%, transparent); }
.btn-warn { background: var(--amber-soft); border-color: transparent; color: var(--amber); }
.btn-warn:hover { background: color-mix(in srgb, var(--amber) 22%, transparent); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-sm { height: 31px; padding: 0 11px; font-size: 13px; }
.btn-icon { width: 38px; padding: 0; }
.btn-sm.btn-icon { width: 31px; }
.btn-block { width: 100%; }
.btn.loading { pointer-events: none; opacity: 0.75; }
.btn.loading::before { content: ''; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite; }

.pill {
  display: inline-flex; align-items: center; gap: 7px;
  height: 26px; padding: 0 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
  background: var(--surface-3); color: var(--text-2);
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill-running { background: var(--green-soft); color: var(--green); }
.pill-running .dot { box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 25%, transparent); animation: pulse 2s infinite; }
.pill-stopped { background: var(--red-soft); color: var(--red); }
.pill-paused, .pill-warn { background: var(--amber-soft); color: var(--amber); }
.pill-info { background: var(--accent-soft); color: var(--accent-text); }
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; font-size: 11px; font-weight: 700; background: var(--accent); color: #fff; }

.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.row { display: flex; align-items: center; gap: 10px; }
.row-wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.gap-lg { gap: 18px; }
.mt { margin-top: 16px; }
.mt-lg { margin-top: 26px; }
.hidden { display: none !important; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* forms */
.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-size: 13px; font-weight: 550; color: var(--text-2); margin-bottom: 6px; }
.field .hint { display: block; margin-top: 6px; font-size: 12px; color: var(--text-3); }
.input, select.input, textarea.input {
  width: 100%; height: 40px; padding: 0 12px;
  background: var(--bg-2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
textarea.input { height: auto; min-height: 110px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
textarea.input.mono { font-family: var(--mono); font-size: 12.5px; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder { color: var(--text-3); }
.input-group { display: flex; gap: 8px; }
.input-group .input { flex: 1; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; margin-bottom: 14px; }
.check input { width: 17px; height: 17px; accent-color: var(--accent); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0 14px; }
.form-error { background: var(--red-soft); color: var(--red); padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 14px; }

/* switch */
.switch { position: relative; display: inline-block; width: 40px; height: 23px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--border-strong); border-radius: 999px; cursor: pointer; transition: 0.2s; }
.switch span::before { content: ''; position: absolute; width: 17px; height: 17px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: 0.2s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::before { transform: translateX(17px); }

/* tables */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); padding: 11px 20px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 13px 20px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background 0.1s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tr.clickable { cursor: pointer; }
.table .actions { display: flex; gap: 6px; justify-content: flex-end; }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 22px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  display: flex; align-items: center; gap: 8px; padding: 11px 14px; margin-bottom: -1px;
  color: var(--text-2); font-weight: 550; white-space: nowrap;
  border-bottom: 2px solid transparent; transition: color 0.15s, border-color 0.15s;
}
.tabs a svg { width: 16px; height: 16px; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--text); border-bottom-color: var(--accent); }

.segmented { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px; }
.segmented button { border: 0; background: transparent; padding: 5px 12px; border-radius: 6px; color: var(--text-2); font-weight: 550; font-size: 13px; cursor: pointer; }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* stats */
.stat { padding: 18px 20px; }
.stat .label { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; font-weight: 500; }
.stat .label svg { width: 16px; height: 16px; color: var(--text-3); }
.stat .value { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat .value small { font-size: 14px; color: var(--text-3); font-weight: 500; margin-left: 4px; }
.stat .sub { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }

.meter { height: 7px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--cyan)); transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1); }
.meter.warn > i { background: var(--amber); }
.meter.crit > i { background: var(--red); }
.meter-row { display: grid; grid-template-columns: 54px 1fr auto; gap: 12px; align-items: center; font-size: 12.5px; }
.meter-row + .meter-row { margin-top: 10px; }
.meter-row .k { color: var(--text-3); font-weight: 600; }
.meter-row .v { color: var(--text-2); font-variant-numeric: tabular-nums; min-width: 92px; text-align: right; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 10px 22px; margin: 0; }
.kv dt { color: var(--text-3); font-size: 13px; }
.kv dd { margin: 0; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }

/* server cards */
.vps-card { display: block; padding: 20px; color: inherit; transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s; }
.vps-card:hover { border-color: var(--border-strong); transform: translateY(-2px); text-decoration: none; box-shadow: var(--shadow-lg); }
.vps-card .top { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.os-icon { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); flex-shrink: 0; }
.os-icon svg { width: 22px; height: 22px; }
.vps-card h3 { margin: 0; font-size: 15.5px; font-weight: 650; }
.vps-card .sub { color: var(--text-3); font-size: 12.5px; margin-top: 2px; }
.vps-card .top .pill { margin-left: auto; }
.vps-card .foot { display: flex; align-items: center; gap: 8px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); color: var(--text-3); font-size: 12.5px; }

/* service header */
.svc-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.svc-head .os-icon { width: 54px; height: 54px; border-radius: 14px; }
.svc-head .os-icon svg { width: 28px; height: 28px; }
.svc-head h1 { margin: 0; font-size: 24px; letter-spacing: -0.02em; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.svc-head .meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--text-3); font-size: 13px; margin-top: 4px; }
.svc-head .meta span { display: inline-flex; align-items: center; gap: 6px; }
.svc-head .meta svg { width: 14px; height: 14px; }
.svc-head .power { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.copy { cursor: pointer; border-bottom: 1px dashed var(--border-strong); }
.copy:hover { color: var(--text); }

.banner { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius); margin-bottom: 20px; background: var(--accent-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); }
.banner svg { width: 18px; height: 18px; color: var(--accent-text); margin-top: 1px; }
.banner.warn { background: var(--amber-soft); border-color: color-mix(in srgb, var(--amber) 35%, transparent); }
.banner.warn svg { color: var(--amber); }
.banner.danger { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 35%, transparent); }
.banner.danger svg { color: var(--red); }

.empty { text-align: center; padding: 48px 24px; color: var(--text-2); }
.empty .ico { width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 16px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-3); }
.empty .ico svg { width: 26px; height: 26px; }
.empty h3 { margin: 0 0 6px; color: var(--text); font-size: 16px; }
.empty p { margin: 0 auto 16px; max-width: 420px; }

.list-item { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-item .ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); flex-shrink: 0; }
.list-item .ico svg { width: 17px; height: 17px; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 550; }
.list-item .sub { font-size: 12.5px; color: var(--text-3); }

.task-ok { color: var(--green); }
.task-err { color: var(--red); }
.task-run { color: var(--accent-text); }

/* charts */
.chart { position: relative; height: 190px; }
.chart svg { width: 100%; height: 100%; overflow: visible; display: block; }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .axis { fill: var(--text-3); font-size: 10.5px; font-family: var(--font); }
.chart .tip {
  position: absolute; pointer-events: none; z-index: 5;
  background: var(--surface-3); border: 1px solid var(--border-strong); border-radius: 8px;
  padding: 7px 10px; font-size: 12px; box-shadow: var(--shadow-lg); white-space: nowrap;
  transform: translate(-50%, -110%);
}
.chart .tip b { display: block; font-size: 11px; color: var(--text-3); font-weight: 500; margin-bottom: 2px; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* modal */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(5, 8, 14, 0.62); backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 20px;
  animation: fade 0.15s ease-out;
}
.modal {
  width: 100%; max-width: 480px; max-height: calc(100vh - 40px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 18px;
  box-shadow: var(--shadow-lg); animation: pop 0.18s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.modal.wide { max-width: 680px; }
.modal-head { display: flex; align-items: flex-start; gap: 14px; padding: 22px 22px 0; }
.modal-head .ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); flex-shrink: 0; }
.modal-head .ico.danger { background: var(--red-soft); color: var(--red); }
.modal-head .ico.warn { background: var(--amber-soft); color: var(--amber); }
.modal-head .ico svg { width: 20px; height: 20px; }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-head p { margin: 4px 0 0; color: var(--text-2); }
.modal-body { padding: 20px 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 0 22px 22px; }

/* toasts */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 40px)); }
.toast {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 13px 15px; border-radius: 12px;
  background: var(--surface-3); border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg);
  animation: slide 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.1);
}
.toast svg { width: 18px; height: 18px; margin-top: 1px; }
.toast .t-body { flex: 1; min-width: 0; }
.toast b { display: block; font-size: 13.5px; }
.toast span { display: block; font-size: 12.5px; color: var(--text-2); overflow-wrap: anywhere; }
.toast.ok svg { color: var(--green); }
.toast.err svg { color: var(--red); }
.toast.info svg { color: var(--accent-text); }
.toast.leaving { opacity: 0; transform: translateX(20px); transition: 0.25s; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--accent-text); border-right-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite; flex-shrink: 0; }

.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 8px; }

/* dropdown */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 210px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--shadow-lg);
  padding: 6px; display: none;
}
.dropdown.open .dropdown-menu { display: block; animation: pop 0.14s ease-out; }
.dropdown-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: none; border-radius: 8px; cursor: pointer; text-align: left; color: var(--text); }
.dropdown-menu button:hover { background: var(--surface-2); }
.dropdown-menu button svg { width: 16px; height: 16px; color: var(--text-3); }
.dropdown-menu button.danger { color: var(--red); }
.dropdown-menu button.danger svg { color: var(--red); }
.dropdown-menu hr { border: 0; border-top: 1px solid var(--border); margin: 5px 0; }

/* auth screen */
.auth {
  min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr;
}
.auth-art {
  position: relative; overflow: hidden; padding: 48px;
  display: flex; flex-direction: column; justify-content: space-between;
  background:
    radial-gradient(900px 500px at 10% 10%, rgba(124, 108, 255, 0.35), transparent 60%),
    radial-gradient(700px 500px at 90% 90%, rgba(56, 214, 245, 0.22), transparent 60%),
    #080b12;
  color: #e8ecf5;
  border-right: 1px solid var(--border);
}
.auth-art::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
}
.auth-art .brand { color: #fff; position: relative; z-index: 1; }
.auth-art h2 { position: relative; z-index: 1; font-size: 40px; line-height: 1.1; letter-spacing: -0.03em; margin: 0 0 16px; max-width: 520px; }
.auth-art h2 span { background: linear-gradient(90deg, #b4abff, #38d6f5); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-art p { position: relative; z-index: 1; color: #aab3c7; max-width: 460px; font-size: 15px; margin: 0; }
.auth-feats { position: relative; z-index: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 32px; max-width: 520px; }
.auth-feats div { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 12px; background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.07); font-size: 13px; color: #cfd6e6; }
.auth-feats svg { width: 17px; height: 17px; color: #b4abff; }
.auth-art .foot { position: relative; z-index: 1; font-size: 12.5px; color: #6f7a92; }
.auth-form { display: grid; place-items: center; padding: 40px 24px; }
.auth-form .box { width: 100%; max-width: 380px; }
.auth-form h1 { margin: 0 0 6px; font-size: 26px; letter-spacing: -0.02em; }
.auth-form .lead { color: var(--text-2); margin: 0 0 28px; }
.auth-form .btn-primary { height: 44px; margin-top: 6px; }
.otp-input { text-align: center; font-size: 26px; letter-spacing: 0.5em; font-family: var(--mono); height: 58px !important; padding-left: 0.5em !important; }

.qr { width: 188px; height: 188px; padding: 10px; background: #fff; border-radius: 14px; margin: 0 auto 14px; }
.qr svg { width: 100%; height: 100%; display: block; }
.secret { display: block; text-align: center; font-family: var(--mono); font-size: 14px; letter-spacing: 0.08em; padding: 10px; border-radius: var(--radius-sm); background: var(--bg-2); border: 1px dashed var(--border-strong); overflow-wrap: anywhere; }

.chat { display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 82%; padding: 13px 16px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); }
.msg.mine { align-self: flex-end; background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 28%, transparent); }
.msg.staff { border-left: 3px solid var(--cyan); }
.msg .who { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--text-3); margin-bottom: 6px; }
.msg .who b { color: var(--text-2); }
.msg .txt { white-space: pre-wrap; overflow-wrap: anywhere; }

.loader-page { display: grid; place-items: center; min-height: 40vh; }

/* animations */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(0.96) translateY(6px); } }
@keyframes slide { from { opacity: 0; transform: translateY(12px); } }
@keyframes shimmer { to { background-position: -200% 0; } }
.fade-in { animation: slide 0.25s ease-out; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 60; width: 272px; transform: translateX(-100%); transition: transform 0.22s ease; box-shadow: var(--shadow-lg); }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open::after { content: ''; position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, 0.5); }
  .btn.menu-btn { display: inline-flex; }
  .topbar { padding: 12px 16px; }
  .content { padding: 20px 16px 48px; }
  .grid-2 { grid-template-columns: 1fr; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .svc-head .power { margin-left: 0; width: 100%; }
}
@media (max-width: 560px) {
  .grid-4, .grid-3 { grid-template-columns: 1fr; }
  .grid-auto { grid-template-columns: 1fr; }
  .page-head h1 { font-size: 22px; }
  .topbar .crumbs a, .topbar .crumbs svg { display: none; }
  .step-title .faint { display: none; }
  .pick-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .table th, .table td { padding: 11px 14px; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 10px; }
  .msg { max-width: 100%; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- provisioning ---------- */
.os-badge {
  display: inline-grid; place-items: center; flex-shrink: 0; border-radius: 12px; font-weight: 800; letter-spacing: -0.02em; color: #fff;
  background: linear-gradient(145deg, var(--os), color-mix(in srgb, var(--os) 60%, #000));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 4px 12px color-mix(in srgb, var(--os) 30%, transparent);
}
.pick-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.pick {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 14px; cursor: pointer; text-align: left;
  background: var(--surface-2); border: 1.5px solid var(--border); border-radius: 12px; color: var(--text);
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
}
.pick:hover { border-color: var(--border-strong); }
.pick.selected { border-color: var(--accent); background: var(--accent-soft); }
.pick.selected::after {
  content: ''; position: absolute; top: 10px; right: 10px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / 11px no-repeat;
}
.pick.disabled { opacity: 0.45; cursor: not-allowed; }
.pick b { display: block; font-size: 14px; }
.pick span.sub { display: block; font-size: 12px; color: var(--text-3); }
.pick.plan { flex-direction: column; align-items: stretch; gap: 10px; }
.pick.plan .specs { display: grid; gap: 4px; font-size: 13px; color: var(--text-2); }
.pick.plan .specs div { display: flex; align-items: center; gap: 8px; }
.pick.plan .specs svg { width: 14px; height: 14px; color: var(--text-3); }
.pick.plan .price { font-weight: 700; font-size: 15px; color: var(--accent-text); }
.wizard { display: grid; grid-template-columns: 1fr 330px; gap: 22px; align-items: start; }
.wizard .summary { position: sticky; top: 84px; }
.step-title { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; font-size: 15px; }
.step-title .num { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); font-size: 12px; font-weight: 700; }
.summary-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.summary-row:last-of-type { border-bottom: 0; }
.summary-row span:first-child { color: var(--text-3); }
.summary-row span:last-child { font-weight: 550; text-align: right; }
.code-block { position: relative; background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; }
.code-block pre { margin: 0; padding: 12px 44px 12px 14px; font: 12.5px/1.6 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.code-block .btn { position: absolute; top: 6px; right: 6px; }
.agent-help .segmented { flex-wrap: wrap; margin-bottom: 12px; }
.steps { padding-left: 18px; margin: 0; } .steps li + li { margin-top: 6px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 12px; align-items: flex-start; padding: 9px 0; }
.timeline .dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; background: var(--surface-3); color: var(--text-3); }
.timeline .dot svg { width: 13px; height: 13px; }
.timeline li.done .dot { background: var(--green-soft); color: var(--green); }
.timeline li.active .dot { background: var(--accent-soft); color: var(--accent-text); }
.timeline li.error .dot { background: var(--red-soft); color: var(--red); }
.timeline li.active b { color: var(--text); }
.timeline b { font-weight: 550; color: var(--text-2); }
.term { background: #05070c; color: #cfd6e6; border: 1px solid var(--border); border-radius: 12px; padding: 14px; font: 12px/1.6 var(--mono); max-height: 420px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.term .ok { color: #34d399; } .term .err { color: #f87171; } .term .step { color: #b4abff; }
.progress-bar { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.progress-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--cyan)); transition: width 0.5s; }
.progress-bar.indeterminate i { width: 35% !important; animation: indet 1.3s ease-in-out infinite; }
@keyframes indet { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
.ip-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 7px; font: 12px var(--mono); background: var(--surface-3); }
.ip-chip.used { background: var(--accent-soft); color: var(--accent-text); }
.ip-chip.blocked { background: var(--amber-soft); color: var(--amber); }
@media (max-width: 1100px) { .wizard { grid-template-columns: 1fr; } .wizard .summary { position: static; } }
