:root {
  --verde: #146b30; --verde2: #22a33a; --crema: #fbf6d5; --fondo: #f4f7f3; --texto: #1c2a20;
  --gris: #5f6b62; --borde: #d7e0d8; --rojo: #b3261e; --naranja: #8a4b00; --azul: #1d3f8f;
}
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--fondo); color: var(--texto); }
a { color: var(--verde); }

header.top { background: var(--verde); color: #fff; display: flex; align-items: center; gap: 10px; padding: 8px 16px; position: sticky; top: 0; z-index: 5; min-height: 52px; }
.marca { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-weight: 700; font-size: 18px; }
.marca img { width: 36px; height: 36px; border-radius: 50%; background: #fff; }
.tasa { margin-left: auto; font-size: 13px; color: #fff; text-decoration: none; background: rgba(255,255,255,.16); padding: 5px 10px; border-radius: 999px; white-space: nowrap; }
.tasa.alerta { background: #f6c343; color: #3b2a00; }

nav.menu { background: #fff; border-bottom: 1px solid var(--borde); display: flex; gap: 4px; overflow-x: auto; padding: 6px 12px; position: sticky; top: 52px; z-index: 4; scrollbar-width: none; }
nav.menu a, nav.menu .enlace { padding: 8px 12px; border-radius: 999px; color: var(--texto); text-decoration: none; white-space: nowrap; font-size: 15px; }
nav.menu a.on { background: var(--verde); color: #fff; }
nav.menu form { margin: 0; }
.enlace { background: none; border: 0; font: inherit; cursor: pointer; min-height: 0; }

main { max-width: 1000px; margin: 0 auto; padding: 16px; }
h1 { font-size: 22px; margin: 4px 0 14px; }
h2 { font-size: 18px; margin: 22px 0 10px; }
.card { background: #fff; border: 1px solid var(--borde); border-radius: 12px; padding: 14px; margin-bottom: 14px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); margin-bottom: 14px; }
.grid .card { margin: 0; }
.stat b { font-size: 24px; display: block; }
.fila { display: grid; gap: 0 12px; grid-template-columns: 1fr 1fr; }
@media (max-width: 560px) { .fila { grid-template-columns: 1fr; } }

label, .form div > label { display: block; font-weight: 600; margin: 12px 0 4px; font-size: 15px; }
input, select, textarea { width: 100%; font: inherit; font-size: 17px; padding: 10px 12px; border: 1px solid #aebcb1; border-radius: 10px; background: #fff; min-height: 48px; color: var(--texto); }
input[type=checkbox], input[type=radio] { width: 22px; height: 22px; min-height: 0; vertical-align: middle; margin: 0 6px 0 0; }
input:focus, select:focus { outline: 3px solid #9fd3a9; border-color: var(--verde); }
.opcion { display: flex; align-items: center; gap: 4px; padding: 10px 12px; border: 1px solid var(--borde); border-radius: 10px; margin: 6px 0; font-weight: 400; background: #fff; }
.errorlist { color: var(--rojo); list-style: none; padding: 0; margin: 4px 0; font-size: 14px; }
.helptext { color: var(--gris); font-size: 13px; display: block; margin-top: 4px; }

button, .btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 10px 18px; border-radius: 10px; border: 1px solid var(--verde); background: var(--verde); color: #fff; font: inherit; font-size: 17px; font-weight: 600; text-decoration: none; cursor: pointer; }
button[disabled] { opacity: .6; }
.btn.sec, button.sec { background: #fff; color: var(--verde); }
.btn.peligro, button.peligro { background: #fff; color: var(--rojo); border-color: var(--rojo); }
.btn.chico, button.chico { min-height: 36px; padding: 5px 12px; font-size: 14px; }
.acciones { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.acciones form { margin: 0; }
.acciones.grande .btn { flex: 1 1 140px; min-height: 56px; }
form.en-linea { display: inline; margin: 0; }
.enviar { margin-top: 16px; width: 100%; }
@media (min-width: 700px) { .enviar { width: auto; } }

.tabla { overflow-x: auto; border: 1px solid var(--borde); border-radius: 12px; background: #fff; margin-bottom: 14px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 9px 8px; border-bottom: 1px solid var(--borde); text-align: left; vertical-align: top; }
tr:last-child td { border-bottom: 0; }
th { font-size: 13px; color: var(--gris); font-weight: 600; white-space: nowrap; }
.n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
tfoot td { font-weight: 700; background: #f7faf7; }
.tabla input { min-height: 44px; font-size: 16px; }

.msg { padding: 12px 14px; border-radius: 10px; margin-bottom: 12px; }
.msg.success { background: #e3f4e6; border: 1px solid #9fd3a9; }
.msg.error { background: #fde8e6; border: 1px solid #f2b3ad; }
.msg.info, .msg.warning { background: #e8eef9; border: 1px solid #b6c6ec; }
.aviso { background: #fff4d6; border: 1px solid #f0cf73; padding: 10px 14px; border-radius: 10px; margin-bottom: 12px; }
.aviso.mal { background: #fde8e6; border-color: #f2b3ad; }
.chip { display: inline-block; padding: 2px 9px; border-radius: 999px; background: #eef3ef; font-size: 13px; margin: 2px 2px 2px 0; white-space: nowrap; }
.chip.alerta { background: #fff0c2; color: var(--naranja); }
.chip.mal { background: #fde2df; color: var(--rojo); }
.chip.ok { background: #e3f4e6; color: var(--verde); }
.muted { color: var(--gris); font-size: 14px; }
.debe { color: var(--rojo); font-weight: 600; }
.anulado td { opacity: .5; text-decoration: line-through; }
.centro { text-align: center; }

/* Documentos imprimibles */
.doc { background: #fff; border: 1px solid var(--borde); border-radius: 12px; padding: 20px; }
.doc-cab { display: flex; gap: 14px; align-items: center; border-bottom: 2px solid var(--verde); padding-bottom: 10px; margin-bottom: 12px; }
.doc-cab img { width: 72px; height: 72px; }
.guia { background: #eef8f1; border: 2px solid var(--azul); color: var(--azul); border-radius: 8px; padding: 12px; }
.guia table { background: #fff; }
.guia th, .guia td { border: 1px solid var(--azul); color: var(--azul); }
.guia .dato { color: #0d1b3d; font-weight: 700; font-family: "Segoe Print", "Comic Sans MS", cursive; }
.guia-titulo { background: var(--azul); color: #fff; padding: 6px 10px; border-radius: 6px; font-weight: 700; margin-bottom: 10px; }

@media print {
  header.top, nav.menu, .no-print, .acciones, .msg, .aviso { display: none !important; }
  body { background: #fff; font-size: 13px; }
  main { padding: 0; max-width: none; }
  .doc, .guia { border: 0; padding: 0; }
  .guia { border: 2px solid var(--azul); padding: 8px; }
}
