:root {
  --ink: #17302e;
  --muted: #6c7b78;
  --green: #173f3a;
  --green-2: #225b53;
  --gold: #c6a15b;
  --cream: #f6f2e9;
  --paper: #fffefb;
  --line: #dfe5e1;
  --danger: #a83a35;
  --shadow: 0 24px 80px rgba(24, 56, 51, .13);
  --radius: 22px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--paper); }
button, input, select { font: inherit; }
a { color: inherit; }
.hidden { display: none !important; }
.container { width: min(1180px, calc(100% - 40px)); margin-inline: auto; }
.public-page::before, .admin-page::before { content: ""; position: fixed; inset: 0; z-index: -2; background:
  linear-gradient(rgba(255,255,255,.92), rgba(255,255,255,.92)),
  repeating-linear-gradient(0deg, transparent 0 39px, rgba(23,63,58,.045) 40px),
  repeating-linear-gradient(90deg, transparent 0 79px, rgba(23,63,58,.035) 80px); }
.public-page::after { content: ""; position: absolute; inset: 90px 0 auto 52%; height: 620px; z-index: -1; opacity: .6; background: radial-gradient(circle at center, rgba(198,161,91,.2), transparent 66%); }
.site-header { min-height: 92px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: inline-flex; align-items: center; gap: 13px; text-decoration: none; }
.brand-mark { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 14px; background: var(--green); color: white; font-family: Georgia, serif; font-size: 20px; letter-spacing: 1px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.16); }
.brand strong, .brand small { display: block; }
.brand strong { font-family: Georgia, serif; font-size: 18px; }
.brand small { color: var(--muted); margin-top: 2px; }
.brand.light { color: white; }.brand.light small { color: rgba(255,255,255,.68); }.brand.light .brand-mark { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2); }
.text-link { font-weight: 700; color: var(--green); text-decoration: none; }
.text-link:hover { text-decoration: underline; }
.centered { text-align: center; display: block; }
.hero { min-height: 660px; display: grid; grid-template-columns: 1.05fr .95fr; gap: 70px; align-items: center; padding-block: 64px 90px; }
.eyebrow { display: inline-flex; align-items: center; gap: 10px; color: var(--gold); text-transform: uppercase; letter-spacing: .14em; font-weight: 800; font-size: 12px; }
.eyebrow::before { content: ""; width: 30px; height: 1px; background: currentColor; }
.hero h1, .login-brand h1 { font-family: Georgia, "Times New Roman", serif; font-weight: 500; font-size: clamp(42px, 5vw, 70px); line-height: 1.03; letter-spacing: -.035em; margin: 20px 0 24px; }
.hero-copy > p { font-size: 19px; line-height: 1.75; color: var(--muted); max-width: 660px; }
.credential-line { margin-top: 34px; display: flex; align-items: center; gap: 14px; }
.credential-line strong, .credential-line small { display: block; }.credential-line small { color: var(--muted); margin-top: 4px; }
.credential-seal { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid rgba(198,161,91,.5); border-radius: 50%; color: var(--gold); }
.search-card, .login-card, .panel { background: rgba(255,255,253,.96); border: 1px solid rgba(23,63,58,.1); border-radius: var(--radius); box-shadow: var(--shadow); }
.search-card { padding: 38px; position: relative; overflow: hidden; }
.search-card::after { content: "FACTURA"; position: absolute; right: -18px; top: 22px; font: 700 64px/1 Georgia, serif; color: rgba(23,63,58,.035); transform: rotate(90deg); pointer-events: none; }
.card-heading { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 28px; }
.card-heading h2, .panel h2 { margin: 0 0 6px; font-family: Georgia, serif; font-size: 25px; font-weight: 500; }
.card-heading p, .panel-heading p { margin: 0; color: var(--muted); line-height: 1.5; }
.icon-badge { width: 44px; height: 44px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 14px; background: var(--cream); color: var(--green); font-size: 20px; }
.form-grid, .login-card { display: grid; gap: 20px; }
label { display: grid; gap: 8px; font-weight: 700; font-size: 14px; }
input, select { width: 100%; border: 1px solid var(--line); background: white; border-radius: 12px; min-height: 48px; padding: 0 14px; color: var(--ink); outline: none; transition: border-color .2s, box-shadow .2s; }
input:focus, select:focus { border-color: var(--green-2); box-shadow: 0 0 0 4px rgba(34,91,83,.1); }
.button { border: 0; border-radius: 12px; min-height: 48px; padding: 0 20px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 800; cursor: pointer; text-decoration: none; transition: transform .2s, background .2s, opacity .2s; }
.button:hover { transform: translateY(-1px); }.button:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.button.primary { color: white; background: var(--green); box-shadow: 0 10px 24px rgba(23,63,58,.2); }.button.primary:hover { background: var(--green-2); }
.button.secondary { color: var(--green); background: var(--cream); border: 1px solid rgba(23,63,58,.12); }.button.small { min-height: 38px; padding-inline: 14px; font-size: 13px; }
.status-message { min-height: 24px; margin-top: 14px; font-size: 14px; line-height: 1.5; }.status-message.loading { color: var(--green-2); }.status-message.error { color: var(--danger); }.status-message.success { color: #247052; }.status-message.warning { color: #8d681f; }
.results-section { padding-block: 70px; }.section-title { margin-bottom: 28px; }.section-title h2 { font: 500 38px/1.1 Georgia, serif; margin: 12px 0 0; }
.invoice-result { background: white; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 24px; }
.invoice-result-head { padding: 28px 32px; display: flex; align-items: center; justify-content: space-between; background: linear-gradient(100deg, var(--green), var(--green-2)); color: white; }
.invoice-result-head h3 { margin: 7px 0 0; font: 500 28px/1 Georgia, serif; }.invoice-result-head > strong { font-size: 24px; }.document-tag { text-transform: uppercase; font-size: 11px; letter-spacing: .13em; color: rgba(255,255,255,.7); }
.detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); }.detail-grid > div { padding: 24px 28px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }.detail-grid > div:nth-child(3n) { border-right: 0; }
.detail-grid span, .detail-grid strong, .detail-grid small { display: block; }.detail-grid span { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }.detail-grid strong { margin: 8px 0 4px; }.detail-grid small { color: var(--muted); }
.cdc-line { padding: 20px 28px; background: var(--cream); display: grid; gap: 8px; }.cdc-line span { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; }.cdc-line code { overflow-wrap: anywhere; }
.result-foot { padding: 16px 28px; display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; }
.trust-strip { margin-top: 50px; background: var(--green); color: white; }.trust-grid { display: grid; grid-template-columns: repeat(3, 1fr); }.trust-grid article { display: flex; gap: 18px; padding: 46px 34px; border-right: 1px solid rgba(255,255,255,.12); }.trust-grid article:last-child { border: 0; }.trust-grid article > span { font: 500 28px Georgia, serif; color: var(--gold); }.trust-grid strong { display: block; }.trust-grid p { color: rgba(255,255,255,.65); margin: 7px 0 0; line-height: 1.5; }
.site-footer { background: #102e2a; color: white; padding: 28px 0; }.site-footer .container { display: flex; justify-content: space-between; align-items: center; }.site-footer strong,.site-footer span { display: block; }.site-footer span { color: rgba(255,255,255,.58); font-size: 13px; }
.login-layout { min-height: 100vh; display: grid; grid-template-columns: 1.1fr .9fr; }.login-brand { padding: 52px clamp(40px,7vw,110px); background: linear-gradient(145deg, rgba(13,48,43,.97), rgba(29,89,80,.95)), repeating-linear-gradient(0deg, transparent 0 39px, rgba(255,255,255,.04) 40px); color: white; display: flex; flex-direction: column; justify-content: space-between; }.login-brand h1 { font-size: clamp(42px, 5vw, 68px); }.login-brand p { font-size: 18px; line-height: 1.7; color: rgba(255,255,255,.7); max-width: 620px; }.light-text { color: #dfbd78; }
.login-panel { display: grid; place-items: center; padding: 40px; }.login-card { width: min(450px, 100%); padding: 40px; }.login-card .button { margin-top: 4px; }
.admin-shell { min-height: 100vh; display: grid; grid-template-columns: 272px 1fr; background: #f4f6f3; }.sidebar { position: sticky; top: 0; height: 100vh; padding: 28px 20px; background: var(--green); color: white; display: flex; flex-direction: column; }.brand.compact .brand-mark { width: 42px; height: 42px; }.brand.compact strong { font-size: 16px; }
.admin-nav { display: grid; gap: 8px; margin-top: 52px; }.nav-button { width: 100%; border: 0; background: transparent; color: rgba(255,255,255,.68); min-height: 46px; padding: 0 14px; border-radius: 12px; display: flex; align-items: center; gap: 12px; font-weight: 700; cursor: pointer; text-align: left; }.nav-button:hover, .nav-button.active { color: white; background: rgba(255,255,255,.1); }.nav-button span { width: 22px; text-align: center; }.sidebar-footer { margin-top: auto; border-top: 1px solid rgba(255,255,255,.12); padding-top: 18px; }.sidebar-footer > span { display: block; padding: 0 14px 10px; color: rgba(255,255,255,.55); font-size: 13px; }
.admin-main { min-width: 0; padding: 34px clamp(24px,4vw,58px) 70px; }.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 34px; }.admin-header h1 { margin: 8px 0 0; font: 500 38px Georgia, serif; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 22px; }.stat-card { padding: 25px; border-radius: 18px; background: white; border: 1px solid var(--line); box-shadow: 0 12px 40px rgba(23,63,58,.07); }.stat-card span,.stat-card strong,.stat-card small { display: block; }.stat-card span { color: var(--muted); font-size: 13px; }.stat-card strong { font: 500 34px Georgia, serif; margin: 12px 0 6px; }.stat-card small { color: var(--muted); }
.dashboard-grid, .import-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 22px; }.panel { padding: 26px; box-shadow: 0 12px 40px rgba(23,63,58,.06); }.panel-heading { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 22px; }.empty-state { color: var(--muted); padding: 26px; text-align: center; border: 1px dashed var(--line); border-radius: 14px; }
.batch-list { display: grid; gap: 10px; }.batch-list article, .period-list article { display: flex; justify-content: space-between; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }.batch-list article:last-child,.period-list article:last-child { border-bottom: 0; }.batch-list strong,.batch-list small,.period-list strong,.period-list small { display: block; }.batch-list small,.period-list small { margin-top: 4px; color: var(--muted); }.period-list article > span { font-weight: 800; }
.icon-button { width: 34px; height: 34px; border: 0; border-radius: 10px; background: #f7e9e7; color: var(--danger); font-size: 20px; cursor: pointer; }
.drop-zone { min-height: 260px; border: 1.5px dashed #b8c7c2; border-radius: 18px; display: grid; place-items: center; align-content: center; gap: 8px; text-align: center; padding: 28px; background: linear-gradient(rgba(246,242,233,.65), rgba(255,255,255,.8)); transition: border .2s, background .2s; }.drop-zone.dragging { border-color: var(--green); background: #edf5f1; }.drop-zone p { margin: 0 0 12px; color: var(--muted); }.upload-icon { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 50%; background: var(--green); color: white; font-size: 24px; margin-bottom: 6px; }
.file-summary { margin-top: 16px; padding: 14px 16px; border-radius: 12px; background: var(--cream); display: flex; justify-content: space-between; align-items: center; }.file-summary strong,.file-summary small { display: block; }.file-summary small { color: var(--muted); margin-top: 3px; }
.progress-wrap { margin: 16px 0; }.progress-bar { height: 9px; background: #e6eae7; border-radius: 10px; overflow: hidden; }.progress-bar span { display: block; height: 100%; width: 0; background: var(--green); transition: width .2s; }.progress-wrap small { display: block; margin-top: 8px; color: var(--muted); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }table { border-collapse: collapse; width: 100%; min-width: 700px; background: white; }th,td { padding: 13px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }th { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); background: #f8faf8; }td { font-size: 13px; }td strong,td small { display: block; }td small { color: var(--muted); margin-top: 3px; }.table-wrap tr:last-child td { border-bottom: 0; }
.manual-panel { margin-top: 22px; }.manual-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px 20px; }.span-2 { grid-column: 1 / -1; }.filters { display: grid; grid-template-columns: 1.5fr 1fr .8fr auto; gap: 12px; margin-bottom: 18px; }.pagination { margin-top: 18px; display: flex; justify-content: flex-end; align-items: center; gap: 14px; color: var(--muted); font-size: 13px; }.error-text { color: var(--danger); }
@media (max-width: 980px) { .hero { grid-template-columns: 1fr; gap: 36px; }.trust-grid,.stats-grid { grid-template-columns: 1fr; }.trust-grid article { border-right: 0; border-bottom: 1px solid rgba(255,255,255,.12); }.detail-grid { grid-template-columns: repeat(2, 1fr); }.detail-grid > div:nth-child(3n) { border-right: 1px solid var(--line); }.detail-grid > div:nth-child(2n) { border-right: 0; }.login-layout { grid-template-columns: 1fr; }.login-brand { min-height: 430px; }.admin-shell { grid-template-columns: 86px 1fr; }.sidebar .brand span:last-child,.sidebar .nav-button:not(#logout-button) { font-size: 0; }.sidebar .nav-button span { font-size: 18px; }.sidebar-footer > span { display:none; }.dashboard-grid,.import-grid { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .container { width: min(100% - 28px, 1180px); }.site-header { min-height: 76px; }.brand strong { font-size: 15px; }.brand small { font-size: 11px; }.brand-mark { width: 42px; height: 42px; }.hero { padding-block: 40px 70px; }.hero h1 { font-size: 42px; }.search-card { padding: 25px; }.detail-grid { grid-template-columns: 1fr; }.detail-grid > div { border-right: 0 !important; }.invoice-result-head { align-items: flex-start; gap: 20px; }.invoice-result-head > strong { font-size: 18px; }.result-foot,.site-footer .container { flex-direction: column; gap: 8px; align-items: flex-start; }.admin-shell { display: block; }.sidebar { position: sticky; z-index: 10; height: auto; flex-direction: row; align-items: center; padding: 10px 14px; }.sidebar .brand { display:none; }.admin-nav { display: flex; margin: 0; flex: 1; }.nav-button { justify-content: center; padding: 0; }.sidebar-footer { margin: 0; border: 0; padding: 0; }.sidebar-footer #logout-button { width: 44px; }.admin-main { padding: 25px 14px 60px; }.admin-header { align-items: flex-start; }.admin-header h1 { font-size: 29px; }.admin-header .button { display:none; }.stats-grid { gap: 12px; }.manual-grid,.filters { grid-template-columns: 1fr; }.span-2 { grid-column: auto; }.login-brand { padding: 34px 25px; }.login-panel { padding: 20px 14px; }.login-card { padding: 28px 22px; } }

/* Búsqueda administrativa en los 28 campos */
.filters-search-all { grid-template-columns: minmax(230px, .9fr) minmax(300px, 1.6fr) auto auto; }
.search-help { margin: -6px 0 18px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.invoice-admin-list { display: grid; gap: 16px; }
.invoice-admin-card { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: white; box-shadow: 0 8px 28px rgba(23,63,58,.055); }
.invoice-admin-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; padding: 22px 24px; }
.invoice-admin-head h3 { margin: 7px 0 5px; font: 500 22px/1.1 Georgia, serif; }
.invoice-admin-head p { margin: 0; color: var(--muted); font-size: 13px; }
.document-tag.dark { color: var(--green-2); }
.invoice-admin-total { flex: 0 0 auto; text-align: right; }
.invoice-admin-total strong, .invoice-admin-total small { display: block; }
.invoice-admin-total strong { font-size: 19px; }
.invoice-admin-total small { margin-top: 6px; color: var(--muted); }
.invoice-details { border-top: 1px solid var(--line); }
.invoice-details summary { padding: 15px 24px; cursor: pointer; color: var(--green); font-weight: 800; background: #f8faf8; list-style-position: inside; }
.invoice-details[open] summary { border-bottom: 1px solid var(--line); }
.invoice-data-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.invoice-data-item { min-width: 0; padding: 17px 19px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.invoice-data-item:nth-child(3n) { border-right: 0; }
.invoice-data-item span, .invoice-data-item strong { display: block; }
.invoice-data-item span { margin-bottom: 7px; color: var(--muted); font-size: 10px; line-height: 1.4; text-transform: uppercase; letter-spacing: .07em; }
.invoice-data-item strong { overflow-wrap: anywhere; font-size: 13px; line-height: 1.5; }
.invoice-data-item.wide { grid-column: 1 / -1; border-right: 0; }
.invoice-admin-foot { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 14px 18px; color: var(--muted); font-size: 12px; background: var(--cream); }

@media (max-width: 980px) {
  .filters-search-all { grid-template-columns: 1fr 1.5fr auto auto; }
  .invoice-data-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .invoice-data-item:nth-child(3n) { border-right: 1px solid var(--line); }
  .invoice-data-item:nth-child(2n) { border-right: 0; }
}

@media (max-width: 700px) {
  .filters-search-all { grid-template-columns: 1fr; }
  .invoice-admin-head { flex-direction: column; }
  .invoice-admin-total { text-align: left; }
  .invoice-data-grid { grid-template-columns: 1fr; }
  .invoice-data-item { border-right: 0 !important; }
  .invoice-data-item.wide { grid-column: auto; }
}
