/* Calm, low-contrast palette for long daily use. Tokens first, then layout. */
:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-2: #f1efe9;
  --line: #e5e2da;
  --text: #2c2f31;
  --muted: #6c7075;
  --accent: #3d7a6c;
  --accent-ink: #ffffff;
  --accent-soft: #e2eeea;
  --hot: #b9573f;
  --hot-soft: #f7e7e1;
  --warn: #a97b24;
  --warn-soft: #f5ecd8;
  --ok: #4d7d50;
  --ok-soft: #e4eee2;
  --shadow: 0 1px 2px rgba(40, 40, 30, .05), 0 4px 16px rgba(40, 40, 30, .04);
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16191b; --surface: #1e2225; --surface-2: #252a2e; --line: #31363b;
    --text: #e3e1db; --muted: #979ca1; --accent: #82b9aa; --accent-ink: #12201c; --accent-soft: #223430;
    --hot: #e0907b; --hot-soft: #3a2621; --warn: #d6b06a; --warn-soft: #382f20; --ok: #93c08f; --ok-soft: #223020;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #16191b; --surface: #1e2225; --surface-2: #252a2e; --line: #31363b;
  --text: #e3e1db; --muted: #979ca1; --accent: #82b9aa; --accent-ink: #12201c; --accent-soft: #223430;
  --hot: #e0907b; --hot-soft: #3a2621; --warn: #d6b06a; --warn-soft: #382f20; --ok: #93c08f; --ok-soft: #223020;
  --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 5px; font-size: 13px; }
.muted { color: var(--muted); }
.container { max-width: 1240px; margin: 0 auto; padding: 0 20px; }
.ic { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; max-width: 1240px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand strong { display: block; font-size: 17px; letter-spacing: -.01em; }
.brand small { color: var(--muted); font-size: 12.5px; }
.logo { width: 34px; height: 34px; border-radius: 10px; background: var(--accent-soft); border: 1.5px solid var(--accent); position: relative; }
.logo::after { content: ""; position: absolute; inset: 9px; border-radius: 50%; border: 2px solid var(--accent); }
.topnav { display: flex; gap: 6px; }
.count { background: var(--hot); color: #fff; font-size: 11.5px; font-weight: 600; border-radius: 99px; padding: 0 7px; line-height: 18px; }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: inherit; font-size: 14px; font-weight: 500;
  cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s;
}
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.square { width: 40px; padding: 0; }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

input, select, textarea {
  font: inherit; font-size: 14px; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; height: 40px; width: 100%;
}
textarea { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- search bar ---------- */
.searchbar { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); padding: 12px 0; }
.search-form { display: grid; grid-template-columns: 1fr 1.4fr auto auto; gap: 10px; align-items: end; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field > span { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

/* ---------- page head & stats ---------- */
main { padding-top: 22px; padding-bottom: 60px; }
.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { font-size: 22px; font-weight: 600; letter-spacing: -.015em; }
.page-head .muted { font-size: 13.5px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat {
  text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; cursor: pointer; font: inherit; color: inherit; box-shadow: var(--shadow);
  transition: border-color .15s, background .15s;
}
.stat:hover { border-color: var(--accent); }
.stat.active { border-color: var(--accent); background: var(--accent-soft); }
.stat b { display: block; font-size: 22px; font-weight: 600; line-height: 1.2; }
.stat span { font-size: 12.5px; color: var(--muted); }
.stat.hot b { color: var(--hot); }
.stat.warn b { color: var(--warn); }
.stat.ok b { color: var(--ok); }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar .grow { flex: 1 1 220px; }
.toolbar select { width: auto; min-width: 150px; }

/* ---------- lead cards ---------- */
.leads { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 370px), 1fr)); gap: 14px; }
.lead {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 16px 14px; display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow);
  border-left: 4px solid var(--line);
}
.lead.web-none { border-left-color: var(--hot); }
.lead.web-weak { border-left-color: var(--warn); }
.lead.web-ok { border-left-color: var(--ok); }
.lead.st-not_interested { opacity: .6; }
.lead-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.lead-head h3 { font-size: 16px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.lead-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.badges { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: none; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; padding: 2px 9px; border-radius: 99px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.badge.web-none { background: var(--hot-soft); color: var(--hot); }
.badge.web-weak { background: var(--warn-soft); color: var(--warn); }
.badge.web-ok { background: var(--ok-soft); color: var(--ok); }
.badge .ic { width: 12px; height: 12px; }

.info { display: grid; gap: 6px; font-size: 13.5px; }
.info-row { display: flex; gap: 8px; align-items: flex-start; min-width: 0; }
.info-row .ic { margin-top: 3px; color: var(--muted); }
.info-row > span, .info-row > a { min-width: 0; overflow-wrap: anywhere; }
.info-row .none { color: var(--muted); font-style: italic; }
.info-row .hot { color: var(--hot); }

.socials { display: flex; gap: 6px; flex-wrap: wrap; }
.social { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; padding: 3px 10px 3px 8px; border-radius: 99px; background: var(--surface-2); color: var(--text); }
.social:hover { text-decoration: none; background: var(--accent-soft); }
.social .ic { width: 14px; height: 14px; }

.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.actions .btn { height: 32px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.actions a.btn:hover { text-decoration: none; }
.btn.wa { color: var(--ok); }

.track { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding-top: 12px; border-top: 1px dashed var(--line); }
.track select, .track input { height: 34px; font-size: 13px; }
.track textarea { grid-column: 1 / -1; font-size: 13px; min-height: 38px; }
.track .due { border-color: var(--hot); color: var(--hot); }

details.hours { font-size: 12.5px; color: var(--muted); }
details.hours summary { cursor: pointer; }
details.hours ul { list-style: none; padding: 4px 0 0; margin: 0; }

/* ---------- pager / states ---------- */
.pager { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 22px; flex-wrap: wrap; }
.pager .btn { height: 34px; min-width: 34px; padding: 0 10px; }
.pager .btn.current { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pager-info { color: var(--muted); font-size: 13px; margin: 0 8px; }

.state { text-align: center; padding: 70px 20px; color: var(--muted); }
.state h2 { color: var(--text); font-size: 18px; font-weight: 600; margin-bottom: 6px; }
.state .btn { margin-top: 16px; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .9s linear infinite; margin: 0 auto 18px; }
@keyframes spin { to { transform: rotate(360deg); } }

#toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 10px; font-size: 14px;
  transition: opacity .2s, transform .2s; z-index: 20; max-width: calc(100vw - 32px);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

dialog { border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--text); padding: 0; width: min(640px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0, 0, 0, .35); }
.dialog-body { padding: 22px; display: grid; gap: 12px; }
.dialog-body h2 { font-size: 18px; font-weight: 600; }
.dialog-actions { display: flex; gap: 8px; }
.spacer { flex: 1; }

@media (max-width: 760px) {
  .container { padding: 0 16px; }
  .topbar { padding: 12px 16px; }
  .topnav .btn:not(.square) { padding: 0 10px; }
  .brand small { display: none; }
  .search-form { grid-template-columns: 1fr 1fr; }
  .search-form .btn { grid-column: span 1; }
  .toolbar select { flex: 1 1 140px; }
}
@media (max-width: 420px) {
  .topnav #pitchBtn { display: none; }
  .search-form { grid-template-columns: 1fr; }
}
