:root {
  --canvas: #f4f6f8;
  --surface: #fff;
  --surface-soft: #f8fafb;
  --ink: #17201c;
  --muted: #64706a;
  --line: #dde3df;
  --brand: #4e5ee4;
  --brand-dark: #3d4bc8;
  --green: #11875d;
  --green-dark: #0b6d4a;
  --green-soft: #eaf8f2;
  --danger: #c93939;
  --danger-soft: #fff0f0;
  --warning: #996412;
  --warning-soft: #fff7e7;
  --shadow: 0 12px 36px rgba(29, 45, 37, .08);
  --radius: 16px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--canvas);
  color: var(--ink);
  font: 15px/1.45 Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, textarea, select { font: inherit; }
button, summary, select { touch-action: manipulation; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 4px; font-size: clamp(26px, 3vw, 36px); line-height: 1.08; letter-spacing: -.035em; }
h2 { margin-bottom: 0; font-size: 17px; line-height: 1.25; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.eyebrow { display: block; margin-bottom: 7px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.brand { color: var(--ink); font-size: 20px; font-weight: 800; letter-spacing: -.035em; white-space: nowrap; }
.brand span { color: var(--brand); }

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  min-height: 68px; padding: 10px clamp(16px, 3vw, 34px);
  background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); backdrop-filter: blur(12px);
}
.topbar-right { display: flex; align-items: center; gap: 9px; }
.topbar form { margin: 0; }
.me-name { max-width: 140px; overflow: hidden; color: #35403b; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.line-status { display: inline-flex; align-items: center; gap: 7px; padding: 7px 11px; border-radius: 999px; background: #edf0ee; color: #4a554f; font-size: 12px; font-weight: 750; white-space: nowrap; }
.line-status::before { width: 7px; height: 7px; border-radius: 50%; background: currentColor; content: ''; }
.line-status.ready { background: var(--green-soft); color: #08704c; }
.line-status.starting { background: var(--warning-soft); color: var(--warning); }
.line-status.blocked { background: var(--danger-soft); color: #a32929; }

.locale-switch { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-soft); }
.locale-switch button { border: 0; border-radius: 6px; padding: 5px 7px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 800; cursor: pointer; }
.locale-switch button.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 4px rgba(20,40,30,.12); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 40px; padding: 9px 14px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--ink); font-weight: 750; text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: #bfc9c3; transform: translateY(-1px); }
.btn:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, summary:focus-visible, .text-button:focus-visible { outline: 3px solid rgba(78,94,228,.22); outline-offset: 2px; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { border-color: var(--brand); background: var(--brand); color: #fff; }
.btn-primary:hover { border-color: var(--brand-dark); background: var(--brand-dark); }
.btn-secondary { background: var(--surface-soft); }
.btn-quiet { min-height: 34px; padding: 6px 9px; border-color: transparent; background: transparent; color: var(--muted); }
.btn-quiet:hover { border-color: var(--line); background: var(--surface-soft); color: var(--ink); }
.btn-call { min-width: 132px; min-height: 52px; padding: 13px 20px; border-color: var(--green); background: var(--green); color: #fff; font-size: 16px; }
.btn-call:hover { border-color: var(--green-dark); background: var(--green-dark); }
.btn-danger { min-height: 48px; border-color: var(--danger); background: var(--danger); color: #fff; }
.btn-whatsapp { align-self: flex-start; border-color: var(--green); background: var(--green); color: #fff; }
.btn-whatsapp:hover { border-color: var(--green-dark); background: var(--green-dark); }
.btn-block { width: 100%; }
.text-button { width: fit-content; padding: 3px 0; border: 0; background: transparent; color: var(--brand); font-weight: 750; cursor: pointer; }
.text-button:hover { text-decoration: underline; }

.banner { position: sticky; top: 76px; z-index: 35; max-width: 760px; margin: 12px auto 0; padding: 11px 14px; border: 1px solid #f1d69e; border-radius: 11px; background: var(--warning-soft); color: #704a10; box-shadow: var(--shadow); }
.banner.error { border-color: #efc4c4; background: var(--danger-soft); color: #922828; }
.banner.ok { border-color: #bce6d5; background: var(--green-soft); color: #086343; }

.workspace { display: grid; grid-template-columns: minmax(250px, 300px) minmax(0, 980px); justify-content: center; gap: 18px; padding: 22px clamp(14px, 3vw, 34px) 52px; }
.queue-panel, .contact-panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 2px 14px rgba(30,50,40,.04); }
.queue-panel { position: sticky; top: 90px; align-self: start; overflow: hidden; }
.campaign-head { padding: 18px 18px 15px; border-bottom: 1px solid var(--line); }
.list-select { width: 100%; padding: 9px 34px 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); font-weight: 750; }
.progress-copy { margin: 11px 0 7px; color: var(--muted); font-size: 12px; }
.progress-track { height: 5px; overflow: hidden; border-radius: 999px; background: #edf0ee; }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--brand); transition: width .25s ease; }
.queue-head { display: flex; justify-content: space-between; padding: 14px 16px 7px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.queue { max-height: 430px; overflow-y: auto; list-style: none; margin: 0; padding: 0 8px 8px; }
.queue li { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 9px; align-items: center; margin: 2px 0; padding: 10px; border: 1px solid transparent; border-radius: 11px; cursor: pointer; }
.queue li:hover { background: var(--surface-soft); }
.queue li.current { border-color: #cbd2ff; background: #f0f2ff; }
.queue .pos { display: grid; place-items: center; width: 23px; height: 23px; border-radius: 50%; background: #edf0ee; color: var(--muted); font-size: 11px; font-weight: 800; }
.queue li.current .pos { background: var(--brand); color: #fff; }
.queue .who { min-width: 0; }
.queue .name { overflow: hidden; font-weight: 750; text-overflow: ellipsis; white-space: nowrap; }
.queue .sub { display: flex; justify-content: space-between; gap: 8px; overflow: hidden; color: var(--muted); font-size: 11px; }
.queue .sub-copy { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { flex: none; font-weight: 700; white-space: nowrap; }
.badge.dnc, .badge.invalid { color: var(--danger); }
.badge.done { color: var(--green); }
.badge.callback { color: var(--warning); }
.queue-more { padding: 0 18px 14px; color: var(--muted); font-size: 12px; }
.practice-card { border-top: 1px solid var(--line); padding: 13px 16px 16px; background: var(--surface-soft); }
.practice-card summary { color: #3d4943; font-weight: 750; cursor: pointer; }
.practice-card p { margin: 10px 0; color: var(--muted); font-size: 12px; }
.practice-card input[type="tel"] { width: 100%; margin-bottom: 9px; }

.contact-panel { min-height: 680px; padding: clamp(18px, 3vw, 28px); }
.empty-state { display: grid; min-height: 520px; place-items: center; color: var(--muted); text-align: center; }
.workflow-strip { display: flex; align-items: center; gap: 8px; margin-bottom: 22px; }
.workflow-strip span { position: relative; flex: 1; padding: 8px 10px; border-radius: 9px; background: #f0f2f1; color: #7b8580; font-size: 12px; font-weight: 750; text-align: center; }
.workflow-strip span.active { background: #ebedff; color: #3442bf; }
.workflow-strip span.complete { background: var(--green-soft); color: #08704c; }
.contact-hero { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.company { margin-top: 7px; color: var(--muted); font-size: 16px; }
.phone { margin-top: 5px; font-size: 19px; font-weight: 750; font-variant-numeric: tabular-nums; }
.call-controls { display: flex; gap: 9px; align-items: center; }
.call-status { display: flex; justify-content: space-between; gap: 14px; margin-top: 14px; padding: 13px 15px; border-radius: 11px; background: #edf0ee; font-weight: 750; }
.call-status.live { background: var(--green-soft); color: #086343; }
.call-status.ringing { background: var(--warning-soft); color: #775015; }
.call-status.failed { background: var(--danger-soft); color: #922828; }
.timer { font-variant-numeric: tabular-nums; }

.work-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(300px, .9fr); gap: 14px; margin-top: 16px; }
.work-card { min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-soft); }
.section-heading { display: flex; align-items: center; gap: 9px; margin-bottom: 15px; }
.step-icon { display: inline-grid; place-items: center; width: 25px; height: 25px; border-radius: 8px; background: #e9ecff; color: #3745c5; font-size: 12px; font-weight: 850; }
.script-text { min-height: 170px; max-height: 310px; overflow-y: auto; padding: 14px; border: 1px solid #e0e5e2; border-radius: 10px; background: var(--surface); white-space: pre-wrap; }
.contact-details { margin-top: 12px; }
.contact-details summary, .history summary { color: var(--muted); font-weight: 750; cursor: pointer; }
.extra { display: grid; grid-template-columns: max-content minmax(0,1fr); gap: 6px 14px; margin: 12px 0 0; font-size: 13px; }
.extra dt { color: var(--muted); }
.extra dd { min-width: 0; margin: 0; overflow-wrap: anywhere; }
.extra-link { color: var(--brand); text-decoration: none; }
.extra-link:hover { text-decoration: underline; }
.field-label { display: block; margin: 11px 0 6px; color: #47534d; font-size: 12px; font-weight: 800; }
.outcome-label { margin-top: 18px; }
textarea, select, input[type="datetime-local"], input[type="text"], input[type="tel"], input[type="password"] { border: 1px solid #ccd4cf; border-radius: 9px; background: var(--surface); color: var(--ink); }
textarea { width: 100%; padding: 10px 11px; resize: vertical; }
.followup-card select, .followup-card input[type="datetime-local"] { width: 100%; padding: 10px 11px; }
.followup-card .btn-primary { margin-top: 10px; }
.followup-card .skip-button { display: block; margin: 10px auto 0; color: var(--muted); }

.sms-card { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 12px 18px; align-items: center; margin-top: 14px; padding: 16px 18px; border: 1px solid #bde2d3; border-radius: 13px; background: var(--green-soft); }
.sms-copy { display: flex; gap: 12px; align-items: flex-start; }
.sms-copy h2 { color: #075b3e; }
.sms-copy p { margin: 4px 0 0; color: #3f6658; font-size: 13px; }
.sms-icon { display: grid; flex: none; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: #ccecdf; color: #08704c; font-size: 18px; font-weight: 800; }
.check-row { display: flex; gap: 9px; align-items: flex-start; color: #46524c; font-size: 12px; line-height: 1.35; cursor: pointer; }
.check-row input { flex: none; width: 17px; height: 17px; margin: 0; accent-color: var(--green); }
.consent-row { grid-column: 1; padding-left: 42px; }
.recipient-row { grid-column: 1; display: grid; grid-template-columns: auto minmax(180px, 320px); gap: 10px; align-items: center; padding-left: 42px; font-size: 12px; font-weight: 800; }
.recipient-row input { min-width: 0; }
.sms-card .btn { grid-column: 2; grid-row: 1 / span 3; }
.history { margin-top: 16px; padding: 13px 2px 0; }
.history-list { list-style: none; margin: 10px 0 0; padding: 0; }
.history-list li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.history-list .meta { color: var(--muted); font-size: 12px; }

.login-body { display: grid; min-height: 100vh; place-items: center; padding: 20px; background: radial-gradient(circle at 50% 20%, #fff 0, #f1f3ff 38%, var(--canvas) 75%); }
.login-card { width: min(100%, 420px); padding: 34px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.login-topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.login-card h1 { margin-top: 28px; font-size: 30px; }
.login-card > p { margin-bottom: 24px; }
.login-card label { display: block; margin: 13px 0 6px; font-size: 13px; font-weight: 750; }
.login-card input { width: 100%; padding: 11px 12px; }
.login-card .btn { margin-top: 19px; }
.alert { margin: 14px 0; padding: 11px 13px; border: 1px solid #efc4c4; border-radius: 10px; background: var(--danger-soft); color: #922828; }

.tour-overlay { position: fixed; inset: 0; z-index: 100; background: transparent; }
.tour-overlay.centered-mode { background: rgba(15,24,20,.58); }
.tour-spotlight { position: fixed; z-index: 101; border: 3px solid #fff; border-radius: 16px; box-shadow: 0 0 0 9999px rgba(15,24,20,.58), 0 0 0 6px rgba(78,94,228,.65); pointer-events: none; transition: inset .22s ease, width .22s ease, height .22s ease; }
.tour-card { position: fixed; z-index: 102; width: min(420px, calc(100vw - 28px)); padding: 24px; border-radius: 16px; background: var(--surface); box-shadow: 0 22px 60px rgba(0,0,0,.27); }
.tour-card.centered { top: 50%; left: 50%; transform: translate(-50%, -50%); }
.tour-topline { display: flex; justify-content: space-between; gap: 14px; align-items: center; margin-bottom: 8px; }
.tour-card h2 { margin: 0 0 9px; font-size: 23px; letter-spacing: -.025em; }
.tour-card p { margin-bottom: 20px; color: var(--muted); }
.tour-actions { display: flex; justify-content: flex-end; gap: 8px; }

@media (max-width: 900px) {
  .topbar { align-items: flex-start; }
  .topbar-right { justify-content: flex-end; flex-wrap: wrap; }
  .me-name { display: none; }
  .workspace { grid-template-columns: 1fr; padding-top: 14px; }
  .queue-panel { position: static; }
  .queue { max-height: 260px; }
  .work-grid { grid-template-columns: 1fr; }
  .contact-panel { min-height: 0; }
}

@media (max-width: 620px) {
  .topbar { display: grid; grid-template-columns: 1fr auto auto; gap: 7px 8px; min-height: 60px; padding: 9px 12px; }
  .topbar-right { display: contents; }
  .brand { font-size: 18px; }
  .locale-switch { grid-column: 2; grid-row: 1; }
  .topbar form { grid-column: 3; grid-row: 1; }
  .topbar form .btn { padding-inline: 5px; }
  .line-status { grid-column: 1 / 3; grid-row: 2; max-width: none; justify-content: center; overflow: hidden; text-overflow: ellipsis; }
  #help-button { grid-column: 3; grid-row: 2; padding-inline: 7px; }
  .workspace { padding: 10px 9px 36px; }
  .contact-panel { padding: 15px; }
  .workflow-strip span { padding: 7px 3px; font-size: 10px; }
  .contact-hero { align-items: flex-start; }
  .call-controls { flex-direction: column; align-items: stretch; }
  .btn-call { min-width: 108px; }
  .sms-card { grid-template-columns: 1fr; }
  .consent-row { grid-column: 1; padding-left: 0; }
  .recipient-row { grid-column: 1; grid-template-columns: 1fr; padding-left: 0; }
  .sms-card .btn { grid-column: 1; grid-row: auto; width: 100%; }
  .tour-spotlight { display: none !important; }
  .tour-card { top: auto !important; right: 14px !important; bottom: 14px !important; left: 14px !important; width: auto; transform: none !important; }
}
