/* Lead Factory – app shell, data tables, forms. Light + dark. */
:root {
  --bg: #f6f7fb; --surface: #ffffff; --surface-2: #f8f9fc; --hover: #f2f4fa; --border: #e6e8f0; --border-2: #d7dbe7;
  --text: #111827; --text-2: #374151; --muted: #6b7280;
  --primary: #4f46e5; --primary-2: #4338ca; --primary-ink: #ffffff; --primary-soft: #eef0ff;
  --ok: #047857; --ok-soft: #e7f7ef; --warn: #b45309; --warn-soft: #fff5e6; --danger: #dc2626; --danger-soft: #fdecec;
  --linkedin: #0a66c2;
  --side: #ffffff; --side-text: #4b5563; --side-on: #eef0ff;
  --shadow: 0 1px 2px rgba(17, 24, 39, .04), 0 4px 16px rgba(17, 24, 39, .05);
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f1a; --surface: #121826; --surface-2: #0f1522; --hover: #182033; --border: #1f2940; --border-2: #2b3653;
    --text: #e7eaf2; --text-2: #c4cad8; --muted: #8b95ab;
    --primary: #818cf8; --primary-2: #a5b4fc; --primary-ink: #0b0f1a; --primary-soft: #1e2347;
    --ok: #4ade80; --ok-soft: #10261b; --warn: #fbbf24; --warn-soft: #2a2110; --danger: #f87171; --danger-soft: #2c1517;
    --linkedin: #60a5fa; --side: #0f1522; --side-text: #aab3c7; --side-on: #1e2347;
    --shadow: 0 1px 2px rgba(0, 0, 0, .35);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14.5px/1.5 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.fine { font-size: 12.5px; color: var(--muted); margin: 10px 0 0; }
.ok-text { color: var(--ok) !important; }
[hidden] { display: none !important; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 12px; top: 12px; z-index: 99; background: var(--surface); padding: 8px 12px; border-radius: 8px; }
.ic { width: 18px; height: 18px; flex: none; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 40%, transparent); outline-offset: 2px; }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; font: inherit; font-weight: 600; font-size: 14px; border-radius: 9px; padding: 9px 16px; cursor: pointer; border: 1px solid transparent; text-decoration: none !important; white-space: nowrap; transition: background .15s, border-color .15s, color .15s; }
.btn .ic { width: 16px; height: 16px; }
.btn.primary { background: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { background: var(--primary-2); }
.btn.ghost { background: var(--surface); color: var(--text-2); border-color: var(--border-2); }
.btn.ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn.ghost.danger:hover { border-color: var(--danger); color: var(--danger); }
.btn.sm { padding: 6px 12px; font-size: 13px; }
.btn.xs { padding: 4px 10px; font-size: 12.5px; }
.btn.block { width: 100%; margin-top: 10px; }
.btn:disabled { opacity: .55; cursor: default; }
.linkish { background: none; border: 0; padding: 0; color: var(--primary); font: inherit; font-size: 13px; cursor: pointer; font-weight: 600; }
.linkish.danger { color: var(--danger); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.input, .field input, .field textarea, .field select {
  display: block; width: 100%; padding: 8px 11px; font: inherit; font-size: 14px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-2); border-radius: 9px; transition: border-color .15s, box-shadow .15s;
}
.input:focus, .field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.field { display: block; font-weight: 600; font-size: 13px; color: var(--text-2); margin: 0 0 14px; }
.field input, .field textarea, .field select { margin-top: 6px; font-weight: 400; }
.field textarea { resize: vertical; min-height: 70px; }
.field-label { font-weight: 600; font-size: 13px; color: var(--text-2); margin-bottom: 6px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; margin: 6px 0; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }
.check input[type=number] { width: 80px; margin-left: auto; padding: 5px 8px; border: 1px solid var(--border-2); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--border-2); background: var(--surface); cursor: pointer; font-size: 13px; user-select: none; color: var(--text-2); }
.chip input:checked + span { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.chip input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--primary) 40%, transparent); }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-bottom: 12px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; text-align: center; padding: 6px 4px; border: 1px solid var(--border-2); border-radius: 8px; font-size: 12.5px; cursor: pointer; color: var(--text-2); background: var(--surface); }
.seg input:checked + span { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.seg input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--primary) 40%, transparent); }
.more { margin: 8px 0 4px; }
.more summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--muted); }
.opts { padding-top: 8px; }

/* ---------- app shell ---------- */
.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--side); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 16px 12px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 16px; color: var(--text) !important; text-decoration: none !important; padding: 4px 8px 18px; }
.logo { width: 30px; height: 30px; color: var(--primary); flex: none; }
.nav { display: grid; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 9px; color: var(--side-text); font-weight: 500; text-decoration: none; }
.nav a:hover { background: var(--hover); color: var(--text); }
.nav a.on { background: var(--side-on); color: var(--primary); font-weight: 600; }
.nav em { margin-left: auto; font-style: normal; font-size: 11.5px; font-weight: 700; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); padding: 0 7px; border-radius: 99px; }
.side-foot { margin-top: auto; padding: 8px 10px; font-size: 12px; }
.side-foot a { color: var(--muted); }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px 24px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.top-search { flex: 1; max-width: 560px; display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border-2); border-radius: 10px; padding: 0 12px; }
.top-search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
.top-search .ic { color: var(--muted); }
.top-search input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; padding: 9px 0; color: var(--text); }
.top-search input:focus { outline: none; }
.topbar > .btn, .topbar > .menu { margin-left: auto; }
.mobile-only { display: none !important; }
.menu { position: relative; }
.avatar-btn { background: none; border: 1px solid var(--border); padding: 2px; border-radius: 999px; cursor: pointer; display: flex; }
.avatar-btn img, .avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.dropdown { position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .12); padding: 6px; }
.dropdown a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text-2); text-decoration: none; }
.dropdown a:hover { background: var(--hover); }
.dd-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; display: grid; }
.dd-head span { font-size: 12.5px; color: var(--muted); word-break: break-all; }
.content { padding: 24px; max-width: 1400px; width: 100%; }

/* ---------- page parts ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head p { margin: 4px 0 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card h2 { margin-bottom: 10px; }
.panel-title { display: flex; align-items: center; gap: 8px; font-size: 15px; margin-bottom: 14px !important; }
.panel-title .ic { color: var(--muted); }
.clear-link { margin-left: auto; font-size: 12.5px; font-weight: 600; }
.filters-toggle { display: none; }
.search-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 16px; align-items: start; }
.panel { position: sticky; top: 74px; max-height: calc(100vh - 90px); overflow: auto; }
.results-col { min-width: 0; }
.results-col > .card + .card, .results-col > .alert + .card { margin-top: 16px; }
.empty-state { text-align: center; padding: 40px 24px; }
.empty-state > .ic { width: 40px; height: 40px; color: var(--primary); background: var(--primary-soft); border-radius: 12px; padding: 9px; }
.empty-state h2 { margin: 12px 0 6px; font-size: 18px; }
.empty-state p { max-width: 520px; margin: 0 auto; }
.quick { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin-top: 22px; text-align: left; }
.quick-item { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; color: var(--text-2); font-weight: 500; background: var(--surface-2); }
.quick-item:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.quick-item .ic { width: 15px; height: 15px; color: var(--muted); }
.table-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.table-head h2 { margin: 0; }
.sort { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); font-weight: 600; }
.sort .input { width: auto; padding: 6px 10px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.toolbar .input { width: auto; padding: 6px 10px; }
.toolbar .chips { margin: 0; }
.input.grow, .toolbar .grow { flex: 1; min-width: 200px; }
.alert { padding: 10px 14px; border-radius: 10px; font-size: 14px; margin: 0; }
.alert.error { background: var(--danger-soft); color: var(--danger); }
.errors { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 6px; }
.errors li { background: var(--warn-soft); color: var(--warn); padding: 7px 12px; border-radius: 8px; font-size: 13px; }
.errors:empty { display: none; }
.empty { text-align: center; padding: 28px; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 12px; }
.nudge { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-color: color-mix(in srgb, var(--primary) 30%, var(--border)); background: linear-gradient(90deg, var(--primary-soft), var(--surface)); }
.nudge p { margin: 2px 0 0; }
.foot { color: var(--muted); font-size: 12px; padding: 24px 0 4px; }
.foot a { color: inherit; text-decoration: underline; }

/* badges & avatars */
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); white-space: nowrap; }
.badge .ic { width: 13px; height: 13px; }
.badge.gray { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.badge.green { background: var(--ok-soft); color: var(--ok); }
.badge.tiny { font-size: 11px; padding: 1px 7px; }
.avatar-sq { flex: none; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; font-weight: 800; font-size: 14px; color: var(--primary); background: var(--primary-soft); }
.avatar-sq.sm { width: 30px; height: 30px; font-size: 13px; border-radius: 8px; }

/* ---------- data tables ---------- */
.table-wrap { overflow: auto; border: 1px solid var(--border); border-radius: 10px; }
table.data { border-collapse: collapse; width: 100%; font-size: 13.5px; }
.data th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); text-align: left; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.data td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; color: var(--text-2); }
.data tbody tr:last-child td { border-bottom: 0; }
.data tbody tr:hover { background: var(--hover); }
.data tr.picked { background: color-mix(in srgb, var(--primary-soft) 70%, transparent); }
.data .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.data .sel { width: 40px; padding-right: 0; }
.data .sel input { width: 16px; height: 16px; accent-color: var(--primary); }
.data td.co { min-width: 240px; }
.co-in { display: flex; gap: 10px; align-items: center; }
.co-in > div { min-width: 0; display: grid; gap: 1px; justify-items: start; }
.co-name { font-weight: 600; color: var(--text) !important; }
.data .sub { font-size: 12.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.data .links { white-space: nowrap; }
.ic-link { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; color: var(--muted); }
.ic-link:hover { background: var(--hover); color: var(--primary); text-decoration: none; }
.ic-link.linkedin, .data .links a.li { color: var(--linkedin); }
.data .links a { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; color: var(--muted); }
.data .links a:hover { background: var(--hover); color: var(--primary); }
.data .act { text-align: right; }
.data td.contact { min-width: 170px; }
.data .contact a { display: block; white-space: nowrap; }
.c-phone { color: var(--text-2) !important; }
.saved { display: grid; gap: 3px; font-size: 12.5px; white-space: nowrap; }
.bulkbar { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 30; display: flex; align-items: center; gap: 12px; background: var(--text); color: var(--surface); padding: 8px 8px 8px 18px; border-radius: 14px; box-shadow: 0 12px 32px rgba(0, 0, 0, .25); }
.bulkbar .btn.ghost { background: transparent; color: var(--surface); border-color: color-mix(in srgb, var(--surface) 35%, transparent); }

/* ---------- my leads ---------- */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 2px; }
.tile span { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.tile b { font-size: 24px; font-variant-numeric: tabular-nums; }
.leads-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.leads-layout > .card + .card { margin-top: 0; }
#db-card { position: sticky; top: 74px; }
.db-state { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 10px; margin-bottom: 10px; font-size: 13px; }
.db-state > div { display: grid; gap: 2px; }
.db-state.off { background: var(--warn-soft); color: var(--warn); }
.db-state.on { background: var(--ok-soft); color: var(--ok); }
.db-state b { color: var(--text); }
.db-state .dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: currentColor; margin-top: 6px; }
.db-folder { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--border); border-radius: 10px; }
.db-folder .ic { width: 26px; height: 26px; }
.db-folder a { font-weight: 600; word-break: break-word; }
.db-folder span { display: block; font-size: 12px; color: var(--muted); }
.db-links { display: flex; gap: 14px; margin-top: 12px; }
.howto { font-size: 12.5px; color: var(--muted); padding-left: 18px; margin: 10px 0 0; }

/* ---------- settings ---------- */
.settings { display: grid; gap: 16px; max-width: 760px; }
.settings .card + .card { margin-top: 0; }
.inline-form { display: flex; gap: 8px; }
.users { margin-top: 18px; font-size: 13px; display: grid; }
.users h3 { margin-bottom: 6px; }
.users div { display: flex; justify-content: space-between; gap: 8px; padding: 7px 0; border-top: 1px solid var(--border); }
.copy-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; align-items: center; margin: 10px 0; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; }
.copy-row .label { grid-column: 1 / -1; font-size: 12px; color: var(--muted); font-weight: 600; }
.copy-row code { font-size: 12.5px; word-break: break-all; }

/* ---------- company profile ---------- */
.back { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.back .ic { width: 16px; height: 16px; }
.p-head { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.p-logo { width: 64px; height: 64px; border-radius: 14px; object-fit: contain; background: #fff; border: 1px solid var(--border); padding: 6px; flex: none; }
.p-logo.avatar-sq { font-size: 26px; padding: 0; background: var(--primary-soft); }
.p-title { flex: 1; min-width: 240px; }
.p-title h1 { font-size: 24px; }
.p-title p { margin: 3px 0 8px; }
.p-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.p-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; margin-top: 16px; align-items: start; }
.p-main > .card + .card, .p-side > .card + .card { margin-top: 16px; }
.summary { margin: 0; line-height: 1.65; color: var(--text-2); }
.facts { margin: 0; }
.fact { display: grid; grid-template-columns: 160px 1fr; gap: 12px; padding: 8px 0; border-top: 1px solid var(--border); }
.fact:first-child { border-top: 0; }
.fact dt { color: var(--muted); font-size: 13px; }
.fact dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.people { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.people li { display: flex; gap: 10px; align-items: center; padding: 10px; border: 1px solid var(--border); border-radius: 10px; }
.people li div { display: grid; }
.c-row { display: flex; gap: 10px; padding: 9px 0; border-top: 1px solid var(--border); }
.c-row:first-child { border-top: 0; }
.c-ic { color: var(--muted); padding-top: 2px; }
.c-vals { display: flex; flex-wrap: wrap; gap: 6px 10px; min-width: 0; }
.c-vals a { overflow-wrap: anywhere; }
.pill-link { width: auto !important; padding: 3px 9px 3px 5px; gap: 4px; display: inline-flex !important; border: 1px solid var(--border); font-size: 12.5px; font-weight: 600; }
.pill-link .ic { width: 15px; height: 15px; }
.sources { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.sources li { display: flex; justify-content: space-between; gap: 8px; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2.5px solid var(--primary-soft); border-top-color: var(--primary); animation: spin .8s linear infinite; flex: none; display: inline-block; }
.spinner.inline { width: 13px; height: 13px; border-width: 2px; vertical-align: -2px; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2s; } }

/* ---------- sign-in / setup ---------- */
.signin-card { max-width: 460px; margin: 40px auto; text-align: center; padding: 32px 28px; }
.signin-card .logo { width: 44px; height: 44px; }
.signin-card h1 { margin: 14px 0 6px; }
.gbtn { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 20px; padding: 11px 16px; background: #fff; color: #1f1f1f !important; border: 1px solid #dadce0; border-radius: 10px; font-weight: 600; text-decoration: none !important; }
.gbtn:hover { box-shadow: 0 1px 3px rgba(60, 64, 67, .3); }
.gbtn svg { width: 20px; height: 20px; }
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 560px; }
.auth-card h1 { margin: 6px 0 8px; }

/* ---------- toast & background task ---------- */
.toast { position: fixed; left: 50%; top: 18px; transform: translateX(-50%); max-width: calc(100vw - 32px); background: var(--text); color: var(--surface); padding: 10px 16px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .2); font-size: 13.5px; z-index: 60; }
.toast.error { background: var(--danger); color: #fff; }
.task { position: fixed; right: 20px; bottom: 20px; z-index: 40; width: 320px; max-width: calc(100vw - 32px); display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px; box-shadow: 0 12px 32px rgba(0, 0, 0, .14); }
.task > div { flex: 1; min-width: 0; display: grid; gap: 2px; }
.task #task-msg { font-size: 12.5px; color: var(--muted); }
.task .bar { height: 5px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.task .bar div { height: 100%; width: 4%; background: var(--primary); transition: width .4s; }
.task.done .spinner { animation: none; border-color: var(--ok); }
.task.failed .spinner { animation: none; border-color: var(--danger); }
.task #task-link { font-weight: 700; font-size: 13px; align-self: center; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .p-grid, .leads-layout { grid-template-columns: 1fr; }
  #db-card { position: static; }
}
@media (max-width: 900px) {
  .search-layout { grid-template-columns: 1fr; }
  .panel { position: static; max-height: none; }
  /* with results on screen the filters fold away behind a button */
  .filters-toggle { display: inline-flex; width: 100%; justify-content: flex-start; margin-bottom: 12px; overflow: hidden; text-overflow: ellipsis; }
  .search-layout.has-results:not(.filters-open) .panel { display: none; }
}
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  /* the sidebar becomes a bottom tab bar */
  .sidebar { position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; z-index: 30; flex-direction: row; padding: 4px; border-right: 0; border-top: 1px solid var(--border); }
  .sidebar .brand, .side-foot { display: none; }
  .nav { grid-auto-flow: column; grid-auto-columns: 1fr; width: 100%; }
  .nav a { flex-direction: column; gap: 2px; font-size: 11px; padding: 6px 2px; text-align: center; }
  .nav em { display: none; }
  .mobile-only { display: flex !important; }
  .brand.mobile-only { padding: 0; }
  .topbar { padding: 8px 12px; }
  .content { padding: 16px 12px 90px; }
  .tiles { grid-template-columns: 1fr 1fr; }
  .tiles .tile:last-child { grid-column: 1 / -1; }
  .fact { grid-template-columns: 1fr; gap: 0; }
  .bulkbar { bottom: 76px; }
  .task { bottom: 76px; right: 12px; }
  /* tables become one card per row */
  .table-wrap { border: 0; overflow: visible; }
  .data thead { display: none; }
  .data, .data tbody, .data tr, .data td { display: block; width: 100%; }
  .data tr { position: relative; border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; background: var(--surface); }
  .data td { border: 0 !important; padding: 3px 0; }
  .data td.co { min-width: 0; padding-bottom: 6px; padding-right: 30px; }
  .data td[data-label]:not(.co):not(.links):not(.contact)::before { content: attr(data-label); display: inline-block; width: 86px; color: var(--muted); font-size: 12px; }
  .data td:empty, .data .num:empty { display: none; }
  .data .num { text-align: left; }
  .data .sel { position: absolute; right: 8px; top: 12px; width: auto; }
  .data .act { text-align: left; }
  .data .contact { min-width: 0; }
}
