/* HAL — sistema visual inspirado en el lenguaje de HPE: verde de marca, contraste alto,
   tipografía grotesca firme, botones píldora y mucho aire. */

@font-face {
    font-family: "Inter";
    src: url("fonts/inter-latin.woff2") format("woff2");
    font-weight: 100 900;
    font-display: swap;
}

:root {
    --brand: #01a982;
    --brand-hover: #00936f;
    --brand-ink: #00775b;          /* verde para texto sobre claro (contraste AA) */
    --brand-soft: #e3f6f0;
    --on-brand: #000;

    --bg: #f5f6f7;
    --surface: #ffffff;
    --surface-2: #f7f8f9;
    --surface-hover: #f0f2f3;
    --border: #e1e4e7;
    --border-strong: #c5cad0;
    --text: #16191d;
    --text-weak: #5c6670;
    --focus: #01a982;

    --ok-bg: #e3f6ee;      --ok-fg: #0a6b47;
    --warn-bg: #fff4dc;    --warn-fg: #8a5300;
    --err-bg: #fdeaea;     --err-fg: #b42318;
    --info-bg: #e8f1fd;    --info-fg: #1d5bb8;

    --hero-bg: #0b0f12;
    --shadow-sm: 0 1px 2px rgba(15, 23, 30, .06);
    --shadow-md: 0 6px 24px rgba(15, 23, 30, .08);
    --shadow-lg: 0 16px 48px rgba(15, 23, 30, .16);

    --radius: 12px;
    --radius-sm: 8px;
    --topbar-h: 60px;
    --sidebar-w: 248px;
    --sidebar-w-collapsed: 68px;
    --ease: cubic-bezier(.2, .8, .2, 1);

    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --brand-ink: #3ddbb0;
        --brand-soft: rgba(1, 169, 130, .16);
        --bg: #0e1114;
        --surface: #161a1e;
        --surface-2: #1b2025;
        --surface-hover: #20262c;
        --border: #2a3138;
        --border-strong: #3a434c;
        --text: #e9edf0;
        --text-weak: #98a3ad;
        --ok-bg: rgba(23, 235, 160, .12);   --ok-fg: #4be3b0;
        --warn-bg: rgba(255, 188, 68, .14); --warn-fg: #ffc861;
        --err-bg: rgba(252, 90, 90, .14);   --err-fg: #ff8a8a;
        --info-bg: rgba(66, 140, 255, .14); --info-fg: #8db8ff;
        --hero-bg: #050708;
        --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
        --shadow-md: 0 6px 24px rgba(0, 0, 0, .35);
        --shadow-lg: 0 16px 48px rgba(0, 0, 0, .5);
        color-scheme: dark;
    }
}
:root[data-theme="dark"] {
    --brand-ink: #3ddbb0;
    --brand-soft: rgba(1, 169, 130, .16);
    --bg: #0e1114;
    --surface: #161a1e;
    --surface-2: #1b2025;
    --surface-hover: #20262c;
    --border: #2a3138;
    --border-strong: #3a434c;
    --text: #e9edf0;
    --text-weak: #98a3ad;
    --ok-bg: rgba(23, 235, 160, .12);   --ok-fg: #4be3b0;
    --warn-bg: rgba(255, 188, 68, .14); --warn-fg: #ffc861;
    --err-bg: rgba(252, 90, 90, .14);   --err-fg: #ff8a8a;
    --info-bg: rgba(66, 140, 255, .14); --info-fg: #8db8ff;
    --hero-bg: #050708;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-md: 0 6px 24px rgba(0, 0, 0, .35);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, .5);
    color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
    font: 400 14px/1.55 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-feature-settings: "cv11", "ss01";
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { margin: 0; letter-spacing: -.015em; line-height: 1.2; }
small { font-size: 12px; }
kbd {
    font: 500 11px/1 "Inter", sans-serif; padding: 3px 6px; border-radius: 5px;
    border: 1px solid var(--border); color: var(--text-weak); background: var(--surface);
}
.muted { color: var(--text-weak); }
.center { text-align: center; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

.icon { width: 18px; height: 18px; flex-shrink: 0; stroke: currentColor; fill: none; }
.only-dark { display: none; }
:root[data-theme="dark"] .only-dark { display: block; }
:root[data-theme="dark"] .only-light { display: none; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .only-dark { display: block; }
    :root:not([data-theme="light"]) .only-light { display: none; }
}

.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: 6px; }
.skip-link:focus { left: 8px; }

/* ---------- Logo ---------- */
.logo { display: inline-flex; align-items: center; gap: 10px; color: var(--text); }
.logo:hover { text-decoration: none; }
.logo-mark { width: 30px; height: 32px; flex-shrink: 0; }
.logo-mark-lg { width: 64px; height: 69px; }
.logo-mark .lm-mid { fill: currentColor; opacity: .5; }
.logo-mark .lm-base { fill: var(--brand); }
.logo-text { font-weight: 800; font-size: 19px; letter-spacing: -.02em; white-space: nowrap; }
.logo-accent { color: var(--brand-ink); }
.auth-hero .logo-mark { color: #fff; }
.platform .topbar .logo-accent { color: var(--brand); }

/* ---------- Topbar ---------- */
.topbar {
    position: sticky; top: 0; z-index: 30;
    height: var(--topbar-h);
    display: flex; align-items: center; gap: 16px;
    padding: 0 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.topbar-company {
    padding-left: 16px; border-left: 1px solid var(--border);
    color: var(--text-weak); font-weight: 500;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px;
}
.global-search {
    flex: 1; max-width: 480px; margin-left: auto;
    display: flex; align-items: center; gap: 8px;
    height: 38px; padding: 0 12px;
    background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px;
    color: var(--text-weak);
    transition: border-color .15s, box-shadow .15s;
}
.global-search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.global-search input { border: 0; background: transparent; padding: 0; height: 100%; box-shadow: none !important; }
.global-search input:focus { outline: none; }
.topbar-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.global-search + .topbar-actions { margin-left: 0; }

.icon-btn {
    display: inline-grid; place-items: center;
    width: 38px; height: 38px; border-radius: 999px;
    border: 0; background: transparent; color: var(--text); cursor: pointer;
    transition: background .15s;
}
.icon-btn:hover { background: var(--surface-hover); }
.menu-toggle { display: none; }

.avatar {
    display: inline-grid; place-items: center;
    width: 36px; height: 36px; border-radius: 999px;
    background: var(--brand); color: var(--on-brand);
    font-weight: 700; font-size: 13px; letter-spacing: .02em;
}

/* ---------- Dropdown ---------- */
.dropdown { position: relative; }
.dropdown > summary { list-style: none; cursor: pointer; border-radius: 999px; }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown-panel {
    position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-lg); padding: 6px; z-index: 40;
    animation: pop .14s var(--ease);
}
.dropdown-head { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px 12px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.dropdown-head .badge { align-self: flex-start; margin-top: 4px; }
.dropdown-item {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 9px 12px; border: 0; border-radius: var(--radius-sm);
    background: transparent; color: var(--text); font: inherit; cursor: pointer; text-align: left;
}
.dropdown-item:hover { background: var(--surface-hover); }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ---------- Estructura ---------- */
.shell { display: flex; min-height: calc(100vh - var(--topbar-h)); }
.sidebar {
    position: sticky; top: var(--topbar-h);
    height: calc(100vh - var(--topbar-h));
    width: var(--sidebar-w); flex-shrink: 0;
    display: flex; flex-direction: column;
    padding: 12px 10px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    transition: width .2s var(--ease);
}
.sidebar nav { flex: 1; }
.nav-group {
    font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .09em;
    color: var(--text-weak); padding: 16px 12px 6px;
    white-space: nowrap; overflow: hidden;
}
.nav-group:first-child { padding-top: 4px; }
.nav-link {
    position: relative;
    display: flex; align-items: center; gap: 12px;
    width: 100%; padding: 9px 12px; margin: 1px 0;
    border: 0; border-radius: var(--radius-sm);
    background: transparent; color: var(--text); font-family: inherit; font-weight: 500; font-size: 14px; line-height: 1.3; cursor: pointer;
    white-space: nowrap; overflow: hidden;
    transition: background .15s, color .15s;
}
.nav-link:hover { background: var(--surface-hover); text-decoration: none; }
.nav-link .icon { color: var(--text-weak); transition: color .15s; }
.nav-link.active { background: var(--brand-soft); color: var(--text); font-weight: 600; }
.nav-link.active .icon { color: var(--brand-ink); }
.nav-link.active::before {
    content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px;
    width: 4px; border-radius: 0 4px 4px 0; background: var(--brand);
}
.collapse-btn { color: var(--text-weak); margin-top: 8px; border-top: 1px solid var(--border); border-radius: 0; padding-top: 14px; }
.collapse-btn .icon { transition: transform .2s var(--ease); }

.sb-collapsed .sidebar { width: var(--sidebar-w-collapsed); }
.sb-collapsed .sidebar .nav-link span,
.sb-collapsed .sidebar .nav-group span { display: none; }
.sb-collapsed .sidebar .nav-group { padding: 10px 0 4px; border-top: 1px solid var(--border); margin: 6px 8px 0; }
.sb-collapsed .sidebar .nav-group:first-child { border-top: 0; }
.sb-collapsed .sidebar .nav-link { justify-content: center; padding: 10px 0; }
.sb-collapsed .collapse-btn .icon { transform: rotate(180deg); }

.content { flex: 1; min-width: 0; padding: 28px 32px 48px; max-width: 1360px; }
.page-head { margin-bottom: 22px; }
.page-head h1 { font-size: 26px; font-weight: 700; }
.page-head p { margin: 6px 0 0; }

/* ---------- Componentes ---------- */
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head h2 { font-size: 15px; font-weight: 600; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 38px; padding: 0 18px;
    border: 1.5px solid var(--border-strong); border-radius: 999px;
    background: transparent; color: var(--text);
    font-family: inherit; font-weight: 600; font-size: 14px; line-height: 1; cursor: pointer; white-space: nowrap;
    transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--surface-hover); border-color: var(--text-weak); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn .icon { width: 16px; height: 16px; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-danger { color: var(--err-fg); border-color: transparent; }
.btn-danger:hover { background: var(--err-bg); border-color: transparent; }
.btn-ghost { border-color: transparent; }
.btn-sm { height: 32px; padding: 0 14px; font-size: 13px; }
.btn-lg { height: 46px; padding: 0 24px; font-size: 15px; }
.btn-block { width: 100%; }

.alert {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 18px; font-weight: 500;
    animation: pop .2s var(--ease);
}
.alert .icon { margin-top: 1px; }
.alert-ok { background: var(--ok-bg); color: var(--ok-fg); }
.alert-err { background: var(--err-bg); color: var(--err-fg); }

.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 10px; border-radius: 999px;
    background: var(--surface-hover); color: var(--text-weak);
    font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge-brand { background: var(--brand-soft); color: var(--brand-ink); }
.badge-ok { background: var(--ok-bg); color: var(--ok-fg); }
.badge-warn { background: var(--warn-bg); color: var(--warn-fg); }
.badge-err { background: var(--err-bg); color: var(--err-fg); }

/* ---------- Listados ---------- */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.search {
    display: flex; align-items: center; gap: 8px; flex: 1; max-width: 520px;
}
.search input { border-radius: 999px; padding-left: 16px; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th, .table td { padding: 13px 18px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th {
    font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
    color: var(--text-weak); background: var(--surface-2); white-space: nowrap;
}
.table thead tr:first-child th:first-child { border-top-left-radius: var(--radius); }
.table thead tr:first-child th:last-child { border-top-right-radius: var(--radius); }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.inactive td { color: var(--text-weak); }
.table .num { text-align: right; white-space: nowrap; }
.table .actions { text-align: right; white-space: nowrap; width: 1%; }
.table .empty { text-align: center; color: var(--text-weak); padding: 48px 16px; }
.table small { display: block; }

.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 14px; }

/* ---------- Formularios ---------- */
input, select, textarea {
    width: 100%; height: 40px; padding: 0 12px;
    font-family: inherit; font-weight: 400; font-size: 14px; line-height: 1.4; color: var(--text);
    background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; padding: 10px 12px; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: var(--text-weak); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
input[type=checkbox] {
    width: 18px; height: 18px; accent-color: var(--brand); cursor: pointer; box-shadow: none !important;
}
.form { padding: 24px; }
.form.narrow { max-width: 680px; }
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px 20px; }
.span-2 { grid-column: span 2; }
.span-4 { grid-column: span 4; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; }
.align-end { align-self: end; padding-bottom: 10px; }
.field-error { color: var(--err-fg); font-weight: 500; }
.field:has(.field-error) input, .field:has(.field-error) select { border-color: var(--err-fg); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.danger-zone { margin-top: 14px; display: flex; justify-content: flex-end; }

.perm-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-top: 22px; }
.perm-group { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 16px 14px; margin: 0; background: var(--surface-2); }
.perm-group legend { font-weight: 700; padding: 0 6px; }
.perm-group .check { padding: 4px 0; }

/* ---------- Filtros, detalle y utilidades ---------- */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 16px; }
.filters select, .filters input[type=date] { width: auto; min-width: 160px; }
.filters .search { flex: 1 1 260px; max-width: 420px; }
.push-right { margin-left: auto; }
.toolbar-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.nowrap { white-space: nowrap; }
.mt { margin-top: 16px; }
.inline { display: inline; }
.inline-form { display: flex; gap: 8px; align-items: center; }
.inline-form input { max-width: 320px; }
.span-3 { grid-column: span 3; }
.hint { display: flex; align-items: center; gap: 8px; color: var(--text-weak); margin: 14px 0 0; }
.valuation { color: var(--text-weak); }
.valuation strong { color: var(--text); font-variant-numeric: tabular-nums; }

.row-title { display: block; font-weight: 600; color: var(--text); }
.row-title:hover { color: var(--brand-ink); }
.unit { color: var(--text-weak); font-weight: 400; }
.text-pos { color: var(--ok-fg); font-weight: 600; }
.text-neg { color: var(--err-fg); font-weight: 600; }
.text-warn { color: var(--warn-fg); font-weight: 700; }
.table td .badge { margin-left: 4px; }
.table td:first-child .badge, .table td .badge:first-child { margin-left: 0; }

.badge-type-in, .badge-type-initial, .badge-type-transfer_in { background: var(--ok-bg); color: var(--ok-fg); }
.badge-type-out, .badge-type-transfer_out { background: var(--err-bg); color: var(--err-fg); }
.badge-type-adjust { background: var(--warn-bg); color: var(--warn-fg); }

.form-section {
    font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em;
    color: var(--text-weak); margin: 28px 0 14px; padding-top: 22px; border-top: 1px solid var(--border);
}
.form-section:first-of-type, .form-section.first { margin-top: 0; padding-top: 0; border-top: 0; }
.form .grid + .grid { margin-top: 18px; }

.segmented { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; margin: 0 0 22px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); }
.segmented label { flex: 1; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; text-align: center; padding: 8px 12px; border-radius: 999px; font-weight: 600; font-size: 13px; color: var(--text-weak); white-space: nowrap; transition: background .15s, color .15s; }
.segmented label:hover span { color: var(--text); }
.segmented input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented input:focus-visible + span { outline: 2px solid var(--focus); }

.detail-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; align-items: start; }
.detail-grid-wide { grid-template-columns: 2fr 1fr; }
.props { display: grid; grid-template-columns: max-content 1fr; gap: 10px 24px; margin: 0; padding: 18px 20px; }
.props dt { color: var(--text-weak); }
.props dd { margin: 0; font-weight: 500; }
.card-text { margin: 0; padding: 0 20px 18px; color: var(--text-weak); }
.stock-total { font-size: 18px; font-variant-numeric: tabular-nums; }
.stock-bars { list-style: none; margin: 0; padding: 10px 20px 18px; }
.stock-bars li { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 8px 0; }
.stock-bars strong { font-variant-numeric: tabular-nums; }
.stock-bars meter { grid-column: span 2; width: 100%; height: 6px; }
meter::-webkit-meter-bar { background: var(--surface-hover); border: 0; border-radius: 99px; height: 6px; }
meter::-webkit-meter-optimum-value { background: var(--brand); border-radius: 99px; }
meter::-moz-meter-bar { background: var(--brand); border-radius: 99px; }

.matrix th:first-child, .matrix td:first-child { position: sticky; left: 0; background: var(--surface); z-index: 1; }
.matrix th:first-child { background: var(--surface-2); }

.empty-icon-warn { background: var(--warn-bg); color: var(--warn-fg); }
.alert-list { list-style: none; margin: 0; padding: 8px; }
.alert-list a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm); color: var(--text); }
.alert-list a:hover { background: var(--surface-hover); text-decoration: none; }
.alert-list .alert-dot { width: 8px; height: 8px; border-radius: 99px; background: var(--warn-fg); flex-shrink: 0; }
.alert-list .alert-meta { margin-left: auto; color: var(--text-weak); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- Inicio ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi {
    position: relative; overflow: hidden;
    display: flex; flex-direction: column; gap: 2px;
    padding: 20px 22px; color: var(--text);
    transition: transform .15s var(--ease), box-shadow .15s, border-color .15s;
}
.kpi:hover { text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--brand); }
.kpi::after {
    content: ""; position: absolute; right: -18px; bottom: -18px;
    width: 84px; height: 34px; border: 6px solid var(--brand); border-radius: 3px; opacity: .14;
}
.kpi-icon { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--brand-soft); color: var(--brand-ink); margin-bottom: 12px; }
.kpi-value { font-size: 32px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi-label { color: var(--text-weak); font-weight: 500; }

.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.quick-list { padding: 8px; }
.quick {
    display: flex; align-items: center; gap: 12px;
    padding: 12px; border-radius: var(--radius-sm); color: var(--text); font-weight: 500;
}
.quick:hover { background: var(--surface-hover); text-decoration: none; }
.quick-icon { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.quick-arrow { margin-left: auto; color: var(--text-weak); transition: transform .15s var(--ease); }
.quick:hover .quick-arrow { transform: translateX(3px); color: var(--brand-ink); }

.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 36px 24px; }
.empty-state p { margin: 0; max-width: 340px; }
.empty-icon { display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 999px; background: var(--ok-bg); color: var(--ok-fg); margin-bottom: 6px; }
.empty-icon .icon { width: 22px; height: 22px; }

/* ---------- Login ---------- */
body.guest { min-height: 100vh; }
.auth { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }
.auth-hero {
    position: relative; overflow: hidden;
    background: var(--hero-bg); color: #fff;
    display: flex; align-items: flex-end; padding: 56px;
}
.auth-hero-inner { position: relative; z-index: 1; max-width: 460px; }
.auth-hero h2 { font-size: clamp(32px, 4vw, 52px); font-weight: 800; letter-spacing: -.03em; line-height: 1.05; margin: 32px 0 16px; }
.auth-hero p { color: #b9c2ca; font-size: 16px; margin: 0; }
.auth-hero-shape {
    position: absolute; right: -12%; top: 10%;
    width: 62%; aspect-ratio: 56 / 60;
    background: url("logo-shape.svg") center / contain no-repeat;
}
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 32px 20px; background: var(--surface); }
.auth-form { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 18px; }
.auth-form h1 { font-size: 28px; font-weight: 700; margin-top: 18px; }
.auth-form p { margin: 6px 0 0; }
.auth-foot { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.auth-foot .icon { width: 14px; height: 14px; }

/* ---------- Errores ---------- */
.error-card { margin: 12vh auto; padding: 40px; text-align: center; max-width: 440px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.error-card.wide { max-width: 1000px; text-align: left; align-items: stretch; }
.error-code { font-size: 64px; font-weight: 800; letter-spacing: -.04em; color: var(--brand); }
.trace { white-space: pre-wrap; font-size: 12px; background: var(--surface-2); padding: 14px; border-radius: var(--radius-sm); overflow-x: auto; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
    .topbar-company { display: none; }
    .dash-grid, .detail-grid, .detail-grid-wide { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
    .menu-toggle { display: inline-grid; }
    .topbar { gap: 8px; padding: 0 12px; }
    .global-search kbd { display: none; }
    .sidebar {
        position: fixed; left: 0; top: var(--topbar-h); z-index: 25;
        width: var(--sidebar-w) !important;
        transform: translateX(-100%); transition: transform .22s var(--ease);
        box-shadow: var(--shadow-lg);
    }
    .sb-open .sidebar { transform: none; }
    .sb-collapsed .sidebar .nav-link span, .sb-collapsed .sidebar .nav-group span { display: inline; }
    .sb-collapsed .sidebar .nav-link { justify-content: flex-start; padding: 9px 12px; }
    .collapse-btn { display: none; }
    .content { padding: 20px 16px 40px; }
    .page-head h1 { font-size: 22px; }
    .grid { grid-template-columns: 1fr 1fr; gap: 14px; }
    .span-2, .span-3, .span-4 { grid-column: span 2; }
    .filters select, .filters input[type=date] { flex: 1 1 140px; min-width: 0; }
    .push-right { margin-left: 0; }
    .auth { grid-template-columns: 1fr; }
    .auth-hero { display: none; }
}
@media (max-width: 520px) {
    .logo-text { display: none; }
    .grid { grid-template-columns: 1fr; }
    .span-2, .span-3, .span-4 { grid-column: span 1; }
    .segmented label { flex: 1 1 45%; }
    .form { padding: 18px; }
    .table th, .table td { padding: 11px 12px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}

.table small.unit { display: inline; }

/* ---------- Ayuda ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.help-btn { flex-shrink: 0; margin-top: 2px; }

.help-drawer {
    position: fixed; top: var(--topbar-h); right: 0; bottom: 0; z-index: 35;
    width: min(520px, 100vw);
    background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg);
    animation: slide-in .2s var(--ease);
}
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.help-drawer-body { height: 100%; overflow-y: auto; padding: 24px 24px 48px; outline: none; }
.help-close { position: absolute; top: 14px; right: 14px; z-index: 1; }

.help-article { max-width: 920px; container-type: inline-size; }
.help-head { padding-right: 40px; margin-bottom: 8px; }
.help-head h2 { font-size: 22px; font-weight: 700; margin-top: 6px; }
.help-kicker { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--brand-ink); }
.help-kicker .icon { width: 14px; height: 14px; }
.help-summary { font-size: 16px; color: var(--text-weak); margin: 0 0 8px; line-height: 1.6; }
.help-section { margin-top: 28px; }
.help-section h3 { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-weak); margin-bottom: 12px; }
.help-body p { margin: 0 0 10px; line-height: 1.65; }
.help-body ul { margin: 0 0 10px; padding-left: 20px; line-height: 1.65; }
.help-body code, .help-options code { font-size: 13px; background: var(--surface-hover); padding: 1px 6px; border-radius: 4px; }
.help-steps { margin: 0; padding-left: 22px; line-height: 1.65; }
.help-steps li { margin-bottom: 6px; }
.help-steps li::marker { color: var(--brand-ink); font-weight: 700; }
.help-options { margin: 0; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.help-options > div { display: grid; grid-template-columns: minmax(140px, 30%) 1fr; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border); }
.help-options > div:first-child { border-top: 0; }
.help-options dt { font-weight: 600; }
.help-options dd { margin: 0; color: var(--text-weak); line-height: 1.55; }
.help-tip { display: flex; gap: 10px; align-items: flex-start; margin: 14px 0 0; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--warn-bg); color: var(--warn-fg); font-weight: 500; }
.help-tip .icon { margin-top: 2px; }
.help-related { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.help-related a { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border: 1px solid var(--border); border-radius: 999px; color: var(--text); font-weight: 500; }
.help-related a:hover { border-color: var(--brand); text-decoration: none; }
.help-related .icon { width: 14px; height: 14px; }
.help-video { margin: 20px 0 0; }
.help-video video { display: block; width: 100%; aspect-ratio: 16 / 9; background: #0b0f12; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.help-video figcaption { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 14px; }
.help-video figcaption .icon { width: 16px; height: 16px; color: var(--brand-ink); }
.help-videos { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; margin-bottom: 8px; }
.help-video-card { display: flex; flex-direction: column; gap: 6px; padding: 12px; color: var(--text); }
.help-video-card:hover { border-color: var(--brand); text-decoration: none; }
.help-video-thumb { position: relative; display: block; border-radius: var(--radius-sm); overflow: hidden; aspect-ratio: 16 / 9; background: #0b0f12; margin-bottom: 4px; }
.help-video-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.help-video-play { position: absolute; left: 10px; bottom: 10px; width: 36px; height: 36px; border-radius: 50%; background: rgba(1, 169, 130, .92); display: grid; place-items: center; color: #000; }
.help-video-play .icon { width: 20px; height: 20px; }
.help-video-dur { position: absolute; right: 8px; bottom: 8px; background: rgba(0, 0, 0, .75); color: #fff; font-size: 12px; font-weight: 600; padding: 2px 6px; border-radius: 4px; }
.help-foot { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--border); font-size: 13px; }

.help-group { font-size: 15px; font-weight: 700; margin: 26px 0 12px; }
.help-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.help-card { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; color: var(--text); transition: border-color .15s, transform .15s var(--ease); }
.help-card:hover { border-color: var(--brand); transform: translateY(-1px); text-decoration: none; }

/* Diagrama de flujo: vertical por defecto; horizontal si el contenedor es ancho. */
.flow-wrap { container-type: inline-size; }
.flow { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0; }
.flow-step { position: relative; display: flex; flex-direction: column; align-items: stretch; padding-bottom: 26px; }
.flow-step:last-child { padding-bottom: 0; }
.flow-step:not(:last-child)::after {
    content: ""; position: absolute; left: 27px; bottom: 4px; height: 18px; width: 2px; background: var(--border-strong);
}
.flow-step:not(:last-child)::before {
    content: ""; position: absolute; left: 23px; bottom: 2px; border: 5px solid transparent; border-top-color: var(--border-strong); border-bottom: 0;
}
.flow-node {
    display: grid; grid-template-columns: 36px 1fr; column-gap: 12px; align-items: center;
    padding: 12px 14px; background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius-sm);
}
.flow-node strong { font-size: 14px; }
.flow-text { grid-column: 2; color: var(--text-weak); font-size: 13px; line-height: 1.45; }
.flow-badge {
    grid-row: span 2; display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 10px;
    background: var(--surface-hover); color: var(--text); font-size: 13px;
}
.flow-badge .icon { width: 16px; height: 16px; }
.flow-start .flow-node { border-color: var(--brand); }
.flow-start .flow-badge, .flow-end .flow-badge { background: var(--brand); color: var(--on-brand); }
.flow-end .flow-node { border-color: var(--brand); background: var(--brand-soft); }
.flow-decision .flow-node { border-style: dashed; border-color: var(--warn-fg); }
.flow-decision .flow-badge { background: var(--warn-bg); color: var(--warn-fg); }
.flow-note { margin: 6px 0 0 50px; font-size: 12px; color: var(--warn-fg); font-weight: 600; }

@container (min-width: 760px) {
    .flow { flex-direction: row; align-items: stretch; }
    .flow-step { flex: 1 1 0; padding: 0 22px 0 0; min-width: 0; }
    .flow-step:last-child { padding-right: 0; }
    .flow-step:not(:last-child)::after { left: auto; right: 6px; top: 50%; bottom: auto; width: 12px; height: 2px; }
    .flow-step:not(:last-child)::before { left: auto; right: 0; top: calc(50% - 4px); bottom: auto; border: 5px solid transparent; border-left-color: var(--border-strong); border-right: 0; }
    .flow-node { grid-template-columns: 1fr; row-gap: 6px; align-content: start; height: 100%; padding: 14px; }
    .flow-badge { grid-row: auto; }
    .flow-text { grid-column: 1; }
    .flow-note { margin: 6px 0 0; }
    .flow-step:has(.flow-note):not(:last-child)::after, .flow-step:has(.flow-note):not(:last-child)::before { top: 40%; }
}

/* ---------- Envases ---------- */
.mono { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; letter-spacing: .02em; }
.icon-sm { width: 14px; height: 14px; vertical-align: -2px; color: var(--text-weak); }
.status-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.status-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 14px 16px; color: var(--text); }
.status-tile:hover, .status-tile.active { border-color: var(--brand); text-decoration: none; }
.status-n { font-size: 26px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

.op-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; border: 0; padding: 0; margin: 0 0 22px; }
.op-card { cursor: pointer; }
.op-card input { position: absolute; opacity: 0; pointer-events: none; }
.op-body {
    display: grid; grid-template-columns: 22px 1fr; column-gap: 10px; row-gap: 2px; align-items: center; height: 100%;
    padding: 12px 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); background: var(--surface);
    transition: border-color .15s, background .15s;
}
.op-body .icon { grid-row: span 2; color: var(--text-weak); }
.op-body small { color: var(--text-weak); font-size: 12px; }
.op-card:hover .op-body { border-color: var(--border-strong); }
.op-card input:checked + .op-body { border-color: var(--brand); background: var(--brand-soft); }
.op-card input:checked + .op-body .icon { color: var(--brand-ink); }
.op-card input:focus-visible + .op-body { outline: 2px solid var(--focus); outline-offset: 2px; }

.serial-input { font-size: 15px; line-height: 1.6; min-height: 150px; }
.span-rows { grid-row: span 3; }
.serial-counter { font-weight: 500; }
.serial-errors { margin-top: 8px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--err-bg); color: var(--err-fg); font-weight: 500; }
.serial-errors ul { margin: 6px 0 0; padding-left: 18px; }
.first-hint { margin: 0 0 18px; }

.timeline { list-style: none; margin: 0; padding: 14px 20px 18px; }
.timeline li { position: relative; display: grid; grid-template-columns: 14px 1fr; gap: 12px; padding-bottom: 16px; }
.timeline li:not(:last-child)::before { content: ""; position: absolute; left: 6px; top: 16px; bottom: 0; width: 2px; background: var(--border); }
.timeline-dot { width: 14px; height: 14px; margin-top: 3px; border-radius: 99px; border: 3px solid var(--brand); background: var(--surface); }
.timeline-detail { color: var(--text-weak); font-size: 13px; margin-top: 2px; }
@media (max-width: 860px) { .span-rows { grid-row: auto; } }
.alert-list .alert-dot-err { background: var(--err-fg); }
.badge-type-production { background: var(--warn-bg); color: var(--warn-fg); }

/* ---------- Plataforma y soporte ---------- */
.platform .topbar { background: var(--hero-bg); border-bottom-color: #000; color: #fff; }
.platform .topbar .logo { color: #fff; }
.platform .topbar .icon-btn { color: #fff; }
.platform .topbar .icon-btn:hover { background: rgba(255,255,255,.08); }
.platform-tag {
    display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px;
    border: 1.5px solid var(--brand); color: var(--brand); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
    align-self: flex-start;
}
.platform .topbar .topbar-actions { margin-left: auto; }
.auth-platform .auth-hero h2 { margin-top: 28px; }
.totp-secret { font-size: 20px; letter-spacing: .12em; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px dashed var(--border-strong); text-align: center; word-break: break-all; }
.totp-input { font-size: 22px; letter-spacing: .3em; text-align: center; }
.totp-uri { font-size: 12px; margin: 0; }

.support-bar {
    position: relative; z-index: 31; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
    padding: 8px 20px; background: #ffbc44; color: #1a1300; font-weight: 600; font-size: 13px;
}
.support-bar .icon { width: 16px; height: 16px; }
.support-bar form { margin-left: auto; }
.support-bar .btn { border-color: #1a1300; color: #1a1300; height: 30px; }
.support-bar .btn:hover { background: rgba(0,0,0,.08); }
.support-notice { display: flex; gap: 10px; align-items: center; margin-bottom: 18px; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--warn-bg); color: var(--warn-fg); font-weight: 500; }

.mb { margin-bottom: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.card-form { display: flex; flex-direction: column; gap: 12px; padding: 16px 20px 20px; align-items: flex-start; }
.card-form .field, .card-form .segmented { width: 100%; }
.credentials { align-items: flex-start; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.plan-card { display: flex; flex-direction: column; gap: 12px; }
.plan-head { display: flex; justify-content: space-between; align-items: baseline; }
.plan-head h2 { font-size: 20px; }
.alert-list .alert-dot-off { background: var(--border-strong); }
.alert-list .empty { padding: 16px; }
.inline-field { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
.inline-field select { width: auto; }

.thread { list-style: none; margin: 0; padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 85%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); }
.msg-mine { align-self: flex-end; background: var(--brand-soft); border-color: transparent; }
.msg-internal { background: var(--warn-bg); border: 1px dashed var(--warn-fg); }
.msg-system { align-self: center; max-width: 100%; background: transparent; border: 0; padding: 4px; text-align: center; }
.msg-system-text { color: var(--text-weak); font-size: 12px; }
.msg-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 13px; }
.msg-body { line-height: 1.6; overflow-wrap: anywhere; }
.reply-box { padding: 16px 20px 20px; border-top: 1px solid var(--border); }
.reply-box .form-actions { margin-top: 12px; padding-top: 0; border-top: 0; }
.reply-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 12px; }
.reply-actions .btn { margin-left: auto; }
.audit-data summary { cursor: pointer; color: var(--brand-ink); font-weight: 600; }
.audit-data pre { margin: 6px 0 0; max-width: 460px; max-height: 260px; overflow: auto; font-size: 12px; background: var(--surface-2); padding: 8px; border-radius: 6px; }

/* ---------- Autocompletado ---------- */
.lookup { position: relative; }
.lookup-list {
    position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 20;
    list-style: none; margin: 0; padding: 4px; max-height: 300px; overflow-y: auto;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
    font-weight: 400;
}
.lookup-list li[role=option] { display: flex; flex-direction: column; gap: 1px; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.lookup-list li[aria-selected=true] { background: var(--brand-soft); }
.lookup-list li strong { font-weight: 600; font-size: 14px; }
.lookup-list li small { color: var(--text-weak); }
.lookup-msg { padding: 10px; color: var(--text-weak); font-size: 13px; }
.filters .lookup { flex: 1 1 220px; max-width: 320px; }
.topbar .platform-tag { align-self: center; }

/* ---------- HAL 9000 ---------- */
.hal-eye {
    width: 88px; height: 88px; border-radius: 50%; margin-bottom: 8px;
    background: radial-gradient(circle at 50% 50%, #fff6c8 0 4%, #ffb000 7%, #ff2a00 16%, #b00000 32%, #3a0000 52%, #111 58%, #2a2a2a 62%, #0b0b0b 66%);
    box-shadow: 0 0 0 6px #1a1a1a, 0 0 0 8px #555, 0 0 28px rgba(255, 40, 0, .45);
    animation: hal-pulse 3.2s ease-in-out infinite;
}
@keyframes hal-pulse { 50% { box-shadow: 0 0 0 6px #1a1a1a, 0 0 0 8px #555, 0 0 44px rgba(255, 40, 0, .7); } }
.hal-quote { font-size: 18px; font-weight: 600; margin: 4px 0 0; }
.hal-toast {
    position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 60;
    display: flex; align-items: center; gap: 14px; max-width: calc(100vw - 32px);
    padding: 14px 20px 14px 14px; border-radius: 999px; background: #0b0b0b; color: #f2f2f2;
    box-shadow: var(--shadow-lg); animation: pop .2s var(--ease); font-weight: 500;
}
.hal-toast .hal-eye { width: 34px; height: 34px; margin: 0; flex-shrink: 0; box-shadow: 0 0 0 3px #1a1a1a, 0 0 0 4px #555, 0 0 16px rgba(255, 40, 0, .5); }

/* ---------- Ingresar con Google ---------- */
.auth-or { display: flex; align-items: center; gap: 12px; color: var(--text-weak); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.btn-google { background: var(--surface); border-color: var(--border-strong); gap: 12px; font-weight: 600; }
.btn-google:hover { text-decoration: none; }
.google-g { width: 20px; height: 20px; flex-shrink: 0; }

/* ---------- Configuración en secciones ---------- */
.settings { display: flex; flex-direction: column; gap: 28px; max-width: 1100px; }
.settings-section { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 24px; align-items: start; scroll-margin-top: calc(var(--topbar-h) + 16px); }
.settings-section + .settings-section { padding-top: 28px; border-top: 1px solid var(--border); }
.settings-intro h2 { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.settings-intro p { margin: 0 0 10px; font-size: 13px; line-height: 1.55; }
.settings-card { overflow: hidden; }
.settings-card > .alert { margin: 16px 20px 0; }
.settings-card .props { border-top: 1px solid var(--border); }
.card-form-split { border-top: 1px solid var(--border); }
.card-form .grid { width: 100%; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 860px) {
    .settings-section { grid-template-columns: 1fr; gap: 12px; }
    .grid-2 { grid-template-columns: 1fr; }
}
.settings-alert { margin: 16px 20px 0; }
.error-message { padding-top: 18px; color: var(--text); font-weight: 500; overflow-wrap: anywhere; }
.trace-block { margin: 0; border-radius: 0; max-height: 480px; overflow: auto; }
.field-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.field-link { font-weight: 500; font-size: 12px; }
.btn:disabled { cursor: not-allowed; }
/* Listas de precios */
.cell-input { width: 130px; height: 34px; text-align: right; font-variant-numeric: tabular-nums; }
.bulk-panel { margin-bottom: 16px; }
.bulk-panel > summary { display: flex; align-items: center; gap: 8px; padding: 14px 20px; cursor: pointer; font-weight: 600; list-style: none; }
.bulk-panel > summary::-webkit-details-marker { display: none; }
.bulk-panel[open] > summary { border-bottom: 1px solid var(--border); }
.bulk-panel .form { padding: 18px 20px; }
.form-actions .muted { margin-right: auto; align-self: center; }

/* Pestañas de estado */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.tab { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--text-weak); font-weight: 500; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--text); border-bottom-color: var(--brand); font-weight: 600; }
.tab-count { font-size: 12px; padding: 0 7px; border-radius: 99px; background: var(--surface-hover); color: var(--text-weak); }

/* Próximo paso de un documento */
.next-step { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; margin-bottom: 16px; flex-wrap: wrap; border-left: 4px solid var(--brand); }
.next-step-text { display: flex; gap: 14px; align-items: center; }
.next-step-text p { margin: 2px 0 0; }
.next-step-icon { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--brand-soft); color: var(--brand-ink); flex-shrink: 0; }
.next-step-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Renglones de documentos */
.lines-table td { vertical-align: top; }
.lines-table .line-product { min-width: 260px; }
.lines-table .line-hint { display: block; margin-top: 4px; }
.lines-table .line-unit select { width: auto; min-width: 90px; }
.cell-qty { width: 110px; }
.cell-factor { width: 90px; }
.factor-box { display: flex; align-items: center; gap: 6px; margin-top: 6px; white-space: nowrap; font-size: 13px; color: var(--text-weak); }
.line-serials { margin-top: 8px; }
.line-serials textarea { min-height: 56px; font-family: ui-monospace, Menlo, Consolas, monospace; }
.lines-table tfoot td { border-bottom: 0; padding-top: 6px; padding-bottom: 6px; }
.total-row td { font-size: 15px; border-top: 1px solid var(--border); }
.add-line { margin-top: 12px; }
.field-static { display: block; padding: 9px 0; font-weight: 500; }

/* Documentos relacionados */
.doc-list { list-style: none; margin: 0; padding: 8px 20px 14px; }
.doc-list li { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.doc-list li:last-child { border-bottom: 0; }

/* Selección por tarjetas */
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.pick-card { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; color: var(--text); transition: border-color .15s, transform .15s; }
.pick-card:hover { text-decoration: none; border-color: var(--brand); transform: translateY(-2px); }
.pick-head { display: flex; justify-content: space-between; align-items: center; }
.pick-title { font-weight: 600; font-size: 15px; }
.section-title { font-size: 15px; font-weight: 600; margin: 24px 0 12px; }
.kpi-money { font-size: 24px; }
.todo-card { margin-bottom: 16px; }
.alert-list .alert-dot-info { background: var(--brand); }

/* Impresión */
.print-page { background: #fff; color: #111; }
.print-toolbar { display: flex; justify-content: flex-end; padding: 16px; max-width: 900px; margin: 0 auto; }
.print-doc { max-width: 900px; margin: 0 auto; padding: 0 16px 40px; }
.print-head { display: flex; justify-content: space-between; gap: 24px; padding-bottom: 16px; border-bottom: 2px solid #111; }
.print-head h1 { font-size: 22px; margin: 0 0 4px; }
.print-head p { margin: 0; color: #555; }
.print-doc-id { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.print-doc-id strong { font-size: 18px; }
.print-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin: 20px 0; }
.print-parties div { display: flex; flex-direction: column; gap: 2px; }
.print-parties small { text-transform: uppercase; letter-spacing: .06em; color: #666; }
.print-table { margin-top: 8px; }
.print-notes, .print-foot { margin-top: 20px; }
@media print {
    .no-print { display: none !important; }
    .print-doc { padding: 0; }
    @page { margin: 14mm; }
}

/* Menú por categorías colapsables */
.nav-group-toggle { padding: 12px 12px 6px; display: flex; align-items: center; justify-content: space-between; width: 100%; border: 0; background: transparent; cursor: pointer; font-family: inherit; text-align: left; border-radius: var(--radius-sm); }
.nav-group-toggle:hover { color: var(--text); }
.nav-chevron { width: 14px; height: 14px; transition: transform .2s var(--ease); }
.nav-section.is-closed .nav-chevron { transform: rotate(-90deg); }
.nav-section.is-closed .nav-items { display: none; }
.nav-section:first-child .nav-group { padding-top: 4px; }
.sb-collapsed .sidebar .nav-section.is-closed .nav-items { display: block; }
.sb-collapsed .sidebar .nav-chevron { display: none; }
.sb-collapsed .sidebar .nav-section:first-child .nav-group { border-top: 0; }

/* Vista previa de rol */
.preview-bar { position: relative; z-index: 31; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 8px 16px; background: var(--info-bg); color: var(--info-fg); font-weight: 500; }
.preview-bar form { margin: 0; }
.preview-bar select { width: auto; height: 32px; padding: 0 8px; }
.preview-bar .inline-form { margin-left: auto; }
.form-section.spaced { margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--border); }
.serial-picker { margin-top: 10px; padding: 12px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); }
.serial-picker-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.serial-picker-head .btn { margin-left: auto; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 99px; background: var(--surface); color: var(--text); cursor: pointer; font: inherit; font-size: 13px; }
.chip:hover { border-color: var(--brand); background: var(--brand-soft); }
.chip small { color: var(--text-weak); }
.sidebar .nav-group-toggle { padding: 10px 12px; margin-top: 2px; }
.sidebar .nav-group-toggle:hover { background: var(--surface-hover); }
.todo-card .alert-list .quick-arrow { margin-left: 4px; }
.todo-card .alert-list .alert-meta { min-width: 88px; text-align: right; }
.kpi-alert .kpi-icon { background: var(--err-bg); color: var(--err-fg); } .kpi-alert .kpi-value { color: var(--err-fg); }
.search-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.topbar-company { display: inline-flex; align-items: center; gap: 8px; }
.topbar-logo { height: 26px; width: auto; max-width: 90px; object-fit: contain; }
.print-logo { max-height: 56px; max-width: 220px; margin-bottom: 8px; display: block; }
.logo-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.logo-preview { width: 180px; height: 72px; display: grid; place-items: center; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-2, var(--surface)); }
.logo-preview img { max-width: 160px; max-height: 60px; object-fit: contain; }
.radio-card { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-bottom: 8px; cursor: pointer; }
.radio-card:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.radio-card input { margin-top: 4px; }
.field-bottom { justify-content: flex-end; display: flex; align-items: flex-end; }
/* Alertas */
.alert-list li.is-read strong { font-weight: 500; color: var(--text-weak); }
.alert-config { display: grid; gap: 14px; }
.alert-config-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.alert-config-head h2 { font-size: 15px; font-weight: 600; margin: 0 0 2px; }
.alert-config-head p { margin: 0; }
.alert-config-body { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-end; margin-top: 14px; }
.field-label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.chip-check { cursor: pointer; }
.chip-check:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.alert-days input { width: 70px; }
.bell { position: relative; }
.bell-count { position: absolute; top: 2px; right: 0; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px; background: var(--err-fg); color: #fff; font-size: 11px; font-weight: 700; line-height: 17px; text-align: center; }
.bell-panel { width: min(380px, calc(100vw - 24px)); padding: 0; }
.bell-panel .bell-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.bell-panel .alert-list { max-height: 360px; overflow-y: auto; }
.bell-panel .bell-foot { display: flex; justify-content: space-between; padding: 10px 14px; border-top: 1px solid var(--border); font-size: 13px; }
/* Renglones en pantallas chicas: cada renglón es una tarjeta (recepción en el depósito con tablet o celular). */
@media (max-width: 760px) {
    .lines-table thead { display: none; }
    .lines-table, .lines-table tbody, .lines-table tr, .lines-table td { display: block; width: 100%; }
    .lines-table tbody tr[data-line] { position: relative; padding: 12px 0; border-bottom: 1px solid var(--border); }
    .lines-table tbody td { border: 0; padding: 4px 0; text-align: left; }
    .lines-table tbody td[data-label] { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
    .lines-table tbody td[data-label]::before { content: attr(data-label); color: var(--text-weak); font-size: 13px; }
    .lines-table tbody td.actions { position: absolute; top: 8px; right: 0; width: auto; }
    .lines-table .line-product { min-width: 0; padding-right: 40px; }
    .lines-table tfoot tr { display: flex; justify-content: flex-end; gap: 12px; }
    .lines-table tfoot td { width: auto; }
    .lines-table tfoot td:empty { display: none; }
    .cell-input { width: 140px; }
}
.lookup-create { color: var(--brand-ink); font-weight: 600; border-top: 1px solid var(--border); }
.quick-dialog { border: 0; border-radius: 14px; padding: 0; width: min(520px, calc(100vw - 32px)); background: var(--surface); color: var(--text); box-shadow: var(--shadow-md, 0 20px 50px rgba(0,0,0,.25)); }
.quick-dialog::backdrop { background: rgba(10, 14, 18, .45); }
.quick-dialog h2 { font-size: 18px; margin: 0 0 4px; }
.quick-dialog .alert { margin: 12px 0; }
.customer-box { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--surface-hover); }
.print-sign { display: grid; grid-template-columns: 2fr 1fr; gap: 40px; margin-top: 60px; }
.print-sign div { border-top: 1px solid #111; padding-top: 6px; font-size: 13px; color: #555; }
.print-letter { width: 64px; height: 64px; flex-direction: column; line-height: 1; border: 2px solid #111; display: grid; place-items: center; font-size: 32px; font-weight: 800; align-self: flex-start; }
.print-draft { text-align: center; padding: 8px; margin-bottom: 12px; border: 2px dashed #b42318; color: #b42318; font-weight: 800; letter-spacing: .1em; }
.letter-badge { display: inline-grid; place-items: center; width: 26px; height: 26px; border: 2px solid var(--text); border-radius: 4px; font-weight: 800; }
.print-cae { display: flex; gap: 16px; align-items: center; margin-top: 24px; padding-top: 16px; border-top: 1px solid #ccc; font-size: 13px; }
.print-qr { width: 110px; height: 110px; flex-shrink: 0; }
.print-qr svg { width: 100%; height: 100%; }
.wizard { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.wizard li { position: relative; padding: 12px 14px 14px 18px; border-left: 3px solid var(--border); }
.wizard li.current { border-left-color: var(--brand); background: var(--brand-soft); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.wizard li.done { border-left-color: var(--ok-fg); }
.wizard li.done > strong::after { content: " ✓"; color: var(--ok-fg); }
.wizard p { margin: 4px 0 8px; font-size: 13px; }
.wizard .inline-form { flex-wrap: wrap; }
.print-letter small { display: block; font-size: 9px; font-weight: 600; margin-top: 2px; }
/* Logística */
.progress-line { display: flex; align-items: center; gap: 10px; }
.progress-bar { flex: 1; height: 6px; border-radius: 99px; background: var(--surface-hover); overflow: hidden; }
.progress-fill { display: block; height: 100%; width: 0; background: var(--brand); }
.stops { list-style: none; margin: 0; padding: 0; }
.stop { display: grid; grid-template-columns: 32px 1fr auto; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); align-items: start; }
.stop-num { width: 28px; height: 28px; border-radius: 99px; display: grid; place-items: center; background: var(--surface-hover); font-weight: 700; font-size: 13px; }
.stop-done .stop-num { background: var(--ok-bg); color: var(--ok-fg); }
.stop-failed .stop-num, .stop-conflict .stop-num { background: var(--err-bg); color: var(--err-fg); }
.stop-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stop-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.check-list { list-style: none; margin: 0; padding: 0; max-height: 360px; overflow-y: auto; }
.check-list li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.check-list .check { align-items: flex-start; }
.print-sub { font-size: 15px; margin: 20px 0 6px; }
.print-signbox { width: 140px; }
.proof-img { display: block; max-width: calc(100% - 40px); max-height: 180px; margin: 0 20px 16px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; }
.print-signature { max-height: 80px; max-width: 220px; border-bottom: 1px solid #111; }
.backup-list li { display: flex; align-items: center; gap: 8px; padding: 6px 12px; font-size: 13px; }
.setup-card { margin-bottom: 16px; }
.setup-progress { height: 6px; margin: 0 20px 4px; border-radius: 99px; background: var(--surface-hover); overflow: hidden; }
.setup-bar { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.setup-bar-0 { width: 0%; }
.setup-bar-10 { width: 10%; }
.setup-bar-20 { width: 20%; }
.setup-bar-30 { width: 30%; }
.setup-bar-40 { width: 40%; }
.setup-bar-50 { width: 50%; }
.setup-bar-60 { width: 60%; }
.setup-bar-70 { width: 70%; }
.setup-bar-80 { width: 80%; }
.setup-bar-90 { width: 90%; }
.setup-bar-100 { width: 100%; }
.setup-check { width: 22px; height: 22px; border-radius: 99px; border: 2px solid var(--border); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.setup-list li.is-done .setup-check { background: var(--brand); border-color: var(--brand); color: #fff; }
.setup-list li.is-done strong { text-decoration: line-through; color: var(--text-weak); font-weight: 500; }
.rubro-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; margin: 10px 0 8px; }
.rubro-card { margin: 0; height: 100%; }
.rubro-icon { width: 36px; height: 36px; border-radius: var(--radius-sm); background: var(--brand-soft); color: var(--brand); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.rubro-card { line-height: 1.35; position: relative; }
.rubro-card input { position: absolute; opacity: 0; pointer-events: none; }
.rubro-card:has(input:focus-visible) { outline: 2px solid var(--brand); outline-offset: 2px; }
.rubro-roles { display: block; margin-top: 6px; }

/* Caja / punto de venta */
.is-muted td { color: var(--text-weak); }
.text-err { color: var(--err-fg); }
.pos-registers { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.pos-register.is-open { border-color: var(--brand); }
.pos-amount { font-size: 22px; height: 52px; font-variant-numeric: tabular-nums; }
.pos { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; margin-bottom: 16px; }
.pos-main { min-height: 60vh; display: flex; flex-direction: column; }
.pos-search { position: relative; padding: 14px; border-bottom: 1px solid var(--border); }
.pos-search input { height: 54px; font-size: 18px; padding-left: 44px; }
.pos-search-icon { position: absolute; left: 28px; top: 50%; transform: translateY(-50%); color: var(--text-weak); display: flex; }
.pos-results { position: absolute; left: 14px; right: 14px; top: calc(100% - 8px); z-index: 20; list-style: none; margin: 0; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: 0 16px 40px rgba(0, 0, 0, .18); max-height: 380px; overflow: auto; }
.pos-results li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; cursor: pointer; }
.pos-results li.is-active, .pos-results li:hover { background: var(--brand-soft); }
.pos-res-price { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pos-lines-wrap { flex: 1; overflow: auto; }
.pos-lines td { padding: 10px 14px; }
.pos-lines tr.pos-short small { color: var(--err-fg); }
.pos-qty { display: inline-flex; align-items: center; gap: 4px; }
.pos-qty input { width: 64px; text-align: center; height: 36px; }
.pos-price { width: 110px; text-align: right; height: 36px; }
.pos-error, .pos-warn { margin: 0; padding: 10px 14px; background: var(--err-bg); color: var(--err-fg); border-radius: var(--radius-sm); }
.pos-main .pos-error { margin: 0 14px 14px; }
.pos-warn { background: var(--warn-bg); color: var(--warn-fg); }
.pos-side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 76px; }
.pos-total-card { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.pos-customer { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; }
.pos-customer .btn { margin-left: auto; }
.pos-customer-pick { display: flex; flex-direction: column; gap: 6px; }
.pos-discount input { width: 100px; }
.pos-total { display: flex; flex-direction: column; padding: 14px 0; border-top: 1px solid var(--border); }
.pos-total strong { font-size: 40px; line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.pos-pay-btn { width: 100%; height: 58px; font-size: 18px; }
.pos-shift .props { padding: 0 18px; }
.pos-shift-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 18px 18px; }
.pos-pay-dialog { width: min(560px, calc(100vw - 32px)); }
.pos-pay-dialog .card-form { padding: 22px; align-items: stretch; }
.pos-pay-head { display: flex; flex-direction: column; align-items: center; text-align: center; width: 100%; gap: 2px; padding-bottom: 8px; }
.pos-pay-head strong { font-size: 44px; font-variant-numeric: tabular-nums; }
.pos-quick-cash { display: flex; flex-wrap: wrap; gap: 6px; }
.pos-other summary { cursor: pointer; padding: 8px 0; font-weight: 600; }
.pos-method { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: end; padding: 8px 0; border-top: 1px dashed var(--border); }
.pos-method:has([data-pos-installments]) { grid-template-columns: 1fr 90px 1fr auto; }
.pos-change { display: flex; width: 100%; justify-content: space-between; align-items: baseline; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); font-size: 18px; }
.pos-change strong { font-size: 28px; font-variant-numeric: tabular-nums; }
.pos-done { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 28px 22px; }
.pos-done .empty-icon { background: var(--ok-bg); color: var(--ok-fg); }
.pos-change-big { width: 100%; justify-content: center; gap: 16px; border: 0; }
.pos-change-big strong { font-size: 48px; }
.pos-done .form-actions { width: 100%; justify-content: center; }
@media (max-width: 960px) {
    .pos { grid-template-columns: 1fr; }
    .pos-side { position: static; }
    .pos-main { min-height: 0; }
    .pos-method, .pos-method:has([data-pos-installments]) { grid-template-columns: 1fr 1fr; }
}

/* Ticket de 80 mm */
.ticket { page: ticket; width: 72mm; margin: 0 auto 32px; font: 12px/1.35 ui-monospace, Menlo, Consolas, monospace; color: #000; }
.ticket-head { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 1px; padding-bottom: 6px; border-bottom: 1px dashed #000; }
.ticket-head strong { font-size: 14px; }
.ticket-doc, .ticket-customer { margin: 6px 0; padding-bottom: 6px; border-bottom: 1px dashed #000; }
.ticket-doc { text-align: center; }
.ticket-lines, .ticket-totals { width: 100%; border-collapse: collapse; }
.ticket-lines td, .ticket-totals td { padding: 1px 0; vertical-align: top; }
.ticket .num { text-align: right; white-space: nowrap; }
.ticket-totals { margin-top: 6px; border-top: 1px dashed #000; }
.ticket-total td { font-size: 15px; font-weight: 700; padding: 4px 0; }
.ticket-note { margin: 6px 0; text-align: center; font-size: 11px; }
.ticket-flag { margin: 0 0 6px; padding: 4px; border: 1px solid #000; text-align: center; font-weight: 700; }
.ticket-qr { display: flex; justify-content: center; margin: 8px 0 2px; }
@page ticket { size: 80mm auto; margin: 3mm 4mm; }

/* Lectura de facturas con IA */
.ai-read { display: flex; align-items: center; gap: 16px; padding: 16px 20px; margin-bottom: 16px; flex-wrap: wrap; border-style: dashed; }
.ai-read-icon { width: 42px; height: 42px; border-radius: var(--radius-sm); background: var(--brand-soft); color: var(--brand); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ai-read-text { display: flex; flex-direction: column; gap: 2px; flex: 1 1 320px; }
.ai-read-btn { cursor: pointer; }
.ai-read-btn.is-busy { opacity: .6; pointer-events: none; }
.ai-read-busy { flex-basis: 100%; }
.ai-result { margin-bottom: 16px; border-color: var(--brand); }
.ai-warnings { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ai-warnings li { display: flex; gap: 8px; align-items: flex-start; color: var(--warn-fg); }

/* Etiquetas */
.label-qty { width: 72px; text-align: right; }
.labels { display: flex; flex-wrap: wrap; gap: 2mm; padding: 4mm; justify-content: flex-start; }
.label { display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; border: 1px dashed #bbb; padding: 1.5mm 2mm; color: #000; background: #fff; break-inside: avoid; page-break-inside: avoid; }
.label-name { font: 600 9pt/1.15 Inter, Arial, sans-serif; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.label-price { font: 800 16pt/1 Inter, Arial, sans-serif; font-variant-numeric: tabular-nums; }
.label-price small { font-size: 8pt; font-weight: 600; }
.label-code { display: block; }
.label-code .barcode { width: 100%; height: 11mm; display: block; }
.label-sku { font: 7pt/1 monospace; }
.labels-gondola .label { width: 60mm; height: 30mm; }
.labels-small .label { width: 40mm; height: 25mm; }
.labels-small .label-name { font-size: 7.5pt; -webkit-line-clamp: 1; }
.labels-small .label-price { font-size: 12pt; }
.labels-small .label-code .barcode { height: 9mm; }
.labels-a4_65 { display: grid; grid-template-columns: repeat(5, 38.1mm); grid-auto-rows: 21.2mm; gap: 0 2.5mm; padding: 10.7mm 4.75mm; width: 210mm; }
.labels-a4_65 .label { border-color: #eee; padding: 1mm 1.5mm; }
.labels-a4_65 .label-name { font-size: 6.5pt; -webkit-line-clamp: 1; }
.labels-a4_65 .label-price { font-size: 10pt; }
.labels-a4_65 .label-code .barcode { height: 8mm; }
.labels-thermal { display: block; padding: 0; }
.labels-thermal .label { page: thermal; width: 50mm; height: 25mm; border: 0; margin: 0 auto; break-after: page; page-break-after: always; }
.labels-thermal .label-name { font-size: 7.5pt; }
.labels-thermal .label-price { font-size: 12pt; }
.labels-thermal .label-code .barcode { height: 9mm; }
@page thermal { size: 50mm 25mm; margin: 0; }
@media print {
    .labels { padding: 0; gap: 0; }
    .labels-gondola, .labels-small { gap: 0; }
    .labels-gondola .label, .labels-small .label { border-color: #ddd; }
    .labels-a4_65 { padding: 10.7mm 4.75mm; gap: 0 2.5mm; }
    .labels-a4_65 .label { border: 0; }
    .labels-a4_65, .labels-gondola, .labels-small { page: sheet; }
}
@page sheet { size: A4; margin: 0; }
.label-code-text { display: block; font: 7pt/1.1 monospace; text-align: center; letter-spacing: .05em; }
.labels-a4_65 .label-code-text { font-size: 6pt; }

/* Variantes */
.variants-card { margin-bottom: 16px; }
.variants-card .card-head .toolbar-actions { display: flex; gap: 8px; align-items: center; }
.variants-matrix th:first-child { width: 1%; white-space: nowrap; }
.variant-cell { display: inline-block; min-width: 44px; padding: 4px 8px; border-radius: 8px; background: var(--ok-bg); color: var(--ok-fg); font-weight: 600; text-align: center; }
.variant-cell.is-empty { background: var(--surface-2); color: var(--text-weak); }
.variant-cell:hover { text-decoration: none; outline: 2px solid var(--brand); }
.pos-voucher { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--brand-soft); font-size: 13px; }
.pos-voucher-row { display: flex; gap: 6px; }
.pos-voucher-row input { flex: 1; }
.pos-refund-dialog { width: min(640px, calc(100vw - 32px)); }
.pos-refund-dialog .card-form { padding: 22px; align-items: stretch; }
.refund-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.refund-modes .radio-card { margin: 0; }
@media (max-width: 560px) { .refund-modes { grid-template-columns: 1fr; } }
.pos-total-line { margin: 0; font-size: 16px; }
.refund-qty { width: 80px; text-align: right; }
.refund-modes input[type=radio] { width: 16px; height: 16px; flex: none; margin-top: 3px; }
.lots-card { margin-bottom: 16px; }
.send-log { list-style: none; margin: 0; padding: 0; font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.help-video-play .icon { fill: currentColor; }

/* ---------- Compras: retenciones y listas de precios de proveedores ---------- */
.wh-table .cell-input { width: 140px; }
.wh-table .cell-rate { width: 90px; }
.wh-msg { color: var(--warn-fg); }
.wh-msg:empty { display: none; }
.mt-none { margin-top: 0; }
.table-compact th, .table-compact td { padding: 8px 12px; font-size: 13px; }
.import-table td { vertical-align: top; }
.import-product { min-width: 260px; }
.import-product .lookup { margin-top: 2px; }
.import-change > summary { cursor: pointer; font-size: 12px; color: var(--brand-ink); margin-top: 4px; }
.import-change[open] > summary { margin-bottom: 6px; }
.import-prices { margin-top: 14px; max-width: 760px; }
.import-prices .chips .check { padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; }
.print-void { margin-top: 6px; padding: 2px 10px; border: 2px solid #b00; color: #b00; font-weight: 700; letter-spacing: .1em; }
.print-cert-title { font-size: 17px; margin: 18px 0 0; }
.print-signs { display: flex; justify-content: flex-end; gap: 48px; margin-top: 64px; }
.print-signs span { min-width: 240px; padding-top: 6px; border-top: 1px solid #111; text-align: center; font-size: 13px; color: #444; }
.print-doc + .print-cert { margin-top: 48px; padding-top: 32px; border-top: 1px dashed #999; }
@media print {
    .print-doc + .print-cert { break-before: page; margin-top: 0; padding-top: 0; border-top: 0; }
}

/* ===== Inventario: movimientos de varias líneas, conteos e importación ===== */
.scan-box { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 14px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-2); }
.scan-box > .icon { color: var(--text-weak); flex: none; }
.scan-box input { flex: 1 1 260px; min-width: 0; }
.scan-msg { flex: 1 1 100%; color: var(--text-weak); min-height: 1.2em; }
.scan-msg.text-err { color: var(--err-fg); }
.scan-card { padding: 14px 16px; margin-bottom: 16px; }
.scan-card .scan-box { margin: 0; }
.line-lot { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.line-lot input:not([type=date]) { flex: 1 1 120px; }
.line-lot input[type=date] { width: auto; }
.line-lot select { width: 100%; }
.qty-cell { display: inline-flex; align-items: center; gap: 6px; }
.move-lines tr.is-flash, .count-sheet tr.is-flash { animation: inv-flash 1.2s var(--ease, ease); }
@keyframes inv-flash { 0% { background: var(--brand-soft); } 100% { background: transparent; } }
.chip-static { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 99px; font-size: 13px; }
.count-sheet tr.is-counted td:first-child { box-shadow: inset 3px 0 0 var(--ok-fg); }
.count-sheet td small.muted { display: block; }
.sticky-actions { position: sticky; bottom: 0; z-index: 2; padding: 12px 16px; margin-top: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--shadow-sm); }
.count-print .count-box { min-width: 90px; border: 1px solid #999; }
.count-print-group td { padding-top: 14px; background: #f3f3f3; }
.count-print-extra { height: 120px; border: 1px solid #999; border-radius: 4px; }
.import-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; margin-bottom: 16px; }
.import-grid .card-head h2 { display: flex; align-items: center; gap: 8px; }
.import-grid .field .check { margin-top: 6px; display: flex; align-items: center; gap: 8px; font-weight: 400; }
.import-grid input[type=radio] { width: 16px; height: 16px; flex: none; margin: 0; }
.import-table td small { display: block; }
.import-table tr.is-error td { background: var(--err-bg); }
.import-msgs { margin: 0; padding-left: 18px; font-size: 13px; }
.import-change { display: block; }
@media (max-width: 560px) { .scan-box > .icon { display: none; } .scan-box input { flex-basis: 100%; } .sticky-actions { flex-direction: column; align-items: stretch; } }

/* ---------- Contabilidad ---------- */
.kpi-static:hover { transform: none; box-shadow: var(--shadow-sm); border-color: var(--border); }
.kpi-static::after { display: none; }
.period-filter { margin-bottom: 0; }
.period-filter input[type=month] { width: auto; }
.iva-table th, .iva-table td.num { white-space: nowrap; }
.iva-table { font-size: 13px; }
.journal-table .journal-entry + .journal-entry .journal-head td { border-top: 2px solid var(--border); }
.journal-head td { background: var(--surface-hover); font-size: 13px; }
.journal-head .badge { margin-left: 6px; }
.journal-src { margin-left: 8px; font-size: 13px; white-space: nowrap; }
.journal-credit { padding-left: 40px !important; }
.journal-lines select { min-width: 260px; }
.journal-lines td:nth-child(2) input { min-width: 160px; }
.acc-group td { font-weight: 600; }
.acc-depth-1 { padding-left: 32px !important; }
.acc-depth-2 { padding-left: 52px !important; }
.acc-depth-3 { padding-left: 72px !important; }
.acc-depth-4 { padding-left: 92px !important; }
.print-wide { max-width: none; }
.print-wide .print-table { font-size: 11px; }
.print-wide .print-table th, .print-wide .print-table td { padding: 4px 6px; }
.print-narrow { max-width: 420px; }
.print-wide { page: books; }
@page books { size: A4 landscape; margin: 10mm; }
@media (max-width: 560px) { .journal-credit { padding-left: 20px !important; } .acc-depth-1, .acc-depth-2, .acc-depth-3, .acc-depth-4 { padding-left: 16px !important; } }
.import-prices .radio-card input[type=radio] { width: 16px; height: 16px; flex: none; margin-top: 3px; }
.form > .hint.mt-none { margin-bottom: 18px; }

/* Ticket de soporte emergente */
.ticket-dialog { width: min(640px, calc(100vw - 32px)); }
.ticket-dialog .form, .ticket-dialog .ticket-sent { padding: 22px; }
.ticket-sent h2 { display: flex; align-items: center; gap: 8px; color: var(--ok-fg); }

/* RRHH */
.clock-photo { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; display: block; }
.employee-photo { width: 120px; height: 120px; object-fit: cover; border-radius: 12px; display: block; margin-bottom: 10px; }
.pin-show { font-size: 22px; font-weight: 700; letter-spacing: .2em; }
.pin-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0; }
.pin-card { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border: 1px dashed var(--border-strong); break-inside: avoid; }
.pin-card .pin-show { margin: 6px 0; font-size: 28px; }
.hours-summary { display: flex; flex-wrap: wrap; gap: 8px 28px; padding: 0 20px 14px; }
.hours-summary div { display: flex; flex-direction: column; }
.hours-summary strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.hours-summary span { font-size: 12px; color: var(--text-weak); }
.period-grid td input { width: 72px; text-align: right; }
.period-grid td.num small { display: block; }
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.checklist li:last-child { border-bottom: 0; }
.checklist .badge { min-width: 34px; justify-content: center; }
.face-compare { display: flex; gap: 6px; }
.clock-photo.is-ref { outline: 2px solid var(--brand); outline-offset: -2px; }
.shift-strip { display: inline-flex; flex-wrap: wrap; gap: 3px; }
.shift-chip { display: inline-grid; place-items: center; min-width: 26px; height: 24px; padding: 0 5px; border-radius: 6px; background: var(--brand-soft); color: var(--brand-ink); font-weight: 700; font-size: 12px; }
.shift-chip.is-off { background: var(--surface-hover); color: var(--text-weak); }
.rotation-days { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 12px; }
.rotation-day.is-hidden { display: none; }
[data-for][hidden] { display: none; }
.roster th, .roster td { padding-left: 4px; padding-right: 4px; }
.roster th.is-today { color: var(--brand-ink); }
.roster th.is-holiday { background: var(--warn-bg); }
.roster button.shift-chip { border: 0; cursor: pointer; font: inherit; font-weight: 700; font-size: 12px; }
.shift-chip.is-changed { box-shadow: 0 0 0 2px var(--warn-fg); }
.shift-chip.is-leave { background: var(--info-bg); color: var(--info-fg); }
.roster-options { display: grid; gap: 6px; margin: 12px 0; }
.roster-options .btn { justify-content: flex-start; }
.legend { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.roster-dialog form { padding: 20px; }
.roster-dialog h2 { font-size: 17px; margin: 0; }
.inline-details { display: inline-block; position: relative; }
.inline-details > summary { list-style: none; }
.inline-details > summary::-webkit-details-marker { display: none; }
.adjust-pop { position: absolute; right: 0; z-index: 10; width: 260px; padding: 14px; box-shadow: var(--shadow-lg, 0 16px 48px rgba(0,0,0,.2)); text-align: left; }
.payslip { page-break-after: always; position: relative; }
.payslip-head { display: flex; justify-content: space-between; gap: 16px; border-bottom: 2px solid var(--text); padding-bottom: 8px; margin-bottom: 10px; }
.payslip-title { text-align: right; }
.payslip-data { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px 14px; margin: 0 0 12px; }
.payslip-data dt { font-size: 11px; color: var(--text-weak); }
.payslip-data dd { margin: 0; font-weight: 600; }
.payslip .print-table { width: 100%; }
