/* Hoja de estilos con temas (el activo se aplica con <html data-theme>) */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;600;700;800&family=ABeeZee:ital@0;1&display=swap');

/* PALETAS POR TEMA */
:root,
[data-theme="claro"] {
  color-scheme: light;

  --color-bg: #fffcf2;
  --color-surface: #ffffff;
  --color-border: #ece3cf;
  --surface-deep: #fffdf7;

  --color-text: #1a1a1a;
  --color-text-muted: #5c5c5c;

  --color-primary: #ffc300;
  --color-primary-2: #ffb300;
  --grad-primary: linear-gradient(135deg, #ffc300 0%, #ff8f00 100%);
  --primary-contrast: #1a1a1a;
  --accent-2: #ffd54a;
  --soft-primary: #fff3c4;

  --color-success: #2e7d32;
  --success-strong: #1b5e20;
  --soft-success: #e6f4ea;
  --success-line: #bfe3c8;

  --color-danger: #c62828;
  --danger-strong: #8e1919;
  --soft-danger: #fdecea;
  --danger-line: #f5c6c0;

  --color-warning: #f9a825;
  --warning-strong: #b26a00;
  --soft-warning: #fff3d6;
  --warning-line: #f7dfa9;

  --sidebar-bg: linear-gradient(180deg, #1a1a1a 0%, #2b2b2b 55%, #3d3d3d 100%);
  --sidebar-text: #ffd54a;
  --radius: 16px;
  --shadow-sm: 0 1px 2px rgba(26, 26, 26, .06), 0 1px 6px rgba(26, 26, 26, .05);
  --shadow-md: 0 4px 14px rgba(26, 26, 26, .08), 0 2px 4px rgba(26, 26, 26, .04);
  --shadow-lg: 0 16px 40px rgba(26, 26, 26, .16);
  --glow: 0 6px 20px rgba(255, 195, 0, .35);

  --body-bg:
    url("img/bg-tech-light.svg") center / cover no-repeat,
    radial-gradient(900px 420px at 110% -5%, rgba(255, 195, 0, .09), transparent 60%),
    radial-gradient(700px 380px at -10% 108%, rgba(255, 143, 0, .06), transparent 60%),
    var(--color-bg);

  --th-bg: linear-gradient(180deg, #fffef8, #fffaf0);
  --row-hover: rgba(255, 195, 0, .045);
  --chip-bg: #fff7e0;
  --track-bg: var(--color-border);
  --btn-hover-bg: #fff9e6;
  --btn-hover-border: #e6c96b;
  --hover-border: #ecd286;
  --toggle-off: #d8d2c2;
  --modal-footer-bg: #fffef8;
  --overlay: rgba(20, 20, 20, .6);
  --sel-bg: rgba(255, 195, 0, .18);
  --scroll-thumb: #d8d2c2;
  --scroll-hover: #b8b2a2;
  --logo-glow: drop-shadow(0 0 18px rgba(255, 213, 74, .45));
  --header-accent: rgba(255, 195, 0, .08);
  --photo-grad: linear-gradient(135deg, #1a1a1a, #4a4a4a);

  --toast-bg: #1a1a1a;
  --toast-text: #ffd54a;

  --login-bg:
    url("img/bg-tech.svg") center / cover no-repeat,
    radial-gradient(900px 500px at 85% 0%, rgba(255, 195, 0, .35), transparent 55%),
    radial-gradient(800px 500px at 0% 100%, rgba(255, 143, 0, .4), transparent 55%),
    #0d0d0d;
  --login-card-bg: rgba(255, 255, 255, .95);
  --login-card-border: rgba(255, 255, 255, .7);
  --login-title-color: #1a1a1a;
  --login-name-grad: var(--grad-primary);

  --map-floor: #fffdf7;
  --map-line: #d8d2c2;
  --map-pasillo: #faf4e2;
  --map-side: #faf5e4;
  --map-side-line: #e6d9ae;

  --chart-bg: #fffaf0;
  --chart-axis: #5c5c5c;
  --chart-value: #1a1a1a;

  --mobile-nav-bg: #1a1a1a;
}

[data-theme="oscuro"] {
  color-scheme: dark;

  --color-bg: #141414;
  --color-surface: #1f1f1f;
  --color-border: #3a3a3a;
  --surface-deep: #181818;

  --color-text: #f5f5f5;
  --color-text-muted: #a3a3a3;

  --color-primary: #ffc300;
  --color-primary-2: #ffd54a;
  --grad-primary: linear-gradient(135deg, #1f1f1f 0%, #ffc300 100%);
  --primary-contrast: #141414;
  --accent-2: #ffd54a;
  --soft-primary: rgba(255, 195, 0, .16);

  --color-success: #81c784;
  --success-strong: #a5d6a7;
  --soft-success: rgba(46, 125, 50, .14);
  --success-line: rgba(46, 125, 50, .35);

  --color-danger: #e57373;
  --danger-strong: #ef9a9a;
  --soft-danger: rgba(198, 40, 40, .14);
  --danger-line: rgba(198, 40, 40, .4);

  --color-warning: #ffb300;
  --warning-strong: #ffca28;
  --soft-warning: rgba(249, 168, 37, .14);
  --warning-line: rgba(249, 168, 37, .35);

  --sidebar-bg: linear-gradient(180deg, #141414 0%, #1f1f1f 55%, #3a3a3a 100%);
  --sidebar-text: #ffd54a;
  --radius: 10px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3), 0 1px 4px rgba(0, 0, 0, .2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, .35), 0 2px 4px rgba(0, 0, 0, .2);
  --shadow-lg: 0 12px 24px rgba(0, 0, 0, .4);
  --glow: 0 4px 12px rgba(255, 195, 0, .4);

  --body-bg:
    radial-gradient(900px 420px at 110% -5%, rgba(255, 195, 0, .07), transparent 60%),
    radial-gradient(700px 380px at -10% 108%, rgba(58, 58, 58, .35), transparent 60%),
    var(--color-bg);

  --th-bg: #181818;
  --row-hover: rgba(255, 195, 0, .05);
  --chip-bg: rgba(163, 163, 163, .14);
  --track-bg: #181818;
  --btn-hover-bg: #2a2a2a;
  --btn-hover-border: #ffc300;
  --hover-border: #ffc300;
  --toggle-off: #3a3a3a;
  --modal-footer-bg: rgba(0, 0, 0, .15);
  --overlay: rgba(5, 5, 5, .7);
  --sel-bg: rgba(255, 195, 0, .25);
  --scroll-thumb: #3a3a3a;
  --scroll-hover: #5a5a5a;
  --logo-glow: drop-shadow(0 0 12px rgba(255, 213, 74, .3));
  --header-accent: rgba(255, 195, 0, .1);
  --photo-grad: linear-gradient(135deg, #181818, #3a3a3a);

  --toast-bg: #0e0e0e;
  --toast-text: #f5f5f5;

  --login-bg:
    radial-gradient(900px 500px at 85% 0%, rgba(255, 195, 0, .18), transparent 55%),
    radial-gradient(800px 500px at 0% 100%, rgba(58, 58, 58, .5), transparent 55%),
    #0e0e0e;
  --login-card-bg: #1f1f1f;
  --login-card-border: #3a3a3a;
  --login-title-color: #f5f5f5;
  --login-name-grad: none;
  --login-name-color: #f5f5f5;

  --map-floor: #181818;
  --map-line: #3a3a3a;
  --map-pasillo: #1f1f1f;
  --map-side: #181818;
  --map-side-line: #3a3a3a;

  --chart-bg: #1f1f1f;
  --chart-axis: #a3a3a3;
  --chart-value: #f5f5f5;

  --mobile-nav-bg: #141414;
}

/* Alias con nombres antiguos usados en HTML/JS */
:root,
[data-theme="claro"],
[data-theme="oscuro"] {
  --bg-color: var(--color-bg);
  --surface-color: var(--color-surface);
  --border-color: var(--color-border);
  --text-color: var(--color-text);
  --text-muted: var(--color-text-muted);
  --primary-color: var(--color-primary);
  --success-color: var(--color-success);
  --danger-color: var(--color-danger);
  --warning-color: var(--color-warning);
  --primary-light: var(--soft-primary);
  --success-bg: var(--soft-success);
  --danger-bg: var(--soft-danger);
  --warning-bg: var(--soft-warning);
  --primary-gradient: var(--grad-primary);
}

/* BASE */
* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: "Outfit", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  background: var(--body-bg);
  background-attachment: fixed;
  color: var(--color-text);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

[data-theme="oscuro"] body,
body:has(html[data-theme="oscuro"]) {
  line-height: 1.6;
}

::selection { background: var(--sel-bg); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border-radius: 999px;
  border: 2px solid var(--color-bg);
}
::-webkit-scrollbar-thumb:hover { background: var(--scroll-hover); }

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 1.55rem; margin: 0; font-weight: 800; letter-spacing: -.02em; }
h1 + p { margin: 4px 0 0; color: var(--color-text-muted); font-size: .9rem; }

@keyframes page-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
@keyframes fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}

/* LAYOUT PRINCIPAL */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 250px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid rgba(125, 180, 255, .12);
  /* Apila el sidebar (y el panel de notificaciones) por encima del contenido,
     pero por debajo de modales (100) y toasts (200). El contenido principal
     conserva un contexto de apilamiento por la animación page-in. */
  z-index: 90;
}

.sidebar__brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 20px 14px;
  border-bottom: 1px solid rgba(148, 197, 255, .1);
}

.sidebar__brand img {
  width: 130px;
  height: 130px;
  object-fit: contain;
  margin: 0 auto;
  filter: var(--logo-glow);
}

.sidebar__brand-name {
  font-family: "Outfit", "Segoe UI", system-ui, sans-serif;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  text-align: center;
  line-height: 1.3;
  white-space: nowrap;
  color: #fff;
  margin-top: -6px;
  text-shadow:
    0 0 12px rgba(255, 213, 74, .55),
    0 0 32px rgba(255, 143, 0, .45);
}

.sidebar__nav {
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
  overflow-y: auto;
}

.sidebar__link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 13px;
  border-radius: 11px;
  color: var(--sidebar-text);
  font-size: .92rem;
  font-weight: 600;
  transition: background .2s, color .2s, transform .15s;
}
.sidebar__link:hover {
  background: rgba(255, 255, 255, .08);
  color: #fff;
  text-decoration: none;
  transform: translateX(3px);
}
.sidebar__link.is-active {
  background: var(--grad-primary);
  color: var(--primary-contrast);
  box-shadow: var(--glow);
}
.sidebar__link.is-active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 60%;
  border-radius: 999px;
  background: var(--accent-2);
  box-shadow: 0 0 10px var(--accent-2);
}
.sidebar__link .icon { width: 22px; text-align: center; }
.sidebar__link .icon svg[data-lucide] {
  display: block;
  width: 20px;
  height: 20px;
  margin: 0 auto;
  stroke-width: 2;
}

/* Agrupa el bloque de usuario con la campana de notificaciones. En escritorio
   no genera caja (`display: contents`): el usuario sigue al pie de la barra
   lateral y la campana en su esquina. En el celular se convierte en la
   cabecera del menú desplegable (ver @media max-width: 860px). */
.sidebar__me { display: contents; }

.sidebar__user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px 16px;
  margin: 0 10px 12px;
  border-radius: 13px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .12);
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--grad-primary);
  color: var(--primary-contrast);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: .8rem;
  flex-shrink: 0;
  box-shadow: var(--glow);
}
.sidebar__user .name { font-size: .84rem; color: #fff; font-weight: 700; line-height: 1.25; }
.sidebar__user .role { font-size: .71rem; opacity: .8; }
/* El correo solo se muestra en el menú del celular. */
.sidebar__user .email { display: none; }
/* Columna de texto (nombre, rol y correo): puede encogerse para que el
  ipsis se aplique y no empuje el botón de cerrar sesión. */
.sidebar__user > div:not(.avatar) { min-width: 0; }

.logout-btn {
  margin-left: auto;
  background: transparent;
  border: none;
  color: var(--sidebar-text);
  font-size: 1rem;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  transition: background .2s, color .2s;
}
.logout-btn:hover { background: rgba(239, 68, 68, .2); color: #fda4af; }

.sidebar__toggle { display: none; }

/* Contenido */
.main-content {
  flex: 1;
  padding: 30px 34px 52px;
  min-width: 0;
  animation: page-in .35s ease both;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.page-header h1 { font-size: 1.75rem; margin: 0 0 6px; }
.page-header p { color: var(--color-text-muted); font-size: .9rem; }
.page-header__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--color-text-muted);
}

.section-title {
  font-weight: 800;
  font-size: 1.02rem;
  letter-spacing: -.01em;
  padding: 16px 20px 12px;
}

.footer-small {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--color-border);
  font-size: .75rem;
  color: var(--color-text-muted);
}

/* LOGIN */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--login-bg);
  background-attachment: fixed;
}

.login-body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(125, 180, 255, .06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(125, 180, 255, .06) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
  pointer-events: none;
}

.login-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  background: var(--login-card-bg);
  backdrop-filter: blur(14px);
  border: 1px solid var(--login-card-border);
  border-radius: 22px;
  box-shadow: 0 30px 80px rgba(2, 8, 26, .55), 0 0 0 1px rgba(255, 195, 0, .12);
  padding: 36px 32px;
  animation: card-in .45s cubic-bezier(.2, .8, .3, 1) both;
}

@keyframes card-in {
  from { opacity: 0; transform: translateY(18px) scale(.97); }
  to   { opacity: 1; transform: none; }
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}
.login-brand__icon img {
  width: 96px;
  height: 96px;
  object-fit: contain;
  filter: var(--logo-glow);
}
.login-brand__name {
  font-weight: 800;
  font-size: 1.18rem;
  line-height: 1.2;
  letter-spacing: -.02em;
  background: var(--login-name-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
[data-theme="oscuro"] .login-brand__name {
  background: none;
  color: var(--login-name-color, #f7f9fc);
}
.login-brand__sub { font-size: .78rem; color: var(--color-text-muted); font-weight: 600; }

.login-title { font-size: 1.28rem; margin: 0 0 4px; letter-spacing: -.02em; color: var(--login-title-color); }
.login-desc  { color: var(--color-text-muted); font-size: .88rem; margin: 0 0 22px; }

.login-error {
  background: var(--soft-danger);
  color: var(--danger-strong);
  border: 1px solid var(--danger-line);
  border-radius: 10px;
  padding: 10px 13px;
  font-size: .85rem;
  margin-bottom: 14px;
}

.login-submit {
  width: 100%;
  padding-block: 12px !important;
  font-size: .95rem;
}

.login-hint {
  margin-top: 24px;
  background: var(--soft-primary);
  border: 1px dashed var(--color-primary);
  border-radius: 12px;
  padding: 13px 15px;
  font-size: .78rem;
  color: var(--color-text-muted);
  line-height: 1.9;
  opacity: .95;
}
.login-hint code {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: #7a5c00;
  border-radius: 6px;
  padding: 1px 7px;
  font-size: .76rem;
  font-weight: 700;
}
[data-theme="oscuro"] .login-hint {
  background: var(--primary-soft, var(--soft-primary));
  border-color: rgba(72, 187, 120, .4);
}
.login-hint__btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 4px 12px;
  font-size: .76rem;
  font-weight: 600;
  color: var(--color-text);
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.login-hint__btn:hover {
  border-color: var(--color-primary);
  background: var(--soft-primary);
}

/* Paso 2FA del login */
.login-otp {
  text-align: center;
  padding: 4px 0 2px;
}
.login-otp__title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.login-otp__desc {
  color: var(--color-text-muted);
  font-size: .84rem;
  line-height: 1.45;
  margin: 0 0 18px;
}
.login-otp__input {
  text-align: center;
  font-size: 1.4rem;
  letter-spacing: .45em;
  font-variant-numeric: tabular-nums;
  min-width: 130px;
}
.login-submit--2fa {
  width: 100%;
}
.login-back {
  display: block;
  width: 100%;
  margin-top: 10px;
  background: transparent;
  border: none;
  color: var(--color-text-muted);
  font-size: .78rem;
  cursor: pointer;
  text-decoration: underline;
}
.login-back:hover {
  color: var(--color-primary);
}

/* Enlaces bajo el botón de ingresar (recuperar / crear cuenta) */
.login-links {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 9px;
  margin-top: 14px;
  font-size: .82rem;
}
.login-links__sep { color: var(--color-text-muted); opacity: .6; }
.login-link {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  color: #1a66ff;
  font-size: inherit;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color .15s;
}
.login-link:hover { color: var(--color-primary); }
[data-theme="oscuro"] .login-link { color: #8fc3ff; }
[data-theme="oscuro"] .login-link:hover { color: var(--color-primary); }

/* Divisor "o continúa con" */
.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 16px;
  color: var(--color-text-muted);
  font-size: .76rem;
  font-weight: 600;
}
.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--color-border);
}

/* Botón social (Google) */
.btn--social {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding-block: 11px !important;
}
.login-google {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.login-google:hover {
  border-color: var(--hover-border);
  background: var(--btn-hover-bg);
}

/* Avisos del login */
.login-info {
  background: var(--soft-primary);
  border: 1px solid var(--warning-line);
  color: var(--warning-strong);
  border-radius: 10px;
  padding: 10px 13px;
  font-size: .82rem;
  line-height: 1.5;
  margin-top: 14px;
}
.login-ok {
  background: var(--soft-success);
  color: var(--success-strong);
  border: 1px solid var(--success-line);
  border-radius: 10px;
  padding: 10px 13px;
  font-size: .85rem;
  margin-bottom: 14px;
}

/* Vista de registro */
.login-alt .login-title { margin-top: 8px; }
.login-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 4px 0 12px;
  font-size: .8rem;
  line-height: 1.45;
  color: var(--color-text-muted);
}
.login-check input { margin-top: 2px; accent-color: var(--color-primary); }
.login-aviso-legal {
  font-size: .72rem;
  line-height: 1.55;
  color: var(--color-text-muted);
  margin: 0 0 16px;
}
.form-hint {
  font-size: .74rem;
  color: var(--color-text-muted);
  margin: 4px 2px 0;
}

/* Formulario de registro: 2 columnas en escritorio, 1 en celular */
#registro-form {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 14px;
}
#registro-form .form-group { margin: 0; }
#registro-form .login-check,
#registro-form .login-aviso-legal,
#registro-form .login-error,
#registro-form .login-ok,
#registro-form .login-submit,
#registro-form .login-back {
  grid-column: 1 / -1;
}
@media (max-width: 520px) {
  #registro-form { grid-template-columns: 1fr; }
}

/* Cuerpo del modal de términos / privacidad */
.terminos-cuerpo {
  max-height: 58vh;
  overflow-y: auto;
  font-size: .86rem;
  line-height: 1.6;
  color: var(--color-text);
}
.terminos-cuerpo h3 {
  font-size: .92rem;
  font-weight: 800;
  margin: 16px 0 6px;
}
.terminos-cuerpo p { margin: 0 0 10px; }
.terminos-lead { color: var(--color-text-muted); }

/* Tamaño de texto accesible (Configuración → Apariencia) */
html.texto-grande { font-size: 112.5%; }

/* COMPONENTES */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow .25s, transform .25s, border-color .25s;
}
.card:hover { box-shadow: var(--shadow-md); }

/* Botones */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 11px;
  padding: 9px 17px;
  font-size: .88rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: all .2s;
  text-decoration: none !important;
}
.btn:hover {
  border-color: var(--btn-hover-border);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  background: var(--btn-hover-bg);
  color: var(--color-text);
  text-decoration: none !important;
}
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.btn--primary {
  background: var(--grad-primary);
  border-color: transparent;
  color: var(--primary-contrast);
  box-shadow: var(--glow);
}
.btn--primary:hover {
  background: var(--grad-primary);
  color: var(--primary-contrast);
  filter: saturate(1.15) brightness(1.06);
  box-shadow: 0 8px 26px var(--glow);
}

.btn--danger {
  background: linear-gradient(135deg, #ef4444, #f97362);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 18px rgba(239, 68, 68, .35);
}
.btn--danger:hover { background: linear-gradient(135deg, #ef4444, #f97362); color: #fff; filter: brightness(1.06); box-shadow: 0 8px 24px rgba(239, 68, 68, .45); }

.btn--sm { padding: 6px 12px; font-size: .78rem; border-radius: 9px; }

/* Botón de ayuda (?) de Configuración */
.cfg-acciones {
  position: relative;
  display: flex;
  align-items: center;
  gap: 20px;
}

.cfg-ayuda-btn {
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 50%;
  background: rgba(255, 255, 255, .06);
  flex-shrink: 0;
  pointer-events: auto;
}
.cfg-acciones .cfg-ayuda-btn svg.lucide {
  width: 26px;
  height: 26px;
  stroke-width: 1.8;
  color: #d1d5db;
}

.cfg-ayuda-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  display: none;
  flex-direction: column;
  min-width: 220px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 13px;
  box-shadow: var(--shadow-lg);
  padding: 6px;
}
.cfg-ayuda-menu.is-open { display: flex; animation: fade-in .15s ease; }

.cfg-ayuda-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--color-text);
  font-family: inherit;
  font-size: .87rem;
  font-weight: 600;
  padding: 10px 12px;
  border-radius: 9px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.cfg-ayuda-menu button:hover { background: var(--surface-deep); }
.cfg-ayuda-menu button svg.lucide { width: 16px; height: 16px; opacity: .85; }

/* Contenido del modal de ayuda */
#modal-ayuda .modal__body { max-height: 62vh; overflow-y: auto; }

.ayuda-faq { display: flex; flex-direction: column; gap: 12px; }
.ayuda-faq details {
  border: 1px solid var(--color-border);
  border-radius: 11px;
  padding: 12px 15px;
  background: var(--surface-deep);
}
.ayuda-faq summary { font-weight: 700; font-size: .88rem; cursor: pointer; }
.ayuda-faq summary::marker { color: var(--color-primary); }
.ayuda-faq p { font-size: .84rem; color: var(--color-text-muted); line-height: 1.55; margin: 8px 0 0; }

.ayuda-texto { font-size: .86rem; line-height: 1.65; }
.ayuda-texto h3 { font-size: .93rem; margin: 15px 0 6px; }
.ayuda-texto p { margin: 0 0 9px; }

.ayuda-acerca { text-align: center; }
.ayuda-acerca img { margin-bottom: 12px; }

/* Formularios */
.form-group { margin-bottom: 15px; flex: 1; min-width: 0; }

.form-label {
  display: block;
  font-size: .76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--color-text-muted);
  margin-bottom: 7px;
}

.form-input {
  width: 100%;
  padding: 10px 13px;
  border: 1.5px solid var(--color-border);
  border-radius: 11px;
  font-size: .9rem;
  font-family: inherit;
  background: var(--surface-deep);
  color: var(--color-text);
  outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.form-input::placeholder { color: var(--color-text-muted); opacity: .8; }
.form-input:focus {
  border-color: var(--color-primary);
  background: var(--color-surface);
  box-shadow: 0 0 0 4px var(--sel-bg);
}

.form-row { display: flex; gap: 13px; flex-wrap: wrap; }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3.5px 11px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .02em;
  background: var(--chip-bg);
  color: var(--color-text-muted);
  white-space: nowrap;
}
.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: .8;
}

.badge--disponible {
  background: var(--soft-success);
  color: var(--success-strong);
}
.badge--disponible::before { animation: pulse-dot 2s infinite; }
.badge--ocupado    { background: var(--soft-danger);  color: var(--danger-strong); }
.badge--mantencion { background: var(--soft-warning); color: var(--warning-strong); }
.badge--muted      { background: var(--chip-bg); color: var(--color-text-muted); }
.badge--muted::before { display: none; }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .45; transform: scale(.75); }
}

/* Stat cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(172px, 1fr));
  gap: 15px;
}

.stat-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 19px;
  position: relative;
  overflow: hidden;
}
.stat-card::after {
  content: "";
  position: absolute;
  top: -40%;
  right: -12%;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: var(--soft-primary);
  opacity: 0;
  transition: opacity .3s;
}
.stat-card:hover::after { opacity: .55; }
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

.stat-card > div:first-child { position: relative; z-index: 1; }
.stat-card__label { font-size: .72rem; color: var(--color-text-muted); font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.stat-card__value { font-size: 1.85rem; font-weight: 800; line-height: 1.15; letter-spacing: -.03em; }
.stat-card__sub   { font-size: .72rem; color: var(--color-text-muted); }

.stat-card__icon {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.stat-card__icon--primary { background: var(--soft-primary); }
.stat-card__icon--success { background: var(--soft-success); }
.stat-card__icon--danger  { background: var(--soft-danger); }
.stat-card__icon--warning { background: var(--soft-warning); }
.rep-card__icon.stat-card__icon--primary { background: var(--soft-primary); }
.rep-card__icon.stat-card__icon--success { background: var(--soft-success); }
.rep-card__icon.stat-card__icon--danger  { background: var(--soft-danger); }
.rep-card__icon.stat-card__icon--warning { background: var(--soft-warning); }

/* Tabs */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1.5px solid var(--color-border);
  padding: 0 16px;
  overflow-x: auto;
}

.tab-btn {
  background: none;
  border: none;
  border-bottom: 2.5px solid transparent;
  margin-bottom: -1.5px;
  padding: 13px 15px;
  font-size: .87rem;
  font-weight: 700;
  color: var(--color-text-muted);
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: color .2s, border-color .2s;
}
.tab-btn:hover { color: var(--color-text); }
.tab-btn.is-active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.tab-panel { display: none; padding: 20px; }
.tab-panel.is-active { display: block; animation: fade-in .25s ease; }

/* TABLAS */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  font-size: .87rem;
}

th {
  text-align: left;
  padding: 11px 16px;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  font-weight: 700;
  color: var(--color-text-muted);
  border-bottom: 1.5px solid var(--color-border);
  background: var(--th-bg);
  white-space: nowrap;
}

td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-border);
  color: var(--color-text);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: var(--row-hover); }

/* Info grid (dl) */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 15px 20px;
  margin: 0;
}
.info-grid dt {
  font-size: .7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--color-text-muted);
  margin-bottom: 3px;
}
.info-grid dd {
  margin: 0;
  font-size: .9rem;
  font-weight: 700;
}

.check-list { list-style: none; margin: 0; padding: 0 8px 8px; }
.check-list li { padding: 7px 10px; font-size: .88rem; border-radius: 8px; transition: background .15s; }
.check-list li:hover { background: var(--surface-deep); }
.check-list li::before { content: none; }
.check-list li svg.lucide {
  width: 15px;
  height: 15px;
  vertical-align: -3px;
  margin-right: 7px;
  color: var(--color-success);
}

.access-notice {
  display: flex;
  gap: 13px;
  align-items: flex-start;
  background: var(--soft-warning);
  border: 1px solid var(--warning-line);
  border-left: 4px solid var(--color-warning);
  border-radius: 12px;
  padding: 15px 17px;
  font-size: .86rem;
  margin: 0 20px 20px;
}
.access-notice span { font-size: 1.25rem; }
.access-notice strong { color: var(--warning-strong); }
.access-notice p { margin: 4px 0 0; color: var(--color-text-muted); }

.detail-header {
  display: flex;
  gap: 18px;
  align-items: center;
  padding: 22px;
  background:
    radial-gradient(400px 140px at 95% 0%, var(--header-accent), transparent),
    var(--color-surface);
}
.detail-header__photo {
  width: 88px;
  height: 88px;
  border-radius: 18px;
  background: var(--grad-primary);
  box-shadow: var(--glow);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* TARJETAS DE LABORATORIO */
.lab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(252px, 1fr));
  gap: 17px;
}

.lab-card { display: flex; flex-direction: column; }
.lab-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--hover-border);
}

.lab-card__photo {
  height: 112px;
  background:
    radial-gradient(280px 130px at 80% -20%, rgba(255, 195, 0, .3), transparent),
    var(--photo-grad);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.lab-card__photo::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .07) 1px, transparent 1px);
  background-size: 26px 26px;
  pointer-events: none;
}
.lab-card__img {
  position: absolute;
  inset: 0;
  object-fit: cover;
  transition: transform .3s ease;
}
.lab-card__img:hover {
  transform: scale(1.05);
}

.lab-card__body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.lab-card__title { font-weight: 800; font-size: 1rem; letter-spacing: -.01em; }
.lab-card__room  { font-size: .8rem; color: var(--color-text-muted); margin-top: -4px; }

.lab-card__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .84rem;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.lab-card__link {
  margin-top: auto;
  padding-top: 10px;
  font-size: .84rem;
  font-weight: 800;
  color: var(--color-primary);
}

/* Estado en tiempo real */
.status-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 20px;
  border-bottom: 1px solid var(--color-border);
  transition: background .15s;
}
.status-row:last-child { border-bottom: none; }
.status-row:hover { background: var(--row-hover); }

.status-row__icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.status-row__name { font-weight: 700; font-size: .9rem; line-height: 1.25; }
.status-row__room { font-size: .75rem; color: var(--color-text-muted); }

.status-row__bar-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  min-width: 132px;
}

.progress-bar {
  width: 132px;
  height: 7px;
  background: var(--track-bg);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar__fill {
  height: 100%;
  border-radius: 999px;
  transition: width .5s cubic-bezier(.2, .8, .3, 1);
  box-shadow: 0 0 8px currentColor;
}

/* Donut */
.donut-wrap {
  display: flex;
  gap: 26px;
  align-items: center;
  flex-wrap: wrap;
}

.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 9px;
  font-size: .84rem;
  font-weight: 600;
}
.donut-legend span { display: flex; align-items: center; gap: 9px; }

.donut-legend__dot {
  width: 11px;
  height: 11px;
  border-radius: 4px;
  display: inline-block;
  box-shadow: 0 0 6px rgba(15, 27, 51, .2);
}

/* USUARIOS */
.usr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  gap: 15px;
}

.usr-card {
  display: flex;
  gap: 14px;
  padding: 17px;
  cursor: pointer;
  transition: transform .2s, box-shadow .25s, border-color .25s;
}
.usr-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--hover-border);
}

.usr-card__avatar {
  width: 50px;
  height: 50px;
  border-radius: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: .95rem;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.usr-card__body { min-width: 0; }
.usr-card__nombre { font-weight: 700; font-size: .93rem; }
.usr-card__area   { font-size: .78rem; color: var(--color-text-muted); }
.usr-card__especialidad { font-size: .76rem; color: var(--color-text-muted); }

.usr-avatar-lg {
  width: 66px;
  height: 66px;
  border-radius: 20px;
  background: var(--grad-primary);
  color: var(--primary-contrast);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.3rem;
  flex-shrink: 0;
  box-shadow: var(--glow);
}

.permisos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(262px, 1fr));
  gap: 12px;
}

.permiso-item {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 13px;
  background: var(--surface-deep);
  transition: border-color .2s, box-shadow .2s;
}
.permiso-item:hover { border-color: var(--hover-border); box-shadow: var(--shadow-sm); }
.permiso-item__icon { font-size: 1rem; }
.permiso-item__nombre { font-weight: 700; font-size: .86rem; }
.permiso-item__desc   { font-size: .76rem; color: var(--color-text-muted); margin-top: 2px; }

.actividad-lista { display: flex; flex-direction: column; gap: 4px; }

.actividad-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 11px 8px;
  border-radius: 10px;
  border-bottom: 1px solid var(--color-border);
  transition: background .15s;
}
.actividad-item:hover { background: var(--row-hover); }
.actividad-item:last-child { border-bottom: none; }
.actividad-item__icono { font-size: 1.05rem; }
.actividad-item__texto { font-size: .87rem; font-weight: 700; }
.actividad-item__fecha { font-size: .74rem; color: var(--color-text-muted); }

/* REPORTES */
.rep-card__arrow {
  color: var(--color-primary);
  font-size: 1.15rem;
  font-weight: 800;
  align-self: center;
  transition: transform .2s;
}
.rep-card:hover .rep-card__arrow { transform: translateX(4px); }

/* MODALES */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 18px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg);
  animation: modal-in .22s cubic-bezier(.2, .8, .3, 1) both;
}
.modal--lg { max-width: 580px; }

@keyframes modal-in {
  from { opacity: 0; transform: translateY(16px) scale(.96); }
  to   { opacity: 1; transform: none; }
}

.modal__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 17px 21px;
  border-bottom: 1px solid var(--color-border);
}

.modal__title { font-weight: 800; font-size: 1rem; letter-spacing: -.01em; }

.modal__close {
  background: none;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  color: var(--color-text-muted);
  padding: 5px 9px;
  border-radius: 8px;
  transition: background .2s, color .2s;
}
.modal__close:hover { background: var(--soft-danger); color: var(--color-danger); }

.modal__body { padding: 21px; }

.modal__footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 15px 21px;
  border-top: 1px solid var(--color-border);
  background: var(--modal-footer-bg);
}

/* TOASTS */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 200;
}

.toast {
  background: var(--toast-bg);
  color: var(--toast-text);
  border-left: 4px solid var(--color-success);
  border-radius: 13px;
  box-shadow: var(--shadow-lg);
  padding: 14px 19px;
  font-size: .87rem;
  font-weight: 600;
  max-width: 350px;
  opacity: 0;
  transform: translateX(24px) scale(.97);
  transition: opacity .3s, transform .3s;
}
.toast--error { border-left-color: var(--color-danger); }
.toast--show  { opacity: 1; transform: none; }

/* CONFIGURACIÓN */
.cfg-layout {
  display: flex;
  gap: 22px;
  align-items: flex-start;
}

.cfg-sidenav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 204px;
  flex-shrink: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 10px;
  box-shadow: var(--shadow-sm);
}

.cfg-nav-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  text-align: left;
  padding: 10px 13px;
  border-radius: 10px;
  font-size: .87rem;
  font-weight: 700;
  color: var(--color-text-muted);
  cursor: pointer;
  font-family: inherit;
  transition: background .2s, color .2s;
}
.cfg-nav-btn:hover { background: var(--surface-deep); color: var(--color-text); }
.cfg-nav-btn.is-active {
  background: var(--grad-primary);
  color: var(--primary-contrast);
  box-shadow: var(--glow);
}

.cfg-panels {
  flex: 1;
  min-width: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow-sm);
}

.cfg-panel { display: none; }
.cfg-panel.is-active { display: block; animation: fade-in .25s ease; }

.cfg-panel__title {
  font-size: 1.12rem;
  margin: 0 0 18px;
  letter-spacing: -.02em;
}

.cfg-section { max-width: 560px; }

.cfg-admin-badge {
  display: inline-flex;
  background: var(--soft-danger);
  color: var(--danger-strong);
  font-size: .74rem;
  font-weight: 800;
  border-radius: 999px;
  padding: 4.5px 13px;
  margin-bottom: 18px;
}

.cfg-sys-card {
  border: 1px solid var(--color-border);
  border-radius: 13px;
  padding: 15px 17px;
  background: var(--surface-deep);
  transition: transform .2s, box-shadow .2s;
}
.cfg-sys-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.cfg-sys-card__label { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--color-text-muted); font-weight: 800; }
.cfg-sys-card__value { font-weight: 800; font-size: 1.08rem; margin-top: 4px; }

/* Auditoría */
.cfg-aud-filtros {
  display: grid;
  grid-template-columns: 1fr 150px 150px;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}
.cfg-aud-filtros__acciones {
  display: flex;
  gap: 8px;
  align-items: center;
}
.cfg-aud-wrap {
  overflow-x: auto;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  max-width: 720px;
}
.cfg-aud-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .8rem;
  min-width: 620px;
}
.cfg-aud-table th {
  text-align: left;
  padding: 9px 12px;
  background: var(--surface-deep);
  color: var(--color-text-muted);
  font-weight: 800;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid var(--color-border);
}
.cfg-aud-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}
.cfg-aud-table tr:last-child td { border-bottom: none; }
.cfg-aud-detalle { color: var(--color-text-muted); max-width: 300px; }
.cfg-aud-vacio {
  text-align: center;
  color: var(--color-text-muted);
  padding: 24px !important;
}

/* Respaldos */
.cfg-backup-acciones {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.cfg-backup-acciones label.btn { cursor: pointer; }

/* Modal pequeño (2FA) */
.modal.modal--sm { max-width: 400px; }

.tema-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(142px, 1fr));
  gap: 13px;
}

.tema-item {
  border: 2px solid var(--color-border);
  border-radius: 13px;
  padding: 11px;
  text-align: center;
  font-size: .78rem;
  font-weight: 700;
  cursor: pointer;
  color: var(--color-text);
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.tema-item:hover { border-color: var(--color-text-muted); transform: translateY(-2px); }
.tema-item.is-active {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px var(--sel-bg), var(--glow);
}

.tema-preview {
  height: 46px;
  border-radius: 8px;
  background: var(--tema-bg, #0a1226);
  margin-bottom: 9px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12);
}

.toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 13px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: .89rem;
  font-weight: 600;
  cursor: pointer;
}
.toggle-row:last-of-type { border-bottom: none; }

.toggle {
  width: 46px;
  height: 26px;
  background: var(--toggle-off);
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  transition: background .25s;
  flex-shrink: 0;
}
.toggle--on {
  background: var(--grad-primary);
  box-shadow: var(--glow);
}

.toggle__knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: left .25s cubic-bezier(.2, .8, .3, 1);
  box-shadow: 0 1px 4px rgba(2, 8, 26, .3);
}
.toggle--on .toggle__knob { left: 23px; }

/* MAPA */
.mapa-wrap {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 20px;
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}

.mapa-svg .sala-lab {
  cursor: pointer;
  transition: opacity .2s, filter .2s;
}
.mapa-svg .sala-lab:hover { opacity: .85; filter: drop-shadow(0 4px 14px rgba(2, 8, 26, .35)); }
.mapa-svg .sala-lab:focus { outline: none; }
.mapa-svg .sala-lab:focus rect { stroke: var(--accent-2); stroke-width: 4; stroke-dasharray: 6 3; }
.mapa-svg .sala-lab.selected rect { stroke-width: 3.5; stroke: var(--accent-2); }
.mapa-svg .sala-otra { fill: var(--map-side); stroke: var(--map-side-line); }
.mapa-svg text { pointer-events: none; }

.mapa-leyenda {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  padding: 14px 4px 2px;
  font-size: .8rem;
  font-weight: 600;
  color: var(--color-text-muted);
}
.mapa-leyenda span { display: flex; align-items: center; gap: 7px; }
.mapa-leyenda i {
  width: 13px;
  height: 13px;
  border-radius: 4px;
  display: inline-block;
}

/* EQUIPOS */
.tech-cell { font-family: Consolas, monospace; font-size: .8rem; }

.locked-cell {
  color: var(--color-text-muted);
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 6px,
    rgba(93, 107, 133, .07) 6px,
    rgba(93, 107, 133, .07) 12px
  );
  border-radius: 6px;
}

.remote-log {
  background: #070d1d;
  color: #7ef0a2;
  font-family: Consolas, monospace;
  font-size: .78rem;
  border-radius: 14px;
  border: 1px solid rgba(126, 240, 162, .18);
  box-shadow: inset 0 0 40px rgba(16, 185, 129, .05), var(--shadow-md);
  padding: 15px 17px;
  max-height: 230px;
  overflow-y: auto;
  margin: 0 20px 20px;
}
.remote-log div { padding: 2.5px 0; }
.remote-log .log-time { color: #54749e; margin-right: 9px; }

/* RESPONSIVE */
@media (max-width: 860px) {
  .app-layout { flex-direction: column; }

  .sidebar {
    width: 100%;
    height: auto;
    position: sticky;
    top: 0;
    z-index: 90;
    flex-direction: row;
    align-items: center;
    flex-wrap: nowrap;
    gap: 6px;
    padding: 6px 10px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .25);
  }
  .sidebar__brand {
    border-bottom: none;
    padding: 2px 6px;
    flex-shrink: 0;
    flex-direction: row;
    gap: 5px;
  }
  .sidebar__brand img { width: 48px; height: 48px; }
  .sidebar__brand-name { font-size: .84rem; letter-spacing: .07em; margin-top: 0; }

  /* La barra superior se queda solo con el logo y el botón de menú: el usuario
     y la campana de notificaciones pasan al desplegable (cabecera de .sidebar__me). */
  .sidebar__me {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    padding: 2px 4px 12px;
    margin: 0 0 4px;
    border-bottom: 1px solid rgba(255, 255, 255, .16);
  }
  .sidebar__me .sidebar__user {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    padding: 0;
    gap: 10px;
    background: transparent;
    border: none;
  }
  .sidebar__me .sidebar__user > div:not(.avatar) { min-width: 0; }
  .sidebar__me .sidebar__user .name {
    font-size: .82rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .sidebar__me .sidebar__user .role { display: none; }
  .sidebar__me .sidebar__user .email {
    display: block;
    font-size: .7rem;
    line-height: 1.3;
    color: rgba(255, 255, 255, .72);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .sidebar__me .logout-btn { padding: 5px; }

  /* La campana acompaña al usuario; su panel se despliega dentro del menú */
  .sidebar__me .notif-wrap { display: contents; position: static; }
  .sidebar__me .notif-btn { order: 2; }

  /* Botón hamburguesa */
  .sidebar__toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    margin-left: auto;
    flex-shrink: 0;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 11px;
    color: var(--sidebar-text);
    font-size: 1.15rem;
    cursor: pointer;
    transition: background .2s, color .2s;
  }
  .sidebar__toggle:hover { background: rgba(255, 255, 255, .16); color: #fff; }

  /* Menú desplegable de navegación */
  .sidebar__nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    gap: 3px;
    padding: 12px;
    max-height: calc(100vh - 70px);
    overflow-y: auto;
    background: var(--mobile-nav-bg);
    border-bottom: 1px solid var(--accent-2);
    box-shadow: 0 16px 30px rgba(0, 0, 0, .45);
  }
  .sidebar.nav-open .sidebar__nav { display: flex; }

  .sidebar__link { padding: 11px 13px; }
  .sidebar__link:hover { transform: none; }
  .sidebar__link.is-active::before { display: none; }

  .main-content { padding: 18px 14px 40px; }
  .page-header h1 { font-size: 1.4rem; }

  .cfg-layout { flex-direction: column; }
  .cfg-sidenav { width: 100%; flex-direction: row; flex-wrap: wrap; }
}

@media (max-width: 480px) {
  .main-content { padding: 16px 12px 40px; }
  h1 { font-size: 1.35rem; }
  .sidebar__brand { gap: 2px; padding: 2px 3px; }
  .sidebar__brand img { width: 44px; height: 44px; }
  .sidebar__brand-name { font-size: .72rem; letter-spacing: .04em; }
}

@media (max-width: 400px) {
  .sidebar { gap: 4px; padding: 5px 8px; }
  .sidebar__brand img { width: 42px; height: 42px; }
  .avatar { width: 32px; height: 32px; font-size: .72rem; }
}

/* IMPRESIÓN (reportes) */
@media print {
  .sidebar,
  .page-header button,
  #btn-volver-rep,
  #toast-container,
  .modal-overlay { display: none !important; }

  body { background: #fff !important; color: #111; }
  .main-content { padding: 0; animation: none; }
  .card { box-shadow: none; border-color: #ccc; background: #fff; }
  .card * { color: #111 !important; }
  th { background: #f0f0f0 !important; color: #111 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  td { border-color: #ddd; }
}

/* ICONOS LUCIDE (tamaños por contexto) */
svg.lucide {
  width: 20px;
  height: 20px;
  stroke-width: 2;
  flex-shrink: 0;
  vertical-align: middle;
  /* Los iconos son decorativos: nunca interceptan clics,
     así el botón completo responde en toda su superficie */
  pointer-events: none;
}

.sidebar__toggle svg.lucide { width: 22px; height: 22px; }
.logout-btn svg.lucide { width: 14px; height: 14px; }
.stat-card__icon svg.lucide { width: 26px; height: 26px; }
.status-row__icon svg.lucide { width: 20px; height: 20px; }
.modal__close svg.lucide { width: 18px; height: 18px; display: block; }
.badge svg.lucide {
  width: 12px;
  height: 12px;
  vertical-align: -2px;
  margin-right: 4px;
}
.cfg-nav-btn svg.lucide { width: 17px; height: 17px; }
.cfg-admin-badge svg.lucide {
  width: 13px;
  height: 13px;
  vertical-align: -2px;
  margin-right: 5px;
}
.locked-cell svg.lucide {
  width: 13px;
  height: 13px;
  vertical-align: -2px;
  margin-right: 3px;
}
.permiso-item__icon svg.lucide { width: 18px; height: 18px; }
.actividad-item__icono svg.lucide { width: 17px; height: 17px; }
.rep-card__icon svg.lucide { width: 24px; height: 24px; }
.rep-card__meta svg.lucide {
  width: 13px;
  height: 13px;
  vertical-align: -2px;
  margin-right: 4px;
  opacity: .85;
}
.photo-icon svg.lucide {
  width: 54px;
  height: 54px;
  opacity: .9;
  color: #eaf1ff;
}
.input-icon svg.lucide {
  width: 16px;
  height: 16px;
  color: var(--color-text-muted);
}
.access-notice > span svg.lucide { width: 22px; height: 22px; }
/* v1.7 · REPORTES RESUMIDOS + ADJUNTOS */
.rep-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rep-card {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  cursor: pointer;
  transition: transform .2s, box-shadow .25s, border-color .25s;
}
.rep-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--hover-border);
}

.rep-card__icon {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.rep-card__body { flex: 1; min-width: 0; }
.rep-card__titulo {
  font-weight: 700;
  font-size: .9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rep-chip {
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .02em;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
}
.rep-chip--primary   { background: var(--soft-primary); color: var(--color-primary); }
.rep-chip--success   { background: var(--soft-success); color: #16a34a; }
.rep-chip--danger    { background: var(--soft-danger);  color: var(--color-danger); }
.rep-chip--warning   { background: var(--soft-warning); color: #d97706; }
.rep-chip--neutral   { background: var(--chip-bg, rgba(127,127,127,.12)); color: var(--color-text-muted); }

.stat-card__icon--neutral { background: var(--chip-bg, rgba(127,127,127,.12)); color: var(--color-text-muted); }

.form-hint {
  display: block;
  margin-top: 6px;
  font-size: .72rem;
  line-height: 1.45;
  color: var(--color-text-muted);
}

/* Adjuntos en el detalle del reporte */
.adj-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}
.adj-thumb {
  margin: 0;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--color-surface-2, rgba(127,127,127,.06));
}
.adj-thumb img {
  display: block;
  width: 100%;
  height: 86px;
  object-fit: cover;
  cursor: zoom-in;
}
.adj-thumb figcaption {
  font-size: .64rem;
  color: var(--color-text-muted);
  padding: 5px 7px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.adj-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.adj-file {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: .74rem;
  color: var(--color-text);
  background: var(--color-surface);
  text-decoration: none;
}
.adj-file span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}
.adj-file small { color: var(--color-text-muted); flex-shrink: 0; }
a.adj-file:hover { border-color: var(--color-primary); color: var(--color-primary); }

.adj-file--estatica { padding-right: 4px; }
.adj-file__quitar {
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 3px;
  border-radius: 50%;
}
.adj-file__quitar:hover { color: var(--color-danger); background: var(--soft-danger); }

/* Zona para soltar/seleccionar archivos del modal */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 18px 14px;
  border: 2px dashed var(--color-border);
  border-radius: 12px;
  cursor: pointer;
  text-align: center;
  color: var(--color-text-muted);
  font-size: .8rem;
  transition: border-color .2s, background .2s;
}
.dropzone svg.lucide { width: 20px; height: 20px; color: var(--color-primary); }
.dropzone small { font-size: .68rem; opacity: .75; }
.dropzone:hover, .dropzone.is-over {
  border-color: var(--color-primary);
  background: var(--soft-primary);
}

textarea.form-input { resize: vertical; min-height: 90px; }

/* v1.7 · NOTIFICACIONES (campana en la barra lateral) */
.sidebar { overflow: visible; }

.notif-wrap {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 110;
}

.notif-btn {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(148, 197, 255, .25);
  background: rgba(148, 197, 255, .08);
  color: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s, transform .15s;
  pointer-events: auto;
}
.notif-btn:hover { background: rgba(148, 197, 255, .2); transform: scale(1.06); }
.notif-btn svg.lucide { width: 19px; height: 19px; }

.notif-btn__badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: .62rem;
  font-weight: 800;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(239, 68, 68, .5);
  pointer-events: none;
}

.notif-panel {
  position: absolute;
  top: 46px;
  left: 0;
  right: auto;
  width: min(330px, calc(100vw - 32px));
  max-height: 420px;
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  background: color-mix(in srgb, var(--color-surface) 86%, transparent);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 110;
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
}

.notif-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  font-weight: 700;
  font-size: .82rem;
  border-bottom: 1px solid var(--color-border);
}
.notif-panel__todas {
  border: none;
  background: transparent;
  color: var(--color-primary);
  font-size: .68rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}
.notif-panel__todas:hover { text-decoration: underline; }

.notif-panel__activar {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: none;
  border-radius: 999px;
  background: var(--color-primary);
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 10px;
}
.notif-panel__activar svg.lucide { width: 12px; height: 12px; }
.notif-panel__activar:hover { filter: brightness(1.1); }

.notif-panel__lista { overflow-y: auto; }

.notif-item {
  display: flex;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 11px 14px;
  border: none;
  border-bottom: 1px solid var(--color-border);
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--soft-primary); }

.notif-item__punto {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: transparent;
  margin-top: 6px;
  flex-shrink: 0;
}
.notif-item--nueva { background: var(--soft-primary); }
.notif-item--nueva .notif-item__punto { background: var(--color-primary); }

.notif-item__cuerpo { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.notif-item__titulo { font-size: .78rem; font-weight: 700; }
.notif-item__msj {
  font-size: .72rem;
  color: var(--color-text-muted);
  line-height: 1.4;
  word-break: break-word;
}
.notif-item__fecha {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .65rem;
  color: var(--color-text-muted);
  margin-top: 2px;
}
.notif-item__fecha svg.lucide { width: 11px; height: 11px; }

.notif-item__accion {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  font-size: .72rem;
  font-weight: 700;
  color: var(--color-primary);
}
.notif-item__accion svg.lucide { width: 12px; height: 12px; }

.notif-vacia {
  padding: 28px 18px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: .76rem;
  line-height: 1.5;
}
.notif-vacia svg.lucide { width: 26px; height: 26px; margin-bottom: 8px; opacity: .6; }

/* En móvil la campana acompaña al botón hamburguesa */
@media (max-width: 900px) {
  .notif-wrap { top: 10px; right: 58px; }
}

/* En la barra superior móvil (ancho real) la ventana de notificaciones
   se abre hacia la izquierda y se ajusta para no quedar recortada */
@media (max-width: 860px) {
  .notif-panel {
    left: auto;
    right: 0;
    width: min(330px, calc(100vw - 70px));
  }
  /* Dentro del menú móvil la ventana deja de flotar y ocupa el ancho completo
     del desplegable, justo debajo de los datos del usuario. */
  .sidebar__me .notif-panel {
    order: 3;
    flex: 1 0 100%;
    position: static;
    left: auto;
    right: auto;
    width: auto;
    max-height: 46vh;
  }
}

/* ACCESIBILIDAD */
/* Skip-nav: enlace para saltar al contenido */
.skip-nav {
  position: absolute;
  left: -9999px;
  top: -9999px;
  z-index: 2000;
  background: var(--color-primary);
  color: #000;
  font-weight: 800;
  padding: 10px 18px;
  border-radius: 0 0 10px 0;
  text-decoration: none;
  font-size: .9rem;
  outline: none;
}
.skip-nav:focus {
  left: 0;
  top: 0;
  box-shadow: 0 0 0 3px #000, 0 4px 14px rgba(0, 0, 0, .4);
}

/* Toggles accesibles (role="switch"): estado y foco por teclado */
.toggle[role="switch"] {
  display: inline-flex;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  outline: none;
}
.toggle[role="switch"]:focus-visible {
  box-shadow: 0 0 0 3px var(--color-primary);
}
.toggle[role="switch"] .toggle__knob { pointer-events: none; }

/* Contraste del código en sugerencias de login (claro y oscuro) */
.login-hint { color: var(--color-text); }
[data-theme="oscuro"] .login-hint code {
  background: #1f2937;
  border-color: rgba(148, 197, 255, .35);
  color: #7dd3fc;
}

/* Calendario semanal de disponibilidad */
.semana-nav {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.semana-nav .btn { display: inline-flex; align-items: center; gap: 6px; }
.semana-label { font-weight: 700; font-size: .9rem; }
.semana-tabla {
  width: 100%;
  border-collapse: collapse;
  font-size: .78rem;
  min-width: 760px;
}
.semana-tabla th,
.semana-tabla td {
  border: 1px solid var(--color-border);
  padding: 7px 8px;
  vertical-align: top;
  text-align: center;
}
.semana-tabla td { min-width: 92px; height: 52px; }
.semana-tabla thead th { background: var(--surface-deep); font-weight: 800; }
.semana-th--hoy,
.semana-td--hoy { background: color-mix(in srgb, var(--color-primary) 8%, transparent); }
.semana-dia { display: block; font-size: .72rem; }
.semana-fecha {
  display: inline-block;
  margin-top: 3px;
  background: var(--color-primary);
  color: #fff;
  border-radius: 999px;
  font-size: .68rem;
  font-weight: 800;
  padding: 1px 8px;
}
.semana-lab { font-weight: 700; text-align: left; white-space: nowrap; }
.semana-chip {
  cursor: pointer;
  background: var(--soft-primary);
  color: var(--color-text);
  border: 1px solid var(--color-primary);
  border-radius: 8px;
  padding: 4px 7px;
  margin-bottom: 5px;
  font-size: .72rem;
  line-height: 1.25;
  transition: transform .15s, box-shadow .15s;
}
.semana-chip:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.semana-chip span { display: block; font-weight: 700; }
.semana-chip--pendiente {
  background: var(--soft-danger);
  border-color: var(--danger);
}
/* Reserva de otro usuario: se muestra, pero no se ofrece para cancelar. */
.semana-chip--ajeno { cursor: default; }
.semana-chip--ajeno:hover { transform: none; box-shadow: none; }

/* prefers-reduced-motion: usuario pide menos movimiento */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
