:root {
  color-scheme: light;
  --marca: #176044;
  --marca-hover: #104b34;
  --marca-suave: #e8f3ed;
  --azul-900: #163c2d;
  --azul-800: #ffffff;
  --azul-700: #eef4f0;
  /* Compatibilidad con las plantillas existentes: el acento es verde institucional. */
  --dorado: #176044;
  --dorado-suave: #236448;
  --tinta: #1b2f27;
  --gris-500: #53655c;
  --gris-400: #73867b;
  --gris-200: #d7e2da;
  --fondo: #f3f6f3;
  --papel: #ffffff;
  --papel-elevado: #f7faf8;
  --verde: #176044;
  --rojo: #b42332;
  --ambar: #875400;
  --azul: #205ea0;
  --violeta: #67459a;
  --teal: #205ea0;
  --error-fondo: #fff0f1;
  --aviso-fondo: #fff6df;
  --info-fondo: #eef5fc;
  --radius: 16px;
  --sombra: 0 4px 18px rgba(23, 60, 43, .045);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; font-size: 16px; line-height: 1.5; background: var(--fondo); color: var(--tinta); -webkit-font-smoothing: antialiased; min-height: 100vh; }
h1, h2, h3, h4, p { overflow-wrap: anywhere; }
h1, h2, h3, h4, .brand { font-family: inherit; }
.mono, .card-monto, .kpi .val, .lista-head .total b { font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, Consolas, monospace; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; touch-action: manipulation; }
button:disabled { cursor: wait; opacity: .6; }
button:focus-visible, a:focus-visible, .file-drop:focus-visible { outline: 3px solid var(--azul); outline-offset: 3px; }
header { background: #163c2d; color: #fff; padding: 24px 24px 28px; border-bottom: 4px solid #cfb550; }
.header-inner { max-width: 1200px; margin: 0 auto; }
.header-top-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.brand-row { display: flex; align-items: center; gap: 18px; min-width: 0; }
.escudo-img { width: 72px; height: 90px; object-fit: contain; padding: 7px; background: #fff; border-radius: 12px; flex-shrink: 0; }
.brand h1 { margin: 0 0 5px; font-size: clamp(20px, 2.2vw, 27px); line-height: 1.25; font-weight: 700; letter-spacing: -.025em; color: #fff; }
.subline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: #d4eadb; font-size: 14px; font-weight: 500; }
.subline .dot { width: 7px; height: 7px; border-radius: 50%; background: #dbc870; }
.tagline { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; margin: 16px 0 0; color: #d4eadb; font-size: 14px; }
.tagline span { color: inherit !important; }
.user-badge-area { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; max-width: 100%; font-size: 13px; padding: 12px 14px; background: #214b38; border: 1px solid #648673; border-radius: 12px; }
.user-badge-area .user-name { color: #fff; font-weight: 700; }
.btn-logout, .btn-account { min-height: 38px; padding: 7px 11px; border-radius: 7px; font-size: 13px; font-weight: 600; background: transparent; border: 1px solid #8dab99; color: #fff; }
.btn-logout:hover, .btn-account:hover { background: #355e49; }
#demo-header-badge { background: #fff2c2 !important; border: 1px solid #dbc870 !important; color: #5b4000 !important; font-size: 12px !important; font-weight: 700; }
main { max-width: 1248px; margin: 0 auto; padding: 0 24px 60px; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin: 24px 0; }
.kpi { min-width: 0; background: var(--papel); border: 1px solid var(--gris-200); border-radius: 12px; padding: 18px 20px; box-shadow: var(--sombra); }
.kpi .lbl { font-size: 13px; font-weight: 600; color: var(--gris-500); margin-bottom: 8px; }
.kpi .val { font-size: clamp(21px, 2vw, 27px); line-height: 1.25; font-weight: 700; color: var(--tinta); overflow-wrap: anywhere; letter-spacing: -.02em; }
.kpi .hint { font-size: 13px; color: var(--gris-500); margin-top: 7px; }
.tabs { display: flex; align-items: stretch; gap: 6px; background: #e5ede7; padding: 6px; margin-bottom: 24px; border: 1px solid var(--gris-200); border-radius: 12px; }
.tab-btn { flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: #435d4e; font-size: 14px; font-weight: 600; padding: 12px 14px; min-height: 48px; white-space: nowrap; }
.tab-btn:hover { background: #f1f6f2; color: var(--marca); }
.tab-btn.active { background: #fff; color: var(--marca); border-color: #b3c8ba; font-weight: 700; box-shadow: inset 0 -3px 0 var(--marca), 0 2px 4px rgba(20, 52, 36, .06); }
.panel { background: var(--papel); border: 1px solid var(--gris-200); border-radius: var(--radius); padding: 28px; box-shadow: var(--sombra); }
.section-title { display: flex; align-items: center; gap: 10px; font-size: 21px; line-height: 1.35; font-weight: 700; margin: 0 0 8px; color: var(--tinta); }
.section-title .plus { color: var(--marca); font-size: 21px; }
.section-description { font-size: 14px; color: var(--gris-500); margin: 0 0 24px; max-width: 80ch; }
form { display: flex; flex-direction: column; gap: 20px; }
.row2, .row3 { display: grid; gap: 20px; }
.row2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.row3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
form > div, .row2 > div, .row3 > div { min-width: 0; }
label { display: block; font-size: 14px; font-weight: 600; color: var(--tinta); margin-bottom: 7px; line-height: 1.5; }
label .req { color: var(--rojo); margin-left: 3px; }
label .opt { color: var(--gris-500); font-size: 13px; font-weight: 400; }
input, select, textarea { width: 100%; min-width: 0; min-height: 46px; background: #fff; border: 1px solid #71897a; border-radius: 8px; color: var(--tinta); font-size: 15px; padding: 11px 13px; transition: border-color .15s, box-shadow .15s; }
input::placeholder, textarea::placeholder { color: #61736a; opacity: 1; }
input:focus, select:focus, textarea:focus { border-color: var(--marca); outline: 2px solid var(--marca); outline-offset: 1px; box-shadow: 0 0 0 4px #e8f3ed; }
select option { background: #fff; color: var(--tinta); }
input[type=number], input[type=date], input[type=month] { font-variant-numeric: tabular-nums; }
.file-drop { border: 1.5px dashed #71897a; border-radius: 10px; padding: 22px 18px; background: var(--papel-elevado); text-align: center; cursor: pointer; font-size: 14px; }
.file-drop:hover, .file-drop.has-file { border-color: var(--marca); background: var(--marca-suave); }
.file-thumb { max-width: 100%; max-height: 100px; border-radius: 6px; margin-top: 10px; border: 1px solid var(--gris-200); }
.btn-primary, .btn-secondary { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; border-radius: 8px; padding: 11px 20px; font-size: 14px; font-weight: 600; line-height: 1.4; transition: background .15s, border-color .15s; }
.btn-primary { background: var(--marca); color: #fff; border: 1px solid var(--marca); }
.btn-primary:hover { background: var(--marca-hover); border-color: var(--marca-hover); }
.btn-primary.c-azul, .btn-primary.c-teal { background: var(--azul); border-color: var(--azul); color: #fff; }
.btn-primary.c-azul:hover, .btn-primary.c-teal:hover { background: #174a80; }
.btn-primary.c-rojo { background: var(--rojo); border-color: var(--rojo); color: #fff; }
.btn-primary.c-rojo:hover { background: #941b28; }
.btn-secondary { background: #fff; border: 1px solid #71897a; color: #344e40; }
.btn-secondary:hover { background: #eef4f0; border-color: var(--marca); }
.btn-secondary.c-export { color: var(--azul); border-color: #7799bd; }
.btn-secondary.c-export:hover { background: var(--info-fondo); }
.btn-secondary.c-import { color: var(--marca); border-color: #71897a; }
.btn-secondary.c-import:hover { background: var(--marca-suave); }
.form-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 6px; }
.filter-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; background: var(--papel-elevado); padding: 16px; border: 1px solid var(--gris-200); border-radius: 10px; margin: 28px 0 20px; }
.filter-bar > div { flex-wrap: wrap; }
.filter-bar label { font-size: 13px !important; }
.search-bar { flex: 1; min-width: min(240px, 100%); }
.lista-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin: 24px 0 16px; }
.lista-head h3 { margin: 0; font-size: 18px; color: var(--tinta); font-weight: 700; }
.lista-head .total { font-size: 14px; color: var(--gris-500); }
.lista-head .total b { color: var(--marca); font-size: 18px; margin-left: 4px; }
.ro-summary { display: flex; flex-wrap: wrap; gap: 12px 20px; font-size: 14px; }
.cards { display: flex; flex-direction: column; gap: 12px; }
.card-item { display: flex; justify-content: space-between; align-items: center; gap: 20px; background: #fff; border: 1px solid var(--gris-200); border-radius: 10px; padding: 18px 20px; }
.card-item:hover { border-color: #a7beb0; background: #fafcfb; }
.card-item.is-anulado { background: #fff7f7; border-color: #e7b5bb; }
.card-info { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.badge-folio { font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 700; color: var(--marca); background: var(--marca-suave); padding: 4px 8px; border-radius: 5px; overflow-wrap: anywhere; }
.badge-fecha { color: var(--gris-500); font-size: 13px; }
.badge-estado { font-size: 12px; font-weight: 700; padding: 4px 8px; border-radius: 5px; text-transform: uppercase; }
.badge-estado.registrado, .badge-estado.completada { color: var(--marca); background: var(--marca-suave); }
.badge-estado.pendiente { color: var(--ambar); background: var(--aviso-fondo); }
.badge-estado.en-progreso { color: var(--azul); background: var(--info-fondo); }
.badge-estado.anulado { color: var(--rojo); background: var(--error-fondo); }
.card-title { color: var(--tinta); font-size: 16px; font-weight: 500; margin-bottom: 5px; }
.card-title b { font-weight: 700; }
.card-concept { font-size: 14px; color: var(--gris-500); line-height: 1.6; }
.card-monto-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 14px; max-width: 50%; }
.card-monto { font-weight: 700; font-size: 19px; color: var(--tinta); white-space: nowrap; }
.card-item.is-anulado .card-monto { color: var(--rojo); text-decoration: line-through; }
.card-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.btn-icon { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 8px 10px; background: #fff; border: 1px solid #71897a; color: #344e40; border-radius: 7px; font-size: 13px; font-weight: 500; }
.btn-icon:hover { background: var(--marca-suave); border-color: var(--marca); }
.btn-icon.del { color: var(--rojo); border-color: #d9a2aa; }
.btn-icon.del:hover { background: var(--error-fondo); border-color: var(--rojo); }
.btn-icon.anular { color: var(--ambar); border-color: #c5ac72; }
.btn-icon.anular:hover { background: var(--aviso-fondo); border-color: var(--ambar); }
.io-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--gris-200); }
.io-msg { display: none; margin-top: 12px; font-size: 14px; padding: 12px 14px; border-radius: 8px; }
.io-msg.success { display: block; color: var(--marca); background: var(--marca-suave); border: 1px solid #b3cdbb; }
.io-msg.error { display: block; color: var(--rojo); background: var(--error-fondo); border: 1px solid #e3b5bc; }
.modal-overlay { position: fixed; inset: 0; background: rgba(13, 36, 24, .55); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px; backdrop-filter: blur(3px); }
.modal-content { background: #fff; border: 1px solid var(--gris-200); border-radius: 16px; width: 100%; max-width: 620px; max-height: calc(100dvh - 40px); overflow-y: auto; box-shadow: 0 24px 70px rgba(13, 36, 24, .24); padding: 26px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 20px; border-bottom: 1px solid var(--gris-200); padding-bottom: 16px; }
.modal-head h3 { margin: 0; font-size: 20px; color: var(--tinta); line-height: 1.35; }
.modal-close { background: #f2f6f3; border: 1px solid var(--gris-200); color: #425d4d; border-radius: 7px; font-size: 24px; min-width: 40px; min-height: 40px; padding: 0; flex-shrink: 0; }
.modal-close:hover { background: #e3ece6; }
#login-overlay { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; overflow-y: auto; padding: 28px 20px; background: radial-gradient(ellipse at top left, #d8e9dd, transparent 60%), #edf3ee; }
.login-card { width: 100%; max-width: 470px; background: #fff; border: 1px solid #c6d7cc; border-top: 5px solid var(--marca); border-radius: 18px; padding: 32px; box-shadow: 0 20px 70px rgba(23, 60, 43, .10); margin: auto; }
.login-brand { text-align: center; margin-bottom: 26px; }
.login-brand img { width: 82px; height: 106px; object-fit: contain; display: block; margin: 0 auto 18px; }
.login-brand h2 { color: var(--tinta); font-size: 23px; line-height: 1.3; margin: 0 0 8px; letter-spacing: -.02em; }
.login-brand p { font-size: 14px; margin: 0; color: var(--gris-500); }
.login-card .btn-primary { width: 100%; }
.auth-message, .demo-credentials-box { padding: 13px 14px; border-radius: 9px; border: 1px solid #b2c9df; background: var(--info-fondo); font-size: 13px; line-height: 1.6; margin-bottom: 20px; color: #1e5286; }
.auth-message.error { color: var(--rojo); background: var(--error-fondo); border-color: #e3b5bc; }
.auth-message.success { color: var(--marca); background: var(--marca-suave); border-color: #b3cdbb; }
#demo-login-callout { background: var(--info-fondo) !important; border-color: #b2c9df !important; color: #1e5286 !important; }
#demo-login-callout b, #demo-login-callout code { color: #1e5286 !important; }
.password-field { position: relative; display: flex; align-items: center; width: 100%; }
.password-field input { padding-right: 108px; }
.password-toggle { position: absolute; right: 5px; top: 5px; bottom: 5px; display: inline-flex; gap: 6px; align-items: center; justify-content: center; padding: 0 10px; border: 0; border-radius: 5px; font-size: 13px; font-weight: 600; background: #f0f5f1; color: var(--marca); min-width: 88px; }
.password-toggle:hover { background: #dfece3; }
.password-toggle svg { width: 17px; height: 17px; flex-shrink: 0; }
.security-note { background: var(--aviso-fondo); color: #785000; border: 1px solid #dec58c; padding: 14px; border-radius: 9px; font-size: 14px; }
.danger-zone { background: #fff7f7; border: 1px solid #e6b7be; border-radius: 10px; padding: 18px; margin-top: 12px; }
.import-errors { background: var(--error-fondo); color: var(--rojo); padding: 14px 22px; border-radius: 8px; font-size: 14px; max-height: 240px; overflow-y: auto; }
@media (max-width: 1050px) {
  .card-item { align-items: flex-start; }
  .card-monto-actions { flex-direction: column; align-items: flex-end; }
  .user-badge-area { gap: 8px; }
}
@media (max-width: 800px) {
  header { padding: 20px; }
  main { padding: 0 16px 40px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .row2, .row3 { grid-template-columns: 1fr; gap: 20px; }
  .tabs { flex-wrap: wrap; }
  .tab-btn { flex: 1 1 30%; white-space: normal; }
  .panel { padding: 22px; }
  .header-top-row { gap: 16px; }
  .user-badge-area { width: 100%; }
}
@media (max-width: 600px) {
  header { padding: 18px 14px; }
  main { padding: 0 12px 32px; }
  .brand-row { gap: 12px; }
  .escudo-img { width: 59px; height: 76px; }
  .brand h1 { font-size: 19px; }
  .subline, .tagline { font-size: 13px; }
  .kpis { margin: 16px 0; gap: 10px; }
  .kpi { padding: 14px; }
  .kpi .val { font-size: 21px; }
  .kpi .lbl, .kpi .hint { font-size: 12px; }
  .tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tab-btn { font-size: 13px; padding: 10px 8px; }
  .tab-btn:last-child { grid-column: 1 / -1; }
  .panel { padding: 18px; border-radius: 12px; }
  .section-title { font-size: 19px; }
  .card-item { flex-direction: column; gap: 16px; padding: 16px; }
  .card-monto-actions { max-width: 100%; width: 100%; flex-direction: row; justify-content: space-between; align-items: center; }
  .card-actions { width: 100%; justify-content: flex-start; }
  .card-actions .btn-icon { min-height: 44px; }
  .filter-bar { padding: 14px; }
  .filter-bar > div, .filter-bar > input, .filter-bar > select { width: 100% !important; }
  .filter-bar > div input { flex: 1; }
  .form-actions > button { width: 100%; }
  .io-bar > button { flex: 1; }
  .io-bar > span { width: 100%; }
  .login-card { padding: 24px; }
  .login-brand img { height: 92px; width: 72px; }
  .login-brand h2 { font-size: 21px; }
  .modal-overlay { padding: 12px; }
  .modal-content { padding: 20px; max-height: calc(100dvh - 24px); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; } }
@media print {
  body { background: #fff; color: #000; }
  .tabs, .user-badge-area, .io-bar, .filter-bar, .card-actions, form, #login-overlay, .modal-overlay { display: none !important; }
  header { background: #fff; color: #000; border-bottom: 1px solid #444; }
  .brand h1, .subline, .tagline { color: #000; }
  .kpi, .panel, .card-item { box-shadow: none; break-inside: avoid; }
}

/* Acceso visible a impresión sin tener que recorrer el formulario de registro. */
.receipt-print-toolbar { border: 1px solid var(--gris-200); background: var(--papel-elevado); border-radius: 10px; padding: 18px; margin: 0 0 26px; }
.receipt-print-toolbar h3 { margin: 0 0 6px; font-size: 17px; }
.receipt-print-toolbar p { margin: 0 0 16px; color: var(--gris-500); font-size: 14px; }
.receipt-print-options { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; }
.receipt-print-option { display: grid; gap: 8px; align-content: start; min-width: 0; }
.receipt-print-option label { margin: 0; }
.receipt-print-option input, .receipt-print-option select { width: 100%; min-width: 0; }
.receipt-print-option button { white-space: normal; }
@media (max-width: 650px) { .receipt-print-options { grid-template-columns: 1fr; } }
@media print { .receipt-print-toolbar { display: none; } }
