/* Saturno 2 — base compartida */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

:root {
  --bg: #0e1017;
  --surface: #181c28;
  --surface-2: #222738;
  --line: #2e3448;
  --text: #f2f4fa;
  --muted: #98a1b8;
  --brand: #8b7cf8;
  --brand-deep: #5b4bd4;
  --accent: #ffb200;
  --accent-deep: #e29a00;
  --ok: #34d17b;
  --danger: #ff5d5d;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
}

button {
  font-family: inherit;
  border: none;
  cursor: pointer;
  color: inherit;
  background: none;
  -webkit-tap-highlight-color: transparent;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5em;
  padding: .7em 1.3em;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 700;
  background: var(--surface-2);
  color: var(--text);
  transition: transform .08s ease, filter .15s ease;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-brand { background: linear-gradient(135deg, var(--brand), var(--brand-deep)); color: #fff; }
.btn-accent { background: linear-gradient(135deg, var(--accent), var(--accent-deep)); color: #201400; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; border: 1.5px solid var(--line); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: .4em;
  border-radius: 999px;
  padding: .25em .8em;
  font-size: .82rem;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--muted);
}
.chip.ok { color: var(--ok); }
.chip.warn { color: var(--accent); }
.chip.danger { color: var(--danger); }

/* Banner sin conexión (P21) */
#offline-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  background: var(--danger);
  color: #fff;
  font-weight: 700;
  text-align: center;
  padding: .55em 1em;
  font-size: .95rem;
  transform: translateY(-110%);
  transition: transform .25s ease;
}
#offline-banner.show { transform: translateY(0); }

/* Toasts */
#toasts {
  position: fixed;
  bottom: max(18px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  width: min(92vw, 560px);
  pointer-events: none;
}
.toast {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: .8em 1.2em;
  font-weight: 600;
  font-size: 1rem;
  max-width: 100%;
  animation: toast-in .25s ease;
}
.toast.warn { border-color: var(--accent); }
.toast.danger { border-color: var(--danger); background: #3a1420; }
.toast.ok { border-color: var(--ok); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; } }

/* Modales */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgba(6, 8, 14, .68);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  animation: toast-in .18s ease;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: min(94vw, 520px);
  max-height: 88vh;
  overflow: auto;
  padding: 22px;
}
.modal h3 { margin: 0 0 6px; font-size: 1.25rem; }
.modal .hint { color: var(--muted); font-size: .9rem; margin: 0 0 14px; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }

.field { display: flex; flex-direction: column; gap: 6px; margin: 12px 0; }
.field label { font-size: .85rem; font-weight: 700; color: var(--muted); }
.field input[type="text"], .field input[type="password"], .field textarea, .field select {
  font: inherit;
  background: var(--surface-2);
  color: var(--text);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: .7em .9em;
  outline: none;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--brand); }
.field .error { color: var(--danger); font-size: .88rem; font-weight: 600; min-height: 1.2em; }

/* Pantalla "dispositivo sin vincular" */
.unlinked {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 32px;
  text-align: center;
}
.unlinked .big { font-size: 4rem; }
.unlinked h1 { margin: 0; font-size: 1.6rem; }
.unlinked p { color: var(--muted); max-width: 460px; line-height: 1.5; }

.hidden { display: none !important; }
