/* SOLOVA: interfaz empresarial de alta densidad.
   Reglas: fondos blancos o gris técnico, radios de 2-4 px, sin sombras difusas
   ni transiciones, rojo corporativo sólo para la acción principal y estados
   críticos, texto casi negro y cifras alineadas a la derecha. */

@font-face {
    font-family: "Inter";
    src: url("fonts/InterVariable.2bf3d951bf9d.woff2") format("woff2");
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
}

@font-face {
    font-family: "Inter";
    src: url("fonts/InterVariable-Italic.8d1dc86da258.woff2") format("woff2");
    font-style: italic;
    font-weight: 100 900;
    font-display: swap;
}

:root {
    /* Neutros: blanco cálido para reducir el deslumbramiento y gris Oxford. */
    --bg: #f3f3f1;
    --surface: #ffffff;
    --surface-2: #f8f8f6;
    --border: #e2e2de;
    --border-strong: #cbcbc6;
    --text: #16191d;
    --text-2: #3a3f46;
    --text-3: #5b6068;
    --carbon: #1d2126;
    --carbon-2: #2a2f36;
    --carbon-3: #3a4048;
    --carbon-text: #f4f4f2;
    --carbon-muted: #8e939a;
    /* Tinto institucional: acción principal, marca y estados críticos. */
    --red: #8c1d2b;
    --red-hover: #731723;
    --red-bg: #f6ecee;
    --red-border: #e3c6cb;
    --red-text: #7a1a26;
    --red-on-dark: #b0414e;
    /* Guías por tipo de operación, desaturadas para convivir con el tinto. */
    --forest: #2c6448;        /* verde bandera apagado: recepción, activo, correcto */
    --forest-soft: #e7efea;
    --blue: #475769;          /* pizarra Oxford: entrada adicional, transferencia, información */
    --blue-soft: #e9edf1;
    --violet: #6e4a5c;        /* ciruela de la familia del tinto: reubicación, auditoría */
    --violet-soft: #f1eaee;
    --amber: #8a6a2c;         /* ocre: salida, pendiente, advertencia */
    --amber-soft: #f4eee1;
    --gold: #8c7550;          /* bronce: datos de contexto */
    --gold-soft: #f2eee6;
    --ok-text: #245339;
    --ok-bg: #e7efea;
    --ok-border: #c3d6ca;
    --warn-text: #6f5520;
    --warn-bg: #f4eee1;
    --warn-border: #ddd0b0;
    --info-text: #3b4a5a;
    --info-bg: #e9edf1;
    --info-border: #c9d2dc;
    --table-head: #2e343b;
    --row-alt: #f6f6f4;
    --row-hover: #f6edef;
    --radius: 4px;
    --radius-sm: 2px;
    --sidebar-width: 216px;
    --sidebar-collapsed: 56px;
    --topbar-height: 52px;
    --font: "Inter", "Segoe UI", ui-sans-serif, system-ui, -apple-system, sans-serif;
    --mono: var(--font);
    color-scheme: light;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; color: var(--text); background: var(--bg); font-family: var(--font); font-size: 14px; line-height: 1.4; }
a { color: inherit; }
h1, h2, h3 { color: var(--text); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--carbon); outline-offset: 1px; }
.sr-only { width: 1px; height: 1px; margin: -1px; padding: 0; position: absolute; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.muted { color: var(--text-3); }
.font-mono, .money-value, .quantity, .metric strong, .report-metrics strong, .client-summary strong { font-variant-numeric: tabular-nums slashed-zero; font-feature-settings: "tnum" 1, "zero" 1; }
.eyebrow { margin: 0; color: var(--red-text); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.money-value { display: inline-flex; align-items: baseline; gap: 4px; white-space: nowrap; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.money-currency { color: var(--text-3); font-family: var(--font); font-size: 11px; font-weight: 600; text-transform: uppercase; }

/* ---------- Shell operativo: barra lateral + área de trabajo ---------- */
.app-shell { min-height: 100vh; }
.has-sidebar { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); }
.sidebar-collapsed .has-sidebar { grid-template-columns: var(--sidebar-collapsed) minmax(0, 1fr); }

.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; overflow-y: auto; color: var(--carbon-text); background: var(--carbon); border-right: 1px solid #000; }
.sidebar-brand { height: var(--topbar-height); padding: 0 16px; display: flex; flex: 0 0 auto; align-items: center; background: #fff; border-bottom: 1px solid var(--border); text-decoration: none; }
.brand-logo { width: auto; height: 32px; display: block; }
.brand-monogram { width: 30px; height: 30px; display: none; place-items: center; color: #fff; border-radius: var(--radius-sm); background: var(--red); font-size: 16px; font-weight: 800; }
.brand-copy strong, .brand-copy small { display: block; white-space: nowrap; }
.brand-copy strong { font-size: 14px; font-weight: 700; letter-spacing: .08em; }
.brand-copy small { color: var(--carbon-muted); font-size: 11px; }
.sidebar-nav { padding: 6px 0 12px; flex: 1; }
.sidebar-section { margin: 14px 0 4px; padding: 0 16px; color: var(--carbon-muted); font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; white-space: nowrap; }
.nav-link { height: 34px; padding: 0 16px 0 13px; display: flex; align-items: center; gap: 10px; color: #c9ccd0; border-left: 3px solid transparent; font-size: 13px; font-weight: 500; text-decoration: none; white-space: nowrap; }
.nav-link:hover { color: #fff; background: var(--carbon-2); }
.nav-link.is-active { color: #fff; background: var(--carbon-2); border-left-color: var(--red-on-dark); font-weight: 600; }
.nav-icon { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.sidebar-collapse { height: 40px; padding: 0 16px; display: flex; align-items: center; gap: 10px; color: var(--carbon-muted); border: 0; border-top: 1px solid var(--carbon-2); background: transparent; font-size: 12px; text-align: left; white-space: nowrap; cursor: pointer; }
.sidebar-collapse:hover { color: #fff; background: var(--carbon-2); }

.sidebar-collapsed .sidebar .brand-copy,
.sidebar-collapsed .sidebar .nav-label,
.sidebar-collapsed .sidebar .sidebar-section { display: none; }
.sidebar-collapsed .sidebar-brand { padding: 0; justify-content: center; }
.sidebar-collapsed .sidebar .brand-logo { display: none; }
.sidebar-collapsed .sidebar .brand-monogram { display: grid; }
.sidebar-collapsed .sidebar-nav { padding-top: 10px; }
.sidebar-collapsed .nav-link { padding: 0; justify-content: center; }
.sidebar-collapsed .sidebar-collapse { padding: 0; justify-content: center; }
.sidebar-collapsed .sidebar-collapse .nav-icon { transform: rotate(180deg); }

.workspace { min-width: 0; min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; z-index: 20; top: 0; height: var(--topbar-height); padding: 0 20px; display: flex; align-items: center; gap: 14px; background: var(--surface); border-bottom: 1px solid var(--border); }
.global-search { width: min(460px, 100%); position: relative; }
.global-search input { width: 100%; height: 32px; padding: 0 10px 0 32px; color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface-2); outline: none; font-size: 13px; }
.global-search input:focus { border-color: var(--carbon); background: var(--surface); }
.search-icon { width: 16px; height: 16px; position: absolute; top: 8px; left: 10px; fill: none; stroke: var(--text-3); stroke-width: 2; stroke-linecap: round; }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.environment-badge { padding: 2px 7px; color: var(--text-2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-2); font-size: 10px; font-weight: 700; letter-spacing: .08em; }
.environment-badge.training { color: var(--warn-text); border-color: var(--warn-border); background: var(--warn-bg); }
.user-menu { display: flex; align-items: center; gap: 12px; padding-left: 14px; border-left: 1px solid var(--border); }
.user-menu form { margin: 0; }
.app-user-copy strong, .app-user-copy small { display: block; line-height: 1.2; }
.app-user-copy strong { font-size: 13px; font-weight: 600; }
.app-user-copy small { color: var(--text-3); font-size: 11px; }
.link-button { height: 28px; padding: 0 10px; color: var(--text-2); border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); font-size: 12px; font-weight: 600; cursor: pointer; }
.link-button:hover { color: var(--text); border-color: var(--text-3); }
.app-menu-toggle { width: 34px; height: 32px; padding: 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); cursor: pointer; }
.app-menu-toggle span { width: 16px; height: 2px; display: block; background: currentColor; }

.page-shell { width: 100%; max-width: 1680px; padding: 18px 24px 32px; flex: 1; }
.app-footer { border-top: 1px solid var(--border); background: var(--surface); }
.app-footer-inner { min-height: 40px; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; color: var(--text-3); font-size: 12px; }
.app-footer a { color: var(--text-2); font-weight: 600; }

/* ---------- Portal del cliente y páginas públicas ---------- */
.is-portal, .is-public { display: flex; flex-direction: column; }
.portal-header { position: sticky; z-index: 20; top: 0; background: var(--surface); border-bottom: 1px solid var(--border); }
.portal-header-inner { width: min(1280px, calc(100% - 48px)); height: 60px; margin: 0 auto; display: flex; align-items: center; gap: 28px; }
.portal-header .brand { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; }
.portal-header .brand-logo { height: 36px; }
.portal-header .brand-copy { padding-left: 12px; border-left: 1px solid var(--border-strong); }
.portal-header .brand-copy small { color: var(--text-2); font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.portal-nav { height: 100%; display: flex; align-items: stretch; gap: 4px; }
.portal-nav a { padding: 0 12px; display: flex; align-items: center; color: var(--text-2); border-bottom: 2px solid transparent; font-size: 13px; font-weight: 500; text-decoration: none; }
.portal-nav a:hover { color: var(--text); }
.portal-nav a.is-active { color: var(--text); border-bottom-color: var(--red); font-weight: 600; }
.is-portal .page-shell, .is-public .page-shell { width: min(1280px, calc(100% - 48px)); margin: 0 auto; padding: 22px 0 36px; }
.is-portal .app-footer-inner, .is-public .app-footer-inner { width: min(1280px, calc(100% - 48px)); margin: 0 auto; padding: 0; }

/* ---------- Encabezados de página ---------- */
.page-heading { margin-bottom: 14px; display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-heading h1 { margin: 0 0 2px; font-size: 20px; font-weight: 650; line-height: 1.25; letter-spacing: -.01em; }
.page-heading p { margin: 0; font-size: 13px; }
.title-row { display: flex; align-items: center; gap: 10px; }
.compact-page-heading { align-items: center; }
.keyboard-hint { padding: 3px 8px; color: var(--text-3); border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); font-size: 11px; white-space: nowrap; }

/* ---------- Botones ---------- */
.button { height: 32px; padding: 0 12px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); font-size: 13px; font-weight: 600; line-height: 1; text-decoration: none; white-space: nowrap; cursor: pointer; }
.button:hover { border-color: var(--text-3); background: var(--surface-2); }
.button:disabled { opacity: .5; cursor: not-allowed; }
.button-primary { color: #fff; border-color: var(--red); background: var(--red); }
.button-primary:hover { border-color: var(--red-hover); background: var(--red-hover); }
.button-secondary, .button-entry, .button-exit { color: var(--text); background: var(--surface); }
.button-ghost { color: var(--text-2); border-color: transparent; background: transparent; }
.button-ghost:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface); }
.button-danger { color: var(--red-text); border-color: var(--red-border); background: var(--red-bg); }
.button-danger:hover { color: #fff; border-color: var(--red-text); background: var(--red-text); }
.button-group .button-danger[type="submit"], .form-actions .button-danger { color: #fff; border-color: var(--red-text); background: var(--red-text); }
.button-wide { width: 100%; }
.button-group { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.operation-submit { min-width: 140px; }

/* ---------- Paneles ---------- */
.panel { margin-bottom: 14px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.panel-heading { margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-heading h2, .section-heading h2 { margin: 0; font-size: 15px; font-weight: 650; }
.panel-heading p { margin: 0; }
.panel-heading > strong { font-family: var(--mono); font-size: 15px; font-variant-numeric: tabular-nums; }
.panel > .muted { margin: -2px 0 10px; font-size: 12px; }
.two-column { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 14px; }
.two-column > .panel { margin-bottom: 0; }
.two-column + .panel, .two-column + section { margin-top: 14px; }
.empty-state { padding: 28px 16px; display: grid; place-items: center; gap: 2px; color: var(--text-3); font-size: 13px; text-align: center; }
.empty-state strong { color: var(--text-2); }
.cut-account-prompt { border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface); }

/* ---------- Tablas densas ---------- */
.table-wrap { max-height: min(70vh, 760px); overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th { position: sticky; z-index: 2; top: 0; height: 34px; padding: 0 10px; color: #f4f4f2; border-bottom: 2px solid var(--red-on-dark); background: var(--table-head); font-size: 11px; font-weight: 600; letter-spacing: .05em; text-align: left; text-transform: uppercase; white-space: nowrap; }
td { padding: 6px 10px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:nth-child(even) { background: var(--row-alt); }
tbody tr:hover { background: var(--row-hover); }
th.num, td.num, .numeric-column { text-align: right; }
td.num .money-value { justify-content: flex-end; }
td > small { display: block; margin-top: 1px; color: var(--text-3); font-size: 11px; }
.clickable-row { cursor: pointer; }
.strong-link { color: var(--text); font-weight: 650; text-decoration: none; }
.strong-link:hover, table a:hover { color: var(--red); text-decoration: underline; }
table a { color: var(--text); }
.movement-folio-link { margin-left: 6px; font-size: 12px; }
.product-identification strong, .product-identification small { display: block; }
.product-identification strong { font-weight: 550; }
.product-identification small { color: var(--text-3); font-size: 11px; }
.quantity { white-space: nowrap; font-family: var(--mono); font-variant-numeric: tabular-nums; }

.inventory-table-panel { padding: 0; overflow: hidden; }
.inventory-table-panel .table-wrap { border: 0; border-radius: 0; }
.inventory-table-wrap { max-height: calc(100vh - 240px); }
.inventory-table { min-width: 760px; }
.table-footer { padding: 8px 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--text-3); border-top: 1px solid var(--border); background: var(--surface-2); font-size: 12px; }

.movement-table td { vertical-align: top; }
.movement-table td > strong, .movement-table td > small, .movement-table td > a, .movement-table td > span { display: block; }
.movement-table td > span.badge { display: inline-flex; }
.movement-table details { min-width: 150px; }
.movement-table summary { color: var(--text); font-size: 12px; font-weight: 600; cursor: pointer; }
.compact-details { margin: 6px 0 0; padding: 0; list-style: none; }
.compact-details li { padding: 3px 0; display: flex; justify-content: space-between; gap: 12px; border-top: 1px solid var(--border); font-size: 12px; }
.movement-product { display: block; }
.report-detail-list { min-width: 200px; margin: 0; padding: 0; display: grid; gap: 4px; list-style: none; }
.report-detail-list .movement-product + .movement-product { padding-top: 4px; border-top: 1px solid var(--border); }

.pagination { padding: 8px 12px; display: flex; align-items: center; justify-content: flex-end; gap: 6px; border-top: 1px solid var(--border); font-size: 12px; }
.panel > .pagination { margin: 10px -16px -14px; background: var(--surface-2); }
.pagination span { margin-right: auto; color: var(--text-3); }
.pagination a { height: 28px; padding: 0 10px; display: inline-flex; align-items: center; color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); font-weight: 600; text-decoration: none; }
.pagination a:hover { border-color: var(--text-3); }
.panel-pagination { margin: -14px 0 14px; border: 1px solid var(--border); border-top: 0; border-radius: 0 0 var(--radius) var(--radius); background: var(--surface-2); }

/* ---------- Estados ---------- */
.badge { width: fit-content; height: 20px; padding: 0 6px; display: inline-flex; align-items: center; gap: 5px; color: var(--text-2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-2); font-size: 11px; font-weight: 600; letter-spacing: .02em; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; flex: 0 0 auto; border-radius: 1px; background: currentColor; }
.badge-activa, .badge-completed, .status-active { color: var(--ok-text); border-color: var(--ok-border); background: var(--ok-bg); }
.badge-reservada, .badge-pending, .status-reserved { color: var(--warn-text); border-color: var(--warn-border); background: var(--warn-bg); }
.badge-finalizada, .badge-revertido, .badge-neutral, .status-finalized { color: var(--text-2); border-color: var(--border-strong); background: var(--surface-2); }
.badge-cancelled { color: var(--red-text); border-color: var(--red-border); background: var(--red-bg); }
.badge-exempt, .badge-transferencia { color: var(--info-text); border-color: var(--info-border); background: var(--info-bg); }
.badge-entrada { color: var(--ok-text); border-color: var(--ok-border); background: var(--ok-bg); }
.badge-salida { color: var(--warn-text); border-color: var(--warn-border); background: var(--warn-bg); }
.badge-revertido { text-decoration: line-through; }
.inventory-status { min-width: 84px; }

/* ---------- Indicadores ---------- */
.metric-grid, .report-metrics { margin: 0 0 14px; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.metric, .report-metrics article { --accent: var(--gold); min-width: 0; padding: 10px 14px; display: grid; align-content: start; gap: 2px; border-left: 1px solid var(--border); box-shadow: inset 0 3px 0 var(--accent); }
.metric-forest { --accent: var(--forest); }
.metric-blue { --accent: var(--blue); }
.metric-amber { --accent: var(--amber); }
.metric-violet { --accent: var(--violet); }
.metric:first-child, .report-metrics article:first-child { border-left: 0; }
.metric span, .report-metrics article > span { color: var(--text-3); font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.metric strong, .report-metrics article > strong { font-family: var(--mono); font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.25; }
.report-metrics article > strong .money-value { font-size: 17px; }
.report-metrics article > small { color: var(--text-3); font-size: 11px; }
.report-metrics article.reverted { --accent: var(--red); background: #fbf6f7; }
.report-metrics article.reverted > strong { color: var(--red-text); }
.metric-text { font-family: var(--font) !important; font-size: 14px !important; }

/* ---------- Inicio ---------- */
.home-heading { margin-bottom: 12px; }
.operation-launcher { margin-bottom: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.launcher-heading { padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--border); }
.launcher-heading h2 { margin: 0; font-size: 15px; font-weight: 650; }
.launcher-heading p { margin: 2px 0 0; color: var(--text-3); font-size: 12px; }
.launcher-hint { padding: 3px 8px; color: var(--text-2); border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); font-size: 11px; white-space: nowrap; }
.action-grid { padding: 16px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.action-card { --c: var(--carbon); --c-soft: var(--surface-2); min-width: 0; min-height: 196px; padding: 16px; display: flex; flex-direction: column; color: var(--text); border: 1px solid var(--border); border-top: 4px solid var(--c); border-radius: var(--radius); background: var(--surface); text-decoration: none; }
.action-card:hover { border-color: var(--c); background: var(--c-soft); }
.action-card.recepcion { --c: var(--forest); --c-soft: var(--forest-soft); }
.action-card.entrada { --c: var(--blue); --c-soft: var(--blue-soft); }
.action-card.reubicacion { --c: var(--violet); --c-soft: var(--violet-soft); }
.action-card.salida { --c: var(--amber); --c-soft: var(--amber-soft); }
.action-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.action-icon { width: 40px; height: 40px; display: grid; flex: 0 0 auto; place-items: center; color: var(--c, var(--text)); border-radius: var(--radius); background: var(--c-soft, var(--surface-2)); }
.action-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.action-kicker { padding: 2px 7px; color: var(--c); border: 1px solid currentColor; border-radius: var(--radius-sm); font-size: 10px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; white-space: nowrap; }
.action-copy { margin: 16px 0 auto; }
.action-copy strong, .action-copy small { display: block; }
.action-copy strong { font-size: 16px; font-weight: 650; }
.action-copy small { margin-top: 4px; color: var(--text-2); font-size: 13px; line-height: 1.4; }
.action-route { margin-top: 16px; padding-top: 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--c); border-top: 1px solid var(--border); font-size: 12px; font-weight: 600; }
.action-route b { font-size: 16px; }
.secondary-actions { padding: 0 16px 16px; display: grid; grid-template-columns: 200px repeat(2, minmax(0, 1fr)); gap: 14px; }
.secondary-actions-heading { display: flex; flex-direction: column; justify-content: center; }
.secondary-actions-heading strong, .secondary-actions-heading small { display: block; }
.secondary-actions-heading strong { font-size: 13px; }
.secondary-actions-heading small { color: var(--text-3); font-size: 12px; }
.secondary-action { --c: var(--carbon); --c-soft: var(--surface-2); min-width: 0; padding: 12px 14px; display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 12px; color: var(--text); border: 1px solid var(--border); border-left: 4px solid var(--c); border-radius: var(--radius); text-decoration: none; }
.secondary-action:hover { border-color: var(--c); background: var(--c-soft); }
.secondary-action.transferencia { --c: var(--blue); --c-soft: var(--blue-soft); }
.secondary-action.consulta { --c: var(--red); --c-soft: var(--red-bg); }
.secondary-action .action-icon { width: 34px; height: 34px; }
.secondary-action .action-icon svg { width: 18px; height: 18px; }
.secondary-action strong, .secondary-action small { display: block; }
.secondary-action strong { font-size: 14px; }
.secondary-action small { color: var(--text-3); font-size: 12px; }
.secondary-action > b { color: var(--c); font-size: 16px; }

/* ---------- Filtros y formularios ---------- */
.form-control, .login-card input,
.operation-form :where(input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]), select, textarea) {
    width: 100%; height: 32px; padding: 0 9px; color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); outline: none; font-size: 13px;
}
textarea.form-control, .operation-form textarea { height: auto; min-height: 64px; padding: 6px 9px; resize: vertical; }
select.form-control, .operation-form select { padding-right: 4px; }
.form-control:focus, .login-card input:focus,
.operation-form :where(input, select, textarea):focus { border-color: var(--carbon); box-shadow: 0 0 0 1px var(--carbon); }
.field-group label, .filter-bar label { margin-bottom: 4px; display: block; color: var(--text-2); font-size: 12px; font-weight: 600; }
.help-text { margin-top: 3px; display: block; color: var(--text-3); font-size: 11px; }
.errorlist { margin: 4px 0 0; padding: 0; color: var(--red-text); font-size: 12px; font-weight: 500; list-style: none; }
.error-box { padding: 8px 12px; color: var(--red-text); border: 1px solid var(--red-border); border-left: 3px solid var(--red); border-radius: var(--radius); background: var(--red-bg); font-size: 13px; }
.error-box .errorlist { margin: 0; }
.warning-box { margin-bottom: 14px; padding: 8px 12px; display: grid; gap: 1px; color: var(--warn-text); border: 1px solid var(--warn-border); border-left: 3px solid var(--amber); border-radius: var(--radius); background: var(--warn-bg); font-size: 13px; }
.warning-box strong { color: var(--text); }
.warning-box span { color: var(--text-2); }
.checkbox-field { padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.checkbox-field label { margin: 0; display: flex; align-items: center; gap: 8px; color: var(--text); cursor: pointer; }
.form-check-input, input[type="checkbox"], input[type="radio"] { accent-color: var(--red); }
.stack-form { display: grid; gap: 12px; }
.field-span { grid-column: 1 / -1; }
.field-grow { flex: 1; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-actions { padding-top: 12px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--border); }

.filter-bar { margin-bottom: 12px; padding: 10px 12px; display: flex; align-items: flex-end; gap: 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.report-filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 12px; }
.report-filters .filter-error { grid-column: 1 / -1; }
.filter-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; }
.daily-filter { display: grid; grid-template-columns: minmax(160px, 220px) minmax(220px, 360px) auto; align-items: end; justify-content: start; gap: 12px; }
.billing-filter { grid-template-columns: minmax(240px, 360px) minmax(150px, 180px) minmax(150px, 180px) auto; }
.cut-account-filter { display: grid; grid-template-columns: minmax(240px, 420px) auto; align-items: end; justify-content: start; gap: 12px; }

/* ---------- Pantallas de operación ---------- */
.narrow-page { width: min(720px, 100%); }
.operation-page { width: min(1100px, 100%); }
.wide-operation-page, .receipt-page { width: min(1320px, 100%); }
.operation-accent { --op: var(--forest); --op-soft: var(--forest-soft); }
.operation-accent.salida { --op: var(--amber); --op-soft: var(--amber-soft); }
.operation-accent.transferencia { --op: var(--blue); --op-soft: var(--blue-soft); }
.operation-accent.reubicacion { --op: var(--violet); --op-soft: var(--violet-soft); }
.danger-operation { --op: var(--red); --op-soft: var(--red-bg); }
.operation-card { overflow: hidden; border: 1px solid var(--border); border-top: 3px solid var(--op, var(--carbon)); border-radius: var(--radius); background: var(--surface); }
.operation-card-heading { padding: 9px 14px; border-bottom: 1px solid var(--border); background: var(--op-soft, var(--surface-2)); }
.special-rate-card { --op: var(--gold); --op-soft: var(--gold-soft); }
.section-heading > div { display: flex; align-items: center; gap: 10px; }
.section-heading p { margin: 1px 0 0; color: var(--text-3); font-size: 12px; }
.operation-card-heading h2 { font-size: 14px; }
.step-number { width: 22px; height: 22px; display: grid; flex: 0 0 auto; place-items: center; color: #fff; border-radius: var(--radius-sm); background: var(--op, var(--carbon)); font-size: 12px; font-weight: 700; }
.operation-card-body { padding: 12px 14px; }
.operation-data-grid, .receipt-data-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.operation-card-actions { margin: 0 14px; padding: 10px 0 12px; }
.operation-form { gap: 12px; }
.paired-operation-form { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.paired-operation-form > :not(.operation-card) { grid-column: 1 / -1; }
.receipt-workspace { display: grid; grid-template-columns: minmax(340px, .8fr) minmax(480px, 1.2fr); align-items: start; gap: 12px; }
.operation-form-footer { padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.receipt-submit-bar { position: sticky; z-index: 3; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-top: 3px solid var(--op, var(--carbon)); }
.receipt-submit-bar strong, .receipt-submit-bar small { display: block; }
.receipt-submit-bar small { color: var(--text-3); font-size: 12px; }
.receipt-submit-bar .form-actions { padding: 0; border: 0; }

.context-card { margin-bottom: 12px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--border); border-left: 3px solid var(--gold); border-radius: var(--radius); background: var(--surface); }
.context-card > div { min-width: 0; padding: 8px 14px; border-left: 1px solid var(--border); }
.context-card > div:first-child { border-left: 0; }
.context-card div > span, .context-card div > strong, .context-card div > small { display: block; }
.context-card div > span { color: var(--text-3); font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.context-card div > strong { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.context-card div > small { color: var(--text-3); font-size: 12px; }
.context-card.compact { width: 100%; margin: 0; grid-template-columns: 1fr; }
.transfer-route { margin-bottom: 12px; display: flex; align-items: center; gap: 12px; }
.transfer-route .context-card { flex: 1; }
.route-arrow { color: var(--text-3); font-size: 20px; }

.inventory-strip { margin-bottom: 12px; padding: 8px 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; border: 1px solid var(--border); border-left: 3px solid var(--blue); border-radius: var(--radius); background: var(--surface); }
.inventory-strip > span { margin-right: 6px; color: var(--text-3); font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.inventory-product { padding: 4px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.inventory-product strong, .inventory-product small { display: block; }
.inventory-product strong { font-size: 12px; font-weight: 600; }
.inventory-product small { color: var(--text-3); font-family: var(--mono); font-size: 11px; }

.detail-list { display: grid; gap: 6px; }
.detail-row { padding: 8px; display: grid; grid-template-columns: minmax(0, 1fr) 120px 32px; align-items: end; gap: 8px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.detail-row .field-group label { margin-bottom: 3px; }
.icon-button { width: 32px; height: 32px; color: var(--red-text); border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); font-size: 18px; line-height: 1; cursor: pointer; }
.icon-button:hover { border-color: var(--red-text); background: var(--red-bg); }
.add-row { justify-self: start; }

.product-catalog-toolbar { margin-bottom: 10px; padding: 8px 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid var(--info-border); border-left: 4px solid var(--blue); border-radius: var(--radius); background: var(--blue-soft); }
.product-catalog-toolbar strong, .product-catalog-toolbar small { display: block; }
.product-catalog-toolbar strong { font-size: 13px; }
.product-catalog-toolbar small { color: var(--text-3); font-size: 12px; }
.selected-products-heading, .selected-products-empty, .selected-product-summary { display: none; }
.product-catalog-workspace.is-enhanced .selected-products-heading { padding: 0 8px 4px; display: grid; grid-template-columns: minmax(0, .9fr) minmax(100px, .7fr) minmax(0, 1.4fr) 120px 32px; gap: 8px; color: var(--text-3); font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.product-catalog-workspace.is-enhanced .selected-products-empty:not([hidden]) { margin: 0; padding: 16px; display: block; color: var(--text-3); border: 1px dashed var(--border-strong); border-radius: var(--radius); text-align: center; }
.product-catalog-enabled .detail-row { grid-template-columns: minmax(0, 3fr) 120px 32px; align-items: center; border-left: 3px solid var(--op, var(--carbon)); background: var(--surface); }
.product-catalog-enabled .product-field > label,
.product-catalog-enabled .quantity-field > label { width: 1px; height: 1px; margin: -1px; position: absolute; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.product-catalog-enabled .product-field select { width: 1px; height: 1px; padding: 0; position: absolute; overflow: hidden; opacity: 0; pointer-events: none; }
.product-catalog-enabled .selected-product-summary { display: grid; grid-template-columns: minmax(0, .9fr) minmax(100px, .7fr) minmax(0, 1.4fr); align-items: center; gap: 8px; font-size: 13px; }
.selected-product-summary > * { min-width: 0; overflow-wrap: anywhere; }
.selected-product-code { font-weight: 700; }

.product-catalog-dialog, .empty-pallet-dialog { padding: 0; color: var(--text); border: 1px solid var(--border-strong); border-top: 3px solid var(--carbon); border-radius: var(--radius); background: var(--surface); }
.product-catalog-dialog { width: min(1040px, calc(100vw - 32px)); height: min(720px, calc(100vh - 48px)); max-width: none; max-height: none; }
.product-catalog-dialog[open] { display: flex; flex-direction: column; }
.product-catalog-dialog::backdrop, .empty-pallet-dialog::backdrop { background: rgba(29, 33, 38, .55); }
.product-catalog-header { padding: 12px 16px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--border); }
.product-catalog-header h2 { margin: 2px 0 0; font-size: 16px; }
.product-catalog-header p:last-child { margin: 2px 0 0; color: var(--text-3); font-size: 12px; }
.dialog-close-button { width: 30px; height: 30px; flex: 0 0 auto; color: var(--text-2); border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); font-size: 18px; line-height: 1; cursor: pointer; }
.dialog-close-button:hover { color: var(--text); border-color: var(--text-3); }
.product-catalog-search { padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.product-catalog-search label { margin-bottom: 4px; display: block; color: var(--text-2); font-size: 12px; font-weight: 600; }
.product-catalog-search input { width: 100%; height: 32px; padding: 0 9px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); outline: none; }
.product-catalog-search input:focus { border-color: var(--carbon); box-shadow: 0 0 0 1px var(--carbon); }
.product-catalog-table-wrap { min-height: 0; position: relative; flex: 1; overflow: auto; }
.product-catalog-table, .picking-catalog-table { min-width: 720px; }
.picking-catalog-table { min-width: 900px; }
.product-catalog-table tbody tr, .picking-catalog-table tbody tr { cursor: pointer; }
.product-catalog-table tbody tr:has(input:checked), .picking-catalog-table tbody tr:has(input:checked) { background: var(--red-bg); box-shadow: inset 3px 0 var(--red); }
.product-catalog-code { font-weight: 700; }
.product-catalog-check { width: 96px; text-align: center; }
.product-catalog-check input { width: 16px; height: 16px; cursor: pointer; }
.product-catalog-empty { margin: 16px; padding: 16px; color: var(--text-3); border: 1px dashed var(--border-strong); border-radius: var(--radius); text-align: center; }
.product-catalog-actions { padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-top: 1px solid var(--border); background: var(--surface-2); }
.product-catalog-actions > span { color: var(--text-3); font-size: 12px; }
.product-catalog-actions > span strong { color: var(--text); font-family: var(--mono); font-size: 14px; }

.picking-lines { display: grid; gap: 8px; }
.picking-row { padding: 10px; border: 1px solid var(--border); border-radius: var(--radius); }
.picking-row-grid { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(160px, 1.2fr) 96px minmax(170px, 1.1fr) auto; align-items: end; gap: 8px; background: var(--surface-2); }
.picking-selected-heading, .picking-selection-summary { display: none; }
.paired-operation-form.picking-catalog-enabled { grid-template-columns: minmax(0, .75fr) minmax(0, 1.25fr); }
.picking-catalog-enabled .picking-selected-heading { padding: 0 10px 4px; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.35fr) 72px 90px minmax(0, 1fr) 32px; gap: 8px; color: var(--text-3); font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.picking-catalog-enabled .selected-products-empty:not([hidden]) { margin: 0; padding: 16px; display: block; color: var(--text-3); border: 1px dashed var(--border-strong); border-radius: var(--radius); text-align: center; }
.picking-catalog-enabled .picking-row-grid { padding: 6px 10px; border-left: 3px solid var(--op, var(--carbon)); grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.35fr) 72px 90px minmax(0, 1fr) 32px; align-items: center; background: var(--surface); }
.picking-catalog-enabled .picking-tarima-field, .picking-catalog-enabled .picking-product-field { display: none; }
.picking-catalog-enabled .picking-selection-summary { display: contents; }
.picking-selection-route, .picking-selection-product { min-width: 0; font-size: 13px; overflow-wrap: anywhere; }
.picking-selection-route { font-weight: 600; }
.picking-selection-stock { text-align: right; }
.picking-catalog-enabled .picking-quantity-field label,
.picking-catalog-enabled .picking-state-field label { width: 1px; height: 1px; margin: -1px; position: absolute; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

.collapsible-card-heading { padding: 9px 14px; display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 10px; background: var(--op-soft, var(--surface-2)); cursor: pointer; list-style: none; }
.collapsible-card-heading::-webkit-details-marker { display: none; }
.collapsible-card-heading strong, .collapsible-card-heading small { display: block; }
.collapsible-card-heading small { color: var(--text-3); font-size: 12px; }
.collapsible-card-heading b { color: var(--text-2); font-size: 12px; }
.summary-close { display: none; }
.special-rate-card[open] .collapsible-card-heading { border-bottom: 1px solid var(--border); }
.special-rate-card[open] .summary-open { display: none; }
.special-rate-card[open] .summary-close { display: inline; }

.empty-pallet-dialog { width: min(560px, calc(100vw - 24px)); padding: 18px; }
.empty-pallet-dialog > p { margin: 10px 0 12px; color: var(--text-2); }
.dialog-heading { display: flex; align-items: center; gap: 10px; }
.dialog-heading h2 { margin: 0; font-size: 17px; }
.dialog-icon { width: 30px; height: 30px; display: grid; flex: 0 0 auto; place-items: center; color: var(--warn-text); border: 1px solid var(--warn-border); border-radius: var(--radius); background: var(--warn-bg); font-weight: 800; }
.pallet-state-options { display: grid; gap: 6px; }
.pallet-state-options label { padding: 9px 10px; display: flex; align-items: flex-start; gap: 10px; border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; }
.pallet-state-options label:has(input:checked) { border-color: var(--carbon); background: var(--surface-2); box-shadow: inset 3px 0 var(--carbon); }
.pallet-state-options input { margin-top: 3px; }
.pallet-state-options strong, .pallet-state-options small { display: block; }
.pallet-state-options small { color: var(--text-3); font-size: 12px; }
.dialog-actions { margin-top: 14px; padding-top: 12px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--border); }

/* ---------- Detalle de tarima y trazabilidad ---------- */
.content-list > div { padding: 8px 0; display: flex; justify-content: space-between; align-items: baseline; gap: 16px; border-bottom: 1px solid var(--border); font-size: 13px; }
.content-list > div:last-child { border-bottom: 0; }
.content-list > div > span:first-child:not(.product-identification) { color: var(--text-3); }
.timeline { display: grid; }
.timeline article { position: relative; padding: 0 0 14px 18px; border-left: 1px solid var(--border-strong); }
.timeline article:last-child { padding-bottom: 0; }
.timeline article.reverted { color: var(--text-3); }
.timeline article.reverted .timeline-heading > strong { text-decoration: line-through; }
.timeline-dot { width: 9px; height: 9px; position: absolute; top: 4px; left: -5px; border: 1px solid currentColor; border-radius: 1px; background: currentColor; }
.timeline-dot::before { display: none; }
.timeline-heading { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.timeline-heading time { color: var(--text-3); font-family: var(--mono); font-size: 12px; }
.timeline p { margin: 3px 0; color: var(--text-2); font-size: 12px; }
.timeline ul { margin: 4px 0; padding: 0; list-style: none; }
.timeline li { padding: 2px 0; display: flex; justify-content: space-between; gap: 12px; font-size: 12px; }
.timeline li > strong { font-family: var(--mono); }
.timeline small { display: block; color: var(--text-3); font-size: 11px; }
.timeline small a { color: var(--text); font-weight: 600; }
.timeline-action { margin-top: 4px; display: inline-flex; color: var(--red-text); font-size: 12px; font-weight: 600; }
.reversion-note { margin-top: 6px; padding: 6px 10px; border-left: 3px solid var(--red); background: var(--red-bg); font-size: 12px; }
.reversion-note strong, .reversion-note span, .reversion-note small { display: block; }
.reversion-note strong { color: var(--red-text); }
.pallet-services, .location-history { margin-top: 14px; }
.movement-preview { margin-bottom: 12px; }
.danger-panel { border-top: 3px solid var(--red); }

/* ---------- Cobranza ---------- */
.billing-warning { margin: 0 0 14px; }
.missing-rates { border-top: 3px solid var(--red); }
.close-billing { display: grid; grid-template-columns: minmax(220px, .8fr) minmax(320px, 1.3fr) auto; align-items: end; gap: 16px; border-left: 3px solid var(--red); }
.close-billing strong, .close-billing small { display: block; }
.close-billing small { color: var(--text-3); font-size: 12px; }
.close-billing > .button { justify-self: end; }
.print-section { margin-top: 0; }
.print-footer { display: none; }
.receipt-assurance { padding: 8px 12px; display: grid; border: 1px solid var(--border); border-left: 3px solid var(--carbon); border-radius: var(--radius); background: var(--surface-2); }
.receipt-assurance span { color: var(--text-3); font-size: 12px; }

/* ---------- Servicios ---------- */
.service-type-maniobra_entrada { --service-type-color: var(--blue); }
.service-type-maniobra_salida { --service-type-color: var(--amber); }
.service-type-picking { --service-type-color: var(--violet); }
.service-type-flete_local { --service-type-color: var(--forest); }
.service-type-legend { margin-bottom: 10px; display: flex; align-items: center; gap: 14px; color: var(--text-3); font-size: 12px; }
.service-type-legend > strong { color: var(--text-2); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
.service-type-legend-items { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.service-type-key, .service-type-label { display: inline-flex; align-items: center; gap: 6px; }
.service-type-key i, .service-type-label i { width: 8px; height: 8px; display: inline-block; flex: 0 0 auto; border-radius: 1px; background: var(--service-type-color); }
.service-list-row td:first-child { box-shadow: inset 3px 0 var(--service-type-color); }

.service-detail { --service-state-color: var(--amber); --service-state-bg: var(--amber-soft); padding: 0; overflow: hidden; border-top: 3px solid var(--service-state-color); }
.service-state-valorizado { --service-state-color: var(--forest); --service-state-bg: var(--forest-soft); }
.service-state-exento { --service-state-color: var(--blue); --service-state-bg: var(--blue-soft); }
.service-state-anulado { --service-state-color: var(--red); --service-state-bg: var(--red-bg); }
.service-status-strip { padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--border); background: var(--service-state-bg); }
.service-status-copy { display: grid; justify-items: start; gap: 4px; }
.service-field-label { display: block; color: var(--text-3); font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.service-current-total { text-align: right; }
.service-current-total > strong { display: block; font-family: var(--mono); font-size: 22px; font-variant-numeric: tabular-nums; }
.service-summary-grid { margin: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid var(--border); background: var(--surface-2); }
.service-summary-grid > div { min-width: 0; padding: 8px 16px; border-left: 1px solid var(--border); }
.service-summary-grid > div:first-child { border-left: 0; }
.service-summary-grid dt { color: var(--text-3); font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.service-summary-grid dd { margin: 1px 0 0; font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.service-information-grid { padding: 14px 16px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.service-detail-card, .service-audit-card { min-width: 0; padding: 12px 14px; border: 1px solid var(--border); border-left: 3px solid var(--blue); border-radius: var(--radius); background: var(--surface); }
.service-charge-card { border-left-color: var(--service-state-color); }
.service-audit-card { margin: 0 16px 16px; border-left-color: var(--violet); }
.service-card-heading { margin-bottom: 10px; display: flex; align-items: center; gap: 10px; }
.service-card-heading h2 { margin: 0; font-size: 14px; }
.service-card-index { width: 24px; height: 24px; display: grid; flex: 0 0 auto; place-items: center; color: #fff; border-radius: var(--radius-sm); background: var(--text-2); font-family: var(--mono); font-size: 11px; font-weight: 700; }
.service-description, .service-agreement { padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.service-description p, .service-agreement p, .service-pending-message p { margin: 3px 0 0; font-size: 13px; }
.service-agreement { margin-top: 10px; }
.service-data-row { min-height: 34px; padding: 6px 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--border); font-size: 13px; }
.service-data-row > span { color: var(--text-3); }
.service-data-row > strong { min-width: 0; text-align: right; overflow-wrap: anywhere; }
.service-related-callout { margin-top: 10px; padding: 8px 10px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 12px; border: 1px solid var(--border); border-left: 3px solid var(--carbon); border-radius: var(--radius); background: var(--surface-2); }
.service-related-callout > span { color: var(--text-3); font-size: 12px; font-weight: 600; }
.service-related-callout > a { color: var(--text); font-weight: 700; }
.service-related-callout > small { grid-column: 1 / -1; color: var(--text-3); }
.service-charge-amount { margin-bottom: 8px; padding: 10px 12px; border: 1px solid var(--border); border-left: 3px solid var(--service-state-color); border-radius: var(--radius); background: var(--surface-2); }
.service-charge-amount > strong { display: block; font-family: var(--mono); font-size: 20px; font-variant-numeric: tabular-nums; }
.service-pending-message { padding: 10px 12px; border: 1px solid var(--warn-border); border-left: 3px solid var(--amber); border-radius: var(--radius); background: var(--warn-bg); }
.service-pending-message strong { color: var(--warn-text); }
.service-audit-origin { margin-bottom: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.service-audit-origin > div { padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); }
.service-audit-origin span, .service-audit-origin strong { display: block; }
.service-audit-origin span { color: var(--text-3); font-size: 11px; font-weight: 600; text-transform: uppercase; }
.service-revision-list { margin: 0; padding: 0; list-style: none; }
.service-revision-list li { padding: 8px 10px 8px 18px; position: relative; border-left: 1px solid var(--border-strong); }
.service-revision-list li + li { border-top: 1px solid var(--border); }
.service-revision-marker { width: 9px; height: 9px; position: absolute; top: 13px; left: -5px; border-radius: 1px; background: var(--violet); }
.service-revision-heading { display: flex; justify-content: space-between; gap: 12px; }
.service-revision-heading span, .service-revision-list small { color: var(--text-3); font-size: 12px; }
.service-revision-amount { margin-top: 4px; font-family: var(--mono); font-size: 15px; font-weight: 700; }
.service-revision-list p { margin: 3px 0; font-size: 13px; }
.service-no-revisions { margin: 0; padding: 8px 10px; color: var(--text-3); border: 1px dashed var(--border-strong); border-radius: var(--radius); }
.service-cancellation { margin: 0 16px 16px; padding: 10px 12px; display: grid; grid-template-columns: minmax(0, 1.5fr) 1fr 1fr; gap: 14px; color: var(--red-text); border: 1px solid var(--red-border); border-left: 3px solid var(--red); border-radius: var(--radius); background: var(--red-bg); }
.service-cancellation span, .service-cancellation strong { display: block; }
.service-cancellation span { font-size: 11px; font-weight: 600; text-transform: uppercase; }
.service-section-guide { color: var(--text-3); font-size: 12px; }
.service-movements-panel { margin-top: 14px; }
.service-page-heading { align-items: center; }

/* ---------- Mensajes ---------- */
.messages { margin-bottom: 12px; display: grid; gap: 6px; }
.message { padding: 8px 12px; color: var(--ok-text); border: 1px solid var(--ok-border); border-left: 3px solid var(--ok-text); border-radius: var(--radius); background: var(--ok-bg); font-size: 13px; font-weight: 500; }
.message.error { color: var(--red-text); border-color: var(--red-border); border-left-color: var(--red); background: var(--red-bg); }
.message.info, .message.warning { color: var(--warn-text); border-color: var(--warn-border); border-left-color: var(--amber); background: var(--warn-bg); }

/* ---------- Acceso y documentos legales ---------- */
.login-shell { min-height: calc(100vh - 180px); display: grid; place-items: center; }
.login-card { width: min(400px, 100%); padding: 24px; border: 1px solid var(--border); border-top: 3px solid var(--red); border-radius: var(--radius); background: var(--surface); }
.login-card h1 { margin: 2px 0 4px; font-size: 22px; font-weight: 650; }
.login-card .muted { margin: 0 0 16px; font-size: 13px; }
.login-card input { height: 36px; }
.login-card .button-primary { height: 36px; }
.login-access-help { margin: 12px 0 0; font-size: 13px; text-align: center; }
.login-access-help a { color: var(--text-2); }
.login-privacy-notice { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); color: var(--text-3); font-size: 12px; line-height: 1.5; }
.login-privacy-notice strong { display: block; color: var(--text); }
.login-privacy-notice p { margin: 4px 0; }
.login-privacy-notice a, .legal-document a { color: var(--red-text); font-weight: 600; }
.legal-document { width: min(900px, 100%); margin: 0 auto; padding: 24px 28px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.legal-document h1 { margin: 0 0 6px; font-size: 22px; }
.legal-document h2 { margin: 22px 0 6px; padding-bottom: 5px; border-bottom: 1px solid var(--border); font-size: 15px; }
.legal-document h3 { margin: 14px 0 4px; font-size: 14px; }
.legal-document p, .legal-document li { color: var(--text-2); line-height: 1.6; }
.legal-document ul { padding-left: 20px; }
.legal-document .legal-placeholder-warning { margin: 16px 0; padding: 10px 12px; border: 1px solid var(--warn-border); border-left: 3px solid var(--amber); border-radius: var(--radius); background: var(--warn-bg); color: var(--text); }
.legal-document .legal-meta { margin: 0; font-size: 12px; }

/* ---------- Portal del cliente: contenido ---------- */
.client-heading { align-items: center; }
.client-readonly-badge { padding: 3px 8px; color: var(--text-2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.client-notice { margin-bottom: 14px; padding: 10px 14px; display: grid; gap: 2px; border: 1px solid var(--border); border-left: 3px solid var(--gold); border-radius: var(--radius); background: var(--surface); font-size: 13px; }
.client-notice span { color: var(--text-3); }
.client-summary { margin-bottom: 14px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.client-summary article { min-width: 0; padding: 14px 16px; display: grid; gap: 2px; border-left: 1px solid var(--border); }
.client-summary article:first-child { border-left: 0; }
.client-summary span { color: var(--text-3); font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.client-summary strong { font-family: var(--mono); font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; }
.client-summary .client-summary-primary { box-shadow: inset 0 3px 0 var(--red); }
.client-summary .client-attention-card { background: var(--warn-bg); }
.client-summary .client-attention-card strong { color: var(--warn-text); }
.client-period-panel { display: grid; grid-template-columns: minmax(200px, .8fr) minmax(420px, 1.2fr); align-items: end; gap: 20px; }
.client-period-panel h2 { margin: 1px 0; font-size: 15px; }
.client-period-panel p { margin: 0; font-size: 12px; }
.client-period-form { display: grid; grid-template-columns: 1fr .7fr auto; align-items: end; gap: 10px; }
.client-period-end { height: 32px; padding: 0 10px; display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); font-size: 13px; }
.client-period-end span { color: var(--text-3); font-size: 11px; font-weight: 600; text-transform: uppercase; }
.client-warning { margin-bottom: 14px; }
.client-overview-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr); gap: 14px; }
.client-overview-grid > .panel { margin-bottom: 0; }
.client-debt-panel { border-top: 3px solid var(--red); }
.client-charge-summary > div { padding: 9px 0; display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--border); font-size: 14px; }
.client-charge-summary > div:last-child { border-bottom: 0; }
.client-charge-summary span { color: var(--text-2); }
.client-charge-summary strong { text-align: right; }
.client-charge-summary .client-charge-total { margin-top: 4px; padding: 10px 12px; border: 1px solid var(--ok-border); border-left: 3px solid var(--forest); border-radius: var(--radius); background: var(--forest-soft); font-size: 15px; }
.client-charge-summary .client-charge-total span { color: var(--text); font-weight: 650; }
.client-quick-panel > p { margin: -4px 0 10px; font-size: 12px; }
.client-quick-actions { display: grid; gap: 6px; }
.client-quick-actions .button { height: 40px; justify-content: space-between; }
.client-quick-actions .button strong { color: var(--text-3); font-size: 12px; font-weight: 500; }
.client-pallets, .client-breakdown, .client-services { margin-top: 0; }
.client-inventory-filter { margin-bottom: 10px; display: flex; align-items: end; gap: 10px; }
.client-inventory-search { min-width: 0; display: grid; flex: 1 1 360px; gap: 4px; color: var(--text-2); font-size: 12px; font-weight: 600; }
.client-inventory-search input { width: 100%; height: 32px; padding: 0 9px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); outline: none; font-weight: 400; }
.client-inventory-search input:focus { border-color: var(--carbon); box-shadow: 0 0 0 1px var(--carbon); }
.client-inventory-filter-actions { display: flex; gap: 6px; }
.client-inventory-table-wrap { max-height: none; }
.client-inventory-table { min-width: 520px; }
.client-pallet-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; gap: 8px; }
.client-pallet-card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.client-pallet-collapsible > summary { height: 38px; padding: 0 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; list-style: none; }
.client-pallet-collapsible > summary::-webkit-details-marker { display: none; }
.client-pallet-summary-meta { margin-left: auto; color: var(--text-3); font-size: 12px; }
.client-pallet-collapsible > summary::after { content: "+"; width: 20px; height: 20px; display: grid; place-items: center; color: var(--text-2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font-weight: 700; }
.client-pallet-collapsible > summary:hover { background: var(--surface-2); }
.client-pallet-collapsible[open] { border-color: var(--border-strong); }
.client-pallet-collapsible[open] > summary { border-bottom: 1px solid var(--border); background: var(--surface-2); box-shadow: inset 3px 0 var(--carbon); }
.client-pallet-collapsible[open] > summary::after { content: "−"; }
.client-pallet-meta { padding: 8px 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--text-3); border-bottom: 1px solid var(--border); font-size: 12px; }
.client-pallet-meta strong { color: var(--text); }
.client-pallet-product-table-wrap { max-height: none; border: 0; border-radius: 0; }
.client-pallet-product-table { min-width: 420px; }
.client-pallet-product-table th { position: static; height: 30px; border-bottom-width: 1px; border-bottom-color: var(--carbon-3); background: var(--carbon-3); }
.client-pallet-card-body > p { margin: 0; padding: 12px; font-size: 13px; }

/* ---------- Portal del cliente: presentación ejecutiva ---------- */
.is-portal { background: #f6f6f4; }
.is-portal .portal-header { border-top: 3px solid var(--red); }
.is-portal .page-heading { margin-bottom: 18px; }
.is-portal .page-heading h1 { font-size: 24px; font-weight: 650; letter-spacing: -.02em; }
.is-portal .panel { margin-bottom: 18px; padding: 18px 20px; }
.is-portal .panel-heading h2 { font-size: 16px; }
.is-portal td { padding: 9px 12px; }
.is-portal th { height: 38px; padding: 0 12px; }
.is-portal .client-summary, .is-portal .report-metrics { gap: 12px; border: 0; background: transparent; }
.is-portal .client-summary article, .is-portal .report-metrics article { padding: 16px 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.is-portal .client-summary article:first-child, .is-portal .report-metrics article:first-child { border-left: 1px solid var(--border); }
.is-portal .client-summary .client-summary-primary { color: var(--carbon-text); border-color: var(--carbon); background: var(--carbon); box-shadow: inset 4px 0 var(--red-on-dark); }
.is-portal .client-summary .client-summary-primary span { color: var(--carbon-muted); }
.is-portal .client-summary .client-summary-primary strong { color: #fff; font-size: 26px; }
.is-portal .client-summary .client-attention-card { border-color: var(--warn-border); background: var(--warn-bg); }
.is-portal .client-notice { padding: 12px 16px; }
.is-portal .client-period-panel { padding-block: 14px; }
.is-portal .client-pallet-collapsible > summary { height: 42px; }

/* ---------- Responsivo: tableta y teléfono ---------- */
@media (max-width: 1280px) {
    .client-pallet-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .paired-operation-form.picking-catalog-enabled { grid-template-columns: 1fr; }
    .action-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .action-card { min-height: 170px; }
    .receipt-workspace { grid-template-columns: 1fr; }
}

@media (max-width: 1024px) {
    .has-sidebar, .sidebar-collapsed .has-sidebar { display: block; }
    .sidebar { width: 260px; height: auto; position: fixed; z-index: 40; top: var(--topbar-height); bottom: 0; left: 0; display: none; border-right: 1px solid var(--carbon); }
    .sidebar .sidebar-brand { display: none; }
    .sidebar.is-open { display: flex; }
    .sidebar-collapsed .sidebar .nav-label, .sidebar-collapsed .sidebar .sidebar-section { display: revert; }
    .sidebar-collapsed .sidebar .brand-logo { display: block; }
    .sidebar-collapsed .sidebar .brand-monogram { display: none; }
    .sidebar-collapsed .sidebar-brand { padding: 0 16px; justify-content: flex-start; }
    .sidebar-collapsed .nav-link { padding: 0 16px 0 13px; justify-content: flex-start; }
    .sidebar-collapse { display: none; }
    .app-menu-toggle { display: inline-flex; }
    .app-menu-toggle[aria-expanded="true"] { color: #fff; border-color: var(--carbon); background: var(--carbon); }
    .topbar { padding: 0 14px; }
    .page-shell { padding: 14px 14px 24px; }
    .paired-operation-form { grid-template-columns: 1fr; }
    .two-column, .client-overview-grid, .client-period-panel { grid-template-columns: 1fr; }
    .report-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .service-information-grid { grid-template-columns: 1fr; }
    .close-billing { grid-template-columns: 1fr; }
    .close-billing .button { justify-self: start; }
    .secondary-actions { grid-template-columns: 1fr 1fr; }
    .secondary-actions-heading { grid-column: 1 / -1; }
    .is-portal .portal-header-inner { position: relative; }
    .is-portal .app-menu-toggle { display: inline-flex; }
    .portal-nav { height: auto; position: absolute; top: 60px; right: 0; left: 0; display: none; flex-direction: column; padding: 6px 0; border: 1px solid var(--border); background: var(--surface); }
    .portal-nav.is-open { display: flex; }
    .portal-nav a { height: 38px; border-bottom: 0; border-left: 3px solid transparent; }
    .portal-nav a.is-active { border-left-color: var(--red); }
    .client-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .client-summary article:nth-child(3) { border-left: 0; }
    .client-summary article:nth-child(n + 3) { border-top: 1px solid var(--border); }
    .is-portal .client-summary article:nth-child(3) { border-left: 1px solid var(--border); }
}

@media (max-width: 640px) {
    .global-search { display: none; }
    .app-user-copy, .environment-badge { display: none; }
    .user-menu { padding-left: 0; border-left: 0; }
    .page-heading { align-items: flex-start; flex-direction: column; }
    .keyboard-hint { display: none; }
    .action-grid, .secondary-actions, .form-grid, .operation-data-grid, .receipt-data-grid, .report-filters, .daily-filter, .billing-filter, .cut-account-filter, .client-period-form, .client-pallet-grid, .service-audit-origin, .service-cancellation { grid-template-columns: 1fr; }
    .action-grid { padding: 12px; gap: 10px; }
    .action-card { min-height: 0; }
    .secondary-actions { padding: 0 12px 12px; gap: 10px; }
    .context-card, .service-summary-grid { grid-template-columns: 1fr 1fr; }
    .context-card > div:nth-child(3), .service-summary-grid > div:nth-child(3) { border-left: 0; }
    .context-card > div:nth-child(n + 3), .service-summary-grid > div:nth-child(n + 3) { border-top: 1px solid var(--border); }
    .client-summary { grid-template-columns: 1fr; }
    .client-summary article { border-left: 0; border-top: 1px solid var(--border); }
    .client-summary article:first-child { border-top: 0; }
    .filter-bar, .client-inventory-filter { align-items: stretch; flex-direction: column; }
    .transfer-route { align-items: stretch; flex-direction: column; }
    .route-arrow { align-self: center; transform: rotate(90deg); }
    .detail-row, .product-catalog-enabled .detail-row { grid-template-columns: minmax(0, 1fr) 90px 32px; }
    .product-catalog-workspace.is-enhanced .selected-products-heading { display: none; }
    .product-catalog-enabled .selected-product-summary { grid-template-columns: 1fr; gap: 2px; }
    .product-catalog-toolbar, .product-catalog-actions, .receipt-submit-bar, .service-status-strip { align-items: stretch; flex-direction: column; }
    .product-catalog-dialog { width: calc(100vw - 12px); height: calc(100vh - 20px); }
    .picking-row-grid { grid-template-columns: 1fr; }
    .picking-catalog-enabled .picking-selected-heading { display: none; }
    .picking-catalog-enabled .picking-row-grid { grid-template-columns: minmax(0, 1fr) minmax(120px, .9fr) 32px; }
    .picking-catalog-enabled .picking-selection-summary { padding-bottom: 6px; display: grid; grid-column: 1 / -1; gap: 2px; border-bottom: 1px solid var(--border); }
    .form-actions, .dialog-actions { flex-direction: column-reverse; }
    .form-actions .button, .dialog-actions .button { width: 100%; }
    .receipt-submit-bar { position: static; }
    .service-current-total { text-align: left; }
    .service-data-row { align-items: flex-start; flex-direction: column; gap: 2px; }
    .service-data-row > strong { text-align: left; }
    .is-portal .page-shell, .is-public .page-shell, .portal-header-inner, .is-portal .app-footer-inner, .is-public .app-footer-inner { width: calc(100% - 24px); }
    .portal-header-inner { gap: 12px; }
    .portal-header .brand-copy { display: none; }
    .app-footer-inner { flex-direction: column; justify-content: center; padding-block: 8px; }
}

@media print {
    @page { margin: 14mm; }
    body { color: #000; background: #fff; font-size: 10pt; }
    .has-sidebar { display: block; }
    .sidebar, .topbar, .portal-header, .app-footer, .messages, .no-print { display: none !important; }
    .page-shell, .is-portal .page-shell { width: 100%; max-width: none; margin: 0; padding: 0; }
    .page-heading h1 { font-size: 18pt; }
    .panel, .report-metrics { break-inside: avoid; border-color: #999; }
    .table-wrap { max-height: none; overflow: visible; border: 0; }
    table { font-size: 8.5pt; }
    th { position: static; color: #000; border-bottom: 1px solid #999; background: #e5e7eb; }
    tbody tr:nth-child(even) { background: #f3f4f6; }
    th, td { padding: 4px 6px; }
    tbody tr:hover { background: none; }
    .print-footer { margin-top: 10px; display: block; color: #444; font-size: 8pt; text-align: right; }
}
