/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #0c0c14;
  --surface:     #13131f;
  --surface-2:   #1c1c2e;
  --border:      rgba(255, 255, 255, 0.07);
  --text:        #e2e2ee;
  --text-muted:  #68688a;
  --radius-lg:   20px;
  --radius-md:   12px;
  --radius-sm:   8px;
  --ease:        220ms cubic-bezier(0.4, 0, 0.2, 1);
  --accent:      #7c3aed;
  --font-chat:   0.94rem;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ── Screens ── */
.screen {
  position: fixed;
  inset: 0;
  overflow-y: auto;
  /* padding for iOS safe area */
  padding: env(safe-area-inset-top) env(safe-area-inset-right)
           env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.hidden { display: none !important; }

/* Para file inputs activados via <label>: display:none bloquea el evento input
   en algunos browsers móviles. Se oculta sin sacar del flujo de renderizado. */
.file-input-hidden {
  visibility: hidden;
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* ── Loading overlay ── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(12, 12, 20, 0.8);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(255, 255, 255, 0.08);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Profile screen ── */
.profile-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  gap: 3rem;
}

.greeting {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  text-align: center;
}

.sofia-logo {
  width: 72px;
  height: 72px;
  border-radius: 22px;
  background: linear-gradient(135deg, #7c3aed 0%, #4f46e5 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.1rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 0.5rem;
  box-shadow: 0 8px 32px rgba(124, 58, 237, 0.4);
  user-select: none;
}

.greeting h1 {
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.greeting p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ── Profiles grid ── */
.profiles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
  width: 100%;
  max-width: 400px;
}

@media (max-width: 340px) {
  .profiles-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Profile card ── */
.profile-card {
  --user-color: rgba(255, 255, 255, 0.15);
  appearance: none;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.35rem 0.6rem 1.1rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  transition:
    transform var(--ease),
    box-shadow var(--ease),
    border-color var(--ease),
    opacity var(--ease);
  -webkit-tap-highlight-color: transparent;
  opacity: 0;
  animation: card-in 0.4s var(--ease) forwards;
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.profile-card:hover:not(:disabled) {
  transform: translateY(-4px);
  border-color: var(--user-color);
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.45),
    0 0 0 1px var(--user-color),
    0 0 28px color-mix(in srgb, var(--user-color) 25%, transparent);
}

.profile-card:active:not(:disabled) {
  transform: translateY(-1px);
}

.profile-card--inactive {
  opacity: 0.35 !important;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

/* Avatar circle */
.avatar {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.45rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: -0.01em;
}

.profile-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  line-height: 1.2;
}

.role-badge {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #a78bfa;
  background: rgba(124, 58, 237, 0.18);
  padding: 0.18rem 0.55rem;
  border-radius: 99px;
}

.inactive-badge {
  font-size: 0.6rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.3;
}

/* ── Chat screen ────────────────────────────────────────────── */
.chat-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh; /* viewport dinámico en mobile */
}

/* Header */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-header-sofia {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sofia-logo-sm {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}

.sofia-name {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.2;
}

.sofia-status {
  font-size: 0.72rem;
  color: #34d399;
  line-height: 1.2;
}

.sofia-status.thinking {
  color: var(--text-muted);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 0.3rem 0.75rem 0.3rem 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
}

.avatar-sm {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

/* Messages area */
.messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 1rem;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
}

.messages-list {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  max-width: 700px;
  margin: 0 auto;
  padding-bottom: 0.5rem;
}

/* Individual message */
.message {
  display: flex;
  gap: 0.55rem;
  align-items: flex-end;
  animation: msg-in 0.2s ease forwards;
}

@keyframes msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.message--user {
  flex-direction: row-reverse;
}

.message-avatar-sofia {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  margin-bottom: 2px;
}

.message-bubble {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 18px 18px 18px 4px;
  padding: 0.7rem 1rem;
  max-width: min(80%, 520px);
  line-height: 1.6;
  font-size: var(--font-chat);
  word-break: break-word;
}

.message-bubble--user {
  border-radius: 18px 18px 4px 18px;
  border-color: transparent;
  color: #fff;
}

.message-content strong { font-weight: 700; }
.message-content em     { font-style: italic; }
.message-content code {
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 0.85em;
  background: rgba(255,255,255,0.1);
  padding: 0.15em 0.4em;
  border-radius: 4px;
}
.message-content ul {
  padding-left: 1.25rem;
  margin: 0.35rem 0;
}
.message-content li { margin: 0.2rem 0; }

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 0.15rem 0.1rem;
}

.typing-indicator span {
  width: 7px;
  height: 7px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: typing 1.3s ease-in-out infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.18s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.36s; }

@keyframes typing {
  0%, 60%, 100% { transform: translateY(0);    opacity: 0.4; }
  30%           { transform: translateY(-7px); opacity: 1;   }
}

/* Input area */
.chat-footer {
  padding: 0.85rem 1rem;
  padding-bottom: max(0.85rem, env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.input-wrapper {
  display: flex;
  gap: 0.55rem;
  align-items: flex-end;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.55rem 0.55rem 0.55rem 1rem;
  transition: border-color var(--ease);
  max-width: 700px;
  margin: 0 auto;
}

.input-wrapper:focus-within {
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
}

.chat-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text);
  font-size: var(--font-chat);
  font-family: inherit;
  resize: none;
  max-height: 130px;
  line-height: 1.5;
}

.chat-input::placeholder { color: var(--text-muted); }
.chat-input:disabled      { opacity: 0.5; cursor: not-allowed; }

.send-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--ease), transform var(--ease), opacity var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.send-btn:hover:not(:disabled)  { filter: brightness(0.85); }
.send-btn:active:not(:disabled) { transform: scale(0.92); }
.send-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* Botón adjuntar */
.attach-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  transition: color var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.attach-btn:hover:not(.is-disabled) { color: var(--text); }
.attach-btn.is-disabled { opacity: 0.35; pointer-events: none; cursor: not-allowed; }

/* Preview de imagen sobre el input */
.image-preview {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 700px;
  margin: 0 auto 0.45rem;
  padding: 0 0.1rem;
}

.image-preview img {
  height: 72px;
  width: auto;
  max-width: 140px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  border: 1px solid var(--border);
}

.preview-name {
  font-size: 0.78rem;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.65rem;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.remove-image-btn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  transition: color var(--ease), background var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.remove-image-btn:hover { color: var(--text); background: var(--surface); }

/* Imagen dentro del globo del usuario */
.message-image {
  display: block;
  max-width: 220px;
  max-height: 220px;
  width: auto;
  height: auto;
  border-radius: var(--radius-sm);
  object-fit: contain;
  margin-bottom: 0.35rem;
}

.message-image:only-child { margin-bottom: 0; }

/* PDF adjunto en burbuja de usuario */
.message-pdf {
  font-size: 0.82rem;
  padding: 0.35rem 0.65rem;
  background: rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  margin-bottom: 0.35rem;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-pdf:only-child { margin-bottom: 0; }

/* Imagen generada por IA dentro de burbuja de Sofía */
.message-generated-img {
  display: block;
  max-width: 100%;
  max-height: 420px;
  height: auto;
  width: auto;
  border-radius: var(--radius-md);
  margin-top: 0.6rem;
  border: 1px solid var(--border);
  object-fit: contain;
}

/* ── TTS button ── */
.tts-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.45rem;
  padding: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
  visibility: hidden;
  opacity: 0;
  transition: opacity var(--ease), color var(--ease), background var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.tts-btn--ready {
  visibility: visible;
  opacity: 1;
}

.tts-btn:hover:not(:disabled) {
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
}

.tts-btn:disabled { cursor: not-allowed; }

.tts-btn[data-tts-state="playing"] { color: #a78bfa; }

@keyframes tts-spin { to { transform: rotate(360deg); } }
.tts-btn[data-tts-state="loading"] svg { animation: tts-spin 0.75s linear infinite; }

/* ── PIN screen ────────────────────────────────────────────── */
.pin-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  gap: 2.25rem;
  position: relative;
}

.pin-back-btn {
  position: absolute;
  top: 1.5rem;
  left: 1.5rem;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--ease), background var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.pin-back-btn:hover { color: var(--text); background: var(--surface); }

.pin-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  text-align: center;
}

.pin-user-name {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 500;
  min-height: 1.25rem;
}

.pin-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.pin-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  min-height: 1.25rem;
}

/* Los 4 círculos */
.pin-dots {
  display: flex;
  gap: 1.25rem;
  align-items: center;
}

.pin-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  background: transparent;
  transition: background var(--ease), border-color var(--ease), transform 120ms ease;
}

.pin-dot.filled {
  background: var(--accent);
  border-color: var(--accent);
  transform: scale(1.08);
}

.pin-dot.error {
  background: #ef4444;
  border-color: #ef4444;
}

@keyframes pin-shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-9px); }
  40%       { transform: translateX(9px); }
  60%       { transform: translateX(-5px); }
  80%       { transform: translateX(5px); }
}

.pin-dots.shaking {
  animation: pin-shake 0.38s ease;
}

.pin-error {
  font-size: 0.85rem;
  color: #ef4444;
  min-height: 1.25rem;
  text-align: center;
}

/* Numpad */
.pin-numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.7rem;
  width: 100%;
  max-width: 288px;
}

.pin-key {
  height: 68px;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 1.4rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--ease), transform 80ms ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.pin-key:active {
  background: var(--surface);
  transform: scale(0.93);
}

.pin-key--delete {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}

.pin-key--delete:active {
  background: var(--surface-2);
}

.pin-key-spacer {
  /* celda vacía en la grilla (abajo izquierda) */
}

/* ── Chat header con botón de configuración ── */
.chat-header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.settings-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color var(--ease), background var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.settings-btn:hover { color: var(--text); background: var(--surface); }

/* ── Settings screen ── */
.settings-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.settings-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: relative;
}

.settings-header .pin-back-btn {
  position: static;
  flex-shrink: 0;
}

.settings-title {
  font-size: 1.1rem;
  font-weight: 700;
}

.settings-list {
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
}

.settings-item {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 1.1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: background var(--ease), border-color var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.settings-item:hover {
  background: var(--surface);
  border-color: rgba(255, 255, 255, 0.12);
}
.settings-item:active { transform: scale(0.99); }

.settings-item-left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.settings-item-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.settings-item-text {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.settings-item-title {
  font-size: 0.94rem;
  font-weight: 600;
}

.settings-item-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.settings-item-chevron {
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ── Settings: secciones y extensiones ── */
.settings-section-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.75rem 0.25rem 0.4rem;
}

.settings-item--static {
  cursor: default;
  flex-wrap: wrap;
  row-gap: 0.65rem;
}
.settings-item--static:hover {
  background: var(--surface-2);
  border-color: var(--border);
}
.settings-item--static:active { transform: none; }

.settings-item--danger .settings-item-title { color: #ef4444; }
.settings-item--danger .settings-item-icon {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.25) !important;
  color: #ef4444;
}

.settings-item-value {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-left: auto;
}

/* Swatches de color */
.settings-swatches {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.settings-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2.5px solid transparent;
  cursor: pointer;
  transition: transform var(--ease), border-color var(--ease);
  -webkit-tap-highlight-color: transparent;
  padding: 0;
  flex-shrink: 0;
}
.settings-swatch:hover { transform: scale(1.12); }
.settings-swatch--active { border-color: #fff !important; }

/* Botones tamaño de texto */
.settings-font-btns {
  display: flex;
  gap: 0.4rem;
}

.settings-font-btn {
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8rem;
  transition: color var(--ease), border-color var(--ease), background var(--ease);
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
.settings-font-btn--active {
  color: var(--accent);
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}

/* Toggle de notificaciones */
.settings-toggle {
  position: relative;
  width: 44px;
  height: 26px;
  cursor: pointer;
  flex-shrink: 0;
  margin-left: auto;
}
.settings-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.settings-toggle-track {
  position: absolute;
  inset: 0;
  border-radius: 99px;
  background: var(--surface);
  border: 1px solid var(--border);
  transition: background var(--ease), border-color var(--ease);
}
.settings-toggle-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: transform var(--ease), background var(--ease);
}
.settings-toggle input:checked + .settings-toggle-track {
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  border-color: var(--accent);
}
.settings-toggle input:checked + .settings-toggle-track::after {
  transform: translateX(18px);
  background: var(--accent);
}

/* ── Botón micrófono ── */
.mic-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  position: relative;
  transition: background var(--ease), transform var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.mic-btn:hover:not(.is-disabled) { background: var(--surface); }
.mic-btn:active:not(.is-disabled) { transform: scale(0.92); }
.mic-btn.is-disabled { opacity: 0.35; pointer-events: none; cursor: not-allowed; }
.mic-btn--recording {
  background: #ef4444 !important;
  border-color: transparent;
}
.mic-btn--recording::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.3);
  animation: mic-ring 1.4s ease-out infinite;
}

@keyframes mic-spin {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.mic-btn--processing {
  background: #3b82f6 !important;
  border-color: transparent;
}
.mic-btn--processing::before {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(59, 130, 246, 0.6);
  border-top-color: transparent;
  animation: mic-spin 0.8s linear infinite;
}

@keyframes mic-ring {
  0%   { transform: scale(0.9); opacity: 0.8; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* Color de acento: preview y input oculto */
.settings-accent-preview {
  display: inline-block;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  flex-shrink: 0;
}

.settings-color-input {
  position: absolute;
  width: 0;
  height: 0;
  padding: 0;
  border: none;
  visibility: hidden;
  pointer-events: none;
}
