:root {
  --ink: #243238;
  --muted: #62747a;
  --cream: #eef2f1;
  --paper: #fbfcfb;
  --line: #d8e1e0;
  --mint: #d9e8e6;
  --green: #3f7f84;
  --green-dark: #2e6469;
  --orange: #4a8f8c;
  --orange-dark: #2e6469;
  --red: #a8504b;
  --shadow: none;
  --radius-lg: 28px;
  --radius-md: 19px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--cream);
  font-family: "Segoe UI", Calibri, Arial, sans-serif;
  min-height: 100vh;
}

button, input, select, textarea { font: inherit; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: 100vh; }
.page-shell { width: min(1120px, calc(100% - 56px)); margin: 0 auto; min-width: 0; }

.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 28px; padding: 26px 16px; border-right: 1px solid var(--line); }
.sidebar .main-nav { flex-direction: column; gap: 4px; padding: 0; border-radius: 0; background: none; }
.sidebar .main-nav a { padding: 11px 14px; border-radius: 12px; font-size: 14px; }
.sidebar .main-nav a:hover { background: rgba(36, 50, 56, .06); }
.sidebar .system-state { margin-top: auto; min-width: 0; justify-content: flex-start; padding: 0 6px; }
.account-summary { margin-top: auto; display: grid; gap: 5px; padding: 12px 14px 0; border-top: 1px solid var(--line); }
.account-summary strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.account-summary .text-button { width: max-content; padding: 0; color: var(--muted); font-size: 11px; }

.topbar {
  height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(36, 50, 56, 0.12);
}

.brand { display: inline-flex; align-items: center; gap: 13px; color: inherit; text-decoration: none; }
.brand strong { display: block; font-size: 20px; }
.brand small { display: block; margin-top: 1px; color: var(--muted); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }

.brand-mark {
  width: 45px;
  height: 45px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: var(--ink);
}

.brand-mark i { width: 3px; border-radius: 3px; background: var(--cream); }
.brand-mark i:nth-child(1), .brand-mark i:nth-child(5) { height: 8px; }
.brand-mark i:nth-child(2), .brand-mark i:nth-child(4) { height: 16px; }
.brand-mark i:nth-child(3) { height: 24px; background: var(--orange); }

.system-state { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 13px; min-width: 120px; justify-content: flex-end; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #9fb0b0; box-shadow: 0 0 0 5px rgba(159, 176, 176,.12); }
.status-dot[data-state="ready"] { background: #4a9a78; box-shadow: 0 0 0 5px rgba(74, 154, 120,.13); }
.status-dot[data-state="live"] { background: var(--orange); box-shadow: 0 0 0 5px rgba(74, 143, 140,.17); animation: pulse 1.6s infinite; }
.status-dot[data-state="error"] { background: var(--red); box-shadow: 0 0 0 5px rgba(168, 80, 75,.13); }

.main-nav { display: flex; gap: 6px; padding: 5px; border-radius: 999px; background: rgba(36, 50, 56,.06); }
.main-nav a { padding: 8px 18px; border-radius: 999px; color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 800; }
.main-nav a:hover { color: var(--ink); }
.main-nav a[aria-current="page"] { background: var(--ink); color: white; }

.auth-page { display: grid; place-items: center; padding: 32px; background: var(--cream); }
.auth-shell { width: min(100%, 960px); min-height: 630px; display: grid; grid-template-columns: .9fr 1.1fr; overflow: hidden; border: 1px solid var(--line); border-radius: 30px; background: var(--paper); }
.auth-intro { display: flex; flex-direction: column; padding: 42px; background: var(--ink); color: white; }
.auth-intro .brand { color: white; }
.auth-intro .brand small { color: #a9babb; }
.auth-intro .brand-mark { background: rgba(255,255,255,.08); }
.auth-intro-copy { margin: auto 0; }
.auth-intro-copy .eyebrow { color: #9cc3bf; }
.auth-intro-copy h1 { max-width: 420px; font-size: clamp(34px, 4vw, 48px); line-height: 1.13; }
.auth-intro-copy > p:last-child { max-width: 390px; margin: 22px 0 0; color: #b8c8c8; font-size: 15px; line-height: 1.7; }
.auth-security-note { margin: 0; color: #8fa4a5; font-size: 11px; }
.auth-card { display: flex; flex-direction: column; justify-content: center; padding: 48px 54px; background: var(--paper); }
.auth-card h2 { margin: 0; font-size: 29px; font-weight: 650; }
.auth-copy { margin: 9px 0 25px; color: var(--muted); line-height: 1.55; }
.auth-mobile-brand { display: none; }
.auth-card form, .account-form { display: grid; gap: 16px; }
.auth-card label, .account-form label { display: grid; gap: 7px; color: var(--ink); font-size: 12px; font-weight: 750; }
.auth-card input, .account-form input, .account-form select { width: 100%; height: 48px; padding: 0 13px; border: 1px solid #cbd8d6; border-radius: 12px; background: white; color: var(--ink); outline: 0; }
.auth-card input:focus, .account-form input:focus, .account-form select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(63, 127, 132,.1); }
.auth-card small, .account-form small { color: var(--muted); font-size: 11px; line-height: 1.45; }
.auth-card .primary-button, .account-form .primary-button { min-height: 48px; }
.auth-alternate { margin: 3px 0 0; color: var(--muted); font-size: 12px; text-align: center; }
.auth-alternate a { color: var(--green-dark); font-weight: 800; text-decoration: none; }
.auth-alternate a:hover { text-decoration: underline; }
.auth-message { margin: 0; padding: 10px 12px; border-radius: 10px; background: #f3dddb; color: #8c3d39; font-size: 12px; line-height: 1.45; }
.auth-message[data-tone="ok"] { background: #dfeee6; color: #2e704d; }
.auth-notice { padding: 12px 14px; border-radius: 11px; background: #f2ead6; color: #70571e; font-size: 13px; }
.accounts-page { padding: 52px 0 70px; }
.account-card { margin-top: 22px; padding: 28px; }
.account-card h2 { margin: 0 0 7px; font-size: 21px; }
.account-card > p { color: var(--muted); font-size: 13px; }
.account-form { max-width: 590px; margin-top: 20px; }

.hero { padding: 52px 0 60px; display: grid; grid-template-columns: 1.08fr .92fr; gap: clamp(50px, 8vw, 110px); align-items: center; }
.eyebrow, .section-label, .console-kicker { margin: 0 0 14px; color: var(--orange-dark); font-size: 11px; font-weight: 800; letter-spacing: .18em; }
h1 { margin: 0; max-width: 700px; font-size: clamp(34px, 4vw, 52px); line-height: 1.2; font-weight: 600; }
.hero-text { max-width: 610px; margin: 27px 0 0; color: var(--muted); font-size: 17px; line-height: 1.72; }
.stack-row { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 30px; }
.stack-row span { padding: 8px 12px; border: 1px solid rgba(36, 50, 56,.13); border-radius: 999px; color: var(--green-dark); background: rgba(251,252,251,.55); font-size: 12px; font-weight: 700; }

.call-console { padding: 29px; border-radius: var(--radius-lg); background: var(--ink); color: white; position: relative; overflow: hidden; }
.console-head { display: flex; justify-content: space-between; align-items: flex-start; position: relative; z-index: 1; }
.console-kicker { color: #9cc3bf; margin-bottom: 7px; }
.console-head h2 { margin: 0; font-size: 21px; font-weight: 700; }
#call-timer { padding: 7px 11px; border-radius: 99px; background: rgba(255,255,255,.08); color: #dfeceb; font-variant-numeric: tabular-nums; font-size: 13px; }

.orb-wrap { display: grid; place-items: center; height: 190px; }
.voice-orb { width: 128px; height: 128px; border-radius: 50%; display: flex; justify-content: center; align-items: center; gap: 5px; background: var(--orange); }
.voice-orb span { width: 4px; height: 25px; border-radius: 8px; background: #f4faf9; opacity: .9; }
.voice-orb span:nth-child(2), .voice-orb span:nth-child(4) { height: 43px; }
.voice-orb span:nth-child(3) { height: 62px; }
.call-console[data-live="true"] .voice-orb span { animation: wave .85s ease-in-out infinite alternate; }
.call-console[data-live="true"] .voice-orb span:nth-child(2) { animation-delay: -.35s; }
.call-console[data-live="true"] .voice-orb span:nth-child(3) { animation-delay: -.6s; }
.call-console[data-live="true"] .voice-orb span:nth-child(4) { animation-delay: -.2s; }

.console-copy { min-height: 42px; margin: 0 auto 17px; max-width: 360px; text-align: center; color: #b3c4c4; line-height: 1.55; font-size: 13px; }
.call-button { width: 100%; min-height: 57px; border: 0; border-radius: 15px; display: flex; align-items: center; justify-content: center; gap: 11px; background: var(--orange); color: white; font-weight: 800; cursor: pointer; transition: transform .18s, background .18s, opacity .18s; }
.call-button:hover:not(:disabled) { transform: translateY(-2px); background: #5aa09d; }
.call-button:focus-visible, .text-button:focus-visible { outline: 3px solid rgba(74, 143, 140,.4); outline-offset: 3px; }
.call-button:disabled { opacity: .45; cursor: not-allowed; }
.call-button[data-live="true"] { background: #a8504b; }
.privacy-note { margin: 11px 0 0; text-align: center; color: #8ba2a3; font-size: 11px; }
.error-message { margin: 14px 0 0; padding: 11px 12px; border-radius: 10px; background: rgba(168,80,75,.16); color: #f1d9d6; font-size: 12px; line-height: 1.45; }

.call-console label { display: block; margin-bottom: 8px; color: #9cc3bf; font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.call-console .dialer-row { grid-template-columns: 1fr; gap: 12px; }
.call-console .dialer-row input { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.2); color: white; }
.call-console .dialer-row input::placeholder { color: #8ba2a3; }
.call-console .dialer-row input:focus { border-color: #9cc3bf; box-shadow: none; }
.call-console .dialer-status { color: #8ba2a3; font-size: 12px; text-align: center; }
.call-console .dialer-status[data-ready="true"] { color: #9cd5c0; }
.call-flow-picker { margin: 0 0 18px; }
.call-flow-picker-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.call-flow-picker-head label { margin-bottom: 8px; }
.call-flow-picker-head a { margin-bottom: 8px; color: #9cc3bf; font-size: 11px; font-weight: 750; text-decoration: none; }
.call-flow-picker-head a:hover { color: white; text-decoration: underline; }
.call-flow-picker select { width: 100%; height: 48px; padding: 0 38px 0 14px; border: 1px solid rgba(255,255,255,.2); border-radius: 13px; background: #303f44; color: white; outline: 0; }
.call-flow-picker select:focus { border-color: #9cc3bf; }
.call-flow-picker select:disabled { opacity: .6; }
.call-flow-picker small { display: block; margin-top: 7px; color: #8ba2a3; font-size: 11px; line-height: 1.45; }
.phone-dialer { margin-bottom: 22px; padding: 25px 27px; display: grid; grid-template-columns: .8fr 1.2fr; gap: 42px; align-items: center; }
.dialer-copy h2 { margin: 0; font-size: 28px; font-weight: 600; }
.dialer-copy p:last-child { margin: 10px 0 0; max-width: 470px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.dialer-control label { display: block; margin-bottom: 8px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.dialer-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.dialer-row input { min-width: 0; height: 51px; padding: 0 15px; border: 1px solid #cbd8d6; border-radius: 13px; background: white; color: var(--ink); outline: 0; }
.dialer-row input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(63, 127, 132,.1); }
.phone-button { min-height: 51px; padding: 0 21px; border: 0; border-radius: 13px; background: var(--green); color: white; font-weight: 800; cursor: pointer; transition: transform .18s, background .18s, opacity .18s; }
.phone-button:hover:not(:disabled) { transform: translateY(-1px); background: var(--green-dark); }
.phone-button:disabled { cursor: not-allowed; opacity: .45; }
.phone-button[data-live="true"] { background: #a8504b; }
.dialer-status { margin: 8px 1px 0; min-height: 18px; color: var(--muted); font-size: 11px; }
.dialer-status[data-ready="true"] { color: var(--green); }

.import-panel { margin: 0 0 22px; padding: 25px 27px; display: grid; grid-template-columns: 1fr auto; gap: 24px 36px; align-items: center; }
.import-copy h2 { margin: 0; font-size: 28px; font-weight: 600; }
.import-copy p:last-child { max-width: 650px; margin: 10px 0 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.import-actions { min-width: 210px; display: grid; justify-items: stretch; gap: 8px; }
.upload-button { justify-content: center; user-select: none; }
.upload-button[data-loading="true"] { opacity: .55; pointer-events: none; }
.upload-button[data-disabled="true"] { opacity: .55; pointer-events: none; }
.import-status { color: var(--muted); font-size: 11px; text-align: center; }
.import-status[data-state="success"] { color: var(--green); }
.import-status[data-state="error"] { color: var(--red); }
.import-results { grid-column: 1 / -1; min-width: 0; border-top: 1px solid var(--line); padding-top: 18px; }
.campaign-bar { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 12px; }
.import-summary { color: var(--green-dark); font-size: 13px; font-weight: 750; }
.campaign-progress { margin-top: 5px; color: var(--muted); font-size: 11px; }
.campaign-actions { display: flex; gap: 8px; flex: 0 0 auto; }
.campaign-actions .download-button { min-height: 40px; padding: 0 16px; }
.campaign-actions button:disabled { opacity: .5; cursor: not-allowed; }
.stop-campaign { min-height: 40px; padding: 0 16px; border: 0; border-radius: 12px; background: var(--red); color: white; font-weight: 800; cursor: pointer; }
.import-table-wrap { max-height: 310px; overflow: auto; border: 1px solid var(--line); border-radius: 14px; background: white; }
.import-table { width: 100%; min-width: 610px; border-collapse: collapse; font-size: 13px; }
.import-table th { position: sticky; top: 0; z-index: 1; padding: 10px 12px; background: #e8eeed; color: var(--muted); text-align: left; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; }
.import-table td { padding: 11px 12px; border-top: 1px solid var(--line); }
.import-table tr[data-selected="true"] { background: #e5f0ed; }
.import-table tr[data-campaign-status="calling"] { background: #e5f0ed; }
.import-table .dim { color: #99a7a7; }
.select-contact { padding: 7px 13px; border: 1px solid #bfcfcd; border-radius: 9px; background: white; color: var(--green-dark); font-size: 12px; font-weight: 800; cursor: pointer; }
.select-contact:hover { border-color: var(--green); background: #edf5f3; }
.select-contact:disabled { opacity: .45; cursor: not-allowed; }
.campaign-contact-status { font-size: 11px; font-weight: 800; color: var(--muted); }
.campaign-contact-status[data-status="calling"], .campaign-contact-status[data-status="retry_queued"] { color: var(--orange-dark); }
.campaign-contact-status[data-status="completed"] { color: #3d7a5a; }
.campaign-contact-status[data-status="unanswered"], .campaign-contact-status[data-status="cancelled"] { color: #85692a; }
.campaign-contact-status[data-status="failed"] { color: var(--red); }
.import-rejections { margin-top: 12px; color: var(--muted); font-size: 12px; }
.import-rejections summary { cursor: pointer; color: var(--red); font-weight: 750; }
.import-rejections ul { margin: 9px 0 0; padding-left: 20px; line-height: 1.7; }

.workspace { display: grid; grid-template-columns: 1.5fr .8fr; gap: 22px; margin-bottom: 45px; }
.panel { background: rgba(251,252,251,.86); border: 1px solid rgba(36, 50, 56,.1); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.transcript-panel, .lead-panel { padding: 27px; }
.panel-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.panel-heading .section-label { margin-bottom: 7px; }
.panel-heading h2 { margin: 0; font-size: 28px; font-weight: 600; }
.live-pill { padding: 7px 11px; border-radius: 999px; background: #e6edec; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.live-pill[data-live="true"] { background: #d9e8e6; color: var(--orange-dark); }

.transcript { height: 430px; margin-top: 21px; padding: 17px; overflow-y: auto; border-radius: var(--radius-md); background: #e8eeed; scroll-behavior: smooth; }
.empty-state { min-height: 100%; display: grid; place-content: center; justify-items: center; color: #8fa09f; text-align: center; }
.empty-state p { max-width: 280px; line-height: 1.6; font-size: 13px; }
.turn { width: fit-content; max-width: 82%; margin-bottom: 13px; padding: 11px 14px 12px; border-radius: 15px 15px 15px 4px; background: white; border: 1px solid rgba(36, 50, 56,.07); }
.turn[data-role="user"] { margin-left: auto; border-radius: 15px 15px 4px 15px; background: var(--green-dark); color: white; border-color: transparent; }
.turn-role { display: block; margin-bottom: 4px; color: var(--orange-dark); font-size: 9px; font-weight: 900; letter-spacing: .13em; text-transform: uppercase; }
.turn[data-role="user"] .turn-role { color: #b5d1ce; }
.turn p { margin: 0; font-size: 14px; line-height: 1.55; }

.completion-ring { padding: 7px 11px; border-radius: 999px; background: #e4ecea; color: var(--ink); font-size: 11px; font-weight: 800; }
.completion-ring::after { content: attr(data-label); }

.lead-fields { margin: 25px 0 20px; }
.lead-fields div { padding: 13px 0; border-bottom: 1px solid var(--line); }
.lead-fields dt { margin-bottom: 5px; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; }
.lead-fields .field-optional { color: #879797; font-size: 9px; font-weight: 700; letter-spacing: .08em; }
.lead-fields dd { margin: 0; min-height: 21px; overflow-wrap: anywhere; font-size: 14px; font-weight: 750; }
.lead-fields dd[data-empty="true"] { color: #9aabab; font-weight: 500; }
.lead-fields .lead-fields-empty dd { color: var(--muted); font-weight: 500; line-height: 1.5; }
.flow-card { margin-top: 19px; padding: 17px; border-radius: 16px; background: #e6efed; }
.flow-card > p { margin: 0 0 13px; font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .12em; }
.flow-card > strong { display: block; font-size: 14px; }
.flow-card > span { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.flow-card ol { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.flow-card li { display: flex; align-items: center; gap: 9px; color: #8a9b9a; font-size: 12px; }
.flow-card li span { width: 22px; height: 22px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; border: 1px solid #cad6d4; font-size: 9px; font-weight: 800; }
.flow-card li[data-state="active"] { color: var(--ink); font-weight: 800; }
.flow-card li[data-state="active"] span { color: white; background: var(--orange); border-color: var(--orange); }
.flow-card li[data-state="done"] { color: var(--green); }
.flow-card li[data-state="done"] span { color: white; background: var(--green); border-color: var(--green); }

.history-status, .pill { display: inline-block; width: fit-content; padding: 6px 9px; border-radius: 999px; background: #dfeee6; color: #3d7a5a; font-size: 10px; font-weight: 900; text-transform: uppercase; white-space: nowrap; }
.history-status[data-complete="false"], .pill[data-tone="warn"] { background: #f2ead6; color: #85692a; }
.pill[data-tone="hot"], .pill[data-tone="interested"] { background: #dfeee6; color: #2f6f4e; }
.pill[data-tone="neutral"] { background: #e6edf0; color: #52676f; }
.pill[data-tone="cold"], .pill[data-tone="not_interested"] { background: #f3dddb; color: var(--red); }
.pill[data-tone="undetermined"] { background: #ececeb; color: #6b706f; }

footer { min-height: 90px; display: flex; justify-content: space-between; gap: 20px; align-items: center; border-top: 1px solid rgba(36, 50, 56,.12); color: var(--muted); font-size: 12px; }

/* ---------- dashboard ---------- */
.dash { padding: 40px 0 50px; }
.dash-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
.dash-title { font-size: clamp(32px, 4vw, 46px); }
.dash-sub { margin: 10px 0 0; color: var(--muted); font-size: 14px; }
.dash-actions { display: grid; justify-items: end; gap: 12px; }
.dash-utility-actions { display: flex; justify-content: flex-end; gap: 10px; }
.ghost-button, .download-button { min-height: 46px; padding: 0 20px; border-radius: 13px; display: inline-flex; align-items: center; font-size: 14px; font-weight: 800; cursor: pointer; text-decoration: none; }
.ghost-button { border: 1px solid #cbd8d6; background: white; color: var(--ink); }
.download-button { border: 0; background: var(--green); color: white; }
.download-button:hover { background: var(--green-dark); }
.download-button.is-disabled { opacity: .5; pointer-events: none; }
.excel-export { min-width: 430px; display: grid; gap: 6px; }
.excel-export > label { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.excel-export-row { display: grid; grid-template-columns: minmax(210px, 1fr) auto; gap: 8px; align-items: stretch; }
.excel-export select { width: 100%; height: 46px; padding: 0 36px 0 13px; border: 1px solid #cbd8d6; border-radius: 13px; background: white; color: var(--ink); outline: 0; }
.excel-export select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(63, 127, 132,.1); }
.excel-export > span { color: var(--muted); font-size: 10px; }

.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 28px 0 22px; }
.stat { padding: 18px 20px; border-radius: var(--radius-md); background: rgba(251,252,251,.86); border: 1px solid rgba(36, 50, 56,.1); }
.stat span { display: block; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.stat strong { display: block; margin-top: 8px; font-size: 32px; font-weight: 600; }

.table-panel { padding: 22px; }
.table-tools { display: flex; gap: 10px; margin-bottom: 16px; }
.table-tools input, .table-tools select { height: 44px; padding: 0 14px; border: 1px solid #cbd8d6; border-radius: 12px; background: white; color: var(--ink); outline: 0; }
.table-tools input { flex: 1; min-width: 0; }
.data-wrap { overflow-x: auto; }
.data-table { width: 100%; min-width: 600px; border-collapse: collapse; font-size: 13px; }
.data-table th { padding: 11px 12px; text-align: left; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; border-bottom: 2px solid var(--line); white-space: nowrap; }
.data-table td { padding: 14px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table tbody tr[data-id] { cursor: pointer; }
.data-table tbody tr:hover { background: rgba(217, 232, 230,.25); }
.data-table .dim { color: #9aabab; }
.data-table .strong { font-weight: 750; }
.data-table .num { text-align: right; }
.mono { font-variant-numeric: tabular-nums; }
.table-empty { padding: 36px !important; text-align: center; color: var(--muted); }
.table-note { margin: 14px 2px 0; color: var(--muted); font-size: 12px; }

/* details drawer */
.scrim { position: fixed; inset: 0; z-index: 20; background: rgba(36, 50, 56,.4); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 21; width: min(500px, 100%); display: flex; flex-direction: column; background: var(--paper); border-left: 1px solid var(--line); box-shadow: var(--shadow); }
.drawer[hidden], .scrim[hidden] { display: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { margin: 0; font-size: 14px; font-weight: 800; display: flex; align-items: center; gap: 10px; min-width: 0; }
.drawer-head h2 .mono { overflow: hidden; text-overflow: ellipsis; }
.icon-btn { width: 32px; height: 32px; display: grid; place-items: center; border: 1px solid #cbd8d6; border-radius: 10px; background: white; cursor: pointer; color: var(--ink); }
.icon-btn:hover { background: #e6efed; }
.meta { margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); }
.meta div { padding: 12px 22px; border-right: 1px solid var(--line); min-width: 0; }
.meta div:last-child { border-right: 0; }
.meta dt, .lead-line dt { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.meta dd { margin: 2px 0 0; font-size: 12px; overflow-wrap: anywhere; }
.lead-line { margin: 0; padding: 14px 22px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.lead-line dd { margin: 3px 0 0; font-weight: 750; overflow-wrap: anywhere; }
.analysis-note { display: grid; gap: 5px; padding: 13px 22px; border-bottom: 1px solid var(--line); }
.analysis-note strong { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.analysis-note span { font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.tabs { display: flex; gap: 4px; padding: 0 14px; border-bottom: 1px solid var(--line); }
.tab { padding: 12px 10px; margin-bottom: -1px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font-weight: 800; font-size: 13px; cursor: pointer; }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--orange); }
.drawer-body { flex: 1; overflow-y: auto; }
.insight-panel { padding: 20px 22px 30px; }
.insight-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0 0 18px; }
.insight-grid div { padding: 12px; background: #edf4f2; border: 1px solid var(--line); border-radius: 12px; }
.insight-grid dt, .insight-section h3 { margin: 0; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.insight-grid dd { margin: 5px 0 0; font-size: 18px; font-weight: 800; }
.insight-section { padding: 15px 0; border-top: 1px solid var(--line); }
.insight-section p { margin: 7px 0 0; font-size: 13px; line-height: 1.55; overflow-wrap: anywhere; }
.insight-section ul { display: grid; gap: 7px; margin: 9px 0 0; padding-left: 19px; }
.insight-section li { font-size: 13px; line-height: 1.45; }
.insight-section li[data-empty="true"] { color: var(--muted); }
.insight-action { margin-top: 4px; padding: 15px; border: 1px solid #b9d3ce; border-radius: 12px; background: #edf7f4; }
.tx { padding: 8px 22px 22px; }
.tx-row { display: grid; grid-template-columns: 66px 1fr; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.tx-row:last-child { border-bottom: 0; }
.tx-who { font-size: 10px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.tx-who[data-role="bot"] { color: var(--orange-dark); }
.tx-time { display: block; margin-top: 2px; color: #9aabab; font-size: 11px; font-weight: 500; letter-spacing: 0; }
.tx-text { font-size: 14px; line-height: 1.55; overflow-wrap: anywhere; }
.drawer-empty { padding: 40px 22px; text-align: center; color: var(--muted); }
.payload { margin: 0; padding: 16px 22px; font: 12px/1.6 Consolas, ui-monospace, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.payload-bar { display: flex; justify-content: flex-end; padding: 12px 22px 0; }
.payload-bar .ghost-button { min-height: 34px; padding: 0 14px; font-size: 13px; }
.recording-panel { padding: 20px 22px 30px; }
.recording-card { padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: #f8faf9; }
.recording-card h3 { margin: 0; font-size: 17px; }
.recording-status { margin: 8px 0 15px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.recording-auth { display: grid; gap: 7px; margin-bottom: 16px; }
.recording-auth label, .recording-actions label { color: var(--muted); font-size: 11px; font-weight: 800; }
.recording-auth > div { display: flex; gap: 8px; }
.recording-auth input { min-width: 0; flex: 1; height: 42px; padding: 0 12px; border: 1px solid #cbd8d6; border-radius: 10px; }
.recording-auth small { color: var(--muted); font-size: 10px; line-height: 1.4; }
.recording-card audio { display: block; width: 100%; margin: 12px 0; }
.recording-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.recording-actions select { height: 38px; padding: 0 9px; border: 1px solid #cbd8d6; border-radius: 9px; background: white; }
.recording-actions .download-button { min-height: 38px; margin-left: auto; padding: 0 13px; font-size: 12px; }
.recording-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 18px 0 0; }
.recording-meta div { padding: 10px; border-radius: 10px; background: #edf4f2; }
.recording-meta dt { color: var(--muted); font-size: 9px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.recording-meta dd { margin: 4px 0 0; font-size: 12px; font-weight: 750; overflow-wrap: anywhere; }
.recording-pill[data-tone="available"] { background: #dceee5; color: #2e704d; }
.recording-pill[data-tone="processing"], .recording-pill[data-tone="pending"] { background: #f2ead6; color: #85692a; }
.recording-pill[data-tone="failed"] { background: #f3dddb; color: #8c3d39; }
.recording-pill[data-tone="expired"], .recording-pill[data-tone="not_recorded"] { background: #e8eceb; color: #687877; }
.recording-settings-dialog form { display: grid; gap: 15px; }
.recording-settings-dialog .required-toggle { padding: 0; }
.recording-settings-dialog .flow-form-error { margin: 0; }
.recording-settings-dialog .flow-form-error[data-tone="ok"] { background: #dfeee6; color: #2e704d; }

/* ---------- call flows ---------- */
.flows-page { padding: 40px 0 50px; }
.flows-head { margin-bottom: 28px; }
.flow-builder { display: grid; grid-template-columns: minmax(230px, .34fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.flow-library { position: sticky; top: 24px; overflow: hidden; }
.flow-library-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 19px 20px; border-bottom: 1px solid var(--line); }
.flow-library-head h2 { margin: 0; font-size: 17px; }
.flow-library-head span { min-width: 27px; padding: 4px 7px; border-radius: 99px; background: #e4ecea; color: var(--muted); text-align: center; font-size: 11px; font-weight: 800; }
.flow-library-list { max-height: calc(100vh - 210px); overflow-y: auto; padding: 8px; }
.flow-library-empty { margin: 0; padding: 28px 12px; color: var(--muted); text-align: center; font-size: 13px; line-height: 1.5; }
.flow-library-item { width: 100%; padding: 13px 12px; border: 0; border-radius: 12px; background: transparent; color: var(--ink); text-align: left; cursor: pointer; }
.flow-library-item:hover { background: rgba(217, 232, 230, .45); }
.flow-library-item[aria-selected="true"] { background: #e1edeb; }
.flow-library-item strong, .flow-library-item span { display: block; overflow: hidden; text-overflow: ellipsis; }
.flow-library-item strong { font-size: 13px; }
.flow-library-item span { margin-top: 5px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.flow-editor { padding: 26px; }
.flow-editor-head { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.flow-editor-head .section-label { margin-bottom: 6px; }
.flow-editor-head h2 { margin: 0; font-size: 27px; font-weight: 600; overflow-wrap: anywhere; }
.flow-save-state { flex: 0 0 auto; padding: 6px 9px; border-radius: 99px; background: #e6edec; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; }
.flow-save-state[data-tone="ok"] { background: #dfeee6; color: #3d7a5a; }
.flow-save-state[data-tone="warn"] { background: #f2ead6; color: #85692a; }
.flow-save-state[data-tone="error"] { background: #f3dddb; color: var(--red); }
.flow-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; padding: 24px 0; }
.flow-field { display: grid; gap: 7px; min-width: 0; }
.flow-field-wide { grid-column: 1 / -1; }
.flow-field > span { color: var(--ink); font-size: 12px; font-weight: 800; }
.flow-field > span b { color: var(--red); }
.flow-field input, .flow-field textarea, .flow-field select { width: 100%; min-width: 0; padding: 11px 13px; border: 1px solid #cbd8d6; border-radius: 11px; background: white; color: var(--ink); outline: 0; resize: vertical; line-height: 1.5; }
.flow-field input, .flow-field select { height: 44px; }
.flow-field input:focus, .flow-field textarea:focus, .flow-field select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(63, 127, 132,.1); }
.flow-field input:invalid:not(:placeholder-shown), .flow-field textarea:invalid:not(:placeholder-shown) { border-color: var(--red); }
.flow-field small { color: var(--muted); font-size: 11px; line-height: 1.45; }
.offer-fields { padding: 20px; border: 1px solid #c5d8d4; border-radius: 16px; background: #edf5f3; }
.offer-fields[hidden] { display: none; }
.offer-fields-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.offer-fields-head .section-label { margin: 0 0 5px; }
.offer-fields-head h3 { margin: 0; font-size: 20px; }
.offer-fields-head > span { padding: 6px 9px; border-radius: 99px; background: #d8e9e5; color: var(--green-dark); font-size: 10px; font-weight: 850; text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; }
.offer-note { margin: 12px 0 18px; padding: 11px 13px; border-left: 3px solid var(--orange); background: rgba(255,255,255,.58); color: var(--muted); font-size: 12px; line-height: 1.5; }
.offer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.collect-section { padding-top: 21px; border-top: 1px solid var(--line); }
.collect-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.collect-head h3 { margin: 0; font-size: 18px; }
.collect-head p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.compact-button { min-height: 38px; padding: 0 14px; font-size: 12px; }
.collect-list { display: grid; gap: 10px; margin-top: 17px; }
.collect-row { display: grid; grid-template-columns: minmax(140px, .8fr) minmax(180px, 1.3fr) auto auto; gap: 10px; align-items: end; padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: #f5f8f7; }
.collect-row .flow-field > span { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.required-toggle { height: 44px; display: flex; align-items: center; gap: 7px; padding: 0 5px; color: var(--muted); font-size: 11px; font-weight: 750; white-space: nowrap; }
.required-toggle input { width: 16px; height: 16px; accent-color: var(--green); }
.collect-row .icon-btn { width: 44px; height: 44px; color: var(--red); font-size: 20px; }
.collect-empty { margin: 16px 0 0; padding: 18px; border: 1px dashed #cbd8d6; border-radius: 13px; color: var(--muted); text-align: center; font-size: 12px; }
.collect-empty[hidden] { display: none; }
.flow-form-error { margin: 20px 0 0; padding: 12px 14px; border-radius: 11px; background: #f3dddb; color: #7d3834; font-size: 12px; line-height: 1.5; }
.flow-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.flow-primary-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.flow-primary-actions [aria-disabled="true"] { opacity: .5; pointer-events: none; }
.danger-button { min-height: 46px; padding: 0 18px; border: 0; border-radius: 13px; background: var(--red); color: white; font-weight: 800; cursor: pointer; }
.danger-button:hover:not(:disabled) { background: #91423e; }
.danger-button:disabled, .download-button:disabled, .ghost-button:disabled { opacity: .5; cursor: not-allowed; }
.confirm-dialog { width: min(430px, calc(100% - 32px)); padding: 0; border: 0; border-radius: 20px; color: var(--ink); background: var(--paper); box-shadow: 0 24px 70px rgba(36, 50, 56, .25); }
.confirm-dialog::backdrop { background: rgba(36, 50, 56, .52); }
.confirm-dialog form { padding: 24px; }
.confirm-dialog h2 { margin: 0; font-size: 22px; }
.confirm-dialog p { margin: 12px 0 23px; color: var(--muted); font-size: 13px; line-height: 1.55; overflow-wrap: anywhere; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }

@keyframes pulse { 50% { box-shadow: 0 0 0 9px rgba(74, 143, 140,0); } }
@keyframes wave { from { transform: scaleY(.48); } to { transform: scaleY(1.08); } }

@media (max-width: 900px) {
  .auth-page { align-items: start; padding: 20px; }
  .auth-shell { width: min(100%, 560px); min-height: 0; grid-template-columns: 1fr; }
  .auth-intro { display: none; }
  .auth-mobile-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 32px; }
  .auth-mobile-brand strong { font-size: 20px; }
  .hero { grid-template-columns: 1fr; padding-top: 52px; gap: 46px; }
  .hero-copy { text-align: center; }
  .hero-text { margin-left: auto; margin-right: auto; }
  .stack-row { justify-content: center; }
  .call-console { max-width: 560px; width: 100%; margin: 0 auto; }
  .workspace { grid-template-columns: 1fr; }
  .phone-dialer { grid-template-columns: 1fr; gap: 22px; }
  .import-panel { grid-template-columns: 1fr; }
  .import-results { grid-column: 1; }
  .import-actions { min-width: 0; justify-items: start; }
  .import-status { text-align: left; }
  .campaign-bar { align-items: flex-start; flex-direction: column; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .flow-builder { grid-template-columns: 1fr; }
  .flow-library { position: static; }
  .flow-library-list { max-height: 260px; }
  .collect-row { grid-template-columns: 1fr 1fr; }
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding: 14px 20px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar .main-nav { flex-direction: row; }
  .sidebar .system-state { margin: 0 0 0 auto; }
  .sidebar .account-summary { margin: 0 0 0 auto; padding: 0 0 0 14px; border-top: 0; border-left: 1px solid var(--line); }
  .page-shell { width: min(100% - 40px, 1120px); }
}

@media (max-width: 580px) {
  .page-shell { width: min(100% - 24px, 1120px); }
  .system-state { font-size: 0; min-width: 0; }
  .hero { padding: 42px 0; }
  h1 { font-size: 32px; }
  .hero-text { font-size: 15px; }
  .call-console, .transcript-panel, .lead-panel, .import-panel { padding: 21px; border-radius: 22px; }
  .phone-dialer { padding: 21px; border-radius: 22px; }
  .dialer-row { grid-template-columns: 1fr; }
  .orb-wrap { height: 165px; }
  .voice-orb { width: 110px; height: 110px; }
  .transcript { height: 370px; }
  .turn { max-width: 92%; }
  footer { flex-direction: column; justify-content: center; text-align: center; }
  .main-nav a { padding: 7px 12px; }
  .table-tools { flex-direction: column; }
  .dash-actions { width: 100%; }
  .dash-utility-actions { width: 100%; }
  .excel-export { width: 100%; min-width: 0; }
  .excel-export-row { grid-template-columns: 1fr; align-items: stretch; }
  .excel-export select, .excel-export .download-button { width: 100%; }
  .excel-export .download-button { justify-content: center; }
  .dash-utility-actions .ghost-button { flex: 1; justify-content: center; }
  .meta { grid-template-columns: 1fr 1fr; }
  .lead-line { grid-template-columns: 1fr; }
  .flow-editor { padding: 20px; }
  .flow-form-grid, .collect-row, .offer-grid { grid-template-columns: 1fr; }
  .collect-row .icon-btn { width: 100%; }
  .required-toggle { height: 34px; }
  .flow-actions { align-items: stretch; flex-direction: column-reverse; }
  .flow-primary-actions { display: grid; }
  .flow-actions .danger-button { width: 100%; }
  .auth-page { padding: 14px; }
  .auth-shell { border-radius: 22px; }
  .auth-card { padding: 28px 22px; }
}

@media print {
  .no-print, .scrim, .drawer { display: none !important; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
