:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #09111f;
  color: #f3f8ff;
  --ink-soft: #a9bacb;
  --mint: #a7f3df;
  --aqua: #70c6db;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(ellipse 58% 44% at 50% 35%, #12394b80 0%, transparent 72%),
    radial-gradient(circle at 92% 3%, #32436966 0%, transparent 28%),
    linear-gradient(165deg, #0d1829, #09111f 70%);
}
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: wait; }
button:focus-visible, input:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 2px solid var(--mint); outline-offset: 3px;
}

.shell {
  width: min(100%, 780px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: max(22px, env(safe-area-inset-top)) 22px max(20px, env(safe-area-inset-bottom));
}
.brand { display: flex; align-items: center; gap: 11px; font-size: 1.16rem; font-weight: 730; letter-spacing: -.02em; }
.brand-mark { width: 38px; height: 38px; border-radius: 12px; overflow: hidden; box-shadow: 0 0 20px #85e9de33; }
.brand-mark img { display: block; }
.brand-caption { margin-left: auto; color: #8fa9be; font-size: .73rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.brand-admin-link { color: #bfd8e2; font-size: .82rem; text-transform: none; letter-spacing: 0; text-decoration: underline; text-underline-offset: 3px; }
.brand-admin-link:focus-visible { outline: 2px solid var(--mint); outline-offset: 4px; }
.loading { margin: auto; color: var(--ink-soft); }
.eyebrow { color: #9bd8d6; font-size: .72rem; font-weight: 750; letter-spacing: .17em; text-transform: uppercase; }
.muted { color: var(--ink-soft); line-height: 1.55; }
.message { min-height: 1.5em; color: #ffcfaa; font-size: .88rem; text-align: center; }

.login-panel {
  width: 100%; max-width: 510px; margin: auto; padding: clamp(28px, 6vw, 48px);
  border: 1px solid #b0d3ec27; border-radius: 30px;
  background: linear-gradient(150deg, #ffffff0e, #ffffff05);
  box-shadow: 0 32px 90px #0005;
}
.login-panel h1 { margin: 12px 0 4px; font-size: clamp(2.4rem, 7vw, 3.8rem); letter-spacing: -.055em; }
.login-panel form { display: grid; gap: 9px; margin-top: 30px; }
label { font-size: .86rem; font-weight: 650; color: #d6e4ef; }
input, textarea {
  width: 100%; min-height: 48px; padding: 12px 15px; border: 1px solid #a3c8d546;
  border-radius: 13px; background: #101e2e; color: #fff;
}
input:focus, textarea:focus { border-color: var(--mint); }
.login-panel form button, .text-form button {
  min-height: 50px; margin-top: 14px; border: 0; border-radius: 13px;
  background: var(--mint); color: #09222b; font-weight: 760;
}

.experience { width: 100%; flex: 1; display: flex; flex-direction: column; }
.experience-top { display: flex; align-items: center; justify-content: space-between; margin-top: 24px; }
.quiet-button { border: 0; background: none; color: #a6bbcd; font-size: .85rem; padding: 9px 0 9px 14px; }
.quiet-button:hover { color: white; }

.stage {
  flex: 1; min-height: 420px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; text-align: center; padding: 10px 0 18px;
  --glow: #75d8d6; --glow-soft: #346d90;
}
.stage[data-state="speaking"] { --glow: #b7f9e1; --glow-soft: #3dbcae; }
.stage[data-state="processing"], .stage[data-state="transcribing"], .stage[data-state="validating"] { --glow: #93aefb; --glow-soft: #5466bd; }
.stage[data-state="responding"] { --glow: #f5d3a7; --glow-soft: #ad6e66; }
.stage[data-state="ignored"], .stage[data-state="error"] { --glow: #f3a7a2; --glow-soft: #aa626f; }
.stage[data-state="idle"], .stage[data-state="typing"] { --glow: #8da9b5; --glow-soft: #3b6171; }
.orb-wrap { position: relative; width: min(68vw, 294px); aspect-ratio: 1; display: grid; place-items: center; isolation: isolate; }
.orb-halo, .orb-field, .orb-core { position: absolute; border-radius: 50%; }
.orb-halo { border: 1px solid color-mix(in srgb, var(--glow) 38%, transparent); }
.halo-outer { width: 98%; aspect-ratio: 1; animation: halo 5.2s ease-in-out infinite; }
.halo-inner { width: 78%; aspect-ratio: 1; animation: halo 4.1s ease-in-out infinite reverse; }
.orb-field {
  width: 67%; aspect-ratio: 1;
  background: radial-gradient(circle, color-mix(in srgb, var(--glow) 22%, transparent), transparent 65%);
  filter: blur(13px); transform: scale(calc(1 + var(--level) * .85));
  transition: transform .11s ease-out;
}
.orb-core {
  width: 56%; aspect-ratio: 1; display: grid; place-items: center;
  border: 1px solid color-mix(in srgb, var(--glow) 55%, transparent);
  background:
    radial-gradient(circle at 40% 27%, color-mix(in srgb, var(--glow) 40%, transparent), transparent 48%),
    radial-gradient(circle at 67% 78%, var(--glow-soft), #152638 78%);
  box-shadow: inset 0 0 28px #ffffff12, 0 0 calc(30px + var(--level) * 45px) color-mix(in srgb, var(--glow) 40%, transparent);
  transform: scale(calc(1 + var(--level) * .28));
  transition: transform .11s ease-out, box-shadow .2s ease;
  animation: breathe 4.4s ease-in-out infinite;
}
.orb-letter { font-size: clamp(3.7rem, 17vw, 5.6rem); font-weight: 820; color: #e6fff5; letter-spacing: -.1em; transform: translateX(-.06em); text-shadow: 0 0 28px #b0fff690; }
.orb-spark { position: absolute; width: 4px; height: 4px; border-radius: 50%; background: var(--glow); box-shadow: 0 0 12px var(--glow); }
.spark-one { top: 7%; left: 33%; }
.spark-two { top: 71%; right: 4%; width: 3px; height: 3px; }
.spark-three { bottom: 13%; left: 8%; width: 2px; height: 2px; }
.stage[data-state="processing"] .orb-core, .stage[data-state="transcribing"] .orb-core, .stage[data-state="validating"] .orb-core { animation: processing 1.8s linear infinite; }
.stage[data-state="speaking"] .halo-outer { animation-duration: 3.4s; }
.stage[data-state="responding"] .halo-inner { animation-duration: 2.4s; }
.stage-copy { margin-top: 16px; max-width: 470px; }
.stage-copy .eyebrow { margin: 0 0 8px; }
.stage-copy h1 { margin: 0; font-size: clamp(2.15rem, 8vw, 3.5rem); line-height: 1.1; letter-spacing: -.055em; }
.stage-copy .muted { min-height: 3em; margin: 12px 0 0; font-size: .95rem; }
.transcript-panel { padding: 16px 18px; border: 1px solid #a1e4df32; border-radius: 16px; background: #a1e4df0c; }
.transcript-label { color: #9bd8d6; font-size: .69rem; font-weight: 750; letter-spacing: .14em; text-transform: uppercase; }
.transcript-panel p { margin: 8px 0 0; line-height: 1.5; overflow-wrap: anywhere; }
.primary-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; margin-top: 20px; }
.action { min-height: 60px; border-radius: 16px; font-size: .91rem; font-weight: 750; }
.action-quiet { border: 1px solid #aac9d340; background: #ffffff08; color: #e3edf5; }
.action-quiet:hover { background: #ffffff17; }
.action-primary { border: 1px solid #bbf6e6; background: linear-gradient(145deg, #b8f5e4, #75d7d5); color: #09222b; box-shadow: 0 10px 35px #4dcbb825; }
.action-primary:hover { filter: brightness(1.08); }
.text-form { margin-top: 18px; display: grid; gap: 10px; }
.text-form textarea { resize: vertical; min-height: 94px; }
.text-form button { margin-top: 0; }
#message-control-status {
  width: min(100%, 470px); margin: 8px auto 18px; padding: 12px 16px;
  border: 1px solid #aac9d340; border-radius: 13px; background: #ffffff09;
  color: #d9e8f2; text-align: center; line-height: 1.45;
}
#message-control-status[data-active="true"] { border-color: #a7f3df88; background: #a7f3df13; color: #c6f8e9; }
.settings-panel { border-top: 1px solid #ffffff17; margin: 14px 0 12px; color: #d7e5ef; }
.settings-panel summary { padding: 18px 0; cursor: pointer; font-size: .84rem; color: #a6c5cd; }
.settings-content { padding: 2px 0 22px; font-size: .87rem; }
.settings-content h2 { font-size: 1rem; margin-top: 25px; }
.settings-content label { display: block; margin: 18px 0 9px; }
.availability-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.availability-actions button { flex: 1 1 175px; min-height: 45px; border: 0; border-radius: 11px; background: var(--mint); color: #09222b; font-size: .84rem; font-weight: 700; }
.availability-actions .secondary { border: 1px solid #8daeb64a; color: #e5f2fa; background: transparent; }
footer { margin-top: auto; padding-top: 12px; color: #6f869b; text-align: center; font-size: .73rem; }

@keyframes halo { 50% { transform: scale(1.09); opacity: .46; } }
@keyframes halo-mobile { 50% { transform: scale(1.04); opacity: .78; } }
@keyframes breathe { 50% { filter: brightness(1.15); } }
@keyframes processing { 50% { filter: hue-rotate(18deg) brightness(1.2); } }
@media (max-width: 520px) {
  .shell { padding-left: 18px; padding-right: 18px; }
  .brand-admin-link { font-size: .74rem; }
  .stage { min-height: 360px; }
  .action { min-height: 55px; font-size: .81rem; }
  .primary-actions { gap: 7px; }
  .halo-outer { animation: halo-mobile 6s ease-in-out infinite !important; }
  .halo-inner { animation: halo-mobile 7.2s ease-in-out infinite -3s !important; }
  .orb-core { animation: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
.admin-nav { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1rem 0 2rem; }
.admin-nav button { width: auto; padding: .55rem .8rem; }
.contact-row { display: flex; align-items: center; flex-wrap: wrap; gap: .8rem; padding: .8rem 0; border-bottom: 1px solid #526071; }
.contact-row span { flex: 1 1 15rem; overflow-wrap: anywhere; }
.contact-row label { display: inline-flex; align-items: center; gap: .2rem; }
.contact-row button { width: auto; }
#whatsapp-contact-list {
  max-height: 36rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding: 0 .75rem;
  border: 1px solid #526071;
  border-radius: 13px;
}
#whatsapp-contact-list .contact-row { padding: .45rem 0; }
.whatsapp-settings-form { display: grid; gap: .5rem; max-width: 24rem; margin: 1.5rem 0; }
.whatsapp-settings-form button { justify-self: start; }
#admin-panel input { max-width: 100%; }
#whatsapp-qr-image { display: block; max-width: 100%; width: 320px; height: 320px; margin: 1rem auto; background: #fff; padding: 10px; border-radius: 12px; }
#whatsapp-qr-image[hidden] { display: none; }
