/* Estilos compartidos por el portal y todas las aplicaciones.
   Apariencia: kit visual de Borbón Gestión (el de CapFlow, acento verde):
   tokens de color, letra Plus Jakarta Sans + JetBrains Mono, armazón con
   menú lateral / franja / cajón y barra inferior, tarjetas, tablas, avisos.
   Los colores salen SIEMPRE de los tokens de :root y [data-theme="dark"]. */

/* ── Letras (guardadas en el proyecto: no dependen de Google) ─────────── */
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url('/assets/fonts/plus-jakarta-sans.woff2') format('woff2');
}
@font-face {
  font-family: 'JetBrains Mono';
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url('/assets/fonts/jetbrains-mono.woff2') format('woff2');
}

/* ── Tokens: tema claro ──────────────────────────────────────────────── */
:root {
  --bg: #f5f5f6;
  --surface: #ffffff;
  --surface-2: #fafafb;
  --surface-3: #f4f4f5;
  --border: #ececee;
  --border-strong: #e2e2e5;
  --text: #18181b;
  --text-2: #52525b;
  --muted: #71717a;
  --faint: #a6a6ad;

  --accent: #0f766e;
  --accent-strong: #115e59;
  --accent-lt: #0f766e;
  --on-accent: #ffffff;
  --accent-soft: color-mix(in srgb, var(--accent) 9%, transparent);
  --accent-soft-2: color-mix(in srgb, var(--accent) 14%, transparent);

  --ok: #16a34a;
  --warn: #c2410c;
  --bad: #dc2626;
  --info: #2563eb;
  --ok-soft: rgba(34, 197, 94, .12);
  --warn-soft: rgba(245, 158, 11, .13);
  --bad-soft: rgba(239, 68, 68, .12);
  --info-soft: rgba(96, 165, 250, .13);

  /* Avisos (.aviso): fondo, línea, punto, tinta */
  --ntc-info-bg: #eff5ff; --ntc-info-line: #d3e1fb; --ntc-info-dot: #2563eb; --ntc-info-ink: #1d4ed8;
  --ntc-warn-bg: #fff8eb; --ntc-warn-line: #f6dcaa; --ntc-warn-dot: #d97706; --ntc-warn-ink: #92400e;
  --ntc-bad-bg: #fef2f2;  --ntc-bad-line: #f8d0d0;  --ntc-bad-dot: #dc2626;  --ntc-bad-ink: #b91c1c;
  --ntc-ok-bg: #effaf3;   --ntc-ok-line: #c8ecd5;   --ntc-ok-dot: #16a34a;   --ntc-ok-ink: #15803d;

  /* Íconos de los avisos: el glifo es un hueco por el que se ve el fondo. */
  --g-info: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cmask id='m'%3E%3Ccircle cx='12' cy='12' r='12' fill='%23fff'/%3E%3Cpath d='M12 11v6M12 7.5h.01' stroke='%23000' stroke-width='2.4' stroke-linecap='round' fill='none'/%3E%3C/mask%3E%3Crect width='24' height='24' fill='%23fff' mask='url(%23m)'/%3E%3C/svg%3E");
  --g-warn: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cmask id='m'%3E%3Ccircle cx='12' cy='12' r='12' fill='%23fff'/%3E%3Cpath d='M12 7v6.5M12 17h.01' stroke='%23000' stroke-width='2.4' stroke-linecap='round' fill='none'/%3E%3C/mask%3E%3Crect width='24' height='24' fill='%23fff' mask='url(%23m)'/%3E%3C/svg%3E");
  --g-bad: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cmask id='m'%3E%3Ccircle cx='12' cy='12' r='12' fill='%23fff'/%3E%3Cpath d='M8.5 8.5l7 7M15.5 8.5l-7 7' stroke='%23000' stroke-width='2.4' stroke-linecap='round' fill='none'/%3E%3C/mask%3E%3Crect width='24' height='24' fill='%23fff' mask='url(%23m)'/%3E%3C/svg%3E");
  --g-ok: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cmask id='m'%3E%3Ccircle cx='12' cy='12' r='12' fill='%23fff'/%3E%3Cpath d='M7 12.5l3.3 3.3L17.2 9' stroke='%23000' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/mask%3E%3Crect width='24' height='24' fill='%23fff' mask='url(%23m)'/%3E%3C/svg%3E");
  --g-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 18 6-6-6-6'/%3E%3C/svg%3E");
  --g-select: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a8a93' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  --g-search: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238a8a93' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E");

  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;

  --radius: 14px;
  --rapido: 140ms ease;

  /* Armazón */
  --aside-w: 256px;
  --rail-w: 72px;
  --topbar-h: 60px;
  --tabbar-h: 54px;

  /* Alturas de control (escritorio con puntero fino) */
  --h-btn: 38px;
  --h-input: 40px;
  --h-filter: 36px;
  --h-icon: 32px;

  color-scheme: light;
}

/* ── Tokens: tema oscuro ─────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg: #0a0a0c;
  --surface: #141417;
  --surface-2: #1a1a1e;
  --surface-3: #1f1f24;
  --border: #26262b;
  --border-strong: #303036;
  --text: #fafafa;
  --text-2: #c2c2c9;
  --muted: #8a8a93;
  --faint: #65656d;

  --accent: #14b8a6;
  --accent-strong: #2dd4bf;
  --accent-lt: #5eead4;
  --on-accent: #042f2e;
  --accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
  --accent-soft-2: color-mix(in srgb, var(--accent) 20%, transparent);

  --ok: #22c55e;
  --warn: #f59e0b;
  --bad: #ef4444;
  --info: #60a5fa;

  --ntc-info-bg: #121c31; --ntc-info-line: #22365c; --ntc-info-dot: #60a5fa; --ntc-info-ink: #93c5fd;
  --ntc-warn-bg: #241c10; --ntc-warn-line: #4a3818; --ntc-warn-dot: #f59e0b; --ntc-warn-ink: #fcd34d;
  --ntc-bad-bg: #261414;  --ntc-bad-line: #4d2323;  --ntc-bad-dot: #ef4444;  --ntc-bad-ink: #fca5a5;
  --ntc-ok-bg: #10231a;   --ntc-ok-line: #1e4430;   --ntc-ok-dot: #22c55e;   --ntc-ok-ink: #86efac;

  color-scheme: dark;
}

/* Táctil: iPad, o cualquier ventana de menos de 1280px */
@media (max-width: 1279px), (pointer: coarse) {
  :root { --h-btn: 42px; --h-input: 44px; --h-filter: 42px; --h-icon: 40px; }
}
@media (max-width: 599px) {
  :root { --h-btn: 44px; --h-input: 44px; }
}

/* ── Base ────────────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 14px;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

::selection {
  background: color-mix(in srgb, var(--accent) 24%, transparent);
}

a {
  color: var(--accent-lt);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3,
h4 {
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0 0 0.5rem;
  color: var(--text);
}

h1 {
  font-size: 26px;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 17px;
}

h3 {
  font-size: 15px;
}

h4 {
  font-size: 13.5px;
  margin: 18px 0 6px;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.visualmente-oculto {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ══ Armazón ═══════════════════════════════════════════════════════════ */
.app {
  display: flex;
  min-height: 100dvh;
  width: 100%;
}

.main-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ── Menú lateral ── */
.sidebar {
  width: var(--aside-w);
  flex: none;
  height: 100dvh;
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.sidebar__logo {
  height: var(--topbar-h);
  flex: none;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
}

.sidebar__logo-mark {
  width: 32px;
  height: 32px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-lt);
}

.sidebar__logo-mark svg {
  width: 32px;
  height: 32px;
}

.sidebar__logo-text {
  display: block;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.015em;
  color: var(--text);
}

.sidebar__logo-sub {
  display: block;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--faint);
}

.sidebar__nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 6px 12px 10px;
  scrollbar-width: thin;
}

.sidebar__section-label {
  display: block;
  padding: 14px 11px 6px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar__link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 8px 11px;
  margin: 1px 0;
  border-radius: 9px;
  color: var(--text-2);
  font-weight: 500;
  font-size: 13.5px;
  white-space: nowrap;
  transition: background var(--rapido), color var(--rapido);
}

.sidebar__link:hover {
  background: var(--surface-3);
  color: var(--text);
  text-decoration: none;
}

.sidebar__link--active,
.sidebar__link--active:hover {
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-weight: 600;
}

.sidebar__link-icon {
  display: inline-flex;
  width: 17px;
  height: 17px;
  flex: none;
}

.sidebar__link-icon svg {
  width: 17px;
  height: 17px;
}

.sidebar__footer {
  flex: none;
  display: flex;
  flex-direction: column;
  padding: 4px 12px 0;
}

.sidebar__user {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 12px 14px;
  padding: 9px 10px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.sidebar__user-avatar {
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(140deg, var(--accent-lt), var(--accent-strong));
  color: var(--on-accent);
  font-size: 12px;
  font-weight: 700;
}

.sidebar__user-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.sidebar__user-name,
.sidebar__user-role {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar__user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.sidebar__user-role {
  font-size: 11px;
  color: var(--muted);
}

.sidebar__user-logout {
  width: 32px;
  height: 32px;
  flex: none;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--rapido), color var(--rapido);
}

.sidebar__user-logout svg {
  width: 17px;
  height: 17px;
}

.sidebar__user-logout:hover {
  background: var(--bad-soft);
  color: var(--bad);
}

.sidebar__rail-btn {
  display: none;
  align-items: center;
  justify-content: center;
  flex: none;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
}

.sidebar__rail-btn svg {
  width: 16px;
  height: 16px;
}

.sidebar__rail-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.sidebar__rail-btn--collapse {
  width: 32px;
  height: 32px;
  margin-left: auto;
}

.sidebar__rail-btn--collapse svg {
  transform: rotate(180deg);
}

.sidebar__rail-btn--expand {
  width: 46px;
  height: 40px;
  margin: 0 auto 6px;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1090;
  background: rgba(0, 0, 0, .5);
}

/* ── Barra superior ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  flex: none;
  height: calc(var(--topbar-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 26px 0;
  display: flex;
  align-items: center;
  gap: 14px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar__breadcrumb {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  font-size: 13px;
}

.topbar__crumb-root {
  color: var(--muted);
  white-space: nowrap;
}

.topbar__crumb-root:hover {
  color: var(--text);
  text-decoration: none;
}

.topbar__crumb-sep {
  display: inline-flex;
  color: var(--faint);
}

.topbar__crumb-sep svg {
  width: 14px;
  height: 14px;
}

.topbar__crumb-current {
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar__actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 9px;
}

.topbar__icon-btn,
.topbar__menu-btn,
.topbar__back {
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background var(--rapido), color var(--rapido);
}

.topbar__icon-btn:hover,
.topbar__menu-btn:hover,
.topbar__back:hover {
  background: var(--surface-2);
  color: var(--text);
}

.topbar__icon-btn svg,
.topbar__menu-btn svg,
.topbar__back svg {
  width: 17px;
  height: 17px;
}

.topbar__menu-btn,
.topbar__back {
  display: none;
}

html[data-theme="dark"] .theme-icon-moon,
html:not([data-theme="dark"]) .theme-icon-sun {
  display: none;
}

/* ── Contenido ── */
.principal {
  width: 100%;
  max-width: 1360px;
  margin: 0 auto;
  padding: 26px 26px 64px;
}

.contenedor {
  width: 100%;
}

.tabbar {
  display: none;
}

/* iPad (600–1279): franja de iconos, o menú expandido si se pidió */
@media (min-width: 600px) and (max-width: 1279px) {
  .principal {
    padding: 22px 22px 64px;
  }

  .topbar {
    padding-left: 22px;
    padding-right: 22px;
  }

  html[data-rail="open"] .sidebar__rail-btn--collapse {
    display: inline-flex;
  }

  html:not([data-rail="open"]) .sidebar {
    width: var(--rail-w);
  }

  html:not([data-rail="open"]) .sidebar__logo {
    justify-content: center;
    padding: 0;
  }

  html:not([data-rail="open"]) .sidebar__logo > div {
    display: none;
  }

  html:not([data-rail="open"]) .sidebar__nav {
    padding: 6px 13px 10px;
  }

  html:not([data-rail="open"]) .sidebar__section-label {
    font-size: 0;
    height: 1px;
    padding: 0;
    margin: 9px 4px;
    background: var(--border);
  }

  html:not([data-rail="open"]) .sidebar__section-label:first-child {
    display: none;
  }

  html:not([data-rail="open"]) .sidebar__link {
    width: 46px;
    height: 44px;
    padding: 0;
    justify-content: center;
    margin: 2px 0;
  }

  html:not([data-rail="open"]) .sidebar__link > span:not(.sidebar__link-icon) {
    display: none;
  }

  html:not([data-rail="open"]) .sidebar__link-icon,
  html:not([data-rail="open"]) .sidebar__link-icon svg {
    width: 19px;
    height: 19px;
  }

  html:not([data-rail="open"]) .sidebar__footer {
    align-items: center;
    padding: 8px 13px 4px;
  }

  html:not([data-rail="open"]) .sidebar__rail-btn--expand {
    display: inline-flex;
  }

  html:not([data-rail="open"]) .sidebar__user {
    margin: 6px auto 14px;
    padding: 0;
    background: none;
    border: 0;
    flex-direction: column;
    gap: 8px;
  }

  html:not([data-rail="open"]) .sidebar__user-info {
    display: none;
  }
}

/* Teléfono (<600): cajón + barra inferior */
@media (max-width: 599px) {
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(86vw, 300px);
    z-index: 1100;
    padding-top: env(safe-area-inset-top);
    transform: translateX(-100%);
    transition: transform .22s ease, box-shadow .22s ease;
  }

  .sidebar--open {
    transform: none;
    box-shadow: 0 0 48px rgba(0, 0, 0, .45);
  }

  .topbar {
    padding-left: 16px;
    padding-right: 16px;
    gap: 10px;
  }

  .topbar__menu-btn,
  .topbar__back {
    display: flex;
    width: 40px;
    height: 40px;
  }

  .topbar__icon-btn {
    width: 40px;
    height: 40px;
  }

  .topbar__crumb-root,
  .topbar__crumb-sep {
    display: none;
  }

  .topbar__crumb-current {
    font-size: 16px;
    font-weight: 700;
  }

  .principal {
    padding: 18px 16px 48px;
  }

  .app--con-barra .principal {
    padding-bottom: calc(96px + env(safe-area-inset-bottom));
  }

  .tabbar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--surface) 86%, transparent);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-top: 1px solid var(--border);
  }

  .tabbar__item {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
    -webkit-tap-highlight-color: transparent;
  }

  .tabbar__item:hover {
    text-decoration: none;
  }

  .tabbar__pill {
    width: 52px;
    height: 30px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .tabbar__pill svg {
    width: 20px;
    height: 20px;
  }

  .tabbar__item--active {
    color: var(--accent-strong);
    font-weight: 700;
  }

  .tabbar__item--active .tabbar__pill {
    background: var(--accent-soft);
  }

  h1 {
    font-size: 22px;
  }
}

/* ══ Encabezados de página y secciones ═════════════════════════════════ */
.subtitulo {
  color: var(--muted);
  font-size: 14px;
  margin: 4px 0 22px;
}

.encabezado {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 16px;
  margin-bottom: 18px;
}

.encabezado h1,
.encabezado h2 {
  margin: 0;
}

.encabezado .subtitulo {
  margin: 4px 0 0;
}

.encabezado > .acciones {
  margin-top: 0;
}

.seccion {
  margin-top: 28px;
}

.seccion > h2,
.seccion > .encabezado h2 {
  font-size: 16px;
}

.seccion--pegada {
  margin-top: 12px;
}

.ayuda {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.45;
  margin: 4px 0 0;
}

.acciones {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  justify-content: flex-end;
  margin-top: 18px;
}

.acciones--izquierda {
  justify-content: flex-start;
  margin-top: 8px;
}

.espaciador {
  flex: 1;
}

.cargando {
  color: var(--muted);
}

/* En el teléfono los botones del encabezado de la página van a lo ancho */
@media (max-width: 599px) {
  .contenedor > .encabezado > .boton,
  .contenedor > .encabezado > .acciones {
    width: 100%;
  }

  .contenedor > .encabezado > .acciones > .boton,
  .contenedor > .encabezado > .boton {
    flex: 1 1 auto;
  }
}

/* ══ Tarjetas ══════════════════════════════════════════════════════════ */
.rejilla {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}

.tarjeta {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  min-width: 0;
}

.tarjeta > h2:first-child,
.tarjeta > h3:first-child {
  font-size: 14.5px;
  margin-bottom: 16px;
}

.tarjeta p {
  margin: 0;
  color: var(--muted);
}

a.tarjeta {
  display: block;
  color: inherit;
  text-decoration: none;
  transition: border-color var(--rapido), transform var(--rapido), background var(--rapido);
}

a.tarjeta:hover,
a.tarjeta:focus-visible {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  transform: translateY(-1px);
}

a.tarjeta h2 {
  font-size: 15px;
  margin: 0 0 6px;
}

.tarjeta__icono {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  margin-bottom: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.tarjeta__icono svg {
  width: 20px;
  height: 20px;
}

.tarjeta--apagada {
  opacity: 0.75;
}

.etiqueta {
  display: inline-flex;
  align-items: center;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--surface-3);
  color: var(--muted);
  margin-bottom: 8px;
}

/* Cifras (KPI): etiqueta mono en mayúsculas y la cifra en mono */
.totales {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.total {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  container-type: inline-size;
}

.total > .ayuda:first-child {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}

.total strong {
  margin-top: 8px;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: min(19px, 11cqi);
  letter-spacing: -.01em;
  line-height: 1.2;
  white-space: nowrap;
  color: var(--text);
}

.total > .ayuda:not(:first-child) {
  margin-top: 4px;
  font-size: 12px;
}

/* KPI grandes (resumen de la app) */
.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

.kpi {
  min-width: 0;
  padding: 18px 20px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  container-type: inline-size;
}

.kpi__head {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.kpi__head svg {
  width: 15px;
  height: 15px;
  flex: none;
}

.kpi__label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  font-weight: 500;
  line-height: 1.4;
}

.kpi__value {
  margin-top: 12px;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: min(22px, 10.5cqi);
  letter-spacing: -.01em;
  line-height: 1.15;
  white-space: nowrap;
}

.kpi__unit {
  margin-left: 4px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.kpi__note {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.45;
}

@media (max-width: 899px) {
  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 599px) {
  .kpis {
    gap: 10px;
  }

  .kpi {
    padding: 14px;
  }

  .kpi__value {
    font-size: min(17px, 10.5cqi);
  }
}

/* ══ Formularios ═══════════════════════════════════════════════════════ */
.campo {
  display: grid;
  gap: 6px;
  margin-bottom: 16px;
  align-content: start;
  min-width: 0;
}

.campo > label:not(.casilla),
.etiqueta-campo,
.opciones-registro legend {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  width: 100%;
  min-width: 0;
  height: var(--h-input);
  padding: 0 13px;
  font-size: 13.5px;
  color: var(--text);
  background-color: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  transition: border-color var(--rapido), box-shadow var(--rapido);
}

input::placeholder,
textarea::placeholder {
  color: var(--faint);
}

input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft-2);
}

textarea {
  height: auto;
  min-height: 80px;
  padding: 10px 13px;
  line-height: 1.5;
  resize: vertical;
}

select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background-image: var(--g-select);
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 16px;
  cursor: pointer;
}

select option {
  background: var(--surface);
  color: var(--text);
}

input[type="search"] {
  padding-left: 38px;
  background-image: var(--g-search);
  background-repeat: no-repeat;
  background-position: left 12px center;
  background-size: 16px;
}

input[type="date"],
input[type="month"] {
  -webkit-appearance: none;
  appearance: none;
}

input::-webkit-date-and-time-value {
  text-align: left;
}

input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--accent);
}

/* El iPhone hace zoom al tocar un campo de menos de 16px */
@media (pointer: coarse) and (max-width: 599px) {
  input,
  select,
  textarea {
    font-size: 16px !important;
  }
}

.form-rejilla {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0 18px;
}

.form-rejilla .campo--ancho {
  grid-column: 1 / -1;
}

@media (min-width: 640px) {
  .form-rejilla {
    grid-template-columns: 1fr 1fr;
  }
}

.casilla {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-bottom: 16px;
  font-size: 13.5px;
  color: var(--text-2);
  cursor: pointer;
}

.casilla input {
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  flex: none;
}

.buscador {
  display: flex;
  flex-wrap: wrap-reverse;
  align-items: center;
  gap: 10px 18px;
  margin-bottom: 14px;
}

.buscador input[type="search"] {
  flex: 1 1 280px;
  width: auto;
}

.buscador .casilla {
  margin: 0;
  flex: none;
}

/* ══ Botones ═══════════════════════════════════════════════════════════ */
.boton {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--h-btn);
  padding: 0 15px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  text-decoration: none;
  color: var(--on-accent);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 10px;
  cursor: pointer;
  transition: background var(--rapido), filter var(--rapido), border-color var(--rapido), transform var(--rapido);
}

.boton:hover {
  filter: brightness(1.07);
  text-decoration: none;
}

.boton:active:not(:disabled) {
  transform: translateY(1px);
}

.boton:disabled {
  opacity: 0.55;
  cursor: progress;
}

.boton svg {
  width: 16px;
  height: 16px;
  flex: none;
}

.boton--bloque {
  width: 100%;
}

.boton--secundario {
  background: var(--surface);
  color: var(--text-2);
  border-color: var(--border);
}

.boton--secundario:hover {
  filter: none;
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border-strong);
}

.boton--peligro {
  background: transparent;
  color: var(--bad);
  border-color: color-mix(in srgb, var(--bad) 32%, transparent);
}

.boton--peligro:hover {
  filter: none;
  background: var(--bad-soft);
  border-color: var(--bad);
}

.boton--chico {
  min-height: 32px;
  padding: 0 12px;
  font-size: 12px;
}

.boton--rojo {
  background: var(--bad);
  border-color: var(--bad);
  color: #fff;
}

/* Botón con aspecto de enlace (el nombre de una cuenta en una tabla) */
.enlace {
  font: inherit;
  font-weight: 600;
  color: var(--accent-lt);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
}

.enlace:hover {
  text-decoration: underline;
}

/* ══ Avisos ════════════════════════════════════════════════════════════ */
.aviso {
  --t-bg: var(--ntc-info-bg);
  --t-line: var(--ntc-info-line);
  --t-dot: var(--ntc-info-dot);
  --t-glyph: var(--g-info);
  position: relative;
  margin: 0 0 16px;
  padding: 13px 16px 13px 50px;
  border-radius: 12px;
  background: var(--t-bg);
  border: 1px solid var(--t-line);
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  white-space: pre-line;
}

.aviso::before {
  content: '';
  position: absolute;
  left: 16px;
  top: 12px;
  width: 22px;
  height: 22px;
  background: var(--t-dot);
  -webkit-mask: var(--t-glyph) center / contain no-repeat;
  mask: var(--t-glyph) center / contain no-repeat;
}

.aviso--error {
  --t-bg: var(--ntc-bad-bg);
  --t-line: var(--ntc-bad-line);
  --t-dot: var(--ntc-bad-dot);
  --t-glyph: var(--g-bad);
  color: var(--ntc-bad-ink);
}

.aviso--advertencia {
  --t-bg: var(--ntc-warn-bg);
  --t-line: var(--ntc-warn-line);
  --t-dot: var(--ntc-warn-dot);
  --t-glyph: var(--g-warn);
}

.aviso--ok {
  --t-bg: var(--ntc-ok-bg);
  --t-line: var(--ntc-ok-line);
  --t-dot: var(--ntc-ok-dot);
  --t-glyph: var(--g-ok);
}

.aviso strong,
.aviso b {
  color: var(--text);
}

.aviso ul {
  margin: 4px 0 0;
  padding-left: 18px;
  white-space: normal;
}

.aviso a {
  font-weight: 600;
}

/* ══ Chips de estado ═══════════════════════════════════════════════════ */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.35;
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--surface-3);
  color: var(--muted);
}

.chip--ok,
.chip--alerta {
  text-decoration: none;
}

.chip--ok::before,
.chip--alerta::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

.chip--ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.chip--alerta {
  background: var(--warn-soft);
  color: var(--warn);
}

a.chip--alerta:hover {
  text-decoration: underline;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: flex-end;
}

.resumen-mes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

/* ══ Listas (una tarjeta con filas, como los catálogos del kit) ════════ */
.lista {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.lista:empty {
  display: none;
}

.lista > * {
  min-width: 0;
  margin: 0;
  border: 0;
  border-radius: 0;
  border-bottom: 1px solid var(--border);
}

.lista > :last-child {
  border-bottom: 0;
}

.fila-lista {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  background: transparent;
  color: inherit;
  text-decoration: none;
  line-height: 1.35;
  transition: background var(--rapido);
}

a.fila-lista:hover,
button.fila-lista:hover,
a.fila-lista:focus-visible,
button.fila-lista:focus-visible {
  background: var(--surface-2);
  text-decoration: none;
}

button.fila-lista {
  width: 100%;
  font: inherit;
  text-align: left;
  cursor: pointer;
  border: 0;
}

.fila-lista--fija {
  background: var(--surface-2);
}

.fila-lista__inicial {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 700;
}

.fila-lista__principal {
  flex: 1;
  min-width: 0;
}

.fila-lista__titulo {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
}

.fila-lista__detalle {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vacio {
  color: var(--muted);
  text-align: center;
  padding: 36px 20px;
  font-size: 13.5px;
}

.monto {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.monto--sube {
  color: var(--text);
}

.monto--baja {
  color: var(--ok);
}

/* Tarjeta que se abre (repartición del cierre) */
details.tarjeta--plegable {
  padding: 0;
}

details.tarjeta--plegable > summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  cursor: pointer;
  list-style: none;
  transition: background var(--rapido);
}

details.tarjeta--plegable > summary:hover {
  background: var(--surface-2);
}

details.tarjeta--plegable > summary::-webkit-details-marker {
  display: none;
}

details.tarjeta--plegable > summary::before {
  content: '';
  width: 16px;
  height: 16px;
  flex: none;
  background: var(--muted);
  -webkit-mask: var(--g-chevron) center / contain no-repeat;
  mask: var(--g-chevron) center / contain no-repeat;
  transition: transform 0.15s;
}

details.tarjeta--plegable[open] > summary {
  border-bottom: 1px solid var(--border);
}

details.tarjeta--plegable[open] > summary::before {
  transform: rotate(90deg);
}

details.tarjeta--plegable > :not(summary) {
  margin-left: 18px;
  margin-right: 18px;
}

details.tarjeta--plegable > summary + * {
  margin-top: 16px;
}

details.tarjeta--plegable > :last-child {
  margin-bottom: 18px;
}

details.tarjeta--plegable .fila-lista__principal {
  display: grid;
}

/* ══ Tablas ════════════════════════════════════════════════════════════ */
.tabla-envoltura {
  position: relative;
  overflow-x: auto;
  margin: 0 -20px;
}

.tarjeta > .tabla-envoltura:first-child {
  margin-top: -20px;
}

.tarjeta > .tabla-envoltura:last-child {
  margin-bottom: -20px;
}

.tarjeta:has(> .tabla-envoltura) {
  overflow: hidden;
}

.tabla {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13.5px;
}

.tabla th,
.tabla td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

.tabla :is(th, td):first-child {
  padding-left: 20px;
}

.tabla :is(th, td):last-child {
  padding-right: 20px;
}

.tabla thead th {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--faint);
  background: var(--surface-2);
  white-space: nowrap;
}

.tabla tbody tr:last-child td,
.tabla tbody tr:last-child th {
  border-bottom: none;
}

.tabla tbody tr:hover > td {
  background: var(--surface-2);
}

.tabla tfoot th,
.tabla tfoot td {
  color: var(--text);
  font-weight: 700;
  border-top: 1px solid var(--border-strong);
  border-bottom: none;
  background: var(--surface-2);
}

.tabla tbody th {
  font-weight: 600;
}

.num {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.tabla--apagada td {
  opacity: 0.55;
}

.input-unidades {
  width: 120px !important;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.input-unidades[aria-invalid="true"] {
  border-color: var(--bad) !important;
  box-shadow: 0 0 0 3px var(--bad-soft) !important;
}

/* ══ Diálogos (ventana; hoja que sube desde abajo en el teléfono) ══════ */
dialog {
  padding: 0;
  width: min(600px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  overflow: auto;
  overscroll-behavior: contain;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
}

dialog::backdrop {
  background: rgba(5, 5, 8, .62);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.dialogo__cuerpo {
  padding: 0 20px;
}

.dialogo__cuerpo > h2:first-child {
  position: sticky;
  top: 0;
  z-index: 3;
  margin: 0 -20px 18px;
  padding: 16px 20px;
  font-size: 15px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.dialogo__cuerpo > .acciones:last-child {
  position: sticky;
  bottom: 0;
  z-index: 3;
  margin: 20px -20px 0;
  padding: 12px 20px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
}

.dialogo__cuerpo > .ayuda {
  margin-bottom: 16px;
}

@media (max-width: 599px) {
  dialog {
    width: 100%;
    max-width: 100%;
    margin: auto 0 0;
    max-height: calc(100dvh - 24px);
    border-radius: 20px 20px 0 0;
    border-bottom: 0;
  }

  .dialogo__cuerpo {
    padding: 0 16px;
  }

  .dialogo__cuerpo > h2:first-child {
    margin: 0 -16px 16px;
    padding: 18px 16px 14px;
  }

  .dialogo__cuerpo > .acciones:last-child {
    margin: 18px -16px 0;
    padding: 12px 16px calc(14px + env(safe-area-inset-bottom));
    flex-wrap: nowrap;
  }

  .dialogo__cuerpo > .acciones:last-child .espaciador {
    display: none;
  }

  .dialogo__cuerpo > .acciones:last-child .boton {
    flex: 1;
  }
}

/* Pregunta (en lugar de confirm() del navegador) */
.pregunta {
  width: min(440px, calc(100vw - 32px));
}

.pregunta__cuerpo {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
}

.pregunta__cabeza {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pregunta__icono {
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--warn-soft);
  color: var(--ntc-warn-dot);
}

.pregunta--peligro .pregunta__icono {
  background: var(--bad-soft);
  color: var(--bad);
}

.pregunta__icono svg {
  width: 20px;
  height: 20px;
}

.pregunta__titulo {
  margin: 0;
  font-size: 17px;
  line-height: 1.3;
}

.pregunta__texto {
  margin: 0;
  font-size: 13.5px;
  color: var(--text-2);
  white-space: pre-line;
}

.pregunta__acciones {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

@media (max-width: 599px) {
  .pregunta {
    width: 100%;
  }

  .pregunta__cuerpo {
    padding: 22px 20px calc(24px + env(safe-area-inset-bottom));
  }

  .pregunta__acciones {
    flex-direction: column-reverse;
    gap: 10px;
  }

  .pregunta__acciones .boton {
    width: 100%;
    min-height: 48px;
    font-size: 15px;
  }
}

/* ══ Mensaje breve (toast): abajo al centro, oscuro en los dos temas ═══ */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 2600;
  display: flex;
  align-items: center;
  gap: 11px;
  width: max-content;
  max-width: min(440px, calc(100vw - 32px));
  padding: 12px 16px 12px 13px;
  border-radius: 14px;
  background: #18181b;
  color: #fafafa;
  border: 1px solid #18181b;
  box-shadow: 0 10px 30px rgba(24, 24, 27, .22);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.4;
  animation: toast-sube .2s ease;
}

.toast::before {
  content: '';
  width: 22px;
  height: 22px;
  flex: none;
  background: #22c55e;
  -webkit-mask: var(--g-ok) center / contain no-repeat;
  mask: var(--g-ok) center / contain no-repeat;
}

[data-theme="dark"] .toast {
  background: #1f1f24;
  border-color: #303036;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .5);
}

@keyframes toast-sube {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@media (max-width: 599px) {
  .app--con-barra ~ .toast,
  body:has(.app--con-barra) .toast {
    bottom: calc(80px + env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion: reduce) {
  .toast {
    animation: none;
  }
}

/* ══ Acceso (inicio de sesión) ═════════════════════════════════════════ */
.acceso {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}

.acceso .tarjeta {
  width: 100%;
  max-width: 400px;
  padding: 30px 26px 26px;
}

.acceso__marca {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 26px;
}

.acceso__logo {
  width: 40px;
  height: 40px;
  color: var(--accent-lt);
}

.acceso h1 {
  font-size: 22px;
  margin: 0;
}

.acceso .subtitulo {
  margin: 4px 0 22px;
}

.acceso .boton--bloque {
  margin-top: 6px;
}

/* ══ Distribuidor: precio por botellón ═════════════════════════════════ */
.precio-total {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
  margin: 0;
  color: var(--text);
}

.desglose {
  color: var(--muted);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.campos-config {
  display: grid;
  gap: 0;
  margin-bottom: 8px;
}

.campo-config {
  display: grid;
  grid-template-columns: 28px 1fr 104px;
  grid-template-areas:
    "check nombre valor"
    ". cuenta cuenta";
  gap: 8px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.campo-config:last-child {
  border-bottom: none;
}

.campo-config__check { grid-area: check; }
.campo-config__nombre { grid-area: nombre; }
.campo-config__valor { grid-area: valor; }
.campo-config__cuenta { grid-area: cuenta; }

.campo-config__check input {
  width: 20px;
  height: 20px;
}

.campo-config--apagado .campo-config__nombre,
.campo-config--apagado .campo-config__valor,
.campo-config--apagado .campo-config__cuenta {
  opacity: 0.5;
}

.encabezados-config {
  display: none;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--faint);
}

@media (min-width: 720px) {
  .campo-config {
    grid-template-columns: 28px 1.2fr 112px 1.4fr;
    grid-template-areas: "check nombre valor cuenta";
  }

  .encabezados-config {
    display: grid;
    grid-template-columns: 28px 1.2fr 112px 1.4fr;
    gap: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
  }
}

details.historial summary {
  cursor: pointer;
  color: var(--accent-lt);
  font-weight: 600;
  margin-top: 10px;
}

.historial__version {
  border-top: 1px solid var(--border);
  padding: 8px 0;
  font-size: 13px;
}

/* ══ Movimientos ═══════════════════════════════════════════════════════ */
.opciones-registro {
  border: none;
  padding: 0;
  margin: 0 0 16px;
}

.opciones-registro legend {
  margin-bottom: 8px;
}

.opciones-registro > div {
  display: grid;
  gap: 6px;
}

.opcion-registro {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color var(--rapido), background var(--rapido);
}

.opcion-registro:hover {
  border-color: var(--border-strong);
}

.opcion-registro:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.opcion-registro input {
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  flex: none;
}

.opcion-registro span {
  display: grid;
  font-weight: 600;
}

.opcion-registro .ayuda {
  margin: 0;
  font-weight: 400;
}

/* Solo se explica la opción elegida (el formulario es más corto) */
.opcion-registro:not(:has(input:checked)) .ayuda {
  display: none;
}

.vista-previa {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  min-height: 1.5em;
  margin: 0 0 8px;
}

/* ══ Cierre del mes ════════════════════════════════════════════════════ */
.campo--mes {
  margin: 0;
  min-width: 190px;
}

.campo--mes .chip {
  justify-self: start;
}

.traspasos {
  list-style: none;
  margin: 0;
  padding: 0;
}

.traspasos li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.traspasos li > span:first-child {
  flex: 1;
}

.form-traspaso {
  border-top: 1px solid var(--border);
  margin-top: 16px;
  padding-top: 8px;
}

/* ══ Reportes ══════════════════════════════════════════════════════════ */
.pestanas {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  max-width: 100%;
  margin-bottom: 18px;
  overflow-x: auto;
  scrollbar-width: none;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.pestanas::-webkit-scrollbar {
  display: none;
}

.pestanas button {
  display: inline-flex;
  align-items: center;
  height: calc(var(--h-filter) - 8px);
  padding: 0 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
}

.pestanas button:hover {
  color: var(--text);
}

.pestanas button[aria-selected="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(17, 17, 20, .08);
}

[data-theme="dark"] .pestanas button[aria-selected="true"] {
  background: var(--surface-3);
}

.recibo h3 {
  font-size: 13.5px;
  margin: 22px 0 8px;
}

.recibo__encabezado {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-strong);
}

.recibo .tabla-envoltura {
  margin: 0;
}

.recibo .tabla :is(th, td):first-child {
  padding-left: 0;
}

.recibo .tabla :is(th, td):last-child {
  padding-right: 0;
}

.recibo .tabla thead th,
.recibo .tabla tfoot :is(th, td) {
  background: transparent;
}

.recibo__detalle td {
  color: var(--muted);
  font-size: 12.5px;
  padding-top: 4px;
  padding-bottom: 4px;
  white-space: pre;
}

/* ══ Impresión ═════════════════════════════════════════════════════════ */
@media print {
  .sidebar,
  .topbar,
  .tabbar,
  .sidebar-backdrop,
  .no-imprimir,
  .toast {
    display: none !important;
  }

  html,
  body {
    background: #fff;
    color: #000;
  }

  .principal {
    padding: 0;
    max-width: none;
  }

  .tarjeta {
    border: none;
    padding: 0;
  }

  .tabla-envoltura {
    overflow: visible;
    margin: 0;
  }

  .tabla thead th,
  .tabla tfoot :is(th, td) {
    background: transparent;
  }

  .tabla :is(th, td):first-child {
    padding-left: 0;
  }

  .tabla :is(th, td):last-child {
    padding-right: 0;
  }
}

/* ══ Resumen de la app ═════════════════════════════════════════════════ */
.resumen__titulo {
  margin: 0 0 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
}

h2.seccion {
  font-size: 16px;
  margin-bottom: 14px;
}

@media (max-width: 599px) {
  .totales {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .total {
    padding: 12px 14px;
  }
}

/* Los campos ya marcan el foco con su borde y su halo */
input:not([type="checkbox"]):not([type="radio"]):focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
}

.tabla-envoltura + .ayuda {
  margin-top: 14px;
}
