:root {
  color-scheme: dark;
  --bg: #070b14;
  --bg-soft: #0b111b;
  --panel: #0e1520;
  --panel-alt: #121b28;
  --line: #1d2937;
  --line-light: #2a3848;
  --text: #f1f5f9;
  --muted: #8a98a8;
  --dim: #566372;
  --lime: #b8ef45;
  --cyan: #53d9d4;
  --orange: #ffad5a;
  --purple: #b5a3ff;
  --red: #ff777d;
  --blue: #6aa6ff;
  --sidebar: 232px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body { font-size: 14px; letter-spacing: 0; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; display: flex; }
.app-shell.app-hidden { display: none; }
.auth-gate { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 36px; background: var(--bg); }
.auth-gate[hidden] { display: none; }
.auth-card { width: min(930px, 100%); min-height: 520px; display: grid; grid-template-columns: minmax(0, 1fr) 370px; align-items: center; gap: 70px; padding: 60px 72px; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 24px 80px rgba(0,0,0,.35); border-radius: 18px; }
.auth-copy { align-self: stretch; display: flex; flex-direction: column; justify-content: center; }
.auth-brand { padding: 0 0 64px; }
.auth-copy h1 { font-size: clamp(34px, 4vw, 54px); line-height: 1.1; letter-spacing: -.04em; margin-top: 15px; font-weight: 650; }
.auth-copy h1 em { color: var(--lime); font-style: normal; }
.auth-copy p { max-width: 400px; color: var(--muted); font-size: 13px; line-height: 1.8; margin-top: 18px; }
.auth-points { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 32px; }
.auth-points span { border: 1px solid var(--line-light); color: var(--muted); padding: 7px 10px; font-size: 10px; border-radius: 6px; }
.auth-panel { padding: 30px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 12px; }
.auth-panel h2 { font-size: 23px; margin-top: 12px; }
.auth-panel p { color: var(--muted); font-size: 11px; line-height: 1.6; margin-top: 8px; }
.auth-panel form { display: grid; gap: 14px; margin-top: 25px; }
.auth-card label, .settings-form label { display: grid; gap: 7px; color: var(--muted); font-size: 11px; }
.auth-card input, .settings-form input:not([type="checkbox"]) { width: 100%; height: 40px; color: var(--text); background: var(--bg); border: 1px solid var(--line-light); padding: 0 10px; outline: 0; border-radius: 8px; }
.auth-card input:focus, .settings-form input:focus { border-color: var(--lime); }
.auth-panel .primary-button { width: 100%; margin-top: 5px; }
.auth-panel .primary-button span { margin-left: auto; }
.auth-error { min-height: 15px; color: var(--red); font-size: 11px; }

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar); min-height: 100vh; background: #0a0f17;
  border-right: 1px solid var(--line); padding: 28px 16px 20px;
  display: flex; flex-direction: column; flex-shrink: 0; position: sticky; top: 0;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 10px 34px; }
.brand strong { display: block; font-size: 12px; letter-spacing: .16em; font-weight: 800; white-space: nowrap; }
.brand strong span { color: var(--lime); }
.brand small { display: block; color: var(--dim); font-size: 8px; margin-top: 5px; letter-spacing: .12em; }
.brand-mark { display: flex; align-items: end; gap: 3px; height: 25px; width: 25px; }
.brand-mark span { width: 5px; background: var(--lime); display: block; }
.brand-mark span:nth-child(1) { height: 11px; opacity: .55; }
.brand-mark span:nth-child(2) { height: 18px; opacity: .78; }
.brand-mark span:nth-child(3) { height: 25px; }
.workspace-label, .panel-eyebrow { color: var(--dim); font-size: 10px; letter-spacing: .15em; font-weight: 700; }
.workspace-label { padding: 0 11px 12px; }
.nav-list { display: grid; gap: 3px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: transparent;
  color: var(--muted); padding: 11px 11px; text-align: left; border-radius: 8px;
  transition: .18s ease; font-size: 13px;
}
.nav-item:hover { color: var(--text); background: rgba(255,255,255,.045); }
.nav-item.active { color: var(--text); background: #111a26; }
.nav-icon { width: 18px; color: var(--dim); font-size: 16px; }
.nav-item.active .nav-icon { color: var(--lime); }
.sidebar-spacer { flex: 1; min-height: 50px; }
.sidebar-status { margin: 0 7px 18px; padding: 13px 12px; border: 1px solid var(--line); display: flex; gap: 9px; align-items: center; border-radius: 10px; }
.sidebar-status strong { display: block; font-size: 11px; font-weight: 600; }
.sidebar-status small { display: block; color: var(--dim); font-size: 9px; letter-spacing: .08em; margin-top: 3px; }
.status-pulse { height: 7px; width: 7px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 4px rgba(184,239,69,.08); }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--lime); margin-left: auto; }
.sidebar-footer { display: flex; justify-content: space-between; color: var(--dim); padding: 0 9px; font-size: 9px; letter-spacing: .08em; }

/* ---- Main ---- */
.main-content { flex: 1; min-width: 0; padding: 0 42px 28px; }
.topbar { height: 104px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.breadcrumb { display: flex; gap: 10px; color: var(--dim); font-size: 10px; letter-spacing: .15em; font-weight: 700; margin-bottom: 10px; }
.breadcrumb i { color: #37414c; font-style: normal; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 25px; letter-spacing: -.02em; font-weight: 650; }
h2 { font-size: 17px; font-weight: 600; letter-spacing: -.01em; margin-top: 7px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.user-menu { display: flex; align-items: center; gap: 7px; border: 1px solid var(--line); padding-left: 10px; color: var(--muted); font-size: 11px; border-radius: 8px; }
.user-logout { width: auto; border-top: 0; padding: 0 9px; color: var(--dim); font-size: 10px; }
.user-logout:hover { color: var(--red); }
.last-sync { color: var(--dim); font-size: 11px; margin-right: 10px; }
.last-sync strong { color: var(--muted); font-weight: 500; margin-left: 5px; }
.icon-button, .primary-button, .secondary-button {
  border: 1px solid var(--line-light); background: var(--panel); color: var(--text);
  height: 36px; padding: 0 13px; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  transition: .18s ease; border-radius: 8px;
}
.icon-button { width: 36px; padding: 0; font-size: 18px; color: var(--muted); }
.icon-button:hover, .secondary-button:hover { border-color: #526170; color: var(--text); }
.primary-button { background: var(--lime); color: #11180c; border-color: var(--lime); font-weight: 700; }
.primary-button:hover { background: #cefa71; border-color: #cefa71; }
.primary-button span { font-size: 17px; line-height: 0; }
.secondary-button { font-size: 12px; color: var(--muted); }
.secondary-button span { color: var(--lime); font-size: 16px; }
.secondary-button.danger:hover { border-color: var(--red); color: var(--red); }

/* ---- Views ---- */
.view { display: none; padding-top: 28px; }
.view.active { display: block; }

/* ---- KPI ---- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.kpi-card { min-height: 137px; position: relative; overflow: hidden; padding: 18px 19px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.kpi-card::after { content: ""; position: absolute; right: 16px; bottom: 16px; width: 42px; height: 1px; background: currentColor; opacity: .35; }
.accent-lime { color: var(--lime); } .accent-cyan { color: var(--cyan); } .accent-orange { color: var(--orange); } .accent-purple { color: var(--purple); }
.kpi-label { color: var(--muted); font-size: 11px; display: flex; align-items: center; gap: 7px; }
.mini-tag { border: 1px solid currentColor; color: inherit; font-size: 8px; padding: 2px 4px; opacity: .8; letter-spacing: .06em; border-radius: 4px; }
.kpi-value { color: var(--text); font-size: 35px; font-weight: 600; line-height: 1; margin-top: 20px; }
.kpi-meta { color: var(--dim); font-size: 11px; margin-top: 11px; }
.trend-up { color: var(--lime); margin-right: 4px; } .trend-warn { color: var(--orange); margin-right: 4px; }

.content-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.panel-header { min-height: 75px; padding: 18px 20px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.panel-header.compact { min-height: 70px; padding: 17px 18px; }
.panel-actions { display: flex; gap: 8px; }

/* ---- Merchant summary (overview) ---- */
.merchant-summary-list { display: grid; gap: 10px; padding: 16px 20px 20px; }
.merchant-summary-card {
  display: grid; grid-template-columns: 44px 1fr auto auto; align-items: center; gap: 14px;
  border: 1px solid var(--line); background: var(--bg-soft); padding: 14px 16px; border-radius: 12px;
  text-align: left; transition: .18s ease;
}
.merchant-summary-card:hover { border-color: var(--line-light); transform: translateY(-1px); }
.merchant-summary-mark {
  width: 44px; height: 44px; border-radius: 11px; display: grid; place-items: center;
  color: var(--lime); border: 1px solid currentColor; font-size: 15px; font-weight: 700; background: rgba(184,239,69,.06);
}
.merchant-summary-mark.terabix { color: var(--cyan); background: rgba(83,217,212,.06); }
.merchant-summary-mark.isvoro { color: var(--lime); }
.merchant-summary-mark.seckill { color: var(--orange); background: rgba(255,173,90,.08); }
.merchant-summary-info strong { display: block; font-size: 14px; }
.merchant-summary-info span { color: var(--dim); font-size: 11px; margin-top: 4px; display: block; }
.merchant-summary-stats { display: flex; gap: 8px; }
.merchant-summary-stats span { font-size: 10px; padding: 5px 9px; border-radius: 999px; }
.merchant-summary-stats .stat-in { color: var(--lime); border: 1px solid rgba(184,239,69,.3); background: rgba(184,239,69,.06); }
.merchant-summary-stats .stat-out { color: var(--orange); border: 1px solid rgba(255,173,90,.3); background: rgba(255,173,90,.06); }
.merchant-summary-arrow { color: var(--dim); font-size: 18px; }

.filter-bar { display: flex; gap: 8px; padding: 13px 14px; border-bottom: 1px solid var(--line); }
.search-box { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 150px; border: 1px solid var(--line); background: var(--bg-soft); padding: 0 10px; height: 34px; color: var(--dim); border-radius: 8px; }
.search-box input { width: 100%; border: 0; outline: 0; color: var(--text); background: transparent; font-size: 12px; }
select { height: 34px; min-width: 118px; color: var(--muted); background: var(--bg-soft); border: 1px solid var(--line); padding: 0 9px; outline: 0; border-radius: 8px; }
textarea { width: 100%; color: var(--text); background: var(--bg); border: 1px solid var(--line-light); padding: 10px; outline: 0; border-radius: 8px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; resize: vertical; }
textarea:focus { border-color: var(--lime); }

/* ---- Merchant page ---- */
.merchant-hero {
  display: flex; justify-content: space-between; align-items: center; gap: 20px;
  padding: 24px 26px; border: 1px solid var(--line); border-radius: 16px;
  background: linear-gradient(135deg, #0e1a12 0%, #0b111b 60%);
}
.merchant-hero.terabix { background: linear-gradient(135deg, #0a1a1d 0%, #0b111b 60%); }
.merchant-hero.seckill { background: linear-gradient(135deg, #22160a 0%, #0b111b 60%); }
.merchant-hero-head { display: flex; align-items: center; gap: 18px; }
.merchant-hero-mark { width: 56px; height: 56px; border-radius: 14px; display: grid; place-items: center; color: var(--lime); border: 1px solid currentColor; font-size: 20px; font-weight: 800; background: rgba(184,239,69,.08); }
.merchant-hero.terabix .merchant-hero-mark { color: var(--cyan); background: rgba(83,217,212,.08); }
.merchant-hero h2 { font-size: 24px; }
.merchant-seed-note { color: var(--dim); font-size: 11px; margin-top: 8px; }
.merchant-hero-stats { display: flex; gap: 14px; }
.merchant-hero-stats div { min-width: 72px; text-align: center; padding: 12px 16px; border: 1px solid var(--line); border-radius: 12px; background: rgba(0,0,0,.2); }
.merchant-hero-stats strong { display: block; font-size: 22px; font-weight: 650; }
.merchant-hero-stats span { color: var(--dim); font-size: 10px; }
.merchant-hero-stats .hero-in strong { color: var(--lime); }
.merchant-hero-stats .hero-out strong { color: var(--orange); }

.merchant-filter { margin-top: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }

.seed-interval-panel { margin-top: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: 16px 18px; }
.seed-interval-list { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.seed-interval-row { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; background: rgba(0,0,0,.2); }
.seed-interval-row span { font-size: 12px; color: var(--text); }
.seed-interval-row small { color: var(--dim); font-size: 10px; }
.seed-interval-row input { width: 88px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); background: #0a0e17; color: var(--text); font-size: 12px; }
.seed-interval-panel .form-note { margin-top: 10px; }

.master-toggle-panel { margin-top: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.master-toggle-panel.paused { border-color: rgba(255,173,90,.35); }
.master-toggle-panel .form-note { color: var(--dim); font-size: 12px; margin-top: 6px; max-width: 72ch; }
.master-toggle { display: inline-flex; align-items: center; gap: 10px; border: 1px solid var(--line); background: #0a0e17; border-radius: 999px; padding: 8px 16px; cursor: pointer; color: var(--text); font-size: 13px; transition: .18s; white-space: nowrap; }
.master-toggle:hover { border-color: var(--line-light); }
.master-toggle-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--dim); transition: .18s; }
.master-toggle.on { border-color: var(--lime); background: rgba(184,239,69,.08); }
.master-toggle.on .master-toggle-dot { background: var(--lime); box-shadow: 0 0 8px rgba(184,239,69,.6); }
.merchant-summary-card.paused { opacity: .55; }
.paused-tag { color: var(--orange); font-style: normal; font-size: 9px; border: 1px solid rgba(255,173,90,.4); border-radius: 6px; padding: 1px 5px; margin-left: 6px; vertical-align: middle; }

.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin-top: 16px; }
.product-card {
  display: flex; flex-direction: column; gap: 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px;
  transition: .18s ease;
}
.product-card:hover { border-color: var(--line-light); transform: translateY(-2px); }
.product-card.in_stock { border-color: rgba(184,239,69,.22); }
.product-card.sold_out { opacity: .82; }
.product-card-top { display: flex; justify-content: space-between; align-items: center; }
.region-badge { color: var(--cyan); border: 1px solid rgba(83,217,212,.28); background: rgba(83,217,212,.06); font-size: 10px; padding: 4px 9px; border-radius: 999px; }
.notify-toggle { border: 1px solid var(--line); background: transparent; font-size: 15px; width: 30px; height: 30px; border-radius: 8px; opacity: .4; transition: .18s; }
.notify-toggle.on { opacity: 1; border-color: var(--lime); background: rgba(184,239,69,.08); }
.product-name { font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.spec-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.spec-chips span { color: var(--muted); font-size: 10px; padding: 4px 8px; border-radius: 6px; background: var(--bg-soft); border: 1px solid var(--line); }
.product-card-foot { display: flex; justify-content: space-between; align-items: end; margin-top: auto; }
.product-price s { color: var(--dim); font-size: 11px; margin-right: 6px; }
.product-price strong { font-size: 19px; font-weight: 700; color: var(--lime); }
.product-price small { color: var(--dim); font-size: 10px; margin-left: 4px; }
.stock-badge { font-size: 10px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line-light); color: var(--muted); }
.stock-badge.in_stock { color: var(--lime); border-color: rgba(184,239,69,.3); background: rgba(184,239,69,.06); }
.stock-badge.sold_out { color: var(--orange); border-color: rgba(255,173,90,.3); background: rgba(255,173,90,.06); }
.stock-badge.error { color: var(--red); border-color: rgba(255,119,125,.3); }
.product-actions { display: flex; gap: 2px; border-top: 1px solid var(--line); padding-top: 10px; margin-top: 2px; }
.product-actions .row-action { margin-left: auto; }
.product-actions .row-action:first-child { margin-left: 0; }

/* ---- Seckill ---- */
.seckill-progress { height: 6px; background: #1c252e; border-radius: 999px; overflow: hidden; }
.seckill-progress-bar { height: 100%; background: linear-gradient(90deg, var(--orange), #ff7b4f); }
.seckill-meta { display: flex; justify-content: space-between; color: var(--dim); font-size: 10px; }
.seckill-card .product-price strong { color: var(--orange); }

/* ---- Plugins ---- */
#plugins-list { display: grid; gap: 18px; }
.plugin-card { padding: 20px 22px; }
.plugin-head { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.plugin-title { display: flex; align-items: center; gap: 12px; }
.plugin-mark { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; color: var(--orange); border: 1px solid currentColor; font-size: 18px; background: rgba(255,173,90,.08); }
.plugin-title strong { display: block; font-size: 15px; }
.plugin-title small { color: var(--dim); font-size: 10px; }
.plugin-stats { display: flex; align-items: center; gap: 10px; }
.plugin-count { color: var(--dim); font-size: 11px; }
.plugin-actions { margin-left: auto; display: flex; gap: 7px; }
.plugin-summary { color: var(--dim); font-size: 11px; margin-top: 12px; }
.activity-banner { margin-top: 16px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; background: linear-gradient(135deg, rgba(255,173,90,.06), transparent); }
.activity-banner-head { display: flex; justify-content: space-between; align-items: center; }
.activity-banner h3 { font-size: 16px; }
.countdown { font-family: ui-monospace, Consolas, monospace; font-size: 20px; font-weight: 700; color: var(--orange); letter-spacing: .05em; }

/* ---- Status chip (shared) ---- */
.status-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 10px; padding: 5px 9px; border: 1px solid var(--line-light); white-space: nowrap; border-radius: 999px; }
.status-chip i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status-chip.in_stock { color: var(--lime); border-color: rgba(184,239,69,.28); background: rgba(184,239,69,.05); }
.status-chip.orderable { color: var(--cyan); border-color: rgba(83,217,212,.28); background: rgba(83,217,212,.05); }
.status-chip.sold_out { color: var(--orange); border-color: rgba(255,173,90,.28); background: rgba(255,173,90,.05); }
.status-chip.error { color: var(--red); border-color: rgba(255,119,125,.3); background: rgba(255,119,125,.05); }
.status-chip.unknown { color: var(--muted); }

/* ---- Side column ---- */
.side-column { display: grid; gap: 18px; }
.event-list { padding: 3px 18px 5px; }
.event-item { display: grid; grid-template-columns: 9px 1fr; gap: 10px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.event-item:last-child { border-bottom: 0; }
.event-dot { width: 6px; height: 6px; background: var(--cyan); border-radius: 50%; margin-top: 5px; }
.event-dot.status { background: var(--lime); } .event-dot.error { background: var(--red); } .event-dot.sync { background: var(--purple); } .event-dot.antibot { background: var(--orange); }
.event-message { font-size: 11px; line-height: 1.5; color: var(--muted); }
.event-time { display: block; color: var(--dim); font-size: 9px; margin-top: 4px; }
.text-button { width: 100%; border: 0; border-top: 1px solid var(--line); background: transparent; color: var(--cyan); font-size: 11px; padding: 13px; text-align: left; }
.text-button span { float: right; font-size: 16px; }
.live-label { color: var(--lime); font-size: 9px; letter-spacing: .12em; display: flex; gap: 5px; align-items: center; }
.live-label i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

/* ---- Agents ---- */
.page-section-head { display: flex; justify-content: space-between; align-items: end; margin-bottom: 18px; }
.page-section-head p { color: var(--muted); font-size: 12px; margin-top: 9px; max-width: 620px; line-height: 1.7; }
.agents-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 13px; margin-bottom: 18px; }
.agent-card { padding: 18px; }
.agent-top { display: flex; justify-content: space-between; align-items: start; }
.agent-name { font-size: 14px; font-weight: 600; }
.agent-region { color: var(--muted); font-size: 11px; margin-top: 6px; }
.online-badge { color: var(--lime); font-size: 9px; letter-spacing: .09em; }
.agent-metrics { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); margin-top: 18px; padding-top: 15px; gap: 8px; }
.agent-metric span { display: block; color: var(--dim); font-size: 9px; margin-bottom: 5px; }
.agent-metric strong { font-size: 14px; font-weight: 500; }
.agent-footer { display: flex; justify-content: space-between; color: var(--dim); font-size: 10px; margin-top: 15px; }
.agent-install { padding: 22px; }
.agent-install p { color: var(--muted); font-size: 12px; margin-top: 8px; }
.agent-install code { display: block; margin-top: 18px; padding: 14px; overflow-x: auto; color: var(--lime); background: #090d11; border: 1px solid var(--line); font-size: 11px; border-radius: 10px; }

/* ---- Events ---- */
.full-panel { padding: 0 20px; }
.event-table-row { display: grid; grid-template-columns: 100px 90px 1fr 170px; gap: 15px; align-items: center; padding: 15px 0; border-bottom: 1px solid var(--line); }
.event-table-row:last-child { border-bottom: 0; }
.event-table-row time { color: var(--dim); font-size: 10px; }
.event-kind { color: var(--cyan); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.event-table-row p { color: var(--muted); font-size: 12px; }
.event-product { color: var(--dim); font-size: 10px; text-align: right; }

/* ---- Settings ---- */
.settings-grid { display: grid; gap: 11px; max-width: 760px; }
.setting-card { display: flex; align-items: center; gap: 14px; padding: 17px; }
.setting-icon { width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid var(--line-light); color: var(--lime); font-size: 18px; border-radius: 9px; }
.setting-card div:nth-child(2) { flex: 1; }
.setting-card strong, .setting-card span { display: block; }
.setting-card strong { font-size: 12px; }
.setting-card span { color: var(--dim); font-size: 10px; margin-top: 5px; }
.setting-card b { color: var(--cyan); font-size: 10px; letter-spacing: .08em; }
.settings-columns { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr); gap: 13px; margin-top: 18px; max-width: 1060px; }
.settings-form-card { padding: 21px; }
.settings-form-card h2 { margin-bottom: 8px; }
.form-tip { color: var(--dim); font-size: 10px; line-height: 1.6; margin-bottom: 16px; }
.settings-form { display: grid; gap: 14px; }
.settings-form .form-grid { gap: 12px; }
.settings-form .form-grid input { height: 36px; }
.check-grid { display: flex; flex-wrap: wrap; gap: 9px 15px; border-top: 1px solid var(--line); padding-top: 15px; }
.check-grid label { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; }
.check-grid input { accent-color: var(--lime); }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; }
.main-footer { display: flex; justify-content: space-between; color: var(--dim); font-size: 9px; letter-spacing: .05em; padding: 35px 2px 0; }

/* ---- Modal ---- */
.modal-backdrop { position: fixed; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(2,4,7,.78); z-index: 10; }
.modal-backdrop[hidden] { display: none; }
.modal { width: min(640px, 100%); max-height: 90vh; overflow-y: auto; background: var(--panel-alt); border: 1px solid var(--line-light); box-shadow: 0 22px 70px rgba(0,0,0,.4); border-radius: 14px; }
.plugin-modal { width: min(720px, 100%); }
.modal-header { display: flex; justify-content: space-between; align-items: start; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.modal form { padding: 20px 22px 22px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.form-grid label { display: grid; gap: 7px; color: var(--muted); font-size: 11px; }
.form-grid input, .form-grid select { width: 100%; height: 38px; color: var(--text); background: var(--bg); border: 1px solid var(--line-light); padding: 0 10px; outline: 0; border-radius: 8px; }
.form-grid input:focus { border-color: var(--lime); }
.span-2 { grid-column: 1 / -1; }
.form-note { color: var(--dim); font-size: 10px; line-height: 1.7; margin-top: 18px; }
.form-note code { color: var(--cyan); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 21px; }

/* ---- Row action ---- */
.row-action { color: var(--dim); border: 1px solid var(--line); background: transparent; font-size: 14px; padding: 6px 8px; border-radius: 7px; line-height: 1; }
.row-action:hover { color: var(--lime); border-color: var(--line-light); }
.row-action.danger:hover { color: var(--red); border-color: var(--red); }

/* ---- Empty / Toast ---- */
.empty-state { padding: 70px 15px; color: var(--dim); text-align: center; }
.empty-state span { display: block; font-size: 30px; color: var(--line-light); margin-bottom: 12px; }
.empty-state strong { display: block; font-weight: 500; color: var(--muted); }
.empty-state small { display: block; margin-top: 6px; }
.toast-stack { position: fixed; right: 24px; bottom: 24px; display: grid; gap: 8px; z-index: 20; }
.toast { background: #16202a; border: 1px solid var(--line-light); color: var(--text); padding: 12px 15px; min-width: 220px; font-size: 11px; box-shadow: 0 10px 30px rgba(0,0,0,.3); border-radius: 10px; }
.toast.success { border-left: 3px solid var(--lime); } .toast.error { border-left: 3px solid var(--red); }

/* ---- History ---- */
.history-list { padding: 8px 22px 20px; max-height: 60vh; overflow-y: auto; }
.history-row { display: grid; grid-template-columns: 96px 84px 74px 1fr; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.history-row:last-child { border-bottom: 0; }
.history-row time { color: var(--dim); font-size: 10px; }
.history-ms { color: var(--muted); font-size: 10px; }
.history-error { color: var(--dim); font-size: 10px; line-height: 1.5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Agent form ---- */
.agent-form { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 8px; margin-top: 14px; }
.agent-form input { height: 36px; color: var(--text); background: var(--bg); border: 1px solid var(--line-light); padding: 0 10px; outline: 0; font-size: 12px; border-radius: 8px; }
.agent-form input:focus { border-color: var(--lime); }
.agent-form .primary-button { height: 36px; }

@media (max-width: 1100px) {
  :root { --sidebar: 206px; }
  .main-content { padding-left: 24px; padding-right: 24px; }
  .content-grid { grid-template-columns: 1fr; }
  .side-column { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .auth-gate { padding: 15px; }
  .auth-card { min-height: auto; display: block; padding: 27px 21px; }
  .auth-brand { padding-bottom: 44px; }
  .auth-copy h1 { font-size: 35px; }
  .auth-panel { margin-top: 34px; padding: 22px 17px; }
  .app-shell { display: block; }
  .sidebar { width: 100%; min-height: auto; height: auto; padding: 14px 15px 10px; border-right: 0; border-bottom: 1px solid var(--line); position: static; }
  .brand { padding: 0 5px 15px; }
  .workspace-label, .sidebar-spacer, .sidebar-status, .sidebar-footer { display: none; }
  .nav-list { display: flex; overflow-x: auto; padding-bottom: 2px; }
  .nav-item { width: auto; white-space: nowrap; padding: 9px 12px; }
  .main-content { padding: 0 15px 22px; }
  .topbar { min-height: 96px; height: auto; padding: 20px 0; align-items: end; gap: 14px; flex-wrap: wrap; }
  h1 { font-size: 21px; }
  .topbar-actions { gap: 5px; }
  .last-sync { display: none; }
  .primary-button { padding: 0 10px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi-card { min-height: 125px; padding: 14px; }
  .kpi-value { font-size: 29px; margin-top: 16px; }
  .side-column { grid-template-columns: 1fr; }
  .merchant-summary-card { grid-template-columns: 40px 1fr auto; }
  .merchant-summary-stats { grid-column: 1 / -1; }
  .merchant-summary-arrow { display: none; }
  .merchant-hero { flex-direction: column; align-items: start; }
  .filter-bar { flex-wrap: wrap; }
  .search-box { flex-basis: 100%; }
  .page-section-head { display: block; }
  .page-section-head .primary-button { margin-top: 15px; }
  .event-table-row { grid-template-columns: 1fr 1fr; gap: 8px; }
  .event-table-row p { grid-column: 1 / -1; }
  .event-product { text-align: left; }
  .main-footer { display: block; line-height: 1.8; }
  .main-footer span { display: block; }
  .user-menu { display: none; }
  .settings-columns { grid-template-columns: 1fr; }
  .settings-form .form-grid { grid-template-columns: 1fr; }
  .settings-form .form-grid .span-2 { grid-column: auto; }
  .agent-form { grid-template-columns: 1fr; }
  .history-row { grid-template-columns: 1fr 1fr; gap: 8px; }
  .history-error { grid-column: 1 / -1; white-space: normal; }
  .plugin-head { flex-direction: column; align-items: start; }
  .plugin-actions { margin-left: 0; }
}

/* ---------------------------------------------------------------------------
   反爬与打码（Cloudflare 盾）
   --------------------------------------------------------------------------- */

.antibot-card { margin-top: 13px; max-width: 1060px; }
.antibot-card .field-label { display: grid; gap: 7px; color: var(--muted); font-size: 11px; }
.antibot-card .field-hint { color: var(--dim); font-size: 10px; border: 1px dashed var(--line); border-radius: 8px; padding: 9px 10px; }
.antibot-status { margin-top: 14px; color: var(--dim); font-size: 11px; line-height: 1.7; white-space: pre-wrap; }
.antibot-status.ok { color: var(--lime); }
.antibot-status.error { color: var(--red); }
.probe-row { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.probe-row #probe-url { flex: 1; min-width: 240px; height: 38px; color: var(--text); background: var(--bg); border: 1px solid var(--line-light); border-radius: 8px; padding: 0 11px; outline: 0; font-size: 12px; }
.probe-row #probe-url:focus { border-color: var(--lime); }
.probe-toggle { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11px; }
.probe-toggle input { accent-color: var(--lime); }
.probe-report { margin-top: 12px; max-height: 470px; overflow: auto; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 10px; padding: 13px; color: var(--muted); font-size: 11px; line-height: 1.65; white-space: pre-wrap; word-break: break-word; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.cache-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 12px; color: var(--dim); font-size: 11px; }

@media (max-width: 720px) {
  .probe-row { flex-direction: column; align-items: stretch; }
  .probe-row #probe-url { width: 100%; }
}
