/* ============================================================
   Modern light admin UI.
   Soft sage, warm neutrals, subtle borders, calm shadows.
   ============================================================ */

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --surface-hover: #f0f2f5;
  --border: #d1d5db;
  --border-strong: #9ca3af;
  --ring: rgba(15, 23, 42, 0.15);

  --text: #0f172a;
  --text-mute: #475569;
  --text-dim: #64748b;
  --text-disabled: #94a3b8;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --primary-text: #ffffff;

  --success: #16a34a;
  --success-soft: #dcfce7;
  --warn: #ea580c;
  --warn-soft: #ffedd5;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --info: #0284c7;
  --info-soft: #e0f2fe;

  --radius: 4px;
  --radius-sm: 2px;
  --radius-lg: 8px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);

  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;

  color-scheme: light;
  font-family: var(--font-body);
}

* {
  box-sizing: border-box;
}

html,
body,
#app {
  margin: 0;
  padding: 0;
  width: 100%;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection {
  background: var(--primary-soft);
  color: var(--text);
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 0;
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
}

strong {
  font-weight: 600;
  color: var(--text);
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--primary-hover);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ===== Buttons ===== */

button {
  font: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  color: var(--primary-text);
  background: var(--primary);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

button:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

button:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

button:disabled {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text-disabled);
  cursor: not-allowed;
}

button.secondary {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}

button.secondary:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
  color: var(--text);
}

button.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-mute);
}

button.ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}

button.danger {
  background: var(--surface);
  border-color: var(--danger);
  color: var(--danger);
}

button.danger:hover {
  background: var(--danger);
  color: #fff;
}

button.small {
  padding: 6px 12px;
  font-size: 12.5px;
}

/* ===== Form fields ===== */

input,
select,
textarea {
  font: inherit;
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--text);
  background: var(--surface);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-disabled);
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--text-disabled);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

input[type="checkbox"],
input[type="radio"] {
  width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  accent-color: var(--primary);
  cursor: pointer;
  box-shadow: none;
}

input[type="checkbox"]:focus,
input[type="radio"]:focus {
  box-shadow: none;
}

textarea {
  min-height: 96px;
  resize: vertical;
  font-family: var(--font-body);
  line-height: 1.5;
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-mute) 50%),
    linear-gradient(135deg, var(--text-mute) 50%, transparent 50%);
  background-position: calc(100% - 16px) calc(50% - 1px), calc(100% - 11px) calc(50% - 1px);
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 32px;
  cursor: pointer;
}

label {
  display: grid;
  gap: 6px;
  color: var(--text-mute);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
}

/* ===== Pagination ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px 0 4px;
}
.page-info {
  font-size: 13px;
  color: var(--text-mute);
  font-variant-numeric: tabular-nums;
}

.save-indicator {
  font-size: 13px;
  color: var(--success);
  min-width: 50px;
  text-align: center;
  transition: opacity 0.3s ease;
}

.settings-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0 8px;
  gap: 12px;
  flex-wrap: wrap;
}
.settings-toolbar .row {
  gap: 8px;
  align-items: center;
}

.btn-result {
  font-size: 12.5px;
  margin-left: 2px;
  transition: opacity 0.3s ease;
  white-space: nowrap;
}
.btn-result.ok {
  color: var(--success);
}
.btn-result.bad {
  color: var(--danger);
}

/* ===== Tables ===== */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

th,
td {
  border-bottom: 1px solid var(--border);
  padding: 12px 14px;
  text-align: left;
  vertical-align: middle;
  color: var(--text);
}

tbody tr:last-child > td {
  border-bottom: 0;
}

tbody tr:hover {
  background: var(--surface-hover);
}

th {
  color: var(--text-mute);
  font-weight: 600;
  font-size: 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td input,
td select {
  padding: 6px 10px;
  font-size: 13px;
}

td .row {
  flex-wrap: nowrap;
  white-space: nowrap;
}

td .check {
  margin-top: 4px;
  font-size: 12px;
}

/* ===== Shell layout ===== */

.app {
  min-height: 100vh;
  width: 100%;
  display: block;
}

.layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
  width: 100%;
  max-width: 1440px;
  margin-inline: auto;
}

.sidebar {
  border-right: 1px solid var(--border);
  padding: 22px 16px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
}

.sidebar .brand {
  margin: 0;
  padding: 4px 8px 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  border-bottom: 1px solid var(--border);
}

.sidebar .brand h1 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: var(--text);
}

/* User card �?lives in the top bar (pill style) */
.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 14px 5px 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
}

.user-card .avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
}

.user-card .info {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.user-card .info .email {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 220px;
}

.user-card .info .role {
  font-size: 11px;
  color: var(--text-dim);
}

/* Sidebar nav �?individual floating button cards */
.sidebar .nav {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 6px;
}

.sidebar .nav button {
  width: 100%;
  justify-content: center;
  text-align: center;
  padding: 13px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-mute);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, background-color 0.16s ease, color 0.16s ease;
}

.sidebar .nav button:hover {
  transform: translateY(-3px);
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
  box-shadow: var(--shadow-md);
}

.sidebar .nav button.active {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary-hover);
  font-weight: 600;
}

.sidebar .nav button.active:hover {
  transform: translateY(-3px);
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary-hover);
  box-shadow: var(--shadow-md);
}

.sidebar-foot {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--text-dim);
  text-align: center;
  letter-spacing: 0.2px;
}

.main {
  padding: 28px 32px 56px;
  background: var(--bg);
  min-width: 0;
}

/* Top bar �?page title (left) + user & logout (right) */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  padding: 16px 24px;
  margin: -24px -24px 24px -24px;
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.topbar h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.balance-display {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--primary-soft);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}

.balance-display:hover {
  background: var(--surface-hover);
}

.balance-amount {
  font-weight: 600;
  color: var(--primary);
  font-size: 14px;
}

.balance-label {
  font-size: 12px;
  color: var(--text-mute);
}

.logout-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-mute);
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 13.5px;
  box-shadow: var(--shadow-sm);
}

.logout-btn:hover {
  background: var(--danger-soft);
  border-color: var(--danger-soft);
  color: var(--danger);
}

/* ===== Auth / Landing ===== */

.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  background:
    radial-gradient(ellipse 60% 50% at 50% 0%, rgba(37, 99, 235, 0.06), transparent 70%),
    var(--bg);
}

.auth-wrap {
  width: 100%;
  max-width: 1000px;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 48px;
  align-items: center;
}

.auth-hero {
  display: grid;
  gap: 18px;
  padding: 8px;
}

.auth-hero .logo-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 19px;
  box-shadow: var(--shadow-md);
}

.auth-hero h1 {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.6px;
  line-height: 1.1;
}

.auth-hero p {
  margin: 0;
  font-size: 15px;
  color: var(--text-mute);
  line-height: 1.6;
  max-width: 460px;
}

.auth-hero ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.auth-box {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 28px 26px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.auth-box .auth-head {
  display: grid;
  gap: 6px;
  margin-bottom: 18px;
}

.auth-box .auth-head h2 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.auth-box .auth-head p {
  margin: 0;
  font-size: 13px;
  color: var(--text-dim);
}

.tabs {
  display: inline-flex;
  padding: 3px;
  gap: 0;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
}

.tabs .tab {
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-mute);
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 500;
}

.tabs .tab:hover {
  background: transparent;
  color: var(--text);
}

.tabs .tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* Settings top-nav tabs (underline style) */
.settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.settings-tabs button {
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text-mute);
  padding: 10px 16px;
  font-size: 13.5px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.settings-tabs button:hover {
  background: transparent;
  color: var(--text);
}

.settings-tabs button.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.auth-foot {
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
}

.auth-foot a {
  font-weight: 500;
}

.step-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-hover);
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 14px;
}

.step-pill .num {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 11px;
}

.target-email {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.target-email .change {
  font-size: 12px;
  color: var(--primary);
  cursor: pointer;
  background: transparent;
  border: 0;
  padding: 2px 6px;
  font-weight: 500;
}

.target-email .change:hover {
  background: transparent;
  color: var(--primary-hover);
  text-decoration: underline;
}

/* ===== Forms ===== */

.form {
  display: grid;
  gap: 14px;
}

.form > button[type="submit"] {
  margin-top: 4px;
  padding: 11px 16px;
  width: 100%;
  font-size: 14px;
  font-weight: 600;
}

/* ===== Panels / cards ===== */

.panel,
.metric,
.plan {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.panel {
  margin-bottom: 16px;
  padding: 22px;
}

.panel:last-child {
  margin-bottom: 0;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.panel-head h2,
.panel-head strong {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.panel-head .desc {
  font-size: 12.5px;
  color: var(--text-dim);
  margin-top: 2px;
}

.metric {
  padding: 18px 20px;
  display: grid;
  align-content: start;
  gap: 8px;
}

.metric .label {
  display: block;
  margin: 0;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-dim);
}

.metric .value {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.15;
  color: var(--text);
  word-break: break-word;
  overflow-wrap: anywhere;
}

.metric .value .badge {
  font-size: 11px;
}

.plan {
  display: grid;
  gap: 10px;
  padding: 20px;
  align-content: start;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.plan:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.plan strong {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.plan .price {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.4px;
}

.plan .price small {
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 500;
  margin-left: 4px;
}

.plan .meta {
  font-size: 12.5px;
  color: var(--text-dim);
}

.plan button {
  margin-top: 4px;
  align-self: stretch;
}

.btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: btn-spin 0.6s linear infinite;
  vertical-align: -2px;
}

@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

/* ===== Toolbar ===== */

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.toolbar > strong {
  font-size: 14px;
  font-weight: 600;
}

.toolbar input,
.toolbar select {
  max-width: 280px;
}

/* ===== Section heading (groups of settings) ===== */

.section-head {
  margin: 0 0 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.section-head h2 {
  font-size: 15px;
  font-weight: 600;
}

.section-head p {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--text-dim);
}

/* ===== Grids ===== */

.grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* ===== Row helper ===== */

.row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ===== Text utilities ===== */

.muted {
  color: var(--text-dim);
}

.mono {
  font-family: var(--font-mono);
  word-break: break-all;
  font-size: 12.5px;
}

p.mono {
  margin: 0;
  color: var(--text);
}

.panel p.mono {
  margin: 0 0 14px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  color: var(--text);
}

/* ===== Badges ===== */

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  border-radius: 999px;
  padding: 2px 10px;
  font-family: var(--font-body);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-mute);
  background: var(--surface-2);
  border: 1px solid var(--border);
  white-space: nowrap;
}

.badge.ok {
  color: var(--success);
  background: var(--success-soft);
  border-color: transparent;
}

.badge.warn {
  color: var(--warn);
  background: var(--warn-soft);
  border-color: transparent;
}

.badge.bad {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: transparent;
}

.badge.info {
  color: var(--info);
  background: var(--info-soft);
  border-color: transparent;
}

.notice-inline {
  margin: 14px 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-mute);
  font-size: 14px;
  font-weight: 700;
}

.notice-inline.ok {
  border-color: transparent;
  background: var(--success-soft);
  color: var(--success);
}

.notice-inline.bad {
  border-color: transparent;
  background: var(--danger-soft);
  color: var(--danger);
}

/* ===== Messages / Alerts (floating toast) ===== */

#notice-region {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  width: max-content;
  max-width: min(92vw, 520px);
  pointer-events: none;
}

.notice-toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 220px;
  padding: 13px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--info-soft);
  border-left: 4px solid var(--info);
  background: var(--surface);
  color: var(--info);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translate(14px, -8px);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.notice-toast::before {
  content: "";
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--info);
}

.notice-toast.show {
  opacity: 1;
  transform: translate(0, 0);
}

.notice-toast.error {
  color: var(--danger);
  border-color: var(--danger-soft);
  border-left-color: var(--danger);
}

.notice-toast.error::before {
  background: var(--danger);
}

/* ===== Table wrapper ===== */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.panel .table-wrap {
  border: 1px solid var(--border);
}

/* ===== Settings grid ===== */

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.settings-grid .wide {
  grid-column: 1 / -1;
}

.settings-grid label.check {
  align-self: end;
  padding-bottom: 8px;
}

.info-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.info-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-mute);
}

.contact-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.contact-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.contact-text {
  margin: 0;
  color: var(--text-mute);
  line-height: 1.6;
}

.contact-info {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  line-height: 1.7;
}

.contact-info a,
.tutorial-card-body a {
  color: var(--primary);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  overflow-wrap: anywhere;
}

.contact-info a:hover,
.tutorial-card-body a:hover {
  color: var(--primary-hover);
  text-decoration-thickness: 2px;
}

.contact-info a::after,
.tutorial-card-body a::after {
  content: "�?;
  display: inline-block;
  margin-left: 2px;
  font-size: 0.8em;
  opacity: 0.65;
}

/* Tutorial �?user-facing guide center */
.tutorial-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.46fr);
  gap: 22px;
  align-items: stretch;
  min-height: 210px;
  margin-bottom: 18px;
  padding: 28px;
  overflow: hidden;
  border: 1px solid rgba(37, 99, 235, 0.16);
  border-radius: 8px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.13), transparent 42%),
    linear-gradient(135deg, #2563eb, #5b734f 54%, #394439);
  box-shadow: var(--shadow-lg);
}

.tutorial-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: linear-gradient(120deg, transparent, #000 28%, #000 76%, transparent);
  pointer-events: none;
}

.tutorial-hero-copy,
.tutorial-quick {
  position: relative;
  z-index: 1;
}

.tutorial-hero .eyebrow {
  color: #dce7d7;
}

.tutorial-hero h2 {
  margin-top: 10px;
  color: #fff;
  font-size: 34px;
  font-weight: 900;
  line-height: 1.12;
}

.tutorial-hero p {
  max-width: 640px;
  margin: 12px 0 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 15px;
  line-height: 1.7;
}

.tutorial-quick {
  display: grid;
  gap: 10px;
  align-content: center;
}

.tutorial-quick span {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
}

.tutorial-quick em {
  color: #dce7d7;
  font-style: normal;
  font-size: 12px;
  font-weight: 900;
}

.tutorial-quick strong {
  color: #fff;
  font-size: 14px;
  font-weight: 900;
}

.tutorial-card {
  position: relative;
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr) minmax(220px, 0.28fr);
  gap: 20px;
  align-items: start;
  overflow: hidden;
  padding: 24px;
}

.tutorial-card.no-links {
  grid-template-columns: 68px minmax(0, 1fr);
}

.tutorial-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: linear-gradient(180deg, var(--primary), var(--accent));
}

.tutorial-card-index {
  position: relative;
  z-index: 1;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--primary-hover);
  background: var(--primary-soft);
  font-size: 18px;
  font-weight: 900;
}

.tutorial-card-copy {
  position: relative;
  z-index: 1;
  min-width: 0;
  display: grid;
  gap: 16px;
}

.tutorial-card-head {
  display: grid;
  gap: 8px;
}

.tutorial-card-title {
  margin: 0;
  color: var(--text);
  font-size: 20px;
  font-weight: 900;
  line-height: 1.25;
}

.tutorial-card-head p {
  max-width: 760px;
  margin: 0;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.6;
}

.tutorial-card-body {
  max-width: 980px;
  color: var(--text-mute);
  line-height: 1.9;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.tutorial-card-links {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 8px;
}

.tutorial-card-links a,
.tutorial-resource-links a {
  min-width: 0;
  padding: 9px 11px;
  border: 1px solid rgba(198, 211, 223, 0.72);
  border-radius: 8px;
  color: var(--primary-hover);
  background: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.tutorial-card-links a:hover,
.tutorial-resource-links a:hover {
  border-color: rgba(37, 99, 235, 0.24);
  background: var(--primary-soft);
  color: var(--primary-hover);
  text-decoration: none;
}

.tutorial-resource-band,
.tutorial-empty {
  display: grid;
  gap: 14px;
  margin-top: 18px;
  padding: 22px;
  border: 1px solid rgba(198, 211, 223, 0.72);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(246, 248, 251, 0.84)),
    linear-gradient(90deg, rgba(37, 99, 235, 0.05) 1px, transparent 1px);
  background-size: auto, 30px 30px;
  box-shadow: var(--shadow);
}

.tutorial-resource-band {
  grid-template-columns: minmax(160px, 0.22fr) minmax(0, 1fr);
  align-items: start;
}

.tutorial-resource-band strong,
.tutorial-empty strong {
  display: block;
  margin-top: 4px;
  color: var(--text);
  font-size: 20px;
  font-weight: 900;
}

.tutorial-resource-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 9px;
}

.tutorial-empty span {
  color: var(--text-dim);
  font-weight: 700;
}

/* Tutorial �?admin block editor */
.tutorial-block-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 0 12px;
  flex-wrap: wrap;
}

.tutorial-block-toolbar strong {
  font-size: 13px;
}

.tutorial-block-list {
  display: grid;
  gap: 14px;
}

.tutorial-block-row {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.tutorial-block-row-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tutorial-block-row-head input {
  flex: 1;
  font-weight: 600;
}

.tutorial-block-row textarea {
  min-height: 96px;
}

.maintenance-note {
  margin: 14px 0 0;
  max-width: 680px;
  line-height: 1.7;
}

/* Fortune (embedded promo page) */
.fortune-panel {
  padding: 0;
  overflow: hidden;
}

.fortune-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.fortune-head strong {
  font-size: 15px;
}

.fortune-open {
  font-size: 13px;
  white-space: nowrap;
}

.fortune-frame {
  display: block;
  width: 100%;
  height: calc(100vh - 200px);
  min-height: 480px;
  border: 0;
}

/* Shadowrocket shared accounts */
.sr-warning {
  margin-bottom: 16px;
  padding: 12px 16px;
  border: 1px solid var(--warn-soft);
  border-left: 4px solid var(--warn);
  border-radius: var(--radius);
  background: var(--warn-soft);
}

.sr-warning strong {
  display: block;
  margin-bottom: 4px;
  color: var(--warn);
}

.sr-warning p {
  margin: 0;
  font-size: 13px;
  line-height: 1.7;
  color: #92500a;
}

.sr-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.sr-card {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.sr-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.sr-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sr-label {
  flex: none;
  width: 36px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-mute);
}

.sr-value {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 13.5px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sr-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  flex-wrap: wrap;
}

.sr-locked {
  text-align: center;
  padding: 40px 16px;
}

.sr-locked-icon {
  font-size: 34px;
  line-height: 1;
}

.sr-locked-title {
  margin: 12px 0 6px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.sr-locked .muted {
  margin: 0;
}

.provisioning-node-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 0 8px;
  flex-wrap: wrap;
}

.provisioning-node-toolbar strong {
  font-size: 13px;
}

.provisioning-node-list {
  display: grid;
  gap: 12px;
}

.provisioning-node-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.8fr) minmax(220px, 1.4fr) minmax(160px, 1.1fr) minmax(120px, 0.8fr) minmax(120px, 0.8fr) minmax(90px, 0.5fr) auto auto auto auto;
  gap: 12px;
  align-items: end;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.provisioning-node-row:first-child {
  border-top: 0;
}

.provisioning-node-actions {
  display: flex;
  align-items: center;
  min-height: 36px;
}

.provisioning-settings-brief {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.provisioning-settings-brief > div {
  border: 1px solid #d8d3f5;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #fbfaff 0%, #f6f4ff 100%);
  padding: 14px 16px;
}

.provisioning-settings-brief strong {
  display: block;
  margin-bottom: 5px;
  color: #3f356e;
  font-size: 13.5px;
}

.provisioning-settings-brief p {
  margin: 0;
  color: #6d6688;
  font-size: 12.5px;
  line-height: 1.6;
}

.provisioning-node-toolbar {
  padding-top: 4px;
}

.provisioning-node-list {
  gap: 16px;
}

.provisioning-node-row.provisioning-endpoint-card,
.provisioning-node-row.provisioning-endpoint-card:first-child {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  align-items: stretch;
  padding: 18px;
  border: 1px solid var(--border);
  border-top: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface) 0%, #fbfaff 100%);
  box-shadow: var(--shadow-sm);
}

.provisioning-endpoint-head {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 14px;
  align-items: end;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.provisioning-endpoint-name {
  margin: 0;
}

.provisioning-endpoint-name span {
  display: block;
  margin-bottom: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-mute);
}

.provisioning-endpoint-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-height: 38px;
}

.provisioning-switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.provisioning-switch input {
  flex: none;
}

.provisioning-endpoint-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.provisioning-endpoint-section {
  display: grid;
  align-content: start;
  gap: 12px;
  min-width: 0;
}

.provisioning-endpoint-section-title {
  display: grid;
  gap: 3px;
}

.provisioning-endpoint-section-title strong {
  font-size: 13.5px;
  color: var(--text);
}

.provisioning-endpoint-section-title p {
  margin: 0;
  color: var(--text-dim);
  font-size: 12.5px;
  line-height: 1.55;
}

.provisioning-endpoint-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.provisioning-endpoint-grid .wide {
  grid-column: 1 / -1;
}

.provisioning-check-card {
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid #d8d3f5;
  border-radius: var(--radius-sm);
  background: #fbfaff;
}

.provisioning-check-card input {
  margin-top: 3px;
  flex: none;
}

.provisioning-check-card span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.provisioning-check-card strong {
  color: var(--text);
  font-size: 13px;
}

.provisioning-check-card small {
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
}

/* ===== Check label ===== */

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  line-height: 1.4;
}

td .check {
  display: flex;
  color: var(--text-mute);
}

/* ===== User management ===== */

.user-create-form {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(180px, 1fr) minmax(130px, 0.7fr) minmax(130px, 0.7fr) auto auto auto;
  gap: 12px;
  align-items: end;
}

.user-create-check {
  min-height: 36px;
  align-items: center;
  padding-bottom: 1px;
}

.user-create-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
}

.user-table {
  min-width: 1120px;
}

.user-table th:first-child,
.user-table td:first-child {
  min-width: 210px;
}

.user-table th:nth-child(2),
.user-table td:nth-child(2) {
  min-width: 280px;
}

.user-table th:nth-child(5),
.user-table td:nth-child(5) {
  width: 128px;
  min-width: 128px;
}

.user-table td:nth-child(5) select,
.user-table select[data-field="role"] {
  width: 96px;
  min-width: 96px;
  max-width: none;
  white-space: nowrap;
}

.user-email {
  margin-bottom: 9px;
  font-size: 14px;
  font-weight: 500;
  word-break: break-all;
}

.user-uuid {
  max-width: 340px;
}

.user-state-actions,
.user-actions,
.days-control,
.password-control {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.user-actions {
  flex-direction: column;
  align-items: flex-start;
}

.action-cell .row {
  flex-wrap: wrap;
  white-space: normal;
}

.state-toggle {
  min-width: 70px;
  padding: 5px 10px;
  border-color: var(--border-strong);
  color: var(--text-mute);
  background: var(--surface);
  font-size: 12px;
}

.state-toggle:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.state-toggle.verify-toggle.active {
  border-color: transparent;
  color: var(--success);
  background: var(--success-soft);
}

.state-toggle.disable-toggle.active {
  border-color: transparent;
  color: var(--danger);
  background: var(--danger-soft);
}

.days-control input {
  width: 86px;
  min-width: 86px;
}

.password-control input {
  width: 160px;
  min-width: 160px;
}

.inline-toast {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 3px 9px;
  color: var(--success);
  background: var(--success-soft);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.inline-toast.error {
  color: var(--danger);
  background: var(--danger-soft);
}

tr.is-removing {
  opacity: 0.55;
}

/* ===== Linkbox ===== */

.linkbox {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: stretch;
}

.subscription-linkbox {
  display: grid;
  grid-template-columns: minmax(280px, 640px) auto;
  gap: 8px;
  align-items: stretch;
  max-width: 900px;
}

.subscription-linkbox input {
  font-family: var(--font-mono);
  font-size: 13px;
}

.subscription-actions {
  display: flex;
  align-items: stretch;
  gap: 8px;
  flex-wrap: wrap;
}

.subscription-actions button {
  min-width: 112px;
}

.subscription-qr {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

/* Empty when there is no active link �?collapse it entirely. */
.subscription-qr:empty {
  display: none;
}

.qr-frame {
  width: 200px;
  max-width: 60vw;
  padding: 12px;
  background: #fff; /* QR needs fixed high contrast regardless of theme. */
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(0, 0, 0, 0.12));
}

.qr-frame svg {
  display: block;
  width: 100%;
  height: auto;
}

.qr-cap {
  font-size: 12px;
  color: var(--muted, #6b7280);
}

/* ===== Input compound fields ===== */

.input-suffix,
.input-addon {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: stretch;
  position: relative;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input-suffix::after {
  content: "";
  position: absolute;
  right: 16px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--text-dim);
  border-bottom: 2px solid var(--text-dim);
  pointer-events: none;
  transform: translateY(-65%) rotate(45deg);
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.input-suffix:has(> select:focus)::after {
  border-color: var(--primary);
  transform: translateY(-35%) rotate(225deg);
}

.input-suffix > input,
.input-suffix > select,
.input-addon > input {
  width: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.input-suffix > input:focus,
.input-suffix > select:focus,
.input-addon > input:focus {
  outline: none;
  box-shadow: none;
}

.input-suffix:focus-within,
.input-addon:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.input-suffix > select {
  border-left: 1px solid var(--border);
  background-color: var(--surface-2);
  background-image: none;
  padding-right: 42px;
  cursor: pointer;
  color: var(--text);
  font-size: 13px;
  min-width: 140px;
}

.input-addon > .addon-btn {
  border-radius: 0;
  border: 0;
  border-left: 1px solid var(--primary);
  padding: 0 18px;
  background: var(--primary-soft);
  color: var(--primary);
  white-space: nowrap;
  min-width: 96px;
  font-weight: 600;
  font-size: 13px;
  height: auto;
  align-self: stretch;
}

.input-addon > .addon-btn:hover:not(:disabled) {
  background: var(--primary);
  color: #fff;
}

.input-addon > .addon-btn:disabled {
  background: var(--surface-2);
  border-left-color: var(--border);
  color: var(--text-disabled);
  cursor: not-allowed;
}

/* ===== Misc ===== */

.hidden {
  display: none !important;
}

.discount-row {
  margin-top: 8px;
}

.discount-row input {
  max-width: 200px;
}

/* ===== Scrollbar ===== */

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
  border: 2px solid var(--bg);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-disabled);
}

/* ===== Responsive ===== */

@media (max-width: 1100px) {
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .user-create-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .provisioning-node-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .provisioning-settings-brief,
  .provisioning-endpoint-body {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 960px) {
  .auth-wrap {
    grid-template-columns: 1fr;
    gap: 28px;
    max-width: 460px;
  }

  .auth-hero {
    text-align: center;
    justify-items: center;
  }

  .auth-hero p {
    margin: 0 auto;
  }

  .auth-hero ul {
    margin: 0 auto;
  }
}

@media (max-width: 820px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    padding: 14px 16px;
  }

  .sidebar .nav {
    flex: initial;
    flex-direction: row;
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
    gap: 8px;
    padding: 2px 0 6px;
  }

  .sidebar .nav::-webkit-scrollbar {
    display: none;
  }

  .sidebar .nav button {
    width: auto;
    white-space: nowrap;
    padding: 10px 14px;
  }

  .sidebar-foot {
    display: none;
  }

  .main {
    padding: 22px 18px 40px;
  }

  .topbar {
    margin-bottom: 18px;
  }

  .topbar h1 {
    font-size: 19px;
  }

  .topbar-user .user-card {
    padding: 4px;
  }

  .topbar-user .user-card .info {
    display: none;
  }

  .grid,
  .grid.two,
  .grid.three,
  .settings-grid,
  .provisioning-node-row,
  .user-create-form {
    grid-template-columns: 1fr;
  }

  .linkbox {
    grid-template-columns: 1fr;
  }

  .subscription-linkbox {
    grid-template-columns: 1fr;
    max-width: none;
  }

  .subscription-actions button {
    flex: 1 1 140px;
  }

  .auth-box {
    padding: 22px 18px 20px;
  }

  .panel {
    padding: 18px;
  }

  .provisioning-node-row.provisioning-endpoint-card,
  .provisioning-node-row.provisioning-endpoint-card:first-child {
    padding: 14px;
  }

  .provisioning-settings-brief,
  .provisioning-endpoint-head,
  .provisioning-endpoint-body,
  .provisioning-endpoint-grid {
    grid-template-columns: 1fr;
  }

  .provisioning-endpoint-actions {
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .metric {
    padding: 16px 18px;
  }
}

@media (max-width: 480px) {
  .auth-hero h1 {
    font-size: 28px;
  }
}

/* ============================================================
   Visual refresh 2026
   ============================================================ */

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --surface-3: #f0f2f5;
  --surface-hover: #e5e7eb;
  --border: #d1d5db;
  --border-strong: #9ca3af;
  --ring: rgba(15, 23, 42, 0.15);

  --text: #0f172a;
  --text-mute: #475569;
  --text-dim: #64748b;
  --text-disabled: #94a3b8;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --primary-text: #ffffff;

  --accent: #4338ca;
  --accent-soft: #e0e7ff;
  --amber: #d97706;
  --amber-soft: #fef3c7;
  --rose: #e11d48;
  --rose-soft: #ffe4e6;

  --success: #16a34a;
  --success-soft: #dcfce7;
  --warn: #ea580c;
  --warn-soft: #ffedd5;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --info: #0284c7;
  --info-soft: #e1ece7;

  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 8px;
  --shadow-sm: 0 1px 2px rgba(24, 38, 52, 0.05);
  --shadow: 0 12px 28px rgba(24, 38, 52, 0.07), 0 1px 2px rgba(24, 38, 52, 0.05);
  --shadow-md: 0 18px 40px rgba(24, 38, 52, 0.11), 0 2px 5px rgba(24, 38, 52, 0.06);
  --shadow-lg: 0 28px 70px rgba(24, 38, 52, 0.16), 0 5px 16px rgba(24, 38, 52, 0.08);
}

* {
  letter-spacing: 0 !important;
}

html {
  background: var(--bg);
}

body {
  background:
    linear-gradient(180deg, rgba(255, 254, 250, 0.82), rgba(238, 242, 237, 0.96) 360px),
    linear-gradient(90deg, rgba(37, 99, 235, 0.07) 1px, transparent 1px),
    linear-gradient(180deg, rgba(79, 70, 229, 0.05) 1px, transparent 1px),
    var(--bg);
  background-size: auto, 54px 54px, 54px 54px, auto;
}

button {
  min-height: 38px;
  border: 0;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--primary), #78936b);
  box-shadow: 0 9px 20px rgba(37, 99, 235, 0.18);
  font-weight: 700;
  transform: translateZ(0);
  transition:
    background-color 0.16s ease,
    color 0.16s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.16s ease;
}

button:hover {
  background: linear-gradient(135deg, var(--primary-hover), #2563eb);
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.22);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

button.secondary,
button.ghost,
.logout-btn {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.84);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

button.secondary:hover,
button.ghost:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
  color: var(--primary-hover);
  box-shadow: var(--shadow);
}

button.secondary.active {
  border-color: rgba(37, 99, 235, 0.24);
  background: var(--primary-soft);
  color: var(--primary-hover);
}

button.danger {
  border: 1px solid rgba(190, 18, 60, 0.28);
  background: var(--danger-soft);
  color: var(--danger);
  box-shadow: none;
}

button.danger:hover {
  background: var(--danger);
  color: #fff;
  box-shadow: 0 12px 24px rgba(190, 18, 60, 0.18);
}

button.small {
  min-height: 30px;
  padding: 6px 11px;
}

input,
select,
textarea {
  min-height: 39px;
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.86);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--border-strong);
  background: #fff;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--ring);
}

label {
  gap: 7px;
  color: var(--text-mute);
  font-weight: 700;
}

.layout {
  grid-template-columns: 268px minmax(0, 1fr);
  max-width: none;
  background: transparent;
}

.sidebar {
  border-right: 1px solid rgba(198, 211, 223, 0.78);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(247, 250, 252, 0.9)),
    linear-gradient(135deg, rgba(37, 99, 235, 0.06), rgba(79, 70, 229, 0.04));
  box-shadow: 14px 0 38px rgba(24, 38, 52, 0.06);
  padding: 22px 14px;
}

.sidebar .brand {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 8px 10px 20px;
  border-bottom-color: rgba(198, 211, 223, 0.78);
}

.brand-home {
  width: 44px;
  height: 44px;
  display: block;
  border-radius: 8px;
  text-decoration: none;
}

.brand-home:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 4px var(--ring);
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.18), transparent 42%),
    linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 16px 30px rgba(37, 99, 235, 0.22);
  font-size: 18px;
  font-weight: 900;
}

.brand-mark img,
.logo-mark img {
  width: 72%;
  height: 72%;
  display: block;
  object-fit: contain;
}

.brand-copy {
  min-width: 0;
}

.sidebar .brand h1 {
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 17px;
  font-weight: 900;
}

.brand-copy span {
  display: block;
  margin-top: 3px;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.sidebar .nav {
  gap: 6px;
  margin-top: 10px;
}

.sidebar .nav button {
  min-height: 44px;
  justify-content: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
  color: var(--text-mute);
  font-weight: 800;
}

.sidebar .nav button:hover {
  border-color: rgba(198, 211, 223, 0.62);
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transform: translateX(2px);
}

.sidebar .nav button.active,
.sidebar .nav button.active:hover {
  border-color: rgba(37, 99, 235, 0.18);
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(79, 70, 229, 0.08)),
    rgba(255, 255, 255, 0.94);
  color: var(--primary-hover);
  box-shadow: 0 12px 30px rgba(37, 99, 235, 0.12);
  transform: none;
}

.nav-icon {
  width: 25px;
  height: 25px;
  flex: 0 0 25px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--surface-3);
  color: var(--text-dim);
}

.nav-icon svg {
  width: 15px;
  height: 15px;
  display: block;
  fill: currentColor;
}

.sidebar .nav button.active .nav-icon {
  background: var(--primary);
  color: #fff;
}

.sidebar-foot {
  margin: 18px 10px 0;
  padding: 14px 0 2px;
  border-top-color: rgba(198, 211, 223, 0.78);
  color: var(--text-dim);
  font-weight: 700;
}

.sidebar-foot a {
  display: block;
  overflow: hidden;
  color: var(--text-dim);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-foot a:hover {
  color: var(--primary-hover);
  text-decoration: none;
}

.main {
  padding: 28px 34px 64px;
  background: transparent;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  margin: -28px -34px 24px;
  padding: 18px 34px;
  border-bottom: 1px solid rgba(220, 229, 238, 0.72);
  background: rgba(246, 248, 251, 0.84);
  backdrop-filter: blur(18px);
}

.topbar-title {
  display: grid;
  gap: 3px;
}

.eyebrow {
  color: var(--primary);
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}

.topbar h1 {
  color: var(--text);
  font-size: 24px;
  font-weight: 900;
}

.topbar-user {
  gap: 12px;
}

.user-card {
  border-color: rgba(198, 211, 223, 0.72);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.user-card .avatar {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  font-weight: 900;
}

.logout-btn:hover {
  border-color: rgba(190, 18, 60, 0.22);
  background: var(--danger-soft);
  color: var(--danger);
}

.auth {
  min-height: 100vh;
  place-items: stretch;
  padding: 32px;
  background:
    linear-gradient(115deg, rgba(37, 99, 235, 0.13), transparent 38%),
    linear-gradient(300deg, rgba(79, 70, 229, 0.12), transparent 34%),
    linear-gradient(180deg, #fffefa, var(--bg));
}

.auth-wrap {
  max-width: 1160px;
  margin: auto;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.72fr);
  gap: 34px;
}

.auth-hero {
  position: relative;
  min-height: 560px;
  display: grid;
  align-content: space-between;
  gap: 26px;
  padding: 34px;
  overflow: hidden;
  border: 1px solid rgba(184, 198, 177, 0.76);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 254, 250, 0.92), rgba(246, 249, 241, 0.72)),
    linear-gradient(90deg, rgba(37, 99, 235, 0.07) 1px, transparent 1px),
    linear-gradient(180deg, rgba(79, 70, 229, 0.045) 1px, transparent 1px);
  background-size: auto, 34px 34px, 34px 34px;
  box-shadow: var(--shadow-lg);
}

.auth-hero::after {
  display: none;
}

.auth-hero-copy {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}

.auth-hero .logo-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.22), transparent 42%),
    linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 18px 34px rgba(37, 99, 235, 0.2);
  font-size: 22px;
  font-weight: 900;
}

.auth-kicker {
  display: block;
  margin-bottom: 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

.auth-hero h1 {
  max-width: 680px;
  font-size: 36px;
  font-weight: 900;
  line-height: 1.12;
}

.auth-hero p {
  max-width: 520px;
  color: var(--text-mute);
  font-size: 15px;
  font-weight: 700;
}

.auth-service-board {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 18px;
  min-height: 328px;
  padding: 20px;
  border: 1px solid rgba(184, 198, 177, 0.82);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 254, 250, 0.92), rgba(244, 248, 239, 0.82)),
    linear-gradient(90deg, rgba(37, 99, 235, 0.08) 1px, transparent 1px),
    linear-gradient(180deg, rgba(79, 70, 229, 0.05) 1px, transparent 1px);
  background-size: auto, 28px 28px, 28px 28px;
  box-shadow: var(--shadow);
}

.auth-board-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 900;
}

.auth-window-dots {
  display: flex;
  gap: 6px;
}

.auth-window-dots i {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--border-strong);
}

.auth-window-dots i:first-child {
  background: var(--rose);
}

.auth-window-dots i:nth-child(2) {
  background: var(--amber);
}

.auth-window-dots i:nth-child(3) {
  background: var(--success);
}

.auth-route {
  display: grid;
  grid-template-columns: auto minmax(18px, 1fr) auto minmax(18px, 1fr) auto minmax(18px, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.route-node {
  min-height: 34px;
  display: inline-grid;
  place-items: center;
  padding: 0 12px;
  border: 1px solid rgba(184, 198, 177, 0.76);
  border-radius: 8px;
  background: rgba(255, 254, 250, 0.84);
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
  box-shadow: var(--shadow-sm);
}

.route-node.active {
  background: var(--primary);
  color: #fff;
}

.route-line {
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), rgba(79, 70, 229, 0.42));
}

.auth-status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.auth-status-grid div {
  min-width: 0;
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid rgba(184, 198, 177, 0.72);
  border-radius: 8px;
  background: rgba(255, 254, 250, 0.82);
}

.auth-status-grid span,
.auth-node-row small,
.auth-quick-stats small {
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 900;
}

.auth-status-grid strong {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 14px;
  overflow-wrap: anywhere;
}

.auth-node-list {
  display: grid;
  gap: 10px;
}

.auth-node-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 62px;
  padding: 12px 14px;
  border: 1px solid rgba(184, 198, 177, 0.72);
  border-radius: 8px;
  background: rgba(255, 254, 250, 0.88);
  box-shadow: var(--shadow-sm);
}

.node-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--text-disabled);
}

.node-dot.ok {
  background: var(--success);
  box-shadow: 0 0 0 5px var(--success-soft);
}

.node-dot.warm {
  background: var(--amber);
  box-shadow: 0 0 0 5px var(--amber-soft);
}

.auth-node-row strong {
  display: block;
  color: var(--text);
  font-size: 14px;
  font-weight: 900;
}

.auth-node-row em {
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--primary-hover);
  background: var(--primary-soft);
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

.auth-quick-stats {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.auth-quick-stats span {
  min-width: 0;
  display: grid;
  gap: 2px;
  padding: 13px 14px;
  border: 1px solid rgba(184, 198, 177, 0.68);
  border-radius: 8px;
  background: rgba(255, 254, 250, 0.74);
}

.auth-quick-stats strong {
  color: var(--text);
  font-size: 15px;
  font-weight: 900;
}

.auth-box {
  align-self: center;
  border-color: rgba(184, 198, 177, 0.72);
  border-radius: 8px;
  padding: 30px;
  background: rgba(255, 254, 250, 0.92);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(16px);
}

.auth-box .auth-head h2 {
  font-size: 23px;
  font-weight: 900;
}

.tabs {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.tabs .tab {
  flex: 1;
  min-height: 34px;
  color: var(--text-mute);
  font-weight: 800;
  box-shadow: none;
}

.tabs .tab.active {
  color: var(--primary-hover);
  box-shadow: var(--shadow-sm);
}

.form > button[type="submit"] {
  min-height: 44px;
}

.panel,
.metric,
.plan {
  border-color: rgba(198, 211, 223, 0.72);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.panel {
  padding: 24px;
  margin-bottom: 18px;
}

.panel-head {
  margin-bottom: 18px;
}

.panel-head h2,
.panel-head strong,
.toolbar > strong,
.section-head h2 {
  font-size: 16px;
  font-weight: 900;
}

.panel-head .desc,
.section-head p {
  color: var(--text-dim);
  font-weight: 600;
}

.account-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
  min-height: 188px;
  margin-bottom: 16px;
  padding: 28px;
  overflow: hidden;
  border: 1px solid rgba(37, 99, 235, 0.16);
  border-radius: 8px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.12), transparent 44%),
    linear-gradient(135deg, #2563eb, #596f4d 62%, #394439);
  box-shadow: var(--shadow-lg);
}

.account-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: linear-gradient(120deg, transparent, #000 30%, #000 72%, transparent);
  pointer-events: none;
}

.account-hero-copy,
.account-hero-status {
  position: relative;
  z-index: 1;
}

.account-hero .eyebrow {
  color: #dce7d7;
}

.account-hero h2 {
  margin-top: 10px;
  color: #fff;
  font-size: 30px;
  font-weight: 900;
  line-height: 1.15;
}

.account-hero p {
  max-width: 560px;
  margin: 10px 0 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 14px;
}

.account-hero-status {
  display: grid;
  justify-items: end;
  gap: 10px;
  min-width: 142px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  font-weight: 900;
}

.account-hero-status .badge {
  min-height: 28px;
  padding: 4px 12px;
}

.account-metrics {
  grid-template-columns: minmax(220px, 0.7fr) minmax(280px, 1fr);
}

.metric {
  position: relative;
  min-height: 118px;
  overflow: hidden;
  padding: 20px;
}

.metric::before {
  content: "";
  position: absolute;
  top: 18px;
  right: 18px;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--accent-soft);
}

.metric::after {
  content: "";
  position: absolute;
  top: 28px;
  right: 28px;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: var(--accent);
}

.metric:nth-child(2n)::before {
  background: var(--amber-soft);
}

.metric:nth-child(2n)::after {
  background: var(--amber);
}

.metric .label {
  position: relative;
  z-index: 1;
  color: var(--text-dim);
  font-weight: 800;
}

.metric .value {
  position: relative;
  z-index: 1;
  margin-top: 4px;
  color: var(--text);
  font-size: 27px;
  font-weight: 900;
}

.plan {
  position: relative;
  overflow: hidden;
  padding: 22px;
}

.plan::before {
  content: "";
  height: 4px;
  position: absolute;
  inset: 0 0 auto;
  background: linear-gradient(90deg, var(--primary), var(--accent), var(--amber));
}

.plan:hover {
  border-color: rgba(37, 99, 235, 0.28);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.plan strong {
  font-size: 18px;
  font-weight: 900;
}

.plan .price {
  color: var(--text);
  font-size: 28px;
  font-weight: 900;
}

.plan .price small {
  color: var(--text-dim);
}

.plan .meta {
  color: var(--text-mute);
  font-weight: 700;
}

.table-wrap {
  border-color: rgba(198, 211, 223, 0.72);
  border-radius: 8px;
  background: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

table {
  font-size: 13.5px;
}

th,
td {
  border-bottom-color: #e6edf3;
  padding: 14px 16px;
}

th {
  background: #f5f8fb;
  color: var(--text-dim);
  font-size: 11.5px;
  font-weight: 900;
  text-transform: uppercase;
}

tbody tr {
  transition: background-color 0.14s ease;
}

tbody tr:hover {
  background: #f8fbfd;
}

.badge {
  min-height: 23px;
  border: 0;
  font-weight: 900;
}

.badge.ok {
  color: var(--success);
  background: var(--success-soft);
}

.badge.warn {
  color: var(--warn);
  background: var(--warn-soft);
}

.badge.bad {
  color: var(--danger);
  background: var(--danger-soft);
}

.badge.info {
  color: var(--info);
  background: var(--info-soft);
}

.settings-tabs {
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.settings-tabs button {
  min-height: 35px;
  margin-bottom: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text-mute);
  font-weight: 800;
}

.settings-tabs button:hover {
  background: var(--surface-2);
}

.settings-tabs button.active {
  border-color: rgba(37, 99, 235, 0.2);
  background: var(--primary-soft);
  color: var(--primary-hover);
}

.settings-toolbar {
  padding-top: 0;
}

.section-head {
  padding-bottom: 14px;
}

.contact-info,
.tutorial-block-row,
.panel p.mono,
.target-email,
.sr-value {
  border-color: var(--border);
  background: var(--surface-2);
}

.tutorial-card-title {
  font-weight: 900;
}

.sr-warning {
  border-color: rgba(183, 121, 31, 0.18);
  background: var(--amber-soft);
}

.sr-card {
  border-color: rgba(198, 211, 223, 0.72);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.sr-card:hover {
  border-color: rgba(37, 99, 235, 0.22);
  box-shadow: var(--shadow-md);
}

.sr-list {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
  gap: 16px;
  align-items: start;
}

.sr-card {
  min-width: 0;
  gap: 12px;
  padding: 16px;
  overflow: hidden;
}

.sr-field {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.sr-label {
  width: auto;
  color: var(--text-dim);
  font-weight: 800;
}

.sr-value {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 8px 10px;
}

.sr-copy {
  min-width: 54px;
  padding-inline: 12px;
}

.sr-field .inline-toast {
  grid-column: 2 / -1;
  justify-self: start;
}

.sr-meta {
  padding-left: 50px;
}

.qr-frame {
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.notice-toast {
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-lg);
}

.inline-toast {
  font-weight: 800;
}

button:disabled,
button:disabled:hover,
button.secondary:disabled,
button.secondary:disabled:hover,
button.ghost:disabled,
button.ghost:disabled:hover {
  border: 1px solid var(--border);
  background: var(--surface-3);
  color: var(--text-disabled);
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 232px minmax(0, 1fr);
  }

  .main {
    padding-inline: 24px;
  }

  .topbar {
    margin-inline: -24px;
    padding-inline: 24px;
  }

  .auth-hero h1 {
    font-size: 38px;
  }
}

@media (max-width: 820px) {
  .layout {
    display: block;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 30;
    padding: 12px 14px 10px;
    box-shadow: 0 10px 30px rgba(24, 38, 52, 0.08);
  }

  .sidebar .brand {
    grid-template-columns: 36px minmax(0, 1fr);
    padding: 4px 4px 10px;
  }

  .brand-home {
    width: 36px;
    height: 36px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
  }

  .sidebar .nav {
    gap: 8px;
    padding-bottom: 4px;
  }

  .sidebar .nav button {
    min-height: 38px;
    padding: 8px 11px;
  }

  .nav-icon {
    width: 23px;
    height: 23px;
  }

  .main {
    padding: 18px 14px 42px;
  }

  .topbar {
    position: relative;
    margin: 0 0 16px;
    padding: 0;
    border-bottom: 0;
    background: transparent;
    backdrop-filter: none;
  }

  .topbar h1 {
    font-size: 21px;
  }

  .account-hero {
    grid-template-columns: 1fr;
    min-height: 0;
    padding: 22px;
  }

  .account-hero h2 {
    font-size: 25px;
  }

  .account-hero-status {
    justify-items: start;
    min-width: 0;
  }

  .tutorial-hero,
  .tutorial-card,
  .tutorial-resource-band {
    grid-template-columns: 1fr;
  }

  .tutorial-hero {
    min-height: 0;
    padding: 22px;
  }

  .tutorial-hero h2 {
    font-size: 26px;
  }

  .tutorial-card {
    gap: 16px;
    padding: 20px;
  }

  .tutorial-card-links {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 160px), 1fr));
  }

  .account-metrics {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: 18px;
  }

  .auth {
    padding: 18px;
  }

  .auth-wrap {
    max-width: 520px;
  }

  .auth-hero {
    min-height: auto;
    padding: 28px 22px;
  }

  .auth-status-grid,
  .auth-quick-stats {
    grid-template-columns: 1fr;
  }

  .auth-route {
    grid-template-columns: 1fr;
  }

  .route-line {
    width: 2px;
    height: 18px;
    justify-self: center;
    background: linear-gradient(180deg, var(--primary), rgba(79, 70, 229, 0.42));
  }

  .auth-service-board {
    min-height: 0;
    padding: 16px;
  }

  .auth-box {
    padding: 22px;
  }
}

@media (max-width: 560px) {
  body {
    background-size: auto, 42px 42px, 42px 42px, auto;
  }

  .topbar {
    align-items: flex-start;
  }

  .topbar-user {
    width: 100%;
    justify-content: space-between;
  }

  .logout-btn {
    flex: none;
  }

  .auth-hero {
    text-align: left;
    justify-items: stretch;
  }

  .auth-hero-copy {
    grid-template-columns: 1fr;
  }

  .auth-hero .logo-mark {
    justify-self: start;
  }

  .auth-hero h1 {
    font-size: 30px;
  }

  .subscription-actions button,
  .linkbox button {
    min-width: 0;
    width: 100%;
  }
}

/* Keep page sections unframed; cards are reserved for repeated items and tools. */
.panel {
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
  margin-bottom: 28px;
}

.panel + .panel {
  padding-top: 24px;
  border-top: 1px solid rgba(198, 211, 223, 0.62);
}

.fortune-panel,
.tutorial-card {
  border: 1px solid rgba(198, 211, 223, 0.72);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
  padding: 24px;
}

.fortune-panel {
  padding: 0;
}

.settings-grid,
.user-create-form,
#newPlanForm,
#newDcForm,
#changePasswordForm {
  padding: 18px;
  border: 1px solid rgba(198, 211, 223, 0.72);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-sm);
}

.panel .table-wrap,
.panel .grid.two,
.panel .grid.three {
  margin-top: 12px;
}

@media (max-width: 820px) {
  .panel {
    margin-bottom: 24px;
  }

  .panel + .panel {
    padding-top: 20px;
  }

  .settings-grid,
  .user-create-form,
  #newPlanForm,
  #newDcForm,
  #changePasswordForm,
  .fortune-panel,
  .tutorial-card {
    padding: 16px;
  }

  .fortune-panel {
    padding: 0;
  }
}

/* Subscription operation panel */
.subscription-panel .panel-head {
  margin-bottom: 14px;
}

.subscription-suite {
  display: grid;
  grid-template-columns: minmax(560px, 0.96fr) minmax(320px, 1fr);
  gap: 18px;
  align-items: stretch;
}

.subscription-console {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 238px;
  gap: 18px;
  align-items: stretch;
  min-height: 238px;
  padding: 18px;
  border: 1px solid rgba(198, 211, 223, 0.78);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(246, 248, 251, 0.86)),
    linear-gradient(90deg, rgba(37, 99, 235, 0.06) 1px, transparent 1px),
    linear-gradient(180deg, rgba(79, 70, 229, 0.05) 1px, transparent 1px);
  background-size: auto, 32px 32px, 32px 32px;
  box-shadow: var(--shadow);
}

.subscription-action-card {
  min-width: 0;
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  column-gap: 16px;
  row-gap: 14px;
  align-content: center;
  padding: 12px 8px 12px 6px;
}

.subscription-action-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.28), transparent),
    linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 16px 30px rgba(37, 99, 235, 0.18);
}

.subscription-action-icon::before {
  content: "";
  width: 26px;
  height: 16px;
  border: 3px solid #fff;
  border-left-width: 0;
  border-radius: 0 999px 999px 0;
  transform: rotate(-35deg);
  opacity: 0.95;
}

.subscription-action-copy {
  min-width: 0;
  align-self: center;
}

.subscription-action-copy strong {
  display: block;
  color: var(--text);
  font-size: 22px;
  font-weight: 900;
}

.subscription-action-copy span {
  display: block;
  margin-top: 6px;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 700;
}

.subscription-console .subscription-actions {
  grid-column: 1 / -1;
  align-self: end;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 180px));
  gap: 10px;
}

.subscription-console .subscription-actions button {
  min-width: 0;
  min-height: 46px;
  padding-inline: 18px;
}

.subscription-console .subscription-qr {
  margin-top: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(198, 211, 223, 0.72);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.subscription-console .qr-frame {
  width: 184px;
  max-width: 100%;
  padding: 10px;
  border-color: rgba(198, 211, 223, 0.7);
  box-shadow: none;
}

.subscription-console .qr-cap {
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 900;
}

.qr-placeholder {
  width: 184px;
  max-width: 100%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  color: var(--text-dim);
  background: var(--surface-2);
  font-weight: 900;
}

.subscription-console.is-empty {
  opacity: 0.78;
}

.subscription-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  min-width: 0;
}

.subscription-fact {
  position: relative;
  min-width: 0;
  min-height: 270px;
  display: grid;
  grid-template-rows: auto minmax(92px, 1fr) auto auto auto;
  align-content: stretch;
  gap: 12px;
  overflow: hidden;
  padding: 22px;
  border: 1px solid rgba(198, 211, 223, 0.78);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(248, 251, 253, 0.9)),
    linear-gradient(90deg, rgba(37, 99, 235, 0.08) 1px, transparent 1px),
    linear-gradient(180deg, rgba(79, 70, 229, 0.05) 1px, transparent 1px);
  background-size: auto, 28px 28px, 28px 28px;
  box-shadow: var(--shadow);
}

.subscription-fact::before {
  content: "";
  position: absolute;
  top: 16px;
  right: 16px;
  width: 64px;
  height: 42px;
  border-radius: 8px;
  background: var(--amber-soft);
  box-shadow: inset 0 0 0 1px rgba(183, 121, 31, 0.1);
}

.subscription-fact::after {
  content: "";
  position: absolute;
  top: 30px;
  right: 40px;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: var(--amber);
}

.subscription-fact.is-active::before {
  background: var(--success-soft);
}

.subscription-fact.is-active::after {
  background: var(--success);
}

.subscription-fact.is-warn::before {
  background: var(--warn-soft);
}

.subscription-fact.is-warn::after {
  background: var(--warn);
}

.fact-label,
.fact-value,
.fact-main,
.fact-kicker,
.fact-chip,
.fact-meter,
.fact-date-line,
.fact-mini-grid,
.fact-note {
  position: relative;
  z-index: 1;
}

.fact-label {
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 900;
}

.fact-value {
  color: var(--text);
  font-size: clamp(30px, 2.4vw, 42px);
  font-weight: 900;
  line-height: 1;
}

.fact-main {
  align-self: center;
  display: grid;
  gap: 10px;
  min-width: 0;
}

.fact-kicker {
  color: rgba(23, 33, 43, 0.08);
  font-size: clamp(34px, 3.4vw, 58px);
  font-weight: 900;
  line-height: 0.86;
  text-transform: uppercase;
}

.fact-chip {
  width: max-content;
  max-width: 100%;
  padding: 5px 10px;
  border-radius: 999px;
  color: var(--success);
  background: var(--success-soft);
  font-size: 12px;
  font-weight: 900;
}

.subscription-fact.is-warn .fact-chip {
  color: var(--warn);
  background: var(--warn-soft);
}

.fact-date {
  overflow-wrap: anywhere;
}

.fact-days {
  font-size: clamp(38px, 4vw, 66px);
  line-height: 0.95;
}

.fact-days small {
  margin-left: 8px;
  color: var(--text-dim);
  font-size: 16px;
  font-weight: 900;
}

.fact-date-line {
  width: max-content;
  max-width: 100%;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 7px 11px;
  border: 1px solid rgba(198, 211, 223, 0.7);
  border-radius: 8px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.72);
  font-size: 16px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.fact-meter {
  width: 100%;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-3);
}

.fact-meter span {
  display: block;
  width: 28%;
  height: 100%;
  border-radius: inherit;
  background: var(--warn);
}

.subscription-fact.is-active .fact-meter span {
  width: 100%;
  background: linear-gradient(90deg, var(--success), var(--primary));
}

.subscription-fact.is-warn .fact-meter span {
  width: 28%;
  background: var(--warn);
}

.subscription-fact.is-expiry .fact-kicker {
  color: rgba(183, 121, 31, 0.12);
}

.fact-mini-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.fact-mini-grid span {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 10px 11px;
  border: 1px solid rgba(198, 211, 223, 0.66);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.fact-mini-grid em {
  color: var(--text-dim);
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

.fact-mini-grid strong {
  min-width: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.subscription-fact.is-active .fact-mini-grid span:first-child {
  background: rgba(228, 247, 234, 0.75);
}

.subscription-fact.is-expiry .fact-mini-grid span:first-child {
  background: rgba(255, 243, 214, 0.78);
}

.fact-note {
  color: var(--text-dim);
  font-size: 12.5px;
  font-weight: 800;
}

@media (max-width: 1280px) {
  .subscription-suite {
    grid-template-columns: 1fr;
  }

  .subscription-fact {
    min-height: 132px;
  }
}

@media (max-width: 900px) {
  .subscription-suite,
  .subscription-facts {
    grid-template-columns: 1fr;
  }

  .subscription-console {
    grid-template-columns: 1fr;
  }

  .subscription-console .subscription-qr {
    justify-self: stretch;
  }

  .subscription-fact {
    min-height: 118px;
  }
}

@media (max-width: 560px) {
  .subscription-console {
    min-height: 0;
    padding: 14px;
  }

  .subscription-action-card {
    grid-template-columns: 46px minmax(0, 1fr);
    column-gap: 12px;
    padding: 4px 0 0;
  }

  .subscription-action-icon {
    width: 46px;
    height: 46px;
  }

  .subscription-action-icon::before {
    width: 22px;
    height: 13px;
  }

  .subscription-action-copy strong {
    font-size: 18px;
  }

  .subscription-console .subscription-actions {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   Clear morning theme
   ============================================================ */

:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --surface-3: #e2e8f0;
  --surface-hover: #eef2f6;
  --border: #cbd5e1;
  --border-strong: #94a3b8;
  --ring: rgba(37, 99, 235, 0.18);

  --text: #0f172a;
  --text-mute: #475569;
  --text-dim: #64748b;
  --text-disabled: #94a3b8;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --primary-text: #ffffff;

  --accent: #4f46e5;
  --accent-soft: #e0e7ff;
  --amber: #d97706;
  --amber-soft: #fef3c7;
  --rose: #e11d48;
  --rose-soft: #ffe4e6;
  --violet: #7c3aed;
  --violet-soft: #ede9fe;

  --success: #16a34a;
  --success-soft: #e6f5ff;
  --warn: #f3b64a;
  --warn-soft: #fff3d7;
  --danger: #d94c6a;
  --danger-soft: #ffe8ee;
  --info: #8c73ee;
  --info-soft: #f0ecff;

  --shadow-sm: 0 1px 2px rgba(37, 48, 86, 0.06);
  --shadow: 0 16px 36px rgba(37, 48, 86, 0.09), 0 1px 1px rgba(255, 255, 255, 0.82);
  --shadow-md: 0 22px 52px rgba(37, 48, 86, 0.13), 0 3px 10px rgba(37, 48, 86, 0.08);
  --shadow-lg: 0 34px 86px rgba(37, 48, 86, 0.16), 0 8px 24px rgba(37, 48, 86, 0.08);
}

* {
  letter-spacing: 0;
}

html,
body {
  background: var(--bg);
}

body {
  color: var(--text);
  background:
    linear-gradient(120deg, rgba(79, 103, 232, 0.08) 0%, rgba(255, 255, 255, 0) 34%),
    linear-gradient(235deg, rgba(27, 158, 232, 0.1) 0%, rgba(255, 255, 255, 0) 42%),
    linear-gradient(180deg, #fbfcff 0%, #f6f8ff 52%, #f3f6ff 100%);
}

::selection {
  background: rgba(79, 103, 232, 0.18);
  color: var(--text);
}

a {
  color: var(--primary);
}

a:hover {
  color: var(--accent);
}

button {
  border-color: transparent;
  background: linear-gradient(135deg, var(--primary), var(--violet));
  box-shadow: 0 14px 28px rgba(79, 103, 232, 0.18);
}

button:hover {
  border-color: transparent;
  background: linear-gradient(135deg, var(--primary-hover), #6d5ce4);
  box-shadow: 0 18px 34px rgba(79, 103, 232, 0.22);
}

button.secondary,
button.ghost,
.logout-btn {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

button.secondary:hover,
button.ghost:hover,
.logout-btn:hover {
  border-color: var(--border-strong);
  background: #fff;
  color: var(--primary-hover);
}

button.secondary.active {
  border-color: rgba(79, 103, 232, 0.24);
  background: var(--primary-soft);
  color: var(--primary-hover);
}

button.danger {
  border: 1px solid rgba(217, 76, 106, 0.28);
  background: var(--danger-soft);
  color: var(--danger);
  box-shadow: none;
}

input,
select,
textarea {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
}

input::placeholder,
textarea::placeholder {
  color: rgba(101, 112, 137, 0.62);
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--border-strong);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--ring);
}

.auth {
  padding-inline: clamp(24px, 4vw, 56px);
  background:
    linear-gradient(120deg, rgba(79, 103, 232, 0.09), transparent 36%),
    linear-gradient(240deg, rgba(140, 115, 238, 0.1), transparent 42%),
    linear-gradient(180deg, #fbfcff, #f6f8ff 58%, #f2f5ff);
}

.auth-hero {
  border-color: rgba(219, 228, 246, 0.92);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(238, 243, 255, 0.72)),
    linear-gradient(90deg, rgba(79, 103, 232, 0.055) 1px, transparent 1px),
    linear-gradient(180deg, rgba(27, 158, 232, 0.045) 1px, transparent 1px);
  background-size: auto, 32px 32px, 32px 32px;
}

.auth-hero .logo-mark,
.brand-mark,
.subscription-action-icon {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.28), transparent 45%),
    linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 18px 34px rgba(79, 103, 232, 0.2);
}

.auth-kicker {
  color: var(--primary-hover);
}

.auth-service-board,
.auth-box,
.auth-status-grid div,
.auth-node-row,
.auth-quick-stats span,
.panel,
.metric,
.plan,
.settings-grid,
.user-create-form,
#newPlanForm,
#newDcForm,
#changePasswordForm,
.fortune-panel,
.tutorial-card,
.subscription-console,
.subscription-fact,
.tutorial-resource-band,
.shadowrocket-card {
  border-color: rgba(219, 228, 246, 0.88);
  background: rgba(255, 255, 255, 0.84);
  box-shadow: var(--shadow);
}

.auth-service-board {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(238, 243, 255, 0.76)),
    linear-gradient(90deg, rgba(79, 103, 232, 0.06) 1px, transparent 1px),
    linear-gradient(180deg, rgba(27, 158, 232, 0.045) 1px, transparent 1px);
  background-size: auto, 28px 28px, 28px 28px;
}

.route-node {
  border-color: rgba(219, 228, 246, 0.96);
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
}

.route-node.active {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
}

.route-line {
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

.auth-node-row em {
  color: #176ea7;
  background: var(--accent-soft);
}

.node-dot.ok {
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(27, 158, 232, 0.14);
}

.node-dot.warm {
  background: var(--amber);
  box-shadow: 0 0 0 5px rgba(243, 182, 74, 0.16);
}

.tabs {
  border-color: rgba(219, 228, 246, 0.9);
  background: rgba(238, 243, 255, 0.76);
}

.tabs .tab {
  color: var(--text-dim);
  background: transparent;
  box-shadow: none;
}

.tabs .tab.active {
  color: var(--primary-hover);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow-sm);
}

.layout {
  max-width: 1500px;
  background: transparent;
}

.sidebar {
  width: 260px;
  border-right-color: rgba(219, 228, 246, 0.78);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(246, 248, 255, 0.9)),
    linear-gradient(135deg, rgba(79, 103, 232, 0.055), rgba(27, 158, 232, 0.045));
  box-shadow: 14px 0 38px rgba(37, 48, 86, 0.06);
}

.sidebar .brand,
.sidebar-foot,
.topbar,
th,
td {
  border-color: rgba(219, 228, 246, 0.82);
}

.sidebar .nav button {
  border-color: transparent;
  background: transparent;
  color: var(--text-mute);
}

.sidebar .nav button:hover,
.sidebar .nav button.active {
  border-color: rgba(79, 103, 232, 0.2);
  background:
    linear-gradient(135deg, rgba(79, 103, 232, 0.1), rgba(27, 158, 232, 0.075)),
    rgba(255, 255, 255, 0.94);
  color: var(--text);
  box-shadow: 0 12px 30px rgba(79, 103, 232, 0.11);
}

.sidebar .nav button.active .nav-icon {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
}

.nav-icon {
  background: var(--surface-3);
  color: var(--text-dim);
}

.main {
  padding: 36px clamp(34px, 4vw, 64px) 72px;
  background: transparent;
}

.topbar {
  margin-bottom: 26px;
  padding: 14px 4px;
  background: rgba(246, 248, 255, 0.78);
}

.topbar h1 {
  color: var(--text);
}

.panel {
  padding: 28px;
}

.panel-head {
  padding-inline: 2px;
}

.table-wrap,
table,
.linkbox,
.profile-card,
.shadowrocket-hero,
.tutorial-hero {
  border-color: rgba(219, 228, 246, 0.86);
  background: rgba(255, 255, 255, 0.84);
  box-shadow: var(--shadow);
}

th {
  background: rgba(238, 243, 255, 0.78);
  color: var(--text-mute);
}

td {
  background: rgba(255, 255, 255, 0.62);
}

tr:hover td {
  background: rgba(79, 103, 232, 0.045);
}

.badge {
  background: var(--surface-2);
  color: var(--text-mute);
}

.badge.ok,
.sync-ok {
  color: #176ea7;
  background: var(--accent-soft);
}

.badge.warn {
  color: #8a5d12;
  background: var(--amber-soft);
}

.badge.bad,
.sync-bad {
  color: var(--danger);
  background: var(--danger-soft);
}

.account-hero,
.tutorial-hero,
.purchase-hero {
  border: 1px solid rgba(184, 199, 234, 0.72);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.24)),
    linear-gradient(135deg, #eef4ff 0%, #ffffff 44%, #f3f0ff 100%);
  color: var(--text);
  box-shadow: var(--shadow);
}

.account-hero .eyebrow,
.account-hero p,
.tutorial-hero .eyebrow,
.tutorial-hero p,
.purchase-hero .eyebrow,
.purchase-hero p {
  color: var(--text-mute);
}

.account-hero h2,
.tutorial-hero h2,
.purchase-hero h2 {
  color: var(--text);
}

.account-hero::after,
.purchase-hero::after {
  background:
    linear-gradient(90deg, rgba(79, 103, 232, 0.07) 1px, transparent 1px),
    linear-gradient(180deg, rgba(27, 158, 232, 0.055) 1px, transparent 1px);
  background-size: 38px 38px;
}

.subscription-fact.is-active .fact-meter span {
  background: linear-gradient(90deg, var(--accent), var(--primary));
}

.subscription-fact.is-warn .fact-meter span {
  background: linear-gradient(90deg, var(--amber), var(--violet));
}

.plan {
  border-color: rgba(219, 228, 246, 0.9);
}

.plan::before {
  background: linear-gradient(90deg, var(--primary), var(--accent), var(--amber));
}

.plan:hover {
  border-color: rgba(79, 103, 232, 0.28);
  box-shadow: var(--shadow-md);
}

.purchase-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, 0.34fr);
  align-items: center;
  gap: 24px;
  min-height: 168px;
  margin-bottom: 18px;
  padding: 30px;
  overflow: hidden;
  border-radius: 8px;
}

.purchase-hero h2 {
  margin-top: 10px;
  font-size: 30px;
  font-weight: 900;
  line-height: 1.15;
}

.purchase-hero p {
  max-width: 560px;
  margin: 10px 0 0;
  font-size: 14px;
  font-weight: 650;
}

.purchase-hero-orbit {
  position: relative;
  min-height: 112px;
}

.purchase-hero-orbit span {
  position: absolute;
  border-radius: 8px;
  border: 1px solid rgba(79, 103, 232, 0.18);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow-sm);
}

.purchase-hero-orbit span:nth-child(1) {
  inset: 8px 52px 38px 18px;
  background: linear-gradient(135deg, var(--primary-soft), #fff);
}

.purchase-hero-orbit span:nth-child(2) {
  inset: 42px 12px 6px 58px;
  background: linear-gradient(135deg, var(--accent-soft), #fff);
}

.purchase-hero-orbit span:nth-child(3) {
  width: 54px;
  height: 54px;
  right: 58px;
  top: 30px;
  background: linear-gradient(135deg, var(--amber-soft), #fff);
}

.purchase-panel .panel-head {
  margin-bottom: 20px;
}

.purchase-grid {
  align-items: stretch;
}

.notice-toast {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    width: auto;
  }
}

@media (max-width: 820px) {
  .sidebar {
    position: relative;
    top: auto;
    z-index: auto;
    height: auto;
    max-height: none;
    padding: 16px 20px 18px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(246, 248, 255, 0.92)),
      linear-gradient(135deg, rgba(79, 103, 232, 0.055), rgba(27, 158, 232, 0.045));
    box-shadow: 0 10px 26px rgba(37, 48, 86, 0.07);
  }

  .sidebar .brand {
    grid-template-columns: 40px minmax(0, 1fr);
    padding: 4px 2px 12px;
  }

  .brand-home,
  .brand-mark {
    width: 40px;
    height: 40px;
  }

  .sidebar .nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 9px;
    margin-top: 12px;
    padding: 0;
    overflow: visible;
  }

  .sidebar .nav::-webkit-scrollbar {
    display: none;
  }

  .sidebar .nav button {
    width: 100%;
    min-width: 0;
    min-height: 64px;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    padding: 9px 8px;
    white-space: normal;
    text-align: center;
    line-height: 1.15;
    border-color: rgba(219, 228, 246, 0.9);
    background: rgba(255, 255, 255, 0.76);
  }

  .sidebar .nav button:hover,
  .sidebar .nav button.active,
  .sidebar .nav button.active:hover {
    transform: none;
  }

  .nav-icon {
    width: 25px;
    height: 25px;
    flex-basis: 25px;
  }

  .sidebar-foot {
    display: none;
  }

  .main {
    padding: 24px 22px 48px;
  }

  .topbar {
    position: relative;
    margin: 0 0 20px;
    padding: 0 2px;
    border-bottom: 0;
    background: transparent;
    backdrop-filter: none;
  }

  .panel {
    padding: 22px;
  }

  .account-hero,
  .purchase-hero {
    grid-template-columns: 1fr;
    min-height: 0;
    padding: 24px;
  }

  .purchase-hero-orbit {
    display: none;
  }
}

@media (max-width: 520px) {
  .sidebar {
    padding-inline: 16px;
  }

  .sidebar .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .main {
    padding: 22px 18px 44px;
  }

  .panel {
    padding: 20px;
  }
}

/* ============================================================
   Subscription workspace rebuild
   ============================================================ */

@media (min-width: 981px) {
  .layout {
    grid-template-columns: 282px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
    max-width: 1580px;
    padding-inline: 18px;
    padding-block: clamp(58px, 8vh, 112px) clamp(42px, 7vh, 88px);
  }

  .sidebar {
    position: sticky;
    top: clamp(24px, 6vh, 78px);
    width: auto;
    height: auto;
    min-height: 0;
    max-height: calc(100vh - clamp(48px, 12vh, 156px));
    margin-block: 0;
    overflow-y: auto;
    border: 1px solid rgba(219, 228, 246, 0.86);
    border-radius: 14px;
    box-shadow: 0 18px 46px rgba(37, 48, 86, 0.09);
  }

  .main {
    padding-top: 0;
    padding-inline: clamp(24px, 3vw, 52px);
  }
}

.sidebar-foot {
  display: none;
}

.subscription-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  gap: 18px;
  align-items: stretch;
}

.subscription-command,
.aside-card,
.subscription-step {
  border: 1px solid rgba(184, 199, 234, 0.78);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.subscription-command {
  position: relative;
  min-height: 360px;
  overflow: hidden;
  padding: clamp(24px, 3vw, 34px);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(239, 244, 255, 0.82)),
    linear-gradient(90deg, rgba(79, 103, 232, 0.055) 1px, transparent 1px),
    linear-gradient(180deg, rgba(27, 158, 232, 0.045) 1px, transparent 1px);
  background-size: auto, 34px 34px, 34px 34px;
}

.subscription-command::after {
  content: "";
  position: absolute;
  right: -120px;
  bottom: -170px;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(140, 115, 238, 0.16), transparent 62%);
  pointer-events: none;
}

.command-topline,
.aside-card-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.command-layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 156px minmax(0, 1fr);
  gap: clamp(20px, 3vw, 34px);
  align-items: center;
  margin-top: clamp(22px, 3vw, 34px);
}

.status-dial {
  position: relative;
  width: 156px;
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--text);
  background:
    radial-gradient(circle at center, #fff 0 58%, transparent 59%),
    conic-gradient(var(--primary) 0 74%, var(--accent-soft) 74% 100%);
  box-shadow: inset 0 0 0 1px rgba(184, 199, 234, 0.75), 0 18px 40px rgba(79, 103, 232, 0.16);
}

.subscription-command.is-pending .status-dial {
  background:
    radial-gradient(circle at center, #fff 0 58%, transparent 59%),
    conic-gradient(var(--amber) 0 24%, var(--accent-soft) 24% 100%);
}

.subscription-command .traffic-dial {
  background:
    radial-gradient(circle at center, #fff 0 58%, transparent 59%),
    conic-gradient(var(--primary) 0 var(--traffic-pct, 0%), rgba(219, 228, 246, 0.82) var(--traffic-pct, 0%) 100%);
}

.subscription-command.is-exhausted .traffic-dial {
  background:
    radial-gradient(circle at center, #fff 0 58%, transparent 59%),
    conic-gradient(var(--danger) 0 var(--traffic-pct, 100%), rgba(219, 228, 246, 0.82) var(--traffic-pct, 100%) 100%);
}

.status-dial span {
  display: block;
  color: var(--text);
  font-size: 44px;
  font-weight: 950;
  line-height: 0.9;
  transform: translateY(4px);
}

.status-dial small {
  display: block;
  margin-top: 8px;
  color: var(--text-mute);
  font-size: 13px;
  font-weight: 900;
  transform: translateY(4px);
}

.command-copy h2 {
  margin: 0;
  color: var(--text);
  font-size: clamp(30px, 3.4vw, 46px);
  font-weight: 950;
  line-height: 1.04;
}

.command-copy p {
  max-width: 640px;
  margin: 12px 0 0;
  color: var(--text-mute);
  font-size: 15px;
  font-weight: 650;
}

.command-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.command-actions button {
  min-height: 44px;
}

.traffic-meter {
  position: relative;
  z-index: 1;
  height: 12px;
  margin-top: clamp(22px, 3vw, 34px);
  overflow: hidden;
  border: 1px solid rgba(219, 228, 246, 0.92);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
}

.traffic-meter span {
  display: block;
  height: 100%;
  min-width: 0;
  max-width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.25s ease;
}

.subscription-command.is-exhausted .traffic-meter span {
  background: linear-gradient(90deg, var(--danger), var(--amber));
}

.command-metrics {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: clamp(24px, 3vw, 36px);
}

.command-metrics span {
  min-width: 0;
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid rgba(219, 228, 246, 0.9);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.76);
}

.command-metrics em,
.subscription-step em {
  color: var(--text-dim);
  font-size: 12px;
  font-style: normal;
  font-weight: 850;
}

.command-metrics strong,
.subscription-step strong {
  min-width: 0;
  color: var(--text);
  font-size: 15px;
  font-weight: 950;
  overflow-wrap: anywhere;
}

.subscription-aside {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 18px;
}

.aside-card {
  min-width: 0;
  padding: 20px;
}

.aside-card-head span {
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
}

.aside-card-head b {
  color: var(--primary-hover);
  font-size: 13px;
}

.aside-card > strong {
  display: block;
  margin-top: 18px;
  color: var(--text);
  font-size: 20px;
  font-weight: 950;
}

.aside-card p {
  margin: 8px 0 0;
  color: var(--text-mute);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.6;
}

.subscription-qr-compact {
  min-height: 178px;
  margin-top: 18px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 14px;
  border: 1px dashed rgba(184, 199, 234, 0.9);
  border-radius: 12px;
  background: rgba(238, 243, 255, 0.54);
}

.subscription-qr-compact .qr-frame {
  width: 144px;
  padding: 8px;
  border: 1px solid rgba(184, 199, 234, 0.7);
  border-radius: 8px;
  background: #fff;
  box-shadow: none;
}

.subscription-qr-compact .qr-cap {
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 900;
}

.subscription-qr-compact .qr-placeholder {
  width: 136px;
  background: rgba(255, 255, 255, 0.78);
}

.subscription-renewal {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(255, 243, 215, 0.64)),
    #fff;
}

.subscription-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.subscription-step {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.subscription-step > span {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--text-mute);
  background: var(--surface-3);
  font-size: 12px;
  font-weight: 950;
}

.subscription-step.is-done > span {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--accent));
}

.subscription-step.is-waiting > span {
  color: #8a5d12;
  background: var(--amber-soft);
}

.subscription-step div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

@media (max-width: 1180px) {
  .subscription-workbench {
    grid-template-columns: 1fr;
  }

  .subscription-aside {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: auto;
  }
}

@media (max-width: 820px) {
  .subscription-command {
    min-height: 0;
    padding: 22px;
  }

  .command-layout {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .status-dial {
    width: 136px;
  }

  .command-metrics,
  .subscription-steps,
  .subscription-aside {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .command-metrics,
  .subscription-steps,
  .subscription-aside {
    grid-template-columns: 1fr;
  }

  .command-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .command-actions button {
    width: 100%;
  }
}

/* Tutorial hero contrast fixes */
.tutorial-quick {
  gap: 12px;
}

.tutorial-quick span {
  border: 1px solid rgba(184, 199, 234, 0.9);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 26px rgba(79, 103, 232, 0.08);
  backdrop-filter: none;
}

.tutorial-quick em {
  width: 34px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--primary-hover);
  background: var(--primary-soft);
  font-style: normal;
  font-weight: 950;
}

.tutorial-quick strong {
  color: var(--text);
  font-weight: 900;
}

.plan-id-copy {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 180px;
}

.plan-id-copy code {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  background: var(--surface-2);
  font-size: 12px;
}

.plan-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px;
  min-width: 260px;
}

.plan-picker-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 8px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  cursor: pointer;
}

.plan-picker-item input {
  grid-row: span 2;
}

.plan-picker-item span,
.plan-picker-item code {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plan-picker-item span {
  color: var(--text);
  font-weight: 800;
}

.plan-picker-item code {
  color: var(--text-mute);
  font-size: 12px;
}

.hint {
  display: block;
  margin-top: 6px;
  color: var(--text-mute);
  font-size: 12px;
}

.geetest-box {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  min-height: 44px;
}

.geetest-captcha {
  flex: 1 1 100%;
  width: 100%;
  min-width: 0;
  min-height: 44px;
}

/* Stretch only the GeeTest root we mount (its direct child) so the inline
   trigger button lines up with the form inputs. The slide-captcha popup and
   its drag handle are nested deeper and must keep their own native sizing �?   do NOT target .geetest_btn here, that is also the slider handle's class. */
.geetest-captcha > div {
  width: 100%;
}

.geetest-status {
  color: var(--text-mute);
  font-size: 13px;
}

/* Group buy activity page */
.group-buy-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
  min-height: 164px;
  margin-bottom: 18px;
  padding: 30px 34px;
  border: 1px solid rgba(129, 154, 255, 0.28);
  border-radius: 10px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(69, 105, 255, 0.92), rgba(108, 91, 233, 0.86) 55%, rgba(34, 158, 188, 0.72)),
    #4665f2;
  color: #fff;
}

.group-buy-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(45deg, rgba(255, 255, 255, 0.13) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255, 255, 255, 0.13) 25%, transparent 25%);
  background-size: 34px 34px;
  opacity: 0.28;
  pointer-events: none;
}

.group-buy-hero > * {
  position: relative;
  z-index: 1;
}

.group-buy-hero .eyebrow,
.group-buy-hero p {
  color: rgba(255, 255, 255, 0.82);
}

.group-buy-hero h2 {
  margin: 6px 0 8px;
  color: #fff;
  font-size: 34px;
  line-height: 1.14;
}

.group-buy-hero button {
  border-color: rgba(255, 255, 255, 0.72);
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.group-buy-invite,
.group-buy-empty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding: 18px 22px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.group-buy-invite > div,
.group-buy-empty {
  min-width: 0;
}

.group-buy-invite strong,
.group-buy-empty strong {
  display: block;
  margin: 6px 0;
  font-size: 18px;
}

.group-buy-board {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 18px;
  margin-bottom: 18px;
}

.group-buy-progress-card,
.group-buy-share,
.group-buy-guide {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.group-buy-progress-card {
  padding: 24px;
}

.group-buy-steps {
  display: grid;
  grid-template-columns: max-content 1fr max-content 1fr max-content;
  gap: 12px;
  align-items: center;
  margin-bottom: 22px;
}

.group-buy-steps span {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  padding: 0 14px;
  border-radius: 999px;
  color: var(--text-mute);
  background: var(--surface-2);
  font-size: 13px;
  font-weight: 800;
}

.group-buy-steps span.active {
  color: #fff;
  background: var(--primary);
}

.group-buy-steps i {
  height: 2px;
  background: linear-gradient(90deg, rgba(92, 111, 232, 0.55), rgba(34, 158, 188, 0.35));
}

.group-buy-headline {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
}

.group-buy-headline strong {
  display: block;
  font-size: 24px;
}

.group-buy-headline span {
  color: var(--text-mute);
}

.group-buy-discount {
  flex: 0 0 auto;
  align-self: flex-start;
  padding: 10px 14px;
  border-radius: 8px;
  color: #b9441d;
  background: #fff0e8;
  font-size: 18px;
  font-weight: 950;
}

.group-buy-status-line {
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
}

.group-buy-status-line b {
  color: #df5b2f;
  font-size: 20px;
}

.group-buy-progress {
  height: 10px;
  margin: 16px 0 22px;
  border-radius: 999px;
  overflow: hidden;
  background: #edf2ff;
}

.group-buy-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #4f6fe8, #31a6bd);
}

.group-buy-members {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 12px;
}

.group-buy-member {
  min-width: 0;
  padding: 14px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}

.group-buy-member.me {
  border-color: rgba(79, 111, 232, 0.45);
  background: rgba(79, 111, 232, 0.08);
}

.group-buy-member.empty {
  color: var(--text-mute);
  border-style: dashed;
  background: transparent;
}

button.group-buy-member {
  display: block;
  width: 100%;
  color: inherit;
  text-align: left;
  white-space: normal;
  cursor: pointer;
}

button.group-buy-member.empty:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.member-avatar {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  margin-bottom: 10px;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, #4f6fe8, #31a6bd);
  font-weight: 900;
}

.group-buy-member.empty .member-avatar {
  color: var(--primary);
  background: var(--primary-soft);
}

.group-buy-member strong,
.group-buy-member span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-buy-member span {
  margin-top: 3px;
  color: var(--text-mute);
  font-size: 12px;
}

.group-buy-share {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 20px;
}

.group-buy-share strong {
  font-size: 18px;
}

.group-buy-qr {
  display: grid;
  place-items: center;
  min-height: 168px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

button.group-buy-qr {
  width: 100%;
  color: inherit;
  cursor: pointer;
}

button.group-buy-qr:hover {
  border-color: var(--primary);
  box-shadow: inset 0 0 0 2px var(--primary-soft);
}

.group-buy-qr svg {
  display: block;
  width: 148px;
  max-width: 100%;
  height: auto;
}

.group-buy-share input {
  width: 100%;
  min-width: 0;
  font-size: 12px;
}

.group-buy-invite-runway {
  display: grid;
  grid-template-columns: minmax(0, auto) 1fr auto;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--primary), var(--border) 45%);
  border-radius: 8px;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.72), rgba(227, 237, 223, 0.78)),
    var(--surface);
  white-space: normal;
}

.group-buy-invite-runway span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

.group-buy-invite-runway i {
  height: 2px;
  min-width: 36px;
  background-image: radial-gradient(circle, var(--primary) 1.5px, transparent 1.7px);
  background-size: 10px 2px;
  background-repeat: repeat-x;
  opacity: 0.75;
}

.group-buy-invite-runway b {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  color: #fff;
  background: #57766a;
  font-size: 12px;
}

.group-buy-invite-runway:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.group-pay-box {
  display: grid;
  gap: 10px;
  min-width: min(100%, 520px);
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}

.group-pay-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.group-pay-summary span {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-dim);
  font-size: 12px;
}

.group-pay-summary b {
  color: var(--text);
  font-size: 14px;
}

.group-pay-balance {
  align-items: center;
  color: var(--text-mute);
}

.group-pay-hint {
  margin: 0;
  color: var(--text-mute);
  font-size: 12px;
  line-height: 1.4;
}

.plan-pay-box {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}

.plan-pay-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.plan-pay-summary span {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-dim);
  font-size: 12px;
}

.plan-pay-summary b {
  color: var(--text);
  font-size: 14px;
}

.copy-subscription-qr {
  cursor: pointer;
}

.copy-subscription-qr:hover .qr-frame,
.copy-subscription-qr:hover .qr-placeholder {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.group-buy-guide {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(300px, 1.1fr);
  gap: 22px;
  margin-bottom: 18px;
  padding: 24px;
}

.group-buy-guide-list {
  display: grid;
  gap: 14px;
}

.group-buy-guide-list div {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  column-gap: 14px;
  align-items: center;
  min-height: 70px;
}

.group-buy-guide-list em {
  grid-row: span 2;
  color: #df6a38;
  font-size: 34px;
  font-style: normal;
  font-weight: 950;
}

.group-buy-guide-list strong {
  font-size: 17px;
}

.group-buy-guide-list span,
.group-buy-campaign small {
  color: var(--text-mute);
}

.group-buy-campaigns {
  display: grid;
  gap: 10px;
}

.group-buy-campaigns > strong {
  font-size: 18px;
}

.group-buy-campaign,
.group-buy-mini {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 12px;
  align-items: center;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: 8px;
  background: linear-gradient(135deg, var(--surface-2), rgba(37, 99, 235, 0.03));
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.group-buy-mini:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.group-buy-campaign b {
  grid-row: span 2;
  color: var(--primary);
}

.group-buy-mini-list {
  display: grid;
  gap: 10px;
}

.group-buy-mini span {
  color: var(--text-mute);
}

.group-buy-mini button {
  grid-row: span 2;
}

@media (max-width: 1040px) {
  .group-buy-hero,
  .group-buy-board,
  .group-buy-guide {
    grid-template-columns: 1fr;
  }

  .group-buy-share {
    grid-template-columns: 180px minmax(0, 1fr);
    align-items: center;
  }

  .group-buy-share strong {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  .group-buy-hero {
    padding: 24px 20px;
  }

  .group-buy-hero h2 {
    font-size: 26px;
  }

  .group-buy-steps {
    grid-template-columns: 1fr;
  }

  .group-buy-steps i {
    display: none;
  }

  .group-buy-headline,
  .group-buy-invite,
  .group-buy-empty {
    align-items: flex-start;
    flex-direction: column;
  }

  .group-buy-share {
    grid-template-columns: 1fr;
  }
}

/* Final layout normalization: keep admin forms, tables, and action rows visually consistent. */
.content {
  gap: 18px;
}

.panel,
.settings-grid,
.user-create-form,
#newPlanForm,
#newDcForm,
#changePasswordForm,
.group-buy-progress-card,
.group-buy-share,
.group-buy-guide {
  border-radius: 8px;
}

.panel {
  padding: 20px;
}

.panel-head,
.toolbar,
.settings-toolbar,
.row,
.subscription-actions,
.command-actions {
  gap: 10px;
}

.panel-head,
.toolbar,
.settings-toolbar {
  align-items: center;
}

.panel-head > div,
.toolbar > div,
.settings-toolbar > div {
  min-width: 0;
}

button,
input,
select,
textarea {
  min-height: 40px;
}

button.small {
  min-height: 32px;
}

button,
.input-addon > .addon-btn,
.subscription-actions button,
.command-actions button {
  white-space: nowrap;
}

.toolbar input,
.toolbar select,
.settings-toolbar input,
.settings-toolbar select {
  max-width: 320px;
}

.form,
.settings-grid,
.user-create-form,
#newPlanForm,
#newDcForm,
#changePasswordForm {
  align-items: start;
}

.settings-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
}

.settings-grid .wide,
.user-create-form .wide,
#newPlanForm .wide,
#newDcForm .wide {
  grid-column: 1 / -1;
}

td .row,
td .input-addon,
td .input-suffix,
.discount-row,
.subscription-linkbox,
.group-buy-share .row {
  width: 100%;
}

td .row {
  flex-wrap: nowrap;
}

td input,
td select,
td .input-addon,
td .input-suffix {
  min-width: 0;
  max-width: 100%;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
}

th,
td {
  vertical-align: middle;
}

.badge,
.pill,
.plan-id-copy,
.group-buy-discount {
  width: max-content;
  max-width: 100%;
}

.plan-id-copy {
  min-width: 0;
}

.plan-picker {
  min-width: 0;
}

.plan-picker-item {
  min-height: 44px;
}

/* ===== Balance Page ===== */

.balance-hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}

.balance-hero-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 24px;
  background: linear-gradient(135deg, var(--primary-soft), var(--surface-2));
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.balance-hero-label {
  font-size: 14px;
  color: var(--text-mute);
  font-weight: 500;
}

.balance-hero-amount {
  font-size: 36px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.5px;
}

.balance-hero-sub {
  font-size: 12px;
  color: var(--text-dim);
}

.balance-recharge-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px;
  background: var(--surface-2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.balance-recharge-form strong {
  font-size: 16px;
  font-weight: 600;
}

.balance-recharge-form span {
  font-size: 13px;
  color: var(--text-mute);
}

.balance-recharge-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.balance-recharge-row input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: var(--surface);
}

.balance-recharge-row input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--ring);
}

.balance-presets {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.preset-chip {
  padding: 6px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
}

.preset-chip:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary);
}

.balance-tx-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.balance-tx {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.balance-tx-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.balance-tx-info strong {
  font-size: 14px;
  font-weight: 600;
}

.balance-tx-info span {
  font-size: 12px;
  color: var(--text-mute);
}

.balance-tx-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.balance-tx-amount {
  font-size: 14px;
  font-weight: 600;
}

.balance-tx-amount.positive {
  color: var(--success);
}

.balance-tx-amount.negative {
  color: var(--danger);
}

.balance-tx-meta .muted {
  font-size: 12px;
}

@media (max-width: 820px) {
  .balance-hero {
    grid-template-columns: 1fr;
  }
}

/* Balance payment option in buy plans */
.balance-pay-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--primary-soft);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

.balance-pay-option input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.balance-pay-option span {
  font-size: 13px;
  color: var(--primary);
  font-weight: 500;
}

.balance-insufficient {
  font-size: 12px;
  color: var(--text-mute);
  margin-bottom: 12px;
  padding: 8px 12px;
  background: var(--warn-soft);
  border-radius: var(--radius-sm);
}

.balance-insufficient a {
  color: var(--primary);
  text-decoration: underline;
}

/* Group buy timer and member status */
.group-buy-timer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--warn-soft);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

.timer-label {
  font-size: 12px;
  color: var(--text-mute);
}

.timer-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--warn);
}

.member-status {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
}

.member-status.paid {
  background: var(--success-soft);
  color: var(--success);
}

.member-status.unpaid {
  background: var(--warn-soft);
  color: var(--warn);
}

.group-buy-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.group-buy-actions button {
  flex: 1;
}

.group-buy-mini-status {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
}

.group-buy-mini-status.completed {
  background: var(--success-soft);
  color: var(--success);
}

.group-buy-mini-status.failed {
  background: var(--danger-soft);
  color: var(--danger);
}

.group-buy-mini-status.cancelled {
  background: var(--text-disabled);
  color: var(--text-dim);
}

/* Admin balance adjustment */
.user-balance {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.balance-display-small {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
  padding: 4px 8px;
  background: var(--primary-soft);
  border-radius: var(--radius-sm);
  text-align: center;
}

.balance-adjust-row {
  display: flex;
  gap: 4px;
  align-items: center;
}

.balance-adjust-input {
  flex: 1;
  min-width: 0;
  padding: 4px 6px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.balance-adjust-input:focus {
  outline: none;
  border-color: var(--primary);
}

.balance-adjust-btn {
  padding: 4px 8px;
  font-size: 11px;
  white-space: nowrap;
}

.group-buy-hero,
.group-buy-invite,
.group-buy-empty,
.group-buy-board,
.group-buy-guide {
  margin-bottom: 18px;
}

.group-buy-board {
  align-items: start;
}

.group-buy-share {
  grid-template-columns: 1fr;
}

.group-buy-share .row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.group-buy-share .row button {
  width: 100%;
}

.group-buy-campaign,
.group-buy-mini {
  min-height: 58px;
}

.geetest-box {
  align-items: flex-start;
}

@media (max-width: 820px) {
  .panel {
    padding: 16px;
  }

  .panel-head,
  .toolbar,
  .settings-toolbar,
  .row {
    align-items: stretch;
  }

  .toolbar input,
  .toolbar select,
  .settings-toolbar input,
  .settings-toolbar select {
    max-width: none;
  }

  td .row,
  .group-buy-share .row {
    grid-template-columns: 1fr;
  }

  /* Group buy responsive */
  .group-buy-hero {
    grid-template-columns: 1fr;
    padding: 22px 18px;
  }

  .group-buy-board {
    grid-template-columns: 1fr;
  }

  .group-buy-steps {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .group-buy-steps i {
    width: 2px;
    height: 12px;
    justify-self: center;
  }

  .group-buy-headline {
    flex-direction: column;
    gap: 12px;
  }

  .group-buy-discount {
    align-self: flex-start;
  }

  .group-buy-members {
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  }

  .group-buy-guide {
    grid-template-columns: 1fr;
    padding: 18px;
  }
}

/* ===== Refined register captcha and user operations workspace ===== */

#geetestBox.geetest-box {
  display: grid;
  gap: 6px;
  width: 100%;
}

#geetestBox .geetest-captcha,
#geetestBox .geetest-captcha > div,
#geetestBox .geetest-captcha > div > div {
  width: 100% !important;
  max-width: 100%;
}

#geetestBox .geetest-status:empty {
  display: none;
}

.user-command {
  display: grid;
  gap: 16px;
  margin-bottom: 18px;
}

.user-command-hero {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1.4fr);
  gap: 18px;
  align-items: stretch;
  padding: 24px;
  border: 1px solid color-mix(in srgb, var(--border-strong), transparent 18%);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 254, 250, 0.96), rgba(237, 243, 236, 0.92)),
    var(--surface);
  box-shadow: var(--shadow-sm);
}

.user-command-hero h2 {
  margin-top: 4px;
  font-size: 26px;
  letter-spacing: 0;
}

.user-command-hero p,
.user-search-panel span,
.form-title span {
  margin: 6px 0 0;
  color: var(--text-dim);
  font-size: 13px;
}

.user-command-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.user-command-stats div {
  display: grid;
  align-content: center;
  gap: 6px;
  min-height: 88px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
}

.user-command-stats span {
  color: var(--text-dim);
  font-size: 12px;
}

.user-command-stats strong {
  font-size: 22px;
  line-height: 1.1;
  word-break: break-word;
}

.user-command-grid {
  display: grid;
  grid-template-columns: minmax(320px, 1.35fr) minmax(280px, 0.65fr);
  gap: 16px;
  align-items: stretch;
}

.user-command-grid .user-create-form,
.user-search-panel {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.user-command-grid .user-create-form {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
}

.form-title {
  grid-column: 1 / -1;
  display: grid;
  gap: 2px;
}

.user-create-switches {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.user-create-actions button,
.user-search-panel > button {
  width: 100%;
}

.user-search-panel {
  align-content: start;
}

.user-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.user-list-panel {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.user-list-panel .toolbar {
  margin-bottom: 12px;
}

.user-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 430px), 1fr));
  gap: 14px;
}

.user-card-grid > .user-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.user-card-grid > .user-card:hover {
  border-color: color-mix(in srgb, var(--primary), var(--border) 38%);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.user-card-grid > .user-card.is-disabled {
  background: color-mix(in srgb, var(--surface), var(--danger-soft) 22%);
}

.user-card-main {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.user-avatar {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  color: #fff;
  background: #57766a;
  font-size: 20px;
  font-weight: 700;
}

.user-identity {
  min-width: 0;
}

.user-card-grid > .user-card .user-email {
  margin-bottom: 7px;
  font-size: 15px;
  font-weight: 700;
}

.user-meta-line,
.user-card-details,
.user-card-edit,
.user-op-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.user-card-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.user-card-details > div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}

.user-card-details span {
  display: block;
  margin-bottom: 4px;
  color: var(--text-dim);
  font-size: 11.5px;
}

.user-card-details strong,
.user-card-details code {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.user-card-edit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px;
  gap: 10px;
}

.user-state-actions {
  padding-top: 2px;
}

.user-ops {
  display: grid;
  gap: 8px;
}

.user-op-row {
  align-items: stretch;
}

.user-op-row input {
  flex: 1 1 150px;
  min-width: 0;
}

.user-op-row button {
  flex: 0 0 auto;
}

.password-control input {
  width: auto;
  min-width: 0;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 28px;
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  text-align: center;
  background: var(--surface);
}

@media (max-width: 1100px) {
  .user-command-hero,
  .user-command-grid {
    grid-template-columns: 1fr;
  }

  .user-command-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .user-command-hero,
  .user-command-grid .user-create-form,
  .user-search-panel,
  .user-card-grid > .user-card {
    padding: 14px;
  }

  .user-command-stats,
  .user-command-grid .user-create-form,
  .user-card-details,
  .user-card-edit,
  .user-search-row {
    grid-template-columns: 1fr;
  }

  .user-op-row button,
  .user-create-actions,
  .user-create-actions button {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .group-buy-hero h2 {
    font-size: 26px;
  }

  .group-buy-progress-card,
  .group-buy-share {
    padding: 16px;
  }

  .group-buy-headline strong {
    font-size: 20px;
  }

  .group-buy-discount {
    font-size: 15px;
    padding: 8px 12px;
  }

  .group-buy-members {
    grid-template-columns: 1fr;
  }

  .group-buy-share .row {
    flex-direction: column;
  }

  .group-buy-share .row button {
    width: 100%;
  }
}

/* ===== Group buy refresh ===== */

.group-buy-offers {
  margin-bottom: 18px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.group-buy-offer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 12px;
}

.group-buy-offer {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}

.group-buy-offer strong,
.group-buy-offer span {
  display: block;
}

.group-buy-offer > div > span {
  margin-top: 3px;
  color: var(--text-dim);
  font-size: 12px;
}

.group-buy-tier-board {
  display: grid;
  gap: 12px;
  margin: 14px 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}

.group-buy-tier-board > div:first-child {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.group-buy-tier-board span {
  color: var(--text-dim);
  font-size: 12px;
}

.group-tier-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.group-tier-pill {
  display: inline-grid;
  grid-template-columns: auto auto;
  gap: 6px;
  align-items: center;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  white-space: nowrap;
}

.group-tier-pill b,
.group-tier-pill em {
  font-size: 12px;
  font-style: normal;
  line-height: 1;
}

.group-tier-pill em {
  color: var(--primary);
  font-weight: 800;
}

/* Auth password visibility control */
.password-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  align-items: stretch;
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.password-field:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.password-field input {
  min-width: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.password-field input:focus {
  box-shadow: none;
}

.password-toggle {
  position: relative;
  width: 42px;
  min-width: 42px;
  height: auto;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--border);
  border-radius: 0;
  background: var(--surface-2);
  color: var(--text-mute);
}

.password-toggle:hover:not(:disabled) {
  background: var(--surface-hover);
  color: var(--text);
}

.password-toggle svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.password-toggle::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 2px;
  background: currentColor;
  transform: rotate(-38deg);
}

.password-toggle.is-visible::after {
  display: none;
}

@media (max-width: 820px) {
  .auth {
    min-height: 100dvh;
    padding: 12px;
    overflow-x: hidden;
  }

  .auth-wrap {
    grid-template-columns: 1fr !important;
    width: 100%;
    max-width: 520px;
    gap: 14px;
  }

  .auth-hero,
  .auth-box {
    width: 100%;
    min-width: 0;
  }

  .auth-box {
    padding: 18px;
  }

  .input-addon,
  .input-suffix,
  .password-field {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .input-addon > .addon-btn {
    min-width: 82px;
    padding-inline: 12px;
  }
}

@media (max-width: 560px) {
  .auth {
    padding: 8px;
  }

  .auth-wrap {
    max-width: 100%;
  }

  .auth-hero {
    padding: 14px !important;
  }

  .auth-service-board,
  .auth-quick-stats {
    display: none !important;
  }

  .auth-box {
    padding: 16px;
  }

  .auth-box .auth-head h2,
  .auth-hero h1 {
    font-size: 22px;
  }
}

.group-tier-pill.active {
  border-color: transparent;
  color: #fff;
  background: var(--primary);
}

.group-tier-pill.active em {
  color: #fff;
}

.gb-admin-workspace {
  display: grid;
  gap: 16px;
}

.gb-admin-hero {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1.25fr);
  gap: 18px;
  align-items: stretch;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.gb-admin-hero h2 {
  margin-top: 4px;
  font-size: 26px;
  letter-spacing: 0;
}

.gb-admin-hero p {
  margin: 6px 0 0;
  color: var(--text-dim);
}

.gb-admin-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.gb-admin-stats div {
  display: grid;
  align-content: center;
  gap: 6px;
  min-height: 82px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}

.gb-admin-stats span {
  color: var(--text-dim);
  font-size: 12px;
}

.gb-admin-stats strong {
  font-size: 22px;
  line-height: 1.1;
}

.gb-admin-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.72fr) minmax(0, 1.28fr);
  gap: 16px;
  align-items: start;
}

.gb-admin-create,
.gb-admin-card {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.gb-admin-create {
  position: sticky;
  top: 18px;
}

.gb-admin-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
  gap: 14px;
}

.gb-admin-card-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.gb-admin-card-head strong,
.gb-admin-card-head small {
  display: block;
}

.gb-admin-card-head strong {
  margin-top: 4px;
  font-size: 17px;
}

.gb-admin-card-head small {
  margin-top: 3px;
  color: var(--text-dim);
}

.gb-admin-card-badges,
.gb-admin-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.gb-admin-tier-preview {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}

.gb-admin-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.gb-admin-form .wide,
.gb-admin-create .wide {
  grid-column: 1 / -1;
}

.gb-admin-form textarea,
.gb-admin-create textarea {
  min-height: 88px;
  resize: vertical;
}

.gb-admin-enabled {
  align-self: end;
}

.gb-admin-actions {
  justify-content: flex-start;
}

.gbc-plan-picker {
  max-height: 220px;
  overflow: auto;
}

.gb-admin-card.is-removing {
  opacity: 0.5;
  transform: scale(0.99);
}

@media (max-width: 1120px) {
  .gb-admin-hero,
  .gb-admin-layout {
    grid-template-columns: 1fr;
  }

  .gb-admin-create {
    position: static;
  }
}

@media (max-width: 760px) {
  .gb-admin-hero,
  .gb-admin-create,
  .gb-admin-card,
  .group-buy-offers {
    padding: 14px;
  }

  .gb-admin-stats,
  .gb-admin-form,
  .group-pay-summary,
  .plan-pay-summary {
    grid-template-columns: 1fr;
  }

  .gb-admin-card-head,
  .group-buy-tier-board > div:first-child {
    align-items: flex-start;
    flex-direction: column;
  }

  .gb-admin-actions button,
  .gb-admin-create button[type="submit"] {
    width: 100%;
  }
}

/* ============================================================
   Style consolidation
   ============================================================ */

:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --surface-3: #e2e8f0;
  --surface-hover: #eef2f6;
  --border: #cbd5e1;
  --border-strong: #94a3b8;
  --ring: rgba(37, 99, 235, 0.18);

  --text: #0f172a;
  --text-mute: #475569;
  --text-dim: #64748b;
  --text-disabled: #94a3b8;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --primary-text: #ffffff;

  --accent: #4f46e5;
  --accent-soft: #e0e7ff;
  --amber: #d97706;
  --amber-soft: #fef3c7;
  --rose: #e11d48;
  --rose-soft: #ffe4e6;
  --violet: #7c3aed;
  --violet-soft: #ede9fe;

  --success: #16a34a;
  --success-soft: #dcfce7;
  --warn: #a7670f;
  --warn-soft: #fff1d8;
  --danger: #c93455;
  --danger-soft: #ffe5ec;
  --info: #4560d2;
  --info-soft: #e9edff;

  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 10px;
  --shadow-sm: 0 1px 2px rgba(31, 38, 51, 0.05);
  --shadow: 0 8px 22px rgba(31, 38, 51, 0.07);
  --shadow-md: 0 14px 34px rgba(31, 38, 51, 0.1);
}

html,
body {
  background: var(--bg);
}

body {
  color: var(--text);
  background: var(--bg);
}

button {
  min-height: 38px;
  border: 1px solid var(--primary);
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: var(--primary-text);
  box-shadow: none;
}

button:hover {
  border-color: var(--primary-hover);
  background: var(--primary-hover);
  box-shadow: none;
}

button.secondary,
button.ghost,
.logout-btn {
  border-color: var(--border-strong);
  background: var(--surface);
  color: var(--text);
  box-shadow: none;
}

button.secondary:hover,
button.ghost:hover,
.logout-btn:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-hover);
}

button.danger {
  border-color: rgba(201, 52, 85, 0.38);
  background: var(--danger-soft);
  color: var(--danger);
}

button.danger:hover {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}

input,
select,
textarea {
  border-color: var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--ring);
}

.layout {
  max-width: 1540px;
  background: transparent;
}

.sidebar {
  border-color: var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.sidebar .brand,
.sidebar-foot,
.topbar,
th,
td {
  border-color: var(--border);
}

.sidebar .nav button {
  min-height: 42px;
  border-color: transparent;
  background: transparent;
  color: var(--text-mute);
  box-shadow: none;
}

.sidebar .nav button:hover,
.sidebar .nav button.active,
.sidebar .nav button.active:hover {
  border-color: var(--border);
  background: var(--surface-2);
  color: var(--text);
  box-shadow: none;
}

.sidebar .nav button.active .nav-icon {
  background: var(--primary);
  color: #fff;
}

.topbar {
  border-bottom: 0;
  background: transparent;
  backdrop-filter: none;
}

.topbar-user {
  min-width: 0;
}

.panel,
.auth-box,
.auth-service-board,
.metric,
.plan,
.settings-grid,
.user-create-form,
#newPlanForm,
#newDcForm,
#changePasswordForm,
.subscription-command,
.aside-card,
.subscription-step,
.subscription-console,
.subscription-fact,
.tutorial-card,
.tutorial-resource-band,
.shadowrocket-card,
.group-buy-progress-card,
.group-buy-share,
.group-buy-guide,
.group-buy-offers,
.group-buy-campaign,
.group-buy-mini,
.gb-admin-hero,
.gb-admin-create,
.gb-admin-card,
.user-command-hero,
.user-command-grid .user-create-form,
.user-search-panel,
.user-card-grid > .user-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.panel {
  padding: 22px;
}

.panel-head,
.section-head {
  align-items: flex-start;
  gap: 12px;
}

.panel-head h2,
.panel-head strong,
.section-head h2 {
  letter-spacing: 0;
}

.table-wrap,
.panel .table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: none;
}

table {
  min-width: 760px;
  border-collapse: separate;
  border-spacing: 0;
}

th {
  background: var(--surface-2);
  color: var(--text-mute);
}

td {
  background: var(--surface);
  vertical-align: top;
}

tr:hover td {
  background: var(--surface-hover);
}

td .muted {
  margin-top: 3px;
  line-height: 1.35;
}

.badge {
  min-height: 24px;
  align-items: center;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-mute);
  font-weight: 800;
}

.badge.ok,
.sync-ok {
  color: var(--success);
  background: var(--success-soft);
}

.badge.warn {
  color: var(--warn);
  background: var(--warn-soft);
}

.badge.bad,
.sync-bad {
  color: var(--danger);
  background: var(--danger-soft);
}

.badge.info {
  color: var(--info);
  background: var(--info-soft);
}

.notice-toast,
.inline-toast {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.purchase-hero,
.account-hero,
.tutorial-hero,
.group-buy-hero,
.user-command-hero,
.gb-admin-hero,
.balance-hero {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.purchase-hero::after,
.account-hero::after,
.group-buy-hero::after {
  display: none;
}

.purchase-hero .eyebrow,
.purchase-hero p,
.account-hero .eyebrow,
.account-hero p,
.tutorial-hero .eyebrow,
.tutorial-hero p,
.group-buy-hero .eyebrow,
.group-buy-hero p {
  color: var(--text-mute);
}

.purchase-hero h2,
.account-hero h2,
.tutorial-hero h2,
.group-buy-hero h2 {
  color: var(--text);
  letter-spacing: 0;
}

.purchase-hero-orbit {
  display: none;
}

.group-buy-hero {
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 136px;
  padding: 24px;
}

.group-buy-hero h2 {
  font-size: clamp(24px, 3vw, 34px);
}

.group-buy-board {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  align-items: start;
}

.group-buy-steps span,
.group-tier-pill,
.group-buy-member,
.group-pay-summary span,
.plan-pay-summary span,
.group-buy-tier-board,
.group-buy-offer,
.gb-admin-stats div,
.user-card-details > div {
  border-color: var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.group-buy-steps span.active,
.group-tier-pill.active,
.subscription-step.is-done > span {
  background: var(--primary);
  color: #fff;
}

.group-buy-progress span,
.traffic-meter span,
.subscription-fact.is-active .fact-meter span,
.plan::before {
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

button.group-buy-member,
button.group-buy-qr,
.group-buy-invite-runway {
  border-color: var(--border);
  background: var(--surface-2);
  color: var(--text);
  box-shadow: none;
}

button.group-buy-member:hover,
button.group-buy-qr:hover,
.group-buy-invite-runway:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--text);
}

.group-buy-qr {
  min-height: 168px;
}

.group-buy-invite-runway {
  min-height: 62px;
  border-radius: var(--radius);
}

.group-buy-invite-runway i {
  background:
    linear-gradient(90deg, rgba(69, 96, 210, 0.26), rgba(15, 159, 143, 0.34));
}

.balance-display {
  border-color: var(--border);
  background: var(--surface);
}

.balance-display:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.plan,
.group-buy-offer,
.gb-admin-card,
.user-card-grid > .user-card {
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.plan:hover,
.group-buy-offer:hover,
.gb-admin-card:hover,
.user-card-grid > .user-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

@media (max-width: 1040px) {
  .group-buy-board,
  .gb-admin-layout,
  .user-command-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .layout {
    display: block;
    padding: 0;
  }

  .sidebar {
    position: relative;
    top: auto;
    width: auto;
    max-height: none;
    margin: 0;
    border-width: 0 0 1px;
    border-radius: 0;
    box-shadow: none;
  }

  .sidebar .brand {
    padding-bottom: 12px;
  }

  .sidebar .nav {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    overflow: visible;
  }

  .sidebar .nav button {
    min-height: 58px;
    padding: 8px;
    white-space: normal;
    text-align: center;
  }

  .main {
    padding: 20px 16px 42px;
  }

  .topbar,
  .topbar-user {
    align-items: flex-start;
  }

  .topbar-user {
    width: 100%;
  }

  .panel,
  .purchase-hero,
  .account-hero,
  .tutorial-hero,
  .group-buy-hero,
  .user-command-hero,
  .gb-admin-hero,
  .gb-admin-create,
  .gb-admin-card,
  .group-buy-progress-card,
  .group-buy-share,
  .group-buy-guide,
  .group-buy-offers {
    padding: 16px;
  }

  .purchase-hero,
  .group-buy-hero,
  .group-buy-invite,
  .group-buy-empty {
    grid-template-columns: 1fr;
  }

  .group-buy-hero button,
  .group-buy-invite button,
  .group-buy-empty button,
  .group-buy-actions button,
  .group-buy-share .row button {
    width: 100%;
  }

  .group-buy-steps {
    grid-template-columns: 1fr;
  }

  .group-buy-steps i {
    display: none;
  }
}

@media (max-width: 560px) {
  .sidebar .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar-user .user-card,
  .balance-display,
  .logout-btn {
    width: 100%;
  }

  .group-pay-summary,
  .plan-pay-summary,
  .gb-admin-stats,
  .user-command-stats,
  .user-card-details {
    grid-template-columns: 1fr;
  }
}

/* Group-buy workspace v2 */
.group-buy-workspace {
  display: grid;
  gap: 16px;
}

.group-buy-command {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.group-buy-command h2 {
  margin: 5px 0 6px;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.12;
}

.group-buy-command p {
  margin: 0;
  color: var(--text-mute);
}

.group-buy-dashboard {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}

.group-buy-main-card,
.group-buy-share-card {
  display: grid;
  gap: 16px;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.group-buy-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.95fr);
  gap: 16px;
  align-items: end;
}

.group-buy-summary h3 {
  margin: 5px 0 6px;
  font-size: clamp(22px, 2.4vw, 30px);
}

.group-buy-summary p {
  margin: 0;
  color: var(--text-mute);
}

.group-buy-stat-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.group-buy-stat-row span,
.group-buy-settlement,
.group-pay-box.is-muted {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.dc-edit-row td {
  padding: 12px 16px;
  background: var(--surface-2);
  border-top: none;
}

.dc-edit-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
}

.dc-edit-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--text-dim);
}

.dc-edit-form input {
  width: 140px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
}

.dc-edit-form .row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.group-buy-stat-row b,
.group-buy-stat-row em {
  display: block;
}

.group-buy-stat-row b {
  color: var(--text);
  font-size: 17px;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.group-buy-stat-row em {
  margin-top: 3px;
  color: var(--text-dim);
  font-size: 12px;
  font-style: normal;
}

.group-buy-progress-wrap {
  display: grid;
  gap: 8px;
}

.group-buy-progress-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-mute);
  font-size: 13px;
}

.group-tier-ladder {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 8px;
}

.group-tier-card {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.group-tier-card span,
.group-tier-card em {
  color: var(--text-dim);
  font-size: 12px;
  font-style: normal;
}

.group-tier-card strong {
  font-size: 20px;
}

.group-tier-card.is-current {
  border-color: rgba(69, 96, 210, 0.34);
  background: var(--primary-soft);
}

.group-tier-card.is-next {
  border-color: rgba(15, 159, 143, 0.32);
  background: var(--accent-soft);
}

.group-buy-member-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(138px, 1fr));
  gap: 10px;
}

.group-buy-bottom-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.86fr) minmax(320px, 1.14fr);
  gap: 12px;
  align-items: stretch;
}

.group-buy-settlement {
  display: grid;
  align-content: center;
  gap: 6px;
}

.group-buy-settlement span {
  color: var(--text-dim);
  font-size: 12px;
}

.group-buy-settlement p,
.group-pay-box.is-muted span {
  margin: 0;
  color: var(--text-mute);
  font-size: 13px;
}

.refund-chip {
  display: inline-flex;
  width: fit-content;
  margin-top: 4px;
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--success);
  background: var(--success-soft);
  font-size: 12px;
}

.group-buy-share-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.group-buy-share-head strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
}

.group-buy-share-card .group-buy-qr {
  min-height: 158px;
}

.group-buy-share-card {
  grid-template-columns: minmax(190px, 0.4fr) 172px minmax(0, 1fr);
  align-items: stretch;
}

.group-buy-share-card .group-buy-share-head {
  align-content: center;
}

.group-buy-share-card .group-buy-qr {
  grid-column: 2;
  grid-row: 1 / span 2;
  min-height: 172px;
}

.group-buy-share-flow {
  grid-column: 3;
  display: grid;
  gap: 10px;
  align-content: stretch;
}

.group-buy-copy-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
}

.group-buy-copy-row input {
  min-width: 0;
}

.group-buy-side-note {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.group-buy-side-note span {
  color: var(--text-dim);
  font-size: 12px;
}

.group-buy-side-note strong {
  font-size: 18px;
}

.group-buy-side-note p {
  margin: 0;
  color: var(--text-mute);
  font-size: 13px;
}

.group-cancel-btn {
  width: 100%;
}

.group-buy-local-action {
  margin: 0;
}

.group-buy-local-action .inline-toast,
.group-pay-box .inline-toast,
.group-buy-copy-row .inline-toast,
.group-buy-share-card .inline-toast,
.group-buy-member .inline-toast {
  justify-self: start;
  margin-top: 2px;
}

@media (max-width: 1180px) {
  .group-buy-dashboard {
    grid-template-columns: 1fr;
  }

  .group-buy-summary,
  .group-buy-bottom-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .group-buy-command {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .group-buy-command button,
  .group-buy-copy-row button {
    width: 100%;
  }

  .group-buy-stat-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .group-buy-stat-row,
  .group-tier-ladder,
  .group-buy-member-strip {
    grid-template-columns: 1fr;
  }
}

/* Final auth/mobile overrides */
.password-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  align-items: stretch;
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  overflow: hidden;
}

.password-field:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.password-field input {
  min-width: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.password-field input:focus {
  box-shadow: none;
}

.password-toggle {
  position: relative;
  width: 42px;
  min-width: 42px;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--border);
  border-radius: 0;
  background: var(--surface-2);
  color: var(--text-mute);
}

.password-toggle:hover:not(:disabled) {
  background: var(--surface-hover);
  color: var(--text);
}

.password-toggle svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.password-toggle::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 2px;
  background: currentColor;
  transform: rotate(-38deg);
}

.password-toggle.is-visible::after {
  display: none;
}

@media (max-width: 820px) {
  .auth {
    min-height: 100dvh;
    padding: 12px;
    overflow-x: hidden;
  }

  .auth-wrap {
    grid-template-columns: 1fr !important;
    width: 100%;
    max-width: 520px;
    gap: 14px;
  }

  .auth-hero,
  .auth-box {
    width: 100%;
    min-width: 0;
  }

  .auth-box {
    padding: 18px;
  }

  .input-addon,
  .input-suffix,
  .password-field {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .input-addon > .addon-btn {
    min-width: 82px;
    padding-inline: 12px;
  }
}

@media (max-width: 560px) {
  .auth {
    padding: 8px;
  }

  .auth-wrap {
    max-width: 100%;
  }

  .auth-hero {
    padding: 14px !important;
  }

  .auth-service-board,
  .auth-quick-stats {
    display: none !important;
  }

  .auth-box {
    padding: 16px;
  }

  .auth-box .auth-head h2,
  .auth-hero h1 {
    font-size: 22px;
  }
}

/* ============================================================
   Mobile usability polish: bottom module navigation + compact cards
   ============================================================ */
@media (max-width: 820px) {
  html,
  body,
  .app {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  input,
  select,
  textarea {
    font-size: 16px;
  }

  .layout {
    display: block !important;
    width: 100%;
    max-width: none;
    margin: 0;
  }

  .main {
    width: 100%;
    min-width: 0;
    padding: 14px 12px calc(92px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .sidebar {
    position: fixed !important;
    left: 0;
    right: 0;
    top: auto !important;
    bottom: 0;
    z-index: 1000 !important;
    width: 100%;
    height: auto !important;
    max-height: none !important;
    padding: 7px max(8px, env(safe-area-inset-left, 0px)) calc(7px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-right, 0px)) !important;
    border: 0 !important;
    border-top: 1px solid rgba(203, 213, 225, 0.9) !important;
    background: rgba(255, 255, 255, 0.94) !important;
    box-shadow: 0 -12px 34px rgba(15, 23, 42, 0.13) !important;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }

  .sidebar .brand,
  .sidebar-foot {
    display: none !important;
  }

  .sidebar .nav {
    display: flex !important;
    flex-direction: row !important;
    gap: 6px !important;
    margin: 0 !important;
    padding: 0 4px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }

  .sidebar .nav::-webkit-scrollbar {
    display: none;
  }

  .sidebar .nav button {
    flex: 0 0 72px !important;
    width: 72px !important;
    min-width: 72px !important;
    min-height: 56px !important;
    display: inline-flex !important;
    flex-direction: column !important;
    align-items: center;
    justify-content: center;
    gap: 4px !important;
    padding: 6px 4px !important;
    border: 1px solid transparent !important;
    border-radius: 16px !important;
    background: transparent !important;
    box-shadow: none !important;
    color: var(--text-dim) !important;
    font-size: 11px !important;
    font-weight: 800 !important;
    line-height: 1.1 !important;
    text-align: center !important;
    white-space: normal !important;
    scroll-snap-align: center;
  }

  .sidebar .nav button:hover,
  .sidebar .nav button.active:hover {
    transform: none !important;
    box-shadow: none !important;
  }

  .sidebar .nav button.active {
    border-color: rgba(37, 99, 235, 0.18) !important;
    background: var(--primary-soft) !important;
    color: var(--primary-hover) !important;
  }

  .nav-icon {
    width: 21px !important;
    height: 21px !important;
    flex: 0 0 21px !important;
  }

  .topbar {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 10px !important;
    margin: 0 0 14px !important;
    padding: 0 !important;
    background: transparent !important;
    border: 0 !important;
  }

  .topbar-title {
    min-width: 0;
  }

  .topbar h1 {
    font-size: 22px !important;
    line-height: 1.18;
    overflow-wrap: anywhere;
  }

  .topbar-user {
    width: 100%;
    min-width: 0;
    display: flex !important;
    align-items: center;
    justify-content: flex-start !important;
    gap: 8px !important;
    flex-wrap: wrap;
  }

  .topbar-user .balance-display,
  .topbar-user .user-card,
  .logout-btn {
    min-height: 40px;
  }

  .topbar-user .balance-display {
    flex: 1 1 132px;
    min-width: 0;
    justify-content: space-between;
  }

  .topbar-user .user-card {
    flex: 999 1 190px;
    min-width: 0;
    max-width: 100%;
  }

  .topbar-user .user-card .info {
    display: grid !important;
    min-width: 0;
  }

  .topbar-user .user-card .email {
    max-width: none;
  }

  .logout-btn {
    flex: 0 0 auto;
    padding-inline: 12px;
  }

  .panel,
  .subscription-command,
  .aside-card,
  .subscription-step,
  .account-hero,
  .purchase-hero,
  .tutorial-hero,
  .tutorial-card,
  .tutorial-resource-band,
  .shadowrocket-card,
  .group-buy-command,
  .group-buy-progress-card,
  .group-buy-share,
  .group-buy-guide,
  .group-buy-offers,
  .group-buy-campaign,
  .group-buy-mini,
  .gb-admin-hero,
  .gb-admin-create,
  .gb-admin-card,
  .user-command-hero,
  .user-search-panel {
    border-radius: 14px !important;
  }

  .panel,
  .subscription-command,
  .aside-card {
    padding: 16px !important;
  }

  .panel-head,
  .section-head,
  .toolbar,
  .settings-toolbar {
    display: grid !important;
    grid-template-columns: 1fr !important;
    align-items: start !important;
    gap: 10px !important;
  }

  .panel-head > *,
  .section-head > *,
  .toolbar > *,
  .settings-toolbar > * {
    min-width: 0;
    max-width: 100%;
  }

  .toolbar input,
  .toolbar select,
  .settings-toolbar input,
  .settings-toolbar select,
  .toolbar button,
  .settings-toolbar button {
    width: 100%;
    max-width: none !important;
  }

  .grid,
  .grid.two,
  .grid.three,
  .settings-grid,
  .purchase-grid,
  .provisioning-node-row,
  .provisioning-endpoint-body,
  .provisioning-endpoint-grid,
  .user-create-form,
  #newPlanForm,
  #newDcForm,
  #changePasswordForm,
  .group-buy-dashboard,
  .group-buy-summary,
  .group-buy-bottom-grid,
  .group-buy-share-card,
  .subscription-workbench,
  .subscription-aside,
  .command-layout {
    grid-template-columns: 1fr !important;
  }

  .command-layout {
    justify-items: stretch;
  }

  .status-dial {
    width: min(132px, 45vw) !important;
    justify-self: center;
  }

  .command-copy h2 {
    font-size: clamp(24px, 8vw, 32px) !important;
  }

  .command-metrics,
  .subscription-steps,
  .group-buy-stat-row,
  .account-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .linkbox,
  .subscription-linkbox,
  .group-buy-copy-row,
  .input-addon,
  .input-suffix {
    grid-template-columns: 1fr !important;
  }

  .subscription-actions,
  .command-actions,
  .user-actions,
  .user-state-actions,
  .provisioning-endpoint-actions,
  .group-buy-actions {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 8px !important;
  }

  .subscription-actions button,
  .command-actions button,
  .user-actions button,
  .user-state-actions button,
  .provisioning-endpoint-actions button,
  .group-buy-actions button,
  .linkbox button,
  .subscription-linkbox button,
  .group-buy-copy-row button,
  .input-addon > .addon-btn,
  .input-suffix > button {
    width: 100% !important;
  }

  .settings-tabs {
    display: flex !important;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .settings-tabs::-webkit-scrollbar {
    display: none;
  }

  .settings-tabs button {
    flex: 0 0 auto;
    min-height: 38px;
    white-space: nowrap;
  }

  .table-wrap,
  .panel .table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 720px;
  }

  .user-table {
    min-width: 980px;
  }

  .qr-frame,
  .subscription-qr-compact .qr-frame {
    max-width: min(220px, 72vw);
    margin-inline: auto;
  }
}

@media (max-width: 560px) {
  .main {
    padding-inline: 10px !important;
  }

  .topbar h1 {
    font-size: 20px !important;
  }

  .topbar-user .balance-display,
  .topbar-user .user-card,
  .logout-btn {
    flex-basis: 100%;
    width: 100%;
  }

  .logout-btn {
    justify-content: center;
  }

  .sidebar .nav button {
    flex-basis: 66px !important;
    width: 66px !important;
    min-width: 66px !important;
    font-size: 10.5px !important;
  }

  .panel,
  .subscription-command,
  .aside-card {
    padding: 14px !important;
  }

  .command-metrics,
  .subscription-steps,
  .group-buy-stat-row,
  .account-metrics {
    grid-template-columns: 1fr !important;
  }

  .command-topline,
  .aside-card-head,
  .group-buy-share-head {
    display: grid !important;
    grid-template-columns: 1fr !important;
    justify-items: start;
  }

  .notice-toast {
    left: 10px !important;
    right: 10px !important;
    bottom: calc(82px + env(safe-area-inset-bottom, 0px)) !important;
    width: auto !important;
  }
}

/* Accessibility and mobile-navigation hardening. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 820px) {
  .sidebar .nav {
    padding-bottom: 4px !important;
    scrollbar-width: thin;
    scrollbar-color: rgba(37, 99, 235, 0.45) transparent;
  }

  .sidebar .nav::-webkit-scrollbar {
    display: block;
    height: 3px;
  }

  .sidebar .nav::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.45);
  }
}

/* ============================================================
   ENTERPRISE THEME — deep blue + slate (authoritative layer).
   Appended last so it wins the cascade; re-skins the whole app
   without touching any markup / JS. Stage 1 of the UI rebuild.
   ============================================================ */

:root {
  --bg: #eef2f7;
  --bg-2: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #f1f5f9;
  --surface-hover: #f1f5f9;
  --border: #e5eaf1;
  --border-strong: #cbd5e1;
  --hair: #eef2f7;
  --ring: rgba(37, 99, 235, 0.18);

  --text: #0f172a;
  --text-mute: #475569;
  --text-dim: #64748b;
  --text-disabled: #94a3b8;

  --brand-950: #071834;
  --brand-900: #0b2149;
  --brand-800: #122d5e;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-active: #1e40af;
  --primary-soft: #eaf1fe;
  --primary-text: #ffffff;
  --accent: #3b82f6;
  --accent-soft: #e0e7ff;

  --success: #12915a; --success-soft: #dff5ea;
  --warn: #b45309;    --warn-soft: #fdf0dc;
  --danger: #dc2626;  --danger-soft: #fdeaea;
  --info: #0369a1;    --info-soft: #e5f0fb;

  --radius: 12px;
  --radius-sm: 9px;
  --radius-lg: 16px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 10px 24px -14px rgba(15, 23, 42, 0.22);
  --shadow-md: 0 2px 6px rgba(15, 23, 42, 0.06), 0 18px 40px -20px rgba(15, 23, 42, 0.28);
  --shadow-lg: 0 30px 70px -28px rgba(11, 33, 73, 0.42);
}

html, body { background: var(--bg); }
body {
  background:
    radial-gradient(1200px 520px at 84% -10%, rgba(37, 99, 235, 0.08), transparent 60%),
    linear-gradient(180deg, var(--bg-2), var(--bg) 460px) !important;
  background-attachment: fixed;
  color: var(--text);
}
::selection { background: rgba(37, 99, 235, 0.16); color: var(--text); }

/* ---- Buttons ---- */
button {
  min-height: 40px;
  border: 1px solid transparent !important;
  border-radius: var(--radius-sm) !important;
  padding: 9px 18px !important;
  background: linear-gradient(180deg, #2f6cf1, #2563eb) !important;
  color: #fff !important;
  font-weight: 600 !important;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.28), 0 10px 20px -12px rgba(37, 99, 235, 0.55) !important;
  transition: background .15s ease, box-shadow .15s ease, transform .05s ease, border-color .15s ease !important;
}
button:hover { background: linear-gradient(180deg, #2a63e6, #1d4ed8) !important; }
button:active { transform: translateY(1px); }
button:disabled { opacity: .55; box-shadow: none !important; cursor: not-allowed; }
button.secondary, .secondary {
  background: #fff !important;
  color: var(--text) !important;
  border: 1px solid var(--border-strong) !important;
  box-shadow: var(--shadow-sm) !important;
}
button.secondary:hover, .secondary:hover { background: var(--surface-3) !important; border-color: #b6c2d2 !important; }
button.small, .small { min-height: 32px; padding: 6px 12px !important; font-size: 13px !important; }
button.danger { background: linear-gradient(180deg, #ef4444, #dc2626) !important; box-shadow: 0 10px 20px -12px rgba(220, 38, 38, 0.55) !important; }
.password-toggle {
  background: transparent !important; color: var(--text-dim) !important;
  box-shadow: none !important; border: 0 !important; min-height: auto; padding: 0 8px !important;
}
.password-toggle:hover { color: var(--primary) !important; background: transparent !important; }

/* ---- App shell / sidebar ---- */
.app.layout { background: transparent; }
.app.layout .sidebar {
  background: linear-gradient(180deg, var(--brand-900) 0%, var(--brand-950) 100%) !important;
  border-right: 1px solid rgba(148, 163, 184, 0.14) !important;
  color: #c7d2e4 !important;
}
.app.layout .sidebar .brand-copy h1 { color: #fff !important; }
.app.layout .sidebar .brand-copy span { color: #8ea3c4 !important; }
.app.layout .sidebar .brand-mark {
  background: rgba(255, 255, 255, 0.08) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 12px;
}
.app.layout .sidebar .nav button {
  color: #b7c4dc !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 10px !important;
  box-shadow: none !important;
  font-weight: 500 !important;
  justify-content: flex-start;
  min-height: 42px;
}
.app.layout .sidebar .nav button:hover { background: rgba(148, 163, 184, 0.12) !important; color: #eaf1ff !important; }
.app.layout .sidebar .nav button.active {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.22), rgba(59, 130, 246, 0.08)) !important;
  color: #fff !important;
  box-shadow: inset 3px 0 0 var(--accent) !important;
}
.app.layout .sidebar .nav-icon svg { fill: currentColor; }
.app.layout .sidebar-foot a { color: #8ea3c4 !important; }

/* ---- Topbar ---- */
.app.layout .topbar {
  background: rgba(255, 255, 255, 0.72) !important;
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--border) !important;
}
.eyebrow { color: var(--text-dim) !important; font-weight: 600; text-transform: uppercase; font-size: 11px; }
.app.layout .avatar { background: linear-gradient(180deg, #2f6cf1, #1d4ed8) !important; color: #fff !important; border: 0 !important; }
.balance-display {
  background: var(--primary-soft) !important;
  border: 1px solid #cfe0fc !important;
  border-radius: var(--radius-pill) !important;
  color: var(--primary-active) !important;
}
.logout-btn { background: #fff !important; color: var(--text-mute) !important; border: 1px solid var(--border-strong) !important; box-shadow: var(--shadow-sm) !important; }
.logout-btn:hover { background: var(--danger-soft) !important; color: var(--danger) !important; border-color: #f3c6c6 !important; }

/* ---- Panels ---- */
.panel {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow) !important;
}
.panel-head .desc, .desc { color: var(--text-dim) !important; }

/* ---- Forms ---- */
input, select, textarea {
  background: #fff !important;
  border: 1px solid var(--border-strong) !important;
  border-radius: var(--radius-sm) !important;
  color: var(--text) !important;
}
input:focus, select:focus, textarea:focus {
  outline: none !important;
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px var(--ring) !important;
}

/* ---- Settings segmented tabs ---- */
.settings-tabs { background: var(--surface-3); border-radius: var(--radius-sm); }
.settings-tabs button { background: transparent !important; color: var(--text-mute) !important; box-shadow: none !important; border: 0 !important; border-radius: var(--radius-sm) !important; font-weight: 600 !important; }
.settings-tabs button.active { background: #fff !important; color: var(--primary-active) !important; box-shadow: var(--shadow-sm) !important; }

/* ---- Tables ---- */
table thead th {
  background: var(--surface-2) !important;
  color: var(--text-dim) !important;
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 700;
  border-bottom: 1px solid var(--border) !important;
}
table tbody td { border-bottom: 1px solid var(--hair) !important; }
table tbody tr:hover td { background: var(--surface-2) !important; }

/* ---- Badges ---- */
.badge { border-radius: var(--radius-pill) !important; font-weight: 600; border: 1px solid transparent; background: var(--surface-3); color: var(--text-mute); }
.badge.ok { background: var(--success-soft) !important; color: var(--success) !important; }
.badge.warn { background: var(--warn-soft) !important; color: var(--warn) !important; }
.badge.bad { background: var(--danger-soft) !important; color: var(--danger) !important; }
.badge.info { background: var(--info-soft) !important; color: var(--info) !important; }

/* ---- Plan / purchase cards ---- */
.plan {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow-sm) !important;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.plan:hover { border-color: #bcd0f7 !important; box-shadow: var(--shadow-md) !important; transform: translateY(-2px); }
.plan .price { color: var(--text) !important; font-weight: 800; }
.plan .price small { color: var(--text-dim) !important; font-weight: 500; }

/* ---- Hero bands ---- */
.purchase-hero, .tutorial-hero {
  background: linear-gradient(120deg, var(--brand-900), var(--brand-800)) !important;
  color: #fff !important;
  border: 0 !important;
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-md) !important;
}
.purchase-hero h2, .tutorial-hero h2, .purchase-hero .eyebrow, .tutorial-hero .eyebrow { color: #fff !important; }
.purchase-hero p, .tutorial-hero p { color: #c7d6f5 !important; }

/* ---- Auth screen ---- */
.auth {
  min-height: 100vh;
  background:
    radial-gradient(900px 520px at 12% 0%, rgba(59, 130, 246, 0.22), transparent 55%),
    linear-gradient(160deg, var(--brand-950), var(--brand-800)) !important;
}
.auth-hero-copy h2 { color: #fff !important; }
.auth-kicker { color: #9fb4dc !important; }
.auth-box { background: #fff !important; border: 1px solid var(--border) !important; border-radius: var(--radius-lg) !important; box-shadow: var(--shadow-lg) !important; }
.auth .tabs { background: var(--surface-3); border-radius: var(--radius-pill); }
.auth .tab { background: transparent !important; color: var(--text-mute) !important; box-shadow: none !important; border: 0 !important; border-radius: var(--radius-pill) !important; }
.auth .tab.active { background: #fff !important; color: var(--primary-active) !important; box-shadow: var(--shadow-sm) !important; }
.auth-service-board { background: rgba(255, 255, 255, 0.06) !important; border: 1px solid rgba(255, 255, 255, 0.10) !important; border-radius: var(--radius) !important; }

/* Single centered column: brand lockup on top, login/register card below. */
.auth .auth-wrap {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 24px !important;
  width: 100%;
  max-width: 440px !important;
  min-height: 100vh;
  margin: 0 auto !important;
  padding: 40px 20px !important;
  grid-template-columns: none !important;
}
.auth .auth-hero-copy {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 !important;
  background: none !important;
  border: 0 !important;
  box-shadow: none !important;
}
.auth .auth-hero-copy .logo-mark {
  flex: none; width: 46px; height: 46px; border-radius: 13px;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.16);
}
.auth .auth-hero-copy .logo-mark img { width: 26px; height: 26px; }
.auth .auth-hero-copy h1 { color: #fff !important; font-size: 22px; }
.auth .auth-hero-copy .auth-kicker { color: #9fb4dc !important; font-size: 12px; text-transform: uppercase; }
.auth .auth-box { width: 100% !important; margin: 0 !important; }

/* ---- Account dashboard: declutter the subscription card ---- */
.subscription-command {
  min-height: 0 !important;
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow) !important;
  display: flex !important;
  flex-direction: column;
  gap: 18px;
}
.subscription-command::after { display: none !important; }
.command-copy h2 { color: var(--text) !important; margin: 0; }
.command-copy p { color: var(--text-dim) !important; margin: 6px 0 0; }
.traffic-block-top { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.traffic-block-top > span { color: var(--text-dim); font-size: 13px; }
.traffic-block-top b { color: var(--text); font-weight: 700; }
.traffic-block-top em { margin-left: auto; font-style: normal; color: var(--primary); font-weight: 700; }
.command-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 2px; }
.aside-card { background: var(--surface) !important; border: 1px solid var(--border) !important; box-shadow: var(--shadow) !important; }

/* ---- Admin: solid stat cards (no marketing hero) ---- */
.user-command-stats div { background: var(--surface) !important; box-shadow: var(--shadow-sm); }
.gb-admin-stats div { background: var(--surface) !important; box-shadow: var(--shadow-sm); }

/* ======================================================================
   Users page — redesigned card system
   ====================================================================== */
.users-page { display: grid; gap: 16px; }

.users-toolbar {
  display: flex; flex-wrap: wrap; gap: 12px;
  align-items: center; justify-content: space-between;
}
.users-search { display: flex; gap: 8px; flex: 1 1 320px; min-width: 240px; }
.users-search input { flex: 1; min-width: 0; }

.users-create { position: relative; flex: none; }
.users-create > summary {
  list-style: none; cursor: pointer; user-select: none;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: 8px;
  background: var(--primary); color: #fff; font-weight: 600; font-size: 14px;
  border: 1px solid var(--primary); transition: background .15s;
}
.users-create > summary::-webkit-details-marker { display: none; }
.users-create[open] > summary { background: var(--primary-hover); }
.users-create[open] > .user-create-form {
  position: absolute; z-index: 30; right: 0; top: calc(100% + 8px);
  width: min(400px, 92vw);
  padding: 16px; display: grid; gap: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow-lg);
}
.users-create .user-create-switches { display: flex; gap: 16px; }
.users-create .user-create-actions button { width: 100%; }

.users-list-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 2px 2px 0;
}
.users-list-head strong { font-size: 15px; }
.users-list-head .desc { color: var(--text-dim); font-size: 13px; margin-left: 8px; }

.ucard-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
}

.ucard {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-sm);
  transition: box-shadow .15s, border-color .15s, opacity .3s, transform .3s;
}
.ucard:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.ucard.is-disabled { opacity: .7; }
.ucard.is-removing { opacity: 0; transform: scale(.97); }

.ucard-top { display: flex; align-items: center; gap: 12px; padding: 16px 16px 13px; }
.ucard-avatar {
  flex: none; width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 17px;
  background: linear-gradient(135deg, var(--primary), #4338ca);
}
.ucard-headtext { min-width: 0; flex: 1; }
.ucard-email {
  font-weight: 650; font-size: 15px; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ucard-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.ucard-days {
  flex: none; font-size: 12px; font-weight: 650;
  padding: 5px 11px; border-radius: 999px; white-space: nowrap;
}
.ucard-days-ok { background: var(--success-soft); color: var(--success); }
.ucard-days-warn { background: var(--warn-soft); color: var(--warn); }
.ucard-days-bad { background: var(--danger-soft); color: var(--danger); }
.ucard-days-muted { background: var(--surface-hover); color: var(--text-dim); }

.ucard-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
  background: var(--border);
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.ucard-stats > div { background: var(--surface); padding: 11px 14px; display: grid; gap: 3px; align-content: center; min-width: 0; }
.ucard-stats span { font-size: 11px; color: var(--text-dim); }
.ucard-stats strong { font-size: 14px; color: var(--text); font-weight: 650; }
.ucard-uuid { grid-column: 1 / -1; }
.ucard-uuid code { font-size: 12px; color: var(--text-mute); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ucard-manage > summary {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; font-size: 13px; font-weight: 600; color: var(--primary);
}
.ucard-manage > summary::-webkit-details-marker { display: none; }
.ucard-manage > summary svg { width: 16px; height: 16px; fill: currentColor; transition: transform .15s; }
.ucard-manage[open] > summary { border-bottom: 1px solid var(--border); }
.ucard-manage[open] > summary svg { transform: rotate(180deg); }
.ucard-manage-body { padding: 14px 16px 16px; display: grid; gap: 10px; background: var(--surface-2); }
.ucard-edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ucard-edit-grid label { display: grid; gap: 4px; font-size: 12px; color: var(--text-dim); }
.ucard-edit-grid input, .ucard-edit-grid select { width: 100%; }
.ucard-op { display: flex; gap: 8px; align-items: center; }
.ucard-op input { flex: 1; min-width: 0; }
.ucard-op button { flex: none; }
.ucard-manage-body .user-state-actions { display: flex; gap: 8px; }

/* =======================================================================
   PREMIUM REDESIGN LAYER — final visual language (deep-navy shell +
   refined token system). Appended last so it wins the cascade app-wide.
   ======================================================================= */
:root {
  --bg: #e9edf6;
  --surface: #ffffff;
  --surface-2: #f6f8fc;
  --surface-3: #eef2f9;
  --surface-hover: #eef2f9;
  --border: #e5e8f1;
  --border-strong: #d3d9e6;
  --ring: rgba(58, 91, 217, 0.30);

  --text: #111a2c;
  --text-mute: #47536b;
  --text-dim: #78859f;
  --text-disabled: #a3adc2;

  --primary: #3a5bd9;
  --primary-hover: #2c48bd;
  --primary-soft: #ecefff;
  --primary-text: #ffffff;
  --accent: #6d5efc;
  --violet: #6d5efc;

  --success: #12894a; --success-soft: #e2f6ea;
  --warn: #b95c12; --warn-soft: #fbeddc;
  --danger: #d32f3f; --danger-soft: #fdeaec;
  --info: #1668cc; --info-soft: #e6f1fe;

  --radius-sm: 9px;
  --radius: 13px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(17, 26, 44, 0.05), 0 1px 3px rgba(17, 26, 44, 0.04);
  --shadow: 0 2px 6px rgba(17, 26, 44, 0.05), 0 10px 24px rgba(17, 26, 44, 0.07);
  --shadow-md: 0 10px 30px rgba(17, 26, 44, 0.11);
  --shadow-lg: 0 24px 60px rgba(17, 26, 44, 0.18);
}

body {
  background:
    radial-gradient(900px 500px at 100% -8%, #dfe7fb 0%, transparent 55%),
    radial-gradient(700px 500px at -10% 110%, #e7e2fb 0%, transparent 50%),
    var(--bg) !important;
  background-attachment: fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ---- App shell: deep-navy sidebar ---- */
.layout { grid-template-columns: 258px minmax(0, 1fr) !important; }
.sidebar {
  background: linear-gradient(185deg, #16203a 0%, #0f1728 100%) !important;
  border-right: 0 !important;
  box-shadow: 8px 0 40px rgba(9, 14, 26, 0.28) !important;
  padding: 20px 14px !important;
}
.sidebar .brand { border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important; padding: 6px 8px 18px !important; }
.sidebar .brand h1 { color: #fff !important; }
.brand-copy span { color: #93a1c4 !important; }
.brand-mark, .brand-home { background: rgba(255, 255, 255, 0.07) !important; box-shadow: none !important; }
.sidebar .nav { gap: 3px !important; margin-top: 8px; }
.sidebar .nav button {
  color: #a9b4d2 !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 11px !important;
  padding: 10px 12px !important;
  font-weight: 550 !important;
  transition: background .15s, color .15s;
}
.sidebar .nav button svg { fill: currentColor; opacity: .85; }
.sidebar .nav button:hover { background: rgba(255, 255, 255, 0.07) !important; color: #fff !important; }
.sidebar .nav button.active, .sidebar .nav button.active:hover {
  background: linear-gradient(135deg, var(--primary), var(--accent)) !important;
  color: #fff !important;
  box-shadow: 0 10px 22px rgba(58, 91, 217, 0.40) !important;
}
.sidebar .nav button.active svg { opacity: 1; }
.sidebar-foot { border-top: 1px solid rgba(255, 255, 255, 0.08) !important; }
.sidebar-foot a { color: #93a1c4 !important; }

/* ---- Topbar ---- */
.topbar {
  background: rgba(255, 255, 255, 0.72) !important;
  backdrop-filter: saturate(170%) blur(12px);
  -webkit-backdrop-filter: saturate(170%) blur(12px);
  border-bottom: 1px solid var(--border) !important;
}
.topbar-title .eyebrow, .eyebrow { color: var(--primary) !important; letter-spacing: .14em; font-weight: 700; }
.topbar-title h1, .topbar h1 { color: var(--text) !important; letter-spacing: -.01em; }
.user-card { background: var(--surface) !important; border: 1px solid var(--border) !important; border-radius: 999px !important; box-shadow: var(--shadow-sm); }
.avatar, .user-avatar { background: linear-gradient(135deg, var(--primary), var(--accent)) !important; color: #fff !important; }
.balance-display { background: var(--primary-soft) !important; border: 1px solid #dbe1ff !important; border-radius: 12px !important; }
.balance-amount { color: var(--primary) !important; }

/* ---- Cards / panels / metrics ---- */
.panel { border-radius: var(--radius-lg) !important; border: 1px solid var(--border) !important; box-shadow: var(--shadow-sm) !important; }
.panel:hover { box-shadow: var(--shadow) !important; }
.metric { border-radius: var(--radius) !important; border: 1px solid var(--border) !important; box-shadow: var(--shadow-sm) !important; background: var(--surface) !important; }
.metric .value { color: var(--text) !important; font-weight: 700; }
.metric .label { color: var(--text-dim) !important; }

/* ---- Inputs ---- */
input, select, textarea { border-radius: 10px !important; }
input:focus, select:focus, textarea:focus { box-shadow: 0 0 0 4px var(--ring) !important; border-color: var(--primary) !important; }

/* ---- Badges ---- */
.badge { border-radius: 999px !important; font-weight: 600; padding: 3px 10px; }

/* ---- Tables ---- */
.table-wrap { border-radius: var(--radius) !important; border: 1px solid var(--border); overflow: hidden; }
table thead th { background: var(--surface-2) !important; color: var(--text-mute) !important; font-weight: 600; letter-spacing: .02em; }
table tbody tr:hover td { background: var(--surface-2) !important; }
table td, table th { border-color: var(--border) !important; }

/* ======================================================================
   Users page — data table + right-side edit drawer
   ====================================================================== */
.users-page { display: grid; gap: 16px; }
.utable-toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.utable-search { display: flex; gap: 8px; flex: 1 1 320px; min-width: 240px; }
.utable-search input { flex: 1; min-width: 0; }
#openCreateUser { flex: none; }

.utable-panel { padding: 6px !important; }
.utable-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 12px 10px; }
.utable-head strong { font-size: 15px; }
.utable-head .desc { color: var(--text-dim); font-size: 13px; margin-left: 8px; }
.utable-panel .table-wrap { border: 0 !important; border-radius: 0 !important; overflow-x: auto; }

.utable { width: 100%; border-collapse: collapse; }
.utable thead th { text-align: left; font-size: 12px; padding: 10px 14px; white-space: nowrap; }
.utable tbody td { padding: 11px 14px; border-top: 1px solid var(--border); vertical-align: middle; font-size: 13px; }
.utable tbody tr:first-child td { border-top: 0; }
.utr { transition: background .12s; }
.utr:hover td { background: var(--surface-2) !important; }
.utr.is-open td { background: var(--primary-soft) !important; }
.utd-user { display: flex; align-items: center; gap: 11px; }
.utd-avatar { flex: none; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 14px; background: linear-gradient(135deg, var(--primary), var(--accent)); }
.utd-idtext { display: grid; min-width: 0; gap: 1px; }
.utd-email { font-weight: 600; color: var(--text); }
.utd-uuid { font-size: 11px; color: var(--text-dim); max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.utd-badges { display: inline-flex; flex-wrap: wrap; gap: 5px; }
.utd-days { display: inline-block; font-size: 12px; font-weight: 650; padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.utd-days-ok { background: var(--success-soft); color: var(--success); }
.utd-days-warn { background: var(--warn-soft); color: var(--warn); }
.utd-days-bad { background: var(--danger-soft); color: var(--danger); }
.utd-days-muted { background: var(--surface-hover); color: var(--text-dim); }
.utd-num { font-variant-numeric: tabular-nums; color: var(--text-mute); white-space: nowrap; }
.utd-op { text-align: right; }
.utd-op-h { width: 76px; }
.utable-empty { text-align: center; padding: 30px 14px !important; }

/* ---- Right-side drawer ---- */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.42); z-index: 60; animation: dw-fade .18s ease; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: min(452px, 94vw);
  background: var(--surface); z-index: 61;
  box-shadow: -26px 0 64px rgba(15, 23, 42, 0.24);
  display: flex; flex-direction: column;
  animation: dw-slide .24s cubic-bezier(.22, .61, .36, 1);
}
@keyframes dw-slide { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes dw-fade { from { opacity: 0; } to { opacity: 1; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.drawer-idhead { display: flex; align-items: center; gap: 12px; min-width: 0; }
.drawer-avatar { flex: none; width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; color: #fff; font-weight: 700; background: linear-gradient(135deg, var(--primary), var(--accent)); }
.drawer-idtext { min-width: 0; }
.drawer-title { font-weight: 650; font-size: 15px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-sub { font-size: 12px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-close { flex: none; width: 34px; height: 34px; border-radius: 9px; background: var(--surface-2) !important; border: 1px solid var(--border) !important; color: var(--text-mute) !important; cursor: pointer; box-shadow: none !important; display: grid; place-items: center; }
.drawer-close:hover { background: var(--surface-hover) !important; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px 28px; display: grid; gap: 14px; align-content: start; }
.drawer-badges { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.drawer-stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.drawer-stat-grid > div { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; display: grid; gap: 3px; }
.drawer-stat-grid span { font-size: 11px; color: var(--text-dim); }
.drawer-stat-grid strong { font-size: 13px; color: var(--text); }
.drawer-section { border: 1px solid var(--border); border-radius: 12px; padding: 14px; display: grid; gap: 10px; background: var(--surface); }
.drawer-section-title { font-size: 11px; font-weight: 700; color: var(--text-dim); letter-spacing: .06em; text-transform: uppercase; }
.drawer-section > label, .drawer-form > label { display: grid; gap: 5px; font-size: 12px; color: var(--text-mute); }
.drawer-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.drawer-row input { flex: 1; min-width: 130px; }
.drawer-row button { flex: none; }
.drawer-toggles { display: flex; gap: 8px; }
.drawer-switches { display: flex; gap: 18px; }
.drawer-danger { margin-top: 2px; padding-top: 14px; border-top: 1px dashed var(--border); }
.drawer-form { display: grid; gap: 12px; }
button.block, .block { width: 100%; }


/* ======================================================================
   Topbar — authoritative redesign (last wins)
   ====================================================================== */
.main > .topbar.topbar {
  position: sticky; top: 12px; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: 64px; min-height: 64px; padding: 0 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
}
.topbar.topbar .topbar-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar.topbar .topbar-title h1 { font-size: 19px; font-weight: 650; color: var(--text); margin: 0; letter-spacing: -0.01em; }
.topbar.topbar .topbar-user { display: flex; align-items: center; gap: 10px; }

.topbar.topbar .balance-display {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px; border-radius: 10px; cursor: pointer;
  background: var(--primary-soft); color: var(--primary); border: 1px solid transparent;
}
.topbar.topbar .balance-display:hover { background: color-mix(in srgb, var(--primary-soft), var(--primary) 12%); }
.topbar.topbar .balance-display .balance-label { font-size: 12px; opacity: 0.85; }
.topbar.topbar .balance-display .balance-amount { font-weight: 700; }

.topbar.topbar .user-card {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 5px 13px 5px 5px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border); box-shadow: none;
}
.topbar.topbar .user-card .avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 13px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
}
.topbar.topbar .user-card .info { display: grid; gap: 1px; min-width: 0; }
.topbar.topbar .user-card .info .email { font-size: 13px; font-weight: 600; color: var(--text); max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar.topbar .user-card .info .role { font-size: 11px; color: var(--text-dim); }

.topbar.topbar .logout-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 10px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-mute);
  font-size: 13px; font-weight: 500; box-shadow: none;
}
.topbar.topbar .logout-btn:hover { background: var(--danger-soft); border-color: var(--danger-soft); color: var(--danger); }
.topbar.topbar .logout-btn svg { width: 16px; height: 16px; fill: currentColor; }

.utable-lead { flex: 1; min-width: 0; font-size: 13px; }

.utd-sub { font-size: 11px; color: var(--text-dim); margin-top: 1px; }
.drawer-form label.check, .drawer-section label.check { display: flex; align-items: center; gap: 8px; }
