/* Casava intern portal. Same tokens as the public site's styles.css. */
:root {
  --bg: #ffffff;
  --soft: #f3f5f2;
  --line: #e1e4df;
  --text: #111311;
  --muted: #5c625c;
  --accent: #15803d;
  --accent-hover: #116932;
  --accent-soft: #e7f4ec;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --bad: #b91c1c;
  --bad-soft: #fee2e2;
  --blue: #1e40af;
  --blue-soft: #dbeafe;
  --font: "Geist", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--soft); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
.hl { background: linear-gradient(90deg, #15803d, #22c55e 55%, #0d9488); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 30; background: rgba(255,255,255,.94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar .in { display: flex; align-items: center; gap: 16px; height: 60px; padding: 0 20px; max-width: 1400px; margin: 0 auto; }
.logo { font-weight: 800; font-size: 1.25rem; letter-spacing: -.04em; color: var(--text); text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.mark { width: 22px; height: 22px; border-radius: 7px; background: var(--accent); position: relative; display: inline-block; }
.mark::after { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: #fff; }
.role-chip { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
.topbar .sp { flex: 1; }
.who { font-size: 14px; color: var(--muted); }
.demo-flag { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); }

/* Layout */
.shell { display: grid; grid-template-columns: 220px 1fr; max-width: 1400px; margin: 0 auto; min-height: calc(100vh - 60px); }
.side { padding: 20px 12px; border-right: 1px solid var(--line); background: var(--bg); }
.side button { display: flex; width: 100%; align-items: center; gap: 10px; text-align: left; background: none; border: 0; padding: 10px 12px; border-radius: 10px; cursor: pointer; font-weight: 500; color: var(--muted); }
.side button:hover { background: var(--soft); color: var(--text); }
.side button.on { background: var(--text); color: #fff; }
.side .count { margin-left: auto; font-size: 12px; background: var(--soft); color: var(--text); border-radius: 999px; padding: 1px 8px; }
.side button.on .count { background: rgba(255,255,255,.18); color: #fff; }
.main { padding: 24px; min-width: 0; }
.main h1 { font-size: 1.6rem; letter-spacing: -.03em; margin: 0 0 4px; }
.main .lede { color: var(--muted); margin: 0 0 20px; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: flex; overflow-x: auto; gap: 4px; padding: 8px; border-right: 0; border-bottom: 1px solid var(--line); }
  .side button { width: auto; white-space: nowrap; }
  .main { padding: 16px; }
}

/* Cards */
.card { background: var(--bg); border: 1px solid var(--line); border-radius: 16px; padding: 20px; }
.card h2 { font-size: 1.05rem; margin: 0 0 12px; letter-spacing: -.01em; }
.card h3 { font-size: .95rem; margin: 0 0 8px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.dial-grid { display: grid; gap: 16px; grid-template-columns: minmax(0,1.4fr) minmax(0,1fr); }
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); } .dial-grid { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } }
.stack > * + * { margin-top: 16px; }

.kpi small { display: block; color: var(--muted); font-size: 13px; }
.kpi b { font-size: 1.7rem; letter-spacing: -.03em; display: block; line-height: 1.2; }
.kpi .sub { font-size: 13px; color: var(--muted); }
.bar { height: 8px; background: var(--soft); border-radius: 999px; overflow: hidden; margin-top: 10px; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.bar.warn i { background: #f59e0b; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 600; font-size: 14px; padding: 10px 18px; border-radius: 999px; border: 1px solid transparent; cursor: pointer; text-decoration: none; transition: background .15s; white-space: nowrap; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-dark { background: var(--text); color: #fff; }
.btn-dark:hover { background: #2b302b; }
.btn-ghost { background: var(--bg); border-color: var(--line); color: var(--text); }
.btn-ghost:hover { background: var(--soft); }
.btn-bad { background: var(--bad); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 14px 26px; font-size: 16px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }

/* Forms */
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=datetime-local], input[type=number], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg);
}
textarea { min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.field + .field { margin-top: 12px; }

/* Tables */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--soft); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-variant-numeric: tabular-nums; }

/* Pills */
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: var(--soft); color: var(--text); white-space: nowrap; }
.pill.green { background: var(--accent-soft); color: var(--accent); }
.pill.amber { background: var(--warn-soft); color: var(--warn); }
.pill.red { background: var(--bad-soft); color: var(--bad); }
.pill.blue { background: var(--blue-soft); color: var(--blue); }
.pill.dark { background: var(--text); color: #fff; }
.score { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 10px; font-weight: 700; }
.score.hi { background: var(--accent-soft); color: var(--accent); }
.score.mid { background: var(--warn-soft); color: var(--warn); }
.score.lo { background: var(--bad-soft); color: var(--bad); }

/* Dialer */
.lead-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.lead-head h2 { font-size: 1.4rem; margin: 0; letter-spacing: -.02em; }
.phone-big { font-size: 1.3rem; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 16px 0; }
.facts div { background: var(--soft); border-radius: 10px; padding: 8px 12px; }
.facts small { display: block; color: var(--muted); font-size: 12px; }
.call-live { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 12px; background: var(--text); color: #fff; }
.call-live .dot { width: 10px; height: 10px; border-radius: 50%; background: #22c55e; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.consent { border-radius: 12px; padding: 12px 14px; background: var(--blue-soft); color: var(--blue); font-size: 14px; }
.consent.strict { background: var(--warn-soft); color: var(--warn); }
.dispo { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.dispo button { padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); cursor: pointer; text-align: left; }
.dispo button:hover { border-color: var(--text); }
.dispo button b { display: block; font-size: 14px; }
.dispo button small { color: var(--muted); font-size: 12px; }
.dispo button.dnc { border-color: #fecaca; }
.queue-item { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.queue-item:last-child { border-bottom: 0; }
.queue-item .nm { flex: 1; min-width: 0; }
.queue-item .nm b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note { background: var(--soft); border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.note small { color: var(--muted); display: block; font-size: 12px; }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }

/* Drawer + modal */
.overlay { position: fixed; inset: 0; background: rgba(17,19,17,.45); z-index: 50; display: none; }
.overlay.open { display: block; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 100%); background: var(--bg); z-index: 60; transform: translateX(100%); transition: transform .2s; overflow-y: auto; padding: 24px; box-shadow: -10px 0 30px rgba(0,0,0,.12); }
.drawer.open { transform: none; }
.modal { position: fixed; left: 50%; top: 50%; transform: translate(-50%,-50%); width: min(480px, calc(100% - 32px)); max-height: calc(100vh - 40px); overflow-y: auto; background: var(--bg); border-radius: 18px; padding: 24px; z-index: 60; display: none; }
.modal.open { display: block; }
.x { float: right; background: none; border: 0; font-size: 22px; cursor: pointer; color: var(--muted); line-height: 1; }
.transcript { background: var(--soft); border-radius: 12px; padding: 14px; max-height: 320px; overflow-y: auto; font-size: 14px; }
.transcript p { margin: 0 0 8px; }
.transcript b { font-weight: 600; }
.fb-list { margin: 6px 0 0; padding-left: 18px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: #fff; padding: 12px 18px; border-radius: 12px; z-index: 80; font-size: 14px; display: none; max-width: calc(100% - 32px); }
.toast.show { display: block; }

/* Login */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 500px at 50% -10%, #e7f4ec, transparent), var(--soft); }
.auth .card { width: min(420px, 100%); padding: 28px; }
.auth h1 { font-size: 1.6rem; letter-spacing: -.03em; margin: 18px 0 4px; }
.err { color: var(--bad); font-size: 14px; min-height: 20px; margin-top: 8px; }
.demo-box { margin-top: 18px; padding: 12px 14px; border-radius: 12px; background: var(--soft); font-size: 13px; }
.dropzone { border: 2px dashed var(--line); border-radius: 14px; padding: 26px; text-align: center; color: var(--muted); cursor: pointer; }
.dropzone.hover { border-color: var(--accent); background: var(--accent-soft); }
.integ { display: flex; gap: 12px; align-items: flex-start; padding: 14px 0; border-bottom: 1px solid var(--line); }
.integ:last-child { border-bottom: 0; }
.integ .nm { flex: 1; }
.integ code { font-size: 12px; background: var(--soft); padding: 1px 6px; border-radius: 6px; }

/* ===== Auto-dial session ===== */
.sess-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; background: var(--bg); border: 1px solid var(--line); border-radius: 16px; padding: 14px 18px; margin-bottom: 16px; }
.sess-bar.running { border-color: #86efac; box-shadow: 0 0 0 3px rgba(34,197,94,.12); }
.sess-bar.paused { border-color: #fcd34d; background: #fffbeb; }
.sess-state { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.sess-state .small { display: block; }
.sdot { width: 10px; height: 10px; border-radius: 50%; background: #c7ccc5; flex: none; }
.sess-bar.running .sdot { background: #22c55e; animation: sp 1.4s infinite; }
.sess-bar.paused .sdot { background: #f59e0b; }
@keyframes sp { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,.5); } 70% { box-shadow: 0 0 0 8px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }
.sess-stats { display: flex; gap: 22px; flex: 1; flex-wrap: wrap; }
.sess-stats small { display: block; color: var(--muted); font-size: 12px; }
.sess-stats b { font-size: 18px; font-variant-numeric: tabular-nums; }
.sess-btns { display: flex; gap: 8px; margin-left: auto; }
.btn-lg { padding: 13px 22px; font-size: 15px; }
.start-card { text-align: center; padding: 40px 24px; }
.start-card p { max-width: 46ch; margin: 8px auto 18px; }
.dialing { text-align: center; padding: 34px 24px; }
.dialing h2 { margin: 6px 0 2px; font-size: 24px; }
.ring { position: relative; width: 64px; height: 64px; margin: 0 auto 14px; }
.ring span { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--accent); opacity: 0; animation: ring 1.8s infinite; }
.ring span:nth-child(2) { animation-delay: .6s; } .ring span:nth-child(3) { animation-delay: 1.2s; }
.ring::after { content: ""; position: absolute; inset: 20px; border-radius: 50%; background: var(--accent); }
@keyframes ring { 0% { transform: scale(.4); opacity: .9; } 100% { transform: scale(1.3); opacity: 0; } }
.call-live.done { background: var(--soft); color: var(--text); }
.call-live.done .dot { background: #9ca39b; animation: none; }
.qhead, .queue-item.q3 { display: grid; grid-template-columns: 1.6fr 1fr auto; gap: 10px; align-items: center; }
.qhead { padding: 0 0 6px; border-bottom: 1px solid var(--line); }
@media (prefers-reduced-motion: reduce) { .ring span, .sess-bar.running .sdot { animation: none; } }
@media (max-width: 700px) { .sess-btns { margin-left: 0; width: 100%; } .sess-btns .btn { flex: 1; } }
.pill.dotpill { display: inline-flex; align-items: center; gap: 6px; }
.pill.dotpill i { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill.dotpill.amber i { background: #f59e0b; }
.pill.dotpill.green i { background: #16a34a; }
.pill.dotpill.red i { background: #dc2626; }
.invite-box { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--soft); }
.manual-call { display: inline-block; margin-top: 14px; text-decoration: none; }
