/* Centro Jonas — tokens tomados del canvas "Centro Jonas — look" */
:root {
  --tinta: #15181B;
  --tinta-2: #353A3E;
  --fondo: #F3F4F2;
  --blanco: #FFFFFF;
  --acento: #0E5A63;
  --acento-osc: #093E45;
  --aviso: #8A3D06;
  --aviso-fondo: #FBEEE2;
  --aviso-texto: #6E3005;
  --gris: #5B6368;
  --gris-claro: #A9B0B3;
  --linea: #E1E4E1;
  --borde: #C9CECA;
  --titulos: 'Space Grotesk', system-ui, sans-serif;
  --texto: Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--fondo); color: var(--tinta); font-family: var(--texto); font-size: 15px; line-height: 1.45; }
a { color: var(--acento); }
a:hover { color: var(--acento-osc); }
h1, h2, h3, p { margin: 0; }
h1 { font-family: var(--titulos); font-weight: 700; font-size: 40px; letter-spacing: -0.02em; line-height: 1.1; }
h2 { font-family: var(--titulos); font-weight: 600; font-size: 20px; }
h3 { font-size: 15px; font-weight: 600; }
button, input, select, textarea { font: inherit; color: var(--tinta); }
:focus-visible { outline: 2px solid var(--acento); outline-offset: 2px; }
.nav :focus-visible { outline-color: var(--blanco); }

.sub { font-size: 13px; color: var(--gris); }
.fuerte { font-weight: 600; }
.medio { font-weight: 500; }
.num { font-variant-numeric: tabular-nums; }
.der { text-align: right; }
.flex1 { flex: 1 1 auto; }
.aviso-txt { color: var(--aviso); font-weight: 600; }
.acento-txt { color: var(--acento); }
.tachado { color: var(--gris); text-decoration: line-through; }
.etq { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gris-claro); }
.marca { font-family: var(--titulos); font-weight: 700; font-size: 22px; letter-spacing: -0.01em; }

.centro { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login { width: 100%; max-width: 400px; gap: 20px; }
.login .marca { font-size: 32px; }

/* Estructura */
.app { display: flex; flex-wrap: wrap; min-height: 100vh; }
.nav { flex: 1 1 220px; padding: 28px 20px; background: var(--tinta); color: var(--fondo); display: flex; flex-direction: column; gap: 28px; }
.nav-sub { font-size: 13px; color: var(--gris-claro); }
.nav-links { display: flex; flex-direction: column; gap: 4px; }
.nav-links a { display: flex; justify-content: space-between; align-items: center; min-height: 44px; padding: 0 12px; border-radius: 8px; color: var(--fondo); text-decoration: none; white-space: nowrap; gap: 10px; }
.nav-links a:hover { background: var(--tinta-2); color: var(--blanco); }
.nav-links a[aria-current="page"] { background: var(--acento); color: var(--blanco); font-weight: 600; }
.nav-links span { font-size: 12px; color: var(--gris-claro); }
.nav-links a[aria-current="page"] span { color: var(--blanco); }
.nav-pie { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.nav-caja { padding: 14px 12px; border: 1px solid var(--tinta-2); border-radius: 8px; display: flex; flex-direction: column; gap: 2px; }
.nav-salir { min-height: 44px; border: 0; background: transparent; color: var(--gris-claro); text-align: left; padding: 0 12px; cursor: pointer; border-radius: 8px; }
.nav-salir:hover { color: var(--blanco); background: var(--tinta-2); }
.main { flex: 999 1 560px; min-width: 0; padding: 36px 40px 48px; display: flex; flex-direction: column; gap: 24px; }

.cab { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; }
.cab > div:first-child { display: flex; flex-direction: column; gap: 4px; }
.cab-acc { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.cab-acc select { width: auto; }
.rejilla { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.rejilla > * { flex: 1 1 300px; min-width: 0; }
.columna { display: flex; flex-direction: column; gap: 20px; }

.tarjeta { background: var(--blanco); border: 1px solid var(--linea); border-radius: 12px; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.tarjeta-cab { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px; }
.pie { font-size: 13px; color: var(--gris); padding-top: 12px; border-top: 1px solid var(--linea); }
.vacio { font-size: 14px; color: var(--gris); padding: 12px 0; border-top: 1px solid var(--linea); }

/* Botones y campos */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px; border: 1px solid transparent; border-radius: 8px; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn.acento { background: var(--acento); color: var(--blanco); }
.btn.acento:hover { background: var(--acento-osc); color: var(--blanco); }
.btn.oscuro { background: var(--tinta); color: var(--blanco); }
.btn.oscuro:hover { background: var(--tinta-2); color: var(--blanco); }
.btn.linea { background: var(--blanco); border-color: var(--borde); color: var(--tinta); font-weight: 500; }
.btn.linea:hover { border-color: var(--gris); color: var(--tinta); }
.btn.punteado { background: var(--blanco); border: 1px dashed var(--gris-claro); color: var(--tinta); font-weight: 500; }
.btn.peligro { background: var(--blanco); border-color: var(--borde); color: var(--aviso); font-weight: 500; }
.btn:disabled { opacity: 0.55; cursor: default; }
.inicio { align-self: flex-start; }
.mini { min-height: 44px; padding: 0 10px; border: 0; background: transparent; color: var(--acento); font-size: 13px; font-weight: 600; cursor: pointer; border-radius: 8px; }
.mini:hover { color: var(--acento-osc); background: var(--fondo); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 44px; padding: 0 14px; border: 1px solid var(--linea); border-radius: 22px; background: var(--fondo); font-size: 14px; cursor: pointer; }
.chip:hover { border-color: var(--gris-claro); }

.fila { display: flex; flex-wrap: wrap; gap: 10px; }
.fila > input, .fila > select { flex: 1 1 200px; min-width: 0; }
input[type="text"], input[type="email"], input[type="tel"], input[type="date"], input[type="datetime-local"], input[type="number"], input[type="search"], select, textarea {
  min-height: 44px; padding: 0 12px; border: 1px solid var(--borde); border-radius: 8px; background: var(--blanco); width: 100%;
}
textarea { padding: 12px 14px; resize: vertical; min-height: 88px; }
.grande { min-height: 48px; }
.campos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.campo { display: flex; flex-direction: column; gap: 6px; }
.campo.todo { grid-column: 1 / -1; }
.campo label, .campo-etq { font-size: 13px; font-weight: 500; }
.tarjeta > label { font-weight: 600; }

.insignia { font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 4px; background: var(--fondo); color: var(--tinta); white-space: nowrap; }
.insignia.aviso-i { background: var(--aviso-fondo); color: var(--aviso); }
.insignia.oscura { background: var(--tinta-2); color: var(--fondo); }
.insignia.ok { background: #E3F0F1; color: var(--acento-osc); }
.alerta { padding: 12px 14px; border-radius: 8px; background: var(--aviso-fondo); color: var(--aviso-texto); display: flex; flex-direction: column; gap: 2px; }
.alerta div + div { font-size: 14px; }

/* Listas */
.lista { display: flex; flex-direction: column; }
.item { display: flex; gap: 16px; align-items: center; padding: 10px 0; border-top: 1px solid var(--linea); min-height: 44px; }
.item-txt { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; overflow-wrap: anywhere; }
.item-hora { flex: 0 0 76px; font-variant-numeric: tabular-nums; font-weight: 600; }
.item-acc { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.pen { display: flex; align-items: center; gap: 12px; min-height: 44px; border-top: 1px solid var(--linea); }
.pen input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--acento); flex: 0 0 auto; margin: 0; }
.pen label { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; padding: 10px 0; cursor: pointer; }
.idea { padding: 12px 14px; border-radius: 8px; background: var(--fondo); display: flex; flex-direction: column; gap: 4px; overflow-wrap: anywhere; }
.idea-pie { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; color: var(--gris); }
.ideas { display: flex; flex-direction: column; gap: 10px; }
.grupo-tit { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gris); font-weight: 600; padding-top: 6px; }
.cifra { font-family: var(--titulos); font-weight: 700; font-size: 32px; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.enlace-fuerte { font-weight: 600; }

/* Tablas */
.tabla-caja { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th { padding: 8px 0; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--gris); text-align: left; font-weight: 600; }
td { padding: 10px 0; border-top: 1px solid var(--linea); vertical-align: middle; }
th + th, td + td { padding-left: 10px; }
th.der, td.der { text-align: right; }
.t-conceptos { min-width: 520px; }
.t-conceptos input { text-align: inherit; }
.t-conceptos .c-cant { width: 84px; }
.t-conceptos .c-precio { width: 124px; }
.t-conceptos .c-imp { width: 116px; }
.t-conceptos .c-x { width: 44px; }
.t-facturas { min-width: 620px; }
.t-facturas select { min-height: 36px; width: auto; }

/* Editor de factura */
.editor { display: flex; flex-wrap: wrap; gap: 32px; align-items: flex-start; }
.editor > .columna { flex: 1 1 520px; min-width: 0; }
.editor > aside { flex: 1 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.previa { background: var(--blanco); border: 1px solid var(--linea); border-top: 6px solid var(--tinta); padding: 28px; display: flex; flex-direction: column; gap: 22px; box-shadow: 0 8px 24px rgba(21, 24, 27, 0.08); }
.previa-fila { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.previa-fila > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.previa-marca { font-family: var(--titulos); font-weight: 700; font-size: 24px; letter-spacing: -0.01em; }
.previa-tipo { font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 600; color: var(--acento); }
.previa-linea { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--linea); font-variant-numeric: tabular-nums; }
.previa-linea span:first-child { min-width: 0; overflow-wrap: anywhere; }
.previa-total { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding-top: 14px; border-top: 2px solid var(--tinta); }
.previa-total span:last-child { font-family: var(--titulos); font-weight: 700; font-size: 24px; font-variant-numeric: tabular-nums; }
.ficha { display: flex; flex-direction: column; gap: 2px; }

/* Documento carta */
.hoja-caja { overflow-x: auto; padding-bottom: 8px; }
.hoja { width: 816px; min-height: 1056px; background: var(--blanco); color: var(--tinta); font-size: 16px; line-height: 1.45; border-top: 10px solid var(--tinta); padding: 54px 64px 48px; display: flex; flex-direction: column; gap: 40px; box-shadow: 0 8px 24px rgba(21, 24, 27, 0.08); }
.hoja-cab { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; }
.hoja-cab > div { display: flex; flex-direction: column; gap: 6px; }
.hoja-marca { font-family: var(--titulos); font-weight: 700; font-size: 34px; letter-spacing: -0.02em; line-height: 1; }
.hoja-tipo { font-size: 14px; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 600; color: var(--acento); }
.hoja-num { font-family: var(--titulos); font-weight: 700; font-size: 26px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.hoja-datos { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 24px; padding: 20px 0; border-top: 1px solid var(--borde); border-bottom: 1px solid var(--borde); }
.hoja-datos > div, .hoja-pie > div { display: flex; flex-direction: column; gap: 4px; min-width: 0; overflow-wrap: anywhere; }
.hoja-etq { font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gris); font-weight: 600; }
.hoja-chico { font-size: 14px; color: var(--gris); }
.hoja th { font-size: 13px; letter-spacing: 0.08em; padding: 0 0 10px; }
.hoja td { padding: 16px 0; overflow-wrap: anywhere; }
.hoja th + th, .hoja td + td { padding-left: 12px; }
.hoja tbody tr:first-child td { border-top: 2px solid var(--tinta); }
.hoja tr { break-inside: avoid; }
.hoja .c-cant { width: 80px; }
.hoja .c-precio { width: 120px; }
.hoja .c-imp { width: 130px; font-weight: 600; }
.hoja-totales { align-self: flex-end; width: 330px; display: flex; flex-direction: column; font-variant-numeric: tabular-nums; break-inside: avoid; }
.hoja-totales > div { display: flex; justify-content: space-between; padding: 8px 0; }
.hoja-totales > div > span:first-child { color: var(--gris); }
.hoja-totales > .hoja-total { align-items: baseline; padding: 14px 0 0; margin-top: 6px; border-top: 2px solid var(--tinta); }
.hoja-totales > .hoja-total > span:first-child { color: var(--tinta); font-weight: 600; }
.hoja-total > span:last-child { font-family: var(--titulos); font-weight: 700; font-size: 30px; letter-spacing: -0.01em; }
.hoja-pie { margin-top: auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; break-inside: avoid; }
.hoja-pie p, .hoja-nota { white-space: pre-line; }
.hoja-firma { padding-top: 18px; border-top: 1px solid var(--borde); display: flex; justify-content: space-between; gap: 16px; font-size: 14px; color: var(--gris); break-inside: avoid; }

/* Diálogo y avisos */
.dlg { border: 1px solid var(--linea); border-radius: 12px; padding: 0; width: min(560px, calc(100vw - 32px)); color: var(--tinta); }
.dlg::backdrop { background: rgba(21, 24, 27, 0.5); }
.form { padding: 24px; display: flex; flex-direction: column; gap: 18px; }
.acciones { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.aviso { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: calc(100vw - 32px); background: var(--tinta); color: var(--blanco); padding: 12px 18px; border-radius: 8px; font-weight: 500; z-index: 10; box-shadow: 0 8px 24px rgba(21, 24, 27, 0.25); }
.aviso.mal { background: var(--aviso); }
.demo { background: var(--aviso-fondo); color: var(--aviso-texto); padding: 10px 14px; border-radius: 8px; font-size: 14px; font-weight: 500; }

@media (max-width: 760px) {
  .nav { flex: 1 1 100%; min-width: 0; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px 16px; }
  .nav-cab { display: flex; align-items: baseline; gap: 10px; }
  .nav-links { order: 3; flex: 1 1 100%; min-width: 0; flex-direction: row; overflow-x: auto; }
  .nav-pie { margin: 0 0 0 auto; }
  .nav-caja { display: none; }
  .main { padding: 24px 16px 40px; }
  h1 { font-size: 32px; }
  .campos { grid-template-columns: minmax(0, 1fr); }
}

@page { size: letter; margin: 0; }
@media print {
  body { background: var(--blanco); }
  .nav, .aviso, .dlg, .no-imprimir { display: none !important; }
  .app, .main { display: block; padding: 0; min-height: 0; }
  .hoja-caja { overflow: visible; padding: 0; }
  .hoja { width: 8.5in; min-height: 10.9in; box-shadow: none; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
}
