:root {
  --bg: #f5f6f4; --panel: #ffffff; --ink: #17201c; --muted: #66706b; --line: #e3e6e2;
  --side: #0f1a16; --side-ink: #c9d4cf; --side-active: #1d2d27;
  --accent: #0f7a5c; --accent-ink: #fff; --accent-soft: #e3f2ec;
  --warn: #b25e09; --warn-soft: #fbefe1; --bad: #b3261e; --bad-soft: #fbe7e5; --info: #2457a6; --info-soft: #e6eefb;
  --radius: 10px; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 14px; color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }

.layout { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: #fff; font-weight: 700; letter-spacing: .2px; font-size: 16px; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; font-size: 14px; }
.nav { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 9px 12px; border-radius: 8px; color: var(--side-ink); cursor: pointer; }
.nav:hover { background: var(--side-active); color: #fff; }
.nav.active { background: var(--side-active); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
.side-foot { margin-top: auto; padding: 10px; font-size: 12px; border-top: 1px solid #22332c; }
.side-foot .who { color: #fff; font-weight: 600; }
.side-foot button { margin-top: 8px; background: none; border: 1px solid #2a3d35; color: var(--side-ink); border-radius: 6px; padding: 5px 10px; cursor: pointer; }

.main { padding: 24px 28px 60px; min-width: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 21px; margin: 0; }
.sub { color: var(--muted); font-size: 13px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card h3 { margin: 0 0 12px; font-size: 14px; }
.grid { display: grid; gap: 14px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-bottom: 14px; }
.kpi .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
.kpi .value { font-size: 26px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .hint { color: var(--muted); font-size: 12px; margin-top: 2px; }
.two { grid-template-columns: 2fr 1fr; }
@media (max-width: 1100px) { .two { grid-template-columns: 1fr; } }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar .grow { flex: 1; }
input, select, textarea { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 8px 10px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { width: 100%; min-height: 140px; font-family: var(--mono); font-size: 12px; }
label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
label.f input, label.f select { width: 100%; }
.row { display: flex; gap: 10px; } .row > * { flex: 1; }

.btn { border: 1px solid var(--line); background: #fff; padding: 8px 14px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #c8cdc8; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 600; background: #fafbfa; position: sticky; top: 0; }
tr:hover td { background: #fafcfb; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.masked { font-family: var(--mono); letter-spacing: .5px; color: #3c4641; }

.pill { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 600; background: #eef0ee; color: #4b5550; }
.pill.new { background: var(--info-soft); color: var(--info); }
.pill.in_progress { background: #eef0ee; }
.pill.callback { background: var(--warn-soft); color: var(--warn); }
.pill.done, .pill.completed, .pill.converted { background: var(--accent-soft); color: var(--accent); }
.pill.dnc, .pill.failed, .pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.live { background: #e7f6ee; color: #11804f; }
.pill.live::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #11a35f; margin-right: 6px; vertical-align: 1px; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.tag { display: inline-block; font-size: 11px; padding: 1px 6px; border: 1px solid var(--line); border-radius: 5px; margin-right: 3px; color: var(--muted); }

.bars .bar { display: grid; grid-template-columns: 130px 1fr 44px; gap: 8px; align-items: center; margin: 6px 0; font-size: 12.5px; }
.bars .track { background: #eef0ee; border-radius: 4px; height: 10px; overflow: hidden; }
.bars .fill { background: var(--accent); height: 100%; border-radius: 4px; }
.hours { display: flex; align-items: flex-end; gap: 3px; height: 110px; padding-top: 6px; }
.hours div { flex: 1; background: var(--accent); opacity: .85; border-radius: 3px 3px 0 0; min-height: 2px; position: relative; }
.hours-axis { display: flex; gap: 3px; font-size: 10px; color: var(--muted); } .hours-axis span { flex: 1; text-align: center; }

.empty { color: var(--muted); text-align: center; padding: 28px; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 10px; color: var(--muted); font-size: 12px; }

.modal-bg { position: fixed; inset: 0; background: rgba(10, 20, 16, .42); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: #fff; border-radius: 14px; width: min(560px, 100%); max-height: 90vh; overflow: auto; padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal h2 { margin: 0 0 14px; font-size: 17px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.toast { position: fixed; bottom: 20px; right: 20px; background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 10px; z-index: 99; max-width: 420px; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.toast.err { background: var(--bad); }

.login { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(1200px 600px at 20% 0%, #dcefe7, transparent), var(--bg); }
.login .card { width: 360px; padding: 28px; }
.login h1 { font-size: 20px; margin: 10px 0 4px; }
.err-text { color: var(--bad); font-size: 13px; margin: 6px 0; min-height: 18px; }
.notice { background: var(--warn-soft); color: var(--warn); border-radius: 8px; padding: 10px 12px; font-size: 13px; margin-bottom: 12px; }
.secure-note { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 12px; margin-top: 6px; }
.outcome-row { display: grid; grid-template-columns: 1fr 1.4fr auto auto auto auto; gap: 8px; align-items: center; margin-bottom: 6px; }
.outcome-row label { font-size: 12px; color: var(--muted); display: flex; gap: 4px; align-items: center; }

@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; }
  .side-foot { display: none; }
  .main { padding: 16px; }
}
