/* WHJX Hub — Design tokens
   Style anchor: refined Element-Plus-style admin (iot.gxlong.com DNA)
   Palette: page mist / ink navy / brand blue #0F73E6 / dark sidebar
*/
:root {
  --primary: #0f73e6;
  --primary-hover: #3d8fef;
  --primary-active: #0c5fbe;
  --primary-soft: #e8f2ff;
  --primary-soft-2: #d6e9ff;
  --page: #f3f6fa;
  --panel: #ffffff;
  --ink: #1b2430;
  --text: #4b5568;
  --muted: #8a94a6;
  --border: #e5ebf3;
  --border-strong: #d5dde8;
  --sidebar: #0b1524;
  --sidebar-2: #121e32;
  --sidebar-text: #9aa7bd;
  --sidebar-active: #ffffff;
  --success: #18a058;
  --success-soft: #e6f7ee;
  --warning: #e6a23c;
  --warning-soft: #fdf3e0;
  --danger: #e5484d;
  --danger-soft: #fdebec;
  --info: #6b7a90;
  --info-soft: #eef2f7;
  --shadow-1: 0 1px 2px rgba(16, 32, 56, 0.04);
  --shadow-2: 0 8px 24px rgba(16, 32, 56, 0.06);
  --shadow-3: 0 16px 40px rgba(16, 32, 56, 0.1);
  --radius: 10px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --sidebar-w: 240px;
  --topbar-h: 56px;
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI",
    system-ui, -apple-system, sans-serif;
  --mono: "SF Mono", "Cascadia Code", Consolas, "Microsoft YaHei", monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 0.28s;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: var(--font);
  font-size: 14px;
  color: var(--ink);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

a {
  color: var(--primary);
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

/* ---------- Views ---------- */
.view {
  display: none;
  min-height: 100%;
}

.view.active {
  display: block;
}

#view-login.active {
  display: grid;
  grid-template-columns: minmax(320px, 1.05fr) minmax(360px, 0.95fr);
  min-height: 100vh;
}

#view-app.active {
  display: flex;
  min-height: 100vh;
}

/* ---------- Login ---------- */
.login-brand {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(1200px 600px at 10% 20%, rgba(15, 115, 230, 0.35), transparent 55%),
    radial-gradient(900px 500px at 80% 80%, rgba(34, 211, 238, 0.18), transparent 50%),
    linear-gradient(155deg, #0b1524 0%, #0f2744 48%, #0c3a6b 100%);
  color: #eef5ff;
  padding: 48px 52px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.login-brand::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: radial-gradient(ellipse at 30% 40%, #000 20%, transparent 75%);
  pointer-events: none;
}

.login-brand::after {
  content: "";
  position: absolute;
  width: 420px;
  height: 420px;
  right: -80px;
  bottom: -100px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(15, 115, 230, 0.45), transparent 65%);
  filter: blur(10px);
  pointer-events: none;
}

.brand-top,
.brand-mid,
.brand-foot {
  position: relative;
  z-index: 1;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(145deg, #3d9bff, #0f73e6 55%, #0847a8);
  display: grid;
  place-items: center;
  box-shadow: 0 8px 20px rgba(15, 115, 230, 0.35);
  font-weight: 700;
  letter-spacing: 0.02em;
  font-size: 13px;
  color: #fff;
}

.brand-name {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.brand-domain {
  margin-top: 2px;
  font-size: 12px;
  color: rgba(238, 245, 255, 0.55);
  font-family: var(--mono);
}

.brand-mid h1 {
  margin: 0 0 14px;
  font-size: clamp(28px, 3.2vw, 40px);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0.01em;
}

.brand-mid p {
  margin: 0;
  max-width: 28em;
  color: rgba(238, 245, 255, 0.72);
  line-height: 1.7;
  font-size: 14px;
}

.brand-modules {
  margin-top: 28px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  max-width: 420px;
}

.brand-chip {
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(8px);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 12px;
  color: rgba(238, 245, 255, 0.88);
  text-align: center;
}

.brand-foot {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 12px;
  color: rgba(238, 245, 255, 0.45);
}

.brand-net {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.brand-net circle {
  fill: rgba(255, 255, 255, 0.55);
}

.brand-net line {
  stroke: rgba(255, 255, 255, 0.18);
  stroke-width: 1;
}

.login-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 32px;
  background:
    radial-gradient(700px 400px at 100% 0%, rgba(15, 115, 230, 0.08), transparent 50%),
    var(--page);
}

.login-card {
  width: min(400px, 100%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-2);
  padding: 36px 32px 28px;
  animation: rise-in 0.55s var(--ease) both;
}

.login-card h2 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 600;
}

.login-sub {
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 13px;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  margin-bottom: 7px;
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
}

.field-wrap {
  position: relative;
}

.field-wrap svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.field-wrap input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0 40px 0 38px;
  background: #fff;
  outline: none;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.field-wrap input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.field-wrap .toggle-pw {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border-radius: 6px;
  color: var(--muted);
  display: grid;
  place-items: center;
}

.field-wrap .toggle-pw:hover {
  color: var(--primary);
  background: var(--primary-soft);
}

.login-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 4px 0 20px;
  font-size: 13px;
  color: var(--muted);
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.checkbox input {
  accent-color: var(--primary);
  width: 14px;
  height: 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--radius-xs);
  font-weight: 500;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease),
    border-color var(--dur) var(--ease), transform 0.15s var(--ease),
    box-shadow var(--dur) var(--ease);
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.btn-primary {
  width: 100%;
  height: 42px;
  background: var(--primary);
  color: #fff;
  box-shadow: 0 6px 16px rgba(15, 115, 230, 0.28);
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-primary:disabled {
  background: #9dbcec;
  box-shadow: none;
  cursor: not-allowed;
}

.btn-ghost {
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--text);
}

.btn-ghost:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.btn-soft {
  background: var(--primary-soft);
  color: var(--primary);
}

.btn-soft:hover {
  background: var(--primary-soft-2);
}

.btn-danger-soft {
  background: var(--danger-soft);
  color: var(--danger);
}

.login-hint {
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--info-soft);
  color: var(--text);
  font-size: 12px;
  line-height: 1.6;
}

.login-hint code {
  font-family: var(--mono);
  background: rgba(255, 255, 255, 0.75);
  padding: 1px 6px;
  border-radius: 4px;
}

.login-error {
  display: none;
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: var(--radius-xs);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
}

.login-error.show {
  display: block;
  animation: shake 0.35s var(--ease);
}

/* ---------- App shell ---------- */
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--sidebar) 0%, var(--sidebar-2) 100%);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 20;
  transition: width var(--dur) var(--ease);
}

.sidebar.collapsed {
  width: 72px;
}

.side-brand {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.side-brand .brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  font-size: 11px;
  flex-shrink: 0;
}

.side-brand-text {
  min-width: 0;
}

.side-brand-text strong {
  display: block;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.side-brand-text span {
  font-size: 11px;
  color: rgba(154, 167, 189, 0.75);
  font-family: var(--mono);
  white-space: nowrap;
}

.sidebar.collapsed .side-brand-text {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

.side-nav {
  flex: 1;
  overflow: auto;
  padding: 14px 10px 18px;
}

.side-nav::-webkit-scrollbar {
  width: 4px;
}

.side-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
}

.nav-group {
  margin-bottom: 10px;
}

.nav-group-title {
  padding: 10px 10px 6px;
  font-size: 11px;
  letter-spacing: 0.08em;
  color: rgba(154, 167, 189, 0.55);
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar.collapsed .nav-group-title {
  opacity: 0;
  height: 0;
  padding: 0;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 12px;
  border-radius: var(--radius-xs);
  color: var(--sidebar-text);
  position: relative;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
  margin-bottom: 2px;
  text-align: left;
}

.nav-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.85;
}

.nav-item span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar.collapsed .nav-item span {
  opacity: 0;
  width: 0;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #d7e1ef;
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(15, 115, 230, 0.28), rgba(15, 115, 230, 0.08));
  color: var(--sidebar-active);
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--primary);
  box-shadow: 0 0 12px rgba(15, 115, 230, 0.8);
}

.nav-badge {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(229, 72, 77, 0.2);
  color: #ff8b8f;
  font-size: 11px;
  display: grid;
  place-items: center;
}

.sidebar.collapsed .nav-badge {
  display: none;
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-h);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 15;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-xs);
  display: grid;
  place-items: center;
  color: var(--text);
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}

.icon-btn:hover {
  background: var(--primary-soft);
  color: var(--primary);
}

.crumb {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  min-width: 0;
}

.crumb strong {
  color: var(--ink);
  font-weight: 600;
}

.crumb .sep {
  opacity: 0.5;
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  width: min(240px, 28vw);
  padding: 0 12px;
  border-radius: 999px;
  background: var(--page);
  border: 1px solid transparent;
  color: var(--muted);
}

.search-box:focus-within {
  border-color: var(--primary);
  background: #fff;
}

.search-box input {
  border: none;
  outline: none;
  background: transparent;
  width: 100%;
  font-size: 13px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 8px 0 6px;
  border-radius: 999px;
  transition: background var(--dur) var(--ease);
}

.user-chip:hover {
  background: var(--primary-soft);
}

.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(145deg, #4ea1ff, #0f73e6);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
}

.user-meta {
  text-align: left;
  line-height: 1.15;
}

.user-meta strong {
  display: block;
  font-size: 12px;
  font-weight: 600;
}

.user-meta span {
  font-size: 11px;
  color: var(--muted);
}

.content {
  flex: 1;
  padding: 20px 22px 32px;
  overflow: auto;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  animation: fade-up 0.4s var(--ease) both;
}

.page-head h2 {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 650;
}

.page-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.page-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---------- Cards / stats ---------- */
.grid {
  display: grid;
  gap: 14px;
}

.grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
  padding: 16px 18px;
  animation: fade-up 0.45s var(--ease) both;
}

.card-hover {
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
    border-color var(--dur) var(--ease);
}

.card-hover:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
  border-color: var(--border-strong);
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 112px;
}

.stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-label {
  color: var(--muted);
  font-size: 13px;
}

.stat-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary);
}

.stat-icon.success {
  background: var(--success-soft);
  color: var(--success);
}

.stat-icon.warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.stat-icon.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.stat-value {
  font-size: 28px;
  font-weight: 650;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.stat-foot {
  font-size: 12px;
  color: var(--muted);
}

.stat-foot .up {
  color: var(--success);
}

.stat-foot .down {
  color: var(--danger);
}

/* stagger delays */
.d1 { animation-delay: 0.04s; }
.d2 { animation-delay: 0.08s; }
.d3 { animation-delay: 0.12s; }
.d4 { animation-delay: 0.16s; }
.d5 { animation-delay: 0.2s; }
.d6 { animation-delay: 0.24s; }
.d7 { animation-delay: 0.28s; }
.d8 { animation-delay: 0.32s; }

.module-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 132px;
  cursor: pointer;
}

.module-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.module-card h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.module-card p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.module-kpi {
  margin-top: auto;
  display: flex;
  gap: 14px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}

.module-kpi div {
  min-width: 0;
}

.module-kpi strong {
  display: block;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.module-kpi span {
  font-size: 11px;
  color: var(--muted);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  white-space: nowrap;
}

.pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.pill.ok {
  background: var(--success-soft);
  color: var(--success);
}

.pill.warn {
  background: var(--warning-soft);
  color: var(--warning);
}

.pill.bad {
  background: var(--danger-soft);
  color: var(--danger);
}

.pill.info {
  background: var(--info-soft);
  color: var(--info);
}

.pill.blue {
  background: var(--primary-soft);
  color: var(--primary);
}

/* ---------- Table ---------- */
.table-card {
  padding: 0;
  overflow: hidden;
}

.table-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.table-toolbar .spacer {
  flex: 1;
}

.filter-input,
.filter-select {
  height: 34px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  background: #fff;
  padding: 0 10px;
  outline: none;
  min-width: 140px;
}

.filter-input:focus,
.filter-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.table-wrap {
  overflow: auto;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

table.data th,
table.data td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  white-space: nowrap;
}

table.data th {
  background: #fafbfd;
  color: var(--muted);
  font-weight: 500;
  position: sticky;
  top: 0;
}

table.data tbody tr {
  transition: background 0.15s ease;
}

table.data tbody tr:hover {
  background: #f7faff;
}

table.data .mono {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
}

.table-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  color: var(--muted);
  font-size: 12px;
}

.pager {
  display: flex;
  gap: 6px;
}

.pager button {
  min-width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--text);
}

.pager button.active,
.pager button:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
}

.empty strong {
  display: block;
  color: var(--text);
  margin-bottom: 6px;
}

/* ---------- Logs ---------- */
.log-level {
  width: 64px;
}

.log-detail {
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

/* ---------- Architecture diagram ---------- */
.arch-wrap {
  overflow: auto;
}

.arch-svg {
  width: 100%;
  min-width: 680px;
  height: auto;
  display: block;
}

/* ---------- Payment roadmap ---------- */
.timeline {
  display: grid;
  gap: 0;
}

.timeline-item {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 12px;
  padding-bottom: 18px;
  position: relative;
}

.timeline-item:not(:last-child) .tl-dot::after {
  content: "";
  position: absolute;
  left: 13px;
  top: 28px;
  bottom: -4px;
  width: 2px;
  background: var(--border);
}

.tl-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  position: relative;
  z-index: 1;
}

.timeline-item h4 {
  margin: 2px 0 6px;
  font-size: 14px;
}

.timeline-item p {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.65;
}

.timeline-item code {
  font-family: var(--mono);
  font-size: 12px;
  background: var(--info-soft);
  padding: 1px 6px;
  border-radius: 4px;
}

/* ---------- Modal ---------- */
#modal-host {
  display: none;
}
#modal-host.show {
  display: block;
}
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(12, 22, 40, 0.45);
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  animation: fade-up 0.2s var(--ease) both;
}
.modal {
  width: min(520px, 100%);
  max-height: min(86vh, 720px);
  overflow: auto;
  background: var(--panel);
  border-radius: 14px;
  box-shadow: var(--shadow-3);
  border: 1px solid var(--border);
  animation: rise-in 0.28s var(--ease) both;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 1;
}
.modal-body {
  padding: 16px 18px;
}
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px 16px;
  border-top: 1px solid var(--border);
}
.input {
  width: 100%;
  height: 38px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  background: #fff;
  outline: none;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
textarea.input {
  height: auto;
  padding: 10px 12px;
  resize: vertical;
  min-height: 72px;
}
.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.btn-sm {
  height: 28px;
  padding: 0 8px;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--text);
  margin: 2px 2px 0 0;
}
.btn-sm:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

/* ---------- Toast ---------- */
.toast-host {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: grid;
  gap: 8px;
}

.toast {
  min-width: 220px;
  max-width: 320px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-3);
  animation: toast-in 0.3s var(--ease) both;
  font-size: 13px;
}

.toast.ok {
  border-left: 3px solid var(--success);
}

.toast.warn {
  border-left: 3px solid var(--warning);
}

.toast.bad {
  border-left: 3px solid var(--danger);
}

/* ---------- Animations ---------- */
@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-4px);
  }
  75% {
    transform: translateX(4px);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  #view-login.active {
    grid-template-columns: 1fr;
  }

  .login-brand {
    min-height: 240px;
    padding: 28px 24px;
  }

  .brand-modules {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    transition: transform var(--dur) var(--ease), width var(--dur) var(--ease);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .sidebar.collapsed {
    width: var(--sidebar-w);
  }

  .sidebar.collapsed .side-brand-text,
  .sidebar.collapsed .nav-item span,
  .sidebar.collapsed .nav-group-title,
  .sidebar.collapsed .nav-badge {
    opacity: 1;
    width: auto;
    height: auto;
    display: initial;
  }

  .sidebar.collapsed .nav-group-title {
    display: block;
  }

  .user-meta {
    display: none;
  }
}

@media (max-width: 640px) {
  .grid-4,
  .grid-3,
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .content {
    padding: 16px;
  }

  .search-box {
    display: none;
  }

  .page-head {
    flex-direction: column;
  }
}

/* ---------- Hub 服务状态 / 安全提示 ---------- */
.api-banner {
  position: sticky;
  top: 0;
  z-index: 80;
  padding: 8px 16px;
  font-size: 13px;
  text-align: center;
  background: var(--warning-soft);
  color: #8a5a12;
  border-bottom: 1px solid #f0d9a8;
}
.api-banner.bad { background: var(--danger-soft); color: var(--danger); border-bottom-color: #f3c2c4; }
.api-banner.ok { background: var(--success-soft); color: var(--success); border-bottom-color: #bfe8cf; }

.login-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.login-card-head h2 { margin: 0; }
.svc-pill {
  font-size: 12px; padding: 4px 10px; border-radius: 999px;
  background: var(--info-soft); color: var(--info); white-space: nowrap;
}
.svc-pill.ok { background: var(--success-soft); color: var(--success); }
.svc-pill.bad { background: var(--danger-soft); color: var(--danger); }

.security-note { text-align: left; }
.security-note strong { display: block; margin-bottom: 6px; color: var(--ink); }
.security-note ul { margin: 0; padding-left: 18px; line-height: 1.7; }
.security-note code { font-family: var(--mono); }

.side-foot { padding: 10px 14px 14px; border-top: 1px solid rgba(255, 255, 255, 0.06); }
.side-api {
  font-size: 11px; color: rgba(154, 167, 189, 0.8);
  font-family: var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.side-api.ok { color: #6ddea0; }
.side-api.bad { color: #ff8f94; }

.save-state { font-size: 12px; color: var(--muted); min-width: 64px; text-align: right; white-space: nowrap; }
.save-state.ok { color: var(--success); }
.save-state.warn { color: var(--warning); }
.save-state.bad { color: var(--danger); }

.security-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.badge-pending { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); }

table.data th { white-space: nowrap; font-weight: 600; }
table.data td { font-size: 13px; vertical-align: middle; }
.page-head p { max-width: 72ch; }
.empty strong { display: block; margin-bottom: 4px; }

@media (max-width: 640px) {
  .save-state, #btn-refresh { display: none; }
}

/* ---------- Login redesign (AI admin style) ---------- */
#view-login.active {
  display: block;
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(900px 500px at 15% 20%, rgba(64, 120, 255, 0.35), transparent 55%),
    radial-gradient(700px 420px at 85% 15%, rgba(156, 120, 255, 0.28), transparent 50%),
    radial-gradient(800px 500px at 70% 85%, rgba(40, 90, 200, 0.4), transparent 55%),
    linear-gradient(145deg, #071228 0%, #0b1f45 42%, #123a78 100%);
}

.login-scene {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.login-scene .blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(2px);
  opacity: 0.85;
}

.blob-a {
  width: 420px; height: 320px;
  left: -80px; top: -60px;
  background: radial-gradient(circle at 30% 30%, #5eb0ff, #1a4fd0 60%, transparent 70%);
  border-radius: 60% 40% 50% 50%;
  transform: rotate(-18deg);
}
.blob-b {
  width: 360px; height: 300px;
  right: -40px; top: -40px;
  background: radial-gradient(circle at 40% 40%, #b48cff, #4a3ad4 55%, transparent 70%);
  border-radius: 45% 55% 40% 60%;
}
.blob-c {
  width: 480px; height: 360px;
  left: -120px; bottom: -100px;
  background: radial-gradient(circle at 40% 40%, #3d8cff, #0d2f8a 60%, transparent 72%);
  border-radius: 50% 50% 40% 60%;
}
.blob-d {
  width: 420px; height: 340px;
  right: -80px; bottom: -60px;
  background: radial-gradient(circle at 40% 40%, #6aa8ff, #163a9a 58%, transparent 70%);
  border-radius: 55% 45% 55% 45%;
}

.login-scene .tri {
  position: absolute;
  width: 0; height: 0;
  border-left: 18px solid transparent;
  border-right: 18px solid transparent;
  border-bottom: 30px solid rgba(92, 140, 255, 0.85);
}
.tri-a { right: 22%; top: 28%; transform: rotate(18deg); }
.tri-b { left: 28%; bottom: 22%; border-bottom-color: rgba(186, 140, 255, 0.75); transform: rotate(-24deg); }

.login-scene .sphere {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #9ec5ff, #3b6fd4 45%, #1a3f9a 80%);
  box-shadow: inset -10px -16px 30px rgba(0, 20, 70, 0.35);
}
.sphere-a { width: 140px; height: 140px; left: 8%; top: 42%; opacity: 0.9; }

.login-stage {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px 72px;
}

.login-stage {
  /* card */
}

.login-visual,
.login-form-side {
  background: #fff;
}

.login-stage {
  gap: 0;
}

.login-stage::before {
  content: none;
}

.login-stage {
  /* use flex row card */
}

.login-stage {
  display: flex;
}

.login-stage > .login-visual,
.login-stage > .login-form-side {
  box-shadow: 0 24px 60px rgba(4, 16, 48, 0.35);
}

.login-visual {
  width: min(460px, 46vw);
  min-height: 480px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #2f80ed 0%, #1f6fdb 45%, #1a5fc8 100%);
  border-radius: 8px 0 0 8px;
  overflow: hidden;
  padding: 28px;
}

.login-visual img {
  width: 100%;
  height: auto;
  max-height: 420px;
  object-fit: contain;
  filter: drop-shadow(0 18px 30px rgba(0, 20, 60, 0.25));
}

.login-form-side {
  width: min(420px, 92vw);
  min-height: 480px;
  border-radius: 0 8px 8px 0;
  padding: 36px 40px 28px;
  display: flex;
  flex-direction: column;
  background: #fff;
}

.login-logo-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 22px;
}

.login-logo {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  object-fit: cover;
  box-shadow: 0 10px 28px rgba(15, 40, 90, 0.18);
}

.login-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 28px;
  border-bottom: 1px solid #e8eef8;
}

.login-tab {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 12px 8px 14px;
  font-size: 16px;
  color: #6b7a90;
  cursor: pointer;
  position: relative;
}

.login-tab.active {
  color: #1b6fe0;
  font-weight: 600;
}

.login-tab.active::after {
  content: "";
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: -1px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: #2f80ed;
}

.login-tab.is-muted {
  opacity: 0.45;
  cursor: not-allowed;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login-field {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 14px;
  border: 1px solid #d9e2ef;
  border-radius: 8px;
  background: #fff;
  transition: border-color .2s ease, box-shadow .2s ease;
}

.login-field:focus-within {
  border-color: #2f80ed;
  box-shadow: 0 0 0 3px rgba(47, 128, 237, 0.12);
}

.login-field-icon {
  color: #9aa7b8;
  display: inline-flex;
  flex-shrink: 0;
}

.login-field input {
  flex: 1;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 14px;
  color: var(--ink);
  min-width: 0;
}

.login-field input::placeholder {
  color: #a8b3c4;
}

.login-field .toggle-pw {
  border: 0;
  background: transparent;
  color: #9aa7b8;
  padding: 4px;
  cursor: pointer;
  display: inline-flex;
}

.login-form .login-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 2px;
  margin-bottom: 4px;
}

.login-form .login-error {
  margin: 0;
}

.btn-login {
  width: 100%;
  height: 46px;
  border: 0;
  border-radius: 8px;
  background: #3b8ef0;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: background .2s ease, transform .15s ease;
}

.btn-login:hover {
  background: #2f80ed;
}

.btn-login:active {
  transform: translateY(1px);
}

.btn-login:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.login-links {
  margin-top: 18px;
  text-align: center;
}

.login-links a {
  color: #2f80ed;
  font-size: 13px;
  text-decoration: none;
}

.login-links a:hover {
  text-decoration: underline;
}

.login-copyright {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 18px;
  z-index: 2;
  text-align: center;
  color: rgba(230, 238, 255, 0.55);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.brand-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.side-brand .brand-mark {
  display: none;
}

.svc-pill {
  font-size: 11px;
}

@media (max-width: 900px) {
  .login-stage {
    flex-direction: column;
    padding: 28px 16px 64px;
  }
  .login-visual {
    width: min(420px, 94vw);
    min-height: 220px;
    border-radius: 10px 10px 0 0;
  }
  .login-visual img {
    max-height: 180px;
  }
  .login-form-side {
    width: min(420px, 94vw);
    min-height: auto;
    border-radius: 0 0 10px 10px;
    padding: 28px 22px 24px;
  }
  .blob-a, .blob-c { width: 260px; height: 200px; }
  .sphere-a { width: 90px; height: 90px; }
}

/* ---------- Auth v2：干净管理台登录 ---------- */
#view-login.active {
  display: block;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(1000px 560px at 12% 18%, rgba(47, 128, 237, 0.28), transparent 55%),
    radial-gradient(800px 480px at 88% 12%, rgba(90, 70, 200, 0.22), transparent 50%),
    radial-gradient(900px 520px at 70% 90%, rgba(20, 70, 160, 0.35), transparent 55%),
    linear-gradient(145deg, #060d1c 0%, #0a1830 40%, #0f2a52 100%);
  color: #e8eef8;
}

.lang-switch {
  position: absolute;
  top: 20px;
  right: 24px;
  z-index: 5;
  border: 1px solid rgba(255,255,255,0.22);
  background: rgba(255,255,255,0.08);
  color: #e8eef8;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  cursor: pointer;
  backdrop-filter: blur(8px);
}
.lang-switch:hover { background: rgba(255,255,255,0.16); }

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px 20px 72px;
}

.auth-card {
  width: min(920px, 100%);
  min-height: 520px;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  background: #fff;
  color: var(--ink);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(2, 12, 32, 0.45);
}

.auth-brand {
  position: relative;
  background:
    linear-gradient(160deg, #0d1b33 0%, #12315e 48%, #0b2348 100%);
  color: #f2f6ff;
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}

.auth-brand-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(ellipse at 30% 40%, #000 10%, transparent 75%);
  pointer-events: none;
}

.auth-brand-inner { position: relative; z-index: 1; }

.auth-logo {
  width: 72px;
  height: 72px;
  border-radius: 18px;
  object-fit: cover;
  margin-bottom: 22px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.35);
}

.auth-brand h1 {
  margin: 0 0 10px;
  font-size: 28px;
  font-weight: 650;
  letter-spacing: 0.02em;
}

.auth-brand p {
  margin: 0 0 22px;
  color: rgba(232,238,248,0.72);
  font-size: 14px;
  line-height: 1.7;
}

.auth-features {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.auth-features li {
  position: relative;
  padding-left: 18px;
  color: rgba(232,238,248,0.82);
  font-size: 13px;
}
.auth-features li::before {
  content: "";
  position: absolute;
  left: 0; top: 7px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #3d8fef;
  box-shadow: 0 0 0 4px rgba(61,143,239,0.18);
}

.auth-panel {
  padding: 40px 40px 28px;
  display: flex;
  flex-direction: column;
  background: #fff;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin-bottom: 28px;
  border-bottom: 1px solid #e7edf6;
}

.auth-tab {
  border: 0;
  background: transparent;
  padding: 12px 8px 14px;
  font-size: 15px;
  color: #7a8699;
  cursor: pointer;
  position: relative;
}
.auth-tab.active { color: #1f6fd0; font-weight: 600; }
.auth-tab.active::after {
  content: "";
  position: absolute;
  left: 22%; right: 22%;
  bottom: -1px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: #2f80ed;
}

.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form.is-hidden { display: none !important; }

.auth-input {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 14px;
  border: 1px solid #d8e1ee;
  border-radius: 10px;
  background: #fbfcfe;
  color: #8b97a8;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.auth-input:focus-within {
  border-color: #2f80ed;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(47,128,237,0.12);
}
.auth-input input {
  flex: 1;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 14px;
  color: var(--ink);
  min-width: 0;
}
.auth-input input::placeholder { color: #a3aec0; }

.auth-eye {
  border: 0;
  background: transparent;
  color: #9aa7b8;
  padding: 2px;
  cursor: pointer;
  display: inline-flex;
}

.auth-input-code .btn-code {
  border: 0;
  background: transparent;
  color: #2f80ed;
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
  padding: 0 0 0 8px;
}
.auth-input-code .btn-code:disabled { color: #9aa7b8; cursor: not-allowed; }

.auth-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.auth-error {
  display: none;
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fdebec;
  color: #c0392b;
  font-size: 13px;
  line-height: 1.5;
}
.auth-error.show { display: block; }

.captcha-hint {
  font-size: 12px;
  color: #7a8699;
}

.captcha-element { min-height: 0; }

.btn-auth {
  width: 100%;
  height: 46px;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(180deg, #4a95f5, #2f80ed 55%, #2472d8);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.06em;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(47,128,237,0.28);
}
.btn-auth:hover { filter: brightness(1.03); }
.btn-auth:disabled { opacity: 0.7; cursor: not-allowed; }

.auth-links { text-align: center; margin-top: 6px; }
.auth-links a { color: #2f80ed; font-size: 13px; text-decoration: none; }
.auth-links a:hover { text-decoration: underline; }

.auth-copyright {
  position: absolute;
  left: 0; right: 0; bottom: 16px;
  text-align: center;
  color: rgba(232,238,248,0.45);
  font-size: 12px;
  letter-spacing: 0.03em;
}

.brand-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

@media (max-width: 860px) {
  .auth-card { grid-template-columns: 1fr; min-height: auto; }
  .auth-brand { padding: 28px 24px; }
  .auth-brand h1 { font-size: 22px; }
  .auth-logo { width: 56px; height: 56px; margin-bottom: 14px; }
  .auth-panel { padding: 24px 20px 20px; }
}

/* ---------- Auth v2: clean admin login ---------- */
#view-login.active {
  display: block;
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  background: #070d1a;
}

.auth-bg { position: absolute; inset: 0; pointer-events: none; }
.auth-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(80,120,200,.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(80,120,200,.08) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at 50% 40%, #000 20%, transparent 75%);
}
.auth-orb { position: absolute; border-radius: 50%; filter: blur(40px); opacity: .55; }
.auth-orb-a { width: 420px; height: 420px; left: -80px; top: -100px; background: #1d4ed8; }
.auth-orb-b { width: 380px; height: 380px; right: -60px; bottom: -80px; background: #0ea5e9; opacity: .35; }
.auth-line { position: absolute; height: 1px; background: linear-gradient(90deg, transparent, rgba(96,165,250,.5), transparent); }
.auth-line-a { width: 40%; top: 22%; left: 8%; transform: rotate(-8deg); }
.auth-line-b { width: 35%; bottom: 24%; right: 10%; transform: rotate(6deg); }

.auth-lang {
  position: absolute; top: 20px; right: 24px; z-index: 5;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.06);
  color: #e8eefc;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  cursor: pointer;
  backdrop-filter: blur(8px);
}
.auth-lang:hover { background: rgba(255,255,255,.12); }

.auth-card {
  position: relative;
  z-index: 2;
  width: min(920px, calc(100vw - 40px));
  min-height: 520px;
  margin: 72px auto 64px;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  background: #0d1830;
  border: 1px solid rgba(148,163,204,.16);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,.45);
}

.auth-brand {
  padding: 48px 40px;
  background:
    radial-gradient(400px 240px at 20% 20%, rgba(59,130,246,.25), transparent 60%),
    linear-gradient(165deg, #102044 0%, #0b152c 55%, #0a1228 100%);
  color: #e8eefc;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-right: 1px solid rgba(148,163,204,.1);
}

.auth-logo {
  width: 64px; height: 64px;
  border-radius: 14px;
  object-fit: cover;
  margin-bottom: 22px;
  box-shadow: 0 12px 28px rgba(0,0,0,.35);
}

.auth-brand h1 {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 650;
  letter-spacing: .04em;
}

.auth-brand p {
  margin: 0 0 28px;
  color: rgba(232,238,252,.62);
  font-size: 13px;
}

.auth-points {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 12px;
}

.auth-points li {
  position: relative;
  padding-left: 16px;
  color: rgba(232,238,252,.78);
  font-size: 13px;
}

.auth-points li::before {
  content: "";
  position: absolute;
  left: 0; top: 7px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,.2);
}

.auth-main {
  background: #fff;
  padding: 36px 40px 28px;
  display: flex;
  flex-direction: column;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin-bottom: 28px;
  border-bottom: 1px solid #e8eef7;
}

.auth-tab {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 12px 8px 14px;
  font-size: 15px;
  color: #7b879a;
  cursor: pointer;
  position: relative;
}

.auth-tab.active {
  color: #1d4ed8;
  font-weight: 600;
}

.auth-tab.active::after {
  content: "";
  position: absolute;
  left: 22%; right: 22%; bottom: -1px;
  height: 2px;
  background: #2563eb;
  border-radius: 2px 2px 0 0;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: rise-in .25s ease both;
}

.auth-form.is-hidden { display: none; }

.auth-error {
  display: none;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fef2f2;
  color: #b91c1c;
  font-size: 13px;
  line-height: 1.5;
}
.auth-error.show { display: block; }
.auth-error.ok { background: #ecfdf5; color: #047857; }

.auth-input {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 14px;
  border: 1px solid #d9e2ef;
  border-radius: 8px;
  background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.auth-input:focus-within {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.auth-input input {
  flex: 1;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 14px;
  color: #0f172a;
  min-width: 0;
}
.auth-input input::placeholder { color: #9aa7b8; }
.auth-ico { color: #94a3b8; display: inline-flex; }
.auth-eye {
  border: 0; background: transparent; color: #94a3b8; cursor: pointer; padding: 4px; display: inline-flex;
}

.auth-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 24px;
}

.auth-svc {
  font-size: 12px;
  color: #64748b;
}
.auth-svc.ok { color: #047857; }
.auth-svc.bad { color: #b91c1c; }

.auth-submit {
  width: 100%;
  height: 46px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(180deg, #3b82f6, #2563eb);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .06em;
  cursor: pointer;
  margin-top: 4px;
}
.auth-submit:hover { filter: brightness(1.05); }
.auth-submit:disabled { opacity: .65; cursor: not-allowed; }

.auth-links { text-align: center; margin-top: 6px; }
.linkish {
  border: 0; background: transparent; color: #2563eb; cursor: pointer; font-size: 13px; padding: 0;
}
.linkish:hover { text-decoration: underline; }

.auth-code-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}
.auth-input-grow { height: 46px; }
.auth-code-btn {
  height: 46px;
  min-width: 112px;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
}
.auth-code-btn:disabled { opacity: .55; cursor: not-allowed; }

.auth-copy {
  position: absolute;
  left: 0; right: 0; bottom: 18px;
  z-index: 2;
  text-align: center;
  color: rgba(226,232,240,.45);
  font-size: 12px;
  letter-spacing: .04em;
}

.auth-captcha-host {
  position: absolute;
  z-index: 30;
  left: 50%;
  top: 50%;
  width: 1px;
  height: 1px;
  overflow: visible;
}

.brand-icon {
  width: 32px; height: 32px; border-radius: 8px; object-fit: cover; flex-shrink: 0;
}

@media (max-width: 860px) {
  .auth-card {
    grid-template-columns: 1fr;
    margin-top: 56px;
  }
  .auth-brand {
    border-right: 0;
    border-bottom: 1px solid rgba(148,163,204,.1);
    padding: 28px 24px;
  }
  .auth-brand h1 { font-size: 22px; }
  .auth-main { padding: 24px 20px 20px; }
  .auth-points { display: none; }
}

/* ---------- Centered floating login (cutout bg) ---------- */
#view-login.active {
  display: block;
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  background: #050b18;
}

.login-bg { position: absolute; inset: 0; }
.login-bg-art {
  position: absolute; inset: 0;
  background:
    radial-gradient(900px 520px at 20% 25%, rgba(37,99,235,.35), transparent 55%),
    radial-gradient(700px 420px at 80% 20%, rgba(56,189,248,.22), transparent 50%),
    radial-gradient(800px 500px at 70% 85%, rgba(30,64,175,.4), transparent 55%),
    linear-gradient(160deg, #071228 0%, #0b1d3d 45%, #0d2a5c 100%);
}
.login-bg-art::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(125,170,255,.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(125,170,255,.07) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 78%);
}
.login-bg-art::after {
  content: "";
  position: absolute;
  width: 520px; height: 520px;
  left: -120px; bottom: -140px;
  border-radius: 42% 58% 48% 52%;
  background: radial-gradient(circle at 40% 40%, rgba(96,165,250,.35), transparent 68%);
  filter: blur(8px);
}

/* 中央镂空：用巨大阴影把四周压暗，中间透明，形成“扣洞” */
.login-bg-cut {
  position: absolute;
  left: 50%; top: 50%;
  width: min(420px, calc(100vw - 32px));
  height: min(560px, calc(100vh - 88px));
  transform: translate(-50%, -50%);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(236,245,255,.08), rgba(236,245,255,.02));
  box-shadow:
    0 0 0 9999px rgba(4, 8, 18, .78),
    inset 0 0 0 1px rgba(148,180,255,.18),
    inset 0 0 60px rgba(59,130,246,.08);
  backdrop-filter: blur(2px);
}

.login-float {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 44px 16px 64px;
}

.login-float-inner {
  width: min(420px, calc(100vw - 32px));
  min-height: min(560px, calc(100vh - 88px));
  border-radius: 22px;
  padding: 28px 28px 24px;
  background:
    linear-gradient(180deg, rgba(15,28,54,.96) 0%, rgba(10,18,36,.98) 100%);
  border: 1px solid rgba(148,180,255,.22);
  box-shadow:
    0 28px 60px rgba(0,0,0,.45),
    inset 0 1px 0 rgba(255,255,255,.06);
  display: flex;
  flex-direction: column;
  color: #e8eefc;
}

.login-brand-block {
  text-align: center;
  margin: 8px 0 22px;
}

.login-logo {
  width: 64px; height: 64px;
  border-radius: 16px;
  object-fit: cover;
  box-shadow: 0 10px 28px rgba(0,0,0,.4);
}

.login-company {
  margin-top: 12px;
  font-size: 20px;
  font-weight: 650;
  letter-spacing: .08em;
}

.login-tagline {
  margin-top: 4px;
  font-size: 12px;
  color: rgba(232,238,252,.55);
}

#view-login .auth-tabs {
  margin-bottom: 20px;
  border-bottom-color: rgba(148,180,255,.18);
}

#view-login .auth-tab { color: rgba(232,238,252,.55); }
#view-login .auth-tab.active { color: #7dd3fc; }
#view-login .auth-tab.active::after { background: #38bdf8; }

#view-login .auth-input {
  background: rgba(255,255,255,.04);
  border-color: rgba(148,180,255,.22);
}
#view-login .auth-input:focus-within {
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56,189,248,.15);
}
#view-login .auth-input input { color: #f1f5ff; }
#view-login .auth-input input::placeholder { color: rgba(203,213,225,.45); }
#view-login .auth-ico, #view-login .auth-eye { color: rgba(148,163,184,.9); }

#view-login .auth-row { color: rgba(232,238,252,.7); font-size: 13px; }
#view-login .auth-svc { color: rgba(232,238,252,.55); }
#view-login .auth-svc.ok { color: #4ade80; }
#view-login .auth-svc.bad { color: #f87171; }

#view-login .auth-error {
  background: rgba(127,29,29,.35);
  color: #fecaca;
}
#view-login .auth-error.ok { background: rgba(6,78,59,.35); color: #bbf7d0; }

#view-login .auth-submit {
  background: linear-gradient(180deg, #3b9eff, #1d6fe0);
}
#view-login .linkish { color: #7dd3fc; }

#view-login .auth-code-btn {
  background: rgba(56,189,248,.12);
  border-color: rgba(56,189,248,.35);
  color: #7dd3fc;
}

.auth-hint {
  margin: 0 0 4px;
  font-size: 12px;
  color: rgba(232,238,252,.55);
}

.auth-lang {
  position: absolute; top: 18px; right: 20px; z-index: 5;
  border: 1px solid rgba(255,255,255,.16);
  background: rgba(255,255,255,.06);
  color: #e8eefc;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  cursor: pointer;
}
.auth-lang:hover { background: rgba(255,255,255,.12); }

.auth-copy {
  position: absolute; left: 0; right: 0; bottom: 16px; z-index: 2;
  text-align: center;
  color: rgba(226,232,240,.4);
  font-size: 12px;
  letter-spacing: .08em;
}

.auth-form.is-hidden { display: none; }
.auth-captcha-host { position: absolute; z-index: 40; left: 50%; top: 50%; width: 1px; height: 1px; overflow: visible; }

@media (max-width: 520px) {
  .login-float-inner { padding: 22px 18px 18px; min-height: auto; }
  .login-bg-cut { height: auto; min-height: 520px; top: 48%; }
}

/* ---------- Light standard login ---------- */
#view-login.active {
  display: block;
  position: relative;
  min-height: 100vh;
  background: #f0f2f5;
}

.lite-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(800px 400px at 50% -10%, rgba(47,128,237,.12), transparent 60%),
    linear-gradient(180deg, #eef3fa 0%, #f5f7fb 45%, #f0f2f5 100%);
}

.lite-lang {
  position: absolute; top: 16px; right: 18px; z-index: 5;
  border: 1px solid #d0d7e2;
  background: #fff;
  color: #334155;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 12px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15,23,42,.04);
}
.lite-lang:hover { border-color: #2f80ed; color: #2f80ed; }

.lite-wrap {
  position: relative; z-index: 2;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 16px 56px;
}

.lite-card {
  width: min(400px, 100%);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(15,23,42,.08), 0 2px 6px rgba(15,23,42,.04);
  border: 1px solid #e6ebf2;
  padding: 32px 28px 24px;
}

.lite-brand { text-align: center; margin-bottom: 22px; }
.lite-logo {
  width: 64px; height: 64px;
  margin: 0 auto 12px;
  border-radius: 14px;
  object-fit: cover;
  display: block;
  box-shadow: 0 6px 16px rgba(15,23,42,.12);
}
.lite-title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: #0f172a;
  letter-spacing: .04em;
}
.lite-sub {
  margin: 6px 0 0;
  font-size: 13px;
  color: #64748b;
}

.lite-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid #e8eef7;
  margin-bottom: 20px;
}
.lite-tab {
  border: 0; background: transparent;
  padding: 10px 4px 12px;
  font-size: 14px;
  color: #64748b;
  cursor: pointer;
  position: relative;
}
.lite-tab.active { color: #1d4ed8; font-weight: 600; }
.lite-tab.active::after {
  content: ""; position: absolute; left: 18%; right: 18%; bottom: -1px;
  height: 2px; background: #2f80ed; border-radius: 2px 2px 0 0;
}

.lite-form { display: flex; flex-direction: column; gap: 12px; }
.lite-form.is-hidden { display: none; }

.lite-error {
  display: none;
  padding: 9px 11px;
  border-radius: 8px;
  background: #fef2f2;
  color: #b91c1c;
  font-size: 13px;
}
.lite-error.show { display: block; }
.lite-error.ok { background: #ecfdf5; color: #047857; }

.lite-input {
  display: flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 12px;
  border: 1px solid #d7dee8;
  border-radius: 8px;
  background: #fff;
  color: #94a3b8;
}
.lite-input:focus-within {
  border-color: #2f80ed;
  box-shadow: 0 0 0 3px rgba(47,128,237,.12);
}
.lite-input input {
  flex: 1; min-width: 0;
  border: 0; outline: none; background: transparent;
  font-size: 14px; color: #0f172a;
}
.lite-input input::placeholder { color: #9aa7b8; }
.lite-eye { border: 0; background: transparent; color: #94a3b8; cursor: pointer; padding: 4px; display: inline-flex; }

.lite-row { display: flex; align-items: center; justify-content: space-between; min-height: 22px; font-size: 13px; color: #64748b; }
.lite-svc { font-size: 12px; color: #64748b; }
.lite-svc.ok { color: #059669; }
.lite-svc.bad { color: #dc2626; }

.lite-submit {
  width: 100%; height: 44px;
  border: 0; border-radius: 8px;
  background: #2f80ed; color: #fff;
  font-size: 15px; font-weight: 600;
  cursor: pointer; margin-top: 4px;
}
.lite-submit:hover { background: #1d6fe0; }
.lite-submit:disabled { opacity: .65; cursor: not-allowed; }

.lite-links { text-align: center; margin-top: 4px; }
.lite-link { border: 0; background: transparent; color: #2f80ed; cursor: pointer; font-size: 13px; }
.lite-link:hover { text-decoration: underline; }
.lite-muted { color: #94a3b8; font-size: 12px; }

.lite-code-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.lite-grow { height: 44px; }
.lite-code-btn {
  height: 44px; min-width: 110px;
  border: 1px solid #bfdbfe; background: #eff6ff; color: #1d4ed8;
  border-radius: 8px; cursor: pointer; font-size: 13px;
}
.lite-code-btn:disabled { opacity: .55; cursor: not-allowed; }

.lite-copy {
  margin-top: 20px;
  color: #94a3b8;
  font-size: 12px;
  letter-spacing: .04em;
}

#captcha-element { position: absolute; left: 0; top: 0; width: 0; height: 0; overflow: visible; }

@media (max-width: 480px) {
  .lite-card { padding: 24px 18px 18px; }
  .lite-tabs { grid-template-columns: 1fr 1fr; }
  .lite-tabs .lite-tab:nth-child(3) { grid-column: 1 / -1; }
}

/* accounts filters */
.acc-filters { display: grid; gap: 10px; }
.acc-filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.acc-filter-label {
  min-width: 36px;
  font-size: 13px;
  color: var(--muted);
}
.acc-count {
  margin-left: 4px;
  opacity: .85;
  font-variant-numeric: tabular-nums;
}
.acc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
#acc-search {
  flex: 1;
  min-width: 200px;
}

.acc-chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.acc-chip {
  width: auto !important;
  min-width: 0 !important;
  flex: 0 0 auto !important;
  display: inline-flex !important;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.acc-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px 14px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text);
}
.acc-pager-ops {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.acc-pager-page {
  min-width: 64px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  font-weight: 600;
}
.acc-pager-ops button:disabled {
  opacity: .45;
  cursor: not-allowed;
}
