:root {
  color-scheme: dark;
  font-family: Inter, "SF Pro Display", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-synthesis: none;
  --bg: #080a12;
  --bg-subtle: #0b0e19;
  --sidebar: #0a0c15;
  --surface: #111521;
  --surface-raised: #171b29;
  --surface-soft: #1b2030;
  --surface-hover: #202638;
  --input-bg: #0d101b;
  --line: #293044;
  --line-soft: #202638;
  --line-strong: #39435d;
  --text: #f5f6fb;
  --text-secondary: #c6ccda;
  --muted: #848da2;
  --faint: #606a80;
  --accent: #8068ff;
  --accent-hover: #927fff;
  --accent-soft: rgb(128 104 255 / 13%);
  --accent-line: rgb(128 104 255 / 36%);
  --cyan: #45d6d1;
  --cyan-soft: rgb(69 214 209 / 12%);
  --success: #39d98a;
  --success-soft: rgb(57 217 138 / 11%);
  --warning: #f2b84b;
  --warning-soft: rgb(242 184 75 / 12%);
  --danger: #ff6681;
  --danger-soft: rgb(255 102 129 / 11%);
  --shadow-sm: 0 8px 24px rgb(0 0 0 / 18%);
  --shadow-lg: 0 30px 80px rgb(0 0 0 / 36%);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f6fb;
  --bg-subtle: #eef1f8;
  --sidebar: #ffffff;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --surface-soft: #f5f7fc;
  --surface-hover: #f0f2fa;
  --input-bg: #f8f9fd;
  --line: #dce1ec;
  --line-soft: #e9ecf3;
  --line-strong: #cbd2e1;
  --text: #171b2c;
  --text-secondary: #3e465c;
  --muted: #737d92;
  --faint: #9aa3b5;
  --accent: #6653e8;
  --accent-hover: #5944dc;
  --accent-soft: rgb(102 83 232 / 9%);
  --accent-line: rgb(102 83 232 / 23%);
  --cyan: #0f9f9b;
  --cyan-soft: rgb(15 159 155 / 9%);
  --success: #149d5e;
  --success-soft: rgb(20 157 94 / 9%);
  --warning: #bf7b13;
  --warning-soft: rgb(191 123 19 / 9%);
  --danger: #dc3f5d;
  --danger-soft: rgb(220 63 93 / 8%);
  --shadow-sm: 0 8px 28px rgb(37 45 76 / 7%);
  --shadow-lg: 0 32px 90px rgb(37 45 76 / 16%);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
html { background: var(--bg); }
body {
  background:
    radial-gradient(circle at 80% -10%, rgb(128 104 255 / 6%), transparent 28%),
    var(--bg);
  color: var(--text);
  letter-spacing: .01em;
  transition: background-color .22s ease, color .22s ease;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 0; }
input, select, textarea {
  background: var(--input-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  outline: 0;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
  width: 100%;
}
input, select { min-height: 42px; padding: 0 13px; }
textarea { line-height: 1.6; padding: 12px 14px; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: var(--line-strong); }
input:focus, select:focus, textarea:focus {
  background: var(--input-bg);
  border-color: var(--line);
  box-shadow: none;
  outline: 0;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-repeat: no-repeat; background-size: 5px 5px, 5px 5px; padding-right: 34px; }

/* Shared brand and controls */
.brand-mark {
  align-items: center;
  background: linear-gradient(145deg, #9a88ff, #6952ec 66%, #5741d6);
  border: 1px solid rgb(255 255 255 / 20%);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgb(92 67 225 / 28%), inset 0 1px rgb(255 255 255 / 22%);
  color: white;
  display: inline-flex;
  flex: 0 0 auto;
  height: 44px;
  justify-content: center;
  width: 44px;
}
.brand-mark svg { fill: currentColor; height: 26px; width: 26px; }
.button {
  align-items: center;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  display: inline-flex;
  gap: 8px;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease, box-shadow .18s ease;
}
.button:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--line-strong);
  color: var(--text);
  transform: translateY(-1px);
}
.button:active:not(:disabled) { transform: translateY(0); }
.button svg, .nav-item svg, .theme-toggle svg, .console__sidebar-foot .button svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}
.button svg { height: 16px; width: 16px; }
.button--primary {
  background: linear-gradient(135deg, #8a73ff, #6f57ee);
  border-color: #8c78f5;
  box-shadow: 0 8px 22px rgb(102 79 224 / 22%), inset 0 1px rgb(255 255 255 / 16%);
  color: #fff;
  font-weight: 700;
}
.button--primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #9a87ff, #7861f2);
  border-color: #a493ff;
  box-shadow: 0 10px 28px rgb(102 79 224 / 30%);
  color: #fff;
}
.button--large { font-size: 14px; min-height: 48px; width: 100%; }
.button--compact { font-size: 12px; min-height: 32px; padding: 0 10px; }
.button--quiet { background: transparent; border-color: transparent; box-shadow: none; color: var(--muted); justify-content: flex-start; }
.button--danger { background: var(--danger-soft); border-color: rgb(255 102 129 / 20%); color: var(--danger); }
.button--danger:hover:not(:disabled) { background: rgb(255 102 129 / 16%); border-color: rgb(255 102 129 / 34%); color: var(--danger); }
.button--icon-text { white-space: nowrap; }
.button__plus { font-size: 21px; font-weight: 300; line-height: 1; margin-top: -2px; }
.button.is-busy { filter: saturate(.7); }
.theme-toggle {
  align-items: center;
  background: var(--surface-raised);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--muted);
  display: inline-flex;
  height: 38px;
  justify-content: center;
  transition: .18s ease;
  width: 38px;
}
.theme-toggle:hover { background: var(--surface-hover); border-color: var(--line-strong); color: var(--text); }
.theme-icon { height: 17px; width: 17px; }
.theme-icon--moon { display: none; }
:root[data-theme="light"] .theme-icon--moon { display: block; }
:root[data-theme="light"] .theme-icon--sun { display: none; }
.form-error { background: var(--danger-soft); border: 1px solid rgb(255 102 129 / 24%); border-radius: var(--radius-sm); color: var(--danger); font-size: 12px; line-height: 1.5; margin: 0; padding: 10px 12px; }
.muted { color: var(--muted); font-size: 12px; }

/* Authentication */
.auth-view {
  align-items: center;
  background:
    linear-gradient(90deg, transparent 49.9%, var(--line-soft) 50%, transparent 50.1%),
    radial-gradient(circle at 19% 20%, rgb(128 104 255 / 17%), transparent 30%),
    radial-gradient(circle at 80% 78%, rgb(69 214 209 / 8%), transparent 26%),
    var(--bg);
  display: grid;
  gap: clamp(56px, 9vw, 144px);
  grid-template-columns: minmax(390px, 1fr) minmax(360px, 440px);
  isolation: isolate;
  min-height: 100dvh;
  overflow: hidden;
  padding: 64px max(48px, 9vw);
  position: relative;
}
.auth-view::before {
  background-image: linear-gradient(rgb(128 104 255 / 6%) 1px, transparent 1px), linear-gradient(90deg, rgb(128 104 255 / 6%) 1px, transparent 1px);
  background-size: 58px 58px;
  content: "";
  inset: 0 50% 0 0;
  mask-image: linear-gradient(90deg, black, transparent 88%);
  opacity: .55;
  pointer-events: none;
  position: absolute;
  z-index: -1;
}
.auth-view::after {
  background: var(--accent);
  border-radius: 999px;
  content: "";
  filter: blur(90px);
  height: 180px;
  left: 13%;
  opacity: .11;
  position: absolute;
  top: 42%;
  width: 180px;
  z-index: -1;
}
.auth-view__visual { display: flex; flex-direction: column; min-height: 540px; }
.auth-view__brand { align-items: center; display: flex; gap: 15px; }
.auth-view__brand .brand-mark { height: 50px; width: 50px; }
.auth-view__brand strong { display: block; font-size: 25px; letter-spacing: .12em; line-height: 1; }
.auth-view__brand small { color: var(--muted); display: block; font-size: 9px; letter-spacing: .16em; margin-top: 7px; }
.auth-view__copy { margin: auto 0; max-width: 660px; padding: 64px 0; }
.eyebrow { color: var(--cyan); font-size: 12px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; }
.auth-view__copy h2 { font-size: clamp(39px, 4.1vw, 64px); font-weight: 650; letter-spacing: -.045em; line-height: 1.15; margin: 22px 0 24px; }
.auth-view__copy p { color: var(--muted); font-size: 15px; line-height: 1.8; margin: 0; }
.auth-view__features { display: grid; gap: 12px; grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 640px; }
.auth-view__features div { border-left: 1px solid var(--line-strong); display: grid; gap: 7px; padding: 5px 18px; }
.auth-view__features strong { color: var(--accent-hover); font-size: 11px; letter-spacing: .12em; }
.auth-view__features span { color: var(--text-secondary); font-size: 12px; white-space: nowrap; }
.auth-panel {
  align-self: center;
  backdrop-filter: blur(24px);
  background: color-mix(in srgb, var(--surface-raised) 92%, transparent);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg), inset 0 1px rgb(255 255 255 / 4%);
  display: grid;
  gap: 18px;
  padding: 30px;
  position: relative;
}
.auth-panel::before { background: linear-gradient(90deg, transparent, var(--accent), var(--cyan), transparent); content: ""; height: 1px; left: 18%; opacity: .7; position: absolute; right: 18%; top: -1px; }
.auth-panel__utility { align-items: center; display: flex; justify-content: space-between; margin-bottom: 12px; }
.auth-panel__utility > span { color: var(--faint); font-size: 9px; font-weight: 700; letter-spacing: .2em; }
.auth-panel header { align-items: center; display: flex; justify-content: space-between; }
.auth-panel p, .auth-panel h1 { margin: 0; }
.auth-panel header p { color: var(--accent-hover); font-size: 11px; font-weight: 650; letter-spacing: .08em; margin-bottom: 8px; }
.auth-panel h1 { font-size: 27px; letter-spacing: -.025em; }
.auth-panel__server { align-items: center; background: var(--surface-soft); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); color: var(--faint); display: flex; font-size: 10px; justify-content: space-between; margin-bottom: 4px; min-height: 34px; padding: 0 11px; }
.auth-panel label, .dialog label { display: grid; gap: 8px; }
.auth-panel label > span, .dialog label > span { color: var(--text-secondary); font-size: 12px; font-weight: 650; }
.auth-panel input { min-height: 46px; }
.status-dot { align-items: center; color: var(--muted); display: inline-flex; font-size: 11px; gap: 7px; white-space: nowrap; }
.status-dot::before { background: var(--warning); border-radius: 50%; box-shadow: 0 0 0 4px var(--warning-soft); content: ""; height: 6px; width: 6px; }
.status-dot.is-online { color: var(--success); }
.status-dot.is-online::before { background: var(--success); box-shadow: 0 0 0 4px var(--success-soft); }
.auth-panel__hint { color: var(--faint); font-size: 10px; text-align: center; }

/* Console shell */
.console { display: grid; grid-template-columns: 188px minmax(0, 1fr); height: 100dvh; min-height: 0; }
.console__sidebar {
  background:
    radial-gradient(circle at 20% 5%, rgb(128 104 255 / 10%), transparent 24%),
    var(--sidebar);
  border-right: 1px solid var(--line-soft);
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  min-height: 0;
  padding: 20px 12px 16px;
}
.console__brand { align-items: center; display: flex; gap: 10px; padding: 0 6px 24px; }
.console__brand .brand-mark { border-radius: 9px; height: 34px; width: 34px; }
.console__brand .brand-mark svg { height: 20px; width: 20px; }
.console__brand strong { display: block; font-size: 15px; letter-spacing: .08em; }
.console__brand small { color: var(--faint); display: block; font-size: 8px; letter-spacing: .14em; margin-top: 5px; }
.nav-caption { color: var(--faint); font-size: 9px; font-weight: 700; letter-spacing: .15em; margin: 0 10px 8px; text-transform: uppercase; }
.console nav { align-content: start; display: grid; gap: 4px; }
.nav-item {
  align-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--muted);
  display: flex;
  font-size: 13px;
  font-weight: 550;
  gap: 10px;
  min-height: 40px;
  padding: 0 10px;
  position: relative;
  text-align: left;
  transition: .18s ease;
}
.nav-item svg { height: 17px; width: 17px; }
.nav-item:hover { background: var(--surface-soft); color: var(--text-secondary); }
.nav-item.is-active { background: var(--accent-soft); border-color: var(--accent-line); color: var(--text); }
.nav-item.is-active::after { background: var(--accent); border-radius: 4px; content: ""; height: 18px; left: -13px; position: absolute; width: 3px; }
.nav-item.is-active svg { color: var(--accent-hover); }
.console__sidebar-foot { border-top: 1px solid var(--line-soft); display: grid; gap: 8px; padding: 16px 4px 0; }
.account-card { align-items: center; display: flex; gap: 10px; min-width: 0; padding: 5px 8px 10px; }
.account-card__avatar { align-items: center; background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: 10px; color: var(--accent-hover); display: inline-flex; flex: 0 0 auto; font-size: 12px; font-weight: 800; height: 36px; justify-content: center; width: 36px; }
.account-card > div { min-width: 0; }
.account-card strong { display: block; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-card small { color: var(--muted); display: block; font-size: 9px; margin-top: 4px; }
.console__sidebar-foot .button { font-size: 12px; gap: 10px; width: 100%; }
.console__sidebar-foot .button svg { height: 17px; width: 17px; }
.console__main { background: var(--bg); min-width: 0; overflow: auto; }
.topbar {
  align-items: center;
  backdrop-filter: blur(18px);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  justify-content: space-between;
  min-height: 72px;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 5;
}
.topbar p, .topbar h1 { margin: 0; }
.topbar p { color: var(--muted); font-size: 10px; letter-spacing: .05em; margin-bottom: 6px; }
.topbar h1 { font-size: 22px; letter-spacing: -.02em; }
.topbar__right { align-items: center; display: flex; gap: 10px; }
.sync-state { align-items: center; color: var(--muted); display: inline-flex; font-size: 10px; gap: 7px; margin-right: 4px; }
.sync-state::before { background: var(--success); border-radius: 50%; box-shadow: 0 0 0 3px var(--success-soft); content: ""; height: 5px; width: 5px; }
.view-panel { margin: 0 auto; max-width: 1680px; padding: 24px 28px 44px; }

/* Dashboard and sections */
.metric-grid { display: grid; gap: 16px; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 22px; }
.metric {
  --metric-color: var(--accent);
  --metric-soft: var(--accent-soft);
  background: linear-gradient(145deg, var(--surface-raised), var(--surface));
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 10px;
  min-height: 152px;
  overflow: hidden;
  padding: 20px;
  position: relative;
}
.metric::after { background: var(--metric-color); border-radius: 50%; content: ""; filter: blur(38px); height: 72px; opacity: .11; position: absolute; right: -20px; top: -20px; width: 72px; }
.metric--emerald { --metric-color: var(--success); --metric-soft: var(--success-soft); }
.metric--cyan { --metric-color: var(--cyan); --metric-soft: var(--cyan-soft); }
.metric--amber { --metric-color: var(--warning); --metric-soft: var(--warning-soft); }
.metric__head { align-items: center; display: flex; justify-content: space-between; }
.metric span, .metric small { color: var(--muted); font-size: 11px; }
.metric__icon { align-items: center; background: var(--metric-soft); border: 1px solid color-mix(in srgb, var(--metric-color) 24%, transparent); border-radius: 8px; color: var(--metric-color) !important; display: inline-flex; font-size: 11px !important; font-weight: 800; height: 30px; justify-content: center; width: 30px; }
.metric strong { color: var(--text); font-size: 34px; font-weight: 650; letter-spacing: -.04em; line-height: 1; }
.data-section { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.data-section__header { align-items: center; background: linear-gradient(180deg, var(--surface-raised), var(--surface)); border-bottom: 1px solid var(--line-soft); display: flex; gap: 18px; justify-content: space-between; min-height: 72px; padding: 14px 18px; }
.data-section h2, .data-section p { margin: 0; }
.data-section h2 { font-size: 16px; letter-spacing: -.01em; }
.data-section p { color: var(--muted); font-size: 11px; line-height: 1.5; margin-top: 6px; }
.section-title-line { align-items: center; display: flex; gap: 10px; }
.count-badge { background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: 999px; color: var(--accent-hover); font-size: 9px; font-weight: 700; padding: 3px 8px; white-space: nowrap; }
.audit-stream { display: grid; }
.audit-item { align-items: center; border-bottom: 1px solid var(--line-soft); display: grid; gap: 20px; grid-template-columns: 180px 180px minmax(0, 1fr); min-height: 64px; padding: 0 20px; transition: background .16s ease; }
.audit-item:hover { background: var(--surface-soft); }
.audit-item:last-child { border-bottom: 0; }
.audit-item time, .audit-item span { color: var(--muted); font-size: 11px; }
.audit-item strong { font-size: 12px; font-weight: 650; }
.table-tools { align-items: center; display: flex; gap: 10px; }
.table-tools input { min-width: 270px; }
.table-scroll { max-width: 100%; overflow: auto; }
table { border-collapse: separate; border-spacing: 0; min-width: 900px; table-layout: auto; width: 100%; }
th, td { border-bottom: 1px solid var(--line-soft); padding: 11px 12px; text-align: left; vertical-align: middle; }
th { background: var(--surface-soft); color: var(--muted); font-size: 10px; font-weight: 700; height: 46px; letter-spacing: .04em; position: sticky; top: 0; white-space: nowrap; z-index: 1; }
td { color: var(--text-secondary); font-size: 12px; }
tbody tr { transition: background .16s ease; }
tbody tr:hover { background: color-mix(in srgb, var(--surface-hover) 64%, transparent); }
tbody tr:last-child td { border-bottom: 0; }
td > strong { color: var(--text); display: block; font-size: 12px; }
td > small { color: var(--muted); display: block; font-size: 10px; line-height: 1.5; margin-top: 4px; }
.users-table { min-width: 1020px; table-layout: fixed; }
.users-table th:nth-child(1) { width: 145px; }
.users-table th:nth-child(2) { width: 125px; }
.users-table th:nth-child(3) { width: 95px; }
.users-table th:nth-child(4) { width: auto; }
.users-table th:nth-child(5) { width: 82px; }
.users-table th:nth-child(6) { width: 95px; }
.users-table th:nth-child(7) { width: 174px; }
.users-table td { padding: 8px 10px; }
.user-cell { align-items: center; display: flex; gap: 9px; min-width: 0; }
.user-avatar { align-items: center; background: linear-gradient(145deg, var(--accent-soft), var(--cyan-soft)); border: 1px solid var(--accent-line); border-radius: 9px; color: var(--accent-hover); display: inline-flex; flex: 0 0 auto; font-size: 12px; font-weight: 800; height: 34px; justify-content: center; width: 34px; }
.user-cell > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; min-width: 0; overflow: hidden; }
.user-cell strong { color: var(--text); font-size: 12px; grid-column: 1 / -1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-cell small { color: var(--muted); font-size: 10px; grid-column: 1; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-state { align-items: center; color: var(--muted); display: inline-flex; font-size: 9px; gap: 5px; grid-column: 2; margin: 3px 0 0 7px; width: fit-content; }
.user-state i { background: currentColor; border-radius: 50%; height: 5px; width: 5px; }
.user-state.is-active { color: var(--success); }
.user-state.is-restricted { color: var(--danger); }
.identity-stack { align-items: center; display: flex; flex-wrap: wrap; gap: 4px; }
.permission-cloud { align-items: center; display: flex; flex-wrap: wrap; gap: 4px; max-width: 520px; }
.tag { align-items: center; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 999px; color: var(--muted); display: inline-flex; font-size: 9px; line-height: 1; min-height: 20px; padding: 0 7px; white-space: nowrap; }
.tag--green { background: var(--success-soft); border-color: rgb(57 217 138 / 24%); color: var(--success); }
.tag--violet { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-hover); }
.tag--blue { background: var(--cyan-soft); border-color: rgb(69 214 209 / 24%); color: var(--cyan); }
.tag--muted { color: var(--muted); }
.tag--permission { background: transparent; border-color: var(--line); color: var(--text-secondary); }
.date-cell { color: var(--text-secondary); display: inline-block; font-size: 11px; line-height: 1.5; max-width: 110px; }
.row-actions { align-items: center; display: flex; gap: 6px; white-space: nowrap; }
.users-table .button--compact { padding-left: 8px; padding-right: 8px; }
.empty { color: var(--muted); font-size: 12px; padding: 34px 20px; text-align: center; }

/* Activation and audit */
[data-panel="activation"] {
  display: grid;
  gap: 18px;
  grid-template-rows: auto minmax(0, 1fr);
  height: calc(100dvh - 72px);
  min-height: 520px;
  overflow: hidden;
}
.activation-generator .data-section__header { align-items: flex-end; }
.activation-generator__controls { align-items: end; display: grid; gap: 9px; grid-template-columns: 115px 115px 105px auto auto; }
.activation-generator__controls.is-custom { grid-template-columns: 105px 120px 110px 95px auto auto; }
.activation-generator__controls label { display: grid; gap: 6px; }
.activation-generator__controls label > span { color: var(--muted); font-size: 9px; font-weight: 700; }
.activation-generator__controls input, .activation-generator__controls select, .activation-filters input, .activation-filters select { min-height: 38px; }
.activation-list { display: grid; grid-template-rows: auto auto minmax(0, 1fr); min-height: 0; }
.activation-list__header { align-items: flex-end; }
.activation-filters { display: grid; gap: 8px; grid-template-columns: minmax(210px, 1.5fr) repeat(3, minmax(115px, 1fr)); }
.activation-bulkbar { align-items: center; background: var(--surface-soft); border-bottom: 1px solid var(--line-soft); display: flex; gap: 12px; min-height: 50px; padding: 8px 17px; }
.activation-bulkbar label { align-items: center; display: flex; font-size: 11px; gap: 8px; }
.activation-bulkbar input, .checkbox-column input { accent-color: var(--accent); height: 15px; min-height: 0; width: 15px; }
.activation-bulkbar .button { margin-left: auto; min-height: 32px; }
.activation-list .table-scroll { min-height: 0; overflow-x: hidden; overflow-y: auto; }
.activation-table { min-width: 0; table-layout: fixed; width: 100%; }
.activation-table th, .activation-table td { padding: 10px 8px; }
.activation-table th:nth-child(1) { width: 38px; }
.activation-table th:nth-child(2) { width: 15%; }
.activation-table th:nth-child(3) { width: 7%; }
.activation-table th:nth-child(4) { width: 8%; }
.activation-table th:nth-child(5) { width: 8%; }
.activation-table th:nth-child(6) { width: 11%; }
.activation-table th:nth-child(7) { width: 10%; }
.activation-table th:nth-child(8) { width: 11%; }
.activation-table th:nth-child(9) { width: 15%; }
.activation-table th:nth-child(10) { width: 92px; }
.activation-table td { overflow: hidden; text-overflow: ellipsis; }
.checkbox-column { padding-left: 18px; padding-right: 7px; width: 42px; }
.code-hint { color: var(--text) !important; display: block; font-family: "SFMono-Regular", Consolas, monospace; font-size: 10px !important; letter-spacing: .04em; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activation-result-dialog textarea { font-family: "SFMono-Regular", Consolas, monospace; font-size: 11px; line-height: 1.7; min-height: 220px; }

/* Dialogs */
.dialog {
  background: var(--surface-raised);
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  color: var(--text);
  max-height: calc(100dvh - 48px);
  padding: 0;
  width: min(760px, calc(100vw - 48px));
}
.dialog::backdrop { backdrop-filter: blur(8px); background: rgb(3 5 12 / 72%); }
:root[data-theme="light"] .dialog::backdrop { background: rgb(25 30 50 / 36%); }
.dialog form { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.dialog header, .dialog footer { align-items: center; display: flex; justify-content: space-between; }
.dialog header { border-bottom: 1px solid var(--line-soft); min-height: 74px; padding: 0 22px; }
.dialog header p, .dialog header h2 { margin: 0; }
.dialog header p { color: var(--accent-hover); font-size: 9px; font-weight: 700; letter-spacing: .08em; margin-bottom: 5px; }
.dialog header h2 { font-size: 18px; }
.icon-button { background: var(--surface-soft); border: 1px solid var(--line); border-radius: 8px; color: var(--muted); font-size: 11px; min-height: 32px; padding: 0 10px; }
.icon-button:hover { border-color: var(--line-strong); color: var(--text); }
.dialog__body { display: grid; gap: 17px; max-height: min(64dvh, 660px); overflow: auto; padding: 22px; }
.dialog footer { border-top: 1px solid var(--line-soft); gap: 9px; justify-content: flex-end; padding: 15px 22px; }
.dialog > form > .form-error { margin: 0 22px 16px; }
.fields-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.fields-grid__wide { grid-column: 1 / -1; }
.switch-row { align-items: center; background: var(--surface-soft); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); display: flex !important; gap: 9px !important; min-height: 42px; padding: 0 12px; }
.switch-row input { accent-color: var(--accent); height: 16px; min-height: 0; width: 16px; }
.permission-grid { border: 1px solid var(--line); border-radius: var(--radius); margin: 0; padding: 14px; }
.permission-grid legend { color: var(--text-secondary); font-size: 11px; font-weight: 700; padding: 0 7px; }
#permission-options, #admin-permission-options { display: grid; gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.permission-grid__hint { color: var(--muted); font-size: 10px; grid-column: 1 / -1; line-height: 1.6; margin: 0 0 10px; }
.permission-option { align-items: flex-start; background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius-sm); display: flex !important; gap: 9px !important; min-height: 64px; padding: 10px; transition: .16s ease; }
.permission-option:hover { background: var(--surface-soft); border-color: var(--line); }
.permission-option.is-disabled { opacity: .42; }
.permission-option input { accent-color: var(--accent); height: 15px; min-height: 0; margin-top: 2px; width: 15px; }
.permission-option strong { display: block; font-size: 11px; }
.permission-option small { color: var(--muted); display: block; font-size: 9px; line-height: 1.45; margin-top: 4px; }
.dialog--small { width: min(460px, calc(100vw - 48px)); }
.toast { animation: toast-in .25s ease both; background: var(--surface-raised); border: 1px solid rgb(57 217 138 / 30%); border-radius: 10px; bottom: 24px; box-shadow: var(--shadow-lg); color: var(--success); font-size: 12px; padding: 13px 16px; position: fixed; right: 24px; z-index: 20; }
.toast.is-error { border-color: rgb(255 102 129 / 32%); color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.plugin-billing-form {
  align-items: end;
  background: color-mix(in srgb, var(--surface-raised) 42%, transparent);
  border-bottom: 1px solid var(--line-soft);
  display: grid;
  gap: 14px 16px;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  padding: 20px;
}
.plugin-billing-form label { display: grid; gap: 7px; min-width: 0; }
.plugin-billing-form label > span { color: var(--text-secondary); font-size: 10px; font-weight: 700; }
.plugin-billing-form input { min-width: 0; width: 100%; }
.plugin-billing-form__id,
.plugin-billing-form__name { grid-column: span 3; }
.plugin-billing-form__url { grid-column: span 6; min-width: 0; }
.plugin-billing-form__price { grid-column: span 2; }
.plugin-billing-form__actions {
  align-items: end;
  display: flex;
  gap: 12px;
  grid-column: 5 / -1;
  justify-content: flex-end;
  min-width: 0;
}
.plugin-billing-form__actions .switch-row {
  flex: 1 1 220px;
  max-width: 280px;
  min-height: 42px;
}
.plugin-billing-form__actions .button {
  flex: 0 0 auto;
  min-height: 42px;
  min-width: 158px;
  white-space: nowrap;
}
#billing-secret-value { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }

@media (max-width: 1280px) {
  .view-panel { padding-left: 24px; padding-right: 24px; }
  .activation-generator .data-section__header, .activation-list__header { align-items: stretch; flex-direction: column; }
  .activation-generator__controls { grid-template-columns: repeat(3, minmax(100px, 1fr)) auto auto; }
  .activation-generator__controls.is-custom { grid-template-columns: repeat(4, minmax(100px, 1fr)) auto auto; }
  .activation-filters { width: 100%; }
  .plugin-billing-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .plugin-billing-form__id,
  .plugin-billing-form__name,
  .plugin-billing-form__price { grid-column: span 1; }
  .plugin-billing-form__url,
  .plugin-billing-form__actions { grid-column: 1 / -1; }
}

@media (max-width: 1024px) {
  .console { grid-template-columns: 176px minmax(0, 1fr); }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auth-view { gap: 48px; grid-template-columns: minmax(300px, 1fr) minmax(350px, 420px); padding-left: 48px; padding-right: 48px; }
  .auth-view__features { grid-template-columns: 1fr; }
  .auth-view__features div { grid-template-columns: 30px 1fr; }
  .activation-generator__controls { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .activation-generator__controls.is-custom { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .activation-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .plugin-billing-form__actions { align-items: stretch; }
}

@media (max-width: 760px) {
  .auth-view { align-content: center; background: radial-gradient(circle at 50% 10%, rgb(128 104 255 / 14%), transparent 34%), var(--bg); display: block; padding: 36px 18px; }
  .auth-view::before { inset: 0; mask-image: linear-gradient(180deg, black, transparent 55%); }
  .auth-view__visual { min-height: auto; }
  .auth-view__copy { padding: 54px 0 36px; }
  .auth-view__copy h2 { font-size: 38px; }
  .auth-view__features { display: none; }
  .auth-panel { margin-top: 40px; padding: 24px; }
  .console { grid-template-columns: 76px minmax(0, 1fr); }
  .console__sidebar { padding: 18px 10px 14px; }
  .console__brand { justify-content: center; padding: 0 0 26px; }
  .console__brand > div, .nav-caption, .nav-item span, .account-card > div, .console__sidebar-foot .button span { display: none; }
  .console nav { justify-items: center; }
  .nav-item { justify-content: center; padding: 0; width: 46px; }
  .nav-item.is-active::after { left: -16px; }
  .account-card { justify-content: center; padding-left: 0; padding-right: 0; }
  .console__sidebar-foot .button { justify-content: center; padding: 0; }
  .topbar { min-height: 72px; padding: 0 16px; }
  .topbar__right .sync-state { display: none; }
  .view-panel { padding: 18px 14px 34px; }
  .data-section__header { align-items: stretch; flex-direction: column; }
  .table-tools { align-items: stretch; flex-direction: column; width: 100%; }
  .table-tools input { min-width: 0; }
  .fields-grid, #permission-options, #admin-permission-options { grid-template-columns: 1fr; }
  .plugin-billing-form { grid-template-columns: 1fr; padding: 16px; }
  .plugin-billing-form__id,
  .plugin-billing-form__name,
  .plugin-billing-form__url,
  .plugin-billing-form__price,
  .plugin-billing-form__actions { grid-column: 1; }
  .plugin-billing-form__actions { align-items: stretch; flex-direction: column; }
  .plugin-billing-form__actions .switch-row { flex-basis: auto; max-width: none; }
  .plugin-billing-form__actions .button { width: 100%; }
  .dialog { width: calc(100vw - 24px); }
  .audit-item { gap: 4px; grid-template-columns: 1fr; padding: 12px 16px; }
}

@media (max-width: 520px) {
  .metric-grid { grid-template-columns: 1fr; }
  .metric { min-height: 132px; }
  .topbar p { display: none; }
  .topbar h1 { font-size: 18px; }
  .topbar__right { gap: 6px; }
  .topbar__right .button span { display: none; }
  .topbar__right .button { padding: 0; width: 38px; }
  .activation-generator__controls, .activation-filters { grid-template-columns: 1fr; }
  .activation-generator__controls.is-custom { grid-template-columns: 1fr; }
}
