/* =========================================================
   FIRST HILL · Sistema de gestión
   Marca: naranja First Hill + negro
   ========================================================= */
:root {
  --naranja: #f26b0a;
  --naranja-2: #ff8a33;
  --naranja-bg: #fff3ea;
  --negro: #121212;
  --negro-2: #1d1d1f;
  --gris-9: #2b2b2e;
  --gris-7: #55565b;
  --gris-5: #8a8b91;
  --gris-3: #d9dade;
  --gris-2: #ebecef;
  --gris-1: #f5f6f8;
  --blanco: #fff;
  --verde: #18864b;
  --verde-bg: #e7f6ee;
  --rojo: #c8322b;
  --rojo-bg: #fdecea;
  --azul: #2563c9;
  --azul-bg: #e9f0fc;
  --morado: #7240c2;
  --morado-bg: #f1eafc;
  --radio: 10px;
  --sombra: 0 1px 2px rgba(16, 17, 20, .05), 0 4px 16px rgba(16, 17, 20, .05);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: 14px; color: var(--negro); background: var(--gris-1); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h2 { font-size: 16px; font-weight: 700; }
h3 { font-size: 14px; font-weight: 700; }
p { margin: 0 0 10px; }
code, .mono { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 12.5px; }
.ico { flex: none; }
[hidden] { display: none !important; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 248px; flex: none; background: var(--negro); color: #c9cacf;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 18px 18px 14px; border-bottom: 1px solid #26262a; }
.brand img { width: 40px; height: 40px; object-fit: contain; }
.brand b { display: block; color: #fff; font-size: 15px; letter-spacing: .06em; }
.brand small { display: block; color: var(--naranja); font-size: 11px; font-weight: 600; }
.sidebar nav { padding: 10px 10px 20px; flex: 1; }
.nav-group { font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; color: #6d6e74; padding: 16px 10px 6px; font-weight: 700; }
.sidebar nav a { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 8px; font-weight: 500; transition: background .15s, color .15s; }
.sidebar nav a:hover { background: #1f1f23; color: #fff; }
.sidebar nav a.active { background: var(--naranja); color: #fff; box-shadow: 0 4px 14px rgba(242, 107, 10, .35); }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 14px; border-top: 1px solid #26262a; }
.sidebar-user .who { flex: 1; min-width: 0; }
.sidebar-user b { display: block; color: #fff; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user small { color: #8a8b91; font-size: 11.5px; }
.sidebar-user a { color: #8a8b91; padding: 6px; border-radius: 6px; }
.sidebar-user a:hover { color: #fff; background: #1f1f23; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--naranja); color: #fff; display: grid; place-items: center; font-weight: 700; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 14px 28px; background: rgba(245, 246, 248, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--gris-2);
}
.topbar h1 { font-size: 20px; font-weight: 800; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.menu-btn { display: none; }
.content { padding: 22px 28px 60px; max-width: 1400px; width: 100%; }
.overlay { display: none; }

/* ---------- Componentes ---------- */
.card { background: var(--blanco); border: 1px solid var(--gris-2); border-radius: var(--radio); padding: 18px 20px; box-shadow: var(--sombra); margin-bottom: 18px; }
.card.p0 { padding: 0; overflow: hidden; }
.card h2 { margin-bottom: 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.card-head.pad { padding: 16px 20px 0; }
.card-head.mt, .mt { margin-top: 20px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 + .grid-2, .grid-2 + .card, .grid-2 + .tabs, .grid-2 + form { margin-top: 18px; }
.align-start { align-items: start; }
.muted { color: var(--gris-5); }
.hint { color: var(--gris-5); font-size: 12.5px; margin-top: 6px; }
.empty { color: var(--gris-5); text-align: center; padding: 26px 10px !important; }
.text-danger { color: var(--rojo) !important; }
.text-ok { color: var(--verde) !important; }
.nowrap { white-space: nowrap; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grow { flex: 1; min-width: 0; }
.big { font-size: 26px; font-weight: 800; margin: 4px 0; }
.link { color: var(--naranja); font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.link:hover { text-decoration: underline; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 14px;
  border: 1px solid var(--gris-3); background: var(--blanco); color: var(--negro); border-radius: 8px;
  font: 600 13.5px var(--font); cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--gris-1); border-color: var(--gris-5); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn-primary { background: var(--naranja); border-color: var(--naranja); color: #fff; }
.btn-primary:hover { background: #db5e05; border-color: #db5e05; }
.btn-accent { background: var(--negro); border-color: var(--negro); color: #fff; }
.btn-accent:hover { background: var(--gris-9); border-color: var(--gris-9); }
.btn-ghost-danger { color: var(--rojo); border-color: transparent; background: transparent; }
.btn-ghost-danger:hover { background: var(--rojo-bg); border-color: var(--rojo-bg); }
.btn-dashed { border-style: dashed; color: var(--gris-7); }
.btn-block { width: 100%; }
.btn-sm { height: 32px; padding: 0 10px; font-size: 12.5px; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 7px; border: 0; background: transparent; color: var(--gris-7); cursor: pointer; font: 700 15px var(--font); }
.icon-btn:hover { background: var(--gris-2); color: var(--negro); }
.icon-btn.copied { color: var(--verde); }
.inline-form { display: inline; margin: 0; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.stack .inline-form { display: block; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.badge { display: inline-block; padding: 3px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.badge-gris { background: var(--gris-2); color: var(--gris-7); }
.badge-azul { background: var(--azul-bg); color: var(--azul); }
.badge-verde { background: var(--verde-bg); color: var(--verde); }
.badge-rojo { background: var(--rojo-bg); color: var(--rojo); }
.badge-morado { background: var(--morado-bg); color: var(--morado); }
.doc-chip { display: inline-block; padding: 3px 8px; border-radius: 6px; font: 700 12px var(--font); white-space: nowrap; background: var(--gris-2); }
.doc-chip.lg { font-size: 14px; padding: 5px 10px; }
.doc-cot { background: var(--naranja-bg); color: #b44d00; }
.doc-rem { background: #eaeaec; color: var(--negro); }
.doc-oc { background: var(--azul-bg); color: var(--azul); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--gris-3); }
.dot-ok { background: var(--verde); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

.alert { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 8px; margin-bottom: 14px; font-weight: 500; }
.alert-ok { background: var(--verde-bg); color: #0f5a32; }
.alert-error { background: var(--rojo-bg); color: #8c1d18; }
.alert.small { font-size: 12.5px; margin: 0; }
.ok-note { display: flex; align-items: center; gap: 6px; color: var(--verde); font-weight: 600; margin: 0; }

/* Tabs y filtros */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--gris-3); margin-bottom: 14px; overflow-x: auto; }
.tabs a { padding: 10px 14px; font-weight: 600; color: var(--gris-7); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.active { color: var(--naranja); border-color: var(--naranja); }
.filters { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.search { display: flex; align-items: center; gap: 8px; background: var(--blanco); border: 1px solid var(--gris-3); border-radius: 8px; padding: 0 10px; flex: 1; min-width: 220px; color: var(--gris-5); }
.search input { border: 0 !important; box-shadow: none !important; padding-left: 0 !important; background: transparent; }
.filters select, .filters input[type=date] { width: auto; }
label.inline { display: inline-flex; flex-direction: row; align-items: center; gap: 6px; font-size: 13px; color: var(--gris-7); margin: 0; }

/* Tablas */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--gris-5); font-weight: 700; padding: 11px 14px; background: #fafafb; border-bottom: 1px solid var(--gris-2); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--gris-2); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fcfaf8; }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table .center { text-align: center; }
.table .actions { text-align: right; white-space: nowrap; width: 1%; }
.table tr.clickable { cursor: pointer; }
.table tr.inactive td { opacity: .5; }
.table tfoot th { background: #fafafb; color: var(--negro); font-size: 13px; border-top: 2px solid var(--gris-3); }
.prod-cell { display: flex; align-items: center; gap: 10px; }
.prod-cell img { width: 38px; height: 38px; object-fit: cover; border-radius: 6px; background: var(--gris-1); }
.prod-cell small, .prod-name small { display: block; color: var(--gris-5); font-size: 12px; }

/* Matriz de tallas */
.matrix td.t, .matrix th.t { text-align: center; padding: 9px 6px; min-width: 40px; }
.matrix td.t.zero { color: var(--gris-3); }
.matrix td.t.off { background: repeating-linear-gradient(135deg, #fafafa 0 4px, #f2f2f4 4px 8px); }
.matrix td.t.neg { color: var(--rojo); font-weight: 700; }
.sticky-col { position: sticky; left: 0; background: var(--blanco); z-index: 1; min-width: 210px; }
.table th.sticky-col { background: #fafafb; }
.prod-name b { font-weight: 600; }
.prod-name:hover b { color: var(--naranja); }

/* KPIs y gráficas */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.kpis-sm { grid-template-columns: repeat(3, 1fr); }
.kpi { background: var(--blanco); border: 1px solid var(--gris-2); border-radius: var(--radio); padding: 16px 18px; box-shadow: var(--sombra); position: relative; overflow: hidden; }
.kpi::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--naranja); }
.kpi-warn::before { background: var(--rojo); }
.kpi-label { display: block; font-size: 12px; color: var(--gris-5); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.kpi-value { display: block; font-size: 24px; font-weight: 800; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 12.5px; color: var(--gris-7); }
.bars { display: flex; align-items: flex-end; gap: 14px; height: 190px; padding-top: 18px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.bar { width: 100%; max-width: 46px; background: linear-gradient(180deg, var(--naranja-2), var(--naranja)); border-radius: 6px 6px 2px 2px; min-height: 2px; }
.bar-val { font-size: 11px; font-weight: 700; color: var(--gris-7); }
.bar-lbl { font-size: 12px; color: var(--gris-5); text-transform: capitalize; }
.hbars { display: flex; flex-direction: column; gap: 10px; }
.hbar { display: grid; grid-template-columns: 110px 1fr 50px; gap: 10px; align-items: center; font-size: 13px; }
.hbar b { text-align: right; }
.hbar-lbl { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-track { height: 10px; background: var(--gris-2); border-radius: 99px; overflow: hidden; }
.hbar-fill { height: 100%; background: var(--negro); border-radius: 99px; }
.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--gris-2); }
.list-row:last-child { border-bottom: 0; }
a.list-row:hover { background: #fcfaf8; }
.qty { font-weight: 800; min-width: 44px; font-variant-numeric: tabular-nums; }
.qty.pos { color: var(--verde); }
.qty.neg { color: var(--rojo); }
.dl { display: grid; grid-template-columns: 120px 1fr; gap: 10px 14px; margin: 0; }
.dl dt { color: var(--gris-5); font-weight: 600; font-size: 13px; }
.dl dd { margin: 0; }

/* ---------- Formularios ---------- */
label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--gris-7); margin-bottom: 12px; }
.label { display: block; font-size: 12.5px; font-weight: 600; color: var(--gris-7); margin-bottom: 6px; }
input, select, textarea {
  width: 100%; font: 400 14px var(--font); color: var(--negro); background: var(--blanco);
  border: 1px solid var(--gris-3); border-radius: 8px; padding: 9px 11px; min-height: 38px; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--naranja); box-shadow: 0 0 0 3px rgba(242, 107, 10, .15); }
input[readonly] { background: var(--gris-1); color: var(--gris-7); }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; accent-color: var(--naranja); }
input[type=file] { padding: 7px; }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; color: var(--negro); cursor: pointer; }
.form-card { max-width: 920px; }
.form-card.narrow { max-width: 440px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.form-grid h3 { margin: 6px 0 12px; }
.span-2 { grid-column: span 2; }
.self-end { align-self: end; }
.form-actions { display: flex; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.sticky-actions { position: sticky; bottom: 0; background: var(--gris-1); padding: 12px 0; border-top: 1px solid var(--gris-2); }
.sub-box { background: var(--gris-1); border-radius: 8px; padding: 12px 14px 2px; margin-bottom: 12px; }
.sub-box h3 { margin-bottom: 10px; }
.thumb { width: 72px; height: 72px; object-fit: contain; border-radius: 8px; border: 1px solid var(--gris-2); background: #fff; }
.input-row { display: flex; gap: 6px; }
.input-row select { flex: 1; min-width: 0; }
.check-list { max-height: 240px; overflow-y: auto; border: 1px solid var(--gris-2); border-radius: 8px; padding: 10px 12px; }
.check-list label { margin-bottom: 8px; }
.copy-field { display: flex; align-items: center; gap: 10px; background: var(--gris-1); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; }
.copy-field span { font-size: 12px; color: var(--gris-5); font-weight: 600; min-width: 92px; }
.copy-field code { flex: 1; word-break: break-all; }
details.howto { margin: 12px 0; background: var(--naranja-bg); border-radius: 8px; padding: 10px 14px; }
details.howto summary { cursor: pointer; font-weight: 700; color: #b44d00; }
details.howto ol { margin: 10px 0 4px; padding-left: 18px; line-height: 1.6; }

/* Segmentado (tipo de movimiento) */
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg-opt { flex-direction: row; margin: 0; }
.seg-opt input { position: absolute; opacity: 0; pointer-events: none; }
.seg-opt span { display: inline-block; padding: 8px 12px; border: 1px solid var(--gris-3); border-radius: 8px; cursor: pointer; font-weight: 600; color: var(--gris-7); background: #fff; }
.seg-opt input:checked + span { color: #fff; }
.seg-in input:checked + span { background: var(--verde); border-color: var(--verde); }
.seg-out input:checked + span { background: var(--rojo); border-color: var(--rojo); }
.seg-adj input:checked + span { background: var(--azul); border-color: var(--azul); }
.seg-opt input:focus-visible + span { box-shadow: 0 0 0 3px rgba(242, 107, 10, .3); }

/* Grilla de tallas (movimientos) */
.size-grid-wrap { overflow-x: auto; margin: 4px 0 16px; }
.size-grid { border-collapse: collapse; }
.size-grid th, .size-grid td { border: 1px solid var(--gris-2); padding: 6px; text-align: center; min-width: 58px; font-variant-numeric: tabular-nums; }
.size-grid thead th { background: var(--negro); color: #fff; }
.size-grid tbody th { background: var(--gris-1); text-align: left; font-size: 12px; color: var(--gris-7); white-space: nowrap; }
.size-grid input { text-align: center; padding: 7px 4px; min-height: 34px; font-weight: 700; }
.size-grid td.changed { color: var(--naranja); font-weight: 800; }
.size-total { font-size: 14px; }

/* ---------- Editor de documentos ---------- */
.item { border: 1px solid var(--gris-2); border-radius: 10px; padding: 12px 12px 4px; margin-bottom: 10px; background: #fff; position: relative; }
.item:focus-within { border-color: var(--naranja); box-shadow: 0 0 0 3px rgba(242, 107, 10, .08); }
.item-top { display: grid; grid-template-columns: 26px minmax(220px, 3fr) 1fr 1fr 70px 80px 1.1fr 1fr 70px; gap: 8px; align-items: end; }
.item-top label { margin-bottom: 8px; }
.item-n { align-self: center; width: 24px; height: 24px; border-radius: 50%; background: var(--negro); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 700; margin-bottom: 8px; }
.it-total { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; text-align: right; }
.it-total span { font-size: 12.5px; font-weight: 600; color: var(--gris-7); }
.it-total b { font-size: 15px; line-height: 38px; white-space: nowrap; }
.it-tools { display: flex; gap: 2px; justify-content: flex-end; margin-bottom: 10px; }
.it-desc { margin-left: 34px; }
.it-desc textarea { font-size: 13px; }
.it-tallas { margin-left: 34px; display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; padding-bottom: 8px; }
.it-tallas > label { margin: 8px 0 0; font-size: 12.5px; }
.size-inline { display: flex; flex-wrap: wrap; gap: 4px; }
.size-cell { flex-direction: column; align-items: center; gap: 2px; margin: 0; width: 48px; }
.size-t { font-size: 11px; font-weight: 800; color: #fff; background: var(--negro); border-radius: 4px; width: 100%; text-align: center; padding: 1px 0; }
.size-cell input { text-align: center; padding: 5px 2px; min-height: 32px; font-weight: 700; }
.size-stock { font-size: 10.5px; color: var(--gris-5); font-weight: 600; }
.size-cell.falta input { border-color: var(--rojo); background: var(--rojo-bg); }
.size-cell.falta .size-stock { color: var(--rojo); }
.totals-card .tot-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--gris-2); }
.totals-card .tot-row span { display: inline-flex; align-items: center; gap: 6px; }
.totals-card .tot-row.total { font-size: 20px; border-bottom: 0; padding-top: 14px; }
.totals-card .tot-row.total b { color: var(--naranja); }
input.sm { width: 150px; text-align: right; }
input.xs { width: 56px; text-align: center; padding: 6px; min-height: 30px; }

.dialog { border: 0; border-radius: 14px; padding: 22px; width: min(560px, 94vw); box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.dialog::backdrop { background: rgba(18, 18, 18, .55); }
.dialog h3 { margin-bottom: 14px; font-size: 18px; }

/* ---------- Vista de documento ---------- */
.doc-view { display: grid; grid-template-columns: 290px 1fr; gap: 20px; align-items: start; }
.doc-side { position: sticky; top: 82px; margin: 0; }
.doc-side-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.doc-side-total { font-size: 26px; font-weight: 800; margin: 12px 0 2px; }
.side-title { font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--gris-5); margin: 18px 0 8px; }
.danger-zone { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--gris-2); }
.doc-paper { overflow-x: auto; padding-bottom: 10px; }
.doc-paper .hoja { box-shadow: 0 2px 6px rgba(0, 0, 0, .06), 0 12px 40px rgba(0, 0, 0, .08); margin: 0 auto; }

/* =========================================================
   HOJA A4 (cotización · remisión · orden de compra)
   ========================================================= */
.hoja {
  width: 210mm; min-height: 295mm; padding: 13mm 13mm 10mm; background: #fff; color: #1b1b1d;
  font-family: var(--font); font-size: 9pt; line-height: 1.38; position: relative; display: flex; flex-direction: column;
}
.h-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; }
.h-brand { display: flex; gap: 12px; align-items: center; }
.h-logo { width: 23mm; height: 23mm; object-fit: contain; }
.h-empresa h2 { font-size: 15pt; font-weight: 800; letter-spacing: .02em; margin-bottom: 2px; }
.h-empresa p { margin: 0; font-size: 7.6pt; color: #5b5c61; }
.h-empresa .h-nit { color: #1b1b1d; font-weight: 700; font-size: 8.4pt; }
.h-title { text-align: right; min-width: 64mm; }
.h-tipo { display: inline-block; background: var(--negro); color: #fff; font-size: 13.5pt; font-weight: 800; letter-spacing: .12em; padding: 6px 14px 6px 12px; border-left: 5px solid var(--naranja); }
.h-num { font-size: 19pt; font-weight: 800; color: var(--naranja); margin: 4px 0 4px; letter-spacing: .02em; }
.h-meta { margin-left: auto; border-collapse: collapse; font-size: 8pt; }
.h-meta th { text-align: right; color: #7a7b80; font-weight: 600; padding: 1px 8px 1px 0; }
.h-meta td { text-align: right; font-weight: 700; padding: 1px 0; }
.h-band { height: 5px; margin: 10px 0 12px; background: var(--naranja); position: relative; overflow: hidden; }
.h-band span { position: absolute; right: 0; top: 0; bottom: 0; width: 34%; background: var(--negro); transform: skewX(-30deg); transform-origin: bottom; }
.h-parties { display: grid; grid-template-columns: 1.15fr 1fr; gap: 10px; margin-bottom: 10px; }
.h-parties.one { grid-template-columns: 1fr; }
.h-box { border: 1px solid #e3e4e8; border-top: 3px solid var(--naranja); border-radius: 0 0 4px 4px; padding: 7px 10px 8px; }
.h-box h4 { font-size: 7pt; text-transform: uppercase; letter-spacing: .12em; color: var(--naranja); margin-bottom: 4px; font-weight: 800; }
.h-box p { margin: 0 0 1px; font-size: 8.3pt; }
.h-box p span { color: #7a7b80; display: inline-block; min-width: 29mm; font-weight: 600; }
.h-box .h-razon { font-size: 9.6pt; font-weight: 800; margin-bottom: 3px; }
.h-intro { font-size: 8.6pt; margin: 2px 0 8px; }
.h-items { width: 100%; border-collapse: collapse; margin-bottom: 8px; }
.h-items thead th { background: var(--negro); color: #fff; font-size: 7pt; text-transform: uppercase; letter-spacing: .08em; padding: 6px 7px; text-align: left; font-weight: 700; }
.h-items thead th:first-child { border-left: 4px solid var(--naranja); }
.h-items td { padding: 7px 7px; border-bottom: 1px solid #e8e9ec; vertical-align: top; }
.h-items tbody tr:nth-child(even) td { background: #fafafb; }
.h-items .c-n { width: 7mm; text-align: center; color: #7a7b80; font-weight: 700; }
.h-items .c-img { width: 17mm; }
.h-items .c-img img { width: 16mm; height: 16mm; object-fit: cover; border-radius: 3px; }
.h-items .c-cant { width: 13mm; text-align: center; font-weight: 800; font-size: 9.5pt; }
.h-items .c-und { width: 11mm; text-align: center; color: #5b5c61; font-size: 7.6pt; }
.h-items .c-val { width: 25mm; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.h-items thead th.c-val { text-align: right; }
.h-items thead th.c-cant, .h-items thead th.c-und, .h-items thead th.c-n { text-align: center; color: #fff; font-size: 7pt; }
.h-prod b { font-size: 9pt; }
.h-tags { display: inline-flex; gap: 4px; margin-left: 4px; vertical-align: 1px; }
.h-tags span { background: var(--naranja-bg); color: #a94600; font-size: 6.8pt; font-weight: 700; padding: 1px 5px; border-radius: 3px; }
.h-detalle { font-size: 7.4pt; color: #5b5c61; margin-top: 2px; }
.h-curva { border-collapse: collapse; margin-top: 5px; font-size: 7.4pt; }
.h-curva th { background: #efeff2; color: #5b5c61; font-weight: 700; padding: 1px 5px; text-align: left; border: 1px solid #dedfe3; }
.h-curva td { border: 1px solid #dedfe3; padding: 1px 4px; min-width: 7mm; text-align: center; background: #fff !important; }
.h-curva tr:first-child td { font-weight: 700; color: #1b1b1d; background: #fff5ee !important; }
.h-unid { text-align: right; font-size: 8pt; color: #5b5c61; border-bottom: 0 !important; background: transparent !important; }
.h-bottom { display: grid; grid-template-columns: 1fr 66mm; gap: 14px; margin-top: 2px; }
.h-notes h4 { font-size: 7pt; text-transform: uppercase; letter-spacing: .12em; color: var(--naranja); margin: 8px 0 3px; font-weight: 800; }
.h-notes ul { margin: 0; padding-left: 13px; font-size: 7.8pt; color: #3d3e42; }
.h-notes li { margin-bottom: 1px; }
.h-notes p { font-size: 7.8pt; margin: 0; color: #3d3e42; }
.h-letras { background: #f5f5f7; border-left: 3px solid var(--naranja); padding: 6px 9px; font-size: 7.8pt; font-weight: 700; }
.h-letras span { color: #7a7b80; font-weight: 600; }
.h-totals > div { display: flex; justify-content: space-between; padding: 4px 9px; font-size: 8.8pt; border-bottom: 1px solid #ececef; }
.h-totals > div span { color: #5b5c61; }
.h-totals .h-grand { background: var(--negro); color: #fff; border: 0; padding: 8px 9px; margin-top: 4px; font-size: 11pt; border-left: 4px solid var(--naranja); }
.h-totals .h-grand span { color: #fff; font-weight: 800; letter-spacing: .08em; }
.h-totals .h-grand b { color: var(--naranja-2); font-size: 12.5pt; }
.h-firmas { display: flex; gap: 24mm; margin-top: auto; padding-top: 16mm; }
.h-firma { flex: 1; max-width: 75mm; font-size: 8pt; display: flex; flex-direction: column; }
.h-firma span { color: #6a6b70; font-size: 7.4pt; }
.h-cordial { margin: 0 0 14mm; font-size: 8.4pt; }
.h-linea { border-top: 1.4px solid #1b1b1d; margin: 14mm 0 4px; }
.h-cordial + .h-linea { margin-top: 0; }
.h-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; margin-top: 8mm; padding-top: 5px; border-top: 2px solid var(--naranja); font-size: 7pt; color: #7a7b80; }
.h-eslogan { font-weight: 800; color: #1b1b1d; text-transform: uppercase; letter-spacing: .1em; }
.h-res { flex-basis: 100%; text-align: center; font-size: 6.6pt; }
.h-anulada { position: absolute; top: 40%; left: 50%; transform: translate(-50%, -50%) rotate(-24deg); font-size: 70pt; font-weight: 900; color: rgba(200, 50, 43, .16); border: 8px solid rgba(200, 50, 43, .16); padding: 0 24px; letter-spacing: .1em; pointer-events: none; }
.h-abono { font-size: 7pt; color: #7a7b80; }
.h-estado td { font-size: 8.2pt; }

/* ---------- Ingreso ---------- */
.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 600px at 10% -10%, rgba(242, 107, 10, .28), transparent 60%), var(--negro); }
.auth-card { width: min(400px, 100%); background: #fff; border-radius: 16px; padding: 30px 28px; box-shadow: 0 30px 80px rgba(0, 0, 0, .35); }
.auth-card.wide { width: min(620px, 100%); }
.auth-card h1 { font-size: 22px; font-weight: 800; text-align: center; margin: 6px 0 4px; }
.auth-card > .muted { text-align: center; margin-bottom: 18px; }
.auth-logo { display: block; width: 92px; height: 92px; object-fit: contain; margin: 0 auto; }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .item-top { grid-template-columns: 26px 1fr 1fr 1fr; }
  .it-prod { grid-column: span 3; }
  .it-total { text-align: left; }
  .it-tools { grid-column: 4; }
}
@media (max-width: 1100px) {
  .doc-view { grid-template-columns: 1fr; }
  .doc-side { position: static; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .overlay { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 25; }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 12px 16px; flex-wrap: wrap; }
  .topbar h1 { font-size: 17px; }
  .topbar-actions .btn span { display: none; }
  .content { padding: 16px 16px 60px; }
  .grid-2 { grid-template-columns: 1fr; }
  .form-grid, .form-grid.cols-4 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .doc-paper .hoja { zoom: .5; }
  .item-top { grid-template-columns: 26px 1fr 1fr; }
  .it-prod { grid-column: span 2; }
  .it-desc, .it-tallas { margin-left: 0; }
  .dl { grid-template-columns: 100px 1fr; }
}
@media (max-width: 560px) {
  .kpis, .kpis-sm { grid-template-columns: 1fr; }
  .doc-paper .hoja { zoom: .42; }
  .hbar { grid-template-columns: 80px 1fr 40px; }
}
body.pdf-mode .doc-paper .hoja { zoom: 1; box-shadow: none; }

/* ---------- Impresión ---------- */
@page { size: A4; margin: 0; }
@media print {
  body { background: #fff; }
  .sidebar, .topbar, .doc-side, .overlay, .alert { display: none !important; }
  .app, .main, .content, .doc-view, .doc-paper { display: block; padding: 0 !important; margin: 0 !important; max-width: none; overflow: visible; }
  .doc-paper .hoja { box-shadow: none; zoom: 1; margin: 0; }
  .hoja { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .h-items tr { break-inside: avoid; }
  .h-bottom, .h-firmas { break-inside: avoid; }
}
