/* Leads Engine design system. Light and dark themes share every rule; only the tokens change. */
:root {
  color-scheme: light;
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #f1f1ee;
  --ink: #17191c;
  --mute: #5b6168;
  --line: #e3e3df;
  --line-strong: #c9c9c4;
  --accent: #0b6b5e;
  --accent-ink: #ffffff;
  --link: #0b6b5e;
  --accent-soft: #e2f1ee;
  --warn: #9a3412;
  --warn-soft: #fdeee4;
  --shadow: 0 1px 2px rgb(16 24 32 / 6%), 0 1px 1px rgb(16 24 32 / 4%);
  --radius: 10px;
  --font: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --bg: #0f1113;
    --surface: #171a1d;
    --surface-2: #1f2327;
    --ink: #e8eaec;
    --mute: #a1a8af;
    --line: #2b3035;
    --line-strong: #3d444b;
    --accent: #2bb39c;
    --accent-ink: #04221d;
    --link: #5fd3bd;
    --accent-soft: #12302b;
    --warn: #fb923c;
    --warn-soft: #3a2113;
    --shadow: none;
  }
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0f1113;
  --surface: #171a1d;
  --surface-2: #1f2327;
  --ink: #e8eaec;
  --mute: #a1a8af;
  --line: #2b3035;
  --line-strong: #3d444b;
  --accent: #2bb39c;
  --accent-ink: #04221d;
  --link: #5fd3bd;
  --accent-soft: #12302b;
  --warn: #fb923c;
  --warn-soft: #3a2113;
  --shadow: none;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.55 var(--font); background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 18px; margin: 0; }
h2 { font-size: 15px; margin: 0 0 12px; font-weight: 650; }
a { color: var(--link); text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
code { font: 13px/1.4 ui-monospace, 'SFMono-Regular', Consolas, monospace; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; word-break: break-all; }

/* App shell */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 24px; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(150%) blur(8px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 16px; }
.brand svg { flex: none; }
.topbar-right { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-right .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
main { max-width: 1120px; margin: 0 auto; padding: 24px; }

/* Surfaces */
.card, .tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card { padding: 18px; margin-bottom: 18px; overflow-x: auto; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tile { padding: 14px 16px; }
.tile b { display: block; font-size: 26px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.tile span { color: var(--mute); font-size: 13px; }

/* Tables */
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th { text-align: left; color: var(--mute); font-weight: 550; font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid var(--line); padding: 8px 12px 8px 0; white-space: nowrap; }
td { padding: 9px 12px 9px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.pill { display: inline-block; padding: 1px 9px; border-radius: 99px; background: var(--accent-soft); color: var(--ink); font-size: 12px; font-weight: 550; }

/* Controls */
button, .btnlike, .button { font: inherit; font-size: 14px; font-weight: 550; padding: 7px 14px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; transition: background 0.12s, border-color 0.12s; }
button:hover, .btnlike:hover, .button:hover { background: var(--surface-2); }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.primary:hover, .button.primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--ink)); }
button:disabled { opacity: 0.55; cursor: progress; }
input, select, textarea { font: inherit; padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: 8px; width: 100%; background: var(--surface); color: var(--ink); }
input::placeholder, textarea::placeholder { color: var(--mute); opacity: 0.85; }
label { display: block; font-size: 13px; color: var(--mute); margin-bottom: 4px; font-weight: 500; }
.icon-btn { padding: 7px; border-radius: 8px; line-height: 0; }
.linkish { background: none; border: 0; padding: 0; color: var(--link); text-decoration: underline; text-underline-offset: 2px; font: inherit; font-weight: 500; cursor: pointer; text-align: left; }
.linkish:hover { background: none; }

/* Layout helpers */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.wide { grid-column: 1 / -1; }
.row { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; align-items: center; }
.row input { flex: 1; min-width: 220px; width: auto; }
.row select { width: auto; }
.row button { white-space: nowrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.muted { color: var(--mute); }
.empty { color: var(--mute); padding: 8px 0; }
.warn { color: var(--warn); }
p.warn:not(:empty) { background: var(--warn-soft); padding: 8px 12px; border-radius: 8px; }
#status:not(:empty) { padding: 9px 12px; border-radius: 8px; background: var(--accent-soft); margin: 0 0 16px; }
#status.warn:not(:empty) { background: var(--warn-soft); }

/* Checklist */
.check { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 6px 18px; }
.check li { padding: 3px 0 3px 26px; position: relative; }
.check li::before { content: ''; position: absolute; left: 0; top: 6px; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-strong); }
.check li.done { color: var(--mute); }
.check li.done::before { background: var(--accent); border-color: var(--accent); box-shadow: inset 0 0 0 3px var(--surface); }

/* Conversation */
.msg { padding: 8px 12px; border-radius: 12px; margin: 6px 0; max-width: min(80%, 560px); white-space: pre-wrap; background: var(--surface-2); }
.msg.out { background: var(--accent-soft); margin-left: auto; }
.msg small { display: block; color: var(--mute); margin-top: 3px; font-size: 12px; }
#suggested button { margin: 6px 6px 0 0; font-size: 13px; padding: 4px 10px; text-align: left; font-weight: 450; }

/* Auth screens */
.auth { max-width: 520px; margin: 8vh auto; }
.auth h2 { font-size: 20px; }

@media (max-width: 640px) {
  main { padding: 16px; }
  .topbar { padding: 10px 16px; }
  .card { padding: 14px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
