:root {
  color-scheme: light;
  --h: 220; --page-l: 96%; --surface-l: 98%; --subtle-l: 92%; --ink-l: 13%; --muted-l: 36%; --line-l: 83%; --action-l: 32%;
  --bg: hsl(var(--h) 30% var(--page-l)); --surface: hsl(var(--h) 45% var(--surface-l)); --subtle: hsl(var(--h) 35% var(--subtle-l));
  --ink: hsl(var(--h) 32% var(--ink-l)); --muted: hsl(var(--h) 18% var(--muted-l)); --line: hsl(var(--h) 24% var(--line-l));
  --accent: hsl(var(--h) 84% 79%); --accent-hover: hsl(var(--h) 80% 72%); --accent-ink: hsl(var(--h) 53% 13%);
  --good: hsl(var(--h) 55% var(--action-l)); --warn: #8b5a14; --error: #a53442;
  --shadow: 0 12px 30px hsl(var(--h) 35% 15% / .09); --hero: hsl(var(--h) 46% 23%); --hero-text: hsl(var(--h) 50% 96%);
  background-color: var(--bg); accent-color: var(--good);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) { color-scheme: dark; --page-l: 9%; --surface-l: 14%; --subtle-l: 20%; --ink-l: 95%; --muted-l: 78%; --line-l: 31%; --action-l: 76%; --warn: #efbc75; --error: #ffa4ad; --shadow: none; }
}
:root[data-theme="dark"] { color-scheme: dark; --page-l: 9%; --surface-l: 14%; --subtle-l: 20%; --ink-l: 95%; --muted-l: 78%; --line-l: 31%; --action-l: 76%; --warn: #efbc75; --error: #ffa4ad; --shadow: none; }
:root[data-palette="green"] { --h: 139; }
:root[data-palette="blue"] { --h: 212; }
:root[data-palette="purple"] { --h: 278; }
:root[data-palette="orange"] { --h: 27; }
:root[data-palette="neon"] { --h: 263; }
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--good); outline-offset: 3px; }
p, dl, dd, h1, h2, h3, h4 { margin: 0; }
.symbols { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.shell { width: min(100% - 48px, 1040px); margin-inline: auto; }
.topbar { padding-top: env(safe-area-inset-top); border-bottom: 1px solid var(--line); background: var(--surface); }
.topbar-content, .brand, .environment { display: flex; align-items: center; }
.topbar-content { justify-content: space-between; min-height: 76px; gap: 12px; }
.brand { gap: 11px; line-height: 1.2; }
.brand-mark { flex: none; object-fit: contain; border-radius: 31%; }
.brand strong { display: block; font-size: 1rem; }
.brand span { display: block; color: var(--muted); font-size: .76rem; margin-top: 4px; }
.environment { gap: 7px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 99px; color: var(--muted); font-weight: 600; font-size: .75rem; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.environment .status-dot { color: var(--good); }
main { padding-block: 38px 40px; }
.intro { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin-bottom: 25px; }
h1 { font-size: clamp(2.25rem, 5vw, 3.25rem); line-height: 1.05; letter-spacing: -.055em; }
.intro p { margin-top: 9px; color: var(--muted); }
.button { min-height: 44px; padding: 10px 15px; border: 1px solid transparent; border-radius: 12px; display: inline-flex; justify-content: center; align-items: center; gap: 7px; font-weight: 690; font-size: .9rem; line-height: 1.2; }
.primary { background: var(--accent); color: var(--accent-ink); }
#admin-view > .intro { align-items: center; justify-content: center; flex-direction: column; text-align: center; }
#admin-view > .intro .primary { width: min(100%, 320px); }
.binding.missing, .missing, .danger { color: var(--error); font-weight: 650; }
.stats-box { margin-bottom: 18px; }
.stats-box summary, #delete-section summary { cursor: pointer; font-weight: 650; }
.palette-field { max-width: 360px; margin-block: 18px !important; }
:root[data-palette="neon"] :is(.hero, .primary) { background: linear-gradient(110deg,#572773,#343da4,#8b267a,#572773); background-size: 300% 100%; color: white; }
@media (prefers-reduced-motion: no-preference) { :root[data-palette="neon"] :is(.hero,.primary) { animation: neon-drift 9s ease-in-out infinite alternate; } }
@keyframes neon-drift { from { background-position: 0% 50%; } to { background-position: 100% 50%; } }
.primary:not(:disabled):hover { background: var(--accent-hover); }
.secondary { background: var(--surface); border-color: var(--line); }
.secondary:not(:disabled):hover, .filter:hover, .icon-button:hover { background: var(--subtle); }
.full { width: 100%; }
.hero { position: relative; overflow: hidden; isolation: isolate; padding: 22px 26px 24px; margin-bottom: 33px; color: var(--hero-text); background: linear-gradient(125deg, var(--hero), hsl(var(--h) 48% 32%)); border-radius: 20px; }
.hero-caption { display: flex; align-items: center; gap: 9px; font-size: .66rem; font-weight: 750; letter-spacing: .14em; margin-bottom: 14px; }
.hero-icon, .guide-icon { display: inline-grid; place-items: center; width: 33px; height: 33px; flex: none; border-radius: 10px; }
.hero-icon { background: #ffffff1f; color: var(--accent); }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 700px; }
.metrics div { display: flex; flex-direction: column-reverse; justify-content: start; gap: 3px; padding-inline: 18px; border-inline-start: 1px solid #ffffff35; }
.metrics div:first-child { border: 0; padding-inline-start: 0; }
.metrics dt { font-size: .83rem; color: var(--hero-text); }
.metrics dd { font-size: clamp(1.65rem, 5vw, 2.55rem); line-height: 1; font-weight: 730; letter-spacing: -.05em; font-variant-numeric: tabular-nums; }
.hero-orbits { position: absolute; z-index: -1; width: 375px; height: 190px; right: -87px; top: -32px; transform: rotate(-26deg); border: 1px solid #ffffff25; border-radius: 50%; box-shadow: 0 0 0 20px #ffffff0b, 0 0 0 42px #ffffff0c, 0 0 0 67px #ffffff0c; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; align-items: start; gap: 25px; }
.section-head { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.list-refresh { margin-inline-start: auto; min-height: 38px; padding: 6px 11px; }
h2 { font-size: 1.28rem; letter-spacing: -.025em; line-height: 1.2; }
.count { border-radius: 20px; background: var(--subtle); color: var(--muted); padding: 2px 8px; font-size: .75rem; font-weight: 650; }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin-bottom: 10px; }
.search { display: flex; align-items: center; gap: 9px; flex: 1 0 185px; min-width: 0; background: var(--surface); border: 1px solid var(--line); padding-inline: 12px; border-radius: 11px; color: var(--muted); }
.search:focus-within { outline: 2px solid var(--good); outline-offset: -2px; }
.search input { min-width: 0; width: 100%; height: 42px; padding: 0; border: 0; outline: none; background: transparent; color: var(--ink); font-size: .88rem; }
.search input:focus-visible { outline: none; }
.search input::placeholder { color: var(--muted); }
.filters { display: flex; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
.filter { background: transparent; border: 0; padding: 7px 10px; min-height: 34px; border-radius: 8px; font-size: .8rem; color: var(--muted); }
.filter[aria-pressed="true"] { background: var(--subtle); color: var(--ink); font-weight: 720; }
.list { margin: 0; padding: 0; list-style: none; display: grid; gap: 7px; }
.user-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 66px; padding: 10px 13px; text-align: start; border-radius: 13px; background: var(--surface); border: 1px solid var(--line); }
.user-row:hover { background: var(--subtle); }
.avatar { display: grid; place-items: center; width: 39px; height: 39px; flex: none; border-radius: 11px; background: var(--subtle); color: var(--good); font-size: .92rem; font-weight: 740; }
.user-copy { flex: 1; min-width: 0; }
.user-name { display: block; overflow-wrap: anywhere; font-size: .94rem; }
.user-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 9px; margin-top: 2px; font-size: .75rem; color: var(--muted); }
.status { display: inline-flex; align-items: center; gap: 5px; }
.status .status-dot { width: 6px; height: 6px; color: var(--warn); }
.status.is-active .status-dot { color: var(--good); }
.countries { font-variant-emoji: emoji; }
.badge { display: inline-block; border-radius: 20px; padding: 3px 8px; font-size: .72rem; font-weight: 700; white-space: nowrap; color: var(--ink); background: var(--subtle); }
.badge.pro, .badge.god, .badge.secure { color: var(--good); }
.row-chevron { width: 16px; color: var(--muted); }
.empty { padding: 26px 16px; border: 1px dashed var(--line); border-radius: 13px; text-align: center; }
.empty p { margin-top: 4px; color: var(--muted); }
.empty p:empty { display: none; }
.empty .button { margin-top: 12px; }
.guide { border: 1px solid var(--line); background: var(--surface); padding: 17px; border-radius: 16px; box-shadow: var(--shadow); }
.guide-icon { background: var(--subtle); color: var(--good); margin-bottom: 9px; }
.guide dl { margin-top: 12px; }
.guide dl div { display: grid; grid-template-columns: 58px minmax(0, 1fr); align-items: baseline; gap: 7px; padding-block: 7px; }
.guide dd { font-size: .83rem; }
.connection-diagnostics { margin-top: 18px; padding: 12px 15px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.connection-diagnostics summary { cursor: pointer; font-size: .88rem; }
.connection-diagnostics p { margin: 8px 0; }
.connection-diagnostics input { width: 100%; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); padding: 8px; margin-bottom: 8px; }
.view-switch { display: flex; justify-content: flex-end; padding-top: 16px; }
.cabinet-list { display: grid; gap: 14px; }
.cabinet-card { padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); min-width: 0; }
.cabinet-card h2 { overflow-wrap: anywhere; }
.own-term { margin: 6px 0; }
.cabinet-help { margin-top: 16px; }
.happ-handoff p, .happ-handoff .button { margin-top: 12px; }
.happ-handoff .button { text-decoration: none; }
#cabinet-referrals h2 { margin-bottom: 8px; }
#cabinet-referral-list input { width: 100%; margin-top: 8px; }
#admin-referral-list { margin-top: 10px; }
.referral-metrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-block: 12px; }
.referral-metrics > div { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.referral-metrics dt { font-size: .83rem; }
.referral-metrics dd { margin: 2px 0 0; font-weight: 700; }
.referral-filters { display: flex; align-items: end; flex-wrap: wrap; gap: 8px 12px; margin-bottom: 10px; }
.referral-filters .field { flex: 1 1 180px; margin: 0; }
.referral-record { overflow-wrap: anywhere; }
.referral-record .referral-pair { margin-bottom: 4px; }
.referral-record .button, #referral-pages { margin-top: 8px; }
.cabinet-help summary { cursor: pointer; }
.cabinet-help ol { padding-inline-start: 24px; font-size: .88rem; }
.cabinet-help li { margin-bottom: 6px; }
.guide dd .hint { display: block; margin-top: 2px; }
.guide .badge { overflow: hidden; max-width: 100%; text-overflow: ellipsis; }
.guide dl div { grid-template-columns: minmax(58px, 35%) minmax(0, 1fr); }
.edit-role { padding: 0; border: 0; text-align: start; background: transparent; color: var(--good); font-size: .83rem; text-decoration: underline; }
.check, .role-options label { display: flex; gap: 8px; align-items: center; min-height: 36px; font-size: .88rem; }
.check { margin-bottom: 8px; }
.check input, .role-options input { accent-color: var(--good); }
.role-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px 10px; }
.traffic-values { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 9px; }
.traffic-values dt { color: var(--muted); font-size: .75rem; }
.traffic-values dd { font-weight: 700; font-size: .88rem; overflow-wrap: anywhere; }
.term-section summary { cursor: pointer; font-weight: 650; font-size: .88rem; }
.term-section form { margin-top: 10px; }
.guide p { border-top: 1px solid var(--line); padding-top: 11px; margin-top: 8px; font-size: .76rem; color: var(--muted); }

dialog { width: min(100% - 30px, 480px); max-height: min(calc(100% - 30px), 760px); padding: 22px; border-radius: 23px; border: 1px solid var(--line); overscroll-behavior: contain; background: var(--surface); color: var(--ink); box-shadow: 0 24px 80px #0003; }
dialog::backdrop { background: hsl(var(--h) 24% 9% / .55); }
.dialog-top { display: flex; justify-content: space-between; align-items: start; gap: 14px; margin-bottom: 17px; }
.dialog-top h2 { overflow-wrap: anywhere; font-size: 1.6rem; }
.eyebrow { font-size: .65rem; color: var(--good); letter-spacing: .13em; font-weight: 760; margin-bottom: 5px; }
.dialog-subtitle, .hint, .panel-message { font-size: .83rem; color: var(--muted); }
.dialog-subtitle { margin-top: 6px; }
.dialog-subtitle:empty { display: none; }
.icon-button { display: grid; place-items: center; width: 42px; height: 42px; flex: none; border: 1px solid var(--line); background: var(--surface); border-radius: 11px; }
.field { display: grid; gap: 6px; border: 0; padding: 0; margin: 0 0 14px; font-size: .88rem; font-weight: 650; }
.field input:not([type="checkbox"]), .field select, .delivery input { width: 100%; min-width: 0; min-height: 44px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); font-size: 1rem; }
.field legend { padding: 0 0 6px; }
.country-options { display: flex; flex-wrap: wrap; gap: 7px; }
.country-options label { display: flex; align-items: center; gap: 7px; min-height: 42px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.country-options input { accent-color: var(--good); }
.hint + .full { margin-top: 11px; }
.panel-section { border-top: 1px solid var(--line); padding-block: 14px; }
.panel-section:last-child { padding-bottom: 0; }
.panel-section h3 { font-size: .92rem; margin-bottom: 9px; }
.panel-section .field { margin-bottom: 6px; }
.action-buttons { display: flex; flex-wrap: wrap; gap: 7px; }
.action-buttons + .hint { margin-top: 7px; }
.refresh-user { min-height: 36px; padding: 4px 0; border: 0; background: none; color: var(--good); font-size: .83rem; text-align: start; text-decoration: underline; }
.delivery { margin-top: 12px; padding: 11px; border-radius: 11px; background: var(--subtle); }
.delivery h4 { font-size: .86rem; }
.delivery .hint { margin-top: 3px; }
.delivery .action-buttons, .delivery input { margin-top: 9px; }
.delivery input { font-size: .83rem; }
.panel-message { margin-top: 13px; overflow-wrap: anywhere; color: var(--good); }
.panel-message.error { color: var(--error); }
.toast { position: fixed; bottom: max(15px, env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); background: var(--hero); color: var(--hero-text); padding: 9px 14px; border-radius: 10px; box-shadow: var(--shadow); font-size: .86rem; max-width: 90%; text-align: center; }

@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; gap: 17px; }
  .guide dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 11px; }
}
@media (max-width: 540px) {
  .shell { width: calc(100% - 32px); }
  .topbar-content { min-height: 63px; }
  main { padding-block: 23px 30px; }
  .intro { align-items: start; flex-direction: column; gap: 13px; margin-bottom: 16px; }
  .intro .primary { width: 100%; }
  .hero { margin-bottom: 22px; padding: 14px 14px 17px; border-radius: 15px; }
  .hero-caption { margin-bottom: 10px; }
  .metrics div { padding-inline: 9px 3px; }
  .metrics dt { font-size: .72rem; }
  .controls { flex-direction: column; align-items: stretch; }
  .search { flex: auto; }
  .filter { flex: 1; }
  .guide dl { grid-template-columns: 1fr; }
  dialog { width: 100%; max-width: 100%; max-height: 93%; margin: auto 0 0; border-radius: 22px 22px 0 0; padding: 18px 16px max(18px, env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: no-preference) { .button, .user-row { transition: background-color .15s ease; } }
