/* chasercode UI v2 — one stylesheet, no framework. Light and dark follow the OS. */
/* The accent is the logo's orange (the same #ff7a2f the old shell uses).
   Fills take --accent with --accent-ink on top: near-black on orange, which is
   the pair the brand already reads well with. Orange text on a white page is
   too light to read, so anything that is *text* uses --accent-strong. */
:root {
  --bg: #f7f6f4; --surface: #ffffff; --surface-2: #f2f0ec;
  --text: #17130f; --muted: #6b625a; --line: #e8e2da;
  --accent: #ff7a2f; --accent-strong: #c2410c; --accent-ink: #191008; --accent-soft: #fdeee3;
  --good: #047857; --good-soft: #e3f6ee;
  --warn: #b45309; --warn-soft: #fdf1dc;
  --bad: #b91c1c; --bad-soft: #fde8e8;
  --radius: 14px; --shadow: 0 1px 2px rgba(15,23,42,.05), 0 6px 18px rgba(15,23,42,.05);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0d0f; --surface: #16181b; --surface-2: #1d2024;
    --text: #e9ebee; --muted: #9aa0a8; --line: #26292e;
    --accent: #ff7a2f; --accent-strong: #ff9b5e; --accent-ink: #191008; --accent-soft: #2a1a11;
    --good: #5ee0ad; --good-soft: #0f2a22;
    --warn: #f5b861; --warn-soft: #2e2210;
    --bad: #ff8a8a; --bad-soft: #321616;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.1rem; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: .85rem; margin: .5rem 0 0; }
[hidden] { display: none !important; }

/* ---- shell ---- */
.top { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1120px; margin: 0 auto; padding: .6rem 1rem; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.logo { font-weight: 700; font-size: 1.1rem; color: var(--text); letter-spacing: -.02em; }
.logo b { color: var(--accent); }
.logo:hover { text-decoration: none; }
.tabs { display: flex; gap: .25rem; }
.tab { padding: .4rem .8rem; border-radius: 999px; color: var(--muted); font-weight: 500; }
.tab:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.tab.is-on { background: var(--accent-soft); color: var(--accent-strong); }
.tab-n { margin-left: .4rem; background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 0 .45rem; font-size: .75rem; font-weight: 600; }
.top-end { margin-left: auto; display: flex; align-items: center; gap: .9rem; }
.quota { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; color: var(--text); }
.quota:hover { text-decoration: none; }
.quota-n { font-weight: 700; font-variant-numeric: tabular-nums; }
.quota-n i { font-style: normal; color: var(--muted); font-weight: 500; }
.quota-l { font-size: .7rem; color: var(--muted); }
.quota.is-out .quota-n { color: var(--bad); }
.who { position: relative; }
.who summary { list-style: none; cursor: pointer; padding: .35rem .7rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.who summary::-webkit-details-marker { display: none; }
.who-menu { position: absolute; right: 0; top: calc(100% + .4rem); min-width: 160px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: .35rem; display: grid; }
.who-menu a { padding: .45rem .7rem; border-radius: 8px; color: var(--text); }
.who-menu a:hover { background: var(--surface-2); text-decoration: none; }
.page { width: 100%; max-width: 1120px; margin: 0 auto; padding: 1.25rem 1rem 3rem; flex: 1; }
.foot { max-width: 1120px; width: 100%; margin: 0 auto; padding: 1rem; display: flex; gap: 1rem; flex-wrap: wrap; color: var(--muted); font-size: .8rem; border-top: 1px solid var(--line); }
.foot a { color: var(--muted); }

/* ---- controls ---- */
.go, .btn { font: inherit; cursor: pointer; border-radius: 10px; border: 1px solid transparent; padding: .55rem 1rem; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; }
.go { background: var(--accent); color: var(--accent-ink); }
.go:hover { filter: brightness(1.07); text-decoration: none; }
.go:disabled, .btn:disabled { opacity: .55; cursor: default; }
.btn { background: var(--surface); color: var(--text); border-color: var(--line); padding: .4rem .8rem; font-weight: 500; font-size: .9rem; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-ghost { background: transparent; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-primary:hover { filter: brightness(1.07); background: var(--accent); }
.link { background: none; border: 0; color: var(--accent-strong); cursor: pointer; font: inherit; padding: 0; }
input[type=text], input[type=search], select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .55rem .7rem; width: 100%; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
textarea { resize: vertical; }
.row { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .6rem; align-items: center; }
.note { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; background: var(--accent-soft); border-radius: 12px; padding: .7rem 1rem; margin-bottom: 1rem; }
.note form { margin: 0; }
.note-warn { background: var(--warn-soft); color: var(--warn); }
.err { color: var(--bad); margin: .4rem 0 0; font-size: .85rem; }

/* ---- search ---- */
.search { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem; display: grid; gap: .9rem; }
.search-row { display: grid; grid-template-columns: 1.1fr 1fr 1.6fr auto; gap: .7rem; align-items: end; }
.f { display: grid; gap: .25rem; }
.f > span, .sort > span { font-size: .75rem; color: var(--muted); font-weight: 500; }
.chips { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-block; padding: .35rem .8rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: .88rem; user-select: none; }
.chip span:hover { background: var(--surface-2); }
.chip input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); font-weight: 600; }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.chip-quiet span { border-style: dashed; color: var(--muted); }
.sort { margin-left: auto; display: flex; align-items: center; gap: .5rem; }
.sort select { width: auto; padding: .35rem .6rem; }
.meta { display: flex; justify-content: space-between; gap: 1rem; margin: 1rem .2rem .6rem; color: var(--muted); font-size: .88rem; }

/* ---- cards ---- */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: .35rem; transition: border-color .15s, transform .15s; }
.card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .5rem; }
.card-name { font-size: 1.05rem; font-weight: 650; }
.card-name a { color: var(--text); }
.card-sub { margin: 0; color: var(--muted); font-size: .9rem; }
.card-addr { margin: 0; font-size: .88rem; color: var(--muted); }
.dot { margin: 0 .35rem; }
.rate { color: var(--text); font-weight: 500; }
.badges { display: flex; gap: .35rem; flex-wrap: wrap; margin: .25rem 0 0; }
.badge { font-size: .75rem; font-weight: 600; padding: .15rem .55rem; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.b-none { background: var(--good-soft); color: var(--good); }
.b-social { background: var(--warn-soft); color: var(--warn); }
.b-open { background: var(--accent-soft); color: var(--accent-strong); }
.b-state.s-wrote { background: var(--accent-soft); color: var(--accent-strong); }
.b-state.s-answered { background: var(--good-soft); color: var(--good); }
.b-state.s-closed { background: var(--bad-soft); color: var(--bad); }
.chan { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: .25rem; }
.ch { font-size: .82rem; padding: .2rem .55rem; border: 1px solid var(--line); border-radius: 8px; color: var(--text); background: var(--surface-2); }
.ch-tel { font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.ch-none { color: var(--muted); background: transparent; border-style: dashed; }
.open { margin-top: auto; padding-top: .35rem; display: inline-block; font-weight: 600; }
.card .open { margin-top: .5rem; text-align: center; padding: .5rem; border-radius: 10px; background: var(--accent); color: var(--accent-ink); }
.card .open:hover { text-decoration: none; filter: brightness(1.07); }
.card .open.is-opened { background: var(--surface-2); color: var(--text); }
.card[data-lead=closed] { opacity: .65; }
.star { background: transparent; border: 0; padding: .25rem; cursor: pointer; color: var(--muted); border-radius: 8px; display: inline-flex; align-items: center; gap: .4rem; font: inherit; }
.star svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }
.star:hover { color: var(--accent); }
.star.is-on { color: var(--accent); }
.star.is-on svg { fill: currentColor; }
.star-lg { border: 1px solid var(--line); background: var(--surface); padding: .45rem .8rem; border-radius: 10px; color: var(--text); }
.star-lg.is-on { border-color: var(--accent); }

.pager { display: flex; justify-content: space-between; align-items: center; margin: 1.4rem 0; gap: 1rem; }
.pager a { white-space: nowrap; padding: .5rem 1rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); font-weight: 500; }
.pager-n { color: var(--muted); font-size: .9rem; }
.empty { text-align: center; max-width: 34rem; margin: 3rem auto; display: grid; gap: .8rem; }
.empty p { margin: 0; color: var(--muted); }
.more { margin-top: 2rem; color: var(--muted); }
.more summary { cursor: pointer; }
.collect { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1rem; }
.collect input[type=text] { flex: 1 1 14rem; width: auto; }
.collect .hint { flex-basis: 100%; }

/* ---- lead page ---- */
.back { margin: 0 0 .8rem; }
.lead-head { display: flex; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.2rem 1.3rem; }
.lead-title { display: grid; gap: .3rem; min-width: 0; }
.lead-mark { display: grid; gap: .6rem; align-content: start; justify-items: end; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
.seg-b { font: inherit; border: 0; background: transparent; padding: .4rem .8rem; cursor: pointer; color: var(--muted); border-right: 1px solid var(--line); }
.seg-b:last-child { border-right: 0; }
.seg-b:hover { background: var(--surface-2); }
.seg-b.is-on { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.seg-sm .seg-b { padding: .25rem .55rem; font-size: .82rem; }
.lead-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .9rem; margin-top: .9rem; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem 1.2rem; display: grid; gap: .6rem; }
.panel-wide { grid-column: 1 / -1; }
.panel p { margin: 0; }
.contacts { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
.crow { display: grid; grid-template-columns: 5.5rem 1fr; gap: .2rem .6rem; align-items: center; padding-bottom: .6rem; border-bottom: 1px solid var(--line); }
.crow:last-child { border-bottom: 0; padding-bottom: 0; }
.crow-k { color: var(--muted); font-size: .8rem; }
.crow-v { font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.crow-a { grid-column: 2; display: flex; gap: .4rem; flex-wrap: wrap; }
.crow-none { color: var(--muted); }
.demo-frame { width: 100%; height: 520px; border: 1px solid var(--line); border-radius: 12px; background: #fff; margin-top: .6rem; }

/* ---- favourites ---- */
.shelf-head { margin-bottom: .8rem; display: grid; gap: .2rem; }
.subtabs { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.subtab { padding: .35rem .8rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: .9rem; }
.subtab i { font-style: normal; color: var(--muted); margin-left: .25rem; }
.subtab.is-on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-strong); font-weight: 600; }
.subtab:hover { text-decoration: none; background: var(--surface-2); }
.shelf { display: grid; gap: .6rem; }
.srow { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.4fr) auto; gap: 1rem; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; }
.srow[data-lead=closed] { opacity: .6; }
.srow-main { min-width: 0; }
.srow-contacts { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.srow-state { display: flex; gap: .5rem; align-items: center; }

/* ---- job ---- */
.job { max-width: 34rem; margin: 3rem auto; display: grid; gap: .8rem; }
.job progress { width: 100%; height: 10px; accent-color: var(--accent); }
.job p { margin: 0; }

/* ---- small screens ---- */
@media (max-width: 860px) {
  .search-row { grid-template-columns: 1fr 1fr; }
  .search-row .f-q { grid-column: 1 / -1; }
  .search-row .go { grid-column: 1 / -1; }
  .sort { margin-left: 0; width: 100%; }
  .lead-grid { grid-template-columns: 1fr; }
  .srow { grid-template-columns: 1fr; gap: .6rem; }
  .lead-mark { justify-items: start; }
}
@media (max-width: 640px) {
  .grid { grid-template-columns: 1fr; }
  .tabs { order: 3; width: 100%; }
  .quota-l { display: none; }
  .crow { grid-template-columns: 1fr; }
  .crow-a { grid-column: 1; }
  .demo-frame { height: 380px; }
  .seg-b { padding: .4rem .55rem; font-size: .85rem; }
}
