/* ShexsanVPN CRM — тёмная и светлая темы, адаптив до 360px. */
:root {
  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", ui-monospace, SFMono-Regular, Consolas, monospace;
  --radius: 14px;
  --radius-sm: 10px;
  --accent: #7c5cff;
  --accent-2: #22d3ee;
  --grad: linear-gradient(135deg, #7c5cff 0%, #4f7cff 55%, #22d3ee 100%);
  --ok: #22c55e;
  --warn: #f59e0b;
  --bad: #ef4444;
  --sidebar: 264px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

[data-theme="dark"] {
  --bg: #090b10;
  --bg-2: #0d1017;
  --surface: #12151d;
  --surface-2: #181c26;
  --surface-3: #1f2430;
  --border: rgba(255, 255, 255, .07);
  --border-strong: rgba(255, 255, 255, .13);
  --text: #eceef4;
  --muted: #8b93a7;
  --faint: #5d6477;
  --shadow: 0 20px 60px rgba(0, 0, 0, .45);
  --glow: rgba(124, 92, 255, .18);
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #f4f5fa;
  --bg-2: #eef0f6;
  --surface: #ffffff;
  --surface-2: #f6f7fb;
  --surface-3: #eceef5;
  --border: rgba(16, 24, 40, .08);
  --border-strong: rgba(16, 24, 40, .16);
  --text: #121624;
  --muted: #5f6779;
  --faint: #9aa1b2;
  --shadow: 0 20px 50px rgba(16, 24, 40, .12);
  --glow: rgba(124, 92, 255, .12);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 14px/1.5 var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
p { margin: 0; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono { font-family: var(--mono); font-size: 12.5px; }
::selection { background: rgba(124, 92, 255, .35); }

/* ---------- иконки и логотип */
.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.i.sm { width: 15px; height: 15px; }
.i.lg { width: 22px; height: 22px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 16px; }
.logo-text b { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; margin-left: 2px; }
.logo-mark {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: var(--grad); color: #fff; font-weight: 800; font-size: 17px;
  box-shadow: 0 8px 24px rgba(124, 92, 255, .4), inset 0 1px 0 rgba(255, 255, 255, .25);
}

.boot { position: fixed; inset: 0; display: grid; place-items: center; }
.boot .logo-mark { animation: pulse 1.2s var(--ease) infinite; }
@keyframes pulse { 50% { transform: scale(.9); opacity: .6; } }

/* ---------- кнопки и поля */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  font: 500 13.5px var(--font); cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .1s, box-shadow .15s, opacity .15s;
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { border: 0; background: var(--grad); color: #fff; box-shadow: 0 6px 20px rgba(91, 108, 255, .35); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--surface-2); color: var(--text); }
.btn.danger { color: var(--bad); border-color: rgba(239, 68, 68, .35); background: rgba(239, 68, 68, .08); }
.btn.danger:hover { background: rgba(239, 68, 68, .16); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn.busy { pointer-events: none; opacity: .7; }
.btn.busy::after { content: ""; width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px;
  border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; font-size: 15px;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.danger:hover { color: var(--bad); background: rgba(239, 68, 68, .1); }
.icon-btn.xs { width: 22px; height: 22px; border-radius: 6px; font-size: 14px; }

.field { display: grid; align-content: start; gap: 6px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.field.inline { display: flex; align-items: center; gap: 10px; }
input, select, textarea {
  width: 100%; min-height: 40px; padding: 9px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--bg-2); color: var(--text);
  font: 14px var(--font); outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 90px; resize: vertical; font-family: var(--mono); font-size: 12.5px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--glow); }
input[type="checkbox"] { width: 17px; height: 17px; min-height: 0; padding: 0; accent-color: var(--accent); cursor: pointer; }
input[readonly] { color: var(--muted); }
.input-icon { position: relative; }
.input-icon .i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.input-icon input { padding-left: 38px; }
.copy-field { display: flex; gap: 8px; }
.copy-field input { font-family: var(--mono); font-size: 12px; }
.form-grid { display: grid; align-content: start; gap: 14px; }
.form-grid.two { grid-template-columns: 1fr 1fr; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; flex-wrap: wrap; }
.form-error { color: var(--bad); min-height: 20px; font-size: 13px; }
.hint { font-size: 12.5px; color: var(--faint); font-weight: 400; }

/* ---------- вход */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px; position: relative; overflow: hidden; }
.login-aurora {
  position: absolute; inset: -30%;
  background:
    radial-gradient(40% 40% at 25% 30%, rgba(124, 92, 255, .35), transparent 70%),
    radial-gradient(35% 35% at 75% 70%, rgba(34, 211, 238, .22), transparent 70%),
    radial-gradient(30% 30% at 70% 20%, rgba(79, 124, 255, .25), transparent 70%);
  filter: blur(30px); animation: drift 18s ease-in-out infinite alternate;
}
@keyframes drift { to { transform: translate(4%, -3%) rotate(6deg); } }
.login-card {
  position: relative; width: min(400px, 100%); display: grid; gap: 16px; padding: 34px;
  border-radius: 22px; border: 1px solid var(--border-strong);
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  backdrop-filter: blur(24px) saturate(1.4); box-shadow: var(--shadow);
}
.login-card h1 { font-size: 24px; margin-top: 10px; }

/* ---------- каркас */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100%; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 8px;
  padding: 18px 14px; border-right: 1px solid var(--border); background: var(--bg-2);
}
.sidebar-head { padding: 4px 8px 14px; }
.nav { flex: 1; overflow-y: auto; display: grid; align-content: start; gap: 18px; }
.nav-section { display: grid; gap: 2px; }
.nav-label {
  display: flex; align-items: center; justify-content: space-between; padding: 0 10px 4px;
  font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--faint);
}
.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%; height: 38px; padding: 0 10px;
  border: 0; border-radius: 10px; background: transparent; color: var(--muted);
  font: 500 13.5px var(--font); cursor: pointer; text-align: left; transition: background .15s, color .15s;
}
.nav-item span:not(.badge) { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--surface-3); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.nav-item.active .i { color: var(--accent); }
.badge { min-width: 22px; padding: 1px 7px; border-radius: 99px; background: var(--surface-3); color: var(--muted); font-size: 11.5px; text-align: center; }
.badge.warn { background: rgba(245, 158, 11, .15); color: var(--warn); }
.sidebar-foot .nav-item > span:first-child { flex: none; display: contents; }
.sidebar-foot { display: grid; gap: 2px; padding-top: 10px; border-top: 1px solid var(--border); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 14px;
  padding: 18px 32px; border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(16px);
}
.topbar-title { flex: 1; min-width: 0; }
.topbar-title h1 { font-size: 22px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumb { font-size: 12px; color: var(--faint); font-weight: 500; }
.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.menu-btn { display: none; }
.view { padding: 28px 32px 60px; display: grid; gap: 20px; align-content: start; animation: rise .25s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.scrim { display: none; }

/* ---------- карточки */
.card { border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius); padding: 20px; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h2 { font-size: 15px; font-weight: 600; }
.card.flush .card-head { padding: 16px 20px 0; }
.grid { display: grid; gap: 16px; }
.grid.kpi { grid-template-columns: repeat(4, 1fr); }
.grid.two { grid-template-columns: 1.3fr 1fr; }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }

.kpi-card {
  position: relative; overflow: hidden; display: grid; gap: 6px; padding: 18px 20px; text-align: left; cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); font: inherit;
  transition: border-color .2s, transform .2s var(--ease);
}
.kpi-card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.kpi-card::after { content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%; background: var(--tone, var(--accent)); opacity: .09; filter: blur(4px); }
.kpi-card .kpi-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.kpi-card .kpi-label .i { color: var(--tone, var(--accent)); }
.kpi-card strong { font-size: 30px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.kpi-card .kpi-note { color: var(--faint); font-size: 12px; }
.tone-ok { --tone: var(--ok); }
.tone-warn { --tone: var(--warn); }
.tone-bad { --tone: var(--bad); }
.tone-muted { --tone: var(--muted); }

.list { display: grid; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--border); }
.list-row:first-child { border-top: 0; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .title { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .sub { font-size: 12.5px; color: var(--muted); }

/* ---------- метки и статусы */
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 99px;
  font-size: 12px; font-weight: 550; white-space: nowrap; background: var(--surface-3); color: var(--muted);
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.plain::before { display: none; }
.pill.ok { color: var(--ok); background: rgba(34, 197, 94, .12); }
.pill.warn { color: var(--warn); background: rgba(245, 158, 11, .13); }
.pill.bad { color: var(--bad); background: rgba(239, 68, 68, .12); }
.pill.accent { color: #a996ff; background: rgba(124, 92, 255, .14); }
[data-theme="light"] .pill.accent { color: #5b3df5; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px rgba(34, 197, 94, .14); flex: none; }
.dot.bad { background: var(--bad); box-shadow: 0 0 0 4px rgba(239, 68, 68, .14); }
.dot.idle { background: var(--faint); box-shadow: none; }

.avatar {
  display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 10px;
  font-weight: 700; font-size: 13px; color: #fff; background: var(--avatar, var(--grad));
}
.avatar.lg { width: 48px; height: 48px; border-radius: 14px; font-size: 18px; }

.meter { display: flex; align-items: center; gap: 10px; min-width: 110px; }
.meter-track { flex: 1; height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.meter-fill { height: 100%; width: 0; border-radius: inherit; background: var(--grad); transition: width .4s var(--ease); }
.meter.full .meter-fill { background: var(--warn); }
.meter span { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- панели инструментов и таблицы */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar .input-icon { flex: 1; min-width: 220px; }
.toolbar select { width: auto; min-width: 170px; }
.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--border); flex-wrap: wrap; }
.segmented button {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); font: 500 13px var(--font); cursor: pointer;
}
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.segmented .count { font-size: 11.5px; color: var(--faint); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  padding: 11px 16px; text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: .05em;
  text-transform: uppercase; color: var(--faint); border-bottom: 1px solid var(--border); white-space: nowrap;
}
td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--surface-2); }
tr.clickable { cursor: pointer; }
tr.selected { background: rgba(124, 92, 255, .07); }
td.check, th.check { width: 44px; padding-right: 0; }
td.actions { text-align: right; white-space: nowrap; }
.cell-user { display: flex; align-items: center; gap: 12px; min-width: 200px; }
.cell-user .name { font-weight: 600; }
.cell-user .note { font-size: 12.5px; color: var(--muted); max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-date .rel { font-size: 12px; color: var(--muted); }
.cell-date.warn .rel { color: var(--warn); }
.cell-date.bad .rel { color: var(--bad); }
.alias { min-height: 34px; padding: 6px 10px; font-size: 13px; }
.alias.dirty { border-color: var(--warn); }

.empty { display: grid; place-items: center; gap: 10px; padding: 48px 20px; text-align: center; color: var(--muted); }
.empty .i { width: 34px; height: 34px; color: var(--faint); }
.empty h3 { color: var(--text); font-size: 15px; }

.bulk-stack { position: sticky; bottom: 18px; z-index: 4; display: grid; gap: 10px; }
.bulk-stack .bulkbar { position: static; }
.bulkbar {
  position: sticky; bottom: 18px; z-index: 4; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px 10px 18px; border-radius: 14px; border: 1px solid var(--border-strong);
  background: color-mix(in srgb, var(--surface-2) 90%, transparent); backdrop-filter: blur(14px); box-shadow: var(--shadow);
  animation: rise .2s var(--ease);
}
.bulkbar .grow { flex: 1; font-weight: 600; }
.bulkbar select { width: auto; min-height: 34px; padding: 5px 10px; }

details.endpoints summary { cursor: pointer; color: var(--muted); font-size: 12.5px; list-style: none; }
details.endpoints summary::-webkit-details-marker { display: none; }
details.endpoints[open] summary { color: var(--text); }
.endpoint-list { margin-top: 6px; display: grid; gap: 2px; font-family: var(--mono); font-size: 12px; color: var(--muted); max-height: 160px; overflow: auto; }

/* ---------- источники */
.source-card { display: grid; align-content: start; gap: 14px; }
.source-card .head { display: flex; align-items: flex-start; gap: 12px; }
.source-card .head .grow { flex: 1; min-width: 0; }
.source-card h3 { font-size: 15px; }
.source-url { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--border); font-family: var(--mono); font-size: 12px; color: var(--muted); }
.source-url span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 3px 9px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; color: var(--muted); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; font-size: 13px; }
.alert.bad { background: rgba(239, 68, 68, .09); color: var(--bad); border: 1px solid rgba(239, 68, 68, .25); }
.alert.warn { background: rgba(245, 158, 11, .09); color: var(--warn); border: 1px solid rgba(245, 158, 11, .25); }
.alert.info { background: rgba(124, 92, 255, .08); color: var(--muted); border: 1px solid rgba(124, 92, 255, .2); }
.alert .grow { flex: 1; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.spread { justify-content: space-between; }

.stats-line { display: flex; flex-wrap: wrap; gap: 18px; color: var(--muted); font-size: 13px; }
.stats-line b { color: var(--text); font-weight: 600; }

/* ---------- диалоги */
dialog { padding: 0; border: 0; background: transparent; color: var(--text); max-width: none; max-height: none; }
dialog::backdrop { background: rgba(5, 7, 12, .6); backdrop-filter: blur(4px); }
.modal { width: min(560px, calc(100vw - 24px)); margin: auto; }
.modal.wide { width: min(860px, calc(100vw - 24px)); }
.modal[open] .modal-card { animation: pop .22s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.modal-card { border: 1px solid var(--border-strong); background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); max-height: calc(100vh - 40px); display: flex; flex-direction: column; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 0; }
.modal-head h2 { font-size: 17px; }
.modal-body { padding: 18px 20px 20px; overflow: auto; display: grid; gap: 14px; }
.confirm .modal-body h2 { font-size: 17px; }
pre.json { margin: 0; padding: 14px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--border); font: 12px/1.55 var(--mono); max-height: 60vh; overflow: auto; color: var(--muted); }

.drawer { margin: 0 0 0 auto; height: 100vh; width: min(520px, 100vw); }
.drawer[open] { animation: slide .28s var(--ease); }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
.drawer-body { height: 100%; overflow-y: auto; background: var(--surface); border-left: 1px solid var(--border-strong); box-shadow: var(--shadow); display: grid; align-content: start; }
.drawer-section { padding: 20px 24px; border-bottom: 1px solid var(--border); display: grid; gap: 12px; }
.drawer-section h3 { font-size: 12px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); }
.drawer-head { display: flex; align-items: flex-start; gap: 14px; }
.drawer-head .grow { flex: 1; min-width: 0; }
.drawer-head h2 { font-size: 19px; overflow-wrap: anywhere; }
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.device { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.device .grow { flex: 1; min-width: 0; }
.device .hwid { font-family: var(--mono); font-size: 11.5px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.danger-zone { background: rgba(239, 68, 68, .03); }

.pick-group { display: grid; gap: 4px; }
.pick-group h4 { margin: 10px 0 4px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); }
.pick { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 10px; cursor: pointer; }
.pick:hover { background: var(--surface-2); }
.pick .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-list { max-height: 50vh; overflow: auto; margin: 0 -10px; padding: 0 10px; }

/* ---------- уведомления */
.toasts { position: fixed; inset: auto 20px 20px auto; margin: 0; padding: 0; border: 0; background: transparent; overflow: visible; z-index: 100; display: grid; gap: 10px; width: min(380px, calc(100vw - 40px)); }
.toasts:popover-open { display: grid; }
.toast {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--border-strong); background: var(--surface-2); box-shadow: var(--shadow);
  animation: pop .25s var(--ease); font-size: 13.5px;
}
.toast .i { color: var(--ok); margin-top: 1px; }
.toast.bad .i { color: var(--bad); }
.toast.out { opacity: 0; transform: translateY(6px); transition: .25s; }

.audit-action { font-family: var(--mono); font-size: 12px; color: var(--muted); }

/* ---------- адаптив */
@media (max-width: 1100px) {
  .grid.kpi { grid-template-columns: repeat(2, 1fr); }
  .grid.two { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 30; width: var(--sidebar); transform: translateX(-100%); transition: transform .25s var(--ease); }
  .app.menu-open .sidebar { transform: none; box-shadow: var(--shadow); }
  .app.menu-open .scrim { display: block; position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, .5); }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 14px 16px; }
  .topbar-title h1 { font-size: 18px; }
  .view { padding: 18px 16px 50px; }
  .form-grid.two { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
  .quick { grid-template-columns: repeat(2, 1fr); }
  .topbar-actions .btn-label { display: none; }
}
@media (max-width: 520px) {
  .grid.kpi { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi-card { padding: 14px; }
  .kpi-card strong { font-size: 24px; }
  .grid.cards { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Config order controls: arrows remain usable on touch screens. */
.order-column{width:112px;white-space:nowrap}.order-controls{display:flex;align-items:center;gap:2px}.order-controls .icon-btn{min-width:30px;min-height:34px}.order-grip{cursor:grab}.order-grip:active{cursor:grabbing}.order-dragging{opacity:.45}.order-controls button:disabled{opacity:.3;cursor:default}@media(max-width:640px){.order-column{width:78px}.order-grip{display:none}.order-controls .icon-btn{min-width:34px;min-height:40px}}

/* Users: original list appearance with group filter and bulk controls. */
.client-group-tabs{margin-bottom:16px;flex-wrap:wrap}.client-bulk{display:flex;align-items:center;gap:10px;flex-wrap:wrap;padding:12px 16px;margin-bottom:14px;background:var(--surface-2);border:1px solid var(--border);border-radius:12px}.client-bulk[hidden]{display:none}.clients-grid input[type=checkbox]{width:16px;height:16px;cursor:pointer}.clients-grid td:first-child,.clients-grid th:first-child{width:38px;padding-right:0}.client-row-actions{display:flex;gap:6px;align-items:center;justify-content:flex-end}.client-row-actions .btn{white-space:nowrap}.clients-grid tr.client-selected{background:rgba(124,92,255,.08)}@media(max-width:860px){.client-row-actions{gap:2px}.client-row-actions .btn{padding:6px}.client-group-tabs button{flex:1}.clients-grid{min-width:600px}}
