/* ============================================================
   Design tokens — keep in sync with login page palette.
   ============================================================ */
:root {
  --c-text:        #0f172a;
  --c-text-soft:   #475569;
  --c-muted:       #94a3b8;
  --c-border:      #e2e8f0;
  --c-border-soft: #eef1f5;
  --c-surface:     #ffffff;
  --c-surface-2:   #f8fafc;
  --c-bg:          #f5f7fb;
  --c-brand:       #0066cc;
  --c-brand-2:     #4f46e5;
  --c-brand-soft:  rgba(0,102,204,0.10);
  --c-success:     #16a34a;
  --c-warn:        #d97706;
  --c-danger:      #dc2626;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(15,23,42,0.04), 0 1px 1px rgba(15,23,42,0.03);
  --shadow-md: 0 4px 14px -4px rgba(15,23,42,0.10), 0 2px 6px -2px rgba(15,23,42,0.06);
  --shadow-lg: 0 16px 40px -16px rgba(15,23,42,0.18), 0 6px 16px -8px rgba(15,23,42,0.08);
}

* { box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue",
               "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  margin: 0;
  padding: 0;
  color: var(--c-text);
  font-size: 14px;
  line-height: 1.55;
  min-height: 100vh;
  background:
    radial-gradient(900px 500px at 100% -10%, rgba(99,102,241,0.07), transparent 60%),
    radial-gradient(700px 500px at -10% 110%, rgba(0,102,204,0.06), transparent 55%),
    linear-gradient(180deg, #f7f9fc 0%, #eef2f7 100%);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--c-brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--c-muted); font-size: 13px; }

/* ============================================================
   Header
   ============================================================ */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255,255,255,0.78);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid rgba(15,23,42,0.06);
}
.app-header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 28px;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--c-text);
  font-weight: 700;
  letter-spacing: -0.2px;
}
.brand:hover { text-decoration: none; }
.brand-logo {
  width: 32px; height: 32px;
  border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 16px;
  background: linear-gradient(135deg, var(--c-brand) 0%, #6366f1 100%);
  box-shadow: 0 4px 10px -3px rgba(0,102,204,0.45),
              inset 0 1px 0 rgba(255,255,255,0.3);
  letter-spacing: -0.5px;
}
.brand-name { font-size: 15px; }

.app-nav { display: flex; gap: 4px; }
.app-nav a {
  color: var(--c-text-soft);
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  transition: background 140ms, color 140ms;
}
.app-nav a:hover { background: rgba(15,23,42,0.05); color: var(--c-text); text-decoration: none; }
.app-nav a.active {
  color: var(--c-brand);
  background: var(--c-brand-soft);
  font-weight: 600;
}

.user-bar {
  margin-left: auto;
  display: flex; align-items: center; gap: 10px;
}
.user-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--c-brand) 0%, var(--c-brand-2) 100%);
  color: #fff; font-weight: 600; font-size: 12px;
  box-shadow: 0 2px 6px -2px rgba(0,102,204,0.5);
}
.user-bar .user-email { color: var(--c-text-soft); font-size: 13px; }
.logout-form { margin: 0; display: inline; }
.logout-form button {
  background: transparent;
  color: var(--c-text-soft);
  border: 1px solid var(--c-border);
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 140ms, border-color 140ms, color 140ms;
}
.logout-form button:hover { color: var(--c-danger); border-color: #fecaca; background: #fef2f2; }

/* ============================================================
   Main + typography
   ============================================================ */
main { padding: 28px 24px 48px; max-width: 1280px; margin: 0 auto; }
h2 { font-size: 22px; margin: 0 0 18px; font-weight: 700; letter-spacing: -0.2px; }
h3 { font-size: 15px; margin: 28px 0 10px; font-weight: 600; color: var(--c-text); }

/* ============================================================
   Surface containers (table-card, panel)
   ============================================================ */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  margin-bottom: 18px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
th, td {
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid var(--c-border-soft);
}
tr:last-child td { border-bottom: 0; }
th {
  background: var(--c-surface-2);
  font-weight: 600;
  color: var(--c-text-soft);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--c-border);
}
tbody tr { transition: background 100ms; }
tbody tr:hover td { background: #fafbfd; }

.empty {
  color: var(--c-muted);
  padding: 36px 20px;
  text-align: center;
  background: var(--c-surface);
  border: 1px dashed var(--c-border);
  border-radius: var(--r-lg);
  font-size: 13px;
}

/* ============================================================
   Badges
   ============================================================ */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.1px;
}
.badge.pending { background: #fef3c7; color: #92400e; }
.badge.claimed { background: #dbeafe; color: #1e40af; }
.badge.done    { background: #dcfce7; color: #166534; }
.badge.failed  { background: #fee2e2; color: #991b1b; }
.badge.active   { background: #dcfce7; color: #166534; }
.badge.inactive { background: #fee2e2; color: #991b1b; }

/* 爬虫等级：1=轻量 JSON，2=普通 HTML/SPA，3=强反爬 */
.badge.tier.tier-1 { background: #dcfce7; color: #166534; }
.badge.tier.tier-2 { background: #fef3c7; color: #92400e; }
.badge.tier.tier-3 { background: #fee2e2; color: #991b1b; }

/* Toggle button rendered as a clickable badge (refresh-toggle on brand detail). */
.refresh-toggle-form { display: inline; margin: 0; }
.refresh-toggle-form button.badge {
  border: 1px solid transparent;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
}
.refresh-toggle-form button.badge:hover { filter: brightness(0.95); }

/* Pending refresh count rendered under the toggle button. */
.refresh-pending { margin-top: 4px; font-size: 12px; }

/* Dashboard: unclassified-regions table inside a collapsible <details>. */
.unclassified-detail { margin: 8px 0 24px; }
.unclassified-detail summary {
  cursor: pointer; color: #4b5563; font-size: 13px; padding: 4px 0;
}
.unclassified-detail summary:hover { color: #111827; }
.unclassified-table {
  margin-top: 8px; width: 100%; max-width: 720px;
  border-collapse: collapse; font-size: 13px;
}
.unclassified-table th, .unclassified-table td {
  text-align: left; padding: 4px 12px;
  border-bottom: 1px solid #e5e7eb;
}
.unclassified-table th {
  background: #f9fafb; font-weight: 500; color: #6b7280;
}
.unclassified-table td a { color: #1d4ed8; }

/* Extract mode (v8): per-region classification badge + admin quick-actions. */
.extract-mode-cell { white-space: nowrap; }
.badge.extract-mode-script      { background: #dcfce7; color: #166534; }  /* green */
.badge.extract-mode-llm         { background: #e0e7ff; color: #3730a3; }  /* indigo */
.badge.extract-mode-anti_scrape { background: #fef3c7; color: #92400e; }  /* amber */
.badge.extract-mode-unknown     { background: #fee2e2; color: #991b1b; }  /* red */
.mode-actions { display: inline-flex; gap: 2px; margin-left: 6px; vertical-align: middle; }
.mode-action-form { display: inline; margin: 0; }
.mode-action-form .mode-btn {
  background: transparent;
  border: 1px solid #d1d5db;
  border-radius: 3px;
  cursor: pointer;
  font-size: 11px;
  padding: 2px 6px;
  color: #4b5563;
}
.mode-action-form .mode-btn:hover { background: #f3f4f6; color: #111827; }
.mode-action-form .mode-btn-active {
  background: #1d4ed8;
  border-color: #1d4ed8;
  color: white;
  cursor: default;
}

/* Expandable row on /brands list */
.brands-table .col-toggle { width: 28px; text-align: center; padding: 4px; }
.brands-table .row-toggle {
  background: transparent;
  border: 0;
  cursor: pointer;
  color: #6b7280;
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
}
.brands-table .row-toggle:hover { background: #f3f4f6; color: #111827; }
.brands-table .row-toggle[aria-expanded="true"] { color: #1d4ed8; }

.brands-table .brand-details > td {
  background: #f9fafb;
  padding: 10px 16px;
  border-top: 1px dashed #e5e7eb;
}
.brand-details-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 28px;
  font-size: 12.5px;
  color: #374151;
}
.brand-details-grid b {
  color: #111827;
  font-weight: 600;
  margin-right: 4px;
}

.tier-form { display: inline; margin: 0; }
.tier-select {
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  background: #fff;
  cursor: pointer;
}
.tier-select.tier-1 { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.tier-select.tier-2 { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.tier-select.tier-3 { background: #fee2e2; color: #991b1b; border-color: #fecaca; }

/* ============================================================
   Stat cards (used on dashboard)
   ============================================================ */
.bar {
  background: #eef2f7;
  height: 6px;
  border-radius: 999px;
  overflow: hidden;
  margin: 6px 0;
}
.bar > div {
  background: linear-gradient(90deg, #16a34a 0%, #22c55e 100%);
  height: 100%;
  border-radius: 999px;
}
.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
@media (max-width: 720px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 14px 18px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 160ms, transform 160ms;
}
.card:hover { box-shadow: var(--shadow-md); }
.card .label {
  font-size: 11px;
  color: var(--c-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 600;
}
.card .value {
  font-size: 26px;
  font-weight: 700;
  margin-top: 4px;
  letter-spacing: -0.4px;
  color: var(--c-text);
  line-height: 1.2;
}
.card .sub {
  font-size: 12px;
  color: var(--c-muted);
  margin-top: 4px;
  font-weight: 500;
}
.card.card-warn { border-color: rgba(217,119,6,0.45); background: rgba(217,119,6,0.05); }
.card.card-warn .value { color: var(--c-warn); }
.card.card-danger { border-color: rgba(220,38,38,0.5); background: rgba(220,38,38,0.05); }
.card.card-danger .value { color: var(--c-danger); }

/* dashboard section header (h3 + 链接) */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 20px 0 10px;
}
.section-head h3 { margin: 0; }
.section-more { font-size: 12px; }

pre {
  background: var(--c-surface-2);
  border: 1px solid var(--c-border-soft);
  border-radius: var(--r-md);
  padding: 14px 16px;
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--c-text);
}
.spec-content {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 18px 22px;
  white-space: pre-wrap;
  font-family: "SF Mono", Menlo, monospace;
  font-size: 12.5px;
  line-height: 1.6;
  box-shadow: var(--shadow-sm);
}
.spec-fold { margin: 16px 0; }
.spec-fold > summary {
  cursor: pointer;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--c-text);
  padding: 8px 0;
  list-style: none;
  user-select: none;
}
.spec-fold > summary::-webkit-details-marker { display: none; }
.spec-fold > summary::before {
  content: "▶";
  display: inline-block;
  margin-right: 8px;
  font-size: 0.75em;
  color: var(--c-text-soft);
  transition: transform 0.15s ease;
}
.spec-fold[open] > summary::before { transform: rotate(90deg); }
.spec-fold[open] > summary { margin-bottom: 8px; }
a.url, td.url a { color: var(--c-text-soft); text-decoration: none; }
a.url:hover, td.url a:hover { color: var(--c-brand); text-decoration: underline; }
.images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  margin-top: 24px;
}
.images img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
  background: var(--c-surface);
  box-shadow: var(--shadow-sm);
}
.images img:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

/* product page structured display */
.product-subtitle {
  font-size: 15px;
  color: var(--c-text-soft);
  margin: -10px 0 14px;
}
.price-box {
  margin: 16px 0;
  padding: 14px 18px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  display: inline-block;
  box-shadow: var(--shadow-sm);
}
.price-current {
  font-size: 24px;
  font-weight: 700;
  color: var(--c-danger);
  letter-spacing: -0.3px;
}
.price-compare {
  font-size: 14px;
  color: var(--c-muted);
  text-decoration: line-through;
  margin-right: 10px;
}
.description {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 18px 22px;
  white-space: pre-wrap;
  line-height: 1.75;
  color: var(--c-text);
  margin-top: 24px;
  box-shadow: var(--shadow-sm);
}
.tags { margin: 24px 0 12px; }
.tag {
  display: inline-block;
  background: #eef2f7;
  color: var(--c-text-soft);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  margin: 0 6px 6px 0;
  font-weight: 500;
}
.tag-category {
  background: #e0e9ff;
  color: #3730a3;
}

.category-paths { margin: 20px 0 4px; }
.category-path {
  font-size: 13px;
  color: var(--c-text-soft);
  margin: 6px 0;
  line-height: 1.7;
}
.category-seg {
  display: inline-block;
  padding: 3px 10px;
  background: var(--c-surface-2);
  border-radius: var(--r-sm);
  margin: 0 2px;
  font-weight: 500;
}
.category-seg:first-child { background: #e0e9ff; color: #3730a3; }
.category-sep { color: var(--c-muted); margin: 0 4px; }
.raw-data {
  margin-top: 32px;
  padding: 8px 0;
}
.raw-data summary {
  cursor: pointer;
  color: var(--c-muted);
  font-size: 13px;
  user-select: none;
  font-weight: 500;
}
.raw-data summary:hover { color: var(--c-text-soft); }

/* lightbox overlay */
.lightbox {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
}
.lightbox[hidden] { display: none !important; }
.lightbox-backdrop {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.92);
  cursor: zoom-out;
}
.lightbox img#lightbox-img {
  position: relative;
  max-width: 92vw;
  max-height: 92vh;
  object-fit: contain;
  box-shadow: 0 4px 32px rgba(0,0,0,0.5);
  z-index: 1;
}
.lightbox-btn {
  position: absolute;
  background: rgba(255,255,255,0.12);
  color: white;
  border: none;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  transition: background 0.15s;
  z-index: 2;
}
.lightbox-btn:hover { background: rgba(255,255,255,0.28); }
.lightbox-close { top: 20px; right: 20px; font-size: 24px; }
.lightbox-prev  { left: 20px; top: 50%; transform: translateY(-50%); }
.lightbox-next  { right: 20px; top: 50%; transform: translateY(-50%); }
.lightbox-counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  background: rgba(0,0,0,0.55);
  padding: 6px 16px;
  border-radius: 16px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  z-index: 2;
}
/* ============================================================
   Pagination
   ============================================================ */
.pagination {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 18px 0;
  font-size: 13px;
  flex-wrap: wrap;
}
.pagination a {
  display: inline-block;
  padding: 6px 12px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 8px;
  color: var(--c-brand);
  font-weight: 500;
  transition: background 140ms, border-color 140ms;
}
.pagination a:hover {
  background: var(--c-brand-soft);
  border-color: var(--c-brand);
  text-decoration: none;
}
.pagination .disabled {
  display: inline-block;
  padding: 6px 12px;
  border: 1px solid var(--c-border-soft);
  border-radius: 8px;
  color: var(--c-muted);
  background: var(--c-surface-2);
}
.pagination-info { padding: 0 8px; color: var(--c-text-soft); }

/* ============================================================
   Buttons (defaults — page-specific buttons in apikeys.html /
   users.html still scope-override via embedded <style>)
   ============================================================ */
form { display: inline; }
button {
  background: linear-gradient(135deg, var(--c-brand) 0%, var(--c-brand-2) 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
  cursor: pointer;
  transition: transform 120ms, box-shadow 160ms, filter 140ms;
  font-family: inherit;
  box-shadow: 0 2px 8px -3px rgba(0,102,204,0.45),
              inset 0 1px 0 rgba(255,255,255,0.18);
}
button:hover { transform: translateY(-1px); filter: brightness(1.04); }
button:active { transform: translateY(0); filter: brightness(0.96); }

/* page header w/ action button */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.page-header h2 { margin: 0; }

.btn-primary, .btn-secondary, .btn-danger {
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 9px;
  cursor: pointer;
  border: 1px solid transparent;
  font-family: inherit;
  font-weight: 600;
  letter-spacing: 0.2px;
  transition: transform 120ms, box-shadow 160ms, background 140ms, border-color 140ms;
}
.btn-primary {
  background: linear-gradient(135deg, var(--c-brand) 0%, var(--c-brand-2) 100%);
  color: #fff;
  box-shadow: 0 4px 12px -4px rgba(0,102,204,0.5),
              inset 0 1px 0 rgba(255,255,255,0.18);
}
.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.04); }
.btn-secondary {
  background: var(--c-surface);
  color: var(--c-text-soft);
  border-color: var(--c-border);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover { background: var(--c-surface-2); border-color: #cbd5e1; }
.btn-danger {
  background: #dc2626;
  color: #fff;
  box-shadow: 0 4px 12px -4px rgba(220,38,38,0.55),
              inset 0 1px 0 rgba(255,255,255,0.15);
}
.btn-danger:hover { transform: translateY(-1px); filter: brightness(1.05); }
.btn-danger:disabled {
  background: #f3a8a8;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.btn-link-danger {
  background: transparent;
  border: none;
  color: #b91c1c;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  font-family: inherit;
  font-weight: 500;
}
.btn-link-danger:hover { background: #fef2f2; }

/* danger-zone modal accents */
.danger-text { color: #991b1b; }
.danger-list {
  margin: 0 0 18px;
  padding-left: 22px;
  font-size: 13px;
  color: var(--c-text-soft);
  line-height: 1.7;
}
.danger-list li::marker { color: #991b1b; }

/* flash messages */
.flash {
  padding: 11px 14px;
  border-radius: var(--r-md);
  margin-bottom: 14px;
  font-size: 13px;
  display: flex; align-items: center; gap: 8px;
}
.flash-ok  { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.flash-err { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }

/* ============================================================
   Modal (native <dialog>)
   ============================================================ */
.modal {
  border: none;
  border-radius: var(--r-lg);
  padding: 0;
  box-shadow: var(--shadow-lg);
  width: 480px;
  max-width: 92vw;
  background: var(--c-surface);
}
.modal::backdrop { background: rgba(15,23,42,0.45); backdrop-filter: blur(2px); }
.modal-form { display: block; padding: 26px 28px 22px; }
.modal-form h3 { margin: 0 0 8px; font-size: 17px; font-weight: 700; }
.modal-hint { margin: 0 0 20px; color: var(--c-text-soft); font-size: 13px; }
.modal-field { display: block; margin-bottom: 16px; }
.modal-field span {
  display: block;
  font-size: 12px;
  color: var(--c-text-soft);
  margin-bottom: 6px;
  font-weight: 600;
}
.modal-field input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--c-border);
  border-radius: 9px;
  font-size: 14px;
  font-family: inherit;
  color: var(--c-text);
  background: var(--c-surface);
  transition: border-color 140ms, box-shadow 140ms;
}
.modal-field input:focus {
  outline: none;
  border-color: var(--c-brand);
  box-shadow: 0 0 0 4px var(--c-brand-soft);
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 22px;
}

/* ============================================================
   Tabs
   ============================================================ */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--c-border);
  margin: 22px 0 18px;
  padding-bottom: 0;
}
.tabs .tab {
  padding: 9px 16px;
  text-decoration: none;
  color: var(--c-text-soft);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  font-size: 14px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 8px 8px 0 0;
  transition: color 140ms, background 140ms, border-color 140ms;
}
.tabs .tab:hover { color: var(--c-brand); background: rgba(0,102,204,0.04); text-decoration: none; }
.tabs .tab.active {
  color: var(--c-brand);
  border-bottom-color: var(--c-brand);
  font-weight: 600;
  background: transparent;
}
.tab-count {
  display: inline-block;
  background: #eef2f7;
  color: var(--c-text-soft);
  padding: 1px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1px;
}
.tab.active .tab-count {
  background: linear-gradient(135deg, var(--c-brand) 0%, var(--c-brand-2) 100%);
  color: #fff;
}

.url { font-family: "SF Mono", Menlo, monospace; font-size: 12px; word-break: break-all; color: var(--c-text-soft); }

/* --- auth: login page --- */
.login-body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(1200px 600px at 90% -10%, rgba(99,102,241,0.10), transparent 60%),
    radial-gradient(900px 600px at -10% 110%, rgba(0,102,204,0.08), transparent 55%),
    linear-gradient(180deg, #f5f7fb 0%, #eef2f7 100%);
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  color: #0f172a;
}
.login-body::before {
  content: "";
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(15,23,42,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15,23,42,0.04) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 75%);
}
.login-bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.55;
  pointer-events: none;
  z-index: 0;
}
.login-bg-orb-1 { width: 360px; height: 360px; top: -80px; right: -80px;
  background: radial-gradient(circle, #6366f1 0%, transparent 70%); }
.login-bg-orb-2 { width: 420px; height: 420px; bottom: -120px; left: -120px;
  background: radial-gradient(circle, #0ea5e9 0%, transparent 70%); }

.login-main {
  position: relative; z-index: 1;
  width: 100%; max-width: 420px;
  padding: 32px 24px;
  display: flex; flex-direction: column; align-items: center;
}
.login-card {
  width: 100%;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  padding: 40px 36px 32px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.65);
  box-shadow:
    0 20px 60px -20px rgba(15,23,42,0.25),
    0 8px 24px -12px rgba(15,23,42,0.10);
  animation: login-fade-in 360ms cubic-bezier(.16,1,.3,1) both;
}
@keyframes login-fade-in {
  from { opacity: 0; transform: translateY(8px) scale(0.99); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.login-brand { text-align: center; margin-bottom: 28px; }
.login-logo {
  width: 56px; height: 56px;
  margin: 0 auto 14px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 26px;
  color: #fff;
  background: linear-gradient(135deg, #0066cc 0%, #6366f1 100%);
  box-shadow:
    0 8px 20px -6px rgba(0,102,204,0.5),
    inset 0 1px 0 rgba(255,255,255,0.3);
  letter-spacing: -0.5px;
}
.login-brand h1 {
  margin: 0 0 4px;
  font-size: 22px; font-weight: 700;
  letter-spacing: -0.3px;
  color: #0f172a;
}
.login-brand .login-sub {
  margin: 0;
  color: #64748b; font-size: 13px;
}

.login-err {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  margin-bottom: 18px;
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  border-radius: 10px;
  font-size: 13px;
  animation: login-shake 320ms cubic-bezier(.36,.07,.19,.97);
}
.login-err svg { flex-shrink: 0; }
@keyframes login-shake {
  10%,90% { transform: translateX(-1px); }
  20%,80% { transform: translateX(2px); }
  30%,50%,70% { transform: translateX(-3px); }
  40%,60% { transform: translateX(3px); }
}

.field { margin-bottom: 16px; }
.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px; font-weight: 600;
  color: #475569;
  letter-spacing: 0.2px;
}
.input-wrap {
  position: relative;
  display: flex; align-items: center;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  transition: border-color 160ms, box-shadow 160ms, background 160ms;
}
.input-wrap:hover { border-color: #cbd5e1; }
.input-wrap:focus-within {
  border-color: #0066cc;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(0,102,204,0.12);
}
.input-wrap .input-icon {
  flex-shrink: 0;
  color: #94a3b8;
  margin: 0 0 0 12px;
  transition: color 160ms;
}
.input-wrap:focus-within .input-icon { color: #0066cc; }
.input-wrap input {
  flex: 1;
  border: 0; outline: 0; background: transparent;
  padding: 11px 12px;
  font-size: 14px;
  color: #0f172a;
  font-family: inherit;
}
.input-wrap input::placeholder { color: #94a3b8; }
.input-wrap input:-webkit-autofill {
  -webkit-text-fill-color: #0f172a;
  -webkit-box-shadow: 0 0 0 1000px #fff inset;
  transition: background-color 5000s ease-in-out 0s;
}
.toggle-pw {
  flex-shrink: 0;
  background: transparent; border: 0; cursor: pointer;
  padding: 8px 12px;
  color: #94a3b8;
  display: flex; align-items: center;
  border-radius: 0 9px 9px 0;
  box-shadow: none;
}
.toggle-pw:hover { color: #475569; transform: none; filter: none; }
.toggle-pw:focus-visible { outline: 2px solid #0066cc; outline-offset: -2px; }
/* 默认显示 eye-on，隐藏 eye-off；点击后通过 .show class 翻转 */
.toggle-pw .eye-off { display: none; }
.toggle-pw.show .eye-on  { display: none; }
.toggle-pw.show .eye-off { display: inline-block; }

.btn-login {
  position: relative;
  width: 100%;
  margin-top: 8px;
  padding: 12px 16px;
  border: 0; border-radius: 10px;
  background: linear-gradient(135deg, #0066cc 0%, #4f46e5 100%);
  color: #fff;
  font-size: 14px; font-weight: 600;
  letter-spacing: 0.3px;
  cursor: pointer;
  box-shadow:
    0 4px 14px -4px rgba(0,102,204,0.5),
    inset 0 1px 0 rgba(255,255,255,0.18);
  transition: transform 120ms, box-shadow 160ms, filter 160ms;
}
.btn-login:hover {
  transform: translateY(-1px);
  box-shadow:
    0 8px 22px -6px rgba(0,102,204,0.55),
    inset 0 1px 0 rgba(255,255,255,0.18);
}
.btn-login:active { transform: translateY(0); filter: brightness(0.95); }
.btn-login:disabled { cursor: not-allowed; opacity: 0.85; }
.btn-spinner {
  display: none;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: login-spin 700ms linear infinite;
}
.btn-login.loading .btn-label { visibility: hidden; }
.btn-login.loading .btn-spinner {
  display: block;
  position: absolute; top: 50%; left: 50%;
  margin-top: -8px; margin-left: -8px;
}
@keyframes login-spin { to { transform: rotate(360deg); } }

.login-foot {
  display: flex; justify-content: space-between;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid rgba(15,23,42,0.06);
  font-size: 12px;
  color: #64748b;
}
.login-foot .muted { color: #94a3b8; }

.login-copyright {
  margin: 18px 0 0;
  color: #94a3b8;
  font-size: 12px;
}

@media (max-width: 480px) {
  .login-card { padding: 32px 24px 24px; border-radius: 14px; }
  .login-bg-orb-1, .login-bg-orb-2 { display: none; }
}

/* user-bar styles live in the header section above (light theme). */
