/* SSAK Call Tracker - jeden arkusz stylow (Agent B).
   Jasny motyw, system fonts, czytelnosc na telefonie. Bez CDN. */

:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #15181d;
  --muted: #6a7280;
  --line: #e2e6eb;
  --line-strong: #ccd3db;
  --brand: #1b5cff;
  --brand-dark: #1447c4;
  --ok: #0f7a3d;
  --ok-bg: #e6f5ec;
  --warn: #9a5b00;
  --warn-bg: #fff3e0;
  --bad: #b3261e;
  --bad-bg: #fdeceb;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .06);
  --tap: 40px;
}

* { box-sizing: border-box; }

/* atrybut hidden ma byc silniejszy niz display z klasy */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }

.muted { color: var(--muted); }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* ---------- topbar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 16px; background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 30;
}
.brand { font-weight: 700; color: var(--text); font-size: 16px; white-space: nowrap; }
.brand span { color: var(--brand); }
.brand:hover { text-decoration: none; }
.topbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.client-switch { display: flex; align-items: center; gap: 6px; }
.client-switch-label { font-size: 12px; color: var(--muted); }
.user-login { font-size: 13px; color: var(--muted); max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- layout ---------- */
.page { max-width: 1180px; margin: 0 auto; padding: 16px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.page-title { font-size: 21px; }
.page-sub { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.crumbs { margin: 0 0 2px; font-size: 13px; color: var(--muted); }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 16px; box-shadow: var(--shadow);
}
.card-title { font-size: 16px; margin-bottom: 4px; }
.card-sub { margin: 0 0 12px; font-size: 13px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.card-head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.card-head-actions select { width: auto; min-width: 150px; }
.card-head-actions input[type="search"] { width: auto; min-width: 150px; }

/* ---------- formularze ---------- */
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; min-width: 0; }
.field-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.field-hint { font-size: 12px; color: var(--muted); }
.field-inline { margin-bottom: 0; }
.field-grow { flex: 1 1 200px; }
.field-check { flex-direction: row; align-items: center; gap: 8px; }
.field-check input { width: 18px; height: 18px; }
.field-wide { grid-column: 1 / -1; }

input[type="text"], input[type="tel"], input[type="email"], input[type="password"],
input[type="number"], input[type="search"], input[type="date"], select, textarea {
  font: inherit; color: var(--text); background: #fff;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: 9px 10px; min-height: var(--tap); width: 100%;
}
textarea { min-height: 72px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--brand); outline-offset: 1px;
}
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.row-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.row-form .field { flex: 1 1 160px; margin-bottom: 0; }
.form-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.save-hint { font-size: 12px; }
.form-error { color: var(--bad); font-size: 13px; margin: 0 0 10px; }
.fset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; margin: 0 0 16px; }
.fset legend { font-size: 13px; font-weight: 650; padding: 0 6px; }

/* ---------- przyciski ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--tap); padding: 0 14px; font: inherit; font-size: 14px; font-weight: 550;
  color: var(--text); background: #fff; border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); cursor: pointer;
}
.btn:hover { background: #f2f4f7; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .55; cursor: default; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: #f2f4f7; color: var(--text); }
.btn-small { min-height: 32px; padding: 0 10px; font-size: 13px; }
.btn-danger { color: var(--bad); border-color: #efc5c2; }
.btn-danger:hover { background: var(--bad-bg); }
.btn-block { width: 100%; }

/* ---------- login ---------- */
.login-wrap { max-width: 380px; margin: 8vh auto 0; padding: 16px; }
.login-card { padding: 22px; }
.login-title { font-size: 20px; }
.login-sub { color: var(--muted); font-size: 14px; margin: 4px 0 18px; }
.login-foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 14px; }

/* ---------- okres i filtry ---------- */
.period-bar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.range-inputs { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.range-inputs input { width: auto; min-width: 140px; }
.seg-btn {
  min-height: var(--tap); padding: 0 14px; font: inherit; font-size: 14px;
  background: #fff; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  cursor: pointer; color: var(--text);
}
.seg-btn:hover { background: #f2f4f7; }
.seg-btn.is-active { background: var(--brand); border-color: var(--brand); color: #fff; }

.filters { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 12px; }

/* ---------- statystyki ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; box-shadow: var(--shadow);
}
.stat-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.stat-value { font-size: 22px; font-weight: 700; margin-top: 2px; letter-spacing: -.02em; }
.stat-money .stat-value { color: var(--ok); }
.stat-missed .stat-value { color: var(--bad); }
.stat-bad .stat-value { color: var(--muted); }
/* kafelek jako filtr listy */
.stat-btn { font: inherit; text-align: left; cursor: pointer; color: var(--text); }
.stat-btn:hover { border-color: var(--line-strong); }
.stat-btn.is-active { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.stat-todo .stat-value { color: var(--brand); }

/* ---------- tabele ---------- */
.table-scroll { overflow-x: auto; position: relative; }  /* relative: przycina tez elementy absolutne (.sr-only) */
.data-table, .leads-table { width: 100%; border-collapse: collapse; background: var(--card); }
.data-table { font-size: 14px; }
.leads-table { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.data-table th, .leads-table th {
  text-align: left; font-size: 12px; color: var(--muted); font-weight: 650;
  padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.data-table td, .leads-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table tr:last-child td, .leads-table tbody tr:last-child td { border-bottom: 0; }
.leads-wrap { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.lead-row.is-open td { background: #f8fafd; }
.cell-date { white-space: nowrap; font-variant-numeric: tabular-nums; }
.cell-date .time { font-weight: 600; }
.cell-date .date { display: block; font-size: 12px; color: var(--muted); }
.cell-contact { min-width: 156px; }
/* numer nigdy nie lamie sie na dwie linie (UI-1) */
.contact-main { font-weight: 600; white-space: nowrap; }
.contact-sub { font-size: 12px; color: var(--muted); word-break: break-word; }
.contact-flags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.tel-link { display: inline-flex; align-items: center; gap: 5px; color: var(--brand); }
.tel-link:hover { text-decoration: underline; }
.tel-icon { font-size: 13px; }
.flag {
  display: inline-flex; align-items: center; gap: 3px; padding: 1px 7px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.flag-missed { background: var(--bad-bg); color: var(--bad); }
.flag-repeat { background: var(--warn-bg); color: var(--warn); }
.flag-icon { font-size: 13px; line-height: 1; }
.cell-value { white-space: nowrap; }
.cell-value input { min-height: 36px; width: 104px; font-size: 13px; }
.value-editor { display: flex; align-items: center; gap: 6px; }
.value-shown {
  font: inherit; font-weight: 650; color: var(--ok); background: none; border: 0;
  padding: 0; cursor: pointer; text-align: left;
}
.value-shown:hover { text-decoration: underline; }
.note-preview {
  font: inherit; font-size: 12px; color: var(--muted); background: none; border: 0; padding: 0;
  cursor: pointer; text-align: left; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.note-preview:hover { color: var(--text); text-decoration: underline; }
.note-row { display: flex; gap: 6px; align-items: center; }
.cell-actions { text-align: right; }
.cell-actions > * + * { margin-left: 6px; }
.lead-row.is-focus > td { background: #fff7db; }
.lead-row.is-focus > td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.campaign { font-size: 12px; color: var(--muted); display: block; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kind-icon { font-size: 16px; }
/* czat (SPEC v1.2): ikona emoji jest szersza od ☎ i ✉, wiec zwezamy ja optycznie */
.cell-kind-chat .kind-icon { font-size: 13px; }
.kind-label { font-size: 12px; color: var(--muted); display: block; }
.state-box { padding: 22px 12px; text-align: center; }
.state-box p { margin: 0 0 6px; }

/* ---------- badge zrodel ---------- */
.badge {
  display: inline-block; padding: 3px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: #eef0f3; color: #4b5563;
}
.badge-google_ads { background: #e6efff; color: #1447c4; }
.badge-meta { background: #f1e9ff; color: #6528c7; }
.badge-gbp { background: #e3f6e9; color: #0f7a3d; }
.badge-organic { background: #eef0f3; color: #4b5563; }
.badge-microsoft { background: #e4f3f7; color: #0d6a7d; }
.badge-tiktok { background: #fde9f0; color: #a3124b; }
.badge-paid_other { background: #fff2de; color: #9a5b00; }
.badge-call_asset { background: #e6f7f4; color: #0c6b5d; }
.badge-referral { background: #eaf0fb; color: #3b5578; }
.badge-direct, .badge-unknown_pool, .badge-other { background: #eef0f3; color: #4b5563; }

/* ---------- statusy: segmentowane przyciski (7 statusow, zawsze max 2 rzedy) ---------- */
.cell-status { min-width: 350px; }
.th-status { min-width: 350px; }
/* 12 kolumn: 4 przyciski w pierwszym rzedzie (span 3), 3 szersze w drugim (span 4).
   Dzieki temu "W trakcie" i "Sprzedano" nie sa ucinane, a rzedy sa zawsze dwa. */
.status-group { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 4px; }
.status-btn { grid-column: span 3; }
.status-btn:nth-child(n+5) { grid-column: span 4; }
.status-btn {
  min-height: 36px; padding: 0 6px; font: inherit; font-size: 12px;
  background: #fff; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  cursor: pointer; color: var(--muted); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.status-btn:hover { background: #f2f4f7; color: var(--text); }
.status-btn.is-active { color: #fff; font-weight: 600; }
.status-btn.is-active[data-status="new"] { background: #4b5563; border-color: #4b5563; }
.status-btn.is-active[data-status="callback"] { background: #1447c4; border-color: #1447c4; }
.status-btn.is-active[data-status="bad"] { background: var(--bad); border-color: var(--bad); }
.status-btn.is-active[data-status="spam"] { background: #5b3a86; border-color: #5b3a86; }
.status-btn.is-active[data-status="good"] { background: var(--ok); border-color: var(--ok); }
.status-btn.is-active[data-status="in_progress"] { background: #b8770c; border-color: #b8770c; }
.status-btn.is-active[data-status="won"] { background: #0a6b34; border-color: #0a6b34; }
.status-btn[disabled] { opacity: .6; cursor: progress; }

/* powod oceny "Zly" */
.reason-box { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.reason-box .field-label { flex: 0 0 auto; }
.reason-select { width: auto; min-width: 150px; min-height: 34px; padding: 4px 8px; font-size: 13px; }
.reason-tag { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); }

.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #eef0f3; color: #4b5563; }
.pill-pending { background: var(--warn-bg); color: var(--warn); }
.pill-sent { background: var(--ok-bg); color: var(--ok); }
.pill-failed { background: var(--bad-bg); color: var(--bad); }
.pill-skipped { background: #eef0f3; color: #4b5563; }

/* ---------- szczegoly leada ---------- */
.details-row td { background: #f8fafd; padding: 0; }
.details-inner { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; padding: 14px; }
.details-block h4 { font-size: 12px; color: var(--muted); margin: 0 0 6px; text-transform: uppercase; letter-spacing: .04em; }
.kv { margin: 0; font-size: 13px; }
.kv div { display: flex; gap: 8px; padding: 2px 0; border-bottom: 1px dotted var(--line); }
.kv dt { color: var(--muted); flex: 0 0 42%; }
.kv dd { margin: 0; word-break: break-word; }
.events-list { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.events-list li { padding: 3px 0; border-bottom: 1px dotted var(--line); }
.events-list .ev-time { color: var(--muted); font-variant-numeric: tabular-nums; margin-right: 6px; }
.audio-player { width: 210px; max-width: 100%; height: 36px; }

/* ---------- pager, stopka ---------- */
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 14px 0; }
.pager-info { font-size: 13px; color: var(--muted); }
.panel-foot { font-size: 12px; text-align: center; }

/* ---------- snippet ---------- */
.snippet-block { margin-bottom: 14px; }
.snippet-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.snippet-title { font-size: 13px; color: var(--muted); font-weight: 650; }
.snippet {
  background: #0f172a; color: #e6edf7; border-radius: var(--radius-sm);
  padding: 12px; overflow-x: auto; font-size: 12.5px; margin: 6px 0 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  white-space: pre-wrap; word-break: break-all;
}

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45);
  display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50;
}
.modal-backdrop[hidden] { display: none; }
.modal { width: 100%; max-width: 460px; margin: 0; max-height: 90vh; overflow-y: auto; }
.modal-title { font-size: 17px; margin-bottom: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* ---------- toast ---------- */
.toast-wrap {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; z-index: 80; pointer-events: none; width: max-content; max-width: 92vw;
}
.toast {
  background: #15181d; color: #fff; padding: 10px 16px; border-radius: 999px;
  font-size: 14px; box-shadow: 0 6px 20px rgba(0, 0, 0, .22); text-align: center;
}
.toast-error { background: var(--bad); }
.toast-ok { background: #0a6b34; }

/* ---------- mobile: tabela leadow jako karty ---------- */
@media (max-width: 719px) {
  .page { padding: 12px; }
  .grid-2 { grid-template-columns: 1fr; }
  /* kafelki 3 w rzedzie, zeby lista leadow zaczynala sie wyzej */
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-bottom: 12px; }
  .stat { padding: 8px 9px; }
  .stat-label { font-size: 11px; }
  .stat-value { font-size: 17px; }
  .period-bar { gap: 4px; margin-bottom: 10px; }
  .seg-btn { padding: 0 11px; }
  .filters { gap: 8px; }
  .filters .field-inline { flex: 1 1 calc(50% - 4px); }
  .filters .field-grow { flex: 1 1 100%; }

  /* karta leada: kompaktowo, cel 4 karty na ekranie 390 px (UI-9) */
  .leads-wrap { background: transparent; box-shadow: none; }
  .leads-table { border: 0; background: transparent; }
  .leads-table thead { display: none; }
  .leads-table, .leads-table tbody { display: block; width: 100%; }
  .leads-table tr.lead-row {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 10px; row-gap: 2px;
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 8px 12px; margin-bottom: 8px; box-shadow: var(--shadow); width: 100%;
  }
  .leads-table tr.lead-row.is-open { border-color: var(--line-strong); }
  .leads-table tr.lead-row.is-missed { border-left: 3px solid var(--bad); }
  .leads-table td { display: block; border-bottom: 0; padding: 0; }
  .leads-table td::before { content: none; }

  .leads-table td.cell-contact { grid-column: 1; grid-row: 1; }
  .leads-table td.cell-date { grid-column: 2; grid-row: 1; text-align: right; }
  .leads-table td.cell-date .time { font-size: 14px; }
  /* godzina i data w jednej linii: karta nizsza o ~16 px */
  .leads-table td.cell-date .date { display: inline; font-size: 11px; margin-left: 4px; }
  .leads-table td.cell-kind { grid-column: 1; grid-row: 2; display: flex; align-items: center; gap: 6px; }
  .leads-table td.cell-kind .kind-label { display: inline; }
  .leads-table td.cell-source {
    grid-column: 2; grid-row: 2; justify-self: end; text-align: right;
    max-width: 100%; min-width: 0; overflow: hidden;
  }
  .leads-table td.cell-status { grid-column: 1 / -1; grid-row: 3; margin-top: 4px; min-width: 0; }
  .leads-table td.cell-value {
    grid-column: 1 / -1; grid-row: 4; margin-top: 4px;
    display: flex; align-items: center; gap: 8px;
  }
  .leads-table td.cell-value::before {
    content: 'Kwota'; color: var(--muted); font-size: 12px; font-weight: 600;
  }
  .leads-table td.cell-actions {
    grid-column: 1 / -1; grid-row: 5; margin-top: 4px;
    display: flex; align-items: center; gap: 8px; text-align: left;
  }
  /* pusta kwota znika z karty; regula po .cell-value, zeby wygrala kolejnoscia */
  .leads-table td.cell-empty { display: none; }
  .cell-actions > * + * { margin-left: 0; }
  .note-preview { max-width: 100%; flex: 1 1 auto; }
  .leads-table td.cell-actions .btn { margin-left: auto; }
  .status-group { gap: 5px; }
  .status-btn { font-size: 12px; padding: 0 4px; }
  .cell-value input { width: 100%; min-height: 38px; }
  .value-editor { flex: 1 1 auto; }
  .campaign { max-width: 100%; }
  .details-row { display: block; }
  .details-row td { padding: 0; background: transparent; }
  .details-inner { grid-template-columns: 1fr; padding: 10px 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin: -6px 0 10px; }
  .row-form .field { flex: 1 1 100%; }
  .audio-player { width: 100%; }
}

@media (max-width: 560px) {
  /* naglowek: logo w pierwszej linii, reszta w drugiej, bez lamania slow */
  .topbar { flex-wrap: wrap; row-gap: 6px; padding: 8px 12px; }
  .topbar-right { width: 100%; justify-content: flex-start; gap: 6px; }
  .client-switch select { max-width: 165px; }
  .topbar .btn { padding: 0 10px; }
  .user-login { display: none; }
  .page-title { font-size: 19px; }
}

/* ---------- admin: karta Zdrowie ---------- */
.health-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px;
}
.health-item { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; background: #fff; }
.health-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.health-value { font-size: 16px; font-weight: 650; margin-top: 2px; word-break: break-word; }
.health-note { font-size: 12px; color: var(--muted); margin-top: 2px; }
.health-item.is-warn { border-color: #f0c98a; background: var(--warn-bg); }
.health-item.is-warn .health-value { color: var(--warn); }
.health-item.is-bad { border-color: #efc5c2; background: var(--bad-bg); }
.health-item.is-bad .health-value { color: var(--bad); }
.health-item.is-ok .health-value { color: var(--ok); }
.health-numbers { list-style: none; margin: 10px 0 0; padding: 0; font-size: 13px; }
.health-numbers li { padding: 4px 0; border-bottom: 1px dotted var(--line); display: flex; gap: 8px; flex-wrap: wrap; }
.health-numbers li:last-child { border-bottom: 0; }
.health-alert { margin: 10px 0 0; font-size: 13px; color: var(--bad); }

/* kropka zdrowia na liscie klientow */
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--line-strong); }
.dot-ok { background: var(--ok); }
.dot-warn { background: #d39100; }
.dot-bad { background: var(--bad); }

/* ---------- admin: mapowanie statusow jako sekcje ---------- */
.preset-bar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 12px; }
.preset-bar .field-label { margin-right: 2px; }
.map-sections { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; }
.map-section { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; }
.map-section h3 { font-size: 14px; margin-bottom: 2px; }
.map-section .map-desc { font-size: 12px; color: var(--muted); margin: 0 0 8px; }
.map-list { display: flex; flex-direction: column; gap: 6px; }
.map-opt { display: flex; align-items: center; gap: 8px; font-size: 13px; min-height: 28px; }
.map-opt input { width: 18px; height: 18px; flex: 0 0 auto; }
.map-opt.is-off { color: var(--muted); }
.map-opt .map-off-tag { font-size: 11px; color: var(--warn); }

/* ---------- admin: sekrety i zablokowane numery ---------- */
.secret-row { display: flex; align-items: center; gap: 8px; }
.secret-set { flex: 1 1 auto; font-size: 13px; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); padding: 9px 10px; min-height: var(--tap); display: flex; align-items: center; }
.blocked-list { list-style: none; margin: 0 0 10px; padding: 0; font-size: 14px; }
.blocked-list li { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px dotted var(--line); }
.blocked-list li:last-child { border-bottom: 0; }
.blocked-phone { font-weight: 600; white-space: nowrap; }
.blocked-meta { font-size: 12px; color: var(--muted); flex: 1 1 auto; }

/* ---------- admin: backfill ---------- */
.checks-inline { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.checks-inline label { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.checks-inline input[type="checkbox"] { width: 18px; height: 18px; }

/* ---------- admin: lista klientow ---------- */
.cell-health { width: 20px; padding-right: 0 !important; }
.data-table tr.is-inactive td { color: var(--muted); background: #fafbfc; }

/* ---------- admin na telefonie (blok na koncu pliku, zeby wygral kolejnoscia) ---------- */
@media (max-width: 719px) {
  .health-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .health-item { padding: 8px 9px; }
  .health-value { font-size: 15px; }
  .health-label { font-size: 11px; }
  .map-sections { grid-template-columns: 1fr; gap: 10px; }
  .preset-bar { gap: 5px; }
  .preset-bar .btn-small { flex: 1 1 calc(50% - 3px); }
  .secret-row { flex-wrap: wrap; }
  /* tabele admina: lepiej przewijac w poziomie niz lamac numer na cztery linie */
  .table-scroll .data-table { min-width: 520px; }
  /* tylko kolumna bledu w kolejce moze sie lamac */
  .table-scroll .data-table td:not(.cell-error),
  .table-scroll .data-table th { white-space: nowrap; }
}

/* ---------- admin: zdarzenia trackera (czat, SPEC v1.2) ---------- */
#events-table td { vertical-align: top; }
#events-table td.cell-error { white-space: normal; word-break: break-word; max-width: 420px; }
