/* ================================================================
   TC Voice Agent v2 - Stylesheet
   Covers: landing, call page, widget, admin, report
   ================================================================ */
:root {
  --navy-900: #0f1e3d;
  --navy-800: #1a2b4a;
  --navy-700: #2a3f63;
  --saffron: #ff9933;
  --gold: #c9a227;
  --ivory: #faf7f0;
  --white: #fff;
  --gray-100: #f3f5f9;
  --gray-300: #cbd5e1;
  --gray-500: #64748b;
  --gray-700: #334155;
  --green: #22c55e;
  --red: #ef4444;
  --amber: #f59e0b;
  --shadow: 0 4px 12px rgba(15,30,61,.08);
  --shadow-md: 0 8px 24px rgba(15,30,61,.12);
  --radius: 12px;
  --radius-sm: 8px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: var(--saffron); }
code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .92em; }

/* ================= LANDING ================= */
.landing { min-height: 100vh; background: linear-gradient(135deg, var(--navy-900), var(--navy-800)); color: var(--white); }
.landing-container { max-width: 1100px; margin: 0 auto; padding: 24px 24px 60px; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 16px 0; margin-bottom: 28px; border-bottom: 1px solid rgba(255,255,255,.1); }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 17px; color: var(--white); }
.brand-logo { width: 40px; height: 40px; border-radius: 8px; background: linear-gradient(135deg, var(--saffron), var(--gold)); display: flex; align-items: center; justify-content: center; font-size: 18px; color: var(--navy-900); font-weight: 800; }
.brand-text small { display: block; font-size: 11px; font-weight: 400; opacity: .7; }
.topbar-links { display: flex; gap: 16px; font-size: 14px; }
.topbar-links a { color: var(--white); opacity: .85; text-decoration: none; }
.hero { display: grid; grid-template-columns: 1.15fr 1fr; gap: 44px; align-items: center; padding: 36px 0; }
.hero-left h1 { font-size: 40px; line-height: 1.15; margin-bottom: 16px; }
.hero-left h1 span { background: linear-gradient(90deg, var(--saffron), var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-subtitle { font-size: 16px; opacity: .85; margin-bottom: 26px; max-width: 540px; }
.hero-cta-row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 30px; }
.btn { display: inline-flex; align-items: center; gap: 10px; padding: 13px 22px; border-radius: var(--radius-sm); font-weight: 600; font-size: 15px; border: none; cursor: pointer; text-decoration: none; transition: all .2s; }
.btn-primary { background: linear-gradient(135deg, var(--saffron), var(--gold)); color: var(--navy-900); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.btn-ghost { background: rgba(255,255,255,.08); color: var(--white); border: 1px solid rgba(255,255,255,.2); }
.btn-ghost:hover { background: rgba(255,255,255,.15); text-decoration: none; }
.hero-stats { display: flex; gap: 26px; }
.stat-num { font-size: 26px; font-weight: 700; color: var(--saffron); }
.stat-label { font-size: 11px; opacity: .7; text-transform: uppercase; letter-spacing: .5px; }
.hero-right { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12); border-radius: var(--radius); padding: 24px; backdrop-filter: blur(10px); }
.preview-header { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; }
.preview-avatar { width: 44px; height: 44px; border-radius: 50%; background: linear-gradient(135deg, var(--saffron), var(--gold)); display: flex; align-items: center; justify-content: center; font-weight: 800; color: var(--navy-900); }
.steps { padding-left: 18px; font-size: 14px; opacity: .92; }
.steps li { margin-bottom: 12px; }
.preview-status { display: flex; align-items: center; gap: 8px; font-size: 12px; opacity: .8; margin-top: 14px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }
.section { padding: 44px 0; }
.section-title { font-size: 26px; text-align: center; margin-bottom: 26px; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(230px,1fr)); gap: 18px; }
.feature-card { background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1); border-radius: var(--radius); padding: 20px; }
.feature-card h3 { font-size: 15px; margin-bottom: 6px; color: var(--saffron); }
.feature-card p { font-size: 13px; opacity: .82; }
.footer { text-align: center; padding: 28px 0; border-top: 1px solid rgba(255,255,255,.1); font-size: 12px; opacity: .6; }
@media (max-width: 820px) { .hero { grid-template-columns: 1fr; } .hero-left h1 { font-size: 30px; } .topbar-links { display: none; } }

/* ================= CALL / WIDGET (tenant colors) ================= */
.call-page { background: var(--bg, var(--navy-900)); color: var(--white); min-height: 100vh; }
.call-shell { max-width: 560px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }
.widget-page { background: var(--bg, var(--navy-900)); color: var(--white); height: 100vh; display: flex; flex-direction: column; overflow: hidden; }

.call-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.widget-header { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid rgba(255,255,255,.08); background: rgba(0,0,0,.15); }
.brand-mini { display: flex; gap: 10px; align-items: center; }
.brand-dot { width: 36px; height: 36px; border-radius: 10px; background: var(--brand, var(--saffron)); color: #10131a; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 17px; }
.brand-mini strong { display: block; font-size: 14px; }
.brand-mini small { font-size: 11px; opacity: .65; }
.wh-info strong { display: block; font-size: 14px; }
.wh-info small { font-size: 11px; opacity: .75; }
.online-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--green); margin-right: 3px; animation: pulse 2s infinite; }
.back-link { color: rgba(255,255,255,.8); font-size: 13px; text-decoration: none; background: rgba(255,255,255,.07); padding: 6px 12px; border-radius: 6px; }

.call-wrap { flex: 1; display: flex; flex-direction: column; padding: 14px 16px; min-height: 0; }

.call-status { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.pill { padding: 5px 14px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill-ready { background: rgba(255,255,255,.1); color: rgba(255,255,255,.8); }
.pill-listening { background: rgba(255,153,51,.18); color: var(--brand, var(--saffron)); border: 1px solid var(--brand, var(--saffron)); animation: pulse 1.6s infinite; }
.pill-thinking { background: rgba(59,130,246,.18); color: #7cb0ff; border: 1px solid #3b82f6; }
.pill-speaking { background: rgba(34,197,94,.15); color: #4ade80; border: 1px solid #22c55e; }
.pill-idle { background: rgba(255,255,255,.08); color: rgba(255,255,255,.5); }
.call-timer { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--brand, var(--saffron)); font-size: 15px; }
.icon-btn { margin-left: auto; background: rgba(255,255,255,.08); color: rgba(255,255,255,.85); border: 1px solid rgba(255,255,255,.14); border-radius: 8px; padding: 6px 10px; font-size: 12px; cursor: pointer; }

.banner { background: rgba(245,158,11,.14); border: 1px solid rgba(245,158,11,.4); color: #fcd34d; border-radius: var(--radius-sm); padding: 10px 12px; font-size: 12.5px; margin-bottom: 10px; }
.resume-row { display: flex; align-items: center; gap: 10px; background: rgba(59,130,246,.12); border: 1px solid rgba(59,130,246,.4); border-radius: var(--radius-sm); padding: 9px 12px; font-size: 12.5px; margin-bottom: 10px; }
.resume-row span { flex: 1; }
.mini-btn { background: var(--brand, var(--saffron)); color: #10131a; border: none; border-radius: 6px; padding: 6px 12px; font-weight: 700; font-size: 12px; cursor: pointer; }
.mini-btn.ghost { background: rgba(255,255,255,.1); color: var(--white); }

.transcript { flex: 1; overflow-y: auto; background: rgba(0,0,0,.22); border-radius: var(--radius); padding: 16px; min-height: 220px; }
.t-msg { margin-bottom: 12px; max-width: 86%; }
.t-msg.agent { margin-right: auto; }
.t-msg.caller { margin-left: auto; text-align: right; }
.t-msg.interim { opacity: .6; }
.t-meta { font-size: 10px; opacity: .55; margin: 0 6px 3px; text-transform: uppercase; letter-spacing: .5px; }
.t-bubble { display: inline-block; padding: 10px 14px; border-radius: 14px; font-size: 14px; line-height: 1.5; text-align: left; }
.t-msg.agent .t-bubble { background: rgba(255,153,51,.13); border: 1px solid rgba(255,153,51,.28); border-top-left-radius: 4px; }
.t-msg.caller .t-bubble { background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.18); border-top-right-radius: 4px; }
.typing span { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--brand, var(--saffron)); margin-right: 4px; animation: blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%,100%{opacity:.25} 50%{opacity:1} }

.lead-strip { display: flex; gap: 8px; margin: 10px 0; }
.lead-cell { flex: 1; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.09); border-radius: var(--radius-sm); padding: 7px 10px; min-width: 0; }
.lead-cell small { display: block; font-size: 9.5px; text-transform: uppercase; letter-spacing: .4px; opacity: .55; }
.lead-cell strong { font-size: 12.5px; color: var(--brand, var(--saffron)); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.dock { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 12px; background: rgba(0,0,0,.22); border-radius: var(--radius); }
.dock-btn { width: 58px; height: 58px; border-radius: 50%; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: transform .15s, box-shadow .15s; }
.dock-btn:disabled { opacity: .35; cursor: not-allowed; }
.dock-btn.start { background: var(--green); color: white; }
.dock-btn.start:hover:not(:disabled) { transform: scale(1.06); box-shadow: 0 0 0 8px rgba(34,197,94,.18); }
.dock-btn.ready { background: var(--brand, var(--saffron)); color: #10131a; }
.dock-btn.ready:hover { transform: scale(1.06); }
.dock-btn.listening { background: var(--brand, var(--saffron)); color: #10131a; animation: micPulse 1.4s infinite; }
@keyframes micPulse { 0%,100%{box-shadow:0 0 0 0 rgba(255,153,51,.45)} 50%{box-shadow:0 0 0 12px rgba(255,153,51,0)} }
.dock-btn.speaking { background: var(--red); color: white; }
.dock-btn.stop { width: 46px; height: 46px; background: rgba(239,68,68,.16); color: #fca5a5; border: 1px solid rgba(239,68,68,.5); }
.dock-btn.stop:hover { background: rgba(239,68,68,.3); }
.dock-btn.end { width: 46px; height: 46px; background: rgba(239,68,68,.9); color: white; }
.dock-btn.end:hover:not(:disabled) { transform: scale(1.06); }
.dock-btn.end:disabled { background: rgba(255,255,255,.12); color: rgba(255,255,255,.4); }
.dock-btn.repeat { width: 46px; height: 46px; background: rgba(255,255,255,.09); color: rgba(255,255,255,.8); border: 1px solid rgba(255,255,255,.15); }
.dock-label { font-size: 12px; font-weight: 600; opacity: .8; width: 76px; }

.chat-row { display: flex; gap: 8px; margin-top: 10px; }
.chat-row input { flex: 1; background: rgba(0,0,0,.25); border: 1px solid rgba(255,255,255,.15); color: var(--white); border-radius: 10px; padding: 11px 14px; font-size: 14px; outline: none; }
.chat-row input:focus { border-color: var(--brand, var(--saffron)); }
.chat-row button { width: 46px; background: var(--brand, var(--saffron)); color: #10131a; border: none; border-radius: 10px; cursor: pointer; display: flex; align-items: center; justify-content: center; }

.settings { background: rgba(0,0,0,.25); border: 1px solid rgba(255,255,255,.1); border-radius: var(--radius); padding: 14px; margin-top: 10px; }
.set-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 13px; flex-wrap: wrap; }
.set-row label { min-width: 120px; opacity: .8; }
.set-row select, .set-row input[type=range] { flex: 1; min-width: 120px; }
.set-row select { background: var(--navy-800); color: var(--white); border: 1px solid rgba(255,255,255,.2); border-radius: 6px; padding: 6px 8px; max-width: 240px; }
.radio { display: flex; gap: 6px; align-items: center; min-width: 0 !important; }
.call-footer { text-align: center; font-size: 11px; opacity: .5; padding: 10px; }

/* ================= ADMIN / DASHBOARD ================= */
.dashboard-page { background: var(--gray-100); min-height: 100vh; color: var(--navy-900); }
.dash-header { background: var(--navy-900); color: var(--white); padding: 14px 24px; display: flex; align-items: center; justify-content: space-between; }
.dash-header .brand { color: var(--white); }
.hdr-link { color: rgba(255,255,255,.8); font-size: 13px; text-decoration: none; background: rgba(255,255,255,.07); padding: 7px 13px; border-radius: 7px; }
.hdr-link:hover { background: rgba(255,255,255,.15); }
.dash-container { max-width: 1200px; margin: 0 auto; padding: 24px; display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 900px) { .dash-container { grid-template-columns: 1fr; } }
.dash-card { background: var(--white); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.dash-card h3 { font-size: 15.5px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.count { background: var(--saffron); color: var(--navy-900); padding: 2px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.dash-stats { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin-bottom: 20px; grid-column: 1/-1; }
.dash-stat { background: var(--white); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.dash-stat-num { font-size: 24px; font-weight: 700; color: var(--saffron); }
.dash-stat-label { font-size: 11.5px; color: var(--gray-500); text-transform: uppercase; letter-spacing: .4px; }

.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th { text-align: left; background: var(--navy-900); color: var(--white); padding: 9px 10px; font-size: 12px; }
.admin-table td { padding: 9px 10px; border-bottom: 1px solid var(--gray-100); vertical-align: top; }
.admin-table tr:nth-child(even) td { background: #f8fafc; }
.manage-cell a { display: inline-block; margin: 0 8px 4px 0; font-size: 12px; background: var(--gray-100); padding: 4px 9px; border-radius: 6px; text-decoration: none; color: var(--navy-800); font-weight: 600; }
.manage-cell a:hover { background: #e8edf5; }
.desc-cell { max-width: 260px; color: var(--gray-500); }
.del-btn { background: rgba(239,68,68,.1); color: var(--red); border: 1px solid rgba(239,68,68,.3); border-radius: 6px; padding: 5px 10px; font-size: 12px; font-weight: 600; cursor: pointer; }
.del-btn:hover { background: rgba(239,68,68,.2); }

.inline-form { display: flex; gap: 10px; flex-wrap: wrap; }
.inline-form input { flex: 1; min-width: 260px; padding: 11px 14px; border: 1px solid var(--gray-300); border-radius: var(--radius-sm); font-size: 14px; }
.hint { font-size: 12.5px; color: var(--gray-500); margin-top: 8px; }
.flash-ok { background: rgba(34,197,94,.12); border: 1px solid rgba(34,197,94,.4); color: #15803d; padding: 12px 16px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; }
.form-error { background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.4); color: #b91c1c; padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13.5px; margin-bottom: 12px; }

.key-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.key-grid label { font-size: 11.5px; color: var(--gray-500); text-transform: uppercase; letter-spacing: .4px; display: block; margin-bottom: 4px; }
.key-box { display: block; background: var(--gray-100); border: 1px solid var(--gray-300); border-radius: 6px; padding: 8px 12px; font-size: 12.5px; word-break: break-all; }
.quick-links { display: flex; gap: 12px; flex-wrap: wrap; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }
.settings-form label { font-size: 12.5px; font-weight: 600; color: var(--gray-700); display: block; margin-bottom: 5px; }
.settings-form input[type=text] { width: 100%; padding: 10px 12px; border: 1px solid var(--gray-300); border-radius: var(--radius-sm); font-size: 14px; }
.settings-form textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--gray-300); border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 12px; }
.check-row { display: flex; align-items: center; gap: 8px; margin: 12px 0; font-size: 14px; }

.upload-form label { font-size: 12.5px; font-weight: 600; color: var(--gray-700); display: block; margin: 12px 0 5px; }
.upload-form input[type=file] { width: 100%; padding: 10px; border: 1px dashed var(--gray-300); border-radius: var(--radius-sm); background: var(--gray-100); }
.upload-form textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--gray-300); border-radius: var(--radius-sm); font-size: 13px; font-family: ui-monospace, Menlo, monospace; }
.upload-form select { padding: 9px 12px; border: 1px solid var(--gray-300); border-radius: var(--radius-sm); margin: 5px 0 14px; font-size: 13.5px; }
.format-help { margin-top: 14px; border-top: 1px solid var(--gray-100); padding-top: 12px; }
.format-help summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--gray-700); }
.fmt pre { background: var(--navy-900); color: #ffd9a3; border-radius: 8px; padding: 12px; font-size: 12px; overflow-x: auto; margin: 8px 0 14px; }
.fmt b { font-size: 12.5px; display: block; margin-top: 6px; }
.single-form { display: flex; flex-wrap: wrap; gap: 8px; }
.single-form input, .single-form select { padding: 9px 11px; border: 1px solid var(--gray-300); border-radius: var(--radius-sm); font-size: 13px; }
.single-form input[name=name] { flex: 1; min-width: 160px; }

.code-block { position: relative; background: var(--navy-900); border-radius: var(--radius-sm); padding: 16px; margin-top: 8px; }
.code-block pre { color: #ffd9a3; font-size: 12.5px; overflow-x: auto; white-space: pre-wrap; word-break: break-all; }
.copy-btn { position: absolute; top: 10px; right: 10px; background: var(--saffron); color: var(--navy-900); border: none; border-radius: 6px; padding: 6px 14px; font-weight: 700; font-size: 12px; cursor: pointer; }
.platform-guide details { border: 1px solid var(--gray-100); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 8px; background: #fcfdff; }
.platform-guide summary { cursor: pointer; font-weight: 700; font-size: 13.5px; }
.platform-guide ol { margin: 10px 0 4px 20px; font-size: 13px; color: var(--gray-700); }
.platform-guide li { margin-bottom: 6px; }
.note-list { margin-left: 18px; font-size: 13px; color: var(--gray-700); }
.note-list li { margin-bottom: 8px; }

.call-list, .lead-list { max-height: 460px; overflow-y: auto; }
.call-row { padding: 12px; border-radius: var(--radius-sm); background: var(--gray-100); margin-bottom: 8px; font-size: 13px; }
.call-row.live { background: rgba(255,153,51,.08); border-left: 3px solid var(--saffron); }
.call-row .meta, .lead-row-item .meta { display: block; font-size: 11px; color: var(--gray-500); margin-top: 3px; }
.lead-row-item { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--gray-100); margin-bottom: 7px; font-size: 13px; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 5px; font-size: 10.5px; font-weight: 700; margin-left: 6px; }
.tag-catalog { background: rgba(34,197,94,.14); color: #15803d; }
.tag-subscription { background: rgba(255,153,51,.14); color: #b45309; }
.tag-lead { background: rgba(239,68,68,.1); color: #b91c1c; }
.tag-info { background: rgba(59,130,246,.12); color: #1d4ed8; }
.empty-state { text-align: center; padding: 26px; color: var(--gray-500); font-size: 13px; }
.transcript-preview { background: var(--white); border: 1px solid var(--gray-100); padding: 10px; border-radius: 8px; margin-top: 8px; font-size: 12.5px; max-height: 220px; overflow-y: auto; color: var(--gray-700); }
.transcript-preview div { margin-bottom: 4px; }

/* auth */
.admin-auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--navy-900), var(--navy-700)); }
.auth-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow-md); padding: 34px; width: 380px; max-width: 92vw; }
.auth-card .brand-text { color: var(--navy-900); }
.auth-card label { font-size: 12.5px; font-weight: 600; color: var(--gray-700); display: block; margin: 14px 0 5px; }
.auth-card input { width: 100%; padding: 11px 13px; border: 1px solid var(--gray-300); border-radius: var(--radius-sm); font-size: 14px; }
.auth-card .btn { margin-top: 20px; }
.auth-hint { font-size: 11.5px; color: var(--gray-500); text-align: center; margin-top: 16px; }
