:root {
  color-scheme: light dark;
  --primary: #2563eb;
  --primary-strong: #1d4ed8;
  --on-primary: #ffffff;
  --accent: #047857;
  --accent-strong: #065f46;
  --background: #f8fafc;
  --surface: #ffffff;
  --surface-muted: #f1f5f9;
  --text: #0f172a;
  --text-muted: #475569;
  --border: #dbe4f0;
  --danger: #b91c1c;
  --focus: #2563eb;
  --shadow: 0 18px 50px rgba(15, 23, 42, .10);
  --radius: 20px;
  font-family: "Plus Jakarta Sans", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --primary: #60a5fa;
    --primary-strong: #93c5fd;
    --on-primary: #0b1220;
    --accent: #34d399;
    --accent-strong: #6ee7b7;
    --background: #07111f;
    --surface: #101c2d;
    --surface-muted: #17263a;
    --text: #f8fafc;
    --text-muted: #b8c5d6;
    --border: #2a3b52;
    --danger: #fca5a5;
    --focus: #93c5fd;
    --shadow: 0 18px 50px rgba(0, 0, 0, .32);
  }
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--background); }
body { min-height: 100dvh; margin: 0; background: var(--background); color: var(--text); font-size: 16px; line-height: 1.55; }
button, input, textarea { font: inherit; }
button, a { touch-action: manipulation; }
[hidden] { display: none !important; }

.skip-link { position: fixed; top: 8px; left: 8px; z-index: 100; padding: 10px 14px; background: var(--surface); color: var(--text); transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }
.app-bar { display: flex; min-height: 64px; align-items: center; justify-content: space-between; gap: 12px; padding: max(12px, env(safe-area-inset-top)) 20px 12px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--background) 92%, transparent); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 750; letter-spacing: -.02em; }
.brand-mark { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 11px; background: var(--primary); color: var(--on-primary); }
.brand-mark svg { width: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.shell { width: min(100%, 620px); margin: 0 auto; padding: 24px 16px max(32px, env(safe-area-inset-bottom)); }
.panel { padding: clamp(24px, 6vw, 40px); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); animation: appear 220ms ease-out; }
.panel:focus { outline: none; }
.eyebrow { margin: 0 0 8px; color: var(--primary-strong); font-size: .78rem; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(2rem, 9vw, 3.5rem); line-height: 1.02; letter-spacing: -.045em; }
.lede { max-width: 52ch; margin: 18px 0 26px; color: var(--text-muted); }
.meta, .helper { color: var(--text-muted); font-size: .875rem; }
.badge { display: inline-flex; min-height: 30px; align-items: center; padding: 4px 10px; border-radius: 999px; font-size: .75rem; font-weight: 750; }
.badge-waiting { background: var(--surface-muted); color: var(--text-muted); }
.badge-ready, .badge-new { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); color: var(--accent-strong); }
.button { display: inline-flex; width: 100%; min-height: 52px; align-items: center; justify-content: center; gap: 10px; padding: 12px 18px; border: 1px solid transparent; border-radius: 14px; cursor: pointer; font-weight: 750; transition: background-color 180ms ease, border-color 180ms ease, opacity 180ms ease; }
.button:active { opacity: .78; }
.button:disabled { cursor: not-allowed; opacity: .48; }
.button-primary { background: var(--primary); color: var(--on-primary); }
.button-primary:hover { background: var(--primary-strong); }
.button-secondary { border-color: var(--border); background: var(--surface-muted); color: var(--text); }
.button-call { margin-top: 24px; background: var(--accent); color: #fff; }
.button-call:hover { background: var(--accent-strong); }
.button-call svg { width: 22px; fill: currentColor; }
.button-quiet { margin-top: 10px; background: transparent; color: var(--text-muted); }
.button-warning { margin: -8px 0 24px; border-color: var(--border); background: var(--surface-muted); color: var(--text); }
.button-danger { background: var(--danger); color: #fff; }
.button:focus-visible, input:focus-visible, textarea:focus-visible, .outcome-option:has(input:focus-visible) { outline: 3px solid color-mix(in srgb, var(--focus) 52%, transparent); outline-offset: 3px; }
label, legend { display: block; margin-bottom: 8px; font-weight: 750; }
input, textarea { width: 100%; min-height: 50px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--background); color: var(--text); }
textarea { resize: vertical; }
.field-group { margin: 24px 0; }
.field-error { min-height: 24px; margin: 8px 0; color: var(--danger); font-weight: 650; }
.input-action { position: relative; }
.input-action input { padding-right: 92px; }
.input-button { position: absolute; top: 5px; right: 5px; min-height: 40px; padding: 6px 12px; border: 0; border-radius: 9px; background: var(--surface-muted); color: var(--text); cursor: pointer; font-weight: 700; }
fieldset { margin: 24px 0; padding: 0; border: 0; }
.outcome-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.outcome-option { display: flex; min-height: 54px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--background); cursor: pointer; font-size: .9rem; font-weight: 650; }
.outcome-option:has(input:checked) { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 10%, var(--surface)); color: var(--primary-strong); }
.outcome-option input { width: 18px; min-height: 18px; margin: 0 9px 0 0; accent-color: var(--primary); }
.waiting-view { text-align: center; }
.signal { display: flex; height: 60px; align-items: end; justify-content: center; gap: 7px; margin-bottom: 26px; }
.signal span { width: 8px; border-radius: 9px; background: var(--primary); animation: signal 1.4s ease-in-out infinite; }
.signal span:nth-child(1) { height: 22px; }
.signal span:nth-child(2) { height: 38px; animation-delay: 120ms; }
.signal span:nth-child(3) { height: 54px; animation-delay: 240ms; }
.call-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.company { margin: 10px 0 0; color: var(--text-muted); font-size: 1.1rem; }
.phone-number { display: inline-block; margin-top: 20px; color: var(--primary-strong); font-size: clamp(1.35rem, 6vw, 2rem); font-weight: 750; text-decoration-thickness: 2px; text-underline-offset: 5px; }
.context { margin: 20px 0 0; padding: 14px; border-left: 4px solid var(--primary); border-radius: 0 10px 10px 0; background: var(--surface-muted); }
.info-line { margin: 14px 0 0; color: var(--text-muted); font-size: .9rem; }
.notification-panel { margin: 0 0 24px; padding: 16px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-muted); text-align: left; }
.notification-panel p { margin: 4px 0 14px; color: var(--text-muted); font-size: .88rem; }
.notification-panel .button { min-height: 46px; }
.quick-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.chip { min-height: 44px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-muted); color: var(--text); cursor: pointer; font-weight: 650; }
.confirm-dialog { width: min(calc(100% - 32px), 480px); padding: 26px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.confirm-dialog::backdrop { background: rgba(2, 6, 23, .58); }
.confirm-dialog h2 { margin: 0; font-size: 1.5rem; }
.confirm-dialog p { color: var(--text-muted); }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 24px; }
.success-view #retryButton { margin-bottom: 10px; }
.success-view { text-align: center; }
.success-icon { display: grid; width: 72px; height: 72px; margin: 0 auto 24px; place-items: center; border-radius: 50%; background: color-mix(in srgb, var(--accent) 16%, var(--surface)); color: var(--accent-strong); }
.success-icon svg { width: 38px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.toast { position: fixed; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); left: 16px; z-index: 20; max-width: 520px; margin: 0 auto; padding: 13px 16px; border-radius: 12px; background: var(--text); color: var(--surface); box-shadow: var(--shadow); }

@keyframes appear { from { opacity: 0; transform: translateY(8px); } }
@keyframes signal { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
@media (min-width: 640px) { .shell { padding-top: 48px; } }
@media (max-width: 380px) { .outcome-grid { grid-template-columns: 1fr; } .badge { font-size: .7rem; } }
@media (orientation: landscape) and (max-height: 600px) { .shell { width: min(100%, 760px); } .panel { padding: 24px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }
