/* public/admin/app.css
   Estilo del panel: el mismo de la web de Gusma S.A. (ver estilo.md del
   proyecto). Fondo blanco siempre, rojo ladrillo como unico acento, titulos
   en Domine, texto en Barlow y cifras/etiquetas en Courier Prime. */
@import url('https://fonts.googleapis.com/css2?family=Domine:wght@400;500;600;700&family=Barlow:wght@400;500;600;700&family=Courier+Prime:wght@400;700&display=swap');

:root {
    color-scheme: light;
    --ground: #FFFFFF;
    --paper: #F5F1F1;
    --ink: #1E1B1B;
    --ink-soft: #6B6363;
    --brick: #BD343C;
    --brick-deep: #8E2229;
    --line: #E7E1E1;
    --white: #FFFFFF;
    --ok: #3D7A4F;
    --sidebar: 236px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--ground); color: var(--ink); font-family: 'Barlow', ui-sans-serif, system-ui, sans-serif; font-size: 15.5px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
::selection { background: var(--brick); color: var(--white); }
a { color: inherit; }
h1, h2, h3 { font-family: 'Domine', ui-serif, Georgia, serif; font-weight: 600; text-wrap: balance; }
.mono, .num { font-family: 'Courier Prime', ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.oculto { display: none !important; }

.eyebrow { font-family: 'Courier Prime', monospace; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--brick); font-weight: 700; }

/* ── Layout ───────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar); flex-shrink: 0; border-right: 1px solid var(--line); background: var(--ground); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.marca { display: flex; align-items: center; gap: 12px; padding: 22px 20px; border-bottom: 1px solid var(--line); text-decoration: none; }
.marca img { width: 38px; height: 38px; }
.marca-nombre { font-family: 'Domine'; font-size: 17px; line-height: 1.15; }
.marca-nombre small { display: block; font-family: 'Courier Prime'; font-size: 10px; color: var(--ink-soft); letter-spacing: 0.03em; margin-top: 3px; text-transform: uppercase; }
.nav { display: flex; flex-direction: column; padding: 14px 0; gap: 2px; flex: 1; overflow-y: auto; }
.nav-grupo { font-family: 'Courier Prime'; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); padding: 14px 20px 6px; }
.nav a { display: block; padding: 8px 20px 8px 17px; border-left: 3px solid transparent; text-decoration: none; color: var(--ink-soft); font-weight: 500; font-size: 15px; transition: color .15s, background .15s; }
.nav a:hover { color: var(--ink); background: var(--paper); }
.nav a.activo { color: var(--ink); border-left-color: var(--brick); font-weight: 600; }
.nav a.pronto { opacity: 0.45; pointer-events: none; }
.nav a.pronto::after { content: 'pronto'; font-family: 'Courier Prime'; font-size: 10px; margin-left: 8px; text-transform: uppercase; }
.usuario-box { border-top: 1px dashed var(--line); padding: 14px 20px; font-size: 13.5px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.usuario-box span { color: var(--ink-soft); }
.usuario-box a { color: var(--brick); text-decoration: none; font-weight: 600; }

.main { flex: 1; min-width: 0; }
.topbar { display: none; }
.contenido { max-width: 1120px; padding: 40px 40px 72px; }

.cabecera { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 28px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.cabecera .eyebrow { display: block; margin-bottom: 8px; }
.cabecera h1 { font-size: clamp(24px, 3vw, 32px); }
.cabecera p { color: var(--ink-soft); margin-top: 6px; max-width: 60ch; }
.acciones { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── Botones ─────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; font-family: 'Barlow'; font-size: 14.5px; font-weight: 600; background: var(--ground); color: var(--ink); border: 1.5px solid var(--ink); border-radius: 2px; cursor: pointer; text-decoration: none; transition: background .15s, color .15s, border-color .15s; white-space: nowrap; }
.btn:hover { background: var(--ink); color: var(--paper); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--brick); outline-offset: 2px; }
.btn-solid { background: var(--brick); color: var(--white); border-color: var(--brick); }
.btn-solid:hover { background: var(--brick-deep); border-color: var(--brick-deep); color: var(--white); }
.btn-chico { padding: 5px 11px; font-size: 13px; border-width: 1px; }
.btn-texto { background: none; border: none; color: var(--brick); font-weight: 600; cursor: pointer; font-family: inherit; font-size: 14px; padding: 0; }
.btn-texto:hover { color: var(--brick-deep); text-decoration: underline; }
.btn[disabled] { opacity: .5; cursor: default; }

/* ── Paneles, tarjetas y esquinas ────────────────────── */
.panel { border: 1px solid var(--line); border-radius: 2px; background: var(--ground); }
.panel-papel { background: var(--paper); }
.panel-cab { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.panel-cab h2 { font-size: 17px; }
.panel-cuerpo { padding: 20px; }
.corner { position: relative; }
.corner::before, .corner::after { content: ''; position: absolute; width: 14px; height: 14px; border-color: var(--brick); opacity: 0.55; pointer-events: none; }
.corner::before { top: -1px; left: -1px; border-top: 1.5px solid; border-left: 1.5px solid; }
.corner::after { bottom: -1px; right: -1px; border-bottom: 1.5px solid; border-right: 1.5px solid; }

.tarjetas { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 18px; margin-bottom: 28px; }
.tarjeta { background: var(--paper); border: 1px solid var(--line); border-radius: 2px; padding: 20px 22px; }
.tarjeta .eyebrow { display: block; margin-bottom: 10px; }
.tarjeta .valor { font-family: 'Courier Prime'; font-weight: 700; font-size: 34px; line-height: 1; color: var(--ink); }
.tarjeta .detalle { margin-top: 8px; font-size: 13.5px; color: var(--ink-soft); }

/* Lista tipo "legajo": etiqueta gris a la izquierda, valor ladrillo a la derecha. */
.legajo { list-style: none; display: flex; flex-direction: column; gap: 11px; }
.legajo li { display: flex; justify-content: space-between; gap: 16px; font-size: 14px; border-bottom: 1px dashed var(--line); padding-bottom: 10px; }
.legajo li:last-child { border-bottom: 0; padding-bottom: 0; }
.legajo li > span:first-child { color: var(--ink-soft); }
.legajo .v { font-family: 'Courier Prime'; font-weight: 700; color: var(--brick); text-align: right; }

.grilla-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }

/* ── Tablas ──────────────────────────────────────────── */
.tabla-scroll { overflow-x: auto; }
table.tabla { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.tabla th { text-align: left; font-family: 'Courier Prime'; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-soft); font-weight: 700; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--paper); white-space: nowrap; }
.tabla td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tabla tr:last-child td { border-bottom: 0; }
.tabla tbody tr.clic { cursor: pointer; }
.tabla tbody tr.clic:hover td { background: #FBF8F8; }
.tabla .num { text-align: right; white-space: nowrap; }
.tabla .tenue { color: var(--ink-soft); }
.tabla .acciones-fila { text-align: right; white-space: nowrap; }
.vacio { padding: 36px 20px; text-align: center; color: var(--ink-soft); }

.etiqueta { display: inline-block; font-family: 'Courier Prime'; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 2px 8px; border: 1px solid var(--line); border-radius: 2px; color: var(--ink-soft); white-space: nowrap; }
.etiqueta.blanco { color: var(--ink); border-color: var(--ink); }
.etiqueta.negro { color: var(--white); background: var(--ink); border-color: var(--ink); }
.etiqueta.activa { color: var(--brick); border-color: var(--brick); }
.etiqueta.urgente { color: var(--white); background: var(--brick); border-color: var(--brick); }
.etiqueta.baja, .etiqueta.terminada { color: var(--ink-soft); border-style: dashed; }

/* ── Filtros ─────────────────────────────────────────── */
.filtros { display: flex; gap: 0; margin-bottom: 18px; flex-wrap: wrap; }
.filtros button { font-family: 'Barlow'; font-size: 14px; font-weight: 600; padding: 7px 16px; border: 1px solid var(--line); background: var(--ground); color: var(--ink-soft); cursor: pointer; margin-right: -1px; }
.filtros button:first-child { border-radius: 2px 0 0 2px; }
.filtros button:last-child { border-radius: 0 2px 2px 0; }
.filtros button.activo { background: var(--ink); color: var(--white); border-color: var(--ink); position: relative; }
.buscador { flex: 1; min-width: 200px; max-width: 320px; margin-left: auto; }

/* ── Formularios ─────────────────────────────────────── */
.campo { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.campo label { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.campo .ayuda { font-size: 12.5px; color: var(--ink-soft); }
input, select, textarea { font-family: 'Barlow'; font-size: 15px; color: var(--ink); padding: 9px 11px; border: 1px solid #D5CDCD; border-radius: 2px; background: var(--white); width: 100%; }
input[type="number"], input[type="date"] { font-family: 'Courier Prime'; }
textarea { resize: vertical; min-height: 70px; }
.fila-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.opciones { display: flex; gap: 0; }
.opciones label { flex: 1; text-align: center; padding: 9px 10px; border: 1px solid #D5CDCD; cursor: pointer; font-weight: 600; font-size: 14px; color: var(--ink-soft); margin-right: -1px; }
.opciones input { position: absolute; opacity: 0; pointer-events: none; width: auto; }
.opciones label:has(input:checked) { background: var(--ink); color: var(--white); border-color: var(--ink); position: relative; }
.opciones label:has(input:focus-visible) { outline: 2px solid var(--brick); outline-offset: 2px; }

/* ── Dialogos ────────────────────────────────────────── */
dialog { border: 1px solid var(--line); border-radius: 2px; padding: 0; width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 32px); color: var(--ink); margin: auto; }
dialog::backdrop { background: rgba(30, 27, 27, 0.45); }
.dlg-cab { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.dlg-cab h2 { font-size: 19px; }
.dlg-cerrar { background: none; border: none; font-size: 24px; line-height: 1; cursor: pointer; color: var(--ink-soft); }
.dlg-cuerpo { padding: 20px 22px 6px; }
.dlg-pie { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 22px 20px; flex-wrap: wrap; }
.dlg-pie .derecha { display: flex; gap: 10px; margin-left: auto; }
.error-form { color: var(--brick); font-size: 14px; font-weight: 600; min-height: 1em; margin-bottom: 8px; }

.aviso { font-size: 14px; color: var(--ink); background: var(--paper); border-left: 3px solid var(--brick); padding: 12px 16px; margin-bottom: 22px; }
.aviso a { color: var(--brick); font-weight: 600; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--white); padding: 11px 20px; border-radius: 2px; font-size: 14.5px; opacity: 0; transition: opacity .2s, transform .2s; pointer-events: none; z-index: 100; }
.toast.visible { opacity: 1; transform: translateX(-50%); }

/* ── Login ───────────────────────────────────────────── */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--paper); }
.login-caja { width: min(400px, 100%); background: var(--ground); border: 1px solid var(--line); padding: 34px 30px 28px; }
.login-caja .marca { padding: 0 0 22px; margin-bottom: 22px; }
.login-caja h1 { font-size: 22px; margin-bottom: 4px; }
.login-caja p { color: var(--ink-soft); margin-bottom: 20px; font-size: 14.5px; }
.login-caja .btn { width: 100%; justify-content: center; padding: 12px; margin-top: 6px; }

/* ── Mobile ──────────────────────────────────────────── */
@media (max-width: 860px) {
    .layout { display: block; }
    .topbar { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--ground); z-index: 30; }
    .topbar .marca { padding: 0; border: 0; }
    .topbar .marca img { width: 32px; height: 32px; }
    .btn-menu { background: none; border: 1.5px solid var(--ink); border-radius: 2px; padding: 6px 12px; font-size: 14px; font-weight: 600; font-family: 'Barlow'; cursor: pointer; }
    .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 40; transform: translateX(-100%); transition: transform .2s; box-shadow: none; }
    body.menu-abierto .sidebar { transform: none; box-shadow: 0 0 0 100vw rgba(30, 27, 27, 0.45); }
    .contenido { padding: 24px 16px 56px; }
    .grilla-2, .fila-2 { grid-template-columns: 1fr; }
    .tabla .ocultar-mobile { display: none; }
    .buscador { max-width: none; margin-left: 0; margin-top: 10px; flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ── Partes diarios ──────────────────────────────────── */
.tenue { color: var(--ink-soft); }
.filtros-partes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 14px; max-width: 900px; }
.rapidos-fecha { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 22px; font-size: 13.5px; }
.rapidos-fecha #btnLimpiar { margin-left: 8px; }
@media (max-width: 760px) { .filtros-partes { grid-template-columns: 1fr 1fr; } }

/* ── Quincenas ───────────────────────────────────────── */
.bloque-q { margin-bottom: 24px; }
.tabla-q td { vertical-align: top; }
.chips-faltas { display: flex; flex-wrap: wrap; gap: 4px; max-width: 220px; }
.chip-falta { font-family: 'Courier Prime', monospace; font-size: 12px; padding: 2px 7px; border: 1px solid var(--brick); color: var(--brick); background: var(--ground); border-radius: 2px; cursor: pointer; }
.chip-falta:hover { background: var(--brick); color: var(--white); }
.chip-falta.cert { border-color: var(--ink-soft); color: var(--ink); background: var(--paper); }
.chip-falta.cert:hover { background: var(--ink); color: var(--white); }
.input-descuento { width: 110px; text-align: right; padding: 6px 8px; font-size: 14px; }
.falta { color: var(--brick); }

@media print {
    .sidebar, .topbar, .no-imprimir, .toast { display: none !important; }
    .layout, .main { display: block; }
    .contenido { padding: 0; max-width: none; }
    body { font-size: 12px; }
    .tarjeta { padding: 10px 14px; }
    .tarjeta .valor { font-size: 20px; }
    .bloque-q { break-inside: avoid; }
    .chip-falta { border: none; padding: 0 4px 0 0; cursor: default; }
    .input-descuento { border: none; padding: 0; width: auto; }
}

/* ── Proveedores ─────────────────────────────────────── */
/* Filas de pago: tinte ladrillo suave + filete a la izquierda, para que no se confundan con el fondo */
.tabla tr.fila-pago td { background: #FBEDEE; }
.tabla tr.fila-pago td:first-child { box-shadow: inset 3px 0 0 var(--brick); }
.tabla tr.fila-pago td:nth-child(5) { color: var(--brick-deep); font-weight: 600; }
.tabla tbody tr.fila-pago.clic:hover td { background: #F6DEE0; }
.tarjetas.cuatro .valor { font-size: 26px; white-space: nowrap; }
