:root {
  --paper: #f2f4f8; --panel: #fff; --ink: #172033; --muted: #5b677a; --line: #dde3ec; --soft: #eef1f6;
  --brand: #2b3a8c; --brand-2: #232f73; --brand-soft: #e6e9f8;
  --live: #0f8a5f; --live-soft: #dff3ea; --warn: #b36b00; --warn-soft: #fbeed6; --bad: #b83232; --bad-soft: #fae3e3;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Consolas, monospace;
  --r: 10px; --rail: 208px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.45 var(--sans); }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
h2 { font-size: 17px; font-weight: 600; letter-spacing: -.005em; }
h3 { font-size: 15px; font-weight: 600; }
.muted { color: var(--muted); } .small { font-size: 13px; } .err { color: var(--bad); }
.ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.row { display: flex; align-items: center; gap: 10px; } .between { justify-content: space-between; } .grow { flex: 1; min-width: 0; }
.wrap { flex-wrap: wrap; } .stack { display: flex; flex-direction: column; gap: 12px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- buttons & fields ---------- */
.btn { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 9px 14px; cursor: pointer; font-weight: 500; min-height: 40px; }
.btn:hover { background: var(--soft); } .btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; } .btn.primary:hover { background: var(--brand-2); }
.btn.live { background: var(--live); border-color: var(--live); color: #fff; } .btn.live:hover { filter: brightness(.94); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.quiet { border-color: transparent; background: transparent; color: var(--muted); } .btn.quiet:hover { background: var(--soft); color: var(--ink); }
.btn.sm { padding: 5px 11px; min-height: 32px; font-size: 14px; } .btn.big { width: 100%; padding: 13px; font-size: 16px; min-height: 48px; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; background: #fff; min-height: 40px; }
textarea { min-height: 84px; resize: vertical; }
input[type=checkbox] { width: 18px; height: 18px; min-height: 0; accent-color: var(--brand); }
label { font-weight: 500; font-size: 14px; display: block; margin-bottom: 4px; }
.field { margin-bottom: 14px; } .help { font-size: 13px; color: var(--muted); margin-top: 4px; }

/* ---------- shell ---------- */
.rail { position: fixed; inset: 0 auto 0 0; width: var(--rail); background: var(--brand); color: #dfe3f7; padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; z-index: 5; }
.rail .brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 600; font-size: 16px; padding: 4px 10px 18px; }
.rail .brand svg { width: 28px; height: 28px; }
.rail button { position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 0; background: transparent; color: inherit; border-radius: 8px; cursor: pointer; text-align: left; font-weight: 500; }
.rail button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.rail button:hover { background: rgba(255,255,255,.1); } .rail button.on { background: #fff; color: var(--brand); }
.rail b { margin-left: auto; background: var(--warn); color: #fff; border-radius: 9px; font-size: 12px; padding: 0 7px; line-height: 18px; }
.rail-foot { margin-top: auto; padding: 0 6px; }
.stage { margin-left: var(--rail); min-height: 100vh; }
.bar { display: flex; align-items: center; justify-content: space-between; padding: 18px 28px 6px; }
.bar-right { display: flex; align-items: center; gap: 12px; } #phonePill2 { display: none; }
main { padding: 12px 28px 40px; max-width: 1280px; }
.pill { display: inline-block; font-size: 13px; font-weight: 500; padding: 3px 11px; border-radius: 99px; background: rgba(255,255,255,.14); color: #fff; }
.pill.on { background: var(--live); } .pill.warn { background: var(--warn); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.card.alert { border-color: #e6c27a; background: #fff9ec; }
.card.ring { border-color: var(--brand); background: var(--brand-soft); }
.empty { text-align: center; color: var(--muted); padding: 36px 16px; }
.badge { display: inline-block; font-size: 12.5px; font-weight: 500; padding: 2px 9px; border-radius: 99px; color: var(--c); background: color-mix(in srgb, var(--c) 13%, #fff); white-space: nowrap; }

/* ---------- dialer ---------- */
.dialer-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 420px); gap: 20px; align-items: start; }
.col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
#dlLive:empty, #dlAuto:empty { display: none; }
#dlLive, #dlAuto { display: flex; flex-direction: column; gap: 14px; }
.count-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.count { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 11px 13px; }
.count b { display: block; font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; } .count span { font-size: 13px; color: var(--muted); }

.livebar { border: 1px solid #b7e0cf; background: var(--live-soft); border-radius: var(--r); padding: 14px 16px; }
.livebar.dialing { border-color: var(--line); background: var(--panel); }
.livebar .who { font-size: 18px; font-weight: 600; }
.pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 0 rgba(15,138,95,.5); animation: pulse 1.6s infinite; flex: none; }
.dialing .pulse { background: var(--warn); animation-name: pulse-w; }
@keyframes pulse { 70% { box-shadow: 0 0 0 9px rgba(15,138,95,0); } 100% { box-shadow: 0 0 0 0 rgba(15,138,95,0); } }
@keyframes pulse-w { 0% { box-shadow: 0 0 0 0 rgba(179,107,0,.45); } 70% { box-shadow: 0 0 0 9px rgba(179,107,0,0); } 100% { box-shadow: 0 0 0 0 rgba(179,107,0,0); } }
.timer { font-family: var(--mono); font-size: 26px; font-weight: 500; font-variant-numeric: tabular-nums; }

.dialpad input { font-family: var(--mono); font-size: 22px; text-align: center; letter-spacing: .04em; min-height: 52px; }
.keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; max-width: 300px; margin: 0 auto; width: 100%; }
.key { border: 1px solid var(--line); background: #fff; border-radius: 10px; min-height: 48px; font: 500 20px var(--mono); cursor: pointer; }
.key:hover { background: var(--soft); } .key:active { background: var(--brand-soft); }

.item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.item + .item { margin-top: 6px; } .item:hover { border-color: #b9c3d6; }
.item .sub { font-size: 13px; color: var(--muted); }

/* lead file: the person on the line */
.file { position: sticky; top: 14px; padding: 0; overflow: hidden; }
.file-head { padding: 16px 18px 14px; border-bottom: 1px solid var(--line); }
.file-head .tag { font-size: 13px; font-weight: 500; color: var(--live); display: flex; align-items: center; gap: 7px; margin-bottom: 8px; }
.file-head .tag.next { color: var(--muted); }
.file-head .nm { font-size: 20px; font-weight: 600; line-height: 1.2; }
.file-head .num { font: 500 24px/1.2 var(--mono); letter-spacing: -.01em; margin-top: 6px; word-break: break-all; }
.file-body { padding: 14px 18px 18px; display: flex; flex-direction: column; gap: 16px; max-height: calc(100vh - 150px); overflow: auto; }
.sec h3 { margin-bottom: 8px; }
.kv { display: grid; grid-template-columns: minmax(90px, 36%) 1fr; gap: 6px 12px; font-size: 14px; margin: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; word-break: break-word; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 5px 12px; font-size: 14px; cursor: pointer; font-weight: 500; }
.chip:hover { background: var(--soft); } .chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip.good:hover { background: var(--live-soft); } .chip.bad:hover { background: var(--bad-soft); }
.hint { font-size: 13px; padding: 7px 10px; border-radius: 8px; }
.hint.ok { background: var(--live-soft); color: #0b6445; } .hint.late { background: var(--warn-soft); color: #7a4800; }
.hist { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; padding: 5px 0; border-top: 1px solid var(--soft); }

/* ---------- tables (leads, redial) ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; align-items: center; }
.toolbar input[type=search] { max-width: 300px; } .toolbar select { width: auto; max-width: 200px; }
.table { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.tr { display: grid; grid-template-columns: 34px minmax(160px, 1.4fr) minmax(130px, 1fr) 130px 70px 150px 72px; gap: 10px; align-items: center; padding: 9px 14px; border-top: 1px solid var(--soft); }
.tr.head { background: var(--soft); border-top: 0; font-size: 13px; font-weight: 600; color: var(--muted); padding-top: 8px; padding-bottom: 8px; }
.tr:not(.head):hover { background: #f8f9fc; cursor: pointer; }
.tr.redial { grid-template-columns: 34px minmax(150px, 1.1fr) 150px 62px minmax(200px, 2fr) 72px; }
.c-phone { white-space: nowrap; }
.bulk { position: sticky; bottom: 12px; margin-top: 12px; background: var(--ink); color: #fff; border-radius: 12px; padding: 10px 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; box-shadow: 0 8px 24px rgba(23,32,51,.3); }
.bulk select { width: auto; background: #fff; color: var(--ink); min-height: 34px; padding: 4px 8px; } .bulk .btn { min-height: 34px; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.seg .chip b { font-weight: 600; margin-left: 5px; opacity: .75; }
.dates { display: flex; gap: 5px; flex-wrap: wrap; }
.dpill { font-size: 12.5px; padding: 1px 8px; border-radius: 6px; background: var(--soft); color: var(--muted); white-space: nowrap; }

/* ---------- sheet (drawer on desktop, bottom sheet on phones) ---------- */
dialog { border: 0; padding: 0; background: transparent; max-width: none; max-height: none; width: 100%; height: 100%; margin: 0; overflow: hidden; }
dialog::backdrop { background: rgba(23,32,51,.45); }
.sheet { position: absolute; top: 0; right: 0; bottom: 0; width: min(480px, 100%); background: var(--panel); padding: 20px; overflow: auto; display: flex; flex-direction: column; gap: 14px; box-shadow: -12px 0 40px rgba(23,32,51,.2); }
.sheet.wide { width: min(640px, 100%); }
dialog[open] .sheet { animation: slide .2s ease-out; } @keyframes slide { from { transform: translateX(24px); opacity: 0; } }

/* ---------- settings ---------- */
.set-grid { display: grid; gap: 16px; max-width: 720px; }
.set-grid .card h2 { margin-bottom: 12px; }
.toggle { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; } .toggle input { margin-top: 3px; } .toggle label { margin: 0; }
pre.diag { background: var(--ink); color: #dfe6f3; padding: 12px; border-radius: 8px; font: 12.5px/1.5 var(--mono); white-space: pre-wrap; overflow: auto; margin-top: 10px; }
.map-table { width: 100%; border-collapse: collapse; font-size: 13px; } .map-table th, .map-table td { padding: 5px 8px; border: 1px solid var(--line); text-align: left; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-table th { background: var(--soft); }
.scroll-x { overflow: auto; }

/* ---------- login & toast ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 28px; }
.logo { width: 40px; height: 40px; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 10px; z-index: 50; max-width: 90vw; }

/* ---------- phones ---------- */
@media (max-width: 900px) {
  .rail { inset: auto 0 0 0; width: auto; flex-direction: row; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); gap: 0; justify-content: space-around; }
  .rail .brand, .rail-foot { display: none; }
  .rail button { flex-direction: column; gap: 2px; padding: 6px 4px; font-size: 11.5px; flex: 1; align-items: center; text-align: center; }
  .rail button.on { background: rgba(255,255,255,.18); color: #fff; } .rail b { position: absolute; top: 1px; right: 22%; margin: 0; }
  .stage { margin-left: 0; padding-bottom: 76px; }
  .bar { padding: 14px 16px 4px; } #phonePill2 { display: inline-block; background: var(--muted); } #phonePill2.on { background: var(--live); } #phonePill2.warn { background: var(--warn); }
  main { padding: 10px 16px 24px; }
  .dialer-grid { display: flex; flex-direction: column; gap: 14px; }
  .col { display: contents; }
  #dlLive { order: 1; } #dlAuto { order: 3; } .dialpad { order: 4; } #dlNext { order: 5; } #dlFile { order: 6; }
  .dialer-grid.live #dlFile { order: 2; }
  .dialer-grid > .col > * { min-width: 0; }
  #dlLive, #dlAuto { display: flex; flex-direction: column; gap: 14px; }
  .file { position: static; } .file-body { max-height: none; }
  .toolbar input[type=search] { max-width: none; flex: 1 1 100%; }
  .tr.redial { grid-template-columns: 30px 1fr auto; }
  .tr.redial > .c-dates { grid-area: auto; }
  .count-row { grid-template-columns: repeat(2, 1fr); }
  .tr { grid-template-columns: 30px 1fr auto; grid-template-areas: "c n b" "c p a"; row-gap: 2px; }
  .tr.head { display: none; }
  .tr > .c-name { grid-area: n; } .tr > .c-phone { grid-area: p; } .tr > .c-status { grid-area: b; } .tr > .c-chk { grid-area: c; }
  .tr > .c-hide { display: none; } .tr > .c-act { grid-area: a; justify-self: end; }
  .tr.redial > .c-dates { grid-column: 2 / -1; }
  .sheet { top: auto; left: 0; width: 100%; max-height: 92%; border-radius: 16px 16px 0 0; }
  dialog[open] .sheet { animation: rise .2s ease-out; } @keyframes rise { from { transform: translateY(24px); opacity: 0; } }
  .toast { bottom: 90px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.cn-name{font-size:17px;font-weight:600;margin-bottom:4px}
