:root {
  --ink: #12343b;        /* sidebar */
  --ink-2: #1c4750;
  --paper: #f4f6f5;      /* page */
  --surface: #ffffff;
  --line: #dde3e1;
  --text: #1e2a2f;
  --muted: #637277;
  --call: #1f8a5b;       /* the call button — the one loud colour */
  --call-dark: #176b46;
  --amber: #b86e0b;
  --amber-bg: #fdf3e3;
  --red: #b23a3a;
  --red-bg: #fbecec;
  --blue: #2c5f8a;
  --blue-bg: #e9f1f8;
  --green-bg: #e6f4ed;
  --radius: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.5 var(--font); color: var(--text); background: var(--paper); font-variant-numeric: tabular-nums; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; line-height: 1.25; margin: 0; font-weight: 650; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; font-weight: 650; }
h3 { font-size: .95rem; margin: 0 0 .5rem; font-weight: 650; }
p { margin: 0 0 .75rem; }
small, .muted { color: var(--muted); }
:focus-visible { outline: 3px solid #7db7e8; outline-offset: 2px; }

/* ---------- shell */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: var(--ink); color: #d6e4e6; padding: 1.25rem .75rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { color: #fff; font-weight: 700; font-size: 1.1rem; padding: 0 .6rem 1.25rem; display: block; }
.brand:hover { text-decoration: none; }
.nav a { display: flex; justify-content: space-between; color: #d6e4e6; padding: .5rem .6rem; border-radius: 6px; margin-bottom: 2px; }
.nav a:hover { background: var(--ink-2); text-decoration: none; }
.nav a.on { background: #fff; color: var(--ink); font-weight: 600; }
.nav .group { margin-top: 1.1rem; padding: .25rem .6rem; font-size: .8rem; color: #8fb0b5; }
.nav .count { background: var(--amber); color: #fff; border-radius: 10px; font-size: .75rem; padding: 0 .45rem; font-weight: 600; }
.side .who { margin-top: 1.5rem; padding: .75rem .6rem; border-top: 1px solid var(--ink-2); font-size: .85rem; }
.side .who strong { color: #fff; display: block; }
.side .who button { background: none; border: 0; color: #8fb0b5; padding: 0; cursor: pointer; font: inherit; }
.side .who button:hover { color: #fff; }
.main { padding: 1.5rem 2rem 3rem; min-width: 0; }
.btn.menu-btn { display: none; }

.head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.head .actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ---------- blocks */
.box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.25rem; margin-bottom: 1.25rem; }
.box.flush { padding: 0; overflow-x: auto; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.25rem; }
.lead-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 1.25rem; align-items: start; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; margin-bottom: 1.25rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; }
.stat b { display: block; font-size: 1.6rem; line-height: 1.2; font-weight: 650; }
.stat span { color: var(--muted); font-size: .85rem; }
.stat.warn { border-left: 4px solid var(--amber); }
.stat a { color: inherit; }

/* ---------- tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .55rem .75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .8rem; font-weight: 600; color: var(--muted); background: #fafbfb; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; }
tr.overdue td:first-child { box-shadow: inset 4px 0 0 var(--amber); }
.nowrap { white-space: nowrap; }
.empty { padding: 2rem; text-align: center; color: var(--muted); }

/* ---------- badges */
.badge { display: inline-block; padding: .05rem .5rem; border-radius: 10px; font-size: .8rem; font-weight: 600; background: #eef1f0; color: var(--muted); white-space: nowrap; }
.b-new { background: var(--blue-bg); color: var(--blue); }
.b-interested, .b-converted, .b-answered { background: var(--green-bg); color: var(--call-dark); }
.b-follow_up, .b-contacted { background: var(--amber-bg); color: var(--amber); }
.b-missed, .b-failed, .b-not_interested, .b-invalid, .b-not_reachable { background: var(--red-bg); color: var(--red); }
.late { color: var(--amber); font-weight: 600; }

/* ---------- forms */
label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .25rem; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=date], input[type=datetime-local], input[type=number], input[type=file], select, textarea {
  width: 100%; padding: .5rem .6rem; border: 1px solid #c9d2cf; border-radius: 6px; font: inherit; background: #fff; color: var(--text);
}
textarea { min-height: 80px; resize: vertical; }
.field { margin-bottom: .9rem; }
.field .hint { font-size: .8rem; color: var(--muted); margin-top: .2rem; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .75rem; }
.check { display: flex; gap: .5rem; align-items: center; font-weight: 400; }
.check input { width: auto; }

.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: end; margin-bottom: 1rem; }
.filters > * { flex: 0 1 auto; }
.filters input[type=text] { min-width: 220px; }
.filters select, .filters input { width: auto; }

.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .5rem .9rem; border-radius: 6px; border: 1px solid #c9d2cf; background: #fff; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: #f1f4f3; text-decoration: none; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: var(--ink-2); }
.btn.danger { color: var(--red); border-color: #e3bcbc; }
.btn.small { padding: .25rem .55rem; font-size: .85rem; }
.btn[disabled] { opacity: .55; cursor: wait; }

/* ---------- the call panel: the one loud element */
.call-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 1.25rem; }
.call-panel .who-line { padding: 1.1rem 1.25rem .9rem; }
.call-panel .who-line h1 { font-size: 1.35rem; }
.call-panel .phone { font-size: 1.05rem; color: var(--muted); letter-spacing: .02em; }
.call-btn { display: flex; width: 100%; align-items: center; justify-content: center; gap: .6rem; border: 0; background: var(--call); color: #fff; font: inherit; font-size: 1.2rem; font-weight: 700; padding: 1rem; cursor: pointer; }
.call-btn:hover { background: var(--call-dark); }
.call-btn svg { width: 22px; height: 22px; }
.call-btn[disabled] { background: #6aa98a; cursor: wait; }
.call-alt { display: block; text-align: center; padding: .5rem; font-size: .85rem; background: #f7faf8; border-top: 1px solid var(--line); }
.call-alt button { background: none; border: 0; color: var(--call-dark); font: inherit; font-weight: 600; cursor: pointer; }
.call-status { display: none; padding: .7rem 1.25rem; font-weight: 600; border-top: 1px solid var(--line); }
.call-status.show { display: block; }
.call-status.ringing { background: var(--green-bg); color: var(--call-dark); }
.call-status.ringing::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--call); margin-right: .5rem; animation: pulse 1.2s ease-in-out infinite; vertical-align: middle; }
.call-status.error { background: var(--red-bg); color: var(--red); }
.call-status.done { background: var(--blue-bg); color: var(--blue); }
@keyframes pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .call-status.ringing::before { animation: none; } }

.facts { display: grid; grid-template-columns: auto 1fr; gap: .3rem 1rem; margin: 0; padding: 0 1.25rem 1.1rem; font-size: .9rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }

/* outcome chips */
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .9rem; }
.chips input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chips label { margin: 0; font-weight: 500; padding: .35rem .75rem; border: 1px solid #c9d2cf; border-radius: 18px; cursor: pointer; background: #fff; font-size: .9rem; }
.chips input:checked + label { background: var(--ink); border-color: var(--ink); color: #fff; }
.chips input:focus-visible + label { outline: 3px solid #7db7e8; outline-offset: 2px; }
.quick { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: .35rem; }

/* timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: .6rem 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.timeline li:last-child { border-bottom: 0; }
.timeline .meta { color: var(--muted); font-size: .8rem; }
audio { height: 32px; max-width: 100%; vertical-align: middle; }

/* flash */
.flash { padding: .7rem 1rem; border-radius: 6px; margin-bottom: 1rem; font-weight: 500; }
.flash.ok { background: var(--green-bg); color: var(--call-dark); }
.flash.error { background: var(--red-bg); color: var(--red); }

.pager { display: flex; gap: .5rem; align-items: center; justify-content: flex-end; padding: .75rem 1rem; }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; flex-wrap: wrap; }
.tabs a { padding: .55rem .9rem; color: var(--muted); border-bottom: 3px solid transparent; font-weight: 600; }
.tabs a.on { color: var(--text); border-color: var(--ink); }
.tabs a:hover { text-decoration: none; color: var(--text); }
.bulkbar { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; padding: .75rem 1rem; border-bottom: 1px solid var(--line); background: #fafbfb; }
.bulkbar select { width: auto; }
pre.code { background: #f1f4f3; border: 1px solid var(--line); border-radius: 6px; padding: .75rem; overflow-x: auto; font-size: .82rem; white-space: pre-wrap; word-break: break-all; }
.copy-row { display: flex; gap: .5rem; }
.copy-row input { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; }
ol.steps { padding-left: 1.2rem; margin: 0; }
ol.steps li { margin-bottom: .6rem; }
.bar { height: 8px; background: #e7ecea; border-radius: 4px; overflow: hidden; min-width: 60px; }
.bar i { display: block; height: 100%; background: var(--ink); }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: var(--ink); }
.login form { background: #fff; padding: 2rem; border-radius: 10px; width: 100%; max-width: 360px; }
.login h1 { margin-bottom: .25rem; }
.login p { color: var(--muted); margin-bottom: 1.25rem; }
.login .btn { width: 100%; justify-content: center; padding: .7rem; }

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 240px; z-index: 20; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; }
  .btn.menu-btn { display: inline-flex; margin-bottom: 1rem; }
  .main { padding: 1rem 16px 3rem; }
  .grid2, .lead-grid { grid-template-columns: 1fr; }
  .filters input[type=text] { min-width: 0; width: 100%; }
}
