:root {
  --navy-950: #07122d;
  --navy-900: #0b1739;
  --navy-800: #12234c;
  --blue-700: #1555d8;
  --blue-600: #2563eb;
  --blue-500: #3b82f6;
  --blue-100: #dbeafe;
  --blue-50: #eff6ff;
  --cyan-500: #06b6d4;
  --green-700: #15803d;
  --green-100: #dcfce7;
  --amber-800: #92400e;
  --amber-100: #fef3c7;
  --red-700: #b91c1c;
  --red-100: #fee2e2;
  --ink-950: #111827;
  --ink-800: #1f2937;
  --ink-700: #374151;
  --ink-600: #4b5563;
  --ink-500: #6b7280;
  --ink-400: #9ca3af;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --surface: #ffffff;
  --canvas: #f4f7fb;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow-md: 0 14px 36px rgba(15, 23, 42, .09);
  --radius-sm: 8px;
  --radius-md: 13px;
  --radius-lg: 20px;
  --sidebar-width: 256px;
  --topbar-height: 76px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  font-family: Inter, "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  color: var(--ink-950);
  background: var(--canvas);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html {
  width: 100%;
  background: var(--canvas);
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  width: 100%;
  max-width: 100%;
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--canvas);
  overflow-x: clip;
}
body.ui-scroll-locked { overflow: hidden; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .52; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid rgba(37, 99, 235, .25); outline-offset: 2px; }

.boot-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 16px;
  color: var(--ink-600);
  background: radial-gradient(circle at 50% 20%, #fff 0, var(--canvas) 54%);
}

.boot-mark,
.brand-symbol {
  display: inline-grid;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: 16px;
  color: #fff;
  font-weight: 800;
  font-size: 25px;
  background: linear-gradient(145deg, var(--blue-500), var(--cyan-500));
  box-shadow: 0 12px 26px rgba(37, 99, 235, .28);
}
.brand-symbol.small { width: 40px; height: 40px; border-radius: 12px; font-size: 20px; }

/* Authentication */
.auth-shell { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(380px, 1.04fr) minmax(440px, .96fr); background: #fff; }
.auth-brand {
  position: relative;
  overflow: hidden;
  display: grid;
  align-items: center;
  padding: 64px clamp(42px, 7vw, 110px);
  color: #fff;
  background:
    radial-gradient(circle at 14% 15%, rgba(59, 130, 246, .48), transparent 31%),
    radial-gradient(circle at 88% 82%, rgba(6, 182, 212, .20), transparent 34%),
    linear-gradient(145deg, var(--navy-950), var(--navy-800));
}
.auth-brand::after {
  content: "";
  position: absolute;
  width: 440px;
  height: 440px;
  right: -240px;
  top: -140px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 50%;
  box-shadow: 0 0 0 70px rgba(255,255,255,.03), 0 0 0 140px rgba(255,255,255,.025);
}
.auth-brand-inner { position: relative; z-index: 1; max-width: 620px; }
.brand-lockup { display: flex; align-items: center; gap: 15px; }
.brand-lockup > span:last-child { display: grid; gap: 3px; }
.brand-lockup strong { font-size: 18px; letter-spacing: .02em; }
.brand-lockup small { color: #a9c3ef; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; }
.auth-brand h1 { margin: 80px 0 22px; font-size: clamp(34px, 4.2vw, 58px); line-height: 1.18; letter-spacing: -.035em; }
.auth-brand p { max-width: 580px; margin: 0; color: #c5d3ed; font-size: 16px; line-height: 1.85; }
.auth-points { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 32px; }
.auth-points span { padding: 9px 12px; border: 1px solid rgba(255,255,255,.14); border-radius: 999px; color: #d9e5f8; font-size: 12px; background: rgba(255,255,255,.055); }
.auth-panel { display: grid; place-items: center; padding: 40px clamp(28px, 6vw, 88px); background: #fff; }
.auth-card { width: min(100%, 470px); }
.environment-badge,
.simulation-ribbon { display: flex; align-items: center; gap: 8px; color: var(--amber-800); font-size: 12px; font-weight: 700; }
.environment-badge { width: fit-content; margin: 0 0 34px auto; padding: 8px 11px; border: 1px solid #fcd34d; border-radius: 999px; background: #fffbeb; }
.environment-badge span,
.simulation-ribbon span { width: 7px; height: 7px; border-radius: 50%; background: #f59e0b; box-shadow: 0 0 0 4px rgba(245,158,11,.14); }
.auth-heading { margin-bottom: 28px; }
.eyebrow { margin: 0 0 8px; color: var(--blue-600); font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.auth-heading h2, .dialog-header h2 { margin: 0; color: var(--ink-950); font-size: 29px; letter-spacing: -.025em; }
.auth-heading > p:last-child { margin: 10px 0 0; color: var(--ink-500); line-height: 1.65; }
.auth-form { animation: appear .22s ease-out; }
.field { display: grid; gap: 7px; margin-bottom: 17px; color: var(--ink-700); font-size: 13px; font-weight: 650; }
.field small, .field-help { color: var(--ink-500); font-size: 12px; font-weight: 400; line-height: 1.55; }
.input,
.select,
.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  color: var(--ink-950);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #fff;
  transition: border-color .16s ease, box-shadow .16s ease;
}
.field textarea { min-height: 92px; resize: vertical; line-height: 1.55; }
.input:focus,
.select:focus,
.field input:focus,
.field select:focus,
.field textarea:focus { border-color: var(--blue-500); outline: 0; box-shadow: 0 0 0 3px rgba(37,99,235,.11); }
.form-alert,
.global-notice { padding: 11px 13px; border: 1px solid #fecaca; border-radius: 9px; color: var(--red-700); background: #fff7f7; font-size: 13px; line-height: 1.5; }
.form-alert { margin-bottom: 17px; }
.privacy-note { margin: 20px 0 0; color: var(--ink-400); font-size: 11px; line-height: 1.6; text-align: center; }

/* Buttons */
.button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  touch-action: manipulation;
  transition: transform .12s ease, border-color .16s ease, background .16s ease, box-shadow .16s ease;
}
.button:not(:disabled):active { transform: translateY(1px); }
.button-primary { color: #fff; background: var(--blue-600); box-shadow: 0 6px 15px rgba(37,99,235,.18); }
.button-primary:not(:disabled):hover { background: var(--blue-700); }
.button-secondary { color: var(--ink-700); border-color: var(--line-strong); background: #fff; }
.button-secondary:not(:disabled):hover { border-color: #94a3b8; background: #f8fafc; }
.button-danger { color: var(--red-700); border-color: #fecaca; background: #fff7f7; }
.button-danger:not(:disabled):hover { background: var(--red-100); }
.button-quiet { color: var(--blue-700); border-color: transparent; background: transparent; box-shadow: none; }
.button-quiet:not(:disabled):hover { background: var(--blue-50); }
.button-block { width: 100%; min-height: 47px; }
.button-compact { min-height: 36px; padding: 7px 11px; font-size: 12px; }
.icon-button,
.menu-button { display: inline-grid; width: 38px; height: 38px; place-items: center; padding: 0; border: 1px solid transparent; border-radius: 9px; color: inherit; background: transparent; }
.icon-button:hover, .menu-button:hover { background: rgba(148,163,184,.13); }

/* Main layout */
.app-shell { min-height: 100vh; min-height: 100dvh; }
.sidebar {
  position: fixed;
  z-index: 40;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  color: #d6e2f5;
  background: linear-gradient(180deg, var(--navy-950), #0c1a3e 62%, #0a1734);
  box-shadow: 7px 0 28px rgba(7,18,45,.08);
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: calc(var(--topbar-height) + var(--safe-top));
  padding: calc(17px + var(--safe-top)) 20px 17px calc(20px + var(--safe-left));
  border-bottom: 1px solid rgba(255,255,255,.075);
}
.sidebar-brand > span:last-child { display: grid; gap: 3px; }
.sidebar-brand strong { color: #fff; font-size: 15px; }
.sidebar-brand small { color: #8fa7ce; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; }
.simulation-ribbon { margin: 16px 16px 7px calc(16px + var(--safe-left)); padding: 9px 10px; color: #f9d687; border: 1px solid rgba(245,158,11,.18); border-radius: 9px; background: rgba(245,158,11,.08); }
.main-nav {
  display: grid;
  flex: 1 1 auto;
  min-height: 0;
  align-content: start;
  grid-auto-rows: max-content;
  gap: 3px;
  padding: 13px 12px 18px calc(12px + var(--safe-left));
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.nav-group-label { padding: 13px 10px 7px; color: #7188af; font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.nav-item { display: flex; width: 100%; align-items: center; gap: 11px; min-height: 43px; padding: 9px 11px; border: 0; border-radius: 9px; color: #aec0dc; background: transparent; font-size: 13px; text-align: left; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.055); }
.nav-item.active { color: #fff; background: linear-gradient(90deg, rgba(37,99,235,.29), rgba(37,99,235,.13)); box-shadow: inset 3px 0 var(--blue-500); }
.nav-icon { display: grid; width: 25px; height: 25px; place-items: center; color: #b7cced; font-size: 15px; }
.nav-count { margin-left: auto; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center; background: #ef4444; color: #fff; font-size: 11px; font-weight: 900; line-height: 1; }
.nav-count[hidden] { display: none; }
.sidebar-footer {
  display: grid;
  grid-template-columns: 38px minmax(0,1fr) 36px;
  gap: 10px;
  align-items: center;
  margin-top: auto;
  padding: 15px 16px calc(15px + var(--safe-bottom)) calc(16px + var(--safe-left));
  border-top: 1px solid rgba(255,255,255,.075);
}
.user-avatar { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 10px; color: #fff; background: rgba(59,130,246,.32); font-size: 13px; font-weight: 800; }
.sidebar-user { display: grid; min-width: 0; gap: 3px; }
.sidebar-user strong, .sidebar-user span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user strong { color: #fff; font-size: 12px; }
.sidebar-user span { color: #8198bc; font-size: 10px; }
.sidebar-footer .icon-button { color: #aec0dc; }
.sidebar-scrim { display: none; }
.workspace { min-height: 100vh; min-height: 100dvh; margin-left: var(--sidebar-width); }
.topbar {
  position: sticky;
  z-index: 25;
  top: 0;
  height: calc(var(--topbar-height) + var(--safe-top));
  display: flex;
  align-items: center;
  gap: 16px;
  padding: var(--safe-top) max(clamp(20px, 3.2vw, 42px), calc(12px + var(--safe-right))) 0 max(clamp(20px, 3.2vw, 42px), calc(12px + var(--safe-left)));
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.93);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.menu-button { display: none; }
.page-heading { display: grid; min-width: 0; gap: 3px; }
.page-heading span { color: var(--ink-500); font-size: 10px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.page-heading h1 { margin: 0; overflow: hidden; color: var(--ink-950); font-size: 20px; letter-spacing: -.015em; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 10px; margin-left: auto; }
.role-badge { padding: 6px 10px; border: 1px solid var(--blue-100); border-radius: 999px; color: var(--blue-700); background: var(--blue-50); font-size: 11px; font-weight: 800; }
.workspace-body {
  padding: 28px max(clamp(20px, 3.2vw, 42px), calc(12px + var(--safe-right))) calc(48px + var(--safe-bottom)) max(clamp(20px, 3.2vw, 42px), calc(12px + var(--safe-left)));
}
.global-notice { margin-bottom: 18px; }
.view-root { max-width: 1620px; margin: 0 auto; }
.view-root[aria-busy="true"] { opacity: .72; }

/* View components */
.page-intro { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin: 0 0 22px; }
.page-intro h2 { margin: 0; font-size: 24px; letter-spacing: -.025em; }
.page-intro p { max-width: 850px; margin: 7px 0 0; color: var(--ink-500); font-size: 13px; line-height: 1.65; }
.page-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; }
.notice-strip { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 18px; padding: 13px 15px; border: 1px solid #bfdbfe; border-radius: var(--radius-md); color: #1e4d8f; background: var(--blue-50); font-size: 12px; line-height: 1.65; }
.notice-strip.warning { border-color: #fde68a; color: var(--amber-800); background: #fffbeb; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card { position: relative; overflow: hidden; min-height: 126px; padding: 19px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-sm); }
.stat-card::after { content: ""; position: absolute; width: 80px; height: 80px; right: -32px; top: -32px; border-radius: 50%; background: var(--accent-soft, var(--blue-50)); }
.stat-card .stat-label { color: var(--ink-500); font-size: 12px; font-weight: 650; }
.stat-card .stat-value { margin-top: 12px; color: var(--ink-950); font-size: 29px; font-weight: 780; letter-spacing: -.035em; }
.stat-card .stat-hint { margin-top: 5px; color: var(--ink-400); font-size: 11px; }
.statistics-filter-card { margin-bottom: 18px; }
.statistics-filter-card .toolbar { margin-bottom: 0; }
.statistics-chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; margin-bottom: 18px; }
.chart-card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-sm); }
.chart-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 17px 19px 4px; }
.chart-card-header h3 { margin: 0; color: var(--ink-950); font-size: 15px; }
.chart-card-header p { max-width: 520px; margin: 6px 0 0; color: var(--ink-500); font-size: 11px; line-height: 1.55; }
.chart-current-value { flex: 0 0 auto; color: var(--blue-700); font-size: 19px; font-weight: 800; white-space: nowrap; }
.line-chart-scroll { max-width: 100%; overflow-x: auto; overscroll-behavior-inline: contain; -webkit-overflow-scrolling: touch; }
.line-chart { display: block; width: 100%; min-width: 560px; height: auto; padding: 0 8px 7px; }
.chart-grid-line { stroke: #e8eef6; stroke-width: 1; }
.chart-axis-label { fill: var(--ink-400); font-size: 9px; }
.chart-line { fill: none; stroke: var(--blue-600); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.chart-point { fill: #fff; stroke: var(--blue-600); stroke-width: 2.5; }
.content-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr); gap: 18px; }
.content-grid.equal { grid-template-columns: repeat(2, minmax(0,1fr)); }
.content-grid.single { grid-template-columns: minmax(0,1fr); }
.card { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-sm); }
.card + .card { margin-top: 18px; }
.card-header { display: flex; min-width: 0; align-items: flex-start; justify-content: space-between; gap: 16px; min-height: 68px; padding: 17px 19px; border-bottom: 1px solid var(--line); }
.card-header > div { min-width: 0; }
.card-header h3 { margin: 0; font-size: 15px; }
.card-header p { margin: 6px 0 0; color: var(--ink-500); font-size: 11px; line-height: 1.5; }
.card-body { padding: 19px; }
.toolbar { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.toolbar-group { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 9px; }
.toolbar .field { min-width: 190px; margin: 0; }
.toolbar .field.grow { min-width: min(360px, 100%); flex: 1; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.selection-summary { padding: 12px 13px; border: 1px dashed var(--line-strong); border-radius: 9px; color: var(--ink-600); background: #f8fafc; font-size: 12px; line-height: 1.6; }
.inline-summary { color: var(--ink-500); font-size: 12px; }
.text-success { color: var(--green-700); }
.text-danger { color: var(--red-700); }
.extra-connection-panel { margin: 1px 0 16px; border: 1px solid var(--line); border-radius: 11px; background: #fbfdff; }
.extra-connection-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 15px; }
.extra-connection-heading > div { display: grid; min-width: 0; gap: 5px; }
.extra-connection-heading strong { color: var(--ink-950); font-size: 13px; }
.extra-connection-heading small { color: var(--ink-500); font-size: 10px; line-height: 1.55; }
.switch-control { display: inline-flex; flex: 0 0 auto; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.switch-control input { position: absolute; width: 1px; height: 1px; overflow: hidden; opacity: 0; }
.switch-track { position: relative; width: 42px; height: 24px; border-radius: 999px; background: var(--ink-300); transition: background .16s ease, box-shadow .16s ease; }
.switch-track::after { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(15,23,42,.25); content: ''; transition: transform .16s ease; }
.switch-control input:checked + .switch-track { background: var(--blue-600); }
.switch-control input:checked + .switch-track::after { transform: translateX(18px); }
.switch-control input:focus-visible + .switch-track { box-shadow: 0 0 0 3px rgba(37,99,235,.2); }
.switch-label { color: var(--ink-700); font-size: 12px; font-weight: 700; }
.extra-connection-options { padding: 14px 15px 0; border-top: 1px solid var(--line); }
.extra-mode-group { margin: 0; padding: 0; border: 0; }
.extra-mode-group legend { margin-bottom: 9px; color: var(--ink-700); font-size: 11px; font-weight: 700; }
.extra-mode-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
.extra-mode-choice { display: grid; grid-template-columns: 18px minmax(0,1fr); align-items: start; gap: 9px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; cursor: pointer; }
.extra-mode-choice:has(input:checked) { border-color: var(--blue-600); background: var(--blue-50); box-shadow: 0 0 0 2px rgba(37,99,235,.08); }
.extra-mode-choice input { width: 17px; height: 17px; margin: 1px 0 0; accent-color: var(--blue-600); }
.extra-mode-choice span { display: grid; gap: 4px; }
.extra-mode-choice strong { color: var(--ink-900); font-size: 12px; }
.extra-mode-choice small { color: var(--ink-500); font-size: 10px; line-height: 1.5; }
.extra-value-grid { margin-top: 12px; }
.extra-value-grid .field { transition: opacity .15s ease; }
.extra-value-grid .field.is-inactive { opacity: .5; }
.recharge-rules-copy { margin: 0; line-height: 1.8; }
.recharge-rule-list { display: grid; gap: 8px; margin: 14px 0; padding: 0; list-style: none; }
.recharge-rule-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink-600); background: #f8fafc; font-size: 11px; transition: border-color .16s ease, background .16s ease, color .16s ease; }
.recharge-rule-item strong { color: var(--green-700); white-space: nowrap; }
.recharge-rule-item.active { border-color: #86efac; color: var(--green-700); background: #f0fdf4; box-shadow: 0 0 0 2px rgba(34,197,94,.08); }
.recharge-rule-empty { margin: 14px 0; padding: 11px 12px; border: 1px dashed var(--line-strong); border-radius: 9px; color: var(--ink-500); background: #f8fafc; font-size: 11px; line-height: 1.6; }
.recharge-rule-empty.invalid { color: var(--red-700); border-color: #fecaca; background: #fff7f7; }
.recharge-rule-announcement { margin-top: 14px; padding: 12px 13px; border: 1px solid var(--blue-100); border-radius: 9px; color: var(--blue-700); background: var(--blue-50); font-size: 12px; font-weight: 650; line-height: 1.65; }
.recharge-rule-footnote { margin: 12px 0 0; color: var(--ink-400); font-size: 10px; line-height: 1.65; }
.admin-recharge-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; margin-bottom: 17px; }
.settings-window { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.settings-window-header { min-height: 70px; padding: 15px 16px 13px; border-bottom: 1px solid var(--line); background: #fbfdff; }
.settings-window-header h4 { margin: 0; color: var(--ink-950); font-size: 13px; }
.settings-window-header p { margin: 6px 0 0; color: var(--ink-500); font-size: 10px; line-height: 1.55; }
.settings-window-body { padding: 16px; }
.recharge-prompt-window .settings-window-body { height: calc(100% - 70px); }
.credential-format-note { margin-bottom: 16px; }
.confirm-check { display: flex; align-items: flex-start; gap: 10px; margin-top: 16px; padding: 12px 13px; border: 1px solid #fecaca; border-radius: 9px; color: var(--red-700); background: #fff7f7; font-size: 12px; font-weight: 650; line-height: 1.5; cursor: pointer; }
.confirm-check input { flex: 0 0 auto; width: 17px; height: 17px; margin-top: 1px; accent-color: var(--red-700); }
.field-spaced { margin-top: 16px; }
.room-extract-button { margin-bottom: 17px; }
.resolver-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 11px; margin: -5px 0 17px; }
.payment-channel-panel { display: grid; min-height: 170px; place-items: center; margin-bottom: 17px; padding: 16px; border: 1px dashed var(--line-strong); border-radius: 10px; background: #f8fafc; }
.payment-placeholder, .payment-code { display: grid; justify-items: center; gap: 8px; color: var(--ink-600); text-align: center; }
.payment-placeholder.warning { color: var(--amber-800); }
.payment-placeholder small, .payment-code small { max-width: 360px; color: var(--ink-500); font-size: 11px; line-height: 1.6; }
.payment-code img { display: block; width: min(220px, 100%); max-height: 260px; object-fit: contain; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.payment-checkout-summary { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; margin-bottom: 16px; }
.payment-checkout-summary > div { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: #f8fafc; }
.payment-checkout-summary span { display: block; margin-bottom: 7px; color: var(--ink-500); font-size: 10px; }
.payment-checkout-summary strong { color: var(--ink-950); font-size: 13px; overflow-wrap: anywhere; }
.payment-channel-dialog { margin-bottom: 16px; }
.payment-confirmation-notice { margin-bottom: 0; }
.payment-choice-group { display: grid; gap: 10px; margin: 0 0 16px; padding: 0; border: 0; }
.payment-choice-group legend { margin-bottom: 9px; color: var(--ink-700); font-size: 13px; font-weight: 750; }
.payment-choice { display: grid; grid-template-columns: 22px minmax(0,1fr); gap: 12px; align-items: center; min-height: 58px; margin: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; transition: border-color .15s ease, box-shadow .15s ease, background .15s ease; }
.payment-choice:hover { border-color: #93b4f5; background: var(--blue-50); }
.payment-choice:has(input:checked) { border-color: var(--blue-600); background: var(--blue-50); box-shadow: 0 0 0 3px rgba(37,99,235,.10); }
.payment-choice.is-disabled { color: var(--ink-500); background: #f8fafc; cursor: not-allowed; opacity: .72; }
.payment-choice.is-disabled:hover { border-color: var(--line); background: #f8fafc; box-shadow: none; }
.payment-choice input { width: 19px; height: 19px; margin: 0; accent-color: var(--blue-600); }
.payment-choice span { display: grid; min-width: 0; gap: 4px; }
.payment-choice strong { color: var(--ink-900); font-size: 14px; }
.payment-choice small { color: var(--ink-500); font-size: 11px; font-weight: 500; line-height: 1.55; overflow-wrap: anywhere; }
.payment-choice-action { width: 100%; color: inherit; text-align: left; font: inherit; appearance: none; }
.payment-choice-action > .payment-choice-icon { display: grid; width: 22px; height: 22px; place-items: center; border-radius: 7px; color: #fff; background: var(--blue-600); font-size: 12px; font-weight: 800; }
.payment-safety-note { margin-bottom: 0; }
.audit-delete-form { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 10px; padding-top: 15px; border-top: 1px solid var(--line); }
.audit-delete-form .field { width: min(280px, 100%); margin: 0; }
.audit-delete-form > small { align-self: center; color: var(--ink-500); font-size: 11px; }
.credential-copy-status { display: block; margin-top: 12px; text-align: center; }
.submit-spaced { margin-top: 14px; }
.with-bottom-gap { margin-bottom: 14px; }
.stacked-aside { display: grid; align-content: start; gap: 18px; }

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow: auto;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
}
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table caption { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.data-table th { padding: 11px 13px; color: var(--ink-500); border-bottom: 1px solid var(--line); background: #f8fafc; font-size: 10px; font-weight: 800; letter-spacing: .03em; text-align: left; white-space: nowrap; }
.data-table td { min-width: 0; padding: 12px 13px; color: var(--ink-700); border-bottom: 1px solid #edf1f6; vertical-align: middle; overflow-wrap: anywhere; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #fbfdff; }
.cell-main { min-width: 0; color: var(--ink-950); font-weight: 700; overflow-wrap: anywhere; }
.cell-sub { min-width: 0; margin-top: 4px; color: var(--ink-400); font-size: 10px; line-height: 1.45; overflow-wrap: anywhere; }
.cell-actions { display: flex; flex-wrap: wrap; gap: 5px; min-width: max-content; }
.table-checkbox { width: 16px; height: 16px; accent-color: var(--blue-600); }
.touch-checkbox { display: inline-grid; width: 32px; height: 32px; place-items: center; cursor: pointer; touch-action: manipulation; }
.touch-checkbox:has(.table-checkbox:disabled) { cursor: not-allowed; opacity: .62; }
.empty-state { display: grid; min-height: 170px; place-content: center; justify-items: center; padding: 28px; color: var(--ink-500); text-align: center; }
.empty-state strong { margin-bottom: 6px; color: var(--ink-700); }
.empty-state small { max-width: 430px; line-height: 1.6; }
.loading-state { display: grid; min-height: 220px; place-content: center; gap: 12px; justify-items: center; color: var(--ink-500); font-size: 13px; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--blue-100); border-top-color: var(--blue-600); border-radius: 50%; animation: spin .7s linear infinite; }
.pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; padding: 12px 15px; border-top: 1px solid var(--line); color: var(--ink-500); font-size: 11px; }
.table-pagination-body:empty { display: none; }
.table-pagination-body { padding: 0; border-top: 1px solid var(--line); }
.table-pagination-body .pagination { border-top: 0; }
.local-pagination { min-width: 0; }
.log-filter-summary { margin: 0 0 12px; }

.pill { display: inline-flex; align-items: center; gap: 6px; min-height: 24px; padding: 4px 8px; border-radius: 999px; color: var(--ink-700); background: #eef2f7; font-size: 10px; font-weight: 800; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .72; }
.pill.success { color: var(--green-700); background: var(--green-100); }
.pill.info { color: var(--blue-700); background: var(--blue-100); }
.pill.warning { color: var(--amber-800); background: var(--amber-100); }
.pill.danger { color: var(--red-700); background: var(--red-100); }
.mono { min-width: 0; font-family: "Cascadia Mono", Consolas, monospace; font-size: 11px; overflow-wrap: anywhere; word-break: break-word; }

.status-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }
.status-grid.compact-two { grid-template-columns: repeat(2, minmax(0,1fr)); }
.status-panel { min-height: 116px; padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.status-panel .key { color: var(--ink-500); font-size: 11px; }
.status-panel .reading { margin-top: 10px; color: var(--ink-950); font-size: 19px; font-weight: 780; }
.status-panel .description { margin-top: 7px; color: var(--ink-400); font-size: 10px; line-height: 1.5; }
.activity-list { display: grid; gap: 0; }
.activity-list-spaced { margin-top: 16px; }
.activity-item { display: grid; grid-template-columns: 10px minmax(0,1fr) auto; gap: 11px; align-items: start; padding: 13px 0; border-bottom: 1px solid var(--line); }
.activity-item:last-child { border-bottom: 0; }
.activity-dot { width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; background: var(--blue-500); box-shadow: 0 0 0 4px var(--blue-50); }
.activity-copy { color: var(--ink-700); font-size: 12px; line-height: 1.5; }
.activity-copy strong { display: block; margin-bottom: 2px; color: var(--ink-950); }
.activity-time { color: var(--ink-400); font-size: 10px; white-space: nowrap; }
.batch-result-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; }
.batch-result-grid h3 { margin: 0 0 10px; color: var(--ink-700); font-size: 13px; }
.result-list { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; }
.result-list li { display: grid; gap: 3px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 9px; background: #f8fafc; }
.result-list strong { color: var(--ink-800); font-size: 12px; }
.result-list span { color: var(--ink-500); font-size: 11px; line-height: 1.5; }
.success-list li { border-color: #bbf7d0; background: #f0fdf4; }
.warning-list li { border-color: #fde68a; background: #fffbeb; }
.balance-card { padding: 22px; color: #fff; border-radius: var(--radius-md); background: linear-gradient(135deg, #1849bd, #2476ec 66%, #13a7c7); box-shadow: 0 17px 32px rgba(37,99,235,.19); }
.balance-card span { color: rgba(255,255,255,.74); font-size: 12px; }
.balance-card strong { display: block; margin-top: 9px; font-size: 32px; letter-spacing: -.035em; overflow-wrap: anywhere; }
.balance-card small { display: block; margin-top: 18px; color: rgba(255,255,255,.66); }

/* Dialog and notifications */
.app-dialog {
  width: min(620px, calc(100vw - 28px));
  max-height: min(780px, calc(100vh - 32px));
  max-height: min(780px, calc(100dvh - 32px - var(--safe-top) - var(--safe-bottom)));
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 16px;
  color: var(--ink-950);
  box-shadow: 0 30px 80px rgba(15,23,42,.28);
}
.app-dialog > form { display: flex; max-height: inherit; flex-direction: column; }
.app-dialog[aria-busy="true"] { cursor: progress; }
.app-dialog::backdrop { background: rgba(7,18,45,.58); backdrop-filter: blur(3px); }
.dialog-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 21px 22px 18px; border-bottom: 1px solid var(--line); }
.dialog-header h2 { font-size: 20px; }
.dialog-body { flex: 1 1 auto; min-height: 0; max-height: none; overflow-y: auto; overscroll-behavior: contain; padding: 21px 22px; -webkit-overflow-scrolling: touch; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 9px; padding: 15px 22px; border-top: 1px solid var(--line); background: #f8fafc; }
.dialog-actions:empty { display: none; }
.dialog-inline-alert { margin-top: 16px; margin-bottom: 0; }
.forced-password-actions { display: flex; justify-content: flex-start; margin-top: 18px; }
.management-qr-shell { display: grid; justify-items: center; gap: 12px; text-align: center; }
.management-qr-account { max-width: 100%; color: var(--ink-600); font-size: 13px; overflow-wrap: anywhere; }
.management-qr-frame {
  display: grid;
  width: min(280px, 76vw);
  aspect-ratio: 1;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #f8fafc;
}
.management-qr-frame img { display: block; width: 100%; height: 100%; object-fit: contain; background: #fff; }
.management-qr-frame img[hidden] { display: none; }
.management-qr-placeholder { padding: 24px; color: var(--ink-500); font-size: 14px; line-height: 1.65; }
.management-qr-status { color: var(--ink-950); font-size: 16px; }
.management-qr-actions { display: flex; justify-content: center; width: 100%; }
.management-qr-help { max-width: 470px; margin: 4px 0 0; color: var(--ink-500); font-size: 12px; line-height: 1.7; }
.management-qr-shell .form-alert { width: 100%; text-align: left; }
.management-payment-qr-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.management-payment-qr-card { display: grid; align-content: start; gap: 14px; min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: #f8fafc; }
.management-payment-qr-card h4 { margin: 0; color: var(--ink-950); font-size: 16px; }
.management-payment-qr-card .payment-channel-panel { min-height: 210px; }
.management-payment-qr-card .payment-channel-panel img { display: block; width: min(100%, 280px); margin: 0 auto; aspect-ratio: 1; object-fit: contain; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.management-payment-qr-card .mono { overflow-wrap: anywhere; }
.toast-region {
  position: fixed;
  z-index: 100;
  right: max(22px, calc(12px + var(--safe-right)));
  bottom: max(22px, calc(12px + var(--safe-bottom)));
  display: grid;
  gap: 10px;
  width: min(380px, calc(100vw - 32px - var(--safe-left) - var(--safe-right)));
}
.toast { padding: 13px 15px; color: #fff; border-radius: 10px; background: var(--navy-900); box-shadow: var(--shadow-md); font-size: 12px; line-height: 1.5; animation: toast-in .2s ease-out; }
.toast.error { background: #991b1b; }
.toast.success { background: #166534; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes appear { from { opacity: 0; transform: translateY(5px); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 1240px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .status-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
}

@media (max-width: 960px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-brand {
    min-height: 300px;
    padding: calc(42px + var(--safe-top)) max(34px, calc(20px + var(--safe-right))) 42px max(34px, calc(20px + var(--safe-left)));
  }
  .auth-brand h1 { margin: 42px 0 16px; font-size: 36px; }
  .auth-panel {
    padding: 38px max(24px, calc(16px + var(--safe-right))) calc(50px + var(--safe-bottom)) max(24px, calc(16px + var(--safe-left)));
  }
  .sidebar { width: min(var(--sidebar-width), calc(100vw - 44px)); transform: translateX(-102%); transition: transform .2s ease; }
  body.sidebar-open { overflow: hidden; }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-scrim { position: fixed; z-index: 35; inset: 0; display: block; visibility: hidden; opacity: 0; border: 0; background: rgba(7,18,45,.46); transition: .2s ease; }
  body.sidebar-open .sidebar-scrim { visibility: visible; opacity: 1; }
  .workspace { margin-left: 0; }
  .menu-button { display: inline-grid; }
  .content-grid, .content-grid.equal { grid-template-columns: 1fr; }
  .management-payment-qr-grid { grid-template-columns: 1fr; }
  .statistics-chart-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px), (max-width: 960px) and (max-height: 600px) {
  :root { --topbar-height: 68px; }
  .button,
  .button-compact { min-height: 44px; }
  .icon-button,
  .menu-button { width: 44px; height: 44px; }
  .nav-item { min-height: 48px; }
  .touch-checkbox { width: 44px; height: 44px; }
  .table-checkbox { width: 22px; height: 22px; }
  .auth-brand {
    min-height: 150px;
    padding: calc(22px + var(--safe-top)) max(20px, calc(14px + var(--safe-right))) 24px max(20px, calc(14px + var(--safe-left)));
  }
  .auth-brand h1 { margin: 24px 0 0; font-size: clamp(24px, 8vw, 30px); }
  .auth-brand p, .auth-points { display: none; }
  .auth-panel {
    place-items: start center;
    padding: 26px max(16px, calc(12px + var(--safe-right))) calc(38px + var(--safe-bottom)) max(16px, calc(12px + var(--safe-left)));
  }
  .environment-badge { margin-bottom: 24px; }
  .topbar {
    padding-right: max(14px, calc(10px + var(--safe-right)));
    padding-left: max(14px, calc(10px + var(--safe-left)));
  }
  .page-heading h1 { font-size: 17px; }
  .page-heading span, .role-badge { display: none; }
  .topbar-actions .button { padding-inline: 9px; }
  .workspace-body {
    padding: 20px max(14px, calc(10px + var(--safe-right))) calc(36px + var(--safe-bottom)) max(14px, calc(10px + var(--safe-left)));
  }
  .page-intro { display: grid; }
  .page-actions { width: 100%; justify-content: flex-start; }
  .page-actions .button { flex: 1 1 150px; }
  .stats-grid, .status-grid { grid-template-columns: 1fr; }
  .status-grid.compact-two, .batch-result-grid { grid-template-columns: 1fr; }
  .stat-card { min-height: 112px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .extra-connection-heading { align-items: flex-start; }
  .extra-mode-grid { grid-template-columns: 1fr; }
  .admin-recharge-grid, .payment-checkout-summary { grid-template-columns: 1fr; }
  .toolbar, .toolbar-group { align-items: stretch; flex-direction: column; }
  .toolbar .field, .toolbar .field.grow { width: 100%; min-width: 0; }
  .toolbar .button { width: 100%; }
  .resolver-actions, .audit-delete-form { align-items: stretch; flex-direction: column; }
  .resolver-actions .button, .audit-delete-form .button, .audit-delete-form .field { width: 100%; }
  .card-header { flex-direction: column; }
  .chart-card-header { flex-direction: column; }
  .line-chart { min-width: 0; }
  .card-header > .button, .card-header > .page-actions { width: 100%; }
  .recharge-rule-item { align-items: flex-start; flex-direction: column; }
  .recharge-rule-item strong { white-space: normal; }
  .table-wrap { overflow: visible; }
  .data-table.responsive thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }
  .data-table.responsive, .data-table.responsive tbody, .data-table.responsive tr, .data-table.responsive td { display: block; width: 100%; }
  .data-table.responsive tr { padding: 11px 13px; border-bottom: 1px solid var(--line); }
  .data-table.responsive tr:last-child { border-bottom: 0; }
  .data-table.responsive td { display: grid; grid-template-columns: minmax(88px, 35%) minmax(0,1fr); align-items: start; gap: 12px; padding: 7px 0; border: 0; }
  .data-table.responsive td::before { content: attr(data-label); color: var(--ink-400); font-size: 10px; font-weight: 800; }
  .cell-actions { min-width: 0; max-width: 100%; }
  .activity-item { grid-template-columns: 10px minmax(0,1fr); }
  .activity-time { grid-column: 2; white-space: normal; }
  .pagination { justify-content: center; }
  .field input:not([type="checkbox"]):not([type="radio"]),
  .field select,
  .field textarea,
  .input,
  .select { font-size: 16px; }
  .app-dialog {
    width: 100%;
    max-width: none;
    max-height: calc(100vh - var(--safe-top));
    max-height: calc(min(100dvh, var(--visual-viewport-height, 100dvh)) - var(--safe-top));
    margin: auto 0 0;
    border-radius: 16px 16px 0 0;
  }
  .dialog-header {
    padding: 18px max(17px, calc(12px + var(--safe-right))) 15px max(17px, calc(12px + var(--safe-left)));
  }
  .dialog-body {
    padding: 18px max(17px, calc(12px + var(--safe-right))) 18px max(17px, calc(12px + var(--safe-left)));
  }
  .dialog-actions {
    padding: 13px max(17px, calc(12px + var(--safe-right))) calc(13px + var(--safe-bottom)) max(17px, calc(12px + var(--safe-left)));
  }
  .dialog-actions .button { flex: 1 1 140px; }
  .toast-region {
    right: max(12px, var(--safe-right));
    bottom: max(12px, calc(8px + var(--safe-bottom)));
    left: max(12px, var(--safe-left));
    width: auto;
  }
}

@media (max-width: 480px) {
  .topbar {
    height: auto;
    min-height: calc(var(--topbar-height) + var(--safe-top));
    grid-template-columns: 44px minmax(0,1fr);
    display: grid;
    gap: 7px 9px;
    padding-top: calc(7px + var(--safe-top));
    padding-bottom: 8px;
  }
  .menu-button { grid-column: 1; grid-row: 1; }
  .page-heading { grid-column: 2; grid-row: 1; }
  .topbar-actions {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    gap: 7px;
    margin-left: 0;
  }
  .topbar-actions .button { flex: 1 1 0; min-width: 0; }
  .dialog-header h2 { font-size: 18px; }
}

@media (pointer: coarse) {
  .button,
  .button-compact { min-height: 44px; }
  .icon-button,
  .menu-button { width: 44px; height: 44px; }
  .nav-item { min-height: 48px; }
  .field input:not([type="checkbox"]):not([type="radio"]),
  .field select,
  .field textarea,
  .input,
  .select {
    min-height: 48px;
    font-size: 16px;
  }
  .table-checkbox,
  .confirm-check input { width: 22px; height: 22px; }
  .touch-checkbox { width: 44px; height: 44px; }
}

@media (max-height: 600px) and (max-width: 960px) {
  .auth-brand { min-height: auto; }
  .auth-brand h1 { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
