﻿/* ============================================================
   ScrapePlaces Admin — Styles
   ============================================================ */

:root {
  --bg: #FFFFFF;
  --bg-soft: #F7F8FB;
  --bg-soft-2: #EEF1F7;
  --fg: #0B1733;
  --fg-2: #1B2747;
  --fg-muted: #5A6685;
  --fg-dim: #8A93AB;
  --border: #E4E8F0;
  --border-strong: #CFD5E2;
  --brand: #1F6FEB;
  --brand-dk: #1559C7;
  --brand-soft: #E8F0FF;
  --brand-soft-2: #DCE7FF;
  --accent: #0FA37F;
  --warn: #F59E0B;
  --danger: #E5484D;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --shadow-card: 0 1px 2px rgba(11,23,51,0.04), 0 4px 12px rgba(11,23,51,0.04);
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
h1,h2,h3,h4 { font-weight: 700; letter-spacing: -0.02em; line-height: 1.08; margin: 0 0 8px; color: var(--fg); }
h3 { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
h4 { font-size: 15px; font-weight: 600; }
p { margin: 0 0 12px; color: var(--fg-muted); font-size: 15px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px;
  border-radius: 9px; font-size: 13px; font-weight: 500;
  border: 1px solid transparent;
  transition: background 0.12s, border-color 0.12s, transform 0.1s;
  white-space: nowrap; cursor: pointer;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 14px; height: 14px; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 6px 14px -4px rgba(31,111,235,0.45); }
.btn-primary:hover { background: var(--brand-dk); }
.btn-outline { background: #fff; color: var(--fg); border-color: var(--border-strong); }
.btn-outline:hover { border-color: var(--brand); color: var(--brand); }
.btn-ghost { background: var(--bg-soft); color: var(--fg); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg-soft-2); }
.btn-danger { background: #FFF0F0; color: var(--danger); border-color: #FFCDD0; }
.btn-danger:hover { background: #FFE0E0; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12px; border-radius: 7px; }
.btn-lg { height: 44px; padding: 0 22px; font-size: 15px; border-radius: 11px; }
.btn-secondary { background: #fff; color: var(--fg); border-color: var(--border-strong); }
.btn-secondary:hover { border-color: var(--brand); color: var(--brand); }

/* ---------- Unified admin layout ---------- */
.admin-shell { min-height: 100vh; background: var(--bg-soft); }
.admin-layout {display: grid; grid-template-columns: 240px minmax(0, 1fr);min-height: 100vh; background: var(--bg-soft);}
.admin-login-layout { min-height: 100vh; background: var(--bg-soft); }
.admin-sidebar { display: flex; flex-direction: column; gap: 16px;position: sticky; top: 0; height: 100vh; overflow-y: auto;padding: 18px 14px; border-right: 1px solid var(--border); background: #fff;}
.admin-side-nav { display: grid; gap: 4px; }
.admin-side-nav .topnav-link {width: 100%; justify-content: flex-start;min-height: 36px; padding: 0 12px;}
.admin-logout {margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border);}
.admin-logout .btn { width: 100%; }
.admin-topbar {display: flex; justify-content: space-between; align-items: center; gap: 16px;min-height: 64px; padding: 8px 12px;border-bottom: 1px solid var(--border); background: #fff;position: sticky; top: 0; z-index: 30;}
.admin-topbar-left { display: flex; align-items: center; gap: 18px; min-width: 0; flex: 1; }
.admin-brand {display: inline-flex; align-items: center; gap: 8px;color: var(--fg); font-size: 14px; font-weight: 700; flex: 0 0 auto;}
.admin-brand-text {display: inline-flex; align-items: center; min-height: 24px;padding: 0 8px; border-radius: 6px;background: var(--brand-soft); color: var(--brand);font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;}
.nav-logo { display: inline-flex; align-items: center; }
.nav-logo img { width: 50px; height: auto; }
.topnav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.topnav-link {
  display: inline-flex; align-items: center; min-height: 34px;
  padding: 0 10px; border-radius: 6px;
  color: var(--fg-muted); font-size: 13px; font-weight: 600;
  white-space: nowrap;
}
.topnav-link:hover { background: var(--bg-soft); color: var(--fg); }
.topnav-link.is-active { background: var(--brand-soft); color: var(--brand); }
.admin-main { width: 100%; max-width: none; margin: 0; padding: 0; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(440px, 100%); }

/* ---------- Legacy admin view primitives ---------- */
.page { width: 100%; max-width: none; margin: 0; padding: 28px 24px 40px; }
.page > .page-head {
  display: flex; justify-content: space-between; gap: 16px; align-items: center;
  margin-bottom: 20px;
}
.page-title { margin: 0; font-size: 28px; line-height: 1.1; }
.page-copy { margin: 6px 0 0; color: var(--fg-muted); }
.detail-title { margin: 0 0 12px; font-size: 20px; line-height: 1.2; }
.card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--r-md);
  box-shadow: var(--shadow-card);
}
.card-body { padding: 10px; }
.card-body-data { padding: 0; }
.field { margin-bottom: 16px; }
.label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--fg-muted); }
.input {
  width: 100%; border: 1px solid var(--border-strong); border-radius: 9px;
  padding: 10px 12px; font: inherit; background: #fff; color: var(--fg);
}
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(31,111,235,0.14); }
.table-wrap { overflow: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--fg-muted); background: var(--bg-soft); }
.table tr:last-child td { border-bottom: 0; }
.muted { color: var(--fg-muted); font-size: 13px; }
.mono { font-family: var(--font-mono); font-size: 12px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; align-items: end; }
.field-inline { display: flex; flex-direction: column; gap: 6px; }
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 20px; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-value { margin-top: 8px; font-size: 28px; line-height: 1; font-family: var(--font-mono); }
.code-block {
  margin: 0; padding: 14px; border-radius: var(--r-md);
  background: #0F172A; color: #E5E7EB; overflow: auto;
  white-space: pre-wrap; word-break: break-word;
  font-family: var(--font-mono); font-size: 12px; line-height: 1.5;
}
.status { display: inline-flex; align-items: center; padding: 4px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.status.pending { background: #E5E7EB; color: #374151; }
.status.running { background: #DBEAFE; color: #1D4ED8; }
.status.succeeded { background: #DCFCE7; color: #166534; }
.status.failed { background: #FEE2E2; color: #991B1B; }
.alert-success { background: #DCFCE7; border-color: #86EFAC; color: #166534; }
.alert-error { background: #FEE2E2; border-color: #FCA5A5; color: #991B1B; }
.notes-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 20px; align-items: start; }
.notes-sidebar { position: sticky; top: 88px; }
.notes-sidebar-title { margin-bottom: 12px; font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; color: var(--fg-muted); }
.notes-country-nav { display: grid; gap: 8px; }
.notes-country-link {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  min-height: 42px; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: var(--r-md); color: var(--fg); font-weight: 600; background: #fff;
}
.notes-country-link:hover { border-color: var(--border-strong); background: var(--bg-soft); }
.notes-country-link.is-active { border-color: var(--brand-soft-2); background: var(--brand-soft); color: var(--brand); }
.notes-country-link span { color: var(--fg-muted); font-size: 12px; font-weight: 800; }
.notes-content { min-width: 0; }
.notes-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; }
.note-card { height: 100%; }
.note-kicker {
  display: inline-flex; align-items: center; min-height: 28px; padding: 0 10px;
  border-radius: 999px; background: var(--brand-soft); color: var(--brand);
  font-size: 12px; font-weight: 800; letter-spacing: 0.06em;
}
.note-head { margin: 14px 0 18px; }
.note-title { margin: 0; font-size: 22px; line-height: 1.1; }
.note-scope { margin: 6px 0 0; color: var(--fg-muted); font-weight: 600; }
.note-meta { display: grid; gap: 14px; margin: 0; }
.note-meta dt { margin: 0 0 4px; color: var(--fg-muted); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; }
.note-meta dd { margin: 0; line-height: 1.55; }
.note-meta code {
  display: inline-block; padding: 8px 10px; border-radius: 10px;
  background: var(--bg-soft); border: 1px solid var(--border); color: var(--fg);
  white-space: pre-wrap; word-break: break-word;
}
.note-list-wrap { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.note-list-title { margin-bottom: 10px; font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; color: var(--fg-muted); }
.note-list { margin: 0; padding-left: 18px; display: grid; gap: 8px; line-height: 1.5; }
.note-source { margin-top: 16px; color: var(--fg-muted); font-size: 12px; font-family: var(--font-mono); }
.empty-title { margin: 0 0 8px; font-size: 22px; }
.empty-copy { margin: 0; color: var(--fg-muted); line-height: 1.6; }
.empty-copy code { padding: 2px 6px; border-radius: 8px; background: var(--bg-soft); border: 1px solid var(--border); }
.spc-admin-page { max-width: 1180px; margin: 0 auto; padding: 24px; }
.spc-page-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; }
.spc-page-head h1 { margin: 0; font-size: 24px; font-weight: 650; }
.spc-page-head p { margin: 6px 0 0; color: var(--fg-muted); }
.spc-card { background: #fff; border: 1px solid var(--border); border-radius: var(--r-md); padding: 18px; margin-bottom: 18px; }
.spc-card h2 { margin: 0 0 14px; font-size: 17px; }
.spc-import-form { display: grid; gap: 16px; }
.spc-form-row { display: grid; gap: 6px; }
.spc-form-row label { font-weight: 600; font-size: 13px; }
.spc-form-row input,
.spc-form-row select {
  height: 38px; border: 1px solid var(--border-strong);
  border-radius: 8px; padding: 0 10px; font-size: 14px;
}
.spc-form-row input[type="file"] { padding: 8px 10px; height: auto; }
.spc-form-row small { color: var(--fg-muted); font-size: 12px; }
.spc-actions { display: flex; justify-content: flex-start; }
.spc-btn { border: 1px solid var(--fg); border-radius: 8px; padding: 9px 14px; font-size: 13px; cursor: pointer; }
.spc-btn-primary { background: var(--fg); color: #fff; }
.spc-alert { border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; font-size: 13px; }
.spc-alert-success { background: #ECFDF3; border: 1px solid #BBF7D0; color: #166534; }
.spc-alert-danger { background: #FEF2F2; border: 1px solid #FECACA; color: #991B1B; }
.spc-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.spc-table th { text-align: left; color: var(--fg-muted); font-weight: 600; border-bottom: 1px solid var(--border); padding: 9px; }
.spc-table td { border-bottom: 1px solid var(--border); padding: 9px; vertical-align: top; }
.spc-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.spc-status { display: inline-flex; border-radius: 999px; padding: 3px 8px; font-size: 12px; background: var(--bg-soft-2); color: var(--fg-2); }
.spc-status-completed { background: #ECFDF3; color: #166534; }
.spc-status-failed { background: #FEF2F2; color: #991B1B; }
.spc-status-running { background: #EFF6FF; color: #1D4ED8; }
.spc-error-text { margin-top: 4px; color: #991B1B; font-size: 12px; }
.spc-muted { color: var(--fg-muted); }

/* ---------- Brand mark ---------- */
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-weight: 700; letter-spacing: -0.02em; font-size: 17px; color: var(--fg);
}
.brand .logo { width: 24px; height: 24px; color: var(--brand); display: grid; place-items: center; }
.brand .logo svg { width: 22px; height: 22px; }
.brand .scrape { color: var(--fg); }
.brand .places { color: var(--brand); }
.brand .admin-badge {
  font-size: 9px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  background: var(--brand-soft); color: var(--brand);
  padding: 2px 7px; border-radius: 4px; margin-left: 4px;
}

/* ---------- App shell ---------- */
.app-shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.app-sidebar {
  background: #FAFBFD; border-right: 1px solid var(--border);
  padding: 18px 12px;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 2px; overflow-y: auto;
}
.app-sidebar .brand { padding: 4px 8px 16px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
.app-nav-group {
  font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--fg-dim); padding: 14px 12px 5px; font-weight: 700;
}
.app-nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 12px; border-radius: 8px;
  color: var(--fg-2); font-size: 13.5px; font-weight: 500;
  cursor: pointer; transition: background 0.12s, color 0.12s;
}
.app-nav-item:hover { background: var(--bg-soft); color: var(--brand); }
.app-nav-item.active { background: var(--brand-soft); color: var(--brand); }
.app-nav-item .ico { width: 16px; height: 16px; display: inline-flex; align-items: center; justify-content: center; color: var(--fg-muted); flex: 0 0 16px; }
.app-nav-item.active .ico { color: var(--brand); }
.app-nav-item .ico svg { width: 15px; height: 15px; }
.app-sidebar-footer { margin-top: auto; border-top: 1px solid var(--border); padding-top: 12px; }
.app-user { display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-radius: 8px; cursor: pointer; }
.app-user:hover { background: var(--bg-soft); }
.app-user .avatar { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg,#4F8DFF,#22D3EE); color:#fff; display:grid;place-items:center;font-weight:700;font-size:12px; flex:0 0 30px; }
.app-user .who { font-size: 12px; font-weight: 500; line-height: 1.2; }
.app-user .who small { color: var(--fg-muted); font-size: 11px; font-weight: 400; display: block; }

/* ---------- Main area ---------- */
.app-main { overflow: hidden; }
.app-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 28px; border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.85); backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 10;
}
.crumbs { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--fg-muted); }
.crumbs .here { color: var(--fg); font-weight: 500; }
.crumbs a { color: var(--fg-muted); }
.crumbs a:hover { color: var(--brand); }
.topbar-actions { display: inline-flex; align-items: center; gap: 10px; }
.app-content { padding: 28px 32px; max-width: 1280px; }

/* ---------- Page head ---------- */
.page-head { margin-bottom: 24px; }
.page-head h1 { font-size: 26px; font-weight: 700; margin-bottom: 4px; }
.page-head p { font-size: 14px; margin: 0; }

/* ---------- Stat cards row ---------- */
.stat-cards-row { display: grid; grid-template-columns: repeat(6,1fr); gap: 12px; margin-bottom: 20px; }
.stat-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 14px 16px; box-shadow: var(--shadow-card);
}
.stat-card .lbl { font-size: 11px; color: var(--fg-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }
.stat-card .num { font-size: 22px; font-weight: 700; color: var(--fg); letter-spacing: -0.02em; line-height: 1; }
.stat-card .num.brand { color: var(--brand); }
.stat-card .num.good { color: var(--accent); }
.stat-card .num.warn { color: var(--warn); }
.stat-card .num.danger { color: var(--danger); }

/* ---------- Section block ---------- */
.section-block {
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-card);
  overflow: hidden; margin-bottom: 20px;
}
.section-block .sb-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.section-block .sb-head h3 { margin: 0; font-size: 15px; }
.section-block .sb-head .sub { font-size: 13px; color: var(--fg-muted); margin-top: 2px; }
.section-block .sb-actions { display: inline-flex; gap: 8px; }
.section-block .sb-body { padding: 20px; }

/* ---------- Table ---------- */
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.data-table thead th {
  text-align: left; padding: 11px 16px;
  background: var(--bg-soft); color: var(--fg-muted);
  font-weight: 600; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}
.data-table tbody td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--bg-soft); }
.data-table .row-actions { display: inline-flex; gap: 6px; }

/* ---------- Status pills ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600; padding: 3px 9px;
  border-radius: 999px; white-space: nowrap;
}
.pill::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: 0.8; }
.pill-draft    { background: #F3F4F6; color: #6B7280; }
.pill-active   { background: #DCFCE7; color: #16A34A; }
.pill-paused   { background: #FEF3C7; color: #D97706; }
.pill-completed{ background: #E0F2FE; color: #0284C7; }
.pill-cancelled{ background: #FEE2E2; color: #DC2626; }
.pill-pending  { background: #F3F4F6; color: #6B7280; }
.pill-sent     { background: #DCFCE7; color: #16A34A; }
.pill-delivered{ background: #D1FAE5; color: #047857; }
.pill-bounced  { background: #FFE4E6; color: #BE123C; }
.pill-failed   { background: #FEE2E2; color: #DC2626; }
.pill-suppressed { background: #F3E8FF; color: #7C3AED; }

/* ---------- Form fields ---------- */
.form-grid { display: grid; gap: 18px; }
.form-grid.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-row label { font-size: 12px; font-weight: 600; color: var(--fg-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.form-row input[type="text"],
.form-row input[type="number"],
.form-row textarea,
.form-row select {
  width: 100%; padding: 9px 13px;
  border: 1px solid var(--border-strong); border-radius: 9px;
  font: inherit; font-size: 14px; color: var(--fg);
  background: #fff; outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.form-row input:focus,
.form-row textarea:focus,
.form-row select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(31,111,235,0.14);
}
.form-row textarea { resize: vertical; min-height: 200px; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.6; }
.form-row .hint { font-size: 12px; color: var(--fg-muted); margin-top: 2px; }
.form-footer { display: flex; align-items: center; gap: 12px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }
.form-footer .spacer { flex: 1; }

/* ---------- Recipient picker ---------- */
.recipient-search-bar { display: flex; gap: 10px; margin-bottom: 14px; }
.recipient-search-bar input { flex: 1; padding: 8px 13px; border: 1px solid var(--border-strong); border-radius: 9px; font: inherit; font-size: 13px; outline: none; }
.recipient-search-bar input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(31,111,235,0.12); }
.recipient-counter { font-size: 13px; color: var(--fg-muted); margin-bottom: 12px; }
.recipient-counter strong { color: var(--fg); }
.recipient-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.recipient-toolbar .recipient-counter { margin-bottom: 0; }
.recipient-selected-total { margin-bottom: 2px; color: var(--fg); font-size: 13px; font-weight: 600; }
.recipient-selected-total strong { font-family: var(--font-mono); font-size: 14px; }
.recipient-selection-note {
  margin-bottom: 10px; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: var(--r-sm); background: var(--bg-soft); color: var(--fg-muted);
  font-size: 12px;
}
.check-all-row { display: flex; align-items: center; gap: 8px; padding: 8px 14px; background: var(--bg-soft); border-radius: 8px; margin-bottom: 8px; font-size: 13px; cursor: pointer; }
.check-all-row input { margin: 0; accent-color: var(--brand); cursor: pointer; }
.recipient-list { max-height: 340px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--r-md); }
.recipient-row {
  display: grid; grid-template-columns: 36px 1fr 220px 80px;
  align-items: center; gap: 12px;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background 0.1s;
}
.recipient-row:last-child { border-bottom: 0; }
.recipient-row:hover { background: var(--bg-soft); }
.recipient-row.selected { background: var(--brand-soft); }
.recipient-row input[type="checkbox"] { margin: 0; accent-color: var(--brand); cursor: pointer; width: 15px; height: 15px; }
.recipient-row .r-name { font-weight: 500; font-size: 13px; }
.recipient-row .r-biz  { font-size: 12px; color: var(--fg-muted); margin-top: 2px; }
.recipient-row .r-email { font-size: 12px; color: var(--fg-muted); font-family: var(--font-mono); }
.recipient-row .r-tag { font-size: 11px; color: var(--fg-dim); text-align: right; }

/* ---------- Campaign detail ---------- */
.campaign-detail-grid { display: grid; grid-template-columns: 1fr 340px; gap: 20px; align-items: start; }
.campaign-progress-stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.campaign-meta-card { background: #fff; border: 1px solid var(--border); border-radius: var(--r-lg); padding: 20px; box-shadow: var(--shadow-card); }
.campaign-meta-card .cm-title { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--brand); margin-bottom: 14px; }
.meta-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); font-size: 13px; }
.meta-row:first-of-type { border-top: 0; padding-top: 0; }
.meta-row .ml { color: var(--fg-muted); min-width: 110px; flex: 0 0 110px; }
.meta-row .mv { color: var(--fg); font-weight: 500; }
.campaign-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.email-preview-card { background: #fff; border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-card); overflow: hidden; margin-top: 20px; }
.email-preview-card .ep-head { padding: 14px 20px; border-bottom: 1px solid var(--border); }
.email-preview-card .ep-head .ep-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--fg-muted); margin-bottom: 6px; }
.email-preview-card .ep-head .ep-subject { font-size: 15px; font-weight: 600; color: var(--fg); }
.email-preview-frame { padding: 20px; background: var(--bg-soft); min-height: 260px; font-size: 13px; line-height: 1.65; }
.email-preview-frame * { max-width: 100%; }

/* ---------- Progress bar ---------- */
.progress-bar-wrap { background: var(--bg-soft-2); border-radius: 999px; height: 6px; margin: 10px 0 4px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--brand); border-radius: 999px; transition: width 0.4s; }
.progress-label { font-size: 12px; color: var(--fg-muted); display: flex; justify-content: space-between; }

/* ---------- Empty state ---------- */
.empty-state { text-align: center; padding: 48px 20px; }
.empty-state .es-icon { width: 48px; height: 48px; background: var(--bg-soft); border-radius: 14px; display: grid; place-items: center; margin: 0 auto 14px; color: var(--fg-dim); }
.empty-state .es-icon svg { width: 24px; height: 24px; }
.empty-state h4 { font-size: 15px; margin-bottom: 6px; }
.empty-state p { font-size: 13px; max-width: 34ch; margin: 0 auto 16px; }

/* ---------- Alert banner ---------- */
.alert { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: var(--r-md); font-size: 13px; margin-bottom: 16px; }
.alert svg { width: 16px; height: 16px; flex: 0 0 16px; }
.alert-info { background: var(--brand-soft); color: var(--brand); border: 1px solid var(--brand-soft-2); }
.alert-warn { background: #FFFBEB; color: #92400E; border: 1px solid #FDE68A; }

/* ---------- Worker monitor ---------- */
.worker-monitor-page .page-copy { font-family: var(--font-mono); font-size: 12px; }
.worker-section { margin-bottom: 20px; }
.worker-status-table td { vertical-align: middle; }
.worker-secondary-stats { margin-top: 20px; }
.worker-log-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 16px; margin-bottom: 20px; }
.worker-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.worker-log { display: grid; gap: 8px; margin-top: 14px; }
.worker-log-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.worker-log-head > div { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.worker-log-head .mono { color: var(--fg-muted); word-break: break-all; }
.log-tail { max-height: 360px; min-height: 92px; }
.sql-snippet { max-height: 280px; }
.worker-sql-grid { display: grid; gap: 10px; }
.worker-sql-detail {
  border: 1px solid var(--border); border-radius: var(--r-md);
  padding: 10px 12px; background: var(--bg-soft);
}
.worker-sql-detail summary {
  display: flex; align-items: center; gap: 12px; cursor: pointer;
  font-size: 13px; font-weight: 700;
}
.worker-sql-detail .code-block { margin-top: 10px; }

@media (max-width: 1100px) {
  .stat-cards-row { grid-template-columns: repeat(3,1fr); }
  .campaign-detail-grid { grid-template-columns: 1fr; }
  .campaign-progress-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .form-grid.cols-2 { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar {
    position: sticky;
    top: 0;
    z-index: 60;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px 12px;
    height: auto;
    max-height: none;
    overflow: visible;
    padding: 10px 12px 8px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 8px 24px rgba(11,23,51,0.07);
  }
  .admin-sidebar .admin-brand {
    min-width: 0;
  }
  .admin-sidebar .nav-logo img {
    width: 42px;
  }
  .admin-side-nav {
    grid-column: 1 / -1;
    display: flex;
    gap: 8px;
    margin: 0 -12px;
    padding: 2px 12px 6px;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }
  .admin-side-nav::-webkit-scrollbar {
    height: 0;
  }
  .admin-side-nav .topnav-link {
    flex: 0 0 auto;
    width: auto;
    min-height: 38px;
    padding: 0 13px;
    border: 1px solid var(--border);
    background: #fff;
    scroll-snap-align: start;
  }
  .admin-side-nav .topnav-link.is-active {
    border-color: var(--brand-soft-2);
    background: var(--brand-soft);
  }
  .admin-logout {
    align-self: center;
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
  }
  .admin-logout .btn {
    width: auto;
    min-width: 78px;
  }
  .admin-topbar { align-items: flex-start; flex-direction: column; padding: 12px 16px; }
  .admin-topbar-left { width: 100%; align-items: flex-start; flex-direction: column; gap: 10px; }
  .topnav { width: 100%; }
  .page { padding: 22px 16px 32px; }
  .page > .page-head { flex-direction: column; align-items: flex-start; }
  .detail-grid { grid-template-columns: 1fr; }
  .notes-layout { grid-template-columns: 1fr; }
  .notes-sidebar { position: static; }
  .app-shell { grid-template-columns: 1fr; }
  .app-sidebar { position: relative; height: auto; }
  .stat-cards-row { grid-template-columns: repeat(2,1fr); }
  .campaign-progress-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .worker-log-grid { grid-template-columns: 1fr; }
  .worker-card-head,
  .worker-log-head,
  .worker-sql-detail summary { align-items: flex-start; flex-direction: column; }
  .recipient-toolbar { align-items: flex-start; flex-direction: column; }
  .recipient-row { grid-template-columns: 28px minmax(0, 1fr); align-items: start; }
  .recipient-row .r-email,
  .recipient-row .r-tag { grid-column: 2; text-align: left; }
}
