/* Santadoge Centro de control v0.9.0 - mismo lenguaje visual que Studio (abeto, traje rojo, dorado, crema). */
:root {
  --spruce: #0f1d1e;
  --spruce-2: #142628;
  --spruce-3: #1b3234;
  --line: #2b4547;
  --line-2: #3d5f61;
  --fur: #f2ede1;
  --mist: #9bb2ae;
  --mist-2: #6f8a86;
  --suit: #e5484d;
  --suit-deep: #3a1519;
  --gold: #f2c14e;
  --gold-deep: #3b2f12;
  --pine: #4fc79a;
  --pine-deep: #12332a;
  --frost: #7cb4ee;
  --frost-deep: #142c45;
  --r-ctl: 10px;
  --display: "Barlow Condensed", Bahnschrift, "Arial Narrow", "Roboto Condensed", "Liberation Sans Narrow", sans-serif;
  --text: Figtree, "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--spruce); }
body.cc {
  margin: 0; min-height: 100vh; background: var(--spruce); color: var(--fur);
  font-family: var(--text); font-size: 15px; line-height: 1.5;
}
button, input, textarea { font-family: inherit; }
:focus-visible { outline: 2px solid var(--frost); outline-offset: 2px; }
.hidden { display: none !important; }
[hidden] { display: none !important; }
.shell { width: 100%; max-width: 1280px; margin: 0 auto; padding: 16px 20px 24px; }

/* ---------- acceso ---------- */
.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card {
  width: min(400px, 100%); padding: 30px 28px 22px; text-align: center;
  background: var(--spruce-2); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, .45);
}
.login-avatar { width: 92px; height: 92px; border-radius: 50%; object-fit: cover; background: var(--spruce-3); border: 2px solid var(--line-2); }
.login-card h1 { margin: 12px 0 0; font-family: var(--display); font-size: 44px; line-height: 1; letter-spacing: .02em; text-transform: uppercase; }
.subtitle { margin: 4px 0 22px; color: var(--mist); }
.field { text-align: left; margin-bottom: 14px; }
.field label, .field-label { display: block; margin: 0 0 5px; color: var(--mist); font-size: 13px; }
.field input, .password-wrapper input, .text-area {
  width: 100%; padding: 11px 12px; background: var(--spruce); color: var(--fur);
  border: 1px solid var(--line-2); border-radius: var(--r-ctl); font-size: 16px;
}
.field input::placeholder, .text-area::placeholder { color: var(--mist-2); }
.password-wrapper { position: relative; }
.password-wrapper input { padding-right: 46px; }
.password-toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 38px; height: 38px; background: none; border: 0; border-radius: 8px; color: var(--mist); cursor: pointer; font-size: 16px;
}
.password-toggle:hover { background: var(--spruce-3); }
.login-error { min-height: 20px; margin: 0 0 8px; color: #ff9a9d; font-size: 14px; text-align: left; }
.login-button {
  width: 100%; min-height: 48px; border-radius: var(--r-ctl); cursor: pointer;
  background: var(--gold); color: #231a05; border: 1px solid var(--gold);
  font-size: 15px; font-weight: 700; letter-spacing: .08em;
}
.login-button:hover:not(:disabled) { background: #f6cf6e; }
.login-button:disabled { opacity: .55; cursor: wait; }
.login-footer { margin-top: 18px; color: var(--mist-2); font-size: 12px; }

/* ---------- barra superior ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-bottom: 14px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; background: var(--spruce-3); border: 1px solid var(--line); flex: none; }
.brand-name { font-weight: 700; font-size: 17px; line-height: 1.2; }
.brand-sub { color: var(--mist); font-size: 13px; }
.top-actions { display: flex; gap: 8px; align-items: center; }
.ghost-link {
  background: none; border: 1px solid var(--line); color: var(--mist);
  padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 500; cursor: pointer;
  transition: color .15s, border-color .15s;
}
.ghost-link:hover { color: var(--fur); border-color: var(--line-2); }

/* ---------- banda de estado real ---------- */
.onair {
  --tone: var(--mist-2); --tone-bg: var(--spruce-2);
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "lamp text cta" "chips chips chips";
  align-items: center; column-gap: 22px; row-gap: 14px;
  padding: 20px 26px 16px; background: var(--tone-bg);
  border-left: 8px solid var(--tone); border-radius: 14px;
  transition: background-color .35s ease, border-color .35s ease;
}
.onair[data-state="offline"] { --tone: var(--mist-2); --tone-bg: var(--spruce-2); }
.onair[data-state="live"], .onair[data-state="error"] { --tone: var(--suit); --tone-bg: var(--suit-deep); }
.onair[data-state="starting"], .onair[data-state="closing"], .onair[data-state="break"] { --tone: var(--gold); --tone-bg: var(--gold-deep); }
.onair[data-state="reading"] { --tone: var(--frost); --tone-bg: var(--frost-deep); }
.lamp { grid-area: lamp; width: 54px; height: 54px; border-radius: 50%; border: 4px solid var(--tone); transition: background-color .3s; }
.onair[data-state="live"] .lamp, .onair[data-state="break"] .lamp, .onair[data-state="reading"] .lamp,
.onair[data-state="starting"] .lamp, .onair[data-state="closing"] .lamp, .onair[data-state="error"] .lamp { background: var(--tone); }
.onair[data-state="live"] .lamp { animation: tally 2.2s ease-out infinite; }
.onair[data-state="starting"] .lamp, .onair[data-state="closing"] .lamp { animation: blink 1s steps(2, jump-none) infinite; }
@keyframes tally { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--suit) 55%, transparent); } 70% { box-shadow: 0 0 0 16px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes blink { 50% { opacity: .35; } }
.onair-text { grid-area: text; min-width: 0; }
.state-word {
  margin: 0; font-family: var(--display); font-weight: 700; font-size: clamp(38px, 6vw, 70px);
  line-height: .95; letter-spacing: .01em; text-transform: uppercase; overflow-wrap: anywhere;
}
.state-sub { margin: 6px 0 0; color: color-mix(in srgb, var(--fur) 82%, transparent); font-size: 16px; max-width: 64ch; }
.onair-cta { grid-area: cta; display: grid; gap: 6px; justify-items: end; text-align: right; }
.onair-cta small { color: var(--mist); font-size: 12px; max-width: 22ch; }
.onair-cta .primary-button { width: auto; min-width: 190px; }
.chips { grid-area: chips; list-style: none; margin: 0; padding: 12px 0 0; display: flex; flex-wrap: wrap; gap: 8px; border-top: 1px solid color-mix(in srgb, var(--tone) 35%, transparent); }
.chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 10px; border-radius: 999px;
  background: color-mix(in srgb, var(--spruce) 55%, transparent); border: 1px solid var(--line); font-size: 13px; color: var(--mist);
}
.chip strong { color: var(--fur); font-weight: 600; }
.chip::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--mist-2); flex: none; }
.chip[data-tone="ok"]::before { background: var(--pine); }
.chip[data-tone="warn"]::before { background: var(--gold); }
.chip[data-tone="bad"]::before { background: var(--suit); }

/* ---------- botones ---------- */
.primary-button, .secondary-button {
  min-height: 46px; padding: 10px 18px; border-radius: var(--r-ctl); font-size: 15px; font-weight: 700; cursor: pointer;
  transition: background-color .15s, border-color .15s, transform .08s, opacity .15s;
}
.primary-button { background: var(--gold); color: #231a05; border: 1px solid var(--gold); }
.primary-button:hover:not(:disabled) { background: #f6cf6e; }
.secondary-button { background: var(--spruce-3); color: var(--fur); border: 1px solid var(--line-2); width: 100%; }
.secondary-button:hover:not(:disabled) { background: #22403f; border-color: var(--mist-2); }
.secondary-button.stop { background: var(--suit-deep); color: #ffd9da; border-color: var(--suit); }
.secondary-button.stop:hover:not(:disabled) { background: #52191f; }
.compact { min-height: 38px; padding: 6px 14px; font-size: 14px; width: auto; }
.primary-button:active:not(:disabled), .secondary-button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: not-allowed; }

/* ---------- distribución ---------- */
.grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(320px, 1fr); gap: 18px 22px; align-items: start; margin-top: 18px; }
.side { display: grid; gap: 18px; min-width: 0; }
.card { background: var(--spruce-2); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; min-width: 0; display: grid; gap: 10px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.card-head h2 { margin: 2px 0 0; font-size: 19px; line-height: 1.2; }
.eyebrow { display: block; color: var(--mist); font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.pill { padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--spruce-3); color: var(--mist); font-size: 12px; font-weight: 600; white-space: nowrap; }
.hint { color: var(--mist); font-size: 13px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.row-between.meta { gap: 8px; }

/* ---------- escena de prueba ---------- */
.scene-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.scene-badge { padding: 3px 10px; border-radius: 4px; border: 1px solid var(--line-2); background: rgba(15, 29, 30, .82); font-family: var(--display); font-weight: 700; font-size: 15px; letter-spacing: .06em; }
.scene { position: relative; display: grid; place-items: center; min-height: 340px; padding: 18px; background: #0a1314; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.scene-glow { position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 55%, rgba(242, 193, 78, .14), transparent 62%); pointer-events: none; }
.character-stage { position: relative; display: grid; justify-items: center; gap: 4px; }
.character-image { max-width: min(100%, 280px); max-height: 260px; width: auto; height: auto; object-fit: contain; }
.character-image.talking { animation: talk .5s ease-in-out infinite alternate; }
@keyframes talk { from { transform: translateY(0) scale(1); } to { transform: translateY(-5px) scale(1.015); } }
.character-name { font-family: var(--display); font-weight: 700; font-size: 20px; letter-spacing: .24em; }
.character-stage small { color: var(--mist); letter-spacing: .12em; }
.session { display: grid; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-left: 5px solid var(--line-2); border-radius: var(--r-ctl); background: var(--spruce); }
.session-copy strong { display: block; }
.session-copy p { margin: 4px 0 0; color: var(--mist); font-size: 13px; max-width: 70ch; }
.session-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

/* ---------- pruebas de IA y voz ---------- */
.text-area { min-height: 84px; resize: vertical; line-height: 1.4; }
.voice-card { display: grid; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-ctl); background: var(--spruce); }
.voice-title { font-weight: 600; }
.voice-name { color: var(--mist); font-size: 13px; }
.activity-block p { margin: 4px 0 0; overflow-wrap: anywhere; }
.activity-label { color: var(--mist); font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.activity-divider { height: 1px; background: var(--line); margin: 4px 0; }

/* ---------- registro ---------- */
.logs {
  height: 190px; overflow: auto; padding: 10px 12px; background: #0a1314; border: 1px solid var(--line); border-radius: 8px;
  font: 12.5px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--mist);
}
.log-time { color: var(--mist-2); }
.log-success { color: var(--pine); }
.log-warning { color: var(--gold); }
.log-error { color: #ff8a8e; }

/* ---------- avisos emergentes ---------- */
.toasts { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 10px; z-index: 12000; width: min(380px, calc(100vw - 36px)); pointer-events: none; }
.toast {
  pointer-events: auto; cursor: pointer; padding: 12px 14px 12px 16px; border-radius: 12px;
  background: var(--spruce-3); border: 1px solid var(--line-2); border-left: 6px solid var(--mist);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45); font-size: 14px; overflow-wrap: anywhere; animation: toast-in .22s ease-out;
}
.toast[data-tone="ok"] { border-left-color: var(--pine); }
.toast[data-tone="warn"] { border-left-color: var(--gold); }
.toast[data-tone="bad"] { border-left-color: var(--suit); }
.toast.is-leaving { opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.foot { margin-top: 22px; color: var(--mist-2); font-size: 12px; text-align: center; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (max-width: 980px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
  .onair { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "lamp text" "cta cta" "chips chips"; }
  .onair-cta { justify-items: stretch; text-align: left; }
  .onair-cta .primary-button { width: 100%; }
  .onair-cta small { max-width: none; }
}
@media (max-width: 520px) {
  .shell { padding: 12px 14px 20px; }
  .onair { padding: 16px 16px 14px; column-gap: 14px; }
  .lamp { width: 40px; height: 40px; border-width: 3px; }
  .session-buttons { grid-template-columns: 1fr; }
  .scene { min-height: 280px; }
}

/* ---------- entrada directa a Studio ---------- */
.goto-studio #dashboardScreen { display: none !important; }
.enter-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.enter-screen[hidden] { display: none !important; }
.enter-card { text-align: center; }
.enter-card h1 { margin: 12px 0 0; font-family: var(--display); font-size: 40px; line-height: 1; letter-spacing: .02em; text-transform: uppercase; }
.enter-card .subtitle { margin: 6px 0 14px; }
.enter-link { color: var(--gold); font-size: 14px; }
