/* Leads (index.html): stats header, filters, the list, the lead drawer and the
   numbers view (#zahlen). Built from the preview's tokens and pieces; only what
   app.css does not already draw lives here. */
/* ---------- head: title, count, Liste | Zahlen ---------- */
.leads-head { display: flex; align-items: center; gap: 16px; }
.leads-head .title { align-self: baseline; }
.leads-head #count { align-self: baseline; font-size: 14px; }
.leads-switch { flex: 0 0 200px; margin: 0; }

/* ---------- stats header ---------- */
#stats .stats { margin-top: 24px; }
#stats .stat .v.skeleton { width: 56px; height: 30px; }
.stat .per { margin-top: 6px; font-size: 12px; color: var(--text-3); }
.stat .per b { color: var(--text-2); font-weight: 500; }
.legacy-note { margin: 10px 0 0; font-size: 12px; color: var(--text-3); }
.legacy-note b { color: var(--text-2); font-weight: 500; }
#stats > .notice { margin: 24px 0 0; }

/* ---------- filters ---------- */
.filters { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 32px 0 8px; }
.search { position: relative; flex: 1 1 280px; max-width: 380px; }
.search svg.i { position: absolute; left: 12px; top: 11px; width: 18px; height: 18px; color: var(--text-3); pointer-events: none; }
.search input { padding-left: 40px; }
.search input::-webkit-search-cancel-button { filter: grayscale(1); opacity: .5; }
.pickfield select { width: auto; min-width: 190px; }
.toggle {
  display: inline-flex; align-items: center; gap: 10px; height: 40px; padding: 0 14px;
  border: 1px solid var(--line-2); border-radius: 10px; font-size: 14px; color: var(--text-2); cursor: pointer;
  transition: background-color .15s, color .15s;
}
.toggle:hover { background: var(--raise); color: var(--text); }
.toggle:has(input:checked) { color: var(--text); border-color: var(--text-3); }
.more summary {
  display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px;
  border: 1px solid var(--line-2); border-radius: 10px; font-size: 14px; color: var(--text-2);
  cursor: pointer; list-style: none; user-select: none; transition: background-color .15s, color .15s;
}
.more summary::-webkit-details-marker { display: none; }
.more summary::after {
  content: ""; width: 7px; height: 7px; margin: -3px 0 0 4px;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg);
  transition: transform .15s;
}
.more[open] summary::after { transform: translateY(3px) rotate(-135deg); }
.more summary:hover, .more[open] summary { background: var(--raise); color: var(--text); }
.more-count { color: var(--text); font-weight: 500; }
.more-panel {
  position: absolute; z-index: 15; left: 0; right: 0; top: calc(100% + 8px);
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; align-items: end;
  padding: 20px; background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: var(--shadow);
  animation: rise .16s cubic-bezier(.2,.7,.2,1);
}
.more-panel .field { margin: 0; }
.more-panel .ghost { grid-column: 1 / -1; justify-self: start; height: 40px; font-size: 14px; color: var(--text-2); }

/* ---------- the list ---------- */
.leads-table th { padding-top: 14px; }
.leads-table th.sortable button {
  all: unset; display: inline-flex; align-items: center; gap: 4px; cursor: pointer; border-radius: 4px;
}
.leads-table th.sortable button:focus-visible { outline: 1.5px solid var(--focus); outline-offset: 2px; }
.leads-table th[aria-sort] { color: var(--text); }
.leads-table th[aria-sort="descending"] button::after { content: "\2193"; }
.leads-table th[aria-sort="ascending"] button::after { content: "\2191"; }
.leads-table td { padding: 12px 10px; }
.leads-table th { padding-left: 10px; padding-right: 10px; }
.leads-table td:first-child, .leads-table th:first-child { padding-left: 4px; }
.leads-table tbody tr:focus-visible { outline: 1.5px solid var(--focus); outline-offset: -2px; border-radius: 0; }
.lead-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
/* Bodoni stays with the large handle; a row's small initial is Jost */
.lead-cell .avatar { width: 36px; height: 36px; font: 500 14px/1 "Jost", -apple-system, "Helvetica Neue", sans-serif; }
.lead-name { min-width: 0; }
.lead-handle { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.lead-sub { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.lead-sub:empty { display: none; }
.c-score { font-weight: 500; }
td.c-src, td.c-found, td.c-team { font-size: 13px; white-space: nowrap; }
.trunc { display: block; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td.c-niche { max-width: 150px; line-height: 0; }
td.c-niche .chip { margin: 2px 4px 2px 0; line-height: 1; }
.c-meta { display: none; }
.row-actions { display: flex; justify-content: flex-end; gap: 2px; }
.row-actions .iconbtn { width: 32px; height: 32px; color: var(--text-3); }
.row-actions .iconbtn svg.i { width: 16px; height: 16px; }
.row-actions .reject:hover { color: var(--bad); background: var(--bad-bg); }
@media (hover: hover) {
  .row-actions { opacity: .55; transition: opacity .15s; }
  tr:hover .row-actions, tr:focus-within .row-actions { opacity: 1; }
}
#v-liste > .empty { border-bottom: 1px solid var(--line); }
/* Narrow laptops: the three least used columns go, the list stays unscrolled. */
@media (max-width: 1240px) and (min-width: 861px) {
  .leads-table .c-eng, .leads-table .c-src, .leads-table .c-sent { display: none; }
}
/* Split-screen laptops: niche and owner go too (both are in the drawer). */
@media (max-width: 1000px) and (min-width: 861px) {
  .leads-table .c-niche, .leads-table .c-team { display: none; }
}

/* ---------- drawer ---------- */
.drawer { padding: 32px; }
.d-head { display: flex; align-items: center; gap: 16px; }
.d-head .avatar { width: 56px; height: 56px; font-size: 22px; }
.d-title { flex: 1; min-width: 0; }
.drawer .handle { font-size: 32px; }
.d-head .sub { margin-top: 4px; font-size: 14px; }
.d-head .iconbtn { align-self: flex-start; }
.drawer .tags { margin-top: 20px; }
.drawer .tags:empty { display: none; }
.d-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.d-links .ghost { height: 40px; font-size: 14px; white-space: nowrap; }
.d-links .ghost svg.i { width: 16px; height: 16px; }
.d-hint { margin: 8px 0 0; }
.drawer .stats { margin-top: 24px; }
.drawer .stat { padding-left: 14px; }
.drawer .stat:first-child { padding-left: 0; }
.drawer .stat .v { font-size: 19px; }
.d-detail { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 24px; margin-top: 28px; }
/* no screenshot, or a broken one (its frame is dropped): the bio takes the width */
.d-detail:not(:has(> .d-shot)) { grid-template-columns: minmax(0, 1fr); }
.d-shot { display: block; border-radius: 16px; }
.d-shot .shot { border-radius: 16px; }
.drawer .bio { font-size: 15px; margin-bottom: 24px; }
.d-reasons { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 14px; color: var(--text-2); }
.d-reasons li { display: flex; gap: 10px; align-items: baseline; overflow-wrap: anywhere; }
.d-reasons .pts { flex: none; min-width: 2.6em; text-align: right; color: var(--text-3); font-weight: 500; }
.d-reasons li.plus { color: var(--text); }
.d-reasons li.plus .pts { color: var(--text-2); }
.d-reasons li.blocker, .d-reasons li.blocker .pts { color: var(--bad); }
.d-sec { margin-top: 28px; padding-top: 24px; border-top: 1px solid var(--line); }
.d-sec .h { margin-bottom: 14px; }
.d-evidence { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 13px; color: var(--text-2); }
.d-evidence li { display: flex; gap: 10px; align-items: baseline; overflow-wrap: anywhere; min-width: 0; }
.d-evidence svg.i { width: 14px; height: 14px; transform: translateY(2px); color: var(--text-3); }
.d-kv { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); gap: 8px 16px; margin: 0; font-size: 14px; }
.d-kv dt { color: var(--text-3); }
.d-kv dd { margin: 0; overflow-wrap: anywhere; }
.d-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.d-sec .primary { height: 48px; margin-top: 4px; }
.d-wide { width: 100%; margin-top: 10px; }
.d-sec .hint { margin: 0 0 14px; line-height: 1.5; }
.d-msg {
  margin-bottom: 10px; padding: 12px 14px; border-radius: 10px; white-space: pre-wrap; overflow-wrap: anywhere;
  font-size: 14px; line-height: 1.6; background: var(--bg); border: 1px solid var(--line);
}
.d-msg .hint { margin: 6px 0 0; white-space: normal; }
.d-timeline { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.d-timeline li { position: relative; padding: 6px 0 6px 16px; border-left: 1px solid var(--line-2); }
.d-timeline li::before {
  content: ""; position: absolute; left: -3px; top: 15px; width: 5px; height: 5px; border-radius: 50%; background: var(--text-3);
}
.d-timeline .when { color: var(--text-3); margin-left: 6px; }

/* ---------- numbers view ---------- */
.kpi-panel { margin-top: 24px; }
.kpi-panel > .h { margin-bottom: 16px; }
.kpi-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.kpi-head .h { margin: 0; }
.kpi-head .pickfield select { min-width: 0; height: 36px; font-size: 14px; background-color: transparent; }
.ghost.small { height: 36px; padding: 0 14px; font-size: 14px; }
.kpi-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 24px; }
.kpi-grid .kpi-panel { margin-top: 24px; }
.kpi-panel .table th:first-child, .kpi-panel .table td:first-child { padding-left: 0; }
.kpi-panel .table th:last-child, .kpi-panel .table td:last-child { padding-right: 0; }
.kpi-panel .table tbody tr:last-child td { border-bottom: 0; }
.kpi-panel .table tbody tr:hover { background: transparent; }
.kpi-panel .empty { padding: 32px 0; }
.kpi-foot { margin: 14px 0 0; }
#daily-table { margin-top: 20px; max-height: 420px; overflow-y: auto; border-top: 1px solid var(--line); }
.table .legacy { border-left: 1px dashed var(--line-2); color: var(--text-3); }

/* Daily chart: one ink in three steps; "gefunden" also dashed, so it never
   rests on lightness alone. Text stays in text tokens. */
.chart { min-height: 240px; display: grid; place-items: center; }
.chart svg { display: block; overflow: visible; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--text-3); font-size: 11px; }
.chart .direct { fill: var(--text-2); font-size: 12px; }
.chart .series { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .series.s-discovered { stroke: var(--text-3); stroke-width: 1.5; stroke-dasharray: 4 4; }
.chart .series.s-contacted { stroke: var(--text-2); }
.chart .series.s-replied { stroke: var(--text); }
.chart .crosshair { stroke: var(--line-2); stroke-width: 1; opacity: 0; }
.chart .marker { opacity: 0; stroke: var(--panel); stroke-width: 2; }
.chart .marker.s-discovered { fill: var(--text-3); }
.chart .marker.s-contacted { fill: var(--text-2); }
.chart .marker.s-replied { fill: var(--text); }
.chart .crosshair.on, .chart .marker.on { opacity: 1; }
.chart .hit { fill: transparent; cursor: crosshair; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 10px; font-size: 12px; color: var(--text-3); }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.sw { display: inline-block; width: 16px; height: 0; border-top: 2px solid; }
.legend .sw.s-discovered { border-top: 1.5px dashed var(--text-3); }
.legend .sw.s-contacted { border-color: var(--text-2); }
.legend .sw.s-replied { border-color: var(--text); }
.chart-tip {
  position: fixed; z-index: 150; pointer-events: none; opacity: 0; transition: opacity .1s;
  display: grid; gap: 3px; padding: 10px 12px; border-radius: 10px; white-space: nowrap;
  font-size: 13px; line-height: 1.45; background: var(--text); color: var(--bg); box-shadow: 0 10px 30px -10px rgba(0,0,0,.4);
}
.chart-tip.on { opacity: 1; }
.chart-tip span { display: flex; align-items: center; gap: 8px; }
.chart-tip b { font-weight: 500; }
.chart-tip .faint { color: inherit; opacity: .6; }
.chart-tip .sw { width: 12px; border-color: currentColor; }
.chart-tip .sw.s-discovered { border-top-style: dashed; opacity: .5; }
.chart-tip .sw.s-contacted { opacity: .75; }
.auth-pending > .chart-tip { visibility: hidden; }

/* Pipeline bars: magnitude in one ink. */
.bars { display: grid; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 8rem minmax(0, 1fr) 3.5rem; gap: 14px; align-items: center; font-size: 14px; }
.bar-row .track { display: block; height: 8px; border-radius: 4px; background: var(--raise); overflow: hidden; }
.bar-row .track i { display: block; height: 100%; min-width: 4px; border-radius: 4px; background: var(--text-2); }
.legacy-box { margin-top: 20px; padding-top: 16px; border-top: 1px dashed var(--line-2); }
.legacy-box .tags { margin-top: 0; }
.legacy-box .hint { margin: 0; }

/* ---------- phone ---------- */
@media (max-width: 860px) {
  .leads-head { flex-wrap: wrap; gap: 4px 12px; }
  .leads-head .grow { display: none; }
  .leads-switch { flex: 1 0 100%; margin-top: 14px; }
  #stats .stats { margin-top: 20px; }
  .stat .per { font-size: 11px; }

  .filters { margin-top: 24px; gap: 8px; }
  .search { flex: 1 0 100%; max-width: none; }
  .search input, .pickfield select, .toggle, .more summary { height: 44px; }
  .search svg.i { top: 13px; }
  .pickfield { flex: 1 1 0; min-width: 0; }
  .pickfield select { min-width: 0; }
  .more { flex: 1 0 100%; }
  .more summary { display: flex; justify-content: center; }
  .more-panel { position: static; margin-top: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 16px; box-shadow: none; }
  .more-panel .field input, .more-panel .field select { height: 44px; }

  /* The table becomes compact rows: who and status, then one meta line. */
  .leads-table thead { display: none; }
  .leads-table, .leads-table tbody { display: block; }
  .leads-table tr.clickable {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 12px;
    padding: 12px 0; border-bottom: 1px solid var(--line);
  }
  .leads-table td { display: none; padding: 0; border: 0; }
  .leads-table td:first-child { padding-left: 0; }
  .leads-table td.c-who { display: block; grid-column: 1; grid-row: 1; }
  .leads-table td.c-status { display: block; grid-column: 2; grid-row: 1; justify-self: end; }
  .leads-table td.c-meta { display: block; grid-column: 1; grid-row: 2; padding-left: 48px; font-size: 12px; color: var(--text-3); }
  .lead-handle, .lead-sub { max-width: none; }
  /* no one-tap reject in a list scrolled by thumb: it stays in the drawer and in Outreach,
     so the action cell (reject only, no Instagram link) stays hidden like the other cells */

  .drawer { padding: 20px 16px calc(24px + env(safe-area-inset-bottom)); }
  .drawer .handle { font-size: 28px; }
  .d-head .avatar { width: 48px; height: 48px; font-size: 20px; }
  .drawer .stat { padding-left: 12px; }
  .drawer .stats > .stat:nth-child(3n + 1) { padding-left: 0; }
  .d-detail { grid-template-columns: 92px minmax(0, 1fr); gap: 16px; }
  .d-kv { grid-template-columns: 7.5rem minmax(0, 1fr); }
  .d-pair { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .d-sec .d-pair .ghost { margin-bottom: 8px; }
  .d-links .ghost { flex: 1 1 auto; height: 44px; }

  .kpi-head { flex-wrap: wrap; }
  .kpi-head .h { flex: 1 0 100%; margin-bottom: 4px; }
  .kpi-head .grow { display: none; }
  .kpi-head .pickfield select, .ghost.small { height: 44px; }
  .kpi-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .bar-row { grid-template-columns: 6.5rem minmax(0, 1fr) 3rem; gap: 10px; }
  /* Phone tables keep the columns that decide; replies and hours stay on the Mac. */
  .kpi-panel .table th, .kpi-panel .table td { padding-left: 6px; padding-right: 6px; }
  #people .table :is(th, td):nth-child(5), #templates .table :is(th, td):nth-child(5) { display: none; }
}
