/* Yellow Pages dashboard — design tokens first; every component consumes
   variables, no one-off hex values. Light + dark themes via [data-theme]
   (resolved before first paint by the boot script in index.html —
   universal standard §5/§6; 🌙 shows in light, ☀️ in dark: the glyph is
   the mode you switch TO). */
:root {
  --brand: #b45309;            /* leads amber */
  --brand-strong: #92400e;
  --brand-ink: #ffffff;
  --brand-soft: #fef3c7;
  --bg: #f7f5f1;
  --surface: #ffffff;
  --surface-2: #faf8f4;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e0d5;
  --radius: 12px;
  --shadow: 0 8px 24px rgba(31, 41, 55, 0.10);
  --good: #15803d;
  --good-bg: #dcfce7;
  --warn: #b45309;
  --warn-bg: #fef3c7;
  --bad: #b91c1c;
  --bad-bg: #fee2e2;
  --track: #e9e4d8;
  --code-bg: #f3f0e9;
  --sidebar-bg: #fffdf8;
  --nav-active-bg: #fef3c7;
  --focus: #f59e0b;
  color-scheme: light;
}

html[data-theme="dark"] {
  --brand: #f59e0b;
  --brand-strong: #fbbf24;
  --brand-ink: #1a1207;
  --brand-soft: #422006;
  --bg: #0b1220;
  --surface: #111827;
  --surface-2: #0f172a;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --border: #374151;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
  --good: #4ade80;
  --good-bg: #052e16;
  --warn: #fbbf24;
  --warn-bg: #451a03;
  --bad: #f87171;
  --bad-bg: #450a0a;
  --track: #1f2937;
  --code-bg: #1f2937;
  --sidebar-bg: #0e1626;
  --nav-active-bg: #422006;
  --focus: #f59e0b;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { scroll-padding-top: 76px; scrollbar-gutter: stable; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--surface);
  color: var(--brand);
  padding: 10px 16px;
  z-index: 200;
  border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; }

.svg-sprite { position: absolute; }
.ic {
  width: 20px; height: 20px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
  vertical-align: -4px;
}
button .ic { margin-right: 6px; }
.num, .num-col, .stat-value, td.num-col { font-variant-numeric: tabular-nums; }
.num-col { text-align: right; }

/* ================= app shell ================= */

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 248px;
  flex: none;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 60;
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--brand); color: var(--brand-ink);
  display: inline-flex; align-items: center; justify-content: center;
}
.brand-mark .ic { width: 22px; height: 22px; margin: 0; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-text strong { font-size: 1.02rem; }
.brand-text small { color: var(--muted); font-size: 0.8rem; }

.side-nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; min-height: 44px;
  padding: 10px 12px;
  border: 1px solid transparent; border-radius: 10px;
  background: transparent; color: var(--text);
  font-size: 0.95rem; font-weight: 500; text-align: left; cursor: pointer;
}
.nav-item .ic { margin: 0; }
.nav-item:hover { background: var(--surface-2); filter: none; }
.nav-item.is-active { background: var(--nav-active-bg); color: var(--brand-strong); font-weight: 600; }
.nav-badge {
  margin-left: auto; background: var(--brand); color: var(--brand-ink);
  border-radius: 999px; font-size: 0.75rem; font-weight: 700;
  min-width: 22px; height: 22px; padding: 0 6px;
  display: inline-flex; align-items: center; justify-content: center;
}
.side-foot { margin-top: auto; padding: 10px 8px 2px; border-top: 1px solid var(--border); }
.side-workspace { margin: 0 0 4px; font-weight: 600; font-size: 0.9rem; overflow-wrap: anywhere; }
.side-tag { margin: 0; color: var(--muted); font-size: 0.82rem; }

.nav-scrim {
  position: fixed; inset: 0; background: rgba(10, 10, 10, 0.45); z-index: 55;
}

.app-column { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 24px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.view-title { margin: 0; font-size: 1.3rem; font-weight: 700; }
.nav-toggle { display: none; }
.user-area { margin-left: auto; display: flex; align-items: center; gap: 10px; flex: none; }

.main {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 24px 40px;
  flex: 1;
}

/* ================= generic components ================= */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-top: 16px;
  box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 10px; font-size: 1.12rem; }
.card h3 { margin: 18px 0 8px; font-size: 1rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-head h2 { margin: 0; }

.hint { color: var(--muted); font-size: 0.92rem; margin: 0 0 12px; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
code { background: var(--code-bg); padding: 1px 5px; border-radius: 4px; font-size: 0.9em; overflow-wrap: anywhere; }
a { color: var(--brand); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

button {
  background: var(--brand);
  color: var(--brand-ink);
  border: 1px solid var(--brand);
  border-radius: 9px;
  padding: 9px 15px;
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
  min-height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
}
button:hover { filter: brightness(1.07); }
button:disabled { opacity: 0.5; cursor: default; }
button.secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
button.ghost { background: transparent; color: var(--muted); border-color: transparent; }
button.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
html[data-theme="dark"] button.danger { color: #1a0505; }

input, select, textarea {
  font: inherit;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  width: 100%;
  background: var(--surface);
  color: var(--text);
  min-height: 44px;
}
textarea { min-height: 0; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; accent-color: var(--brand); }

.status { min-height: 1.2em; margin: 10px 0 0; font-size: 0.92rem; }
.status.error, .error-text { color: var(--bad); }

.notice {
  background: var(--brand-soft);
  border: 1px solid var(--brand);
  border-radius: 9px;
  padding: 10px 12px;
  margin: 10px 0 0;
  font-size: 0.95rem;
}

.progress { height: 8px; background: var(--track); border-radius: 4px; overflow: hidden; margin-top: 10px; }
.progress-bar { height: 100%; width: 0; background: var(--brand); transition: width 0.4s ease; }
.progress-inline { height: 6px; background: var(--track); border-radius: 3px; overflow: hidden; min-width: 90px; }
.progress-inline > div { height: 100%; background: var(--brand); }

.badge {
  display: inline-block; font-size: 0.8rem; padding: 1px 9px;
  border-radius: 999px; background: var(--code-bg); color: var(--text);
  white-space: nowrap;
}
.badge.good { background: var(--good-bg); color: var(--good); }
.badge.mid { background: var(--warn-bg); color: var(--warn); }
.badge.low { background: var(--bad-bg); color: var(--bad); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.brand { background: var(--brand-soft); color: var(--brand-strong); }

.method-badge {
  display: inline-block; font-size: 0.75rem; padding: 0 7px;
  border-radius: 999px; background: var(--brand-soft); color: var(--brand-strong);
  white-space: nowrap; vertical-align: middle;
}
.lang-chip {
  display: inline-block; font-size: 0.72rem; font-weight: 700; padding: 0 6px;
  border-radius: 999px; background: var(--code-bg); color: var(--text);
  white-space: nowrap; vertical-align: middle; letter-spacing: 0.04em;
}
.lang-chip.fr { background: var(--brand-soft); color: var(--brand-strong); }
.social-links { display: inline-flex; gap: 10px; flex-wrap: wrap; font-size: 0.9rem; }

/* tables */
.table-wrap { overflow-x: auto; margin-top: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
thead th {
  position: sticky; top: 0; background: var(--surface);
  text-align: left; padding: 8px; border-bottom: 2px solid var(--border);
  font-size: 0.85rem; color: var(--muted); font-weight: 600;
}
tbody td { padding: 9px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
tbody tr:nth-child(even) td { background: var(--surface-2); }
td.actions { white-space: nowrap; }
td.actions button, td button.small { padding: 5px 10px; font-size: 0.85rem; min-height: 36px; }
.check-col { width: 38px; }
tbody tr.selected td { background: var(--brand-soft); }

/* empty / error states */
.empty-state { text-align: center; padding: 28px 16px; color: var(--muted); }
.empty-state .ic { width: 34px; height: 34px; margin-bottom: 6px; color: var(--brand); }
.empty-state p { margin: 4px 0 12px; }
.error-state {
  background: var(--bad-bg); color: var(--bad);
  border-radius: 9px; padding: 12px 14px; margin-top: 10px;
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}

/* loading */
.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid var(--track); border-top-color: var(--brand);
  animation: spin 0.8s linear infinite; display: inline-block; vertical-align: -3px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-row { display: flex; gap: 10px; align-items: center; color: var(--muted); padding: 14px 2px; }
.skeleton { border-radius: 8px; background: var(--track); opacity: 0.55; animation: pulse 1.3s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }
.skeleton-card { height: 96px; }

/* ================= header user menu (standard §1) ================= */

.icon-btn {
  background: transparent; color: var(--text);
  border: 1px solid transparent; border-radius: 9px;
  width: 44px; height: 44px; min-height: 44px; padding: 0;
  font-size: 1.15rem; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn .ic { margin: 0; }
.icon-btn:hover { border-color: var(--border); filter: none; }
.signin-link { font-weight: 600; text-decoration: none; padding: 10px 6px; }
.user-menu-wrap { position: relative; }
.user-chip {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 5px 12px 5px 5px;
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px;
}
.user-chip:hover { filter: none; border-color: var(--brand); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand); color: var(--brand-ink);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.82rem; font-weight: 700;
}
.user-name { font-weight: 600; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu {
  position: absolute; right: 0; top: calc(100% + 8px);
  width: 300px; max-width: calc(100vw - 32px);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 8px; z-index: 90;
}
.menu-identity { padding: 8px 10px 4px; }
.menu-name { margin: 0; font-weight: 700; }
.menu-email { margin: 2px 0 6px; color: var(--muted); font-size: 0.9rem; overflow-wrap: anywhere; }
.menu-sep { border: none; border-top: 1px solid var(--border); margin: 8px 0; }
.menu-item {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; min-height: 44px; padding: 10px;
  border-radius: 8px; color: var(--text); text-decoration: none;
  font-size: 0.95rem; background: transparent; border: none;
  text-align: left; cursor: pointer;
}
a.menu-item:hover, button.menu-item:hover { background: var(--code-bg); filter: none; }
.menu-appearance { cursor: default; }
.menu-appearance .icon-btn { width: 40px; height: 40px; min-height: 40px; }
.menu-signout { color: var(--bad); font-weight: 600; }

/* ================= sign-in (standard §2) ================= */

.signin-fields { display: grid; gap: 12px; max-width: 420px; }
.signin-fields label { font-size: 0.9rem; color: var(--muted); display: block; }
.signin-fields input, .signin-fields select { margin-top: 4px; }
.form-error {
  background: var(--bad-bg); color: var(--bad);
  border-radius: 9px; padding: 10px 12px; margin: 12px 0 0;
  max-width: 420px; font-size: 0.95rem;
}
.big-primary { min-height: 52px; padding: 12px 22px; font-size: 1rem; font-weight: 600; margin-top: 14px; }
.token-alt { margin-top: 18px; border-top: 1px solid var(--border); padding-top: 12px; }
.token-alt summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
.token-alt .hint { margin-top: 8px; }
.token-row { display: flex; gap: 8px; }
.token-row input { flex: 1; }

/* ================= overview ================= */

.attention {
  margin-top: 16px;
  background: var(--warn-bg); color: var(--warn);
  border: 1px solid var(--warn); border-radius: var(--radius);
  padding: 12px 16px;
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}
.attention .ic { color: var(--warn); }
.attention button { min-height: 38px; padding: 6px 12px; }

.stat-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-top: 16px; }
.stat {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; background: var(--surface); box-shadow: var(--shadow);
}
.stat-label { font-size: 0.85rem; color: var(--muted); }
.stat-value { font-size: 1.45rem; font-weight: 700; margin-top: 2px; }
.stat-sub { font-size: 0.85rem; color: var(--muted); margin-top: 2px; }
.split-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; margin-top: 8px; background: var(--track); }
.split-bar .split-direct { background: var(--brand); }
.split-bar .split-ai { background: var(--muted); }

.quick-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.quick-btn {
  background: var(--surface-2); color: var(--text); border-color: var(--border);
  min-height: 48px; padding: 10px 16px; font-weight: 500;
}
.quick-btn:hover { border-color: var(--brand); filter: none; }

/* ================= search / forms ================= */

.form-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 4px; }
.form-grid label { font-size: 0.9rem; color: var(--muted); display: block; }
.form-grid input { margin-top: 4px; }

.inline-form { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; margin-bottom: 6px; }
.inline-form label { font-size: 0.9rem; color: var(--muted); display: block; min-width: 180px; }
.inline-form input, .inline-form select, .inline-form textarea { margin-top: 4px; }
.inline-form .filter-check { min-width: 0; }

/* ================= lists & leads ================= */

.leads-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.enrich-opts { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 8px 0 2px; font-size: 0.92rem; }
.enrich-opts-label { color: var(--muted); }
.enrich-opts label { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; min-height: 32px; }

.filter-bar {
  display: flex; gap: 12px; flex-wrap: wrap; align-items: end;
  margin-top: 14px; padding: 12px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
}
.filter-field { font-size: 0.85rem; color: var(--muted); display: block; }
.filter-field input, .filter-field select { margin-top: 4px; min-height: 40px; }
.filter-field.grow { flex: 1; min-width: 160px; }
.filter-check { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; font-size: 0.92rem; color: var(--text); cursor: pointer; }
.filter-count { margin-left: auto; font-size: 0.88rem; align-self: center; }

.bulk-bar {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  margin-top: 14px; padding: 10px 12px;
  background: var(--brand-soft); border: 1px solid var(--brand); border-radius: var(--radius);
}
.bulk-bar span { font-weight: 600; margin-right: 4px; }

.contacts { display: flex; flex-direction: column; gap: 12px; }
.contact { border-left: 3px solid var(--brand); padding-left: 10px; }

/* ================= jobs ================= */

.job-error { color: var(--bad); font-size: 0.88rem; max-width: 340px; overflow-wrap: anywhere; }
.job-opts { font-size: 0.85rem; color: var(--muted); }
.status-pill { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 0.85rem; white-space: nowrap; }
.status-pill .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.status-pill.done .dot { background: var(--good); }
.status-pill.failed .dot { background: var(--bad); }
.status-pill.running .dot { background: var(--brand); animation: pulse 1.2s infinite; }
.status-pill.queued .dot { background: var(--warn); }

/* ================= activity history ================= */

.list-error { margin-top: 4px; max-width: 340px; overflow-wrap: anywhere; }
.history-list { display: flex; flex-direction: column; gap: 6px; }
.history-row { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.history-time { font-size: 0.85rem; white-space: nowrap; }
.history-label { font-weight: 600; white-space: nowrap; }
.history-detail { overflow-wrap: anywhere; }
.job-history-row td { background: var(--surface); }
.job-history-row h3 { margin-top: 4px; }

/* ================= compliance ================= */

.danger-zone { border-top: 1px solid var(--border); margin-top: 8px; padding-top: 6px; }
button.danger-outline { background: transparent; color: var(--bad); border-color: var(--bad); }
.scope-tag { font-size: 0.78rem; font-weight: 600; }

/* ================= API keys ================= */

.scope-fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; margin: 0; min-width: 260px; flex: 1; }
.scope-fieldset legend { font-size: 0.85rem; color: var(--muted); padding: 0 4px; }
.scope-grid { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.scope-grid label { display: inline-flex; gap: 6px; align-items: center; min-width: 0; font-size: 0.9rem; color: var(--text); min-height: 36px; cursor: pointer; }
.new-key-box {
  background: var(--good-bg); border: 1px solid var(--good);
  border-radius: var(--radius); padding: 14px 16px; margin-top: 14px;
}
.new-key-box p { margin: 0 0 8px; }
.key-copy-row { display: flex; gap: 8px; align-items: stretch; }
.key-copy-row code {
  flex: 1; display: flex; align-items: center;
  background: var(--surface); padding: 8px 12px; border-radius: 8px;
  font-size: 0.95rem; word-break: break-all;
}
.key-prefix { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.88rem; }

/* ================= settings ================= */

.kv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px 24px; }
.kv-grid dt { color: var(--muted); font-size: 0.85rem; }
.kv-grid dd { margin: 2px 0 10px; font-weight: 600; overflow-wrap: anywhere; }
.integration-row {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; margin-top: 12px; background: var(--surface-2);
}
.integration-row h3 { margin: 0 0 4px; font-size: 1rem; }
.integration-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; align-items: center; }
.integration-actions input { flex: 1; min-width: 220px; }
.source-pill { font-size: 0.8rem; font-weight: 700; padding: 2px 10px; border-radius: 999px; white-space: nowrap; }
.source-pill.db { background: var(--good-bg); color: var(--good); }
.source-pill.env { background: var(--code-bg); color: var(--muted); }
.source-pill.none { background: var(--bad-bg); color: var(--bad); }

/* ================= drawer / modal / toasts ================= */

.drawer-scrim { position: fixed; inset: 0; background: rgba(10, 10, 10, 0.45); z-index: 70; }
.drawer {
  position: fixed; top: 0; right: 0; z-index: 80;
  width: min(520px, 100vw); height: 100dvh;
  background: var(--surface); border-left: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  overscroll-behavior: contain;
}
.drawer-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.drawer-head h2 { margin: 0; font-size: 1.1rem; overflow-wrap: anywhere; }
.drawer-body { padding: 16px 18px 28px; overflow-y: auto; }
.drawer-body h3 { margin: 18px 0 8px; font-size: 0.98rem; }
.drawer-body h3:first-child { margin-top: 0; }
.detail-grid { display: grid; grid-template-columns: auto 1fr; gap: 4px 16px; font-size: 0.94rem; }
.detail-grid dt { color: var(--muted); }
.detail-grid dd { margin: 0; overflow-wrap: anywhere; }
.score-big { font-size: 1.6rem; font-weight: 700; }

.modal-scrim {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(10, 10, 10, 0.5);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  max-width: 440px; width: 100%; padding: 22px;
  overscroll-behavior: contain;
}
.modal h2 { margin: 0 0 8px; font-size: 1.1rem; }
.modal p { margin: 0; color: var(--muted); overflow-wrap: anywhere; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }

.toast-region {
  position: fixed; right: 16px; bottom: 16px; z-index: 120;
  display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px));
}
.toast {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-left: 4px solid var(--good);
  border-radius: 10px; box-shadow: var(--shadow);
  padding: 11px 14px; font-size: 0.93rem;
  display: flex; gap: 10px; align-items: flex-start;
}
.toast.error { border-left-color: var(--bad); }
.toast .ic { flex: none; margin-top: 1px; }
.toast .toast-close { margin-left: auto; min-height: 32px; width: 32px; padding: 0; }

/* ================= footer (standard §7) ================= */

.site-footer {
  display: flex; flex-wrap: wrap; gap: 8px 48px; align-items: flex-start;
  border-top: 1px solid var(--border); margin-top: 28px; padding-top: 18px;
}
.footer-name { font-weight: 700; font-size: 1.05rem; margin: 0 0 4px; }
.footer-brand p { margin: 0 0 4px; }
.footer-group h3 { margin: 0 0 8px; font-size: 0.95rem; color: var(--brand); }
.footer-group a { display: block; padding: 6px 0; min-height: 32px; text-decoration: none; }
.footer-group a:hover { text-decoration: underline; }
.footer-copy { width: 100%; border-top: 1px solid var(--border); padding-top: 12px; margin: 8px 0 0; font-size: 0.9rem; }

/* ================= responsive ================= */

/* Tablet (≤1024px): collapsed icon rail. */
@media (max-width: 1024px) {
  .sidebar { width: 70px; padding: 14px 8px; align-items: center; }
  .brand-text, .side-tag, .side-workspace { display: none; }
  .side-brand { padding: 2px 0; }
  .nav-item { justify-content: center; padding: 10px 0; }
  .nav-item span:not(.nav-badge) { display: none; }
  .nav-badge { position: absolute; margin: 0; transform: translate(14px, -14px); }
  .nav-item { position: relative; }
  .side-foot { border-top: none; padding: 0; }
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .form-grid { grid-template-columns: 1fr 1fr; }
}

/* Phone (≤560px): top bar + hamburger drawer, never a shrunken sidebar. */
@media (max-width: 560px) {
  .sidebar {
    position: fixed; left: 0; top: 0; height: 100dvh; width: 264px;
    transform: translateX(-105%); transition: transform 0.22s ease;
    align-items: stretch; padding: 18px 12px; z-index: 65;
  }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow); }
  .brand-text, .side-tag, .side-workspace { display: block; }
  .brand-text { display: flex; }
  .nav-item { justify-content: flex-start; padding: 10px 12px; position: static; }
  .nav-item span:not(.nav-badge) { display: inline; }
  .nav-badge { position: static; transform: none; margin-left: auto; }
  .side-foot { border-top: 1px solid var(--border); padding: 10px 8px 2px; }
  .nav-toggle { display: inline-flex; }
  .topbar { padding: 8px 12px; }
  .view-title { font-size: 1.12rem; }
  .main { padding: 14px 12px 32px; }
  .card { padding: 16px 14px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .token-row { flex-direction: column; }
  .user-name { max-width: 110px; }
  button.big-primary, #search-submit { width: 100%; min-height: 52px; }
  .leads-actions button { flex: 1; min-height: 52px; }
  /* tables: horizontal scroll with a sticky first column, never squished */
  .leads-table th:first-child, .leads-table td:first-child { position: sticky; left: 0; background: var(--surface); z-index: 1; }
  .toast-region { left: 12px; right: 12px; max-width: none; }
  .drawer { width: 100vw; }
  .site-footer { flex-direction: column; gap: 16px; }
}
