:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --line: #d8e0eb;
  --line-strong: #c5cfde;
  --text: #172033;
  --muted: #64748b;
  --blue: #2563eb;
  --blue-2: #1d4ed8;
  --teal: #0f766e;
  --amber: #b7791f;
  --green: #15803d;
  --danger: #dc2626;
  --shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1080px;
  min-height: 100vh;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.09), transparent 48%),
    linear-gradient(315deg, rgba(15, 118, 110, 0.08), transparent 44%),
    var(--bg);
}

.login-panel {
  width: 380px;
  padding: 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.brand-mark {
  margin-bottom: 24px;
  color: var(--text);
  font-size: 22px;
  font-weight: 700;
}

.login-form {
  display: grid;
  gap: 16px;
}

.login-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
}

.login-form input,
.token-input,
.date-range input,
.select-shell select {
  height: 34px;
  color: var(--text);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
}

.login-form input:focus,
.token-input:focus,
.date-range:focus-within,
.select-shell select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.login-form input {
  width: 100%;
  padding: 0 10px;
}

.form-error {
  min-height: 18px;
  margin: 0;
  color: var(--danger);
  font-size: 13px;
}

.dashboard-view {
  min-height: 100vh;
  display: flex;
  background: var(--bg);
}

.sidebar {
  width: 188px;
  min-height: 100vh;
  flex: 0 0 188px;
  display: flex;
  flex-direction: column;
  position: relative;
  padding: 18px 12px;
  color: #e5edf8;
  background: #172033;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  transition: width 0.18s ease, flex-basis 0.18s ease;
}

.sidebar-toggle {
  position: absolute;
  top: 14px;
  right: -13px;
  z-index: 3;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  padding: 0;
  color: #ffffff;
  background: #2563eb;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
}

.sidebar-brand {
  display: grid;
  gap: 6px;
  padding: 4px 8px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-brand strong {
  font-size: 17px;
}

.sidebar-brand span {
  color: #9fb0c9;
  font-size: 12px;
}

.sidebar-brand em {
  width: fit-content;
  padding: 2px 7px;
  color: #bfdbfe;
  background: rgba(37, 99, 235, 0.16);
  border: 1px solid rgba(147, 197, 253, 0.26);
  border-radius: 999px;
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
}

.side-nav {
  display: grid;
  gap: 8px;
  padding: 18px 0;
}

.side-nav-item {
  height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  color: #cbd5e1;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  text-align: left;
  font-weight: 700;
}

.side-nav-item:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

.side-nav-item.active {
  color: #ffffff;
  background: #2563eb;
  border-color: rgba(255, 255, 255, 0.16);
}

.nav-icon {
  width: 22px;
  height: 22px;
  display: inline-grid;
  place-items: center;
  font-size: 15px;
}

.sidebar-logout {
  height: 34px;
  margin-top: auto;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
}

.sidebar-logout:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.11);
}

.dashboard-view.sidebar-collapsed .sidebar {
  width: 64px;
  flex-basis: 64px;
  padding-left: 10px;
  padding-right: 10px;
}

.dashboard-view.sidebar-collapsed .sidebar-toggle {
  transform: rotate(180deg);
}

.dashboard-view.sidebar-collapsed .sidebar-brand {
  padding-left: 0;
  padding-right: 0;
}

.dashboard-view.sidebar-collapsed .sidebar-brand strong,
.dashboard-view.sidebar-collapsed .sidebar-brand span,
.dashboard-view.sidebar-collapsed .sidebar-brand em,
.dashboard-view.sidebar-collapsed .nav-label {
  display: none;
}

.dashboard-view.sidebar-collapsed .side-nav-item {
  justify-content: center;
  padding: 0;
}

.dashboard-view.sidebar-collapsed .sidebar-logout {
  min-width: 0;
  padding: 0;
}

.workspace {
  min-width: 0;
  flex: 1;
}

.page-view {
  min-width: 0;
}

.topbar {
  min-height: 92px;
  display: grid;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
}

.topbar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.auth-row {
  width: 100%;
}

.filter-row {
  flex-wrap: wrap;
}

.select-shell {
  width: 196px;
}

.select-shell.narrow {
  width: 180px;
}

.select-shell select {
  width: 100%;
  padding: 0 34px 0 12px;
}

.date-range {
  height: 36px;
  min-width: 348px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid #b8c8e6;
  border-radius: 6px;
  background: #ffffff;
}

.date-range input {
  width: 152px;
  min-width: 152px;
  flex: 0 0 152px;
  border: 0;
  padding: 0 2px;
  background: transparent;
  font-variant-numeric: tabular-nums;
}

.date-range span {
  color: var(--muted);
}

.token-input {
  width: min(720px, 100%);
  flex: 1 1 520px;
  max-width: 760px;
  padding: 0 10px;
  resize: none;
  line-height: 32px;
  overflow: hidden;
  white-space: nowrap;
}

.primary-button,
.secondary-button,
.ghost-button {
  height: 32px;
  min-width: 82px;
  border-radius: 6px;
  padding: 0 14px;
}

.primary-button {
  border: 1px solid var(--blue);
  background: var(--blue);
  color: #fff;
  font-weight: 700;
}

.primary-button:hover {
  border-color: var(--blue-2);
  background: var(--blue-2);
}

.secondary-button,
.ghost-button {
  color: var(--text);
  background: #ffffff;
  border: 1px solid var(--line-strong);
}

.secondary-button:hover,
.ghost-button:hover {
  background: #eef4ff;
  border-color: #9db3df;
}

.ghost-button {
  min-width: 72px;
  color: var(--muted);
}

.status-line {
  min-height: 32px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 20px;
  color: var(--muted);
  font-size: 13px;
  background: #eef4ff;
  border-bottom: 1px solid #dde7fb;
}

.status-line .loading::before {
  content: "";
  width: 12px;
  height: 12px;
  display: inline-block;
  margin-right: 8px;
  border: 2px solid #bfdbfe;
  border-top-color: var(--blue);
  border-radius: 50%;
  vertical-align: -2px;
  animation: spin 0.8s linear infinite;
}

.batch-panel {
  margin: 12px 20px 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
}

.batch-header {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
}

.batch-header strong {
  color: var(--text);
  font-size: 14px;
}

.batch-header span {
  flex: 1;
  color: var(--muted);
  font-size: 13px;
}

.batch-body {
  padding: 0 12px 12px;
  border-top: 1px solid var(--line);
}

.batch-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 170px;
  gap: 12px;
  padding-top: 12px;
}

.batch-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.batch-field textarea,
.batch-field input {
  width: 100%;
  color: var(--text);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: none;
}

.batch-field textarea {
  min-height: 104px;
  padding: 8px 10px;
  resize: vertical;
  line-height: 1.45;
}

.batch-field input {
  height: 34px;
  padding: 0 10px;
}

.batch-field textarea:focus,
.batch-field input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.batch-companies {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 8px;
  margin-top: 12px;
  padding: 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
}

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

.batch-company input {
  flex: 0 0 auto;
}

.batch-company span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-inline {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 13px;
}

.batch-progress {
  min-width: 0;
}

#batchProgressMeta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  color: var(--muted);
  font-size: 12px;
}

.progress-bar {
  height: 6px;
  overflow: hidden;
  background: #e2e8f0;
  border-radius: 3px;
}

.progress-bar span {
  width: 0%;
  height: 100%;
  display: block;
  background: var(--blue);
  transition: width 0.2s ease;
}

.batch-task-list {
  border-bottom: 1px solid var(--line);
}

.batch-task,
.batch-task-heading {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) 88px minmax(0, 1fr) 66px 32px;
  gap: 16px;
  align-items: center;
  font-size: 13px;
}

.batch-task-heading {
  margin-top: 26px;
  padding: 10px 12px;
  color: var(--muted);
  background: var(--panel-2);
  border-block: 1px solid var(--line);
  font-size: 12px;
}

.batch-task {
  min-height: 66px;
  padding: 12px;
  border-top: 1px solid var(--line);
}

.batch-task:first-child { border-top: 0; }

.batch-task-name,
.batch-task-message {
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.7;
}

.batch-task-name { font-weight: 500; }
.batch-task-message { color: var(--muted); }
.batch-task-message.is-error { color: #b42318; }

.batch-task-elapsed {
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}

.batch-task-detail {
  grid-column: 1 / -1;
  padding: 12px 14px;
  background: var(--panel-2);
  border-left: 2px solid var(--line-strong);
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 12px;
}

.batch-status {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 7px;
  border-radius: 4px;
  color: #596579;
  background: #f0f2f5;
  font-size: 12px;
  white-space: nowrap;
}

.batch-status.success {
  color: #166534;
  background: #dcfce7;
}

.batch-status.failed {
  color: #991b1b;
  background: #fee2e2;
}

.batch-status.collecting,
.batch-status.calculating,
.batch-status.running {
  color: #1d4ed8;
  background: #dbeafe;
}

.batch-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.38);
}

.batch-dialog {
  width: min(1040px, calc(100vw - 48px));
  height: min(690px, calc(100dvh - 48px));
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.22);
}

.batch-dialog-head,
.batch-dialog-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
}

.batch-dialog-head {
  justify-content: space-between;
}

.batch-dialog-head strong {
  display: block;
  font-size: 18px;
}

.batch-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 16px; }
#batchModalSubtitle { color: var(--muted); font-size: 12px; }
#batchSummary,
.batch-inline-status {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.batch-inline-status.error {
  color: #b42318;
}

.batch-dialog-body {
  min-height: 0;
  overflow: auto;
  padding: 24px;
  overscroll-behavior: contain;
}

.batch-dialog-foot {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

#batchSummary {
  margin-right: auto;
}

.batch-footer-actions { display: flex; align-items: center; gap: 10px; }
.batch-dialog-foot { min-height: 70px; background: #fcfdff; }
.batch-modal.db-update-mode #batchSetupTab {
  display: none;
}

.batch-history-list { border-top: 1px solid var(--line); }
.batch-history-row { display: grid; grid-template-columns: minmax(0, 1fr) 80px 40px; gap: 16px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--line); }
.batch-history-copy { display: grid; gap: 6px; min-width: 0; overflow-wrap: anywhere; }
.batch-history-copy strong { font-size: 14px; }
.batch-history-copy span { font-size: 13px; }
.batch-history-copy small, .batch-history-notice { color: var(--muted); font-size: 12px; }
.batch-history-status { font-size: 12px; text-align: center; }
.batch-history-status.running { color: #245fe5; }
.batch-history-status.success { color: #08784b; }
.batch-history-status.failed { color: #b54039; }
.batch-history-pagination { display: flex; gap: 8px; align-items: center; justify-content: flex-end; font-size: 12px; }
@media (max-width: 600px) {
  .batch-history-row { grid-template-columns: minmax(0, 1fr) 56px 36px; gap: 8px; }
  .batch-history-copy small { line-height: 1.6; }
}

.batch-config-row {
  display: grid;
  grid-template-columns: minmax(0, 420px) minmax(0, 1fr);
  align-items: start;
  gap: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.batch-date-range {
  width: 100%;
  min-width: 0;
}

.batch-date-range input {
  flex: 1 1 0;
  min-width: 0;
}

.batch-advanced { justify-self: end; padding-top: 24px; }
.batch-advanced summary,
.batch-run-details summary {
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  cursor: pointer;
  font-size: 12px;
  color: var(--muted);
}
.batch-modal summary::-webkit-details-marker { display: none; }
.batch-advanced .batch-field { margin-top: 12px; }
.batch-advanced input { width: 150px; }

.batch-draft-section {
  margin-bottom: 16px;
}

.batch-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 20px 0 14px;
}

.batch-section-head h2 { margin: 0; font-size: 14px; }

.batch-draft-list {
  display: grid;
  gap: 10px;
}

.batch-draft {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel-2);
}

.batch-draft-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 138px;
  align-items: end;
  gap: 12px;
}

.batch-draft .batch-field textarea {
  height: 76px;
  min-height: 76px;
  resize: vertical;
}

.batch-draft-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.batch-inline-status:empty { display: none; }
.batch-group-list {
  border-top: 1px solid var(--line);
}

.batch-group {
  border-bottom: 1px solid var(--line);
}

.batch-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
}

.batch-group-head strong {
  display: block;
  font-size: 13px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.batch-group-head > div:first-child { flex: 1; min-width: 0; }
.batch-group-head .batch-group-caption {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}

.batch-group-actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
}

.batch-unit-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px 24px;
  padding: 0 0 16px;
}

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

.batch-unit.readonly {
  padding: 6px 0;
}

.batch-unit span {
  min-width: 0;
  overflow-wrap: anywhere;
}

body.batch-modal-open { overflow: hidden; }
.batch-modal button { min-height: 34px; font-size: 13px; }
.batch-modal svg { width: 16px; height: 16px; flex: 0 0 16px; stroke-width: 1.8; }
.batch-button,
.batch-text-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.batch-icon-button {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.batch-icon-button:hover:not(:disabled) { background: #eef2f7; color: var(--text); }
.batch-icon-button:disabled { opacity: .4; cursor: not-allowed; }
.batch-text-button { padding: 0; border: 0; background: transparent; color: var(--blue); cursor: pointer; }
.batch-modal :focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.batch-tabs { display: flex; gap: 28px; padding: 0 24px; border-bottom: 1px solid var(--line); }
.batch-tab { display: flex; align-items: center; gap: 8px; height: 48px; padding: 0 2px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); cursor: pointer; }
.batch-tab.active { border-bottom-color: var(--blue); color: var(--blue); font-weight: 600; }
.batch-tab:disabled { opacity: .45; cursor: not-allowed; }
.batch-tab-count { min-width: 20px; padding: 1px 5px; text-align: center; border-radius: 4px; color: var(--muted); background: #eef2f7; font-size: 11px; }
.batch-tab.active .batch-tab-count { background: #eaf1ff; color: var(--blue); }
.batch-empty { display: grid; justify-items: center; gap: 10px; padding: 32px 12px; color: var(--muted); font-size: 13px; }
.batch-empty svg { width: 28px; height: 28px; color: #94a3b8; }
.batch-outcome { display: flex; align-items: flex-start; gap: 16px; margin: 4px 0 26px; }
.batch-outcome-icon { width: 44px; height: 44px; flex: 0 0 44px; display: grid; place-items: center; color: var(--blue); background: #edf3ff; border-radius: 6px; }
.batch-outcome-icon svg { width: 24px; height: 24px; }
.batch-progress.success .batch-outcome-icon { color: var(--green); background: #ecf9f0; }
.batch-progress.failed .batch-outcome-icon { color: #b42318; background: #fff1f0; }
.batch-progress.partial .batch-outcome-icon { color: #946200; background: #fff8e8; }
.batch-outcome-copy { min-width: 0; }
#batchProgressTitle { font-size: 18px; line-height: 1.5; }
#batchOutcomeNote { margin: 5px 0 10px; line-height: 1.7; font-size: 13px; overflow-wrap: anywhere; color: #475569; }
.batch-progress-caption { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 8px; font-size: 12px; color: var(--muted); }
.batch-progress.success .progress-bar span { background: var(--green); }
.batch-progress.failed .progress-bar span { background: #c63333; }
.batch-progress.partial .progress-bar span { background: #c38b26; }
.batch-status svg { width: 13px; height: 13px; flex-basis: 13px; }
.batch-spin { animation: spin 1.6s linear infinite; }
.batch-run-details { margin-top: 16px; }
.batch-run-details[open] summary svg { transform: rotate(90deg); }
.batch-run-details dl,
.batch-task-detail dl { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 12px 0 0; font-size: 12px; color: var(--muted); }
.batch-run-details dl > div,
.batch-task-detail dl > div { display: flex; flex-wrap: wrap; gap: 8px; }
.batch-run-details dt,
.batch-task-detail dt { color: var(--muted); }
.batch-run-details dd,
.batch-task-detail dd { margin: 0; color: #475569; overflow-wrap: anywhere; }
.batch-task-detail p { margin: 10px 0 0; line-height: 1.7; }
.batch-notice { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; padding: 10px 12px; margin-top: 16px; background: #fff8e8; color: #946200; font-size: 12px; }
@media (max-width: 680px) {
  .batch-modal { padding: 8px; }
  .batch-dialog { width: calc(100vw - 16px); height: calc(100dvh - 16px); }
  .batch-dialog-head,
  .batch-dialog-foot { padding: 12px 16px; }
  .batch-dialog-head strong { font-size: 16px; }
  .batch-heading { display: grid; gap: 4px; }
  .batch-tabs { padding: 0 12px; gap: 12px; }
  .batch-tab { gap: 4px; font-size: 12px; white-space: nowrap; }
  .batch-dialog-body { padding: 20px 16px; }
  .batch-config-row { grid-template-columns: minmax(0, 1fr); gap: 10px; padding-bottom: 16px; }
  .batch-advanced { padding-top: 0; }
  .batch-date-range input { padding: 0 4px; font-size: 12px; }
  .batch-draft-main { grid-template-columns: minmax(0, 1fr); }
  .batch-task-heading { display: none; }
  .batch-task-list { margin-top: 22px; border-top: 1px solid var(--line); }
  .batch-task { grid-template-columns: minmax(0, 1fr) 78px 32px; gap: 8px 10px; padding: 14px 0; }
  .batch-task-name { grid-column: 1; }
  .batch-task .batch-status { grid-column: 2; grid-row: 1; justify-self: end; }
  .batch-task .batch-task-toggle { grid-column: 3; grid-row: 1; }
  .batch-task-message { grid-column: 1 / 3; grid-row: 2; }
  .batch-task-elapsed { grid-column: 3; grid-row: 2; }
  .batch-group-head { gap: 10px; }
  .batch-group-actions { gap: 4px; }
  .batch-group-actions .batch-text-button { font-size: 12px; }
  .batch-group-actions .batch-text-button > span { display: none; }
  .batch-dialog-foot { flex-wrap: wrap; gap: 10px; }
  #batchSummary { width: 100%; margin: 0; font-size: 12px; }
  .batch-footer-actions { width: 100%; justify-content: flex-end; }
  .batch-outcome { gap: 12px; }
  #batchProgressTitle { font-size: 16px; }
  #batchProgressMeta { display: grid; gap: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .batch-modal .batch-spin { animation: none; }
  .batch-modal .progress-bar span { transition: none; }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.metric-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 20px 20px;
}

.metric-card {
  min-height: 118px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 0.8fr);
  column-gap: 22px;
  align-content: center;
  padding: 20px 28px;
  position: relative;
  background:
    linear-gradient(180deg, rgba(248, 250, 252, 0.9), rgba(255, 255, 255, 0.98)),
    var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--blue);
  border-radius: 8px 0 0 8px;
}

.metric-card h2 {
  grid-column: 1;
  margin: 0 0 8px;
  color: var(--text);
  font-size: 16px;
}

.metric-main {
  grid-column: 1;
  color: var(--blue);
  font-size: 22px;
  font-weight: 800;
}

.metric-main::after {
  content: " 万元";
  font-size: 13px;
  color: var(--muted);
  font-weight: 400;
}

.metric-card dl {
  grid-column: 2;
  grid-row: 1 / span 2;
  margin: 0;
  display: grid;
  gap: 9px;
  align-content: center;
}

.metric-card dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-weight: 700;
}

.metric-card dd {
  margin: 0;
  color: #334155;
  font-weight: 700;
}

.metric-card dd .unit {
  margin-left: 6px;
  color: var(--muted);
}

.accent-amber .metric-main {
  color: var(--amber);
}

.accent-amber::before {
  background: var(--amber);
}

.accent-teal .metric-main {
  color: var(--teal);
}

.accent-teal::before {
  background: var(--teal);
}

.sms-section {
  margin: 18px 20px 28px;
  padding: 18px 22px 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.sms-hero {
  min-height: 112px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.sms-hero h1 {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 24px;
}

.sms-hero p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.eyebrow {
  margin-bottom: 6px !important;
  color: var(--blue) !important;
  font-size: 12px;
  font-weight: 800;
}

.sms-summary-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.sms-summary-row article {
  min-height: 74px;
  display: grid;
  align-content: center;
  gap: 8px;
  padding: 14px 16px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.sms-summary-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.sms-summary-row strong {
  color: var(--text);
  font-size: 16px;
}

.admin-page {
  margin: 18px 20px 28px;
}

.admin-hero,
.import-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.admin-hero {
  min-height: 112px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 22px;
}

.admin-hero h1 {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 24px;
}

.admin-hero p {
  max-width: 820px;
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.import-card {
  margin-top: 14px;
  padding: 16px;
}

.import-actions {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}

.file-picker {
  min-width: 360px;
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.file-picker input {
  height: 34px;
  padding: 5px 10px;
  color: var(--text);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.import-status {
  min-height: 30px;
  display: flex;
  align-items: center;
  margin-top: 12px;
  padding: 0 10px;
  color: var(--muted);
  background: #eef4ff;
  border: 1px solid #dce7fb;
  border-radius: 6px;
}

.import-status.error {
  color: var(--danger);
  background: #fff1f2;
  border-color: #fecdd3;
}

.import-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.summary-chip {
  height: 26px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  color: var(--muted);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
}

.summary-chip strong {
  color: var(--text);
}

.import-table-wrap {
  max-height: calc(100vh - 330px);
  margin-top: 12px;
}

#parameterImportTable {
  min-width: 1320px;
}

#parameterImportTable th,
#parameterImportTable td {
  height: auto;
  padding: 9px 10px;
  text-align: left;
  white-space: normal;
  vertical-align: top;
}

.import-warning-row td {
  background: #fff7ed;
}

.import-warning-cell {
  min-width: 260px;
  color: #9a3412;
}

.toolbar-subtitle {
  color: var(--muted);
  font-size: 12px;
}

.sms-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.sms-device-panel {
  padding: 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.sms-events-panel {
  min-width: 0;
  padding: 12px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.sms-panel-title {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.sms-device-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 8px;
}

.sms-device-item {
  min-height: 108px;
  padding: 10px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.sms-device-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  font-weight: 700;
}

.sms-device-badges {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.sms-device-meta,
.sms-empty {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.sms-badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  color: var(--green);
  background: #dcfce7;
  font-size: 12px;
  font-weight: 700;
}

.sms-badge.off {
  color: var(--danger);
  background: #fee2e2;
}

.sms-badge.online {
  color: var(--green);
  background: #dcfce7;
}

.sms-badge.offline {
  color: #b45309;
  background: #fef3c7;
}

.sms-table-wrap {
  max-height: calc(100vh - 330px);
  overflow-x: hidden;
}

.table-wrap.sms-table-wrap {
  overflow-x: hidden;
}

#smsTable {
  min-width: 0;
  table-layout: auto;
}

#smsTable th,
#smsTable td {
  height: auto;
  padding: 10px 12px;
  text-align: left;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  vertical-align: top;
}

#smsTable th {
  white-space: nowrap;
}

#smsTable td:nth-child(-n + 4) {
  white-space: nowrap;
}

.sms-code {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  height: 26px;
  padding: 0 10px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #0f172a;
  font-family: Consolas, "Courier New", monospace;
  font-weight: 700;
  letter-spacing: 0;
}

.sms-code.revealed {
  color: #ffffff;
  background: var(--blue);
}

.sms-body {
  max-width: 360px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  word-break: break-all;
}

.sms-body.inline {
  max-width: none;
  margin-top: 0;
  color: var(--text);
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: normal;
}

.sms-expired-row td {
  color: var(--muted);
  background: #f8fafc;
}

.sms-reveal-button {
  height: 28px;
  padding: 0 10px;
  color: var(--blue);
  background: #ffffff;
  border: 1px solid #9db3df;
  border-radius: 6px;
  font-weight: 700;
}

.table-section {
  margin: 0 20px 28px;
  padding: 18px 22px 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.section-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.toolbar-title {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.toolbar-title strong {
  font-size: 15px;
}

.tiny-help {
  width: 18px;
  height: 18px;
  padding: 0;
  border-radius: 50%;
  color: var(--danger);
  border: 1px solid var(--danger);
  background: #fff;
  line-height: 16px;
}

.segmented {
  display: flex;
  gap: 8px;
}

.segmented button {
  height: 32px;
  padding: 0 12px;
  color: var(--blue);
  background: #ffffff;
  border: 1px solid #9db3df;
  border-radius: 6px;
  font-weight: 700;
}

.segmented button.active {
  color: #ffffff;
  background: var(--blue);
  border-color: var(--blue);
}

.spacer {
  flex: 1;
}

.column-manager {
  position: relative;
}

.column-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  width: 420px;
  max-height: min(560px, calc(100vh - 260px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  background: #ffffff;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.18);
}

.column-panel-head {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.column-list {
  min-height: 0;
  overflow: auto;
  padding: 10px 12px 12px;
}

.column-group + .column-group {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.column-group-title {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.column-group-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.column-option {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 8px;
  color: #334155;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 12px;
}

.column-option:hover {
  background: #f8fbff;
  border-color: #bfdbfe;
}

.column-option input {
  flex: 0 0 auto;
}

.column-option span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-wrap {
  width: 100%;
  max-height: calc(100vh - 330px);
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #ffffff;
}

table {
  width: 100%;
  min-width: 2920px;
  border-collapse: collapse;
  color: var(--text);
  table-layout: fixed;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eaf0f8;
  color: #0f172a;
  font-size: 12px;
  font-weight: 700;
}

thead tr:first-child th {
  height: 32px;
  text-align: center;
  background: #dbe5f1;
}

thead tr:nth-child(2) th {
  top: 32px;
  background: #f8fafc;
}

.group-start {
  border-left: 3px solid #7c8da6;
  box-shadow: inset 1px 0 0 #7c8da6;
}

.group-end {
  border-right: 3px solid #7c8da6;
  box-shadow: inset -1px 0 0 #7c8da6;
}

.group-start.group-end {
  box-shadow: inset 1px 0 0 #7c8da6, inset -1px 0 0 #7c8da6;
}

thead .group-heading {
  color: #0f172a;
  background: #dbe5f1;
}

thead th.sticky-col {
  z-index: 6;
}

thead tr:first-child th.sticky-col {
  z-index: 7;
}

tbody td.sticky-col {
  position: sticky;
  z-index: 2;
  background: #ffffff;
}

th,
td {
  height: 30px;
  padding: 0 9px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

td {
  background: #ffffff;
  text-align: right;
}

td:first-child,
th:first-child {
  text-align: left;
}

tbody tr:hover td {
  background: #f8fafc;
}

tbody tr:hover td.sticky-col {
  background: #f8fafc;
}

.total-row td {
  background: #eff6ff;
  color: #0f172a;
  font-weight: 700;
}

.total-row td.sticky-col {
  background: #eff6ff;
}

.total-row:hover td {
  background: #dbeafe;
}

.total-row:hover td.sticky-col {
  background: #dbeafe;
}

.expandable-row td:first-child {
  color: #1d4ed8;
  cursor: pointer;
  font-weight: 700;
}

.summary-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
}

.disclosure {
  flex: 0 0 auto;
  width: 16px;
  color: #64748b;
  font-size: 12px;
}

.child-row td {
  background: #fbfdff;
  color: #334155;
}

.child-row td.sticky-col {
  background: #fbfdff;
}

.child-row td:first-child {
  padding-left: 38px;
  color: #0f766e;
  font-weight: 700;
}

.child-row:hover td {
  background: #f0fdfa;
}

.child-row:hover td.sticky-col {
  background: #f0fdfa;
}

.simulated-row td {
  background: #fff7ed;
}

.simulated-row td.sticky-col {
  background: #fff7ed;
}

.simulated-row:hover td {
  background: #ffedd5;
}

.simulated-row:hover td.sticky-col {
  background: #ffedd5;
}

.mixed-source-row td {
  background: #fefce8;
}

.mixed-source-row td.sticky-col {
  background: #fefce8;
}

.mixed-source-row:hover td {
  background: #fef3c7;
}

.mixed-source-row:hover td.sticky-col {
  background: #fef3c7;
}

th.key-metric-cell,
td.key-metric-cell,
tbody tr:hover td.key-metric-cell,
.total-row td.key-metric-cell,
.total-row:hover td.key-metric-cell,
.child-row td.key-metric-cell,
.child-row:hover td.key-metric-cell,
.simulated-row td.key-metric-cell,
.simulated-row:hover td.key-metric-cell,
.mixed-source-row td.key-metric-cell,
.mixed-source-row:hover td.key-metric-cell {
  color: #991b1b;
  background: #fee2e2;
  font-weight: 800;
}

thead th.key-metric-cell {
  color: #7f1d1d;
  background: #fecaca;
}

.day-label::before {
  content: "";
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #0f766e;
}

.source-badge {
  min-width: 44px;
  height: 22px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  vertical-align: middle;
}

.source-badge.settlement {
  color: #166534;
  background: #dcfce7;
  border: 1px solid #86efac;
}

.source-badge.simulated {
  color: #9a3412;
  background: #ffedd5;
  border: 1px solid #fdba74;
}

.source-badge.mixed {
  color: #854d0e;
  background: #fef3c7;
  border: 1px solid #facc15;
}

.busy-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.34);
  backdrop-filter: blur(3px);
}

.busy-panel {
  width: min(420px, calc(100vw - 48px));
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 24px 28px;
  background: #ffffff;
  border: 1px solid #dbe5f2;
  border-radius: 8px;
  box-shadow: 0 22px 54px rgba(15, 23, 42, 0.22);
}

.busy-spinner {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border: 4px solid #dbeafe;
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.busy-copy {
  min-width: 0;
}

.busy-title {
  margin-bottom: 8px;
  color: #0f172a;
  font-size: 17px;
  font-weight: 800;
}

.busy-time {
  color: var(--blue);
  font-size: 14px;
  font-weight: 700;
}

.busy-note {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.empty-row td {
  height: 120px;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 1280px) {
  body {
    min-width: 980px;
  }

  .topbar {
    min-height: 96px;
    padding: 10px 18px;
  }

  .metric-card {
    padding: 22px 26px;
  }
}
.proxy-header, .proxy-section-heading, .proxy-header-actions, .proxy-actions, .proxy-pagination, .proxy-dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
body.proxy-admin-active { min-width: 0; }
.proxy-header { padding: 24px 28px; border-bottom: 1px solid var(--line); background: #fff; }
.proxy-header h1 { font-size: 24px; margin: 0 0 6px; }
.proxy-subtitle, .proxy-header-actions { color: #64748b; font-size: 13px; }
.proxy-channel, .proxy-route, .proxy-audit, .proxy-balance-section, .proxy-usage-section { padding: 24px 28px; border-bottom: 1px solid var(--line); background: #fff; }
.proxy-section-heading h2 { font-size: 18px; margin: 0; }
.proxy-balance-section h2 { border-left: 3px solid #2879ff; padding-left: 12px; }
.proxy-balance-scale { display: flex; justify-content: space-between; color: #7c8797; font-size: 12px; margin: 30px 0 10px; }
.proxy-balance-track { position: relative; background: #eaf1ff; height: 22px; border-radius: 6px; overflow: hidden; }
.proxy-balance-track > div { position: absolute; right: 0; top: 0; height: 100%; background: #2879ff; border-radius: 6px; width: 0; }
.proxy-balance-track.unknown { opacity: 0.5; }
.proxy-balance-bottom { display: flex; justify-content: space-between; gap: 20px; margin-top: 18px; align-items: flex-end; }
.proxy-balance-meta { display: grid; gap: 6px; color: #7c8797; font-size: 12px; line-height: 1.6; min-width: 0; }
#proxyBalanceError { color: #b54708; overflow-wrap: anywhere; }
.proxy-balance-number { display: grid; gap: 8px; text-align: right; font-size: 13px; flex-shrink: 0; }
.proxy-balance-number strong { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border: 1px solid #dce3ed; border-radius: 4px; font-size: 18px; font-weight: 500; }
.proxy-balance-number i { width: 16px; height: 16px; border-radius: 3px; background: #2879ff; margin-right: 4px; }
.proxy-live-summary { display: flex; flex-wrap: wrap; gap: 10px 32px; color: #6b778a; margin-top: 18px; font-size: 13px; }
.proxy-live-summary strong { color: #273449; font-weight: 600; margin-left: 6px; }
.proxy-date-controls { display: flex; align-items: center; gap: 8px; min-width: 0; }
.proxy-date-controls .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.proxy-date-controls input { height: 34px; width: 148px; min-width: 0; border: 1px solid #d6dfec; border-radius: 4px; background: #fff; padding: 5px 8px; font: inherit; font-size: 13px; color: #273449; }
.proxy-date-controls button { height: 34px; padding: 5px 12px; font-size: 13px; }
.proxy-chart-heading { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 28px; }
.proxy-chart-heading h3 { font-size: 14px; font-weight: 600; margin: 0; }
.proxy-trend-modes button { padding: 6px 12px; font-size: 13px; }
.proxy-chart-legend { display: flex; gap: 20px; font-size: 12px; color: #6b778a; }
.proxy-chart-legend span::before { content: ""; display: inline-block; width: 14px; height: 3px; vertical-align: middle; margin-right: 6px; background: #2879ff; }
.proxy-chart-legend .proxy-series-extracted::before { background: #dd8d14; }
.proxy-usage-chart { height: 232px; margin-top: 12px; overflow: hidden; }
.proxy-usage-chart svg { width: 100%; height: 100%; display: block; }
.proxy-usage-chart text { font-size: 12px; fill: #7c8797; }
.proxy-chart-grid { stroke: #e9edf3; stroke-width: 1; }
.proxy-chart-requests { stroke: #2879ff; fill: #2879ff; stroke-width: 2; }
.proxy-chart-extracted { stroke: #dd8d14; fill: #dd8d14; stroke-width: 2; }
.proxy-usage-chart polyline { fill: none; }
.proxy-chart-empty { height: 100%; display: grid; place-items: center; color: #7c8797; font-size: 14px; }
#proxyUsageCoverage { margin: 6px 0 0; line-height: 1.6; }
.proxy-channel-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.proxy-channel-heading { flex-wrap: wrap; }
.proxy-channel-heading button { display: inline-flex; align-items: center; gap: 8px; }
.proxy-channel-heading button svg { width: 18px; height: 18px; flex-shrink: 0; }
.proxy-recovery-hint { margin: 10px 0 0; color: #64748b; font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.proxy-reason { color: #b42318; margin: 14px 0 0; overflow-wrap: anywhere; }
.proxy-reason:empty { display: none; }
.proxy-badge { padding: 5px 10px; border-radius: 4px; background: #f1f5f9; color: #475569; font-size: 13px; font-weight: 600; }
.proxy-badge.success, .proxy-notice.success { color: #067647; background: #ecfdf3; }
.proxy-badge.danger, .proxy-notice.danger { color: #b42318; background: #fef3f2; }
.proxy-badge.warning { color: #93370d; background: #fff6e6; }
.proxy-notice { margin: 18px 28px 0; padding: 12px 16px; border-left: 3px solid currentColor; overflow-wrap: anywhere; }
.proxy-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 24px; gap: 20px; }
.proxy-metrics > div { display: grid; gap: 8px; padding-left: 16px; border-left: 2px solid #dce5f2; min-width: 0; }
.proxy-metrics span, .proxy-metrics small { font-size: 13px; color: #64748b; }
.proxy-metrics strong { font-size: 26px; color: #17253b; overflow-wrap: anywhere; }
.proxy-metrics > div:nth-child(2) { border-color: #12b76a; }
.proxy-metrics > div:nth-child(4) { border-color: #eaaa08; }
.proxy-actions { justify-content: flex-end; flex-wrap: wrap; }
.proxy-actions button { display: inline-flex; align-items: center; gap: 8px; }
.proxy-actions svg, .proxy-header svg, .proxy-pagination svg, .proxy-dialog svg { width: 18px; height: 18px; flex-shrink: 0; }
.proxy-details { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; margin: 26px 0 0; }
.proxy-details dt { color: #64748b; font-size: 13px; margin-bottom: 8px; }
.proxy-details dd { margin: 0; font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }
.proxy-table-wrap { overflow: auto; margin-top: 20px; }
.proxy-table-wrap table { width: 100%; min-width: 750px; border-collapse: collapse; table-layout: auto; font-size: 13px; }
.proxy-table-wrap th { background: #f6f8fb; color: #64748b; font-weight: 500; }
.proxy-table-wrap th, .proxy-table-wrap td { padding: 13px 12px; border-bottom: 1px solid #e9edf3; text-align: left; }
.proxy-ip-cell { font-family: Consolas, monospace; }
.proxy-empty { text-align: center !important; height: 100px; color: #64748b; }
.proxy-pagination { justify-content: flex-end; margin-top: 16px; color: #64748b; font-size: 13px; }
.proxy-dialog { width: 460px; max-width: calc(100vw - 32px); padding: 24px; border: 1px solid #dce5f2; border-radius: 8px; color: #17253b; }
.proxy-dialog::backdrop { background: rgb(15 23 42 / 40%); }
.proxy-dialog p { font-size: 14px; line-height: 1.7; }
.proxy-password-label { display: block; margin: 20px 0 8px; font-size: 14px; }
.proxy-dialog input[type="password"] { width: 100%; min-width: 0; height: 42px; padding: 8px 12px; border: 1px solid #c5cfde; border-radius: 6px; background: #fff; }
.proxy-dialog input[type="password"]:focus-visible { outline: 2px solid #bfdbfe; outline-offset: 1px; border-color: #2563eb; }
.proxy-provider-confirmation { display: flex; align-items: flex-start; gap: 8px; font-size: 14px; line-height: 1.6; }
.proxy-provider-confirmation input { width: 16px; height: 16px; flex-shrink: 0; margin-top: 3px; }
.proxy-dialog-actions { justify-content: flex-end; margin-top: 20px; }
#proxyAdminNav svg { width: 20px; height: 20px; flex-shrink: 0; }
.proxy-logout-icon { display: none; }
@media (max-width: 900px) {
  .proxy-metrics, .proxy-details { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .proxy-route > .proxy-section-heading { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 600px) {
  .proxy-admin-active .sidebar { width: 56px; flex-basis: 56px; padding-left: 6px; padding-right: 6px; transition: none; }
  .proxy-admin-active .sidebar-brand { padding: 0; min-height: 30px; }
  .proxy-admin-active .sidebar-brand > *, .proxy-admin-active .nav-label { display: none; }
  .proxy-admin-active .side-nav-item { justify-content: center; padding: 0; }
  .proxy-admin-active .sidebar-logout { display: grid; place-items: center; padding: 0; }
  .proxy-admin-active .proxy-logout-icon { display: block; width: 18px; height: 18px; }
  .proxy-header, .proxy-channel, .proxy-route, .proxy-audit, .proxy-balance-section, .proxy-usage-section { padding: 20px 16px; }
  .proxy-header { align-items: flex-start; flex-direction: column; }
  .proxy-header h1 { font-size: 22px; }
  .proxy-notice { margin-left: 16px; margin-right: 16px; }
  .proxy-actions { justify-content: flex-start; gap: 8px; }
  .proxy-actions button { padding-left: 10px; padding-right: 10px; font-size: 13px; }
  .proxy-details { grid-template-columns: minmax(0, 1fr); }
  .proxy-metrics { gap: 20px 12px; }
  .proxy-metrics strong { font-size: 24px; }
  .proxy-audit > .proxy-section-heading { flex-wrap: wrap; }
  .proxy-balance-section > .proxy-section-heading, .proxy-usage-section > .proxy-section-heading { flex-wrap: wrap; gap: 16px; }
  .proxy-balance-bottom { flex-direction: column-reverse; align-items: stretch; gap: 12px; }
  .proxy-balance-number { text-align: left; align-self: flex-end; }
  .proxy-usage-chart { height: 200px; }
  .proxy-live-summary { gap: 10px 16px; }
}
/* Official browser authorization management */
body.browser-authorization-active { min-width: 0; }
#browserAuthorizationNav svg { width: 20px; height: 20px; flex-shrink: 0; }
.authorization-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 28px 32px; border-bottom: 1px solid #dce3ec; background: #fff; }
.authorization-heading h1 { margin: 0 0 8px; font-size: 26px; }
.authorization-heading span { color: #6e7e93; font-size: 14px; }
.authorization-content { padding: 20px 32px; background: #fff; min-height: 70vh; }
.authorization-actions { display: flex; align-items: center; gap: 10px; }
.authorization-actions svg, .authorization-form button svg, .authorization-heading button svg, .authorization-dialog button svg { width: 18px; height: 18px; flex: 0 0 auto; }
.authorization-actions button, .authorization-form button, .authorization-dialog button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; }
.authorization-form { display: grid; grid-template-columns: minmax(180px,1fr) minmax(180px,1fr) auto auto; align-items: end; gap: 20px; padding: 16px 0 28px; border-bottom: 1px solid #dce3ec; }
.authorization-form label, .authorization-link label, .authorization-dialog label { display: flex; flex-direction: column; gap: 10px; color: #63748a; font-size: 14px; min-width: 0; }
.authorization-form input:not([type=checkbox]), .authorization-form select, .authorization-link input, .authorization-dialog input, .authorization-dialog textarea { box-sizing: border-box; width: 100%; height: 42px; padding: 8px 12px; border: 1px solid #cfd8e5; border-radius: 6px; color: #172235; background: white; font-size: 15px; }
.authorization-form .authorization-check { flex-direction: row; align-items: center; align-self: center; margin-top: 24px; color: #334155; }
.authorization-check input { width: 16px; height: 16px; }
.authorization-link { display: flex; align-items: end; gap: 12px; padding-top: 24px; }
.authorization-link label { flex: 1; }
.authorization-section { padding: 26px 0; border-bottom: 1px solid #dce3ec; }
.authorization-section h2 { margin: 0 0 20px; font-size: 18px; }
.authorization-table-scroll { overflow-x: auto; }
.authorization-table { width: 100%; min-width: 760px; border-collapse: collapse; font-size: 14px; table-layout: fixed; }
.authorization-table th { font-weight: 500; color: #63748a; text-align: left; background: #f5f7fa; }
.authorization-table td, .authorization-table th { padding: 16px; border-bottom: 1px solid #e3e8ef; min-width: 96px; overflow-wrap: anywhere; text-align: left; white-space: normal; }
.authorization-table th:nth-child(1) { width: 18%; }
.authorization-table th:nth-child(2) { width: 14%; }
.authorization-table th:nth-child(3) { width: 32%; }
.authorization-table th:nth-child(4) { width: 16%; }
.authorization-table th:nth-child(5) { width: 20%; }
.authorization-table td:nth-child(3) { min-width: 180px; }
.authorization-table .authorization-empty { text-align: center; padding: 48px 0; }
.authorization-status { display: inline-block; color: #2563eb; background: #edf3ff; padding: 5px 8px; border-radius: 4px; white-space: nowrap; }
.authorization-status.success { color: #087443; background: #e9f8ef; }
.authorization-status.failed { color: #b42318; background: #fff0ef; }
.authorization-empty { color: #728096; }
.authorization-agent-list > div { display: grid; grid-template-columns: minmax(0,1fr) auto auto; gap: 24px; align-items: center; padding: 12px 0; border-bottom: 1px solid #e3e8ef; }
.authorization-dialog { box-sizing: border-box; width: min(520px, calc(100% - 32px)); border: 1px solid #cfd8e5; border-radius: 8px; padding: 24px; color: #172235; }
.authorization-dialog::backdrop { background: rgba(10,20,35,.35); }
.authorization-dialog header { display: flex; align-items: center; justify-content: space-between; }
.authorization-dialog h2 { font-size: 20px; }
.authorization-dialog > button { margin: 18px 0; }
.authorization-dialog textarea { height: 128px; font-size: 13px; resize: vertical; }
#authorizationNotice, #authorizationPairNotice { min-height: 20px; font-size: 14px; color: #b42318; overflow-wrap: anywhere; margin: 0; }
@media (max-width: 1100px) { .authorization-form { grid-template-columns: minmax(0,1fr) minmax(0,1fr); } }
@media (max-width: 600px) { .authorization-heading { align-items: flex-start; padding: 20px 16px; flex-wrap: wrap; } .authorization-content { padding: 12px 16px; } .authorization-form { grid-template-columns: minmax(0,1fr); } .authorization-form .authorization-check { margin-top: 0; } }
@media (max-width: 600px) {
  .browser-authorization-active .sidebar { width: 56px; flex-basis: 56px; padding-left: 6px; padding-right: 6px; transition: none; }
  .browser-authorization-active .sidebar-brand { padding: 0; min-height: 30px; }
  .browser-authorization-active .sidebar-brand > *, .browser-authorization-active .nav-label { display: none; }
  .browser-authorization-active .side-nav-item { justify-content: center; padding: 0; }
  .browser-authorization-active .sidebar-logout { display: grid; place-items: center; padding: 0; }
  .browser-authorization-active .proxy-logout-icon { display: block; width: 18px; height: 18px; }
}
