/* Solar Finanzas: tokens de la identidad visual v0.2 (sección 12) sobre Bulma 1.x.
   Traducción a variables CSS del tema solar-bulma.scss (sin Sass ni Node en el build): mismos colores,
   tipografías, radio de 6 px y ajustes de marca.
   Diseño del shell: "Shell e Inicio" y la especificación del Inicio (secciones 4 y 5).
   Reglas de uso:
   1. Un solo .button.is-primary por pantalla: fondo Solar 500 con texto Pizarra 900, nunca texto blanco.
   2. Estados siempre con .tag.is-light (aceptado is-success, rechazado is-danger, en proceso is-info, por agotarse is-warning).
   3. Nada de .hero de color ni botones .is-rounded.
   4. El naranja nunca es color de texto sobre blanco: para texto y enlaces, Solar 800.
   5. El único bloque oscuro es la barra superior.
   6. NCF, RNC y números e-CF llevan .is-fiscal-code.
   7. Cifras tabulares (global) y montos alineados a la derecha en tablas (.has-text-right). */
:root {
  /* Paleta de marca */
  --solar-300: #F5A33A;      /* Variante clara sobre fondos oscuros */
  --solar-500: #E8890C;      /* Primario: botones, logo, subrayado de pestaña */
  --solar-700: #B86A05;      /* Hover del botón primario */
  --solar-800: #9A5804;      /* Enlaces y texto naranja sobre blanco */
  --slate-900: #1F2A37;      /* Pizarra 900: barra superior, texto principal */
  --gray-600: #5B6573;
  --gray-300: #D9DDE3;
  --gray-100: #F4F5F7;
  /* Semánticos (solo en etiquetas de estado) */
  --success: #1A7A4D;
  --danger: #C2362B;
  --info: #2F6FB5;

  /* Tokens de uso */
  --primary: var(--solar-500);
  --on-primary: var(--slate-900);
  --link: var(--solar-800);
  --bg: var(--gray-100);
  --surface: #FFFFFF;
  --text: var(--slate-900);
  --muted: var(--gray-600);
  --line: var(--gray-300);
  --divider: #EDEFF2;
  --menu-active: #FDF1E2;
  --shadow: 0 1px 2px rgba(31, 42, 55, .06), 0 2px 10px rgba(31, 42, 55, .06);
  --scrim: rgba(10, 14, 20, .5);

  /* Barra superior */
  --topbar-h: 56px;
  --topbar-bg: var(--slate-900);
  --topbar-ink: #E6E9ED;
  --topbar-muted: #9AA5B4;
  --topbar-field: #141B24;
  --topbar-field-line: #2E3A49;

  --f-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, monospace;

  --r-s: 6px; --r-m: 10px;

  /* Puente hacia Bulma 1.x (variables HSL), igual que solar-bulma.scss:
     primary Solar 500, link Solar 800, warning Solar 300, dark Pizarra 900, text Pizarra 900, border Gris 300. */
  --bulma-primary-h: 34deg; --bulma-primary-s: 90%; --bulma-primary-l: 48%;
  --bulma-primary-invert-l: 17%;
  --bulma-link-h: 34deg; --bulma-link-s: 95%; --bulma-link-l: 31%; --bulma-link-on-scheme-l: 31%;
  --bulma-info-h: 211deg; --bulma-info-s: 59%; --bulma-info-l: 45%;
  --bulma-success-h: 152deg; --bulma-success-s: 65%; --bulma-success-l: 29%;
  --bulma-danger-h: 4deg; --bulma-danger-s: 64%; --bulma-danger-l: 46%;
  --bulma-warning-h: 34deg; --bulma-warning-s: 90%; --bulma-warning-l: 59%;
  --bulma-dark-h: 212deg; --bulma-dark-s: 28%; --bulma-dark-l: 17%;
  --bulma-scheme-h: 213deg; --bulma-scheme-s: 12%;
  --bulma-text: var(--text); --bulma-text-strong: var(--text); --bulma-border: var(--line);
  --bulma-family-primary: var(--f-body);
  --bulma-family-code: var(--f-mono);
  --bulma-radius: var(--r-s); --bulma-radius-large: var(--r-m);
}
/* Modo oscuro: solo con data-theme="dark" en <html>. App.razor fija data-theme="light" por defecto. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --primary: var(--solar-300); --link: var(--solar-300);
    --bg: #141B24; --surface: #1F2A37; --text: #E6E9ED; --muted: #9AA5B4; --line: #2E3A49; --divider: #2E3A49;
    --menu-active: color-mix(in srgb, var(--solar-300) 16%, #1F2A37);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    --topbar-bg: #0F151D;
    --bulma-primary-l: 59%; --bulma-link-l: 59%; --bulma-link-on-scheme-l: 59%;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --primary: var(--solar-300); --link: var(--solar-300);
  --bg: #141B24; --surface: #1F2A37; --text: #E6E9ED; --muted: #9AA5B4; --line: #2E3A49; --divider: #2E3A49;
  --menu-active: color-mix(in srgb, var(--solar-300) 16%, #1F2A37);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  --topbar-bg: #0F151D;
  --bulma-primary-l: 59%; --bulma-link-l: 59%; --bulma-link-on-scheme-l: 59%;
  color-scheme: dark;
}

html, body { background: var(--bg); color: var(--text); }
body { font-family: var(--f-body); font-size: 16px; font-variant-numeric: tabular-nums; }
.title { letter-spacing: -0.01em; text-wrap: balance; color: var(--text); }
.subtitle { color: var(--muted); }
.is-fiscal-code, .mono { font-family: var(--f-mono); font-size: .875em; }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; font-weight: 600; color: var(--muted); }
.muted { color: var(--muted); }
.ic { width: 1.15em; height: 1.15em; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: -0.2em; }
.icon-sprite { position: absolute; width: 0; height: 0; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.skip-link { position: absolute; left: 16px; top: -100px; z-index: 100; background: var(--surface); color: var(--text); padding: .5rem 1rem; border-radius: var(--r-s); box-shadow: var(--shadow); }
.skip-link:focus { top: 8px; }

/* Botón primario: texto Pizarra 900 sobre Solar (5.5:1) */
.button.is-primary { background: var(--solar-500); color: var(--on-primary); font-weight: 600; }
.button.is-primary:hover { background: var(--solar-700); color: var(--on-primary); }

/* Superficies: tarjetas blancas con sombra suave, sin borde */
.box, .card { background: var(--surface); color: var(--text); border-radius: var(--r-m); box-shadow: var(--shadow); }
.card-header { box-shadow: none; border-bottom: 1px solid var(--divider); }
/* Pantallas de configuración: las tarjetas se reparten a lo ancho, tantas por fila como quepan. */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 26rem), 1fr)); gap: 1.25rem; align-items: start; margin-bottom: 1.25rem; }
.settings-grid > .box { margin-bottom: 0; }
.card-header-title { color: var(--text); font-weight: 600; }
.card-content { color: var(--text); }
.card-footer { border-top-color: var(--divider); }
.card-footer-item { color: var(--link); }
.card > .card-content.is-flush { padding: 0; }
.table { background: transparent; color: var(--text); }
.table td, .table th { border-color: var(--divider); }
.table thead th { color: var(--text); }

/* Etiqueta neutra (.tag.is-light sin color): nombre del módulo en las tarjetas */
.tag.is-light:not(.is-success):not(.is-danger):not(.is-info):not(.is-warning):not(.is-primary):not(.is-link) { background: var(--bg); color: var(--text); }
/* Avisos de advertencia: fondo Solar claro con texto Pizarra (v0.2) */
.notification.is-warning.is-light { background: color-mix(in srgb, var(--solar-300) 26%, var(--surface)); color: var(--text); }

/* Pestaña activa con el subrayado de marca */
.tabs li.is-active a { border-bottom-color: var(--solar-500); color: var(--text); font-weight: 600; }

/* Logo: sol con dos órbitas */
.logo { display: inline-flex; align-items: center; gap: .5rem; font-weight: 700; font-size: 17px; color: inherit; white-space: nowrap; }
.logo:hover { color: inherit; }
.logo-mark { width: 28px; height: 28px; display: inline-grid; flex: none; }
.logo-mark svg { width: 28px; height: 28px; }

/* ---------- Autenticación ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding-block: 2.5rem; padding-inline: 16px; }
.auth .inner { width: 100%; max-width: 420px; display: grid; justify-items: center; }
.auth .logo { margin-bottom: 1.5rem; color: var(--text); font-size: 20px; }
.auth .logo-mark, .auth .logo-mark svg { width: 34px; height: 34px; }
.auth-card { width: 100%; padding: 2rem; }
@media (max-width: 768px) { .auth-card { padding: 1.5rem 1.25rem; } }

/* ---------- Páginas de estado (404 y error) ---------- */
.status-page { min-height: 100vh; display: grid; place-items: center; padding-block: 3rem; padding-inline: 16px; }
.status-inner { width: 100%; max-width: 520px; text-align: center; display: grid; justify-items: center; }
.status-inner .logo { color: var(--text); margin-bottom: 2rem; }
.status-code { font-size: 3.5rem; font-weight: 700; color: var(--link); line-height: 1; margin-bottom: 1rem; }
.status-lead { color: var(--muted); max-width: 44ch; font-size: 1rem; }
.ref-box { margin-top: 1.5rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; width: 100%; background: var(--surface); box-shadow: var(--shadow); border-radius: var(--r-m); padding: .8rem 1rem; text-align: left; flex-wrap: wrap; }
.ref-box > div { display: grid; gap: .3rem; min-width: 0; }
.ref-box code { background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: var(--r-s); padding: .1rem .4rem; font-size: .85rem; overflow-wrap: anywhere; }

/* ---------- Shell: barra superior oscura + menú lateral blanco ---------- */
.app { display: grid; grid-template-columns: 260px minmax(0, 1fr); grid-template-rows: var(--topbar-h) minmax(0, 1fr); grid-template-areas: "top top" "side main"; min-height: 100vh; }

.topbar { grid-area: top; position: sticky; top: 0; z-index: 30; height: var(--topbar-h); background: var(--topbar-bg); color: var(--topbar-ink); display: flex; align-items: center; gap: 16px; padding: 0 24px 0 20px; }
.topbar .logo { color: #FFFFFF; }
.topbar .spacer { flex: 1; }
.topbar :focus-visible { outline-color: var(--solar-300); }
.topbar-company { min-width: 0; flex: 0 1 auto; }
.topbar-company:empty { display: none; }
.topbar-company .select, .topbar-company select { max-width: 100%; }
.topbar-company select { text-overflow: ellipsis; }
/* Selector de empresa activa (lo llena SEC-05): .select.is-small dentro de .topbar-company */
.topbar .select select, .topbar .input { background: var(--topbar-field); border-color: var(--topbar-field-line); color: var(--topbar-ink); box-shadow: none; }
.topbar .select:not(.is-multiple):not(.is-loading)::after { border-color: var(--topbar-ink); }
.topbar .input::placeholder { color: var(--topbar-muted); }
.topbar .input:focus, .topbar .select select:focus { border-color: var(--solar-300); box-shadow: 0 0 0 3px color-mix(in srgb, var(--solar-300) 30%, transparent); }
.topbar-search { flex: 0 1 460px; min-width: 0; }
.topbar-search .icon { color: var(--topbar-muted); }
.topbar-search kbd { position: absolute; right: .5rem; top: 50%; transform: translateY(-50%); font: 500 .7rem var(--f-body); color: var(--topbar-muted); border: 1px solid var(--topbar-field-line); border-radius: 4px; padding: 0 .3rem; pointer-events: none; }
.topbar-btn { width: 40px; height: 40px; border-radius: var(--r-s); display: inline-grid; place-items: center; border: 0; background: transparent; color: var(--topbar-ink); cursor: pointer; flex: none; position: relative; }
.topbar-btn:hover { background: rgba(255, 255, 255, .08); }
.topbar-btn .dot { position: absolute; top: 9px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--solar-300); }
.search-btn { display: none; }
.menu-btn { display: inline-grid; }

.user-menu { position: relative; }
.user-btn { display: inline-flex; align-items: center; gap: .4rem; min-height: 40px; padding: 0 .5rem; border: 0; border-radius: var(--r-s); background: transparent; color: var(--topbar-ink); font: 500 .95rem var(--f-body); cursor: pointer; max-width: 240px; }
.user-btn:hover { background: rgba(255, 255, 255, .08); }
.user-btn .ic-user { display: none; }
.user-btn .user-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-dropdown { position: absolute; right: 0; top: calc(100% + 8px); min-width: 210px; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: var(--r-m); box-shadow: 0 8px 24px rgba(15, 21, 29, .18); padding: 6px; z-index: 40; }
.user-dropdown[hidden] { display: none; }
.user-dropdown form { margin: 0; }
.user-dropdown-item { display: flex; align-items: center; gap: .6rem; width: 100%; min-height: 44px; padding: 0 .75rem; border: 0; border-radius: var(--r-s); background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.user-dropdown-item:hover { background: var(--bg); color: var(--text); }

.sidebar { grid-area: side; background: var(--surface); border-right: 1px solid var(--line); padding: 24px 16px; position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); overflow-y: auto; }
.sidebar .menu-label { color: var(--muted); font-size: .72rem; letter-spacing: .1em; font-weight: 500; margin: 1.25rem 0 .5rem; padding-inline: .75rem; display: flex; align-items: center; gap: .5rem; white-space: nowrap; }
.sidebar .menu-list a { display: flex; align-items: center; gap: .5rem; padding: .6rem .75rem; border-radius: var(--r-s); color: var(--text); box-sizing: border-box; }
.sidebar .menu-list a:hover { background: var(--bg); color: var(--text); }
.sidebar .menu-list a.is-active { background: var(--menu-active); color: var(--text); font-weight: 600; }
.sidebar .menu-list a .tag { margin-left: auto; }
.sidebar .menu-add { color: var(--link); }
/* SEC-14: una sección con varias opciones se despliega (details/summary, sin JavaScript). */
/* Módulos del menú como acordeón: el título es el summary y abre o cierra sus secciones. */
.sidebar .menu-module > summary { cursor: pointer; list-style: none; margin: .35rem 0; padding: .6rem .75rem; border-radius: var(--r-s); color: var(--text); font-size: .9rem; font-weight: 600; letter-spacing: .04em; white-space: normal; line-height: 1.25; }
.sidebar .menu-module > summary .menu-text { min-width: 0; overflow-wrap: anywhere; }
.sidebar .menu-module > summary .ic { flex-shrink: 0; }
.sidebar .menu-module > summary::-webkit-details-marker { display: none; }
.sidebar .menu-module > summary:hover { background: var(--bg); }
.sidebar .menu-module > summary:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.sidebar .menu-module > summary .menu-chevron { margin-left: auto; transition: transform .15s ease; }
.sidebar .menu-module[open] > summary .menu-chevron { transform: rotate(180deg); }
.sidebar .menu-section > summary { display: flex; align-items: center; gap: .5rem; padding: .6rem .75rem; border-radius: var(--r-s); color: var(--text); cursor: pointer; list-style: none; }
.sidebar .menu-section > summary::-webkit-details-marker { display: none; }
.sidebar .menu-section > summary:hover { background: var(--bg); }
.sidebar .menu-section > summary:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.sidebar .menu-section .menu-chevron { margin-left: auto; transition: transform .15s ease; }
.sidebar .menu-section[open] .menu-chevron { transform: rotate(180deg); }
.sidebar .menu-section > ul { margin: .15rem 0 .35rem 1.1rem; padding-left: .6rem; border-left: 1px solid var(--line); }
/* El módulo abierto se distingue de los demás: va en un bloque propio, su título en naranja oscuro y sus opciones
   sangradas junto a una línea naranja. */
.sidebar .menu-module[open] { background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-m); margin-block: .5rem; padding-bottom: .5rem; }
.sidebar .menu-module[open] > summary { margin: 0; color: var(--link); font-weight: 700; }
.sidebar .menu-module[open] > summary:hover { background: var(--surface); }
.sidebar .menu-module[open] > .menu-list { margin: .15rem .35rem 0 1.15rem; padding-left: .4rem; border-left: 2px solid var(--primary); }
.sidebar .menu-module[open] .menu-list a { background: transparent; }
.sidebar .menu-module[open] > .menu-list a:hover,
.sidebar .menu-module[open] .menu-section a:hover,
.sidebar .menu-module[open] .menu-section > summary:hover { background: var(--surface); }
.sidebar .menu-module[open] .menu-list a.is-active { background: var(--menu-active); }

.page-content { grid-area: main; min-width: 0; padding: 28px 32px 40px; }
.page-content:focus { outline: none; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem 1.5rem; flex-wrap: wrap; margin-bottom: 24px; }
.page-head .title { margin-bottom: .35rem; }
.page-head .subtitle { margin: 0; }
.page-head .buttons { margin-bottom: 0; }
.scrim { display: none; }

/* Menú contraído (escritorio): una columna con los íconos de Inicio y de cada módulo. Al pasar el ratón o al entrar
   con el teclado se despliega encima del contenido, sin moverlo, y se vuelve a contraer al salir. */
@media (min-width: 1024px) {
  .sidebar { transition: width .18s ease, box-shadow .18s ease; }
  .sidebar-collapsed .app { grid-template-columns: 64px minmax(0, 1fr); }
  .sidebar-collapsed .sidebar { width: 64px; padding-inline: 10px; overflow-x: hidden; z-index: 40; }
  .sidebar-collapsed .sidebar:not(:hover):not(:focus-within) .menu-text,
  .sidebar-collapsed .sidebar:not(:hover):not(:focus-within) .menu-list:not(.menu-home) { display: none; }
  .sidebar-collapsed .sidebar:not(:hover):not(:focus-within) .menu-label { justify-content: center; padding-inline: 0; margin: .5rem 0; height: 40px; border-radius: var(--r-s); color: var(--text); }
  .sidebar-collapsed .sidebar:not(:hover):not(:focus-within) .menu-module > summary .menu-chevron { display: none; }
  .sidebar-collapsed .sidebar:not(:hover):not(:focus-within) .menu-module[open] { padding-bottom: 0; }
  .sidebar-collapsed .sidebar:not(:hover):not(:focus-within) .menu-module[open] > summary { color: var(--link); }
  .sidebar-collapsed .sidebar:not(:hover):not(:focus-within) .menu-label .ic,
  .sidebar-collapsed .sidebar:not(:hover):not(:focus-within) .menu-home .ic { width: 20px; height: 20px; }
  .sidebar-collapsed .sidebar:not(:hover):not(:focus-within) .menu-home a { justify-content: center; padding-inline: 0; }
  .sidebar-collapsed .sidebar:hover, .sidebar-collapsed .sidebar:focus-within { width: 260px; padding-inline: 16px; box-shadow: var(--shadow); }
}

/* 769–1023 px: el menú lateral es un panel que abre el botón de menú */
@media (max-width: 1023px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "main"; }
  .sidebar { position: fixed; top: var(--topbar-h); bottom: 0; left: 0; width: 272px; height: auto; z-index: 50; transform: translateX(-100%); visibility: hidden; transition: transform .2s ease, visibility 0s linear .2s; box-shadow: var(--shadow); }
  .sidebar.is-open { transform: none; visibility: visible; transition: transform .2s ease; }
  .scrim.is-open { display: block; position: fixed; inset: var(--topbar-h) 0 0 0; background: var(--scrim); z-index: 45; }
  .topbar { padding-inline: 12px 16px; gap: 12px; }
  .topbar-btn { width: 44px; height: 44px; }
  .user-btn { min-height: 44px; }
  .topbar-search kbd { display: none; }
}
/* ≤ 768 px: la búsqueda es un icono que abre un campo a pantalla completa; acciones apiladas */
@media (max-width: 768px) {
  .search-btn { display: inline-grid; }
  .topbar-search { display: none; }
  .topbar.search-open > :not(.topbar-search) { display: none; }
  .topbar.search-open .topbar-search { display: block; flex: 1; }
  .topbar.search-open .topbar-search .input { height: 44px; }
  .topbar { gap: 6px; padding-inline: 8px; }
  .topbar .logo-text, .user-btn .user-name, .user-btn .ic-chevron { display: none; }
  .user-btn .ic-user { display: inline-block; }
  .user-btn { width: 44px; justify-content: center; padding: 0; }
  .page-content { padding: 20px 16px 32px; }
  .page-head .buttons { width: 100%; flex-direction: column; align-items: stretch; }
  .page-head .buttons .button { width: 100%; margin-right: 0; }
}

/* Bulma: formularios */
.label { color: var(--text); font-weight: 600; font-size: .88rem; }
.input { background: var(--surface); border-color: var(--line); color: var(--text); box-shadow: none; }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent); }
.help { color: var(--muted); }

/* Estado vacío */
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty strong { color: var(--text); }
.icon-circle { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--menu-active); color: var(--solar-800); margin: 0 auto 1rem; }
.icon-circle .ic { width: 26px; height: 26px; }
.icon-circle.is-small { width: 40px; height: 40px; margin: 0 0 .75rem; }
.icon-circle.is-small .ic { width: 20px; height: 20px; }

.view { animation: fadein .25s ease; }
@keyframes fadein { from { opacity: .4; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .view { animation: none; } .sidebar, .sidebar .menu-chevron { transition: none; } }

/* Blazor: aviso de error no controlado en un circuito interactivo */
#blazor-error-ui { display: none; position: fixed; bottom: 0; left: 0; width: 100%; z-index: 1000; box-sizing: border-box; padding: .6rem 2.5rem .7rem 1.25rem; background: var(--surface); color: var(--text); box-shadow: 0 -1px 2px rgba(0, 0, 0, .2); }
#blazor-error-ui .dismiss { position: absolute; right: .75rem; top: .5rem; cursor: pointer; }

/* Ver u ocultar contraseña: el ojo va dentro del campo, a la derecha, con la altura del input. */
.password-control { position: relative; }
.password-control .input { padding-right: 2.75rem; }
.password-toggle { position: absolute; top: 0; right: 0; height: 100%; width: 2.75rem; display: grid; place-items: center; padding: 0; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 0 var(--r-s) var(--r-s) 0; z-index: 5; }
.password-toggle:hover { color: var(--text); }
.password-toggle:focus-visible { outline: 2px solid var(--link); outline-offset: -2px; }

/* Impresión (conduce y demás documentos): solo el documento, sin menú ni barra superior. */
@media print {
  .topbar, .sidebar, .scrim, .skip-link, .no-print { display: none !important; }
  .app { display: block; }
  .view { animation: none; padding: 0; }
  .box.conduce { box-shadow: none; border: 0; }
}

/* Visor de documentos (PDF) dentro del modal. */
.document-viewer { width: 100%; height: 70vh; border: 1px solid var(--line); border-radius: var(--r-s); background: #fff; }

/* Un campo con fuente mono (.875em) quedaba más bajo que los demás de la fila: la altura del control sale del tamaño de
   letra. Se deja el mismo tamaño que los demás campos (los .is-small de las tablas no cambian). */
.input.mono:not(.is-small) { font-size: 1rem; }
/* Pantalla de producto: filas compactas (menos aire arriba y abajo de cada dato). */
.product-form .columns { margin: 0; }
.product-form .column { padding-top: .25rem; padding-bottom: .25rem; }
.product-form .field:not(:last-child) { margin-bottom: 0; }
.product-form > p.label { margin: 1.1rem 0 .1rem; padding-bottom: .25rem; border-bottom: 1px solid var(--bulma-border-weak, #ebebeb); }
.product-form > p.label:first-child { margin-top: 0; }

/* Punto de venta: los productos a la izquierda y el ticket a la derecha. */
.pos-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.pos-tile { display: flex; flex-direction: column; gap: 4px; text-align: left; padding: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; min-height: 92px; color: var(--text); }
.pos-tile:hover:not(:disabled) { border-color: var(--primary); background: var(--menu-active); }
.pos-tile:disabled { opacity: .5; cursor: not-allowed; }
.pos-tile-name { font-weight: 600; line-height: 1.25; }
.pos-tile-price { color: var(--link); font-weight: 600; margin-top: auto; }
.pos-tile-stock { font-size: .75rem; color: var(--muted); }
.pos-ticket { position: sticky; top: 12px; }
.pos-lines { max-height: 38vh; overflow-y: auto; margin-bottom: 12px; border-top: 1px solid var(--divider); }
.pos-line { padding: 8px 0; border-bottom: 1px solid var(--divider); }
.pos-line-main { display: flex; align-items: center; gap: 6px; }
.pos-line-name { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.pos-qty { width: 64px; text-align: center; }
.pos-line-total { min-width: 84px; text-align: right; }
.pos-line-adjust { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-top: 8px; }
.pos-totals { border-top: 2px solid var(--line); padding-top: 8px; }
.pos-total-row { display: flex; justify-content: space-between; padding: 2px 0; }
.pos-total-grand { font-size: 1.6rem; font-weight: 700; }
.shift-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 20px; }
.shift-card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; }
.shift-card .label-sm { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.shift-card .figure { font-size: 1.4rem; font-weight: 700; }

/* Punto de venta retail a pantalla completa. */
.pos-shell { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.pos-bar { display: flex; align-items: center; gap: 16px; height: 48px; padding: 0 16px; background: var(--slate-900); color: #fff; }
.pos-brand { color: var(--solar-300); font-weight: 700; }
.pos-bar-title { flex: 1; color: #fff; opacity: .85; }
.pos-bar-links { display: flex; gap: 8px; }
.pos-bar-links .button.is-dark.is-outlined { color: #fff; border-color: rgba(255,255,255,.5); background: transparent; }
.pos-main { flex: 1; padding: 12px 16px; }
.rt { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 14px; height: calc(100vh - 130px); min-height: 520px; }
.rt-left, .rt-right { display: flex; flex-direction: column; min-height: 0; }
.rt-cats { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0; flex: none; }
.rt-cat { flex: none; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 600; color: var(--text); }
.rt-cat.is-on { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.rt-tiles { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); grid-auto-rows: 110px; gap: 10px; align-content: start; padding-bottom: 8px; }
.rt-right { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.rt-head { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; flex: none; }
.rt-pick { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 6px 10px; text-align: left; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; min-width: 0; color: var(--text); }
.rt-pick:hover { border-color: var(--primary); background: var(--menu-active); }
.rt-pick-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.rt-pick-value { font-weight: 600; font-size: .85rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-list { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow-y: auto; }
.pick-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; text-align: left; color: var(--text); }
.pick-item:hover { background: var(--menu-active); }
.pick-item.is-on { border-color: var(--primary); background: var(--menu-active); font-weight: 600; }
.rt-lines { flex: 1; overflow-y: auto; margin: 8px 0; border-top: 1px solid var(--divider); }
.rt-line { padding: 8px 0; border-bottom: 1px solid var(--divider); }
.rt-line-top { display: flex; justify-content: space-between; gap: 8px; }
.rt-line-bottom { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.rt-step { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-size: 1.2rem; cursor: pointer; line-height: 1; color: var(--text); }
.rt-qty { width: 54px; text-align: center; font-weight: 700; }
.rt-foot { flex: none; border-top: 2px solid var(--line); padding-top: 8px; }
.rt-pay { width: 100%; height: 64px; font-size: 1.4rem; font-weight: 700; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.keypad button { height: 56px; font-size: 1.4rem; font-weight: 600; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; color: var(--text); }
.keypad button:active { background: var(--menu-active); }
.quick-cash { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.method-switch { display: flex; gap: 6px; margin-bottom: 8px; }
.method-switch button { flex: 1; height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; cursor: pointer; color: var(--text); }
.method-switch button.is-on { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.pay-readout { font-size: 2rem; font-weight: 700; text-align: right; padding: 6px 10px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; background: var(--bg); min-height: 56px; }
@media (max-width: 900px) { .rt { grid-template-columns: 1fr; height: auto; } .rt-tiles { max-height: 45vh; } }

.pos-strip { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; margin-bottom: 8px; }
.pos-strip-info { font-size: .8rem; color: var(--muted); }
/* Cerrar mi turno: a la derecha y en rojo, para que se encuentre de un vistazo. */
.pos-strip .pos-close-shift { margin-left: auto; font-weight: 700; min-height: 44px; padding-inline: 1.5rem; }

.invoice-suggest { position: absolute; z-index: 20; left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); max-height: 280px; overflow-y: auto; }
.invoice-suggest-item { display: flex; justify-content: space-between; gap: 12px; width: 100%; text-align: left; padding: 8px 12px; background: transparent; border: 0; border-bottom: 1px solid var(--divider); cursor: pointer; color: var(--text); }
.invoice-suggest-item:hover:not(:disabled) { background: var(--menu-active); }
.invoice-suggest-item:disabled { opacity: .5; cursor: not-allowed; }

/* Título de sección con la raya del color principal. */
.inv-section { color: var(--text); font-size: 1.05rem; font-weight: 700; border-bottom: 2px solid var(--primary); padding-bottom: 4px; margin-bottom: 12px; }

/* Formulario de venta: artículos a la izquierda y el resumen fijo a la derecha. */
.sale-layout { display: grid; grid-template-columns: minmax(0, 1fr) 22rem; gap: 16px; align-items: start; }
.sale-layout > .box { margin-bottom: 0; }
.sale-summary { position: sticky; top: calc(var(--topbar-h) + 12px); }
.sale-title { color: var(--text); font-size: 1.05rem; font-weight: 700; margin-bottom: 12px; }
.sale-search { position: relative; }
.sale-lines { border-top: 1px solid var(--divider); }
.sale-line { padding: 10px 0; border-bottom: 1px solid var(--divider); }
.sale-line-main { display: grid; grid-template-columns: minmax(0, 1fr) 6rem 8rem 7.5rem 7rem; gap: 12px; align-items: center; }
.sale-line-name { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
.sale-field { display: flex; flex-direction: column; font-size: .75rem; color: var(--muted); }
.sale-line-total { display: flex; flex-direction: column; text-align: right; }
.sale-line-actions { display: flex; justify-content: flex-end; align-items: center; }
.sale-line-adjust { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 8px; }
.sale-adjust { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: .85rem; }
.sale-adjust > span { min-width: 5rem; }
.sale-adjust .input { width: 8rem; }
.sale-empty { color: var(--muted); text-align: center; padding: 32px 12px; }
.sale-caption { display: block; font-size: .75rem; color: var(--muted); margin-bottom: 2px; }
.sale-customer { margin-bottom: 14px; padding-bottom: 8px; border-bottom: 1px solid var(--divider); }
.sale-customer-results { border: 1px solid var(--line); border-radius: 8px; max-height: 220px; overflow-y: auto; margin-top: 4px; }
.sale-links { display: flex; flex-wrap: wrap; gap: 0 16px; }
.sale-facts, .sale-totals { margin-bottom: 14px; }
.sale-facts > div, .sale-totals > div { display: flex; justify-content: space-between; gap: 12px; padding: 2px 0; }
.sale-facts dt, .sale-totals dt { color: var(--muted); }
.sale-totals { border-top: 1px solid var(--divider); padding-top: 10px; }
.sale-totals dd { font-family: var(--f-mono); }
.sale-totals .sale-grand { border-top: 2px solid var(--primary); margin-top: 6px; padding-top: 8px; font-size: 1.35rem; font-weight: 700; align-items: baseline; }
.sale-totals .sale-grand dt { color: var(--text); font-size: 1rem; }
@media (max-width: 1180px) { .sale-layout { grid-template-columns: minmax(0, 1fr); } .sale-summary { position: static; } }
@media (max-width: 700px) {
  .sale-line-main { grid-template-columns: 1fr 1fr; }
  .sale-line-name { grid-column: 1 / -1; }
  .sale-line-total { text-align: left; }
}

.rt-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex: none; }
.rt-bar .help { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-config { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.rt-config-body { flex: 1; overflow-y: auto; padding-right: 4px; margin-bottom: 10px; }

.charge-keys:focus { outline: none; }

/* Filtros del listado de facturas: una fila que se acomoda en pantallas angostas. */
.invoice-filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; margin-bottom: 16px; }
.invoice-filters .field { margin-bottom: 0; }

/* Caja bloqueada (SEC-12): cubre toda la pantalla del punto de venta sin cerrar el turno. */
.pos-lock { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--slate-900) 88%, transparent); }
.pos-lock-box { width: min(26rem, calc(100vw - 32px)); }

/* Reportes: las tarjetas de la lista, los parámetros en rejilla y el visor fijo debajo. */
.report-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.report-card { display: flex; flex-direction: column; gap: .5rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: 18px; color: var(--text); box-shadow: var(--shadow); }
.report-card:hover, .report-card:focus-visible { border-color: var(--link); color: var(--text); }
.report-card-title { display: flex; align-items: center; gap: .5rem; font-weight: 600; }
.report-card-text { color: var(--muted); font-size: .9rem; }
.report-params { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 16px; }
.report-params .field { margin-bottom: .5rem; }
.report-viewer { margin-top: 16px; height: 75vh; min-height: 420px; border: 1px solid var(--line); border-radius: var(--r-s); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.report-viewer iframe { width: 100%; height: 100%; border: 0; background: #fff; }

/* Avisos del sistema (Toast): flotan arriba a la derecha, por encima de los modales; si salen dos a la vez, el segundo va debajo. */
.notification.toast-note { position: fixed; top: calc(var(--topbar-h) + 12px); right: 16px; width: min(420px, calc(100vw - 32px)); margin: 0; z-index: 110; box-shadow: 0 8px 24px rgba(15, 21, 29, .22); animation: toast-in .18s ease; }
/* El menú del usuario abierto queda por encima del aviso: con el aviso a la vista se puede cerrar sesión igual. */
.topbar:has(.user-dropdown:not([hidden])) { z-index: 120; }
.notification.toast-note ~ .notification.toast-note { top: calc(var(--topbar-h) + 112px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .notification.toast-note { animation: none; } }

/* Inicio: tarjetas de indicadores y el gráfico de barras de los últimos días. */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi-card { --kpi: #E8890C; display: block; background: color-mix(in srgb, var(--kpi) 9%, var(--surface)); border: 1px solid color-mix(in srgb, var(--kpi) 28%, var(--line)); border-top: 4px solid var(--kpi); border-radius: var(--r-m); padding: 14px 16px; color: var(--text); }
.kpi-card.is-orange { --kpi: #E8890C; }
.kpi-card.is-blue { --kpi: #2F6FDE; }
.kpi-card.is-teal { --kpi: #0F9D8A; }
.kpi-card.is-green { --kpi: #2E9E4F; }
.kpi-card.is-purple { --kpi: #7C4DDB; }
.kpi-card.is-red { --kpi: #D64545; }
a.kpi-card:hover, a.kpi-card:focus-visible { border-color: var(--kpi); color: var(--text); box-shadow: var(--shadow); }
.kpi-label { display: flex; align-items: center; gap: .5rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.kpi-icon { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; background: var(--kpi); color: #fff; }
.kpi-figure { font-size: 1.5rem; font-weight: 700; line-height: 1.3; margin-top: 6px; color: color-mix(in srgb, var(--kpi) 55%, var(--text)); }
.kpi-note { font-size: .8rem; color: var(--muted); }
.kpi-chart { display: flex; gap: 8px; align-items: stretch; height: 200px; }
.kpi-bar { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.kpi-bar-value { font-size: .7rem; color: var(--muted); min-height: 1rem; }
.kpi-bar-track { flex: 1; width: 100%; display: flex; align-items: flex-end; }
.kpi-bar-fill { width: 100%; min-height: 2px; background: linear-gradient(180deg, #4C8DF0, #2F6FDE); border-radius: 4px 4px 0 0; }
.kpi-bar.is-today .kpi-bar-fill { background: linear-gradient(180deg, #F6A93B, #E8890C); }
.kpi-bar.is-today .kpi-bar-label { color: var(--text); font-weight: 700; }
.kpi-rank { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; margin-right: 8px; border-radius: 50%; font-size: .7rem; font-weight: 700; color: #fff; background: #7C4DDB; }
.kpi-rank.is-rank-1 { background: #E8890C; }
.kpi-rank.is-rank-2 { background: #2F6FDE; }
.kpi-rank.is-rank-3 { background: #0F9D8A; }
.kpi-bar-label { font-size: .7rem; color: var(--muted); text-align: center; line-height: 1.2; }

/* UI-02 · Indicadores de carga. Barra de navegación (la crea solarerp.js), filas esqueleto (Shared/SkeletonRows) y
   spinner (Shared/LoadingIndicator). Solo tokens, para que el modo oscuro salga solo; el naranja nunca como texto. */
#nav-progress { position: fixed; top: 0; left: 0; z-index: 1100; height: 3px; width: 0; background: var(--primary); box-shadow: 0 0 6px color-mix(in srgb, var(--primary) 60%, transparent); opacity: 0; pointer-events: none; }
#nav-progress.is-active { opacity: 1; animation: nav-progress 8s cubic-bezier(.1, .7, .2, 1) forwards; }
#nav-progress.is-done { opacity: 0; width: 100%; transition: width .15s ease, opacity .3s ease .15s; }
@keyframes nav-progress { from { width: 0; } 20% { width: 45%; } to { width: 92%; } }

.skeleton { display: inline-block; height: .8rem; max-width: 100%; border-radius: 4px; vertical-align: middle; background: linear-gradient(90deg, var(--divider) 25%, var(--line) 50%, var(--divider) 75%); background-size: 200% 100%; animation: skeleton 1.4s ease-in-out infinite; }
.skeleton-row td { padding-block: .85rem; }
@keyframes skeleton { from { background-position: 100% 0; } to { background-position: -100% 0; } }

.loading { display: flex; align-items: center; justify-content: center; gap: .6rem; padding: 2.5rem 1rem; color: var(--muted); }
.loading.is-inline { justify-content: flex-start; padding: .5rem 0; font-size: .85rem; }
.loading-spinner { flex: none; width: 1.4rem; height: 1.4rem; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--primary); animation: spin .7s linear infinite; }
.loading.is-inline .loading-spinner { width: 1rem; height: 1rem; border-width: 2px; }
.has-text-centered > .loading.is-inline { justify-content: center; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  #nav-progress.is-active { animation: none; width: 70%; }
  .skeleton { animation: none; }
  .loading-spinner { animation-duration: 2s; }
}

/* Pantalla de arranque de App.razor: visible solo hasta que llega esta hoja de estilos, que también muestra el resto de la app. */
#boot { display: none !important; }
:root { --app-visibility: visible; }
