:root,
[data-theme="light"] {
  --bg-canvas: #f6f7f9;
  --bg-sidebar: #f0f2f5;
  --bg-surface: #ffffff;
  --bg-subtle: #f3f4f6;
  --bg-hover: #eaedf2;
  --border: #e2e5ea;
  --border-strong: #cbd1da;
  --ink: #111827;
  --text: #272e3a;
  --muted: #525c6b;
  --subtle: #647082;
  --brand: #0f6d52;
  --brand-hover: #0b5842;
  --brand-soft: #e6f4ee;
  --brand-ink: #0b5741;
  --brand-border: #b6e0cd;
  --brand-ring: rgba(15, 109, 82, 0.22);
  --green-bg: #ecfdf5;
  --green-fg: #065f46;
  --green-border: #a7f3d0;
  --amber-bg: #fffbeb;
  --amber-fg: #92400e;
  --amber-border: #fde68a;
  --blue-bg: #eff6ff;
  --blue-fg: #1e40af;
  --blue-border: #bfdbfe;
  --red: #dc2626;
  --red-hover: #b91c1c;
  --red-bg: #fef2f2;
  --red-fg: #991b1b;
  --red-border: #fecaca;
  --neutral-bg: #f3f4f6;
  --neutral-fg: #4b5563;
  --neutral-border: #e5e7eb;
  --chart-total: #64748b;
  --chart-delivered: #0f6d52;
  --chart-area-top: rgba(15, 109, 82, 0.20);
  --chart-area-bottom: rgba(15, 109, 82, 0.01);
  --chart-grid: #e5e7eb;
  --shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.05);
  --shadow-md: 0 4px 14px rgba(17, 24, 39, 0.06);
  --shadow-lg: 0 20px 44px rgba(17, 24, 39, 0.12);
  --backdrop: rgba(17, 24, 39, 0.45);
  color-scheme: light;
  -webkit-font-smoothing: auto;
}

[data-theme="dark"] {
  --bg-canvas: #0e1116;
  --bg-sidebar: #12161d;
  --bg-surface: #161b23;
  --bg-subtle: #1d232e;
  --bg-hover: #242b38;
  --border: #262e3b;
  --border-strong: #374151;
  --ink: #f1f5f9;
  --text: #d5dce6;
  --muted: #94a1b5;
  --subtle: #8492a6;
  --brand: #15805d;
  --brand-hover: #116c4e;
  --brand-soft: rgba(52, 211, 153, 0.14);
  --brand-ink: #6ee7b7;
  --brand-border: rgba(52, 211, 153, 0.30);
  --brand-ring: rgba(52, 211, 153, 0.28);
  --green-bg: rgba(16, 185, 129, 0.14);
  --green-fg: #6ee7b7;
  --green-border: rgba(16, 185, 129, 0.28);
  --amber-bg: rgba(245, 158, 11, 0.14);
  --amber-fg: #fcd34d;
  --amber-border: rgba(245, 158, 11, 0.28);
  --blue-bg: rgba(59, 130, 246, 0.15);
  --blue-fg: #93c5fd;
  --blue-border: rgba(59, 130, 246, 0.28);
  --red: #dc2626;
  --red-hover: #b91c1c;
  --red-bg: rgba(239, 68, 68, 0.15);
  --red-fg: #fca5a5;
  --red-border: rgba(239, 68, 68, 0.28);
  --neutral-bg: rgba(148, 163, 184, 0.14);
  --neutral-fg: #cbd5e1;
  --neutral-border: rgba(148, 163, 184, 0.24);
  --chart-total: #94a3b8;
  --chart-delivered: #34d399;
  --chart-area-top: rgba(52, 211, 153, 0.22);
  --chart-area-bottom: rgba(52, 211, 153, 0.01);
  --chart-grid: #262e3b;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 56px rgba(0, 0, 0, 0.6);
  --backdrop: rgba(4, 7, 12, 0.72);
  color-scheme: dark;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg-canvas);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  text-rendering: optimizeLegibility;
}

button, input, textarea, select { font: inherit; color: inherit; }
button, a, input, textarea, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.55; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4, p { margin: 0; }
input, textarea, select { min-width: 0; }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
::selection { background: var(--brand-soft); color: var(--brand-ink); }

.icon { width: 18px; height: 18px; flex-shrink: 0; vertical-align: middle; }
.hidden, [hidden] { display: none !important; }
.muted, .subtle { color: var(--muted); }
.nowrap { white-space: nowrap; }
.mono, code { font-family: ui-monospace, 'SFMono-Regular', 'Menlo', 'Monaco', 'Consolas', monospace; }
.align-right { text-align: right !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.noscript { padding: 32px; text-align: center; }

/* Buttons */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 8px 16px; border: 1px solid transparent; border-radius: 9px;
  font-size: 14px; font-weight: 500; line-height: 1.35; white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s, color 0.15s;
}
.button .icon { width: 16px; height: 16px; }
.button.primary {
  color: #ffffff; background: var(--brand); border-color: var(--brand);
  box-shadow: var(--shadow-sm);
}
.button.primary:hover:not(:disabled) { background: var(--brand-hover); border-color: var(--brand-hover); }
.button.secondary {
  background: var(--bg-surface); color: var(--ink); border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.button.secondary:hover:not(:disabled) { background: var(--bg-hover); }
.button.danger { background: var(--red); color: #ffffff; border-color: var(--red); }
.button.danger:hover:not(:disabled) { background: var(--red-hover); border-color: var(--red-hover); }
.button.small { min-height: 34px; padding: 6px 12px; font-size: 13px; border-radius: 8px; }

.icon-button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; padding: 0; border-radius: 8px; border: 1px solid transparent;
  color: var(--muted); background: transparent; flex-shrink: 0;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.icon-button .icon { width: 17px; height: 17px; }
.icon-button:hover { background: var(--bg-hover); color: var(--ink); }
.icon-button.danger-hover:hover { color: var(--red-fg); background: var(--red-bg); }
.icon-button.is-copied { color: var(--brand-ink); background: var(--brand-soft); }

.text-button {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px; margin: -4px -6px;
  border-radius: 7px; background: none; border: 0; font-size: 13px; font-weight: 500;
  color: var(--brand-ink); white-space: nowrap; transition: background-color 0.15s, color 0.15s;
}
.text-button .icon { width: 15px; height: 15px; }
.text-button:hover { background: var(--brand-soft); }

.theme-toggle {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 11px;
  border-radius: 8px; border: 1px solid var(--border); background: var(--bg-surface);
  color: var(--text); font-size: 13px; font-weight: 500; white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s;
}
.theme-toggle .icon { width: 16px; height: 16px; color: var(--muted); }
.theme-toggle:hover { background: var(--bg-hover); border-color: var(--border-strong); }

.eyebrow {
  display: block; color: var(--subtle); font-size: 12px;
  letter-spacing: 0.08em; font-weight: 600; text-transform: uppercase; line-height: 1.4;
}

.spinner {
  width: 17px; height: 17px; border: 2px solid currentColor; border-top-color: transparent;
  border-radius: 50%; display: inline-block; animation: spin 0.7s linear infinite;
  opacity: 0.75; flex-shrink: 0;
}
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes shimmer { to { background-position-x: -200%; } }

/* Brand */
.brand { display: inline-flex; align-items: center; gap: 11px; width: fit-content; }
.brand-symbol {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 10px; background: var(--brand); color: #ffffff;
  font-size: 23px; font-weight: 800; letter-spacing: -1.5px; line-height: 1; flex-shrink: 0;
}
.brand-symbol > span { color: #a7f3d0; margin-left: 1px; }
.brand-word {
  display: flex; flex-direction: column; color: var(--ink);
  font-size: 18px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.05;
}
.brand-word > span {
  margin-top: 3px; font-size: 12px; font-weight: 600; color: var(--subtle);
  letter-spacing: 0.14em; transform-origin: left center;
}

.boot-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 18px; color: var(--muted); font-size: 14px;
}
.boot-mark {
  width: 58px; height: 58px; display: grid; place-content: center; border-radius: 16px;
  background: var(--brand); color: #ffffff; font-size: 36px; font-weight: 800; letter-spacing: -2px;
}
.boot-mark span { display: none; }

/* Login: calm centered single-surface layout */
.login-page {
  min-height: 100vh; display: flex; flex-direction: column; justify-content: space-between;
  padding: 24px 32px; background: var(--bg-canvas); gap: 24px;
}
.login-topbar {
  width: 100%; max-width: 1040px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.login-center { flex: 1; display: flex; align-items: center; justify-content: center; padding: 12px 0; }
.login-card {
  width: 100%; max-width: 420px; background: var(--bg-surface);
  border: 1px solid var(--border); border-radius: 16px; padding: 34px 32px 30px;
  box-shadow: var(--shadow-md); animation: fade-in 0.18s ease both;
}
.login-welcome { display: block; font-size: 13px; color: var(--brand-ink); font-weight: 600; }
.login-card h1 {
  margin-top: 8px; margin-bottom: 8px; color: var(--ink);
  font-size: 24px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.3;
}
.login-card > p { font-size: 14px; color: var(--muted); line-height: 1.6; }
.login-form { display: flex; flex-direction: column; gap: 18px; margin-top: 24px; }
.login-security {
  display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted);
  padding: 10px 12px; background: var(--bg-subtle); border-radius: 8px; border: 1px solid var(--border);
}
.login-security .icon { width: 16px; height: 16px; color: var(--brand-ink); }
.button.login-submit { min-height: 44px; justify-content: space-between; padding: 10px 18px; font-size: 14px; }
.login-help {
  margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border);
  font-size: 12.5px; line-height: 1.75; color: var(--muted); text-align: center;
}
.login-footer {
  width: 100%; max-width: 1040px; margin: 0 auto;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  color: var(--subtle); font-size: 12.5px;
}

/* Application shell */
.workspace { min-height: 100vh; }
.sidebar {
  width: 244px; position: fixed; inset: 0 auto 0 0; z-index: 40;
  background: var(--bg-sidebar); border-right: 1px solid var(--border);
  color: var(--text); display: flex; flex-direction: column; padding: 20px 14px 16px;
}
.sidebar-brand {
  padding: 2px 8px 18px; display: flex; justify-content: space-between; align-items: center;
}
.workspace-label {
  display: flex; align-items: center; gap: 10px; padding: 10px 10px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--bg-surface);
  box-shadow: var(--shadow-sm);
}
.workspace-avatar {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand-ink); font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.workspace-label > span:nth-child(2) { font-size: 13px; font-weight: 600; color: var(--ink); flex: 1; min-width: 0; }
.workspace-label small { display: block; font-size: 12px; color: var(--subtle); font-weight: 400; margin-top: 1px; }
.nav-caption {
  margin: 22px 10px 8px; color: var(--subtle); letter-spacing: 0.06em;
  font-size: 12px; font-weight: 600;
}
.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 9px;
  min-height: 42px; color: var(--muted); font-size: 14px; font-weight: 500;
  transition: background-color 0.15s, color 0.15s;
}
.nav-item > .icon { width: 18px; height: 18px; color: var(--subtle); transition: color 0.15s; }
.nav-item > b {
  margin-left: auto; padding: 2px 7px; border-radius: 999px;
  background: var(--bg-hover); color: var(--muted); font-size: 12px; font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.nav-item:hover { background: var(--bg-hover); color: var(--ink); }
.nav-item:hover > .icon { color: var(--ink); }
.nav-item.active {
  background: var(--brand-soft); color: var(--brand-ink); font-weight: 600;
}
.nav-item.active > .icon { color: var(--brand-ink); }
.nav-item.active > b { background: var(--bg-surface); color: var(--brand-ink); }

.sidebar-spacer { flex: 1; }
.sidebar-utility { padding: 8px 0 12px; }
.sidebar-guide-btn {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 9px; border: 1px solid var(--border); background: var(--bg-surface);
  color: var(--text); font-size: 13.5px; font-weight: 500; text-align: left;
  transition: background-color 0.15s, border-color 0.15s;
}
.sidebar-guide-btn .icon:first-child { width: 17px; height: 17px; color: var(--brand-ink); }
.sidebar-guide-btn .icon:last-child { width: 15px; height: 15px; color: var(--subtle); margin-left: auto; }
.sidebar-guide-btn:hover { background: var(--bg-hover); border-color: var(--border-strong); }

.sidebar-bottom {
  padding: 12px 6px 0; display: flex; align-items: center; gap: 10px;
  border-top: 1px solid var(--border);
}
.admin-avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft);
  color: var(--brand-ink); display: grid; place-items: center; font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.admin-identity {
  color: var(--ink); font-size: 13.5px; font-weight: 600; flex: 1;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.admin-identity small { display: block; color: var(--subtle); font-size: 12px; font-weight: 400; margin-top: 1px; }

.main-shell { margin-left: 244px; min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: 60px; background: var(--bg-surface);
  border-bottom: 1px solid var(--border); padding: 0 32px;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
}
.breadcrumb { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--subtle); }
.breadcrumb .icon { width: 14px; height: 14px; }
.breadcrumb b { color: var(--ink); font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.connection-label {
  display: inline-flex; align-items: center; gap: 7px; color: var(--muted);
  font-size: 12.5px; font-weight: 500; padding: 5px 10px; border-radius: 999px;
  background: var(--bg-subtle); border: 1px solid var(--border);
}
.connection-label > i { width: 7px; height: 7px; border-radius: 50%; background: #10b981; flex-shrink: 0; }
.topbar-divider { width: 1px; height: 20px; background: var(--border); }
.topbar-avatar {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  color: var(--brand-ink); font-size: 13px; font-weight: 700;
  border: 1px solid var(--brand-border); background: var(--brand-soft);
}
.topbar-avatar:hover { border-color: var(--brand); }

.main-content {
  flex: 1; display: flex; flex-direction: column;
  padding: 28px 32px 0; max-width: 1480px; width: 100%; margin: 0 auto;
}
.page-heading {
  display: flex; justify-content: space-between; gap: 20px; align-items: flex-end;
  margin-bottom: 24px;
}
.page-heading h1 {
  color: var(--ink); font-size: 24px; font-weight: 700;
  letter-spacing: -0.02em; line-height: 1.3; margin: 4px 0 6px;
}
.page-heading p { font-size: 14px; color: var(--muted); line-height: 1.55; }
.heading-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
#page-content { flex: 1; }
.page-footer {
  display: flex; justify-content: space-between; align-items: center; gap: 15px;
  min-height: 64px; margin-top: 24px; border-top: 1px solid var(--border);
  color: var(--subtle); font-size: 12.5px;
}
.page-footer i { font-style: normal; margin: 0 7px; color: var(--border-strong); }
.nav-backdrop, .nav-toggle, .sidebar-close { display: none; }

/* Dashboard */
.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.metric {
  position: relative; padding: 18px 20px; background: var(--bg-surface);
  border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-sm);
}
.metric.accent { background: var(--brand-soft); border-color: var(--brand-border); }
.metric-top {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  font-size: 13px; font-weight: 500; color: var(--muted);
}
.metric-icon {
  color: var(--muted); background: var(--bg-subtle); display: grid; place-items: center;
  width: 32px; height: 32px; border-radius: 8px;
}
.metric-icon .icon { width: 17px; height: 17px; }
.metric.accent .metric-top { color: var(--brand-ink); }
.metric.accent .metric-icon { background: var(--bg-surface); color: var(--brand-ink); }
.metric > strong {
  display: block; margin: 10px 0 8px; font-size: 30px; line-height: 1.15;
  letter-spacing: -0.02em; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums;
}
.metric > strong small { font-size: 17px; margin-left: 3px; font-weight: 600; color: var(--muted); }
.metric-foot {
  display: flex; align-items: center; gap: 6px; color: var(--muted);
  font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.foot-divider { color: var(--border-strong); margin: 0 3px; }
.tiny-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--subtle); flex-shrink: 0; }
.tiny-dot.green { background: #10b981; }

.panel {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-sm); min-width: 0; overflow: hidden;
}
.panel-heading {
  padding: 18px 22px 16px; display: flex; justify-content: space-between; align-items: center; gap: 15px;
}
.panel-heading h2 {
  font-size: 15px; font-weight: 600; color: var(--ink);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.panel-heading p { font-size: 13px; color: var(--muted); margin-top: 3px; }
.panel-heading > .icon { color: var(--muted); width: 19px; height: 19px; }
.live-pill {
  font-size: 12px; font-weight: 500; color: var(--muted);
  background: var(--bg-subtle); border: 1px solid var(--border); border-radius: 6px; padding: 2px 8px;
}

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.85fr) minmax(290px, 1fr); gap: 20px; margin-bottom: 20px; }
.chart-panel .panel-heading { padding-bottom: 10px; }
.chart-legend { display: flex; gap: 16px; color: var(--muted); font-size: 12.5px; font-weight: 500; flex-shrink: 0; }
.chart-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; }
.legend-dot.total { background: var(--chart-total); }
.legend-dot.delivered { background: var(--chart-delivered); }

.chart-wrap {
  padding: 6px 18px 16px 8px; position: relative; min-height: 245px;
  display: flex; align-items: flex-end;
}
.trend-chart { width: 100%; height: auto; display: block; max-height: 260px; overflow: visible; }
.chart-gridline { stroke: var(--chart-grid); stroke-width: 1; stroke-dasharray: 4 4; }
.chart-y, .chart-x { fill: var(--muted); font-size: 12px; font-family: inherit; }
.chart-line { fill: none; stroke-width: 2.25; stroke-linecap: round; stroke-linejoin: round; }
.chart-line.total { stroke: var(--chart-total); stroke-dasharray: 4 3; opacity: 0.75; }
.chart-line.delivered { stroke: var(--chart-delivered); }
.chart-dot { fill: var(--bg-surface); stroke-width: 2; transition: r 0.12s; }
.chart-dot.total { stroke: var(--chart-total); }
.chart-dot.delivered { stroke: var(--chart-delivered); }
.chart-guide { stroke: var(--border-strong); stroke-width: 1; opacity: 0; transition: opacity 0.12s; pointer-events: none; }
.chart-hit { fill: transparent; cursor: crosshair; }
.chart-hit:focus { outline: none; }
.chart-col.is-active .chart-guide { opacity: 1; }
.chart-empty {
  position: absolute; inset: 28px 50px 53px; display: flex; gap: 8px;
  justify-content: center; align-items: center; color: var(--muted); font-size: 13px; text-align: center;
}
.chart-empty-dot { width: 7px; height: 7px; background: var(--border-strong); border-radius: 50%; }
.chart-tooltip {
  position: absolute; top: 10px; z-index: 5; pointer-events: none;
  min-width: 146px; padding: 9px 12px; border-radius: 9px;
  background: var(--bg-surface); border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-md); font-size: 12.5px; color: var(--text);
}
.chart-tooltip strong { display: block; color: var(--ink); font-size: 12.5px; margin-bottom: 4px; }
.chart-tooltip div { display: flex; justify-content: space-between; gap: 14px; line-height: 1.55; }
.chart-tooltip span { color: var(--muted); }
.chart-tooltip b { font-variant-numeric: tabular-nums; color: var(--ink); }

/* Health / summary panel (replaces old dark card) */
.health-panel {
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 20px 22px; background: var(--bg-surface);
  border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-sm);
}
.health-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.health-top h2 { font-size: 16px; font-weight: 600; color: var(--ink); margin-top: 4px; }
.health-top > .icon { width: 20px; height: 20px; color: var(--brand-ink); }
.health-desc { margin-top: 8px; font-size: 13px; color: var(--muted); line-height: 1.6; }
.config-progress {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 18px 0 8px; font-size: 13px; color: var(--text); font-weight: 500;
}
.config-progress strong { font-weight: 700; font-size: 20px; color: var(--ink); font-variant-numeric: tabular-nums; }
.config-progress small { font-size: 13px; color: var(--muted); font-weight: 500; }
.config-bar {
  height: 8px; border-radius: 999px; background: var(--bg-subtle);
  border: 1px solid var(--border); overflow: hidden;
}
.config-bar > span { display: block; height: 100%; border-radius: 999px; background: var(--brand); }
.health-stats {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px;
  margin: 18px 0; padding: 12px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.health-stats > div span { display: block; font-size: 12px; color: var(--muted); }
.health-stats > div b { display: block; margin-top: 2px; font-size: 16px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.health-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.dashboard-lower { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.dashboard-lower .panel-heading { border-bottom: 1px solid var(--border); }
.recent-sites, .recent-events { padding: 4px 22px; }
.recent-site {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 0;
  text-align: left; background: none; border: 0; border-bottom: 1px solid var(--border); color: inherit;
}
.recent-site:last-child, .recent-event:last-child { border-bottom: 0; }
.site-mark, .backend-mark {
  width: 36px; height: 36px; border-radius: 9px; display: flex; align-items: center; justify-content: center;
  background: var(--bg-subtle); color: var(--muted); flex-shrink: 0; border: 1px solid var(--border);
}
.site-mark .icon, .backend-mark .icon { width: 18px; height: 18px; }
.site-identity { display: block; flex: 1; min-width: 0; }
.site-identity b {
  display: block; font-size: 14px; color: var(--ink); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.site-identity small {
  font-size: 12.5px; color: var(--muted); display: block; margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.recent-site > .icon { width: 15px; height: 15px; color: var(--subtle); margin-left: 4px; }
.recent-site:hover .site-identity b { color: var(--brand-ink); }

.badge {
  display: inline-flex; justify-content: center; align-items: center; gap: 5px;
  white-space: nowrap; border-radius: 6px; padding: 3px 9px;
  font-size: 12px; line-height: 1.4; font-weight: 600; border: 1px solid transparent;
}
.badge .icon { width: 13px; height: 13px; }
.badge.green { background: var(--green-bg); color: var(--green-fg); border-color: var(--green-border); }
.badge.neutral { background: var(--neutral-bg); color: var(--neutral-fg); border-color: var(--neutral-border); }
.badge.amber { background: var(--amber-bg); color: var(--amber-fg); border-color: var(--amber-border); }
.badge.blue { background: var(--blue-bg); color: var(--blue-fg); border-color: var(--blue-border); }
.badge.red { background: var(--red-bg); color: var(--red-fg); border-color: var(--red-border); }

.recent-event {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 0;
  text-align: left; background: none; border: 0; border-bottom: 1px solid var(--border); color: inherit;
}
.recent-event:hover b { color: var(--brand-ink); }
.event-symbol {
  width: 34px; height: 34px; background: var(--green-bg); color: var(--green-fg);
  border: 1px solid var(--green-border); display: grid; place-items: center; border-radius: 50%; flex-shrink: 0;
}
.event-symbol .icon { width: 15px; height: 15px; }
.event-symbol.is-failed { background: var(--red-bg); color: var(--red-fg); border-color: var(--red-border); }
.recent-event > div { flex: 1; min-width: 0; }
.recent-event b { display: block; font-size: 14px; font-weight: 600; color: var(--ink); }
.recent-event small {
  display: block; font-size: 12.5px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px;
}
.recent-event small > span { margin: 0 5px; }

/* Tables, toolbars, filters */
.list-toolbar {
  display: flex; justify-content: space-between; gap: 14px; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.filter-tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--bg-subtle); border-radius: 9px; border: 1px solid var(--border); }
.filter-tab {
  background: none; border: 0; border-radius: 7px; padding: 6px 12px;
  font-size: 13px; font-weight: 500; color: var(--muted);
  display: inline-flex; align-items: center; gap: 7px; min-height: 32px; white-space: nowrap;
}
.filter-tab:hover { color: var(--ink); }
.filter-tab.active {
  background: var(--bg-surface); box-shadow: var(--shadow-sm);
  color: var(--ink); font-weight: 600;
}
.filter-tab > span {
  font-size: 12px; padding: 1px 6px; border-radius: 999px;
  background: var(--bg-subtle); color: var(--muted); font-variant-numeric: tabular-nums;
}
.filter-tab.active > span { background: var(--brand-soft); color: var(--brand-ink); }

.search-field {
  display: flex; align-items: center; gap: 8px; border: 1px solid var(--border-strong);
  border-radius: 9px; padding: 0 12px; min-height: 38px; min-width: 250px;
  color: var(--subtle); background: var(--bg-surface);
}
.search-field .icon { width: 16px; height: 16px; }
.search-field input {
  border: 0; padding: 0; color: var(--ink); background: transparent;
  font-size: 13.5px; width: 100%; height: 36px;
}
.search-field input:focus-visible { outline: none; }
.search-field:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }

input::placeholder, textarea::placeholder { color: var(--subtle); opacity: 1; }

.table-scroll {
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent;
}
.data-table { width: 100%; border-collapse: collapse; text-align: left; }
.data-table th {
  background: var(--bg-subtle); padding: 12px 18px; font-size: 12.5px;
  color: var(--muted); font-weight: 600; white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 15px 18px; border-bottom: 1px solid var(--border);
  font-size: 13.5px; color: var(--text); vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr { transition: background-color 0.12s; }
.data-table tbody tr:hover { background: var(--bg-hover); }

.sites-table { min-width: 960px; }
.sites-table th, .sites-table td { padding: 14px 14px; }
.sites-table th:first-child, .sites-table td:first-child { padding-left: 20px; }
.sites-table th:last-child, .sites-table td:last-child { padding-right: 20px; }
.sites-table th:nth-child(1) { min-width: 170px; }
.sites-table th:nth-child(3), .sites-table td:nth-child(3) { min-width: 230px; }
.backends-table { min-width: 780px; }
.events-table { min-width: 780px; }
.events-table tbody tr[data-action="event-detail"] { cursor: pointer; }

.site-cell { display: flex; align-items: center; gap: 11px; min-width: 155px; }
.site-cell > div { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.table-link {
  padding: 0; background: none; border: 0; text-align: left;
  color: var(--ink); font-size: 14px; font-weight: 600;
}
.table-link:hover { color: var(--brand-ink); text-decoration: underline; text-underline-offset: 3px; }
.domain-link {
  display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px;
  color: var(--muted); margin-top: 2px; white-space: nowrap;
}
.domain-link .icon { width: 12px; height: 12px; }
.domain-link:hover { color: var(--brand-ink); }

.pixel-cell { display: inline-flex; align-items: center; gap: 6px; }
.pixel-value {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: ui-monospace, 'SFMono-Regular', 'Menlo', monospace;
  font-size: 12.5px; white-space: nowrap; color: var(--ink);
}
.pixel-value > i { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); flex-shrink: 0; }

.token-value {
  display: inline-flex; align-items: center; gap: 6px;
  min-width: 205px; max-width: 240px;
}
.token-value > code {
  font-size: 12.5px; line-height: 1.45; overflow-wrap: anywhere; word-break: break-all;
  background: var(--bg-subtle); border: 1px solid var(--border); border-radius: 7px;
  padding: 5px 9px; color: var(--ink); user-select: all;
}
.token-value .icon-button, .pixel-cell .icon-button, .address-url .icon-button, .event-id-row .icon-button {
  width: 28px; height: 28px;
}
.token-value .icon-button .icon, .pixel-cell .icon-button .icon, .address-url .icon-button .icon, .event-id-row .icon-button .icon {
  width: 14px; height: 14px;
}

.backend-cell { display: flex; align-items: center; gap: 8px; min-width: 110px; }
.backend-cell > .icon { width: 15px; height: 15px; color: var(--muted); }
.backend-cell > span { font-size: 13px; color: var(--ink); font-weight: 500; }
.backend-cell small {
  display: block; max-width: 135px; overflow: hidden; white-space: nowrap;
  text-overflow: ellipsis; font-size: 12px; color: var(--muted); margin-top: 2px; font-weight: 400;
}

.status-toggle {
  display: inline-flex; gap: 8px; align-items: center; background: none; border: 0;
  padding: 4px 0; color: var(--muted); white-space: nowrap;
}
.status-toggle > span {
  display: block; width: 34px; height: 20px; background: var(--border-strong);
  border-radius: 999px; padding: 2px; transition: background-color 0.15s;
}
.status-toggle > span::after {
  content: ''; display: block; width: 16px; height: 16px; background: #ffffff;
  border-radius: 50%; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); transition: transform 0.15s;
}
.status-toggle.is-on { color: var(--brand-ink); }
.status-toggle.is-on > span { background: var(--brand); }
.status-toggle.is-on > span::after { transform: translateX(14px); }
.status-toggle > b { font-size: 12.5px; font-weight: 600; }

.row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.row-actions .icon-button { width: 32px; height: 32px; }
.row-actions .icon { width: 16px; height: 16px; }

.table-footer {
  padding: 13px 20px; border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  color: var(--muted); font-size: 12.5px; gap: 15px;
}
.below-note {
  display: flex; align-items: flex-start; gap: 8px; padding: 14px 2px 0;
  color: var(--muted); font-size: 13px; line-height: 1.65;
}
.below-note .icon { width: 16px; height: 16px; margin-top: 2px; color: var(--subtle); }

.empty-state {
  min-height: 240px; padding: 40px 24px; display: flex; align-items: center;
  justify-content: center; flex-direction: column; text-align: center;
}
.empty-symbol {
  width: 50px; height: 50px; border-radius: 13px; display: grid; place-items: center;
  background: var(--bg-subtle); border: 1px solid var(--border); color: var(--muted); margin-bottom: 14px;
}
.empty-symbol .icon { width: 24px; height: 24px; }
.empty-state h3 { font-size: 15px; font-weight: 600; color: var(--ink); }
.empty-state p { margin-top: 6px; max-width: 360px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.empty-state .button { margin-top: 18px; }
.dashboard-lower .empty-state { min-height: 200px; padding: 28px 20px; }

.address-info {
  display: flex; align-items: center; gap: 16px; padding: 18px 22px; margin-bottom: 18px;
  border: 1px solid var(--brand-border); border-radius: 12px; background: var(--brand-soft);
}
.address-info > .icon { width: 26px; height: 26px; color: var(--brand-ink); }
.address-info > div { flex: 1; min-width: 0; }
.address-info h3 { font-size: 15px; color: var(--ink); font-weight: 600; }
.address-info p { margin-top: 4px; font-size: 13px; color: var(--text); line-height: 1.55; }
.address-count {
  text-align: right; font-size: 28px; color: var(--brand-ink);
  line-height: 1.1; font-weight: 700; font-variant-numeric: tabular-nums; flex-shrink: 0;
}
.address-count small { font-size: 12px; display: block; color: var(--muted); margin-top: 4px; font-weight: 500; }
.address-url { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text); }
.address-url > span { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.count-badge {
  font-size: 12.5px; font-weight: 500; color: var(--text); background: var(--bg-subtle);
  border: 1px solid var(--border); padding: 4px 10px; border-radius: 6px; white-space: nowrap;
}

.events-toolbar-left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.events-filter { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.events-filter > label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 500; }
.events-filter select {
  border: 1px solid var(--border-strong); border-radius: 8px; background: var(--bg-surface);
  color: var(--ink); padding: 7px 12px; min-width: 146px; font-size: 13.5px; min-height: 38px;
}
.events-toolbar-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-left: auto; }
.list-caption { font-size: 12.5px; color: var(--muted); white-space: nowrap; }

.event-cell { display: flex; gap: 10px; align-items: center; min-width: 220px; }
.small-event-symbol {
  color: var(--brand-ink); background: var(--brand-soft); display: grid; place-items: center;
  width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
}
.small-event-symbol .icon { width: 16px; height: 16px; }
.event-cell b { display: block; font-size: 14px; font-weight: 600; color: var(--ink); }
.event-id-row { display: flex; align-items: center; gap: 4px; margin-top: 2px; }
.event-id-row small {
  display: block; font-family: ui-monospace, 'SFMono-Regular', 'Menlo', monospace;
  font-size: 12px; color: var(--muted); max-width: 190px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.attempt-count { color: var(--ink); font-size: 13.5px; font-weight: 500; font-variant-numeric: tabular-nums; }

.inline-loading {
  min-height: 240px; display: flex; align-items: center; justify-content: center;
  gap: 11px; color: var(--muted); font-size: 14px;
}
.loading-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.skeleton {
  border: 1px solid var(--border); border-radius: 12px;
  background: linear-gradient(100deg, var(--bg-subtle) 25%, var(--bg-hover) 45%, var(--bg-subtle) 65%);
  background-size: 200% 100%; animation: shimmer 1.6s infinite;
}
.skeleton-card { height: 132px; }
.skeleton-panel { grid-column: 1 / -1; height: 320px; margin-top: 4px; }

/* Settings & forms */
.settings-grid {
  display: grid; grid-template-columns: minmax(290px, 0.85fr) minmax(0, 1.15fr);
  gap: 20px; align-items: start; max-width: 1160px;
}
.account-panel .panel-heading, .password-panel .panel-heading { border-bottom: 1px solid var(--border); }
.account-profile { display: flex; align-items: center; gap: 16px; padding: 22px; }
.profile-avatar {
  display: grid; place-items: center; width: 54px; height: 54px; border-radius: 14px;
  background: var(--brand-soft); border: 1px solid var(--brand-border);
  color: var(--brand-ink); font-size: 22px; font-weight: 700;
}
.account-profile h3 { font-size: 18px; font-weight: 600; color: var(--ink); margin-bottom: 4px; }
.account-meta { margin: 0 22px; }
.account-meta > div {
  display: flex; justify-content: space-between; gap: 16px; padding: 13px 0;
  border-top: 1px solid var(--border); font-size: 13px;
}
.account-meta span { color: var(--muted); }
.account-meta b { font-weight: 600; color: var(--ink); }
.account-note {
  display: flex; align-items: center; gap: 8px; padding: 15px 22px;
  font-size: 12.5px; color: var(--muted); background: var(--bg-subtle);
  border-top: 1px solid var(--border); margin-top: 8px;
}
.account-note .icon { width: 15px; height: 15px; }

.settings-form { padding: 22px; display: flex; flex-direction: column; gap: 18px; }
.settings-form > .button { align-self: flex-start; }

.field { display: flex; flex-direction: column; gap: 7px; color: var(--ink); font-size: 13.5px; }
.field > span:first-child { font-weight: 600; display: flex; align-items: center; gap: 6px; }
.field > span:first-child > b { color: var(--red-fg); font-size: 13px; font-weight: 600; }
.field input, .field textarea, .field select {
  border: 1px solid var(--border-strong); background: var(--bg-surface); border-radius: 9px;
  color: var(--ink); min-height: 42px; padding: 9px 12px; width: 100%; font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field textarea {
  resize: vertical; font-family: ui-monospace, 'SFMono-Regular', 'Menlo', monospace;
  line-height: 1.65; min-height: 86px; font-size: 13px;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring);
}
.field small {
  display: flex; align-items: flex-start; gap: 6px; color: var(--muted);
  font-size: 12.5px; line-height: 1.55; font-weight: 400;
}
.field small .icon { width: 14px; height: 14px; margin-top: 2px; flex-shrink: 0; }

.input-wrap {
  display: flex !important; align-items: center; border: 1px solid var(--border-strong);
  border-radius: 9px; padding: 0 12px; gap: 10px; background: var(--bg-surface); min-height: 44px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input-wrap > .icon { width: 17px; height: 17px; color: var(--subtle); }
.input-wrap input {
  border: 0; background: transparent; padding: 10px 0; min-height: 40px;
  box-shadow: none !important; border-radius: 0;
}
.input-wrap input:focus-visible { outline: none; }
.input-wrap:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.input-wrap:has(input:disabled) { background: var(--bg-subtle); opacity: 0.75; }
.input-wrap .icon-button { width: 28px; height: 28px; margin-right: -4px; }
.token-input-wrap input { font-family: ui-monospace, 'SFMono-Regular', 'Menlo', monospace; font-size: 13px; }

.form-error {
  border: 1px solid var(--red-border); background: var(--red-bg); padding: 11px 14px;
  font-size: 13.5px; line-height: 1.55; color: var(--red-fg); border-radius: 9px;
}
.form-note {
  display: flex; align-items: flex-start; gap: 9px; padding: 12px 14px; border-radius: 9px;
  background: var(--bg-subtle); border: 1px solid var(--border); font-size: 13px; color: var(--text); line-height: 1.6;
}
.form-note .icon { width: 16px; height: 16px; margin-top: 2px; color: var(--brand-ink); }

/* Modals */
.modal {
  padding: 0; border: 1px solid var(--border); border-radius: 16px; color: var(--text);
  width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 36px);
  background: var(--bg-surface); box-shadow: var(--shadow-lg); overflow: hidden;
}
.modal.wide { width: min(740px, calc(100vw - 24px)); }
.modal::backdrop { background: var(--backdrop); backdrop-filter: blur(4px); }
.modal[open] { animation: fade-in 0.15s ease both; }
.modal-inner { display: flex; flex-direction: column; max-height: calc(100dvh - 38px); }
.modal-header {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
  padding: 22px 24px 18px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.modal-header h2 { font-size: 18px; color: var(--ink); font-weight: 700; }
.modal-header p { color: var(--muted); font-size: 13px; margin-top: 4px; line-height: 1.55; }
.modal-header .icon-button { margin: -4px -6px 0 0; }
.modal-body {
  padding: 22px 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 18px;
  scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; overscroll-behavior: contain;
}
.modal-footer {
  display: flex; justify-content: flex-end; align-items: center; gap: 10px;
  padding: 15px 24px; border-top: 1px solid var(--border); background: var(--bg-subtle); flex-shrink: 0;
}
.modal-footer .button { min-width: 88px; }

.form-section-title {
  display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600;
  color: var(--ink); border-top: 1px solid var(--border); padding-top: 18px; margin-top: 2px;
}
.form-section-title:first-of-type { margin-top: 0; padding-top: 0; border-top: 0; }
.form-section-title > span:first-child {
  font-size: 12px; background: var(--brand-soft); color: var(--brand-ink);
  padding: 2px 7px; border-radius: 5px; font-weight: 600;
}
.section-optional { margin-left: auto; color: var(--muted); font-size: 12px; font-weight: 500; }
.form-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.switch-field {
  display: flex; justify-content: space-between; align-items: center; gap: 18px;
  background: var(--bg-subtle); border: 1px solid var(--border); border-radius: 10px; padding: 13px 16px;
}
.switch-field > span:first-child { display: block; }
.switch-field b { color: var(--ink); font-size: 14px; font-weight: 600; }
.switch-field small { display: block; font-size: 12.5px; margin-top: 3px; color: var(--muted); line-height: 1.5; }
.form-switch { display: block; width: 38px; height: 22px; position: relative; flex-shrink: 0; }
.form-switch input { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; opacity: 0; margin: 0; cursor: pointer; }
.form-switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--border-strong); transition: background-color 0.15s; }
.form-switch i::after {
  content: ''; position: absolute; width: 18px; height: 18px; top: 2px; left: 2px;
  border-radius: 50%; background: #ffffff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); transition: transform 0.15s;
}
.form-switch input:checked + i { background: var(--brand); }
.form-switch input:checked + i::after { transform: translateX(16px); }
.form-switch input:focus-visible + i { outline: 2px solid var(--brand); outline-offset: 2px; }

.inline-success {
  font-size: 12px; font-weight: 600; background: var(--green-bg); color: var(--green-fg);
  border: 1px solid var(--green-border); padding: 1px 7px; border-radius: 5px; margin-left: 4px;
}
.checkbox-field { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 13px; cursor: pointer; }
.checkbox-field input { accent-color: var(--brand); width: 15px; height: 15px; }
.clear-token { margin-top: -6px; }

.delete-warning {
  display: flex; gap: 14px; align-items: center; padding: 16px; border-radius: 10px;
  background: var(--red-bg); border: 1px solid var(--red-border);
}
.delete-warning > .icon { color: var(--red-fg); width: 24px; height: 24px; }
.delete-warning b { color: var(--ink); font-size: 14px; font-weight: 600; }
.delete-warning span { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; overflow-wrap: anywhere; }
.delete-copy { font-size: 13.5px; color: var(--text); line-height: 1.65; }

.detail-status { display: flex; align-items: center; gap: 10px; }
.detail-status > span:last-child { font-size: 15px; color: var(--ink); font-weight: 600; }
.detail-list { margin: 0; }
.detail-list > div {
  display: grid; grid-template-columns: 96px 1fr; gap: 12px; padding: 12px 0;
  border-bottom: 1px solid var(--border); font-size: 13.5px;
}
.detail-list dt { color: var(--muted); font-weight: 500; }
.detail-list dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
.detail-list .mono { font-size: 12.5px; }
.delivery-message { background: var(--bg-subtle); border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
.delivery-message > span { font-size: 12px; font-weight: 600; color: var(--muted); }
.delivery-message p { margin-top: 6px; font-size: 13.5px; color: var(--ink); overflow-wrap: anywhere; line-height: 1.6; }

.setup-step { display: flex; align-items: flex-start; gap: 13px; }
.setup-step > span {
  width: 28px; height: 28px; border-radius: 8px; background: var(--brand-soft);
  border: 1px solid var(--brand-border); display: grid; place-items: center;
  color: var(--brand-ink); font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.setup-step h3 { font-size: 14px; color: var(--ink); font-weight: 600; }
.setup-step p { font-size: 13px; color: var(--muted); margin-top: 4px; line-height: 1.6; }
.code-example {
  background: #111827; border: 1px solid #262e3b; padding: 15px 17px; border-radius: 10px; color: #e2e8f0;
}
.code-example > span { display: block; font-size: 12px; color: #94a3b8; margin-bottom: 8px; font-weight: 500; }
.code-example code { display: block; font-size: 12.5px; line-height: 1.7; white-space: nowrap; overflow-x: auto; color: #6ee7b7; }

.toast-stack {
  position: fixed; z-index: 10000; top: 18px; left: 50%; transform: translateX(-50%);
  width: min(460px, calc(100vw - 24px)); display: flex; flex-direction: column;
  align-items: center; gap: 8px; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px 10px 14px;
  border: 1px solid var(--brand-border); border-radius: 10px; background: var(--bg-surface);
  box-shadow: var(--shadow-md); color: var(--ink); font-size: 13.5px; font-weight: 500;
  animation: toast-in 0.18s ease; pointer-events: auto; max-width: 100%;
}
.toast > .icon { width: 18px; height: 18px; color: var(--brand-ink); }
.toast > span { flex: 1; line-height: 1.5; }
.toast.error { border-color: var(--red-border); }
.toast.error > .icon { color: var(--red-fg); }
.toast .icon-button { width: 26px; height: 26px; }
.toast .icon-button .icon { width: 14px; height: 14px; }

/* Responsive */
@media (max-width: 1180px) {
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-lower { grid-template-columns: 1fr; }
}

@media (max-width: 960px) {
  .sidebar { width: 220px; padding: 18px 12px 14px; }
  .main-shell { margin-left: 220px; }
  .topbar { padding: 0 22px; }
  .main-content { padding: 24px 22px 0; }
  .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .sidebar {
    transform: translateX(-100%); transition: transform 0.2s ease;
    width: 256px; box-shadow: var(--shadow-lg);
  }
  .nav-open .sidebar { transform: translateX(0); }
  .sidebar-close { display: inline-flex; }
  .nav-backdrop { position: fixed; inset: 0; background: var(--backdrop); z-index: 35; border: 0; }
  .nav-open .nav-backdrop { display: block; }
  .main-shell { margin-left: 0; }
  .nav-toggle { display: inline-flex; margin-left: -6px; }
  .topbar { padding: 0 18px; height: 58px; }
  .main-content { padding: 20px 18px 0; }
  .page-heading { flex-wrap: wrap; align-items: flex-start; gap: 14px; }
  .page-heading h1 { font-size: 22px; }
  .connection-label span { display: none; }
}

@media (max-width: 620px) {
  .login-page { padding: 18px 16px; }
  .login-card { padding: 26px 20px 22px; border-radius: 14px; }
  .login-footer { flex-direction: column; text-align: center; gap: 6px; }
  .topbar { padding: 0 14px; }
  .topbar-divider { display: none; }
  .theme-toggle span { display: none; }
  .theme-toggle { width: 34px; padding: 0; justify-content: center; }
  .main-content { padding: 18px 14px 0; }
  .heading-actions { width: 100%; justify-content: flex-end; }
  .heading-actions .button.primary { margin-left: auto; }
  .icon-only-mobile span { display: none; }
  .icon-only-mobile { min-width: 40px; padding: 8px !important; }
  .metrics-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .metric { padding: 14px 14px; }
  .metric > strong { font-size: 26px; }
  .panel-heading { padding: 16px; flex-wrap: wrap; }
  .recent-sites, .recent-events { padding: 4px 16px; }
  .list-toolbar { padding: 14px; }
  .filter-tabs { width: 100%; }
  .filter-tab { flex: 1; justify-content: center; padding: 7px 6px; }
  .search-field { width: 100%; min-width: 0; }
  .events-toolbar-left, .events-toolbar-right, .events-filter { width: 100%; }
  .events-filter > label { flex: 1; min-width: 0; flex-direction: column; align-items: flex-start; gap: 5px; }
  .events-filter select { width: 100%; min-width: 0; }
  .address-info { flex-direction: column; align-items: flex-start; padding: 16px; }
  .address-count { text-align: left; }
  .page-footer { flex-direction: column; align-items: flex-start; justify-content: center; gap: 4px; padding: 12px 0; }
  .form-columns { grid-template-columns: 1fr; gap: 14px; }
  .modal-header { padding: 18px 18px 14px; }
  .modal-body { padding: 18px; }
  .modal-footer { padding: 14px 18px; }
  .field input, .field select, .login-form input { font-size: 16px; }
  .loading-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
}

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