:root {
    --bg: #080b14;
    --panel: rgba(20, 25, 42, .92);
    --panel-soft: rgba(255,255,255,.06);
    --text: #f6f8ff;
    --muted: #aab2c8;
    --primary: #6d5dfc;
    --primary-2: #29c8ff;
    --danger: #ff465c;
    --success: #31d693;
    --border: rgba(255,255,255,.12);
    --shadow: 0 24px 70px rgba(0,0,0,.45);
}
* { box-sizing: border-box; }
html, body, form { min-height: 100%; margin: 0; }
body { font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; background: radial-gradient(circle at 20% 0%, #18224f 0, transparent 34%), radial-gradient(circle at 90% 80%, #2b1556 0, transparent 35%), var(--bg); color: var(--text); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.is-hidden { display: none !important; }
.app-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.precall-card { width: min(680px, 100%); padding: 42px; border: 1px solid var(--border); border-radius: 28px; background: linear-gradient(145deg, rgba(25,31,54,.96), rgba(13,16,28,.92)); box-shadow: var(--shadow); text-align: center; }
.brand-mark { width: 72px; height: 72px; margin: 0 auto 20px; display: grid; place-items: center; border-radius: 24px; font-weight: 900; font-size: 24px; background: linear-gradient(135deg, var(--primary), var(--primary-2)); box-shadow: 0 16px 40px rgba(71,95,255,.35); }
.eyebrow { margin: 0 0 8px; letter-spacing: .18em; color: #8edcff; font-size: 12px; font-weight: 800; }
h1 { margin: 0 0 12px; font-size: clamp(32px, 6vw, 56px); line-height: 1.05; }
.subhead { max-width: 530px; margin: 0 auto 24px; color: var(--muted); line-height: 1.6; }
.notice { padding: 12px 14px; border-radius: 12px; margin: 14px 0; text-align: left; font-size: 14px; }
.notice-warning { background: rgba(255,190,62,.12); border: 1px solid rgba(255,190,62,.35); }
.notice-error { background: rgba(255,70,92,.12); border: 1px solid rgba(255,70,92,.35); }
.notice-success { background: rgba(49,214,147,.12); border: 1px solid rgba(49,214,147,.35); }
.notice-info { background: rgba(41,200,255,.1); border: 1px solid rgba(41,200,255,.3); }
.lead-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 22px; text-align: left; }
.lead-grid .full { grid-column: 1 / -1; }
label { display: grid; gap: 8px; color: #dce1ef; font-weight: 650; font-size: 14px; }
input, textarea, .text-input { width: 100%; padding: 13px 14px; border-radius: 12px; border: 1px solid var(--border); background: rgba(4,7,15,.56); color: var(--text); outline: none; resize: vertical; }
input:focus, textarea:focus, .text-input:focus { border-color: var(--primary-2); box-shadow: 0 0 0 3px rgba(41,200,255,.12); }
.consent-line, .checkbox-row { display: flex; align-items: center; gap: 9px; margin: 16px 0; text-align: left; color: var(--muted); font-weight: 500; }
.consent-line input, .checkbox-row input { width: auto; }
.primary-button, .secondary-button { border: 0; border-radius: 14px; padding: 14px 20px; color: white; font-weight: 800; }
.primary-button { width: 100%; background: linear-gradient(135deg, var(--primary), #515eff); box-shadow: 0 15px 34px rgba(87,80,255,.28); }
.primary-button:disabled { opacity: .45; cursor: not-allowed; }
.secondary-button { background: rgba(255,255,255,.1); border: 1px solid var(--border); }
.button-camera { color: #ff6680; margin-right: 8px; }
.admin-link { display: inline-block; margin-top: 16px; color: #91dfff; font-size: 13px; }
.call-screen { width: min(1180px, 100%); height: min(860px, calc(100vh - 28px)); background: #05070d; border: 1px solid var(--border); border-radius: 26px; overflow: hidden; box-shadow: var(--shadow); display: grid; grid-template-rows: auto 1fr auto; }
.call-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; background: rgba(13,17,29,.94); border-bottom: 1px solid var(--border); }
.call-header > div { display: flex; align-items: center; gap: 12px; }
.status-pill { padding: 5px 9px; border-radius: 999px; font-size: 11px; color: var(--muted); background: rgba(255,255,255,.08); }
.status-pill.online { color: #a9ffdb; background: rgba(49,214,147,.14); }
.status-pill.pending { color: #ffe4a6; background: rgba(255,190,62,.14); }
.status-pill.error { color: #ffbac3; background: rgba(255,70,92,.16); }
.video-stage { min-height: 0; position: relative; background: radial-gradient(circle at center, #17203b 0%, #070a11 68%); }
.agent-container { width: 100%; height: 100%; min-height: 540px; overflow: hidden; }
.agent-container > * { width: 100% !important; height: 100% !important; }
.self-view { position: absolute; right: 18px; top: 18px; width: 190px; aspect-ratio: 3 / 4; border: 2px solid rgba(255,255,255,.55); background: #111522; border-radius: 18px; overflow: hidden; box-shadow: 0 12px 34px rgba(0,0,0,.5); z-index: 8; }
.self-view video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.self-view > span { position: absolute; left: 9px; bottom: 8px; padding: 4px 7px; border-radius: 7px; background: rgba(0,0,0,.62); font-size: 11px; }
.camera-off-label { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); background: #111522; }
.call-controls { display: flex; justify-content: center; gap: 12px; padding: 14px; background: rgba(13,17,29,.98); border-top: 1px solid var(--border); }
.control-button { width: 64px; height: 58px; border: 1px solid var(--border); border-radius: 16px; background: rgba(255,255,255,.08); color: white; display: grid; place-items: center; gap: 1px; }
.control-button span { font-size: 20px; line-height: 1; }
.control-button small { font-size: 10px; color: var(--muted); }
.control-button:hover { background: rgba(255,255,255,.14); }
.control-button.is-off { background: rgba(255,70,92,.2); border-color: rgba(255,70,92,.5); }
.control-button.end-call { background: var(--danger); border-color: var(--danger); }
.mock-agent { height: 100%; min-height: 540px; display: grid; place-items: center; align-content: center; gap: 18px; position: relative; overflow: hidden; }
.mock-agent img { width: min(330px, 58vw); z-index: 2; filter: drop-shadow(0 26px 30px rgba(0,0,0,.35)); }
.avatar-glow { width: 390px; height: 390px; position: absolute; border-radius: 50%; background: radial-gradient(circle, rgba(93,100,255,.56), transparent 70%); animation: breathe 3s ease-in-out infinite; }
.mock-agent.is-speaking img { animation: speakPulse .65s ease-in-out infinite alternate; }
.mock-activity { z-index: 3; padding: 8px 12px; border-radius: 999px; background: rgba(0,0,0,.45); color: #dce5ff; }
.mock-chat { position: absolute; left: 16px; bottom: 16px; width: min(420px, calc(100% - 32px)); z-index: 10; border: 1px solid var(--border); border-radius: 16px; background: rgba(5,8,16,.88); backdrop-filter: blur(12px); overflow: hidden; }
.mock-messages { max-height: 190px; overflow-y: auto; padding: 12px; display: grid; gap: 8px; }
.mock-message { max-width: 84%; padding: 9px 11px; border-radius: 12px; font-size: 13px; line-height: 1.4; }
.mock-message.agent { background: rgba(109,93,252,.25); justify-self: start; }
.mock-message.user { background: rgba(41,200,255,.22); justify-self: end; }
.mock-input-row { display: flex; gap: 8px; padding: 10px; border-top: 1px solid var(--border); }
.mock-input-row input { padding: 10px; }
.mock-input-row button { border: 0; border-radius: 10px; padding: 0 15px; background: var(--primary); color: white; font-weight: 700; }
@keyframes breathe { 50% { transform: scale(1.1); opacity: .75; } }
@keyframes speakPulse { to { transform: scale(1.025); } }

.admin-page { min-height: 100vh; }
.admin-shell { width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 30px 0 80px; }
.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; }
.admin-header h1 { font-size: 38px; }
.admin-header a { color: #9ce7ff; }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.admin-card { display: grid; align-content: start; gap: 14px; padding: 24px; border: 1px solid var(--border); border-radius: 20px; background: var(--panel); box-shadow: 0 14px 40px rgba(0,0,0,.22); }
.admin-card h2 { margin: 0; }
.admin-card p { margin: 0; color: var(--muted); line-height: 1.55; }
.full-card { grid-column: 1 / -1; }
.login-card { width: min(460px, 100%); margin: 70px auto; }
.login-card .primary-button { margin-top: 8px; }
.photo-preview { width: 200px; aspect-ratio: 1; object-fit: cover; border-radius: 18px; border: 1px solid var(--border); }
.form-two-column { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; }
.api-result { min-height: 80px; max-height: 260px; overflow: auto; padding: 12px; border-radius: 12px; background: #05070c; color: #bfe9ff; white-space: pre-wrap; }
.sticky-actions { position: sticky; bottom: 12px; display: flex; gap: 12px; margin-top: 18px; padding: 12px; border: 1px solid var(--border); border-radius: 18px; background: rgba(13,17,29,.9); backdrop-filter: blur(12px); }
.sticky-actions .primary-button { width: auto; min-width: 220px; }
.block-message { display: block; }
.field-error { color: #ff9aaa; }
code { color: #9ce7ff; }

@media (max-width: 760px) {
    .app-shell { padding: 0; }
    .precall-card { border-radius: 0; min-height: 100vh; padding: 28px 18px; display: grid; align-content: center; }
    .lead-grid, .admin-grid, .form-two-column { grid-template-columns: 1fr; }
    .full-card, .lead-grid .full { grid-column: auto; }
    .call-screen { height: 100vh; border: 0; border-radius: 0; }
    .agent-container, .mock-agent { min-height: 0; height: 100%; }
    .self-view { width: 105px; right: 10px; top: 10px; border-radius: 13px; }
    .call-controls { gap: 6px; overflow-x: auto; justify-content: flex-start; }
    .control-button { min-width: 54px; width: 54px; height: 54px; }
    .mock-chat { bottom: 8px; left: 8px; width: calc(100% - 16px); }
    .admin-header { align-items: flex-start; gap: 12px; }
    .sticky-actions { flex-direction: column; }
    .sticky-actions .primary-button { width: 100%; }
}
