/* ============================================================
   CloudFlare 批量管理控制台 · 浅色官方控制台风格
   ============================================================ */

:root {
  --bg: #f7f7f7;
  --bg-soft: #ffffff;
  --panel: #ffffff;
  --panel-strong: #ffffff;
  --panel-hover: #f5f5f5;
  --surface-subtle: #fafafa;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --text: #18181b;
  --text-dim: #52525b;
  --text-faint: #8b8b93;
  --accent: #f6821f;
  --accent-soft: #e8590c;
  --accent-2: #ea580c;
  --accent-bg: #fff4e6;
  --accent-border: #fcc28a;
  --success: #067647;
  --success-bg: #ecfdf3;
  --success-border: #abefc6;
  --warning: #b54708;
  --warning-bg: #fffaeb;
  --warning-border: #fedf89;
  --danger: #b42318;
  --danger-bg: #fef3f2;
  --danger-border: #fecdca;
  --info: #175cd3;
  --info-bg: #eff8ff;
  --info-border: #b2ddff;
  --link: #175cd3;
  --radius-lg: 14px;
  --radius: 10px;
  --radius-sm: 8px;
  --shadow-lg: 0 24px 60px -24px rgba(16, 24, 40, 0.28);
  --shadow-md: 0 1px 2px rgba(16, 24, 40, 0.05), 0 8px 24px -18px rgba(16, 24, 40, 0.18);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", "Cascadia Code", Consolas, monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

::selection {
  background: rgba(246, 130, 31, 0.22);
}

/* Ambient light */
.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 480px at 8% -12%, rgba(246, 130, 31, 0.1), transparent 62%),
    radial-gradient(760px 460px at 96% -6%, rgba(37, 99, 235, 0.06), transparent 62%),
    radial-gradient(800px 600px at 50% 112%, rgba(246, 130, 31, 0.05), transparent 60%);
}

/* ============================================================
   Layout
   ============================================================ */

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 14px 16px;
  border-right: 1px solid var(--border);
  background: #ffffff;
  overflow-y: auto;
  scrollbar-width: thin;
}

.content {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.view {
  flex: 1;
  width: 100%;
  max-width: 1480px;
  margin: 0 auto;
  padding: 26px 30px 60px;
  outline: none;
  animation: view-in 0.4s var(--ease);
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ============================================================
   Brand
   ============================================================ */

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 8px 18px;
}

.brand-mark {
  position: relative;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(140deg, #f79041, #f6821f 55%, #e8590c);
  box-shadow: 0 6px 16px -8px rgba(246, 130, 31, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.35) inset;
  flex: none;
  color: #fff;
}

.brand-mark svg {
  width: 20px;
  height: 20px;
}

.brand-title {
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--text);
}

.brand-sub {
  font-size: 10.5px;
  color: var(--text-faint);
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

/* ============================================================
   Navigation
   ============================================================ */

.nav-group {
  margin-top: 14px;
}

.nav-group-title {
  padding: 0 10px 7px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #a1a1aa;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  margin-bottom: 2px;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.16s var(--ease), color 0.16s var(--ease);
  user-select: none;
}

.nav-item svg {
  width: 16px;
  height: 16px;
  opacity: 0.72;
  flex: none;
  transition: opacity 0.16s;
}

.nav-item:hover {
  background: #f4f4f5;
  color: var(--text);
}

.nav-item:hover svg {
  opacity: 1;
}

.nav-item.active {
  background: var(--accent-bg);
  color: var(--accent-soft);
  box-shadow: 0 0 0 1px var(--accent-border) inset;
}

.nav-item.active svg {
  opacity: 1;
  color: var(--accent);
}

.nav-item.active::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}

.sidebar-foot {
  margin-top: auto;
  padding: 14px 10px 4px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-faint);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-foot .token-line {
  display: flex;
  align-items: center;
  gap: 7px;
}

/* ============================================================
   Topbar
   ============================================================ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 30px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(14px) saturate(1.2);
}

.topbar-title {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.topbar-title h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

.topbar-title span {
  font-size: 11px;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.menu-btn {
  display: none;
}

/* Zone picker */
.zone-picker {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 6px 10px 6px 12px;
  border-radius: 9px;
  border: 1px solid var(--border-strong);
  background: #ffffff;
  transition: border-color 0.16s, background 0.16s;
}

.zone-picker:hover,
.zone-picker:focus-within {
  border-color: var(--accent);
  background: #fffdfa;
}

.zone-picker .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #12b76a;
  flex: none;
}

.zone-picker select {
  appearance: none;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  min-width: 150px;
  max-width: 280px;
  cursor: pointer;
  padding-right: 18px;
}

.zone-picker select option {
  background: #ffffff;
  color: var(--text);
}

.zone-picker .chev {
  position: absolute;
  right: 9px;
  pointer-events: none;
  color: var(--text-faint);
  width: 14px;
  height: 14px;
}

.zone-picker-empty {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 3px 4px 3px 10px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  color: var(--text-dim);
}

.zone-picker-empty > svg {
  color: var(--accent);
  flex: none;
}

.zp-empty-text {
  font-size: 12.5px;
  font-weight: 550;
  white-space: nowrap;
}

.zp-loading {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
  flex: none;
}

.zone-picker-empty .btn {
  height: 26px;
  padding: 0 9px;
  font-size: 11.5px;
}

.tb-refresh {
  color: var(--text-dim);
}

.tb-refresh:hover {
  color: var(--text);
}

.tb-refresh-text {
  display: inline;
}

/* ============================================================
   Page header
   ============================================================ */

.page-head {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 20px;
}

.page-head h1 {
  margin: 0 0 4px;
  font-size: 24px;
  font-weight: 650;
  letter-spacing: -0.035em;
  line-height: 1.15;
  color: var(--text);
}

.page-head p {
  margin: 0;
  color: var(--text-dim);
  font-size: 13px;
  max-width: 780px;
}

.page-head .head-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* ============================================================
   Cards
   ============================================================ */

.card {
  position: relative;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: #ffffff;
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.card + .card {
  margin-top: 16px;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: #ffffff;
}

.card-head h3 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.card-head .desc {
  font-size: 11.5px;
  color: var(--text-faint);
  margin-top: 1px;
}

.card-head .head-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
}

.card-body {
  padding: 18px;
}

.card-body.tight {
  padding: 12px;
}

.card-body.flush {
  padding: 0;
}

.card-foot {
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  background: var(--surface-subtle);
}

.grid {
  display: grid;
  gap: 16px;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 1fr);
  gap: 18px;
  align-items: start;
}

/* Stat */
.stat {
  position: relative;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: #ffffff;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.stat .stat-label {
  font-size: 11.5px;
  color: var(--text-faint);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.stat .stat-value {
  font-size: 26px;
  font-weight: 650;
  letter-spacing: -0.03em;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.stat .stat-hint {
  font-size: 11.5px;
  color: var(--text-dim);
  margin-top: 2px;
}

.stat::before {
  content: "";
  position: absolute;
  right: -34px;
  top: -34px;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(246, 130, 31, 0.16), transparent 70%);
}

/* ============================================================
   Buttons
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 13px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: #ffffff;
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  font-weight: 550;
  letter-spacing: -0.005em;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s var(--ease), border-color 0.15s, box-shadow 0.15s, transform 0.15s;
  user-select: none;
}

.btn svg {
  width: 15px;
  height: 15px;
  flex: none;
}

.btn:hover {
  background: #fafafa;
  border-color: #a1a1aa;
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px rgba(246, 130, 31, 0.45);
}

.btn:disabled,
.btn.busy {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  border-color: #e8590c;
  background: linear-gradient(160deg, #f79041, #f6821f 60%, #e8590c);
  color: #ffffff;
  box-shadow: 0 6px 14px -8px rgba(232, 89, 12, 0.85);
}

.btn-primary:hover {
  background: linear-gradient(160deg, #f8984f, #f6821f 60%, #dc4f07);
  border-color: #d94f00;
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-dim);
}

.btn-ghost:hover {
  background: #f4f4f5;
  color: var(--text);
  border-color: transparent;
}

.btn-danger {
  border-color: var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger);
}

.btn-danger:hover {
  background: #fee4e2;
  border-color: #fda29b;
}

.btn-sm {
  height: 28px;
  padding: 0 9px;
  font-size: 11.5px;
  border-radius: 7px;
}

.btn-icon {
  width: 30px;
  padding: 0;
}

.btn-icon.btn-sm {
  width: 26px;
}

/* Busy spinner inside button */
.btn.busy::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  border-right-color: transparent;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ============================================================
   Forms
   ============================================================ */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.field:last-child {
  margin-bottom: 0;
}

.label {
  font-size: 11.5px;
  font-weight: 600;
  color: #3f3f46;
  letter-spacing: 0.01em;
}

.label .req {
  color: #d92d20;
  margin-left: 2px;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 34px;
  padding: 7px 11px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: #ffffff;
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.textarea {
  min-height: 92px;
  resize: vertical;
  line-height: 1.55;
  font-family: var(--mono);
  font-size: 12px;
}

.input::placeholder,
.textarea::placeholder {
  color: #a1a1aa;
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(246, 130, 31, 0.16);
}

.input:disabled,
.select:disabled,
.textarea:disabled {
  background: #f4f4f5;
  color: var(--text-faint);
  cursor: not-allowed;
}

.select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #71717a 50%),
    linear-gradient(135deg, #71717a 50%, transparent 50%);
  background-position: calc(100% - 16px) 15px, calc(100% - 11px) 15px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 30px;
  cursor: pointer;
}

.select option {
  background: #ffffff;
  color: var(--text);
}

.select[multiple] {
  background-image: none;
  padding-right: 11px;
  min-height: 120px;
}

.hint {
  font-size: 11px;
  color: var(--text-faint);
  line-height: 1.5;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 14px;
}

.form-grid .span-2 {
  grid-column: span 2;
}

.input-group {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.input-group .input {
  flex: 1;
}

/* Switch */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch .track {
  position: relative;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: #d4d4d8;
  border: 1px solid transparent;
  transition: background 0.2s var(--ease);
  flex: none;
}

.switch .track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.25);
  transition: transform 0.2s var(--ease);
}

.switch input:checked + .track {
  background: linear-gradient(140deg, #f79041, #e8590c);
}

.switch input:checked + .track::after {
  transform: translateX(16px);
}

.switch input:focus-visible + .track {
  box-shadow: 0 0 0 3px rgba(246, 130, 31, 0.25);
}

.switch input:disabled + .track {
  opacity: 0.45;
  cursor: not-allowed;
}

.switch .switch-label {
  font-size: 12.5px;
  color: var(--text-dim);
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.switch-row:last-child {
  border-bottom: 0;
}

.switch-row .row-info {
  min-width: 0;
}

.switch-row .row-title {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
}

.switch-row .row-desc {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 1px;
}

/* Checkbox */
.check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--text-dim);
}

.check input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ============================================================
   Table
   ============================================================ */

.table-wrap {
  width: 100%;
  overflow-x: auto;
  scrollbar-width: thin;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #667085;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: #fafafa;
  white-space: nowrap;
}

.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid #f0f0f1;
  vertical-align: middle;
  color: #475467;
}

.data-table tbody tr {
  transition: background 0.12s;
}

.data-table tbody tr:hover {
  background: #fafafa;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table td .strong {
  color: var(--text);
  font-weight: 600;
}

.data-table .mono {
  font-family: var(--mono);
  font-size: 11.5px;
}

.data-table .actions {
  display: flex;
  gap: 5px;
  justify-content: flex-end;
}

.data-table tr.selected {
  background: #fff7ed;
}

.data-table .col-check {
  width: 36px;
  padding-right: 0;
}

/* ============================================================
   Badges & dots
   ============================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.badge-muted {
  color: #52525b;
  border-color: #e4e4e7;
  background: #f4f4f5;
}

.badge-success {
  color: var(--success);
  border-color: var(--success-border);
  background: var(--success-bg);
}

.badge-warn {
  color: var(--warning);
  border-color: var(--warning-border);
  background: var(--warning-bg);
}

.badge-danger {
  color: var(--danger);
  border-color: var(--danger-border);
  background: var(--danger-bg);
}

.badge-accent {
  color: var(--accent-soft);
  border-color: var(--accent-border);
  background: var(--accent-bg);
}

.badge-info {
  color: var(--info);
  border-color: var(--info-border);
  background: var(--info-bg);
}

.badge-plain::before {
  display: none;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex: none;
}

.status-dot.ok {
  background: #12b76a;
}

.status-dot.warn {
  background: #f79009;
}

.status-dot.off {
  background: #a1a1aa;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  color: var(--text-dim);
  border: 1px solid var(--border);
  background: var(--surface-subtle);
}

/* ============================================================
   Empty / loading
   ============================================================ */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 46px 20px;
  gap: 8px;
  color: var(--text-faint);
}

.empty .empty-icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  margin-bottom: 6px;
  color: var(--text-dim);
}

.empty .empty-icon svg {
  width: 22px;
  height: 22px;
}

.empty h3 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-dim);
}

.empty p {
  margin: 0;
  font-size: 12px;
  max-width: 420px;
  line-height: 1.6;
}

.skeleton {
  border-radius: 8px;
  background: linear-gradient(90deg, #f0f0f1, #e4e4e7, #f0f0f1);
  background-size: 200% 100%;
  animation: shimmer-bg 1.4s infinite linear;
  height: 14px;
}

@keyframes shimmer-bg {
  to {
    background-position: -200% 0;
  }
}

.loading-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
}

/* ============================================================
   Toast
   ============================================================ */

.toast-root {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 9px;
  align-items: flex-end;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: 440px;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #ffffff;
  box-shadow: var(--shadow-lg);
  font-size: 12.5px;
  color: var(--text);
  opacity: 0;
  transform: translateY(10px) scale(0.98);
  transition: opacity 0.22s var(--ease), transform 0.22s var(--ease);
  pointer-events: auto;
}

.toast.in {
  opacity: 1;
  transform: none;
}

.toast-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
  background: var(--info);
}

.toast-success {
  border-color: var(--success-border);
}

.toast-success .toast-dot {
  background: #12b76a;
}

.toast-error {
  border-color: var(--danger-border);
}

.toast-error .toast-dot {
  background: #f04438;
}

.toast-warn {
  border-color: var(--warning-border);
}

.toast-warn .toast-dot {
  background: #f79009;
}

/* ============================================================
   Modal
   ============================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 8vh 20px 20px;
  background: rgba(16, 24, 40, 0.38);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 0.2s var(--ease);
  overflow-y: auto;
}

.modal-overlay.open {
  opacity: 1;
}

.modal {
  width: 100%;
  max-width: 520px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: #ffffff;
  box-shadow: var(--shadow-lg);
  transform: translateY(14px) scale(0.985);
  transition: transform 0.24s var(--ease);
  overflow: hidden;
}

.modal-overlay.open .modal {
  transform: none;
}

.modal-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--border);
}

.modal-head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.modal-close {
  margin-left: auto;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  border: 0;
  background: transparent;
  color: var(--text-faint);
  font-size: 18px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.modal-close:hover {
  background: #f4f4f5;
  color: var(--text);
}

.modal-body {
  padding: 18px;
  max-height: 68vh;
  overflow-y: auto;
}

.modal-text {
  margin: 0;
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.65;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 13px 18px;
  border-top: 1px solid var(--border);
  background: var(--surface-subtle);
}

/* ============================================================
   Tabs
   ============================================================ */

.tabs {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #f4f4f5;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.tab {
  padding: 6px 13px;
  border-radius: 7px;
  border: 0;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: 12px;
  font-weight: 550;
  cursor: pointer;
  transition: background 0.16s, color 0.16s, box-shadow 0.16s;
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  background: #ffffff;
  color: var(--text);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
}

/* ============================================================
   Misc
   ============================================================ */

.mono {
  font-family: var(--mono);
}

.muted {
  color: var(--text-faint);
}

.small {
  font-size: 11.5px;
}

.hidden {
  display: none !important;
}

.hr {
  height: 1px;
  background: var(--border);
  border: 0;
  margin: 16px 0;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.toolbar .grow {
  flex: 1;
}

.inline-fields {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.inline-fields .field {
  margin-bottom: 0;
  flex: 1;
  min-width: 150px;
}

.code {
  font-family: var(--mono);
  font-size: 11.5px;
  padding: 12px 14px;
  border-radius: 9px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #334155;
  overflow-x: auto;
  white-space: pre;
  line-height: 1.6;
}

.kv {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 8px 12px;
  font-size: 12px;
}

.kv dt {
  color: var(--text-faint);
}

.kv dd {
  margin: 0;
  color: var(--text-dim);
  word-break: break-all;
}

.zone-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.zone-avatar {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
  background: linear-gradient(145deg, #f79041, #e8590c);
  border: 1px solid rgba(232, 89, 12, 0.25);
  flex: none;
}

.progress {
  height: 6px;
  border-radius: 999px;
  background: #eaecf0;
  overflow: hidden;
}

.progress > i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #f79041, #e8590c);
  transition: width 0.25s var(--ease);
}

/* Batch result */
.op-result {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-subtle);
  padding: 12px 14px;
  margin-top: 14px;
  animation: view-in 0.3s var(--ease);
}

.op-result .op-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--text);
}

.op-result .op-stats {
  display: flex;
  gap: 16px;
  margin-left: auto;
  font-size: 11.5px;
  color: var(--text-dim);
}

.op-result .op-stats b {
  color: var(--text);
}

.op-list {
  margin-top: 10px;
  max-height: 260px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.op-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 7px;
  font-size: 11.5px;
  background: #ffffff;
  border: 1px solid #f0f0f1;
  color: var(--text-dim);
}

.op-item .op-idx {
  color: var(--text-faint);
  font-family: var(--mono);
  font-size: 10.5px;
  min-width: 26px;
}

.op-item.err {
  background: var(--danger-bg);
  border-color: var(--danger-border);
  color: var(--danger);
}

.op-item.ok .op-check {
  color: #12b76a;
}

.op-item.err .op-check {
  color: #f04438;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--text-faint);
}

/* Zone chips / selection */
.zone-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.zone-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #ffffff;
  font-size: 11.5px;
  color: var(--text-dim);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.zone-chip:hover {
  border-color: #a1a1aa;
}

.zone-chip.on {
  border-color: var(--accent);
  background: var(--accent-bg);
  color: var(--accent-soft);
  font-weight: 600;
}

/* Settings value editor */
.setting-row {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.setting-row:last-child {
  border-bottom: 0;
}

.setting-row .setting-name {
  font-size: 12.5px;
  font-weight: 550;
  color: var(--text);
}

.setting-row .setting-id {
  font-size: 10.5px;
  color: #a1a1aa;
  font-family: var(--mono);
}

.setting-row .setting-ctl {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
}

.settings-label {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 12.5px;
  color: var(--text-dim);
}

/* ============================================================
   Responsive
   ============================================================ */

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(16, 24, 40, 0.35);
  opacity: 0;
  transition: opacity 0.2s;
}

@media (max-width: 1100px) {
  .split {
    grid-template-columns: minmax(0, 1fr);
  }
  .grid-3,
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 50;
    width: 262px;
    transform: translateX(-105%);
    transition: transform 0.26s var(--ease);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open {
    transform: none;
  }
  .sidebar-overlay.show {
    display: block;
    opacity: 1;
  }
  .menu-btn {
    display: inline-flex;
  }
  .topbar {
    padding: 11px 16px;
  }
  .view {
    padding: 18px 16px 50px;
  }
  .page-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .page-head .head-actions {
    margin-left: 0;
  }
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: minmax(0, 1fr);
  }
  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .form-grid .span-2 {
    grid-column: span 1;
  }
  .zone-picker select {
    max-width: 150px;
  }
  .setting-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }
  .setting-row .setting-ctl {
    justify-content: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #d4d4d8;
  border-radius: 999px;
  border: 3px solid #ffffff;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background: #a1a1aa;
  background-clip: content-box;
}
@media (max-width: 900px) {
  .tb-refresh-text {
    display: none;
  }
}
/* ============================================================
   Custom zone dropdown
   ============================================================ */

.zone-picker-wrap {
  position: relative;
  display: inline-flex;
}

.zone-picker.zp-trigger {
  font: inherit;
  cursor: pointer;
  text-align: left;
  appearance: none;
  padding-right: 28px;
}

.zp-trigger.open {
  border-color: var(--accent);
  background: #fffdfa;
}

.zone-picker .chev {
  transition: transform 0.18s var(--ease);
}

.zp-trigger.open .chev {
  transform: rotate(180deg);
}

.zp-current {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--text);
}

.zp-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 90;
  width: 330px;
  max-width: calc(100vw - 24px);
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 24px 60px -24px rgba(16, 24, 40, 0.35), 0 2px 6px rgba(16, 24, 40, 0.06);
  overflow: hidden;
  animation: zp-in 0.16s var(--ease);
}

.zp-menu[hidden] {
  display: none;
}

@keyframes zp-in {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.zp-menu-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px 7px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.zp-count {
  color: var(--text-faint);
  font-weight: 500;
}

.zp-search {
  padding: 0 10px 8px;
}

.zp-search .input {
  height: 32px;
  font-size: 12px;
}

.zp-options {
  max-height: 300px;
  overflow-y: auto;
  padding: 4px 6px 8px;
  border-top: 1px solid var(--border);
}

.zp-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
  transition: background 0.14s, color 0.14s;
}

.zp-option:hover {
  background: #f5f5f5;
}

.zp-option.selected {
  background: var(--accent-bg);
  color: var(--accent-soft);
}

.zp-option-main {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.zp-option-name {
  font-family: var(--mono);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.zp-tag {
  flex: none;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 10px;
  line-height: 1.5;
  white-space: nowrap;
}

.zp-tag.warn {
  color: var(--warning);
  background: var(--warning-bg);
  border-color: var(--warning-border);
}

.zp-tag.muted {
  color: var(--text-faint);
  background: var(--surface-subtle);
  border-color: var(--border);
}

.zp-check {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  color: var(--accent);
  flex: none;
}

.zp-none {
  padding: 20px;
  text-align: center;
  font-size: 12px;
  color: var(--text-faint);
}
.zp-trigger.batch .dot {
  background: var(--accent);
}

.zp-option-batch {
  background: linear-gradient(90deg, var(--accent-bg), #ffffff);
  margin-bottom: 4px;
}

.zp-option-batch:hover {
  background: #ffedd5;
}

.zp-option-batch.selected {
  background: var(--accent-bg);
}

.zp-batch-icon {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  color: var(--accent);
  flex: none;
}

.zp-batch-name {
  font-family: var(--font);
  font-weight: 600;
}

.zp-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 6px 6px;
}
.account-badge {
  color: var(--text-dim);
  max-width: 220px;
}

.account-badge-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 170px;
}

@media (max-width: 1100px) {
  .account-badge-text {
    display: none;
  }
}
/* ============================================================
   Login
   ============================================================ */

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(900px 480px at 12% -10%, rgba(246, 130, 31, 0.14), transparent 62%),
    radial-gradient(760px 460px at 96% 0%, rgba(37, 99, 235, 0.08), transparent 62%),
    #f7f7f7;
}

.login-card {
  width: 100%;
  max-width: 380px;
  padding: 28px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: #ffffff;
  box-shadow: var(--shadow-lg);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 22px;
}

.login-brand .brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
}

.login-title {
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--text);
}

.login-sub {
  font-size: 11.5px;
  color: var(--text-faint);
  margin-top: 1px;
}

.login-card .field {
  margin-bottom: 14px;
}

.login-btn {
  width: 100%;
  height: 40px;
  margin-top: 4px;
}

.login-error {
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 12px;
  line-height: 1.5;
}

.login-hint {
  margin-top: 16px;
  font-size: 11px;
  color: var(--text-faint);
  line-height: 1.65;
}

.sidebar-foot-actions {
  display: flex;
  gap: 14px;
  margin-top: 2px;
}

.side-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-dim);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

.side-link:hover {
  color: var(--accent);
  text-decoration: underline;
}
.login-tabs {
  display: flex;
  margin: 0 0 16px;
}

.login-tabs .tab {
  flex: 1;
  text-align: center;
}

.invite-code-box {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 12px 14px;
  border: 1px dashed var(--accent-border);
  border-radius: 10px;
  background: var(--accent-bg);
}

.invite-code {
  flex: 1;
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--accent-soft);
}
.op-item.warn {
  background: var(--warning-bg);
  border-color: var(--warning-border);
  color: var(--warning);
}

.op-item.warn .op-check {
  color: #f79009;
}