/* BuenosAiresYa - selector de tema (claro / oscuro / automatico)
   Cargar DESPUES de app.css. Fuerza los tokens segun <html data-theme="light|dark">.
   Sin data-theme (o "auto") se mantiene el comportamiento actual: sigue al sistema. */

:root[data-theme="light"] {
  color-scheme: light;
  --blue: #1a73e0; --blue-hover: #145cb3; --navy: #0b1f3f;
  --brand-grad: linear-gradient(135deg, #38a3f5 0%, #1f5fd6 55%, #5b3fd6 100%);
  --blue-50: #eaf2ff; --blue-100: #d3e4ff;
  --bg: #ffffff; --bg-grad: none; --card: #ffffff; --card-2: #f7f9f9; --hover: #f0f3f6;
  --line: #eff3f4; --line-strong: #cfd9de;
  --text: #16202f; --heading: #0b1f3f; --muted: #5f6c80;
  --glass: rgba(255, 255, 255, .78);
  --green: #14805a; --green-bg: #e3f6ee;
  --orange: #a45a06; --orange-bg: #fff1dc;
  --red: #d8344c; --red-bg: #fdeaed;
  --shadow-sm: 0 1px 2px rgba(15, 30, 60, .05), 0 1px 3px rgba(15, 30, 60, .04);
  --shadow: 0 1px 2px rgba(15, 30, 60, .04), 0 8px 24px -8px rgba(15, 30, 60, .10);
  --shadow-lg: 0 16px 48px -12px rgba(15, 30, 60, .28);
  --ring: 0 0 0 4px rgba(56, 163, 245, .28);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --blue: #6aa8ff; --blue-hover: #8bbcff; --navy: #e8eefb;
  --brand-grad: linear-gradient(135deg, #38a3f5 0%, #3b6fe0 55%, #7a5cf0 100%);
  --blue-50: #14233f; --blue-100: #1d3560;
  --bg: #05080f; --bg-grad: none; --card: #05080f; --card-2: #0e1522; --hover: #121b2b;
  --line: #1c2738; --line-strong: #31425f;
  --text: #e3e9f4; --heading: #f1f5fd; --muted: #93a0b8;
  --glass: rgba(5, 8, 15, .8);
  --green: #4cd3a0; --green-bg: #12362b;
  --orange: #f3b25a; --orange-bg: #3a2810;
  --red: #ff7088; --red-bg: #3c1820;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px -10px rgba(0, 0, 0, .55);
  --shadow-lg: 0 18px 50px -12px rgba(0, 0, 0, .7);
  --ring: 0 0 0 4px rgba(106, 168, 255, .32);
}

/* Boton del selector */
.theme-toggle {
  display: inline-grid; place-items: center; width: 42px; height: 42px; flex: none;
  border: 0; border-radius: 50%; background: transparent; color: var(--heading);
  cursor: pointer; font: inherit; transition: background .15s, transform .15s;
}
.theme-toggle:hover { background: var(--hover); }
.theme-toggle:active { transform: scale(.92); }
.theme-toggle svg { display: block; }
/* Version con texto dentro del menu de cuenta / carril izquierdo */
.theme-toggle.is-wide {
  width: 100%; border-radius: 10px; justify-content: start; display: flex; align-items: center;
  gap: .65rem; padding: .65rem .8rem; font-weight: 500; color: var(--text); height: auto;
}
/* Respaldo flotante si no se encuentra donde insertarlo */
.theme-toggle.is-floating {
  position: fixed; right: 14px; bottom: calc(90px + env(safe-area-inset-bottom)); z-index: 56;
  background: var(--card); border: 1px solid var(--line-strong); box-shadow: var(--shadow);
}
@media (min-width: 760px) { .theme-toggle.is-floating { bottom: 18px; } }

/* Logo de BuenosAiresYa: icono circular + nombre en texto (se adapta a claro y oscuro) */
.brand { gap: .65rem; }
.brand-logo { display: block; width: 46px; height: 46px; flex: none; border-radius: 50%; object-fit: cover; box-shadow: 0 4px 14px -4px rgba(26, 115, 224, .45); }
.rail-brand .brand-logo { width: 52px; height: 52px; }
.admin-side .brand-logo { width: 44px; height: 44px; box-shadow: 0 4px 14px -4px rgba(0, 0, 0, .5); }
/* Pantallas de ingreso: logo grande y centrado, con el nombre debajo */
.brand-center { flex-direction: column; align-items: center; justify-content: center; gap: .6rem; text-align: center; }
.brand-center .brand-logo { width: 92px; height: 92px; margin: 0 auto; box-shadow: 0 10px 28px -8px rgba(26, 115, 224, .5); }
.brand-center .brand-name { display: block; font-size: 1.45rem; }

/* ---- Manual de procedimientos del administrador ---- */
.manual { display: grid; gap: 1.2rem; grid-template-columns: minmax(0, 1fr); }
.manual-body { min-width: 0; }
.manual-body .card { scroll-margin-top: 1rem; }
.manual-body h2 { font-size: 1.3rem; margin-bottom: .8rem; padding-bottom: .5rem; border-bottom: 1px solid var(--line); }
.manual-body h3 { font-size: 1.02rem; margin: 1.3rem 0 .5rem; color: var(--heading); }
.manual-body ul, .manual-body ol { padding-left: 1.3rem; margin: 0 0 .9rem; }
.manual-body li { margin-bottom: .35rem; }
.manual-body li > ul, .manual-body li > ol { margin-top: .35rem; }
.manual-body code { background: var(--hover); border: 1px solid var(--line); border-radius: 6px; padding: .05rem .4rem; font-size: .88em; overflow-wrap: anywhere; }
.manual-body .table-wrap { margin: .6rem 0 1rem; }
.manual-body .table td, .manual-body .table th { vertical-align: top; }
.manual-body .steps { list-style: none; counter-reset: step; padding-left: 0; }
.manual-body .steps > li { counter-increment: step; position: relative; padding-left: 2.4rem; margin-bottom: .8rem; }
.manual-body .steps > li::before { content: counter(step); position: absolute; left: 0; top: .05rem; width: 1.7rem; height: 1.7rem; border-radius: 50%; display: grid; place-items: center; background: var(--blue-50); color: var(--blue); font-weight: 800; font-size: .85rem; }
.manual-body .checklist { list-style: none; padding-left: 0; }
.manual-body .checklist > li { position: relative; padding-left: 2rem; margin-bottom: .6rem; }
.manual-body .checklist > li::before { content: ""; position: absolute; left: 0; top: .2rem; width: 1.15rem; height: 1.15rem; border: 2px solid var(--line-strong); border-radius: 5px; background: var(--card); }
.manual-toc { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow-sm); }
.manual-toc-title { margin: 0 0 .5rem; font-size: .74rem; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.manual-toc ol { margin: 0 0 1rem; padding-left: 1.4rem; columns: 2; column-gap: 1.2rem; }
.manual-toc li { margin-bottom: .3rem; break-inside: avoid; font-size: .92rem; }
.manual-toc a { color: var(--text); }
.manual-toc a:hover { color: var(--blue); }
@media (min-width: 1100px) {
  .manual { grid-template-columns: 250px minmax(0, 1fr); align-items: start; }
  .manual-toc { position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow-y: auto; }
  .manual-toc ol { columns: 1; }
}

/* Impresion / guardar como PDF: solo el manual, sin menus */
@media print {
  .admin-side, .topbar-actions, .theme-toggle, .manual-toc, .skip-link { display: none !important; }
  .admin-shell { display: block !important; }
  .admin-main { padding: 0 !important; }
  .manual { display: block; }
  body, .admin-body { background: #fff !important; color: #000 !important; }
  .manual-body .card { break-inside: avoid-page; box-shadow: none !important; border: 1px solid #ccc !important; margin-bottom: .8rem; }
  .manual-body .table-wrap { overflow: visible; }
  a { color: #000 !important; text-decoration: underline; }
}
