/* Dialer (js/ui/screens/dialer.js): counters on top, then queue | lead | script, filling the screen.
   Motion: callers switch leads and piles hundreds of times a day, so those change instantly. Only presses (scale .97)
   and the after-call outcome strip (a short slide-in, a few times an hour) move. Hover effects only with a mouse. */
.dl-view { --dl-ease: cubic-bezier(0.23, 1, 0.32, 1); --dl-line: var(--hairline); display: flex; flex-direction: column; gap: .75rem; }

/* ---------- counters + progress: one slim strip, not a row of boxes ---------- */
.dl-topbar { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.dl-stats { display: flex; gap: .2rem; padding: .25rem; border-radius: 999px; background: rgba(255, 255, 255, .55); box-shadow: inset 0 0 0 1px var(--dl-line); }
.dl-stat { display: inline-flex; align-items: center; gap: .5rem; padding: .4rem .9rem; border: 0; border-radius: 999px; background: none;
  font: inherit; color: var(--secondary); cursor: pointer; transition: transform 140ms var(--dl-ease), background-color 150ms ease; }
.dl-stat:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) { .dl-stat:hover { background: rgba(255, 255, 255, .8); } }
.dl-stat:focus-visible { outline: 3px solid rgba(66, 85, 154, .3); outline-offset: 2px; }
.dl-stat-n { order: 2; font-family: var(--font-head); font-size: 1rem; font-weight: 700; line-height: 1; color: var(--on-surface); font-variant-numeric: tabular-nums; }
.dl-stat-label { display: inline-flex; align-items: center; gap: .4rem; font-size: .84rem; font-weight: 600; white-space: nowrap; }
.dl-stat-dot { width: .45rem; height: .45rem; border-radius: 50%; background: var(--outline-variant); }
.dl-stat-todo .dl-stat-dot { background: var(--primary); }
.dl-stat-retry .dl-stat-dot { background: var(--amber); }
.dl-stat-leads .dl-stat-dot { background: #10b981; }
.dl-stat-done .dl-stat-dot { background: #94a3b8; }
.dl-stat-due .dl-stat-dot { background: #7c3aed; }
.dl-stat-due.dl-stat-alert .dl-stat-n { color: var(--error); }
.dl-stat[aria-selected="true"] { background: var(--surface-lowest); box-shadow: 0 1px 3px rgba(15, 23, 42, .1); }
.dl-stat[aria-selected="true"] .dl-stat-label { color: var(--primary-dark); }
.dl-progress { flex: 0 1 15rem; margin-left: auto; display: flex; flex-direction: column; justify-content: center; gap: .35rem; padding: 0 .25rem; }
.dl-progress-top { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; }
.dl-progress-label { font-size: .8rem; font-weight: 600; color: var(--secondary); }
.dl-progress-text { font-weight: 700; font-variant-numeric: tabular-nums; }
.dl-progress-bar { height: .4rem; border-radius: 999px; background: var(--surface-container); overflow: hidden; }
.dl-progress-fill { display: block; height: 100%; background: var(--primary); border-radius: inherit; transform-origin: left; transform: scaleX(0); transition: transform 300ms var(--dl-ease); }
.dl-list-filter { flex: 0 1 14rem; align-self: center; }

/* ---------- the panels, filling the screen down to its bottom edge ----------
   --dl-top: where the grid starts on the page (measured in dialer.js), so the panels end just above the bottom.
   data-panels: which panels show (q leads, c lead, s script); the ones shown share the width. */
.dl-grid { display: grid; grid-template-columns: minmax(15rem, 19rem) minmax(0, 1.25fr) minmax(20rem, 1fr); gap: .75rem;
  height: calc(100dvh - var(--dl-top, 15rem) - 1rem); min-height: 30rem; }
.dl-grid[data-panels="cs"] { grid-template-columns: minmax(0, 1.25fr) minmax(20rem, 1fr); }
.dl-grid[data-panels="qc"], .dl-grid[data-panels="qs"] { grid-template-columns: minmax(15rem, 19rem) minmax(0, 1fr); }
.dl-grid[data-panels="q"], .dl-grid[data-panels="c"], .dl-grid[data-panels="s"] { grid-template-columns: minmax(0, 1fr); }
.view:has(> .dl-view:not([hidden])) { padding-bottom: 1rem; }
.dl-grid > * { min-height: 0; }
.dl-grid > .dl-off { display: none !important; }
@media (max-width: 1280px) {
  .dl-grid[data-panels="qcs"] { grid-template-columns: minmax(14rem, 18rem) minmax(0, 1fr); grid-template-rows: auto auto; height: auto; }
  .dl-grid[data-panels="qcs"] .dl-queue { grid-row: span 2; max-height: 48rem; }
  .dl-grid[data-panels="qcs"] .dl-script { grid-column: 2; max-height: 40rem; }
}
@media (max-width: 900px) { .dl-grid, .dl-grid[data-panels] { grid-template-columns: 1fr; height: auto; } .dl-grid .dl-queue { grid-row: auto; max-height: 24rem; } .dl-grid .dl-script { grid-column: auto; min-height: 60vh; } }

/* Softer panels: a light translucent surface and a hairline, no heavy drop shadow. */
.dl-queue, .dl-lead, .dl-script { border: 1px solid var(--dl-line); border-radius: 1.25rem; background: rgba(255, 255, 255, .72); box-shadow: 0 1px 2px rgba(15, 23, 42, .04); }

/* Panel switches (page header): pressed = shown. */
/* Panel switches (page header): a solid white bar so it stands out from the page; shown panels are filled teal. */
.dl-panels { display: inline-flex; align-items: center; gap: .25rem; padding: .3rem; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface-lowest); box-shadow: 0 1px 3px rgba(15, 23, 42, .08); }
.dl-panels[hidden] { display: none; }
.dl-panels-label { padding: 0 .35rem 0 .6rem; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--secondary); }
.dl-panel-btn { display: inline-flex; align-items: center; gap: .45rem; padding: .45rem .95rem; border: 0; border-radius: 999px; background: none; font: inherit; font-size: .9rem; font-weight: 600; color: var(--on-surface-variant); cursor: pointer; transition: transform 140ms var(--dl-ease); }
.dl-panel-btn:active:not(:disabled) { transform: scale(0.97); }
.dl-panel-btn[aria-pressed="true"] { background: var(--primary); color: #fff; }
.dl-panel-btn:disabled { cursor: default; }
.dl-panel-btn:focus-visible { outline: 3px solid rgba(66, 85, 154, .3); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) { .dl-panel-btn:hover:not([aria-pressed="true"]) { background: var(--surface-low); color: var(--on-surface); } }
.dl-panel-tick { width: .5rem; height: .5rem; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--outline-variant); }
.dl-panel-btn[aria-pressed="true"] .dl-panel-tick { background: #fff; box-shadow: none; }

/* ---------- queue ---------- */
.dl-queue { display: flex; flex-direction: column; padding: 0; margin: 0; overflow: hidden; }
.dl-queue-head { padding: .75rem; border-bottom: 1px solid var(--dl-line); }
.dl-search { width: 100%; }
.dl-queue-list { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.dl-rows { list-style: none; margin: 0; padding: .35rem; }
.dl-row { display: flex; align-items: center; gap: .65rem; width: 100%; padding: .55rem .6rem; border: 0; border-radius: .6rem; background: none; font: inherit; text-align: left; color: var(--text); cursor: pointer; }
@media (hover: hover) and (pointer: fine) { .dl-row:hover { background: var(--surface-low); } }
.dl-row:focus-visible { outline: 3px solid rgba(66, 85, 154, .3); outline-offset: -3px; }
.dl-row-num { flex: none; width: 1.6rem; height: 1.6rem; display: grid; place-items: center; border-radius: 50%; background: var(--surface-container); color: var(--secondary); font-size: .72rem; font-weight: 700; font-variant-numeric: tabular-nums; }
/* No numbers: the current lead is marked by its tint and a bar on the left edge (green while on a call with it). */
.dl-row { padding-left: .85rem; }
.dl-row.current { background: var(--primary-soft); box-shadow: inset 3px 0 0 var(--primary); }
.dl-row.live { box-shadow: inset 3px 0 0 #10b981; }
.dl-row-main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.dl-row-main strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-row-sub { font-size: .78rem; color: var(--secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-row-side { display: flex; align-items: center; gap: .3rem; flex: none; }
.dl-row-side .pill { height: 1.3rem; font-size: .66rem; }
.dl-attempts { font-size: .72rem; color: var(--secondary); font-variant-numeric: tabular-nums; }

/* ---------- the lead ---------- */
.dl-center { display: flex; flex-direction: column; gap: .75rem; min-width: 0; }
.dl-lead { flex: 1; display: flex; flex-direction: column; gap: 1.5rem; padding: 1.5rem 1.75rem 1.25rem; margin: 0; overflow-y: auto; }
/* Name of the business and who to ask for on the left, the lead arrows on the right. */
.dl-lead-top { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; }
.dl-lead-top .dl-identity { flex: 1; min-width: 0; display: block; }
.dl-lead-top .dl-lead-nav { flex: none; padding-top: .2rem; }
.dl-list-chip { display: inline-flex; align-items: center; height: 1.6rem; padding: 0 .65rem; border-radius: 999px; background: var(--surface-low); border: 1px solid var(--divider); color: var(--secondary); font-size: .76rem; font-weight: 600; max-width: 60%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-lead-nav { display: flex; align-items: center; gap: .25rem; }
.dl-lead-count { margin-right: .35rem; font-size: .8rem; font-weight: 600; color: var(--secondary); font-variant-numeric: tabular-nums; }
.dl-nav-btn { width: 2rem; height: 2rem; display: grid; place-items: center; border: 1px solid var(--dl-line); border-radius: .55rem; background: var(--surface-lowest); color: var(--on-surface); cursor: pointer; transition: transform 140ms var(--dl-ease); }
.dl-nav-btn:active:not(:disabled) { transform: scale(0.94); }
.dl-nav-btn:disabled { opacity: .4; cursor: default; }
@media (hover: hover) and (pointer: fine) { .dl-nav-btn:hover:not(:disabled) { background: var(--surface-low); } }
.dl-identity { display: flex; align-items: center; gap: 1rem; }
.dl-monogram { flex: none; width: 3.5rem; height: 3.5rem; display: grid; place-items: center; border-radius: 1rem; background: linear-gradient(140deg, var(--primary-soft), #c9ebe5); color: var(--primary-dark); font-family: var(--font-head); font-size: 1.2rem; font-weight: 700; letter-spacing: .02em; }
.dl-identity-text { min-width: 0; }
.dl-identity h2 { margin: 0; font-family: var(--font-head); font-size: 1.6rem; line-height: 1.2; letter-spacing: -.01em; text-wrap: balance; }
.dl-ask { margin: .3rem 0 0; color: var(--secondary); font-size: 1.02rem; }
.dl-ask strong { color: var(--on-surface); font-weight: 600; }
.dl-role { padding: .05rem .45rem; border-radius: .35rem; background: var(--surface-container); color: var(--secondary); font-size: .74rem; font-weight: 600; }
.dl-facts { display: flex; flex-wrap: wrap; gap: .4rem; }
.dl-fact { display: inline-flex; align-items: center; gap: .4rem; height: 2rem; padding: 0 .7rem; border: 1px solid var(--dl-line); border-radius: .55rem; background: var(--surface-lowest); color: var(--on-surface-variant); font-size: .86rem; text-decoration: none; max-width: 100%; }
.dl-fact > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-fact .icon { flex: none; color: var(--secondary); }
a.dl-fact .icon:last-child { width: .8rem; height: .8rem; opacity: .6; }
@media (hover: hover) and (pointer: fine) { a.dl-fact:hover { border-color: var(--primary); color: var(--primary-dark); } }
/* Detail cards sized by their content (dialer.js): compact for short values, wide for long text; each row fills the width. */
.dl-details { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; }
.dl-details > div { flex: 1 1 8.5rem; min-width: 0; padding: .75rem .95rem; border-radius: .8rem; background: var(--surface-low); }
.dl-details > .dl-d-mid { flex: 2 1 14rem; }
.dl-details > .dl-d-long { flex: 4 1 22rem; }
.dl-details dd { overflow-wrap: anywhere; }
.dl-details > .dl-d-long dd { font-size: 1rem; font-weight: 500; line-height: 1.65; }
.dl-details dd { margin-top: .3rem !important; }
.dl-details dt { font-size: .7rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--secondary); }
.dl-details dd { margin: .15rem 0 0; font-size: 1.05rem; font-weight: 700; color: var(--on-surface); font-variant-numeric: tabular-nums; }
.dl-action { display: flex; flex-direction: column; gap: 1rem; padding-top: 1.5rem; border-top: 1px solid var(--divider); }
.dl-meta { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.dl-meta-label { font-size: .8rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--on-surface); }
.dl-meta-text { font-size: .9rem; color: var(--secondary); }
/* Status menu on the lead: a full-size control coloured by the outcome, so the state reads at a glance.
   No transition on the colour: it changes when the caller picks, and should simply be the new state. */
.dl-status { flex: 0 1 20rem; min-height: 3rem; min-width: 14rem; padding: .35rem 2.6rem .35rem 1.1rem; border-width: 2px !important; border-radius: .85rem !important; font-size: 1.05rem; font-weight: 700; cursor: pointer; transition: transform 140ms var(--dl-ease); }
.dl-status:active { transform: scale(0.98); }
/* Stronger tints and borders than the pills elsewhere: the status is the one thing to read on this card. */
.dl-status-new, .dl-status-brand { background-color: #dfe4f5; color: #2f3f75; border-color: #8396d4; }
.dl-status-pos { background-color: #d1fae5; color: #065f46; border-color: #34d399; }
.dl-status-warn { background-color: #fef3c7; color: #92400e; border-color: #fbbf24; }
.dl-status-neg { background-color: #fee2e2; color: #991b1b; border-color: #f87171; }
.dl-status-neutral { background-color: #e2e8f0; color: #334155; border-color: #94a3b8; }
.dl-status option { color: var(--text); background: #fff; }
.dl-controls { display: flex; flex-direction: column; gap: .6rem; }
.dl-btns { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.dl-call, .dl-hangup { display: inline-flex; align-items: center; justify-content: center; gap: .6rem; min-height: 3.25rem; padding: 0 1.5rem; border: 0; border-radius: .85rem;
  font: inherit; font-size: 1.05rem; font-weight: 700; color: #fff; cursor: pointer; transition: transform 140ms var(--dl-ease), background-color 150ms ease; }
/* The Call button is the main action but no longer the full width: Follow up later and Book meeting sit beside it. */
.dl-call { flex: 0 1 auto; min-width: 11rem; min-height: 2.85rem; font-size: 1rem; background: var(--primary); box-shadow: 0 1px 0 rgba(255, 255, 255, .15) inset, 0 .35rem .9rem rgba(66, 85, 154, .25); }
.dl-call .icon { width: 1.15rem; height: 1.15rem; }
.dl-call:disabled { background: var(--surface-container); color: var(--secondary); box-shadow: none; cursor: not-allowed; }
.dl-hangup { margin-left: auto; background: var(--error); box-shadow: 0 .35rem .9rem rgba(186, 26, 26, .25); }
.dl-hangup svg { transform: rotate(135deg); }
.dl-call:active:not(:disabled), .dl-hangup:active, .dl-chip:active, .dl-book:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) { .dl-call:hover:not(:disabled) { background: var(--primary-dark); } .dl-hangup:hover { background: #93000a; } }
.dl-book { min-height: 2.85rem; border-radius: .85rem; padding: 0 1.1rem; transition: transform 140ms var(--dl-ease); }
.dl-oncall .dl-book { min-height: 3.25rem; }
/* Follow up later (dialog) and the follow-up already set for this lead. */
.dl-fu-tag { display: inline-flex; align-items: center; gap: .35rem; text-decoration: none; }
.dl-fu-tag .icon { width: .85rem; height: .85rem; }
.dl-fu-quick { display: flex; flex-wrap: wrap; gap: .4rem; }
.dl-fu-label { font-size: .85rem; font-weight: 600; }
.dl-fu-form textarea { min-height: 4.5rem; }
@media (max-width: 640px) { .dl-fu-form { grid-template-columns: 1fr; } }
.dl-why { margin: 0; display: flex; align-items: center; gap: .5rem; font-size: .82rem; color: var(--secondary); }
.dl-live { display: flex; align-items: center; gap: .55rem; font-size: 1rem; }
.dl-live-dot { width: .6rem; height: .6rem; border-radius: 50%; background: var(--amber); }
.dl-live.talking .dl-live-dot { background: #10b981; animation: dl-pulse 1.6s ease-out infinite; }
@keyframes dl-pulse { 0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, .5); } 100% { box-shadow: 0 0 0 .6rem rgba(16, 185, 129, 0); } }
@media (prefers-reduced-motion: reduce) { .dl-live.talking .dl-live-dot { animation: none; } }
.dl-time { color: var(--secondary); font-variant-numeric: tabular-nums; }
.dl-keypad { max-width: 15rem; gap: .35rem; }
.dl-keypad .call-key { min-height: 2.4rem; }
.dl-notes-wrap { display: flex; flex-direction: column; gap: .35rem; }
.dl-notes-head { display: flex; align-items: baseline; justify-content: space-between; }
.dl-notes-head label { font-size: .8rem; font-weight: 600; color: var(--secondary); }
.dl-notes, .dl-tray-notes { width: 100%; resize: vertical; border-radius: .7rem !important; }

/* ---------- empty states ---------- */
.dl-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem; padding: 2.5rem 1.5rem; text-align: center; color: var(--secondary); }
.dl-empty-ico { width: 3rem; height: 3rem; display: grid; place-items: center; margin-bottom: .4rem; border-radius: .9rem; background: var(--surface-low); color: var(--primary); }
.dl-empty-ico .icon { width: 1.35rem; height: 1.35rem; }
.dl-empty h3 { margin: 0; font-size: 1.02rem; color: var(--on-surface); }
.dl-empty p { margin: 0; max-width: 22rem; font-size: .88rem; line-height: 1.5; }
.dl-empty-actions { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: center; margin-top: .8rem; }

/* ---------- after-call outcome strip ---------- */
.dl-tray { display: flex; flex-direction: column; gap: .5rem; }
.dl-tray:empty { display: none; }
.dl-tray-item { display: flex; flex-direction: column; gap: .6rem; padding: .85rem 1rem; border-radius: .9rem; border: 1px solid #c9d2ef; background: #f3f5fb; box-shadow: var(--shadow-pop);
  transition: opacity 200ms var(--dl-ease), transform 200ms var(--dl-ease); }
@starting-style { .dl-tray-item { opacity: 0; transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) { .dl-tray-item { transition: opacity 150ms ease; } @starting-style { .dl-tray-item { transform: none; } } }
.dl-tray-item.quiet { border-color: var(--dl-line); background: var(--surface-lowest); box-shadow: var(--shadow); }
.dl-tray-item.quiet .dl-tray-notes { display: none; }
.dl-tray-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; font-size: .9rem; }
.dl-chips { display: flex; flex-wrap: wrap; gap: .6rem 1.5rem; }
.dl-chip-group { display: flex; flex-direction: column; gap: .35rem; }
.dl-chip-group-label { font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--secondary); }
.dl-chip-row { display: flex; flex-wrap: wrap; gap: .35rem; }
.dl-chip { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .65rem; border: 1px solid var(--border-strong); border-radius: 999px; background: #fff; font: inherit; font-size: .82rem; font-weight: 600; color: var(--text); cursor: pointer; transition: transform 140ms var(--dl-ease); }
@media (hover: hover) and (pointer: fine) { .dl-chip:hover { border-color: var(--primary); } }
.dl-chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- script ---------- */
.dl-script { display: flex; flex-direction: column; gap: .7rem; padding: 1.1rem 1.2rem; margin: 0; overflow: hidden; }
.dl-panel-label { font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--secondary); }
.dl-script-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.dl-script-pick, .dl-script-title { flex: 1 1 10rem; min-width: 0; font-weight: 600; }
.dl-script-tools { display: flex; align-items: center; gap: .35rem; margin-left: auto; }
.dl-script-owner { margin: -.2rem 0 0; }
.dl-script-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; margin: 0 -.4rem; padding: .2rem .4rem .5rem; font-size: 1.04rem; line-height: 1.75; color: var(--on-surface); }
.dl-script-body h3 { margin: 1.1rem 0 .3rem; font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--primary); }
.dl-script-body h3:first-child { margin-top: .2rem; }
.dl-script-body p { margin: 0 0 .75rem; }
.dl-script-body .dl-bullet { position: relative; padding-left: 1.15rem; }
.dl-script-body .dl-bullet::before { content: ""; position: absolute; left: .3rem; top: .72em; width: .35rem; height: .35rem; border-radius: 50%; background: var(--primary); }
.dl-script-body .dl-tip { margin: .3rem 0 .5rem; padding: .55rem .75rem; border-radius: .6rem; background: var(--amber-soft); font-size: .92rem; line-height: 1.5; box-shadow: inset 3px 0 0 var(--amber); }
.dl-gap { height: .4rem; }
.dl-var { padding: 0 .12rem; margin: 0 -.12rem; border-radius: .25rem; background: #fef3c7; color: inherit; font-weight: 600; }
.dl-var.missing { background: var(--surface-container); color: var(--secondary); font-weight: 500; }
.dl-script-edit { width: 100%; flex: 1; min-height: 16rem; resize: none; border-radius: .7rem !important; font: 400 .95rem/1.6 var(--font-body); }
.dl-saved { min-width: 3.5rem; text-align: right; }
.btn-icon-danger { color: var(--error); }
.btn-icon-danger:hover { background: var(--error-container); border-color: #f2a7a0; }
.warn-text { color: #92400e; }

/* Lists & results (Superadmin) */
.dl-lists-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.dl-lists-head p { margin: 0; }
.dl-list-card { display: flex; flex-direction: column; gap: .8rem; }
.dl-list-top { display: flex; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.dl-list-top h2 { margin: 0; font-size: 1.1rem; }
.dl-list-top p { margin: .15rem 0 0; }
.dl-list-stats { display: flex; gap: 1.1rem; margin-left: auto; color: var(--secondary); font-size: .88rem; }
.dl-list-stats strong { color: var(--on-surface); font-size: 1.05rem; }
.dl-list-actions { display: flex; gap: .35rem; }
.dl-bar { display: flex; height: .45rem; border-radius: 999px; overflow: hidden; background: var(--surface-container); }
.dl-bar-done { background: var(--primary); }
.dl-bar-called { background: #a2b1e1; }
.dl-agent-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.dl-agent-table th { text-align: left; padding: .35rem .5rem; font-size: .72rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--secondary); border-bottom: 1px solid var(--outline-variant); }
.dl-agent-table td { padding: .45rem .5rem; border-bottom: 1px solid var(--divider); font-variant-numeric: tabular-nums; }
.dl-progress-col { width: 30%; }
.dl-agent-cell { display: inline-flex; align-items: center; gap: .45rem; }
.dl-upload { display: flex; flex-direction: column; gap: 1rem; }
.dl-map { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: .6rem .9rem; }
.dl-map:empty { display: none; }
.dl-map select { width: 100%; }
.dl-assign { border: 1px solid var(--hairline); border-radius: var(--radius); padding: .7rem .9rem; margin: 0; }
.dl-assign legend { font-weight: 600; padding: 0 .3rem; }
.dl-assign .help { margin: 0 0 .5rem; }
.dl-agents { display: flex; flex-wrap: wrap; gap: .4rem; }
.dl-agent { display: inline-flex; align-items: center; gap: .45rem; padding: .35rem .7rem .35rem .5rem; border: 1px solid var(--border-strong); border-radius: 999px; cursor: pointer; font-size: .9rem; }
.dl-agent:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.dl-check { display: flex; align-items: center; gap: .4rem; margin-top: .8rem; font-size: .9rem; }
.dl-up-summary p { margin: 0 0 .2rem; }
.dl-res-filters { display: flex; gap: .5rem; margin-bottom: .75rem; }
.dl-res-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.dl-res-table th { position: sticky; top: 0; background: var(--surface-low); text-align: left; padding: .45rem .6rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--secondary); }
.dl-res-table td { padding: .45rem .6rem; border-top: 1px solid var(--divider); vertical-align: top; }
.dl-res-notes { max-width: 22rem; white-space: pre-wrap; }

/* The Dialer has its own call controls: the floating call panel is hidden while a lead is being called from it. */
body.dl-calling .call-panel { display: none; }

/* Test mode: the switch (Superadmin) and the banner everyone sees while it is on. The thumb slides (a toggle is
   occasional, and the movement shows the new state); with reduced motion it just changes. */
.page-actions:has(.dl-switch) { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.dl-switch { display: inline-flex; align-items: center; gap: .55rem; padding: .35rem .75rem .35rem .45rem; border: 1px solid var(--hairline); border-radius: 999px; background: var(--surface-lowest); font-size: .86rem; font-weight: 600; color: var(--on-surface); cursor: pointer; user-select: none; }
.dl-switch-input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.dl-switch-track { position: relative; width: 2.2rem; height: 1.25rem; border-radius: 999px; background: var(--outline-variant); transition: background-color 160ms ease; }
.dl-switch-track::after { content: ""; position: absolute; top: .15rem; left: .15rem; width: .95rem; height: .95rem; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(15, 23, 42, .25); transition: transform 180ms cubic-bezier(0.23, 1, 0.32, 1); }
.dl-switch-input:checked + .dl-switch-track { background: var(--amber); }
.dl-switch-input:checked + .dl-switch-track::after { transform: translateX(.95rem); }
.dl-switch-input:focus-visible + .dl-switch-track { outline: 3px solid rgba(217, 119, 6, .35); outline-offset: 2px; }
.dl-switch-input:disabled + .dl-switch-track { opacity: .6; }
.dl-switch:has(.dl-switch-input:checked) { border-color: #f5c27a; background: var(--amber-soft); }
@media (prefers-reduced-motion: reduce) { .dl-switch-track, .dl-switch-track::after { transition: none; } }
.dl-test-host:empty { display: none; }
.dl-test-banner { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: 1rem; padding: .7rem 1rem; border: 1px solid #f5c27a; border-radius: .85rem; background: var(--amber-soft); color: #7c3f00; font-size: .9rem; }
.dl-test-badge { padding: .15rem .55rem; border-radius: 999px; background: var(--amber); color: #fff; font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.dl-test-actions { display: flex; gap: .4rem; margin-left: auto; }

/* ---------- click-to-edit script ----------
   The text box uses the same type as the script, so clicking into it feels like the text just became editable. */
.dl-script-body.editable { cursor: text; border-radius: .6rem; transition: background-color 150ms ease; }
@media (hover: hover) and (pointer: fine) { .dl-script-body.editable:hover { background: var(--surface-low); } }
.dl-script-body.editable:focus-visible { outline: 3px solid rgba(66, 85, 154, .3); outline-offset: 2px; }
.dl-script-edit { font-size: 1.04rem !important; line-height: 1.65 !important; padding: .5rem .65rem !important; min-height: 0 !important; }

/* ---------- on a call: slim call bar on top, the script fills the rest ----------
   No transition: the layout swaps the moment the call starts, which is when the caller needs the script. */
/* Call bar across the top; below it the script (about two thirds: it is what the caller reads) and, beside it, the
   notes block (dialer.js moves it there). Both show on every call, whatever panels are hidden outside calls.
   No transition: the layout swaps the moment the call starts. */
.dl-callnotes { display: none; }
.dl-oncall .dl-grid[data-panels] { grid-template-columns: minmax(0, 2fr) minmax(18rem, 1fr); grid-template-rows: auto minmax(0, 1fr); grid-template-areas: "lead lead" "script notes"; }
.dl-oncall .dl-grid > .dl-script.dl-off { display: flex !important; }
.dl-oncall .dl-center { grid-area: lead; }
.dl-oncall .dl-script { grid-area: script; }
.dl-oncall .dl-callnotes { grid-area: notes; display: flex; flex-direction: column; margin: 0; padding: 1.1rem 1.25rem; border: 1px solid var(--dl-line); border-radius: 1.25rem; background: rgba(255, 255, 255, .72); box-shadow: 0 1px 2px rgba(15, 23, 42, .04); }
.dl-callnotes .dl-notes-wrap { flex: 1; display: flex; flex-direction: column; gap: .5rem; min-height: 0; }
.dl-callnotes .dl-notes-head label { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.dl-callnotes .dl-notes { flex: 1; min-height: 10rem; resize: none; font-size: 1.05rem; line-height: 1.6; padding: .7rem .85rem; }
.dl-oncall .dl-queue { display: none; }
/* The call controls (hang up, mute, keypad) live in the lead panel: it shows during a call even if hidden. */
.dl-oncall .dl-grid > .dl-center.dl-off { display: flex !important; }
.dl-oncall .dl-script { max-height: none; padding: 1.25rem 2rem; }
.dl-oncall .dl-script-body { font-size: 1.3rem; line-height: 1.7; }
/* The top bar swaps the pile counters for the facts the caller says out loud. */
.dl-callinfo { display: none; }
.dl-oncall .dl-stats, .dl-oncall .dl-progress, .dl-oncall .dl-list-filter { display: none; }
.dl-oncall .dl-callinfo { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: .5rem; flex: 1 1 100%; }
.dl-info { display: flex; flex-direction: column; gap: .15rem; min-width: 0; padding: .6rem .95rem; border: 1px solid var(--dl-line); border-radius: 1rem; background: rgba(255, 255, 255, .72); }
.dl-info-label { font-size: .72rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-info-value { font-family: var(--font-head); font-size: 1.45rem; font-weight: 700; line-height: 1.15; color: var(--on-surface); font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-info-owner { border-color: var(--primary); background: var(--primary-soft); }
.dl-info-owner .dl-info-label { color: var(--primary-dark); }
.dl-info-speed { border-color: #f5c27a; background: var(--amber-soft); }
.dl-info-speed .dl-info-label { color: #92400e; }
.dl-info-speed .dl-info-value { color: #7c2d12; }
.dl-oncall .dl-script-edit { font-size: 1.3rem !important; line-height: 1.7 !important; }
.dl-oncall .dl-lead { flex: none; flex-direction: row; flex-wrap: wrap; align-items: center; gap: .75rem 1.5rem; padding: .85rem 1.25rem; overflow: visible; }
.dl-oncall .dl-lead-nav, .dl-oncall .dl-facts, .dl-oncall .dl-details, .dl-oncall .dl-lead .dl-notes-wrap, .dl-oncall .dl-meta, .dl-oncall .dl-history { display: none; }
.dl-oncall .dl-identity { gap: .75rem; }
.dl-oncall .dl-monogram { width: 2.6rem; height: 2.6rem; border-radius: .75rem; font-size: .95rem; }
.dl-oncall .dl-identity h2 { font-size: 1.2rem; }
.dl-oncall .dl-ask { margin-top: 0; font-size: .88rem; }
.dl-oncall .dl-action { flex: 1; padding: 0; border: 0; }
.dl-oncall .dl-controls { flex-direction: row; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; }
.dl-oncall .dl-btns { flex: 1; justify-content: flex-end; }
.dl-oncall .dl-hangup { margin-left: 0; }
.dl-oncall .dl-keypad { flex-basis: 100%; }
@media (max-width: 900px) {
  .dl-oncall .dl-script { min-height: 60vh; }
  .dl-oncall .dl-grid[data-panels] { grid-template-columns: 1fr; grid-template-areas: "lead" "notes" "script"; }
}

/* ---------- Call stats (js/ui/screens/callStats.js) ----------
   Stat tiles for the headline numbers; one teal series of thin bars on a shared baseline with a recessive grid; the
   outcomes as one-hue horizontal bars with their counts written beside them; tables with the same numbers.
   Changing the period redraws instantly (it is a lookup, done many times): no chart animation. */
.cs-host[hidden] { display: none; }
.cs { display: flex; flex-direction: column; gap: 1rem; padding-bottom: 1rem; }
.cs-head { display: flex; align-items: center; gap: .75rem 1rem; flex-wrap: wrap; }
.cs-seg { display: inline-flex; gap: .2rem; padding: .25rem; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface-lowest); }
.cs-seg-btn { padding: .4rem 1rem; border: 0; border-radius: 999px; background: none; font: inherit; font-size: .9rem; font-weight: 600; color: var(--on-surface-variant); cursor: pointer; transition: transform 140ms cubic-bezier(0.23, 1, 0.32, 1); }
.cs-seg-btn:active { transform: scale(0.97); }
.cs-seg-btn[aria-selected="true"] { background: var(--primary); color: #fff; }
@media (hover: hover) and (pointer: fine) { .cs-seg-btn:hover:not([aria-selected="true"]) { background: var(--surface-low); } }
.cs-nav { display: flex; align-items: center; gap: .5rem; }
.cs-period { margin: 0 .25rem; min-width: 12rem; text-align: center; font-family: var(--font-head); font-size: 1.1rem; }
.cs-who { margin-left: auto; min-width: 12rem; }
.cs-body { display: flex; flex-direction: column; gap: 1rem; transition: opacity 150ms ease; }
.cs-body.cs-busy { opacity: .6; }
.cs-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: .75rem; }
.cs-tile { display: flex; flex-direction: column; gap: .2rem; padding: .9rem 1.1rem; border: 1px solid var(--hairline); border-radius: 1.1rem; background: rgba(255, 255, 255, .72); }
.cs-tile-label { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--secondary); }
.cs-tile-value { font-family: var(--font-head); font-size: 2rem; font-weight: 700; line-height: 1.15; color: var(--on-surface); font-variant-numeric: tabular-nums; }
.cs-tile-sub { font-size: .82rem; color: var(--secondary); }
.cs-grid { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(20rem, 1fr); gap: 1rem; align-items: stretch; }
@media (max-width: 1000px) { .cs-grid, .cs-tables-2 { grid-template-columns: 1fr; } }
/* Tables under the chart, full width; a month shows By week and By day side by side. */
.cs-tables { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; align-items: start; }
.cs-tables-2 { grid-template-columns: minmax(18rem, 1fr) minmax(0, 2fr); }
.cs-outcomes-card { display: flex; flex-direction: column; }
.cs-card-foot { margin-top: auto; padding-top: 1rem; }
.cs-foot-text { margin: 0; font-size: .8rem; color: var(--secondary); line-height: 1.5; }
.cs-main { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.cs-card { padding: 1.1rem 1.25rem; border: 1px solid var(--hairline); border-radius: 1.25rem; background: rgba(255, 255, 255, .72); }
.cs-card-title { margin: 0 0 .2rem; font-size: 1rem; font-weight: 700; color: var(--on-surface); }
.cs-card-sub { margin: 0 0 .9rem; font-size: .85rem; color: var(--secondary); }
.cs-empty { margin: .5rem 0 0; }
/* bars */
.cs-chart { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .5rem; margin-top: .75rem; }
.cs-axis { display: flex; flex-direction: column; justify-content: space-between; height: 12rem; font-size: .72rem; color: var(--secondary); text-align: right; font-variant-numeric: tabular-nums; }
.cs-axis span { transform: translateY(-50%); }
.cs-axis span:last-child { transform: translateY(50%); }
.cs-plot-wrap { position: relative; }
.cs-grid-lines { position: absolute; inset: 0 0 auto 0; height: 12rem; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.cs-grid-lines span { border-top: 1px dashed var(--divider); }
.cs-grid-lines span:last-child { border-top: 1px solid var(--outline-variant); }
.cs-plot { position: relative; height: 12rem; display: flex; align-items: flex-end; gap: 2px; }
.cs-col { flex: 1; height: 100%; display: flex; align-items: flex-end; justify-content: center; outline: none; cursor: default; }
.cs-bar { width: min(70%, 1.6rem); min-height: 0; border-radius: 4px 4px 0 0; background: var(--primary); }
.cs-col:focus-visible .cs-bar, .cs-col:hover .cs-bar { background: var(--primary-dark); }
.cs-col:focus-visible { box-shadow: inset 0 0 0 2px rgba(66, 85, 154, .3); border-radius: 4px; }
.cs-x { display: flex; gap: 2px; margin-top: .35rem; }
.cs-x span { flex: 1; text-align: center; font-size: .72rem; color: var(--secondary); white-space: nowrap; }
.cs-tip { position: absolute; top: -.5rem; transform: translate(-50%, -100%); z-index: 2; display: flex; flex-direction: column; gap: .1rem; padding: .5rem .7rem; border-radius: .6rem; background: #0f172a; color: #fff; font-size: .8rem; white-space: nowrap; box-shadow: 0 .4rem 1rem rgba(15, 23, 42, .2); pointer-events: none; }
.cs-tip strong { font-weight: 700; }
/* outcomes */
.cs-outcomes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .7rem; }
.cs-outcome { display: grid; grid-template-columns: minmax(7rem, 11rem) minmax(0, 1fr) auto; align-items: center; gap: .75rem; font-size: .9rem; }
.cs-outcome-label { color: var(--on-surface); font-weight: 600; }
.cs-outcome-track { height: .6rem; border-radius: 999px; background: var(--surface-container); overflow: hidden; }
.cs-outcome-fill { display: block; height: 100%; border-radius: 999px; background: var(--primary); }
.cs-outcome-none .cs-outcome-label { color: var(--secondary); font-weight: 500; }
.cs-outcome-none .cs-outcome-fill { background: var(--outline-variant); }
.cs-outcome-n { min-width: 4.5rem; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.cs-outcome-pct { margin-left: .4rem; font-weight: 500; color: var(--secondary); }
/* tables */
.cs-table-wrap { max-height: 22rem; overflow: auto; }
.cs-table { width: 100%; border-collapse: collapse; font-size: .88rem; font-variant-numeric: tabular-nums; }
.cs-table th { position: sticky; top: 0; background: #fff; text-align: right; padding: .45rem .6rem; font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--secondary); border-bottom: 1px solid var(--outline-variant); }
.cs-table td { text-align: right; padding: .45rem .6rem; border-bottom: 1px solid var(--divider); }
.cs-table th:first-child, .cs-table td:first-child { text-align: left; }
.cs-table tr.cs-zero td { color: var(--secondary); }
.cs-table tfoot td { background: #f8fafc !important; font-weight: 700; border-top: 1px solid var(--outline-variant); border-bottom: 0; }
.cs-nudge { margin: 0 0 .6rem; font-size: .85rem; }
@media (max-width: 1000px) { .cs-tables-2 { grid-template-columns: 1fr; } }

/* Outcome tray: "Next step" follow-up chip, and the follow-up ticked off by the call. */
.dl-chip-fu { border-color: var(--primary); color: var(--primary); }
.dl-chip-fu .icon { width: .9rem; height: .9rem; }
.dl-tray-fu { color: var(--secondary); }
.dl-tray-fu .btn-link { padding: 0; border: 0; background: none; font: inherit; font-weight: 600; color: var(--primary); text-decoration: underline; cursor: pointer; }

/* The lead's History (calls and follow-ups), under the notes. */
.dl-history { border-top: 1px solid var(--divider); padding-top: .6rem; }
.dl-history summary { display: inline-flex; align-items: center; gap: .45rem; cursor: pointer; font-size: .85rem; font-weight: 600; color: var(--secondary); list-style: none; }
.dl-history summary::-webkit-details-marker { display: none; }
.dl-history summary .icon { width: 1rem; height: 1rem; }
.dl-history[open] summary { color: var(--text); margin-bottom: .5rem; }
.dl-history-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; max-height: 16rem; overflow-y: auto; }
.dl-history-items li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: .55rem; padding: .4rem .1rem; border-top: 1px solid var(--divider); font-size: .85rem; }
.dl-history-items li:first-child { border-top: 0; }
.dl-history-ico { display: inline-flex; color: var(--secondary); }
.dl-history-ico .icon { width: .9rem; height: .9rem; }
.dl-history-text { overflow-wrap: anywhere; }
@media (max-width: 640px) { .dl-history-items li { grid-template-columns: auto minmax(0, 1fr); } .dl-history-items li > :nth-child(n+3) { grid-column: 2; } }
