/*
 * Shared component primitives, with SukiUI Blue workspace styling below.
 * The header navigation, stat cards and responsive tables match the ROM web client.
 * Colours are written once with light-dark(); `data-theme` on <html> forces a scheme,
 * otherwise the system setting decides.
 */

:root {
  color-scheme: light dark;

  --bg: light-dark(#ffffff, #09090b);
  --surface: light-dark(#ffffff, #09090b);
  --surface-2: light-dark(#f4f4f5, #18181b);
  --surface-3: light-dark(#fafafa, #111113);
  --sidebar: light-dark(#fafafa, #0f0f11);
  --border: light-dark(#e4e4e7, #27272a);
  --border-strong: light-dark(#d4d4d8, #3f3f46);
  --text: light-dark(#09090b, #fafafa);
  --muted: light-dark(#71717a, #a1a1aa);
  --faint: light-dark(#a1a1aa, #71717a);

  --primary: light-dark(#18181b, #fafafa);
  --primary-hover: light-dark(#27272a, #e4e4e7);
  --on-primary: light-dark(#fafafa, #18181b);
  --ring: light-dark(rgba(24, 24, 27, 0.18), rgba(250, 250, 250, 0.22));

  --brand: #6366f1;
  --brand-2: #8b5cf6;

  --ok: light-dark(#15803d, #4ade80);
  --ok-soft: light-dark(#f0fdf4, rgba(74, 222, 128, 0.1));
  --ok-line: light-dark(#bbf7d0, rgba(74, 222, 128, 0.3));
  --danger: light-dark(#dc2626, #f87171);
  --danger-hover: light-dark(#b91c1c, #fca5a5);
  --danger-soft: light-dark(#fef2f2, rgba(248, 113, 113, 0.1));
  --danger-line: light-dark(#fecaca, rgba(248, 113, 113, 0.3));
  --warn: light-dark(#b45309, #fbbf24);
  --warn-soft: light-dark(#fffbeb, rgba(251, 191, 36, 0.1));
  --warn-line: light-dark(#fde68a, rgba(251, 191, 36, 0.3));
  --accent: light-dark(#6d28d9, #c4b5fd);
  --accent-soft: light-dark(#f5f3ff, rgba(196, 181, 253, 0.1));
  --accent-line: light-dark(#ddd6fe, rgba(196, 181, 253, 0.3));

  --radius: 8px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-lg: light-dark(0 20px 50px rgba(9, 9, 11, 0.18), 0 20px 50px rgba(0, 0, 0, 0.6));
  --sidebar-w: 240px;
}
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

html, body { margin: 0; }
body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 24px; font-weight: 600; }
h2 { font-size: 22px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; }
p { margin: 0; }
.muted { color: var(--muted); }
.icon { width: 16px; height: 16px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--danger-hover); border-color: var(--danger-hover); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--muted); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.btn-danger-ghost { color: var(--danger); }
.btn-danger-ghost:hover:not(:disabled) { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger); }
.btn-small { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-icon { width: 36px; padding: 0; }
.btn-icon.btn-small { width: 30px; }
.btn-block { width: 100%; height: 40px; }

/* ---------- forms ---------- */

.field { display: grid; gap: 6px; margin-top: 14px; }
.field > span { font-size: 13px; font-weight: 500; }
input:not([type=checkbox]) {
  width: 100%;
  height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input::placeholder { color: var(--faint); }
input:focus { outline: none; border-color: var(--border-strong); box-shadow: 0 0 0 3px var(--ring); }
input:disabled { opacity: 0.5; cursor: not-allowed; }
.input-row { display: flex; gap: 8px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-row.three { grid-template-columns: repeat(3, 1fr); }
.check { display: inline-flex; align-items: center; gap: 8px; margin-top: 14px; cursor: pointer; user-select: none; font-weight: 500; font-size: 13px; }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--primary); }
.form-error {
  display: flex;
  align-items: flex-start;
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid var(--danger-line);
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
}
.hint { margin-top: 10px; color: var(--muted); font-size: 12.5px; }

/* ---------- login ---------- */

.login { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 100vh; }
.login-side {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 40px 44px;
  background: #09090b;
  color: #fafafa;
  overflow: hidden;
}
.login-side::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(700px 400px at 0% 0%, rgba(99, 102, 241, 0.35), transparent 60%),
    radial-gradient(600px 400px at 100% 100%, rgba(139, 92, 246, 0.25), transparent 60%);
  pointer-events: none;
}
.login-brand { position: relative; display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 600; }
.login-brand.compact { display: none; margin-bottom: 28px; color: var(--text); }
.login-quote { position: relative; max-width: 460px; }
.login-quote-text { font-size: 17px; line-height: 1.6; color: rgba(250, 250, 250, 0.92); }
.login-quote-foot { margin-top: 12px; font-size: 13px; color: rgba(250, 250, 250, 0.55); }
.login-main { display: grid; place-items: center; padding: 32px 24px; }
.login-card { width: 100%; max-width: 360px; }
.login-head { margin-bottom: 8px; }
.login-head p { margin-top: 6px; }
.login-card .btn-block { margin-top: 22px; }
.login-foot { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 18px; font-size: 12.5px; }
.login-foot .icon { width: 13px; height: 13px; }

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  flex: 0 0 auto;
}
.brand-mark svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- shell: sidebar + main ---------- */

.shell { display: flex; min-height: 100vh; }
.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-w);
  height: 100vh;
  flex: 0 0 auto;
  padding: 12px;
  background: var(--sidebar);
  border-right: 1px solid var(--border);
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px; }
.sidebar-brand-text { display: grid; line-height: 1.2; }
.sidebar-brand-text strong { font-size: 14px; font-weight: 600; }
.sidebar-brand-text small { font-size: 12px; color: var(--muted); }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; margin-top: 18px; flex: 1; }
.sidebar-label { padding: 0 8px 6px; font-size: 11.5px; font-weight: 500; color: var(--faint); letter-spacing: 0.02em; }
.tab {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text);
  font: inherit;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s;
}
.tab .icon { color: var(--muted); }
.tab:hover { background: var(--surface-2); }
.tab.active { background: var(--surface-2); }
.tab.active .icon { color: var(--text); }
.tab:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.sidebar-foot { display: flex; align-items: center; gap: 4px; padding-top: 12px; border-top: 1px solid var(--border); }
.user-chip { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; padding: 4px 6px; }
.user-chip-text { display: grid; min-width: 0; line-height: 1.2; }
.user-chip-text strong { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip-text small { font-size: 11.5px; color: var(--muted); }
.avatar {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--primary);
  color: var(--on-primary);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  flex: 0 0 auto;
}
.icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: none; }
  :root:not([data-theme="light"]) .icon-moon { display: block; }
}

.main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  height: 52px;
  padding: 0 24px;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 500; }
.crumb-sep { color: var(--faint); }

.page { width: 100%; max-width: 1280px; margin: 0 auto; padding: 24px 24px 48px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-head p { margin-top: 4px; }

/* ---------- cards ---------- */

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.card.pad { padding: 20px 22px 22px; }
.card-title h3 { font-size: 16px; }
.card-title p { margin-top: 4px; font-size: 13px; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.card-head h3 { font-size: 15px; }
.card-head p { margin-top: 2px; font-size: 13px; }
.card-head.pad-x { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.grid-2 > .card { display: flex; flex-direction: column; }
.grid-2 form { display: flex; flex: 1; flex-direction: column; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: auto; padding-top: 18px; }
#generated-card { margin-bottom: 16px; border-color: color-mix(in srgb, var(--brand) 50%, var(--border)); }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.stat { display: grid; gap: 2px; padding: 18px 20px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.stat-head { display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 500; }
.stat-head .icon { color: var(--muted); }
.stat-value { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat small { font-size: 12px; }

/* ---------- toolbar ---------- */

.toolbar { display: flex; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.search-box { position: relative; flex: 1; max-width: 340px; }
.search-box .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-box input { padding-left: 34px; padding-right: 40px; }
.search-box input::-webkit-search-cancel-button { cursor: pointer; }
.search-key {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--muted);
  font: 11.5px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace;
  pointer-events: none;
}
.search-box:focus-within .search-key { display: none; }

/* ---------- table ---------- */

.table-wrap { overflow-x: auto; transition: opacity 0.15s; }
.table-wrap.is-loading { opacity: 0.5; pointer-events: none; }
table { width: 100%; border-collapse: collapse; min-width: 960px; font-variant-numeric: tabular-nums; }
th, td { padding: 10px 12px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--border); }
th, td.username, td.status-cell, td.muted, td.code, td.col-actions, .nowrap { white-space: nowrap; }
th { height: 40px; color: var(--muted); font-size: 12.5px; font-weight: 500; }
th:first-child, td:first-child { padding-left: 16px; }
th:last-child, td:last-child { padding-right: 16px; }
td { height: 52px; }
tbody tr { transition: background 0.12s; }
tbody tr:hover { background: var(--surface-3); }
tbody tr:last-child td { border-bottom: none; }
.row-disabled .username { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--danger); }
.username { max-width: 200px; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
td.expires { line-height: 1.4; }
td.expires .badge { vertical-align: middle; }
.status-cell { white-space: nowrap; }
.status-cell .badge + .badge { margin-left: 6px; }
.badge.after-text { margin-left: 8px; }
.plan { display: inline-block; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; padding: 1px 7px; border-radius: 4px; background: var(--surface-2); color: var(--text); }
.col-actions { text-align: right; width: 1%; white-space: nowrap; }
.row-actions { display: inline-flex; gap: 0; }
.row-actions .btn { padding: 0 8px; box-shadow: none; }
.empty { padding: 56px 16px; text-align: center; color: var(--muted); }
.empty .retry { margin-top: 12px; }
tbody tr.row-flash { animation: flash 1.4s ease-out; }
@keyframes flash { 0%, 30% { background: var(--accent-soft); } 100% { background: transparent; } }
table.compact { min-width: 560px; }
table.compact td { height: 44px; padding: 8px 16px; }
td.code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13.5px; font-weight: 600; letter-spacing: 0.03em; white-space: nowrap; user-select: all; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.badge-ok { color: var(--ok); border-color: var(--ok-line); background: var(--ok-soft); }
.badge-danger { color: var(--danger); border-color: var(--danger-line); background: var(--danger-soft); }
.badge-warn { color: var(--warn); border-color: var(--warn-line); background: var(--warn-soft); }
.badge-accent { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--border); font-size: 13px; }
.pager-buttons { display: flex; gap: 6px; }
.pager .btn-icon { width: 32px; height: 32px; }

/* ---------- dialogs ---------- */

.modal {
  width: min(440px, calc(100vw - 32px));
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}
.modal::backdrop { background: rgba(0, 0, 0, 0.6); }
.modal[open] { animation: pop 0.16s ease-out; }
.modal-head h3 { font-size: 17px; }
.modal-head p { margin-top: 6px; font-size: 13.5px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.chip { height: 30px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; box-shadow: var(--shadow-sm); }
.chip:hover { background: var(--surface-2); }
.chip.active { border-color: var(--primary); background: var(--primary); color: var(--on-primary); font-weight: 500; }
.chip:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }

.credential {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 16px;
  margin: 18px 0 0;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.credential dt { color: var(--muted); font-size: 13px; }
.credential dd { margin: 0; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 14.5px; font-weight: 600; word-break: break-all; user-select: all; }

/* ---------- toasts ---------- */

.toasts { position: fixed; right: 24px; bottom: 24px; z-index: 50; display: grid; gap: 8px; pointer-events: none; }
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 260px;
  max-width: min(420px, calc(100vw - 32px));
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  font-weight: 500;
  animation: rise 0.18s ease-out;
  transition: opacity 0.3s, transform 0.3s;
}
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: 0 0 auto; }
.toast-success::before { background: var(--ok); }
.toast-error::before { background: var(--danger); }
.toast.leaving { opacity: 0; transform: translateY(6px); }

@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- responsive ---------- */

@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .login { grid-template-columns: 1fr; }
  .login-side { display: none; }
  .login-brand.compact { display: flex; }
  .login-main { align-items: start; padding-top: 64px; }

  /* The sidebar folds into a top bar: brand, page buttons, theme + logout. */
  .shell { flex-direction: column; }
  .sidebar { position: static; flex-direction: row; align-items: center; gap: 8px; width: auto; height: auto; padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--border); }
  .sidebar-brand { padding: 0; }
  .sidebar-brand-text small { display: none; }
  .sidebar-nav { flex-direction: row; gap: 2px; margin: 0 auto 0 8px; flex: 1; }
  .sidebar-label { display: none; }
  .tab { height: 34px; padding: 0 10px; }
  .sidebar-foot { padding: 0; border: 0; gap: 0; }
  .user-chip-text { display: none; }
  .topbar { display: none; }
}

@media (max-width: 640px) {
  .page { padding: 16px 12px 40px; }
  .page-head { flex-direction: column; align-items: stretch; }
  .page-head .btn { justify-content: center; }
  .stats { gap: 10px; }
  .stat { padding: 14px 14px 12px; }
  .stat-value { font-size: 22px; }
  .toolbar { flex-wrap: wrap; }
  .search-box { max-width: none; flex-basis: 100%; }
  .search-key { display: none; }
  .search-box input { padding-right: 12px; }
  .field-row, .field-row.three { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .pager { flex-wrap: wrap; }
  .toasts { left: 12px; right: 12px; bottom: 12px; }
  .toast { min-width: 0; max-width: none; }
  .tab { padding: 0 8px; gap: 6px; }
  .sidebar-brand-text { display: none; }

  /* Tables become stacked cards: each cell shows its column header as a label. */
  .table-wrap table, .table-wrap table.compact { min-width: 0; }
  .table-wrap thead { display: none; }
  .table-wrap tbody, .table-wrap tr, .table-wrap td { display: block; height: auto; }
  .table-wrap tr { padding: 12px 16px; border-bottom: 1px solid var(--border); }
  .table-wrap tr:last-child { border-bottom: none; }
  .table-wrap td { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px 8px; padding: 4px 0; border: none; text-align: right; white-space: normal; }
  .table-wrap td[data-label]::before { content: attr(data-label); flex: 0 0 auto; margin-right: auto; color: var(--muted); font-size: 12px; text-align: left; }
  .table-wrap .status-cell .badge + .badge, .table-wrap .badge.after-text { margin-left: 0; }
  .table-wrap td.username { display: block; max-width: none; overflow: visible; word-break: break-all; text-align: left; font-size: 15px; padding-bottom: 8px; }
  .table-wrap td.username::before { content: none; }
  .table-wrap td.code { display: block; text-align: left; font-size: 15px; padding-bottom: 8px; }
  .table-wrap td.code::before { content: none; }
  .table-wrap td.col-actions { display: block; width: auto; padding-top: 10px; text-align: left; white-space: normal; }
  .table-wrap td.col-actions::before { content: none; }
  .table-wrap td.col-actions:empty { display: none; }
  .row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
  .row-actions .btn { padding: 0 10px; border-color: var(--border); background: var(--surface); box-shadow: var(--shadow-sm); }
  .table-wrap td.empty { display: block; text-align: center; padding: 40px 12px; }
  .table-wrap td.empty::before { content: none; }
  .table-wrap tr:has(> td.empty) { padding: 0; }
}

/* SukiUI Blue: shared visual language with the desktop client and ROM web. */
:root {
  --bg: light-dark(#f3f6fc, #111824);
  --surface: light-dark(#ffffff, #1a2332);
  --surface-2: light-dark(#edf3fd, #243249);
  --surface-3: light-dark(#f6f9ff, #202d40);
  --sidebar: var(--bg);
  --border: light-dark(#e3eaf5, #2c3b51);
  --border-strong: light-dark(#bbd0f1, #46668e);
  --text: light-dark(#253650, #e1eafa);
  --muted: light-dark(#77869d, #9aacc5);
  --faint: light-dark(#95a2b6, #8294af);
  --primary: light-dark(#3978e8, #619bff);
  --primary-hover: light-dark(#2865d2, #7aabff);
  --on-primary: light-dark(#ffffff, #101c30);
  --ring: #3978e825;
  --brand: #3978e8;
  --brand-2: #3978e8;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow-sm: 0 4px 20px #294b7a06;
}
body { font-size: 13px; }
.shell { flex-direction: column; max-width: 1500px; margin: auto; padding: 0 30px; }
.sidebar { position: static; display: flex; flex-direction: row; width: 100%; height: 104px; padding: 0 4px; gap: 38px; align-items: center; background: transparent; border: 0; }
.sidebar-brand { padding: 0; gap: 13px; }
.brand-mark { background: var(--primary); width: 46px; height: 46px; border-radius: 13px; font-size: 24px; font-weight: 650; box-shadow: 0 5px 14px #3978e824; }
.sidebar-brand-text { gap: 5px; }
.sidebar-brand-text strong { font-size: 20px; }
.sidebar-brand-text small { font-size: 11px; }
.sidebar-nav { flex-direction: row; flex: 1; gap: 8px; margin: 0; }
.sidebar-label { display: none; }
.tab { height: 39px; padding: 0 17px; border: 1px solid transparent; color: var(--muted); }
.tab.active { color: var(--primary); border-color: var(--border-strong); background: var(--surface); box-shadow: var(--shadow-sm); }
.tab.active .icon { color: var(--primary); }
.sidebar-foot { padding: 0; border: 0; gap: 6px; }
.user-chip-text { display: grid; }
.avatar { background: var(--surface-2); color: var(--primary); border: 1px solid var(--border); }
.topbar { display: flex; position: static; height: auto; padding: 0 4px 20px; border: 0; background: transparent; backdrop-filter: none; }
.crumbs { font-size: 11px; }
.page { max-width: none; padding: 0 0 40px; }
.page-head { align-items: center; margin-bottom: 22px; }
h2 { font-size: 23px; font-weight: 650; }
.page-head p { font-size: 12px; margin-top: 7px; }
.btn { box-shadow: none; }
.btn-primary { box-shadow: 0 4px 10px #3978e81a; }
.stats { grid-template-columns: repeat(4,minmax(0,1fr)); gap: 16px; margin-bottom: 22px; }
.stat { padding: 19px 21px; gap: 4px; }
.stat-head { color: var(--muted); font-size: 12px; }
.stat-head .icon { color: var(--primary); width: 30px; height: 30px; padding: 7px; box-sizing: content-box; background: var(--surface-2); border-radius: 11px; }
.stat-value { font-size: 29px; margin-top: -10px; font-weight: 600; color: var(--text); }
.stat small { font-size: 11px; }
.toolbar { padding: 18px 20px; gap: 10px; align-items: center; }
.search-box { max-width: 400px; }
input:not([type=checkbox]), textarea { background: var(--surface-3); box-shadow: none; border-color: var(--border); }
input:not([type=checkbox]) { height: 39px; }
input:focus { border-color: var(--primary); }
.field > span { color: var(--muted); font-size: 12px; }
.table-wrap table { min-width: 0; table-layout: fixed; }
th { background: var(--surface-3); height: 44px; font-size: 11px; }
td { font-size: 12px; padding-top: 15px; padding-bottom: 15px; height: 68px; }
th, td { padding-left: 12px; padding-right: 12px; }
#user-table th:nth-child(1) { width: 14%; }
#user-table th:nth-child(2) { width: 10%; }
#user-table th:nth-child(3) { width: 9%; }
#user-table th:nth-child(4) { width: 20%; }
#user-table th:nth-child(5) { width: 8%; }
#user-table th:nth-child(6) { width: 17%; }
#user-table th:nth-child(7) { width: 22%; }
#user-table td { overflow-wrap: anywhere; white-space: normal; }
#user-table td.username { white-space: nowrap; }
#user-table .row-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
#user-table .row-actions .btn { padding: 0 8px; font-size: 11px; height: 29px; border: 1px solid var(--border); background: var(--surface-3); }
#user-table .row-actions .btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.badge { font-size: 10px; height: 21px; padding: 0 7px; }
.expires .badge.after-text { display: table; margin: 5px 0 0; }
.pager { background: var(--surface-3); padding: 13px 20px; font-size: 11px; }
.card-title h3 { color: var(--primary); font-size: 15px; }
.card-title p, .hint { font-size: 12px; line-height: 1.7; }
.card.pad { padding: 23px; }
.modal { border-radius: 16px; padding: 26px; }
.modal::backdrop { background: #12234270; backdrop-filter: blur(3px); }
.chip.active { background: var(--surface-2); color: var(--primary); border-color: var(--border-strong); }
.login-side { background: #1c3864; }
.login-side::before { background: radial-gradient(ellipse at top left,#3978e85a,transparent 70%); }
.login-card { max-width: 390px; }
.preview-note { display: none; }
@media(max-width:1100px) { .shell { padding: 0 20px; } .sidebar { gap: 24px; } .stat { padding: 16px; } .stat-head .icon { width: 18px; height: 18px; padding: 7px; } .stat-value { margin-top: 0; } th, td { padding-left: 8px; padding-right: 8px; } #user-table th:nth-child(4) { width: 18%; } #user-table th:nth-child(6) { width: 14%; } #user-table th:nth-child(7) { width: 27%; } }
@media(max-width:760px) { .shell { padding: 0 12px; } .sidebar { flex-wrap: wrap; height: auto; gap: 14px; padding: 20px 0 16px; } .sidebar-brand-text { display: grid; } .sidebar-brand-text small { display: block; } .sidebar-brand-text strong { font-size: 18px; } .sidebar-foot { margin-left: auto; } .user-chip { display: none; } .sidebar-nav { order: 3; flex-basis: 100%; background: var(--surface-2); border-radius: 10px; padding: 4px; gap: 4px; } .tab { flex: 1; justify-content: center; } .topbar { display: none; } .stats { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; } .page-head { flex-direction: row; align-items: center; margin-top: 8px; } .page-head h2 { font-size: 21px; } .page-head .btn { font-size: 12px; padding: 0 10px; } .toolbar { padding: 14px; flex-wrap: nowrap; } .search-box { flex-basis: auto; min-width: 0; } .stat small { font-size: 10px; } .stat-value { font-size: 25px; } .grid-2 { grid-template-columns: minmax(0,1fr); } .table-wrap table { table-layout: auto; } .table-wrap thead { display: none; } .table-wrap tbody, .table-wrap tr, .table-wrap td { display: block; height: auto; } .table-wrap tr { padding: 16px; border-bottom: 1px solid var(--border); } .table-wrap td { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 6px; padding: 5px 0; border: 0; white-space: normal; text-align: right; } .table-wrap td[data-label]::before { content: attr(data-label); margin-right: auto; color: var(--muted); font-size: 11px; } .table-wrap td.username, .table-wrap td.code { display: block; max-width: none; white-space: normal !important; text-align: left; font-size: 15px; font-weight: 600; padding-bottom: 12px; } .table-wrap td.username::before, .table-wrap td.code::before, .table-wrap td.col-actions::before { content: none; } .table-wrap td.col-actions { display: block; width: auto; padding-top: 12px; } #user-table .row-actions { justify-content: flex-start; gap: 7px; } #user-table .row-actions .btn { padding: 0 11px; height: 32px; } .expires .badge.after-text { display: inline-flex; margin: 0; } .table-wrap td.empty { display: block; text-align: center; } .table-wrap td.empty::before { content: none; } .pager { padding: 12px 16px; } }
#user-table .status-cell .badge { max-width: 100%; height: auto; min-height: 21px; white-space: normal; line-height: 1.5; padding-top: 2px; padding-bottom: 2px; }
#user-table .status-cell .badge + .badge { margin: 4px 0 0; }
#user-table .status-cell .badge { display: flex; width: fit-content; }
@media(max-width:760px) { #user-table .status-cell .badge + .badge { margin: 0; } }
#invites-page table th.col-actions { width: 70px; }
#invites-page table td { white-space: normal; overflow-wrap: anywhere; }
#invites-page table .row-actions { display: flex; flex-wrap: wrap; }
@media(max-width:760px) { #invites-page table th.col-actions { width: auto; } }
