:root {
  --primary: #000;
  --secondary: #0051d5;
  --background: #cfd4da;
  --surface: #fff;
  --surface-low: #f2f4f6;
  --surface-high: #e6e8ea;
  --table-row: #ffffff;
  --table-row-alt: #edf3fa;
  --table-row-hover: #dfeaff;
  --text: #191c1e;
  --muted: #62686e;
  --outline: #d5d8dc;
  --error: #ba1a1a;
  --sidebar-width: 256px;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: var(--text);
  background: var(--background);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--background); }
button, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

.app-loading { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 16px; background: var(--background); }
.app-loading img { width: 160px; }
.app-loading span { width: 32px; height: 32px; border: 3px solid #dbe1ff; border-top-color: var(--secondary); border-radius: 50%; animation: spin .8s linear infinite; }
.app-loading p { margin: 0; color: var(--muted); font-size: 13px; }
@keyframes spin { to { transform: rotate(360deg); } }

.app-shell { min-height: 100vh; display: flex; }
.sidebar { position: fixed; z-index: 30; inset: 0 auto 0 0; width: var(--sidebar-width); display: flex; flex-direction: column; color: #45464d; background: var(--surface-low); border-right: 1px solid var(--outline); transition: width .2s, transform .2s; }
.sidebar-brand { height: 88px; display: flex; align-items: center; gap: 12px; padding: 18px 20px; overflow: hidden; }
.logo-full { flex: 0 0 auto; width: 74px; }
.product-title { min-width: 112px; padding-left: 12px; border-left: 1px solid var(--outline); }
.product-title strong { display: block; color: #101316; font-size: 14px; white-space: nowrap; }
.product-title small { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.nav-caption { padding: 12px 18px 7px; color: #85898e; font-size: 9px; font-weight: 800; letter-spacing: .1em; white-space: nowrap; }
.admin-caption { margin-top: 18px; }
.main-navigation { flex: 1; padding: 0 8px; overflow-y: auto; }
.nav-item { position: relative; width: 100%; min-height: 42px; display: flex; align-items: center; gap: 12px; margin: 2px 0; padding: 8px 11px; color: #50565c; background: transparent; border: 0; border-radius: 6px; cursor: pointer; text-align: left; transition: color .15s, background .15s; }
.nav-item:hover { color: #15191c; background: var(--surface-high); }
.nav-item.active { color: var(--secondary); background: rgba(0,81,213,.09); font-weight: 700; }
.nav-item.active::after { content: ""; position: absolute; right: -8px; width: 3px; height: 26px; background: var(--secondary); border-radius: 3px 0 0 3px; }
.nav-subitem { min-height: 36px; padding-left: 49px; }
.nav-subitem .nav-icon { width: 20px; height: 20px; flex-basis: 20px; border-style: dashed; }
.nav-subsubitem { min-height: 32px; padding-left: 69px; }
.nav-subsubitem .nav-icon { width: 17px; height: 17px; flex-basis: 17px; font-size: 8px; }
.nav-chevron { margin-left: auto; transition: transform .18s; }
#settings-menu-toggle[aria-expanded="false"] .nav-chevron,
#users-menu-toggle[aria-expanded="false"] .nav-chevron,
#reports-menu-toggle[aria-expanded="false"] .nav-chevron,
#tools-menu-toggle[aria-expanded="false"] .nav-chevron,
#catalogs-menu-toggle[aria-expanded="false"] .nav-chevron,
#diot-menu-toggle[aria-expanded="false"] .nav-chevron { transform: rotate(-90deg); }
.nav-submenu[hidden] { display: none; }
.nav-icon { flex: 0 0 26px; width: 26px; height: 26px; display: grid; place-items: center; color: currentColor; border: 1px solid currentColor; border-radius: 5px; font-size: 9px; font-weight: 800; }
.nav-label { overflow: hidden; white-space: nowrap; font-size: 12px; font-weight: 700; letter-spacing: .025em; }
.sidebar-footer { padding: 8px; border-top: 1px solid var(--outline); }
.logout-item { color: var(--error); }
.collapse-button { width: 100%; display: flex; align-items: center; gap: 14px; padding: 8px 13px; color: #76777d; background: transparent; border: 0; cursor: pointer; }
.collapse-button > span:first-child { width: 22px; font-size: 24px; }
.close-navigation { display: none; margin-left: auto; }

.app-shell.sidebar-collapsed .sidebar { width: 72px; }
.app-shell.sidebar-collapsed .product-title, .app-shell.sidebar-collapsed .nav-label, .app-shell.sidebar-collapsed .nav-caption { display: none; }
.app-shell.sidebar-collapsed .sidebar-brand { padding-inline: 12px; }
.app-shell.sidebar-collapsed .logo-full { width: 48px; }
.app-shell.sidebar-collapsed .nav-item { justify-content: center; padding-inline: 8px; }
.app-shell.sidebar-collapsed .nav-item.active::after { right: -8px; }
.app-shell.sidebar-collapsed .collapse-button > span:first-child { transform: rotate(180deg); }
.app-shell.sidebar-collapsed .main-area { margin-left: 72px; }

.main-area { min-width: 0; flex: 1; margin-left: var(--sidebar-width); transition: margin-left .2s; }
.topbar { position: sticky; z-index: 20; top: 0; height: 68px; display: flex; align-items: center; justify-content: space-between; padding: 0 28px; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--outline); box-shadow: 0 2px 8px rgba(0,0,0,.035); backdrop-filter: blur(8px); }
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-left small { display: block; margin-bottom: 1px; color: #85898e; font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.topbar-left select { min-width: 220px; padding: 3px 28px 3px 0; color: var(--text); background: transparent; border: 0; outline: 0; font-size: 13px; font-weight: 700; }
.icon-button { width: 36px; height: 36px; display: grid; place-items: center; color: #596067; background: transparent; border: 0; border-radius: 50%; cursor: pointer; }
.icon-button:hover { background: var(--surface-high); }
.open-navigation { display: none; font-size: 20px; }
.user-divider { width: 1px; height: 30px; background: var(--outline); }
.user-summary { display: flex; align-items: center; gap: 10px; padding: 4px; background: transparent; border: 0; border-radius: 8px; cursor: pointer; }
.user-summary:hover { background: var(--surface-low); }
.user-text { text-align: right; }
.user-text strong, .user-text small { display: block; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-text strong { font-size: 12px; }
.user-text small { margin-top: 2px; color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.user-avatar { width: 38px; height: 38px; display: grid; place-items: center; color: #fff; background: #131b2e; border-radius: 50%; font-size: 12px; font-weight: 800; }
.user-menu { position: absolute; top: 59px; right: 24px; width: 245px; padding: 14px; background: #fff; border: 1px solid var(--outline); border-radius: 8px; box-shadow: 0 14px 32px rgba(19,27,46,.15); }
.user-menu strong, .user-menu small { display: block; overflow: hidden; text-overflow: ellipsis; }
.user-menu strong { font-size: 13px; }
.user-menu small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.user-menu button { width: 100%; margin-top: 13px; padding: 9px; color: var(--error); background: var(--surface-low); border: 0; border-radius: 5px; cursor: pointer; font-weight: 700; }

.content { max-width: 1440px; margin: 0 auto; padding: 32px; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 26px; }
.eyebrow { margin: 0 0 5px; color: var(--secondary); font-size: 9px; font-weight: 800; letter-spacing: .12em; }
.page-heading h1 { margin: 0 0 5px; font-size: 30px; line-height: 1.2; letter-spacing: -.025em; }
.page-heading p:last-child { margin: 0; color: var(--muted); font-size: 13px; }
.heading-actions { display: flex; align-items: center; gap: 8px; }
.secondary-button { padding: 9px 15px; color: var(--secondary); background: #fff; border: 1px solid var(--outline); border-radius: 6px; cursor: pointer; font-size: 12px; font-weight: 700; }
.secondary-button:hover { background: var(--surface-low); border-color: #aeb4ba; }
.history-clear-button { color: #991b1b; white-space: nowrap; }
.history-clear-button:hover { color: #7f1d1d; background: #fff5f5; border-color: #e7b8b8; }
.page-alert { margin-bottom: 20px; padding: 12px 14px; color: #7d1010; background: #ffdad6; border-left: 3px solid var(--error); border-radius: 4px; font-size: 12px; }
.page-alert.success { color: #065f46; background: #d1fae5; border-left-color: #10b981; }

.cfdi-period-summary { margin-bottom: 12px; padding: 12px; background: #fff; border: 1px solid var(--outline); border-radius: 8px; box-shadow: 0 3px 8px rgba(0,0,0,.035); }
.currency-summary-main { margin-bottom: 20px; }
.currency-summary-main-header { margin-bottom: 14px; }
.currency-summary-main-header h2 { margin: 2px 0 0; font-size: 18px; }
.currency-summary-section { padding: 12px; background: #f4f6f9; border: 1px solid #dce1e8; border-radius: 9px; box-shadow: 0 3px 8px rgba(0,0,0,.035); }
.currency-summary-section + .currency-summary-section { margin-top: 16px; }
.currency-summary-section-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
.currency-summary-section-header h3 { margin: 0; font-size: 16px; }
.currency-summary-section-header p { margin: 3px 0 0; color: var(--muted); font-size: 10px; }
.currency-summary-section-header > span { padding: 4px 8px; color: #3158ce; background: #e5edff; border-radius: 4px; font-size: 10px; font-weight: 800; }
.currency-summary-toggle { align-self: center; padding: 5px 10px; color: var(--secondary); background: #fff; border: 1px solid #bcc8d8; border-radius: 5px; cursor: pointer; font-size: 10px; font-weight: 800; }
.currency-summary-toggle:hover { background: #eef3ff; border-color: var(--secondary); }
.currency-summary-content > .cfdi-period-summary:last-child { margin-bottom: 0; }
.currency-summary-section > .cfdi-period-summary:last-child { margin-bottom: 0; }
.cfdi-period-summary > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.cfdi-period-summary h2 { margin: 0; font-size: 16px; }
.cfdi-period-summary header p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.cfdi-period-summary > header > span { padding: 4px 7px; color: #3158ce; background: #eef3ff; border-radius: 4px; font-size: 9px; font-weight: 800; white-space: nowrap; }
.cfdi-summary-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; }
.expense-period-summary { margin-top: -8px; }
.expense-summary-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.expense-summary-card { border-left: 3px solid #B33A3A; }
.expense-summary-card > strong { color: #B33A3A; }
.cfdi-summary-card { min-width: 0; padding: 10px; background: #f8f9fb; border: 1px solid #e1e4e8; border-radius: 7px; }
.cfdi-summary-card small { display: block; color: #62686e; font-size: 9px; font-weight: 800; letter-spacing: .055em; text-transform: uppercase; }
.cfdi-summary-card > strong { display: block; margin-top: 4px; color: #172033; font-size: 18px; font-variant-numeric: tabular-nums; }
.cfdi-summary-card > p { margin: 4px 0 0; color: var(--muted); font-size: 9px; line-height: 1.45; }
.cfdi-summary-card.credit-note > strong { color: #a63c32; }
.cfdi-summary-card.net-income { background: #eef4ff; border-color: #cbd9ff; }
.cfdi-summary-card.net-income > strong { color: var(--secondary); }
.tax-breakdown { display: grid; gap: 4px; margin-top: 6px; padding-top: 6px; border-top: 1px solid #dfe3e8; }
.tax-breakdown:empty::after { content: "Sin impuestos en el periodo"; color: var(--muted); font-size: 9px; }
.tax-breakdown-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: #59616b; font-size: 10px; }
.tax-breakdown-row strong { color: #303740; font-size: 10px; font-variant-numeric: tabular-nums; }
.income-breakdown { display: grid; gap: 4px; margin-top: 6px; padding-top: 6px; border-top: 1px solid #dfe3e8; }
.income-breakdown > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: #59616b; font-size: 10px; }
.income-breakdown strong { color: #303740; font-size: 10px; font-variant-numeric: tabular-nums; }
.income-breakdown .addition strong { color: #087f5b; }
.income-breakdown .income-result { margin-top: 2px; padding-top: 6px; border-top: 1px dashed #cfd4da; font-weight: 800; }
.income-breakdown .income-result strong { color: var(--secondary); }
.payment-summary-card { grid-column: 1 / -1; }
.payment-breakdown { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 6px; margin-top: 7px; padding-top: 6px; border-top: 1px solid #dfe3e8; }
.payment-breakdown > div:not(.payment-rate-list), .payment-rate-list > div { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 8px; background: #fff; border: 1px solid #e1e4e8; border-radius: 5px; color: #59616b; font-size: 10px; }
.payment-breakdown strong { color: #303740; font-size: 11px; font-variant-numeric: tabular-nums; }
.payment-rate-list { display: grid; gap: 6px; }
.payment-rate-list:empty::after { content: "Sin IVA trasladado"; display: block; padding: 9px 10px; color: var(--muted); background: #fff; border: 1px solid #e1e4e8; border-radius: 5px; font-size: 10px; }
.payment-breakdown .payment-total-row { background: #eef4ff !important; border-color: #cbd9ff !important; font-weight: 800; }
.payment-breakdown .payment-total-row strong { color: var(--secondary); }
.isr-comparison { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px; margin-top: 6px; }
.isr-comparison > section { padding: 6px 8px; background: #fff; border: 1px solid #e1e4e8; border-radius: 5px; }
.isr-comparison > section > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: #59616b; font-size: 9px; font-weight: 800; }
.isr-comparison > section > div:first-child strong { color: #303740; font-size: 11px; font-variant-numeric: tabular-nums; }
.isr-comparison .tax-breakdown { margin-top: 5px; padding-top: 5px; }

.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; margin-bottom: 24px; }
.metric-card { position: relative; min-width: 0; display: flex; align-items: flex-start; gap: 14px; padding: 20px 20px 37px; color: inherit; background: #fff; border: 1px solid var(--outline); border-radius: 8px; box-shadow: 0 3px 8px rgba(0,0,0,.035); text-align: left; cursor: pointer; transition: transform .15s, border-color .15s, box-shadow .15s; }
.metric-card:hover { transform: translateY(-2px); border-color: #aeb4ba; box-shadow: 0 7px 16px rgba(19,27,46,.08); }
.metric-card:focus-visible { outline: 3px solid rgba(0,81,213,.2); outline-offset: 2px; }
.metric-link { position: absolute; left: 72px; bottom: 15px; color: var(--secondary); font-size: 10px; font-weight: 800; }
.metric-icon { flex: 0 0 38px; height: 38px; display: grid; place-items: center; border-radius: 7px; font-size: 10px; font-weight: 800; }
.metric-icon.blue { color: #0051d5; background: #e6edff; }
.metric-icon.green { color: #087f5b; background: #dff7ed; }
.metric-icon.amber { color: #a15d00; background: #fff1d5; }
.metric-icon.neutral { color: #45464d; background: #eceef0; }
.metric-card small { display: block; color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.metric-card strong { display: block; margin-top: 5px; color: #0f1214; font-size: 25px; line-height: 1.1; }
.metric-card p { margin: 5px 0 0; color: #85898e; font-size: 10px; }

.data-card { overflow: hidden; background: #fff; border: 1px solid var(--outline); border-radius: 8px; box-shadow: 0 3px 8px rgba(0,0,0,.035); }
.data-card.cfdi-results-card { overflow: visible; }
.users-company-access-card { margin-top: 20px; }
.access-scope-note { padding: 4px 8px; color: #32688C; background: #E8F1F8; border-radius: 4px; font-size: 9px; font-weight: 800; white-space: nowrap; }
.data-card > header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 19px 20px; border-bottom: 1px solid var(--outline); }
.data-card h2 { margin: 0; font-size: 16px; }
.data-card header p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.provider-types-card code { color: #143b67; font-family: Consolas, monospace; font-weight: 700; }
.operation-types-card { margin-bottom: 16px; }
.operation-types-card code { color: #143b67; font-family: Consolas, monospace; font-weight: 700; }
.catalog-rule-block { padding: 16px 20px; border-top: 1px solid var(--outline); }
.catalog-rule-block h3 { margin: 0 0 8px; font-size: 14px; }
.catalog-rule-block p { margin: 5px 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.catalog-validation-note { padding: 15px 20px; background: #fff8e8; border-top: 1px solid #ead9ad; }
.catalog-validation-note h3 { margin: 0 0 7px; color: #6f5100; font-size: 13px; }
.catalog-validation-note ul { margin: 0; padding-left: 18px; color: #655b43; font-size: 12px; line-height: 1.55; }
.catalog-inline-filters { display: flex; align-items: center; gap: 8px; }
.catalog-inline-filters select { min-width: 145px; padding: 8px 28px 8px 10px; border: 1px solid var(--outline); border-radius: 6px; background: #fff; }
.catalog-pagination { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--outline); font-size: 12px; }
.catalog-note { margin: 0; padding: 14px 20px; color: var(--muted); background: var(--surface-low); border-top: 1px solid var(--outline); font-size: 12px; line-height: 1.5; }
.table-actions { display: flex; align-items: center; gap: 12px; }
.export-menu { position: relative; }
.export-menu > summary { height: 32px; display: flex; align-items: center; padding: 0 12px; color: var(--secondary); background: #fff; border: 1px solid var(--outline); border-radius: 5px; cursor: pointer; font-size: 10px; font-weight: 800; list-style: none; }
.export-menu > summary::-webkit-details-marker { display: none; }
.export-menu > summary:hover, .export-menu[open] > summary { border-color: var(--secondary); box-shadow: 0 0 0 3px rgba(0,81,213,.08); }
.export-menu.busy > summary { color: var(--muted); cursor: wait; pointer-events: none; }
.export-menu-panel { position: absolute; z-index: 21; top: calc(100% + 8px); left: 0; min-width: 170px; overflow: hidden; padding: 5px; background: #fff; border: 1px solid var(--outline); border-radius: 7px; box-shadow: 0 12px 30px rgba(15,23,42,.18); }
.export-menu-panel button { width: 100%; padding: 9px 10px; color: #374151; background: transparent; border: 0; border-radius: 4px; cursor: pointer; text-align: left; font-size: 10px; font-weight: 700; }
.export-menu-panel button:hover { color: var(--secondary); background: #eef3ff; }
.export-menu-panel button:disabled { color: var(--muted); cursor: wait; }
.column-chooser { position: relative; }
.column-chooser > summary { width: 32px; height: 32px; display: grid; place-items: center; color: #4b5563; background: var(--surface-low); border: 1px solid var(--outline); border-radius: 5px; cursor: pointer; font-size: 20px; font-weight: 800; line-height: 1; list-style: none; }
.column-chooser > summary::-webkit-details-marker { display: none; }
.column-chooser > summary:hover, .column-chooser[open] > summary { color: var(--secondary); background: #fff; border-color: var(--secondary); }
.column-chooser-panel { position: absolute; z-index: 20; top: calc(100% + 8px); right: 0; width: min(380px, 82vw); max-height: 420px; overflow: hidden; background: #fff; border: 1px solid var(--outline); border-radius: 8px; box-shadow: 0 12px 30px rgba(15,23,42,.18); }
.column-chooser-panel header { position: sticky; z-index: 1; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; background: #fff; border-bottom: 1px solid var(--outline); }
.column-chooser-panel header strong { font-size: 12px; }
.column-chooser-panel header button { padding: 0; color: var(--secondary); background: transparent; border: 0; cursor: pointer; font-size: 10px; font-weight: 800; }
.column-chooser-options { max-height: 360px; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 1px 12px; overflow: auto; padding: 10px 14px 14px; }
.column-chooser-options label { min-width: 0; display: flex; align-items: center; gap: 7px; padding: 5px 0; color: #374151; cursor: pointer; font-size: 10px; }
.column-chooser-options input { flex: 0 0 auto; accent-color: var(--secondary); }
.column-chooser-options span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cfdi-column-hidden { display: none; }
.text-button { color: var(--secondary); background: transparent; border: 0; cursor: pointer; font-size: 11px; font-weight: 700; }
.table-wrap { max-height: 66vh; overflow: auto; }
.download-monthly-summary .table-wrap { max-height: none; }
.download-monthly-summary table { table-layout: fixed; }
.download-monthly-summary th:first-child { width: 20%; }
.download-monthly-summary tbody th,
.download-monthly-summary tbody td { padding-top: 8px; padding-bottom: 8px; vertical-align: middle; }
.download-monthly-summary tbody th { color: #243b57; font-size: 12px; font-weight: 700; text-align: left; text-transform: capitalize; }
.download-monthly-summary .download-month-row.is-current > th,
.download-monthly-summary .download-month-row.is-current > td { background: #eaf4fb; }
.monthly-metric { display: grid; grid-template-columns: minmax(46px, 1fr) auto; align-items: center; gap: 8px; min-width: 0; }
.monthly-metric-track { display: block; height: 7px; overflow: hidden; background: #e8edf2; border-radius: 999px; }
.monthly-metric-bar { display: block; height: 100%; border-radius: inherit; background: #3478b8; }
.monthly-metric-received .monthly-metric-bar { background: #2b8c87; }
.monthly-metric-issued .monthly-metric-bar { background: #7555a8; }
.monthly-metric strong { min-width: 2ch; color: #243b57; font-size: 11px; font-variant-numeric: tabular-nums; text-align: right; }
.inactive-months-summary td { padding: 0; background: #fff !important; }
.inactive-months-toggle { display: flex; width: 100%; align-items: center; gap: 8px; padding: 9px 14px; border: 0; background: #f8fafc; color: #53677d; font: inherit; font-size: 11px; font-weight: 700; text-align: left; cursor: pointer; }
.inactive-months-toggle:hover { background: #f1f5f8; color: #243b57; }
.toggle-chevron { font-size: 18px; line-height: 1; transition: transform .16s ease; }
.inactive-months-toggle[aria-expanded="true"] .toggle-chevron { transform: rotate(90deg); }
.inactive-month-detail[hidden] { display: none; }
@media (max-width: 760px) {
  .download-monthly-summary table { min-width: 680px; }
}
table { width: 100%; min-width: max-content; border-collapse: separate; border-spacing: 0; text-align: left; }
th { position: sticky; z-index: 2; top: 0; padding: 11px 16px; color: #656b71; background: var(--surface-low); border-bottom: 1px solid var(--outline); font-size: 9px; letter-spacing: .07em; text-transform: uppercase; white-space: nowrap; }
.cfdi-sortable { cursor: pointer; user-select: none; }
.cfdi-sortable::after { content: "↕"; margin-left: 6px; color: #9aa0a6; font-size: 10px; }
.cfdi-sortable[aria-sort="ascending"]::after { content: "↑"; color: var(--secondary); }
.cfdi-sortable[aria-sort="descending"]::after { content: "↓"; color: var(--secondary); }
.cfdi-sortable:hover { color: var(--secondary); background: #e8eef9; }
.cfdi-sortable:focus-visible { outline: 2px solid var(--secondary); outline-offset: -2px; }
td { padding: 4px 16px; border-top: 1px solid #e6e8ea; font-size: 11px; white-space: nowrap; }
tbody tr:nth-child(odd) td { background-color: var(--table-row); }
tbody tr:nth-child(even) td { background-color: var(--table-row-alt); }
tbody tr.cfdi-type-row.cfdi-type-income td { background-color: #E8F5E9; }
tbody tr.cfdi-type-row.cfdi-type-expense td { background-color: #FDECEC; }
tbody tr.cfdi-type-row.cfdi-type-payroll td { background-color: #F1EBFA; }
tbody tr.cfdi-type-row.cfdi-type-transfer td { background-color: #E8F1F8; }
tbody tr.cfdi-type-row.cfdi-type-payment td { background-color: #FFF3E0; }
tbody tr.cfdi-type-row td:first-child { box-shadow: inset 3px 0 0 var(--cfdi-type-text); }
tbody tr:hover td { background: var(--table-row-hover); }
#cfdi-results tr { cursor: pointer; }
#cfdi-results tr.is-selected td {
  background-color: #d9e9f5 !important;
  box-shadow: inset 0 1px 0 #7ba7c4, inset 0 -1px 0 #7ba7c4;
}
#cfdi-results tr.is-selected td:first-child {
  box-shadow: inset 3px 0 0 var(--cfdi-type-text, #32688c), inset 0 1px 0 #7ba7c4, inset 0 -1px 0 #7ba7c4;
}
#cfdi-results tr.is-selected td:last-child { box-shadow: inset -1px 0 0 #7ba7c4, inset 0 1px 0 #7ba7c4, inset 0 -1px 0 #7ba7c4; }
#cfdi-results tr:focus-visible { outline: 2px solid #32688c; outline-offset: -2px; }
#cfdi-results td,
#cfdi-results td :is(span, button, select),
#recent-cfdi td,
#recent-cfdi td :is(span, button, select) {
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
}
th.percentage-column { color: #4169e1; }
th.percentage-column.cfdi-sortable::after { color: #4169e1; }
th.percentage-column.cfdi-sortable:hover { color: #3158ce; background: #e8eef9; }
#cfdi-results td.percentage-column { color: #3158ce; font-weight: 800; }
td.uuid { color: #3f465c; font-family: "Cascadia Mono", Consolas, monospace; font-size: 10px; }
.uuid-document-link { color: var(--secondary) !important; cursor: zoom-in; text-decoration: underline dotted; text-underline-offset: 3px; }
.uuid-document-link:focus-visible { outline: 2px solid var(--secondary); outline-offset: -3px; }
td.amount { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.status-chip { padding: 3px 7px; color: #065f46; background: #d1fae5; border-radius: 4px; font-size: 9px; font-weight: 800; }
.status-chip.pending { color: #92400e; background: #fef3c7; }
.status-chip.cancelled { color: #991b1b; background: #fee2e2; }
.status-chip.not-found { color: #45464d; background: #e6e8ea; }
.cfdi-type-income { --cfdi-type-background: #E8F5E9; --cfdi-type-text: #2E7D32; }
.cfdi-type-expense { --cfdi-type-background: #FDECEC; --cfdi-type-text: #B33A3A; }
.cfdi-type-payroll { --cfdi-type-background: #F1EBFA; --cfdi-type-text: #6A45A5; }
.cfdi-type-transfer { --cfdi-type-background: #E8F1F8; --cfdi-type-text: #32688C; }
.cfdi-type-payment { --cfdi-type-background: #FFF3E0; --cfdi-type-text: #A86400; }
.cfdi-type-badge {
  display: inline-flex;
  align-items: center;
  min-height: 21px;
  padding: 3px 8px;
  color: var(--cfdi-type-text, inherit);
  background: var(--cfdi-type-background, var(--surface-high));
  border: 1px solid color-mix(in srgb, var(--cfdi-type-text, #62686e) 18%, transparent);
  border-radius: 999px;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}
.document-type-badge { margin-left: 4px; vertical-align: middle; }
.empty-row td { padding: 40px; color: var(--muted); background: var(--surface); text-align: center; }

.empty-state { min-height: 430px; display: grid; place-content: center; justify-items: center; padding: 40px; text-align: center; background: #fff; border: 1px solid var(--outline); border-radius: 8px; }
.empty-state > span { width: 54px; height: 54px; display: grid; place-items: center; color: var(--secondary); background: #e6edff; border-radius: 12px; font-size: 16px; font-weight: 800; }
.empty-state h2 { margin: 18px 0 7px; font-size: 18px; }
.empty-state p { max-width: 470px; margin: 0 0 20px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.filter-card { display: grid; grid-template-columns: minmax(210px,1.5fr) repeat(4,minmax(125px,1fr)) auto auto; align-items: end; gap: 12px; margin-bottom: 20px; padding: 16px; background: #fff; border: 1px solid var(--outline); border-radius: 8px; }
.filter-field label { display: block; margin-bottom: 6px; color: #62686e; font-size: 9px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.filter-field input, .filter-field select, .page-size select { width: 100%; height: 38px; padding: 0 10px; color: var(--text); background: var(--surface-low); border: 1px solid var(--outline); border-radius: 5px; outline: 0; font-size: 11px; }
#cfdi-filters input,
#cfdi-filters select,
#cfdi-use summary,
#cfdi-use .category-option,
#cfdi-category-select summary,
#cfdi-category-select .category-option {
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
}
#cfdi-filters select,
#cfdi-use summary {
  height: 38px;
  min-height: 38px;
  padding: 0 34px 0 11px;
  color: var(--text);
  background-color: var(--surface-low);
  border: 1px solid var(--outline);
  border-radius: 5px;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: normal;
  text-transform: none;
}
#cfdi-filters select option {
  color: #374151;
  background: #fff;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
  font-weight: 500;
  text-transform: none;
}
#cfdi-filters select:focus,
#cfdi-use[open] summary {
  background-color: #fff;
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(0,81,213,.1);
}
.filter-field input:focus, .filter-field select:focus, .page-size select:focus { background: #fff; border-color: var(--secondary); box-shadow: 0 0 0 3px rgba(0,81,213,.1); }
.primary-button, .ghost-button { height: 38px; padding: 0 14px; border-radius: 5px; cursor: pointer; font-size: 11px; font-weight: 800; white-space: nowrap; }
.primary-button { color: #fff; background: var(--secondary); border: 1px solid var(--secondary); }
.ghost-button { color: var(--secondary); background: transparent; border: 0; }
.page-size { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 10px; }
.page-size select { width: 68px; height: 32px; }
.pagination-bar { display: flex; justify-content: space-between; align-items: center; padding: 13px 16px; color: var(--muted); background: var(--surface-low); border-top: 1px solid var(--outline); font-size: 10px; }
.pagination-bar div { display: flex; gap: 7px; }
.pagination-bar button { padding: 7px 10px; color: var(--secondary); background: #fff; border: 1px solid var(--outline); border-radius: 5px; cursor: pointer; font-size: 10px; font-weight: 700; }
.pagination-bar button:disabled { color: #9ca0a4; background: #eceef0; cursor: default; }
.direction-chip { padding: 3px 7px; color: #003ea8; background: #e6edff; border-radius: 4px; font-size: 9px; font-weight: 800; }
.maintenance-layout { display: grid; grid-template-columns: minmax(280px,360px) minmax(0,1fr); gap: 20px; align-items: start; }
.download-layout { display: grid; grid-template-columns: minmax(0,1fr); gap: 20px; align-items: start; margin-bottom: 20px; }
.download-layout > article { min-width: 0; }
.metadata-reconciliation-card { margin-bottom: 20px; }
.metadata-reconciliation-grid { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 1px; background: var(--outline); border-top: 1px solid var(--outline); }
.metadata-reconciliation-grid > div { display: grid; gap: 4px; padding: 12px 14px; background: #fff; }
.metadata-reconciliation-grid small { color: var(--muted); font-size: 9px; font-weight: 700; text-transform: uppercase; }
.metadata-reconciliation-grid strong { font-size: 18px; }
.download-layout.automatic-mode { grid-template-columns: minmax(0,1fr); }
.form-help { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.field-help { min-height: 45px; margin: 7px 0 0; padding: 8px 9px; color: #43505d; background: #edf3fa; border-left: 3px solid var(--secondary); border-radius: 3px; font-size: 10px; line-height: 1.45; }
.sync-status { padding: 3px 7px; color: #003ea8; background: #e6edff; border-radius: 4px; font-size: 9px; font-weight: 800; }
.sync-status.complete { color: #065f46; background: #d1fae5; }
.sync-status.error { color: #991b1b; background: #fee2e2; }
.sync-status.warning { color: #8a4b08; background: #fff0d5; }
.sync-status.working::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 7px; border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%; vertical-align: -3px; animation: spin 2.5s linear infinite; }
.request-age { display: block; margin-top: 5px; color: #65758a; font-size: 9px; font-weight: 600; white-space: nowrap; }
.request-age.stalled { color: #9a570c; font-weight: 800; }
.stalled-download-row td:first-child { box-shadow: inset 3px 0 0 #d48624; }
.download-refresh-arrow { display: inline-block; animation: spin 2.5s linear infinite; }
.live-status { color: #087f5b; font-size: 10px; font-weight: 800; white-space: nowrap; }
.progress-summary { color: #087f5b !important; font-weight: 700; }
.section-tabs { display: flex; gap: 4px; padding: 10px 16px 0; background: #fff; border-bottom: 1px solid var(--outline); }
.section-tab { padding: 9px 14px; color: var(--muted); background: transparent; border: 0; border-bottom: 3px solid transparent; cursor: pointer; font-size: 11px; font-weight: 800; }
.section-tab.active { color: var(--secondary); border-bottom-color: var(--secondary); }
.cfdi-result-tabs { padding-top: 0; }
.cfdi-category-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 13px 16px; background: #f8fafc; border-bottom: 1px solid var(--outline); }
.cfdi-category-toolbar strong, .cfdi-category-toolbar small { display: block; }
.cfdi-category-toolbar strong { font-size: 11px; }
.cfdi-category-toolbar small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.category-multiselect { position: relative; width: min(390px, 48vw); }
.category-multiselect summary { min-height: 38px; display: flex; align-items: center; padding: 8px 34px 8px 11px; overflow: hidden; color: var(--text); background: #fff; border: 1px solid var(--outline); border-radius: 5px; cursor: pointer; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.category-multiselect summary::marker { content: ""; }
.category-multiselect summary::after { content: "⌄"; position: absolute; right: 12px; color: var(--muted); }
.category-multiselect[open] summary { border-color: var(--secondary); box-shadow: 0 0 0 3px rgba(0,81,213,.1); }
.category-options { position: absolute; z-index: 12; top: calc(100% + 5px); right: 0; width: 100%; max-height: 280px; overflow-y: auto; padding: 6px; background: #fff; border: 1px solid var(--outline); border-radius: 6px; box-shadow: 0 12px 28px rgba(19,27,46,.16); }
.category-option { display: flex; align-items: center; gap: 9px; padding: 8px; border-radius: 4px; cursor: pointer; font-size: 11px; }
.category-option:hover { background: var(--surface-low); }
.category-option input { flex: 0 0 auto; accent-color: var(--secondary); }
.filter-multiselect { width: 100%; }
.filter-multiselect summary { height: 38px; min-height: 38px; background: var(--surface-low); }
.filter-multiselect .category-options { right: auto; left: 0; width: min(680px,92vw); overflow-x: auto; padding: 5px; }
.filter-multiselect .category-option {
  display: grid;
  grid-template-columns: 12px max-content;
  align-items: center;
  column-gap: 14px;
  padding: 7px 8px;
  line-height: 1.4;
  white-space: nowrap;
  margin: 0;
  color: #374151;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: normal;
  text-transform: none;
}
.filter-multiselect .category-option input {
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  margin: 0;
}
.filter-multiselect .cfdi-use-option-label { display: block; min-width: 0; white-space: nowrap; }
.filter-multiselect .cfdi-use-all-option { padding-bottom: 9px; border-bottom: 1px solid var(--outline); font-weight: 700; }
.section-tab.active { color: var(--secondary); border-bottom-color: var(--secondary); }
.live-status::first-letter { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.form-card { background: #fff; border: 1px solid var(--outline); border-radius: 8px; box-shadow: 0 3px 8px rgba(0,0,0,.035); }
.form-card header { padding: 18px 20px; border-bottom: 1px solid var(--outline); }
.form-card h2 { margin: 0; font-size: 16px; }
.form-card header p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.form-card form { display: grid; gap: 15px; padding: 20px; }
.download-mode-summary { margin-bottom: 16px; padding: 11px 14px; color: #31445c; background: #eef4fb; border-left: 3px solid var(--secondary); border-radius: 5px; font-size: 11px; font-weight: 700; }
.download-settings-card { width: min(720px,100%); }
.download-mode-option { display: flex; align-items: flex-start; gap: 12px; padding: 16px; color: var(--text); background: var(--surface-low); border: 1px solid var(--outline); border-radius: 7px; cursor: pointer; }
.download-mode-option:has(input:checked) { background: #eef4ff; border-color: var(--secondary); box-shadow: 0 0 0 3px rgba(0,81,213,.08); }
.download-mode-option input { flex: 0 0 auto; margin-top: 3px; accent-color: var(--secondary); }
.download-mode-option span, .download-mode-option strong, .download-mode-option small { display: block; }
.download-mode-option strong { font-size: 13px; }
.download-mode-option small { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.download-mode-detail { padding: 12px 14px; color: #43505d; background: #f5f7fa; border-radius: 5px; font-size: 11px; line-height: 1.55; }
.download-settings-card .primary-button { justify-self: start; }
.form-field label { display: block; margin-bottom: 6px; color: #62686e; font-size: 9px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.form-field input, .form-field textarea, .form-field select, .compact-search { width: 100%; padding: 9px 10px; color: var(--text); background: var(--surface-low); border: 1px solid var(--outline); border-radius: 5px; outline: 0; font-size: 11px; resize: vertical; }
.form-field input:focus, .form-field textarea:focus, .form-field select:focus, .compact-search:focus { background: #fff; border-color: var(--secondary); box-shadow: 0 0 0 3px rgba(0,81,213,.1); }
.check-field { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.form-actions { display: flex; align-items: center; gap: 8px; padding-top: 4px; }
.compact-search { width: min(250px,40vw); }
.rate-value { font-weight: 800; color: #003ea8; }
.row-action { padding: 5px 8px; color: var(--secondary); background: transparent; border: 0; cursor: pointer; font-size: 10px; font-weight: 800; }
.inline-select { min-width: 165px; padding: 6px 8px; color: var(--text); background: var(--surface-low); border: 1px solid var(--outline); border-radius: 5px; font-size: 10px; }
.users-table-wrap { max-height: none; overflow: visible; }
.users-access-card { align-self: start; }
.users-table { min-width: 0; height: auto; table-layout: fixed; }
.users-table tbody, .users-table tbody tr { height: auto; }
.users-table th { padding-top: 9px; padding-bottom: 9px; vertical-align: middle; }
.users-table td { height: auto; padding-top: 7px; padding-bottom: 7px; vertical-align: middle; line-height: 1.3; white-space: normal; overflow-wrap: anywhere; }
.users-table .permission-toggle { width: 14px; height: 14px; margin: 0; }
.users-table th:nth-child(1) { width: 9%; }
.users-table th:nth-child(2) { width: 18%; }
.users-table th:nth-child(3) { width: 18%; }
.users-table th:nth-child(4) { width: 20%; }
.users-table th:nth-child(5) { width: 13%; }
.users-table th:nth-child(6) { width: 9%; }
.users-table th:nth-child(7) { width: 13%; }
.users-table .inline-select { width: 100%; min-width: 0; padding-top: 5px; padding-bottom: 5px; }
.users-table td:nth-child(5), .users-table td:nth-child(6) { white-space: nowrap; }
.user-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.user-actions .row-action { max-width: 100%; padding-inline: 0; text-align: left; white-space: normal; }
.mfa-card { display: grid; grid-template-columns: 1fr auto; gap: 16px; margin-bottom: 20px; padding: 20px; background: #fff; border: 1px solid var(--outline); border-radius: 8px; }
.account-password-card { margin-bottom: 20px; }
.account-password-card form { grid-template-columns: repeat(3,minmax(180px,1fr)) auto; align-items: end; }
.mfa-card h2 { margin: 0 0 5px; font-size: 17px; }
.mfa-card p { margin: 0; color: var(--muted); font-size: 11px; }
.mfa-setup, .mfa-reset, .mfa-recovery { grid-column: 1 / -1; }
.mfa-reset { padding-top: 15px; border-top: 1px solid var(--outline); }
.mfa-reset > p { margin-bottom: 12px; }
.mfa-reset-fields { display: grid; grid-template-columns: repeat(2,minmax(180px,1fr)) auto; align-items: end; gap: 10px; }
.mfa-setup { display: flex; align-items: center; gap: 20px; padding-top: 15px; border-top: 1px solid var(--outline); }
.mfa-setup img { width: 190px; height: 190px; background: #fff; }
.mfa-setup code { user-select: all; font-size: 12px; }
.mfa-confirm { display: flex; gap: 8px; margin-top: 14px; }
.mfa-confirm input { width: 150px; padding: 8px; border: 1px solid var(--outline); border-radius: 5px; font-size: 16px; letter-spacing: .2em; }
.mfa-recovery { padding: 14px; color: #654500; background: #fff3cd; border-radius: 5px; font-size: 11px; }
.mfa-recovery pre { margin: 10px 0 0; white-space: pre-wrap; line-height: 1.7; }
.credential-window { position: relative; width: min(620px,94vw); max-height: 92vh; overflow: auto; padding: 0 22px 22px; background: #fff; border-radius: 9px; box-shadow: 0 28px 80px rgba(0,0,0,.35); }
.credential-window > header { display: flex; justify-content: space-between; align-items: center; margin: 0 -22px 18px; padding: 16px 22px; border-bottom: 1px solid var(--outline); }
.credential-window h2 { margin: 0; font-size: 17px; }
.credential-window header p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.credential-window form { display: grid; gap: 15px; }
.credential-status { margin-bottom: 16px; padding: 12px; background: var(--surface-low); border-radius: 5px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.onboarding-mode .sidebar .main-navigation, .onboarding-mode .collapse-button { display: none; }
.onboarding-mode .topbar-left { visibility: hidden; }
.onboarding-shell { width: min(620px,100%); margin: 5vh auto; padding: 36px; background: #fff; border: 1px solid var(--outline); border-radius: 10px; box-shadow: 0 8px 28px rgba(19,27,46,.08); }
.onboarding-icon { width: 50px; height: 50px; display: grid; place-items: center; margin-bottom: 20px; color: #fff; background: var(--secondary); border-radius: 10px; font-size: 28px; }
.onboarding-shell h1 { margin: 0 0 8px; font-size: 28px; }
.onboarding-shell > p:not(.eyebrow) { margin: 0 0 24px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.onboarding-shell form { display: grid; gap: 16px; }
.nav-overlay { display: none; }

.modal-open { overflow: hidden; }
.document-modal { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; padding: 22px; }
.document-backdrop { position: absolute; inset: 0; background: rgba(20,27,38,.72); backdrop-filter: blur(3px); }
.document-window { position: relative; width: min(1180px,96vw); max-height: 94vh; overflow: auto; background: #e7eaee; border-radius: 10px; box-shadow: 0 28px 80px rgba(0,0,0,.35); }
.document-toolbar { position: sticky; z-index: 5; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 13px 18px; background: #fff; border-bottom: 1px solid var(--outline); }
.document-toolbar strong, .document-toolbar small { display: block; }
.document-toolbar strong { font-size: 13px; }
.document-toolbar small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.document-toolbar > div:last-child { display: flex; align-items: center; gap: 9px; }
.document-close { width: 36px; height: 36px; color: #4b5563; background: var(--surface-low); border: 0; border-radius: 50%; cursor: pointer; font-size: 23px; line-height: 1; }
.document-loading { min-height: 420px; display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.related-window { width: min(980px,96vw); background: #fff; }
.related-content { padding: 20px; }
.related-table { min-width: 880px; }
.related-table td { vertical-align: middle; }
.related-table td:nth-child(2) { font-family: "Cascadia Mono", Consolas, monospace; }
.related-table-action { padding: 6px 9px; color: var(--secondary); background: #eef3ff; border: 1px solid #cbd9ff; border-radius: 4px; cursor: pointer; font-size: 9px; font-weight: 800; white-space: nowrap; }
.related-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.related-unavailable { color: var(--muted); font-size: 9px; }
.related-checkbox { width: 16px; height: 16px; display: block; margin: 0 auto; accent-color: var(--secondary); cursor: pointer; }
.related-checkbox:disabled { cursor: default; opacity: .4; }

#summary-menu-toggle:disabled {
  cursor: default;
  opacity: .45;
}
@keyframes cfdi-record-flash {
  0%, 100% { background-color: inherit; }
  50% { background-color: #ffd966; }
}
.cfdi-record-highlight td { animation: cfdi-record-flash .55s ease-in-out 3; }
.cfdi-document { width: min(1040px,calc(100% - 48px)); margin: 24px auto; padding: 38px 42px; background: #fff; box-shadow: 0 4px 18px rgba(18,28,45,.12); }
.invoice-header { display: flex; justify-content: space-between; gap: 24px; padding-bottom: 22px; border-bottom: 3px solid #17365d; }
.invoice-brand { display: flex; align-items: center; gap: 22px; }
.invoice-brand img { width: 108px; }
.invoice-brand small { color: var(--secondary); font-size: 9px; font-weight: 900; letter-spacing: .12em; }
.invoice-brand h1 { margin: 5px 0 0; font-size: 25px; }
.invoice-status { display: grid; justify-items: end; align-content: center; gap: 9px; }
.invoice-status strong { font-size: 18px; }
.document-status { padding: 5px 10px; color: #065f46; background: #d1fae5; border-radius: 5px; font-size: 10px; font-weight: 900; text-transform: uppercase; }
.document-status.cancelled { color: #991b1b; background: #fee2e2; }
.document-status.pending { color: #92400e; background: #fef3c7; }
.document-status.not-found { color: #45464d; background: #e6e8ea; }
.document-notice { margin: 18px 0; padding: 9px 12px; color: #5d6470; background: #f4f6f8; border-left: 3px solid #8c96a3; font-size: 10px; }
.invoice-identifiers { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.invoice-identifiers div { min-width: 0; padding: 12px; background: #f5f7fa; border-radius: 5px; }
.invoice-identifiers small, .invoice-identifiers strong { display: block; }
.invoice-identifiers small { color: var(--muted); font-size: 8px; font-weight: 900; letter-spacing: .07em; text-transform: uppercase; }
.invoice-identifiers strong { margin-top: 5px; overflow-wrap: anywhere; font-size: 11px; }
.parties-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.parties-grid article { padding: 17px; border: 1px solid #dbe0e6; border-radius: 6px; }
.parties-grid article > span { color: var(--secondary); font-size: 8px; font-weight: 900; letter-spacing: .1em; }
.parties-grid h2 { margin: 7px 0 4px; font-size: 15px; }
.parties-grid p { margin: 0 0 12px; font-family: Consolas, monospace; font-size: 11px; }
.parties-grid dl, .fiscal-data dl { display: grid; grid-template-columns: max-content 1fr; gap: 5px 12px; margin: 0; font-size: 10px; }
.parties-grid dt, .fiscal-data dt { color: var(--muted); }
.parties-grid dd, .fiscal-data dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.concepts-section { margin-top: 25px; }
.concepts-section > h2, .fiscal-data > h2 { margin: 0 0 10px; font-size: 14px; }
.document-table-wrap { overflow-x: auto; border: 1px solid #dbe0e6; border-radius: 5px; }
.document-table { min-width: 850px; border-collapse: collapse; }
.document-table th { position: static; padding: 9px 10px; color: #fff; background: #17365d; font-size: 8px; }
.document-table td { padding: 9px 10px; background: #fff !important; border-top: 1px solid #e5e7eb; font-size: 9px; white-space: normal; }
.document-table td:nth-last-child(-n+5) { text-align: right; white-space: nowrap; }
.invoice-summary { display: grid; grid-template-columns: 1fr minmax(300px,38%); gap: 28px; margin-top: 24px; }
.fiscal-data { padding: 16px; background: #f5f7fa; border-radius: 6px; }
.totals-box { align-self: start; }
.totals-box > div { display: flex; justify-content: space-between; gap: 20px; padding: 7px 10px; border-bottom: 1px solid #e5e7eb; font-size: 11px; }
.totals-box .grand-total { margin-top: 5px; padding: 13px 10px; color: #fff; background: #17365d; border: 0; font-size: 16px; }
.invoice-footer { display: flex; justify-content: space-between; margin-top: 28px; padding-top: 12px; color: var(--muted); border-top: 1px solid #dbe0e6; font-size: 9px; }

@media print {
  body > *:not(#cfdi-document-modal) { display: none !important; }
  #cfdi-document-modal { position: static; display: block; padding: 0; }
  .document-backdrop, .document-toolbar { display: none !important; }
  .document-window { width: 100%; max-height: none; overflow: visible; background: #fff; border-radius: 0; box-shadow: none; }
  .cfdi-document { width: 100%; margin: 0; padding: 14mm; box-shadow: none; }
}

@media (max-width: 1100px) {
  .metrics-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .cfdi-summary-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .filter-card { grid-template-columns: repeat(3,1fr); }
  .filter-search { grid-column: span 2; }
  .maintenance-layout, .download-layout { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .sidebar { width: 270px; transform: translateX(-100%); box-shadow: 12px 0 28px rgba(19,27,46,.18); }
  .app-shell.navigation-open .sidebar { transform: translateX(0); }
  .app-shell.navigation-open .nav-overlay { position: fixed; z-index: 25; inset: 0; display: block; background: rgba(19,27,46,.4); }
  .app-shell.sidebar-collapsed .sidebar { width: 270px; }
  .app-shell.sidebar-collapsed .product-title, .app-shell.sidebar-collapsed .nav-label, .app-shell.sidebar-collapsed .nav-caption { display: block; }
  .app-shell.sidebar-collapsed .nav-item { justify-content: flex-start; padding-inline: 11px; }
  .main-area, .app-shell.sidebar-collapsed .main-area { margin-left: 0; }
  .open-navigation, .close-navigation { display: grid; }
  .collapse-button { display: none; }
  .topbar { padding: 0 15px; }
  .topbar-left select { min-width: 140px; max-width: 46vw; }
  .user-text, .user-divider, .topbar-right > .icon-button { display: none; }
  .content { padding: 24px 16px; }
  .filter-card { grid-template-columns: 1fr 1fr; }
  .filter-search { grid-column: span 2; }
  .cfdi-category-toolbar { align-items: stretch; flex-direction: column; }
  .category-multiselect { width: 100%; }
  .payment-breakdown { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .expense-summary-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .metrics-grid { grid-template-columns: 1fr; }
  .cfdi-summary-grid { grid-template-columns: 1fr; }
  .page-heading { align-items: stretch; flex-direction: column; }
  .page-heading .secondary-button { align-self: flex-start; }
  .heading-actions { align-self: flex-start; flex-wrap: wrap; }
  .filter-card { grid-template-columns: 1fr; }
  .filter-search { grid-column: auto; }
  .payment-breakdown { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .sync-status.working::before,
  .download-refresh-arrow { animation-duration: 2.5s !important; }
}
.constancias-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
.constancia-card { display: flex; flex-direction: column; gap: 20px; }
.constancia-card .primary-button { align-self: flex-start; }
.constancias-note { max-width: none; }
.permission-toggle { width: 18px; height: 18px; accent-color: #32688c; }
.tax-document-company-settings { margin: 18px 0; padding: 16px; background: var(--surface-low); border: 1px solid var(--outline); border-radius: 8px; }
.tax-document-company-settings h3, .tax-document-company-settings p { margin: 0 0 8px; }
.entity-currency-settings { display: grid; gap: 10px; width: 100%; min-width: 0; margin: 18px 0; padding: 16px; overflow: hidden; border: 1px solid var(--outline); border-radius: 8px; background: #fff; }
.entity-currency-settings > *, .entity-currency-settings .form-field { min-width: 0; max-width: 100%; }
.entity-currency-settings h3, .entity-currency-settings p { margin: 0; }
.entity-currency-settings .row-action { max-width: 100%; justify-self: end; margin: 0; }
.entity-currency-settings .form-help { width: 100%; overflow-wrap: anywhere; }
.entity-currency-settings .form-field select { display: block; max-width: 100%; }
.multicurrency-question { display: flex; align-items: center; gap: 18px; margin: 0; padding: 0; border: 0; }
.multicurrency-question legend { float: left; margin-right: 10px; color: var(--text); font-size: 12px; font-weight: 700; }
.multicurrency-question label { display: flex; align-items: center; gap: 5px; font-size: 12px; }
.multicurrency-question input { width: 14px; height: 14px; margin: 0; accent-color: #32688c; }
.field-label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.currency-check-list { box-sizing: border-box; width: 100%; min-width: 0; max-width: 100%; max-height: 156px; overflow-y: auto; overflow-x: hidden; border: 1px solid var(--outline); border-radius: 6px; background: var(--surface-low); scrollbar-gutter: stable; }
.form-field .currency-check-item { display: flex; align-items: center; gap: 5px; min-width: 0; min-height: 23px; margin: 0; padding: 2px 7px; cursor: pointer; border-bottom: 1px solid #e7ebef; color: var(--text); font-size: 10px; font-weight: 400; letter-spacing: normal; line-height: 1.2; text-transform: none; }
.currency-check-item:last-child { border-bottom: 0; }
.currency-check-item:hover { background: #e8f1f8; }
.form-field .currency-check-item input { flex: 0 0 13px; width: 13px; height: 13px; margin: 0; padding: 0; resize: none; accent-color: #32688c; box-shadow: none; }
.currency-check-item span { display: flex; align-items: baseline; gap: 5px; min-width: 0; overflow: hidden; white-space: nowrap; }
.currency-separator { flex: 0 0 auto; font-size: 10px; }
.currency-check-item strong { flex: 0 0 auto; font-size: 10px; }
.currency-check-item small { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.currency-check-item.is-primary { background: #e8f1f8; }
.primary-currency-badge { padding: 1px 5px; border-radius: 8px; background: #d7e8f3; color: #32688c; font-size: 9px; font-style: normal; font-weight: 700; }
.sat-credential-panel { margin-top: 14px; border: 1px solid var(--outline); border-radius: 8px; background: #fff; }
.sat-credential-panel > summary { padding: 13px 16px; cursor: pointer; color: var(--text); font-size: 13px; font-weight: 700; }
.sat-credential-panel[open] > summary { border-bottom: 1px solid var(--outline); }
.sat-credential-panel form { padding: 16px; }
.stored-credential-actions { display: flex; justify-content: flex-end; margin-top: 10px; }
.company-document-setting { display: grid; grid-template-columns: minmax(190px,1fr) 105px 105px auto; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--outline); }
.company-document-setting select, .company-document-setting input[type="time"] { width: 100%; min-height: 32px; padding: 5px 7px; border: 1px solid var(--outline); border-radius: 5px; background: #fff; color: var(--text); font-size: 10px; }
.setting-check { display: flex; align-items: center; gap: 9px; }
.setting-check input { width: 18px; height: 18px; accent-color: #32688c; }
.user-company-tree { display: block; padding: 6px 10px; }
.user-tree-node { border: 0; border-radius: 0; background: transparent; }
.user-tree-node + .user-tree-node { border-top: 1px solid #edf0f2; }
.user-tree-summary { display: flex; align-items: center; min-width: 0; padding: 6px 4px; cursor: pointer; font-size: 12px; }
.user-tree-summary::marker { color: #64748b; font-size: 10px; }
.user-tree-identity { display: flex; align-items: baseline; gap: 7px; min-width: 0; }
.user-tree-identity strong { flex: 0 0 auto; color: var(--text); font-size: 12px; }
.user-tree-identity small { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.company-tree-branches { position: relative; display: grid; margin-left: 8px; padding: 0 0 5px 25px; border-left: 1px solid #cbd5e1; }
.company-tree-branch { position: relative; display: flex; align-items: center; gap: 6px; min-height: 24px; padding: 2px 4px 2px 10px; font-size: 12px; }
.company-tree-branch::before { position: absolute; top: 50%; left: -1px; width: 8px; border-top: 1px solid #cbd5e1; content: ""; }
.company-tree-branch input { flex: 0 0 auto; width: 14px; height: 14px; margin: 0; accent-color: #32688c; }
.company-tree-copy { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.company-tree-copy strong { font-size: 12px; font-weight: 500; }
.company-tree-copy small { color: var(--muted); font-size: 10px; }
.tenant-company-branch { justify-content: space-between; }
.tenant-company-branch .company-tree-copy { flex: 1 1 auto; }
.tenant-company-branch .status-chip { flex: 0 0 auto; margin-right: 4px; }
.tenant-user-summary { justify-content: space-between; gap: 10px; }
.tenant-user-summary .user-tree-identity { flex: 1 1 auto; }
.tenant-user-details { gap: 0; }
.tenant-user-detail { justify-content: flex-start; min-height: 28px; }
.tenant-user-detail-label { flex: 0 0 135px; color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.tenant-user-detail .inline-select { width: min(250px, 100%); min-height: 30px; padding: 4px 8px; }
.tenant-user-detail .permission-toggle { width: 14px; height: 14px; margin: 0; }
.tenant-user-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.tenant-user-actions .row-action { margin: 0; }
@media (max-width:760px) {
  .company-document-setting { grid-template-columns: 1fr 70px 100px; }
  .company-document-setting .row-action { grid-column: 1 / -1; }
  .user-tree-identity { display: grid; gap: 1px; }
  .tenant-user-detail { align-items: flex-start; flex-direction: column; gap: 3px; padding-block: 4px; }
  .tenant-user-detail-label { flex-basis: auto; }
}

/* Descargas SAT: formulario horizontal, historial y resúmenes apilados. */
#manual-download-form {
  grid-template-columns: minmax(150px,1.5fr) repeat(2,minmax(125px,1fr)) minmax(170px,1.3fr) minmax(180px,1.4fr) auto;
  align-items: end;
}
#manual-download-form .form-field { min-width: 0; }
#manual-download-form input, #manual-download-form select { width: 100%; min-width: 0; }
#manual-download-form .field-help { grid-column: 1 / -1; grid-row: 2; min-height: 0; margin: 0; }
#manual-download-form .form-help { grid-column: 1 / -1; grid-row: 3; }
#submit-manual-download { grid-column: 6; grid-row: 1; white-space: nowrap; }
@media (max-width: 1450px) {
  #manual-download-form { grid-template-columns: repeat(3,minmax(0,1fr)); }
  #submit-manual-download { grid-column: 3; grid-row: 2; }
  #manual-download-form .field-help { grid-row: 3; }
  #manual-download-form .form-help { grid-row: 4; }
}
@media (max-width: 760px) {
  #manual-download-form { grid-template-columns: repeat(2,minmax(0,1fr)); }
  #submit-manual-download { grid-column: 2; grid-row: 3; }
  #manual-download-form .field-help { grid-row: 4; }
  #manual-download-form .form-help { grid-row: 5; }
}
@media (max-width: 560px) {
  #manual-download-form { grid-template-columns: minmax(0,1fr); }
  #submit-manual-download, #manual-download-form .field-help, #manual-download-form .form-help { grid-column: 1; grid-row: auto; }
  #submit-manual-download { width: 100%; }
}

@media (max-width: 760px) {
  .isr-comparison { grid-template-columns: minmax(0,1fr); }
}

/* Resúmenes compactos compartidos por moneda y vista. */
.cfdi-period-summary { padding: 9px; margin-bottom: 10px; }
.cfdi-period-summary > header { margin-bottom: 6px; gap: 8px; }
.cfdi-period-summary h2 { font-size: 14px; }
.cfdi-period-summary header p { margin-top: 2px; font-size: 10px; line-height: 1.3; }
.currency-summary-section { padding: 9px; }
.currency-summary-section-header { margin-bottom: 7px; }
.cfdi-summary-grid, .expense-summary-grid { gap: 6px; }
.cfdi-summary-card { display: grid; grid-template-columns: minmax(0,1fr) auto; align-content: start; align-items: center; gap: 3px 8px; padding: 8px; border-radius: 5px; }
.cfdi-summary-card small { letter-spacing: .02em; line-height: 1.3; }
.cfdi-summary-card > strong { margin: 0; font-size: 16px; line-height: 1.2; white-space: nowrap; }
.cfdi-summary-card > p { grid-column: 1 / -1; margin: 0; line-height: 1.3; }
.cfdi-summary-card > .income-breakdown,
.cfdi-summary-card > .tax-breakdown,
.cfdi-summary-card > .payment-breakdown,
.cfdi-summary-card > .isr-comparison { grid-column: 1 / -1; margin-top: 3px; }
.income-breakdown, .tax-breakdown { gap: 3px; padding-top: 4px; }
.income-breakdown .income-result { margin-top: 0; padding-top: 3px; }
.payment-breakdown { gap: 5px; padding-top: 4px; }
.payment-breakdown > div:not(.payment-rate-list), .payment-rate-list > div { padding: 4px 6px; gap: 6px; }
.payment-rate-list { gap: 3px; }
.payment-rate-list:empty::after { padding: 4px 6px; }
.isr-comparison { gap: 4px; }
.isr-comparison > section { min-width: 0; padding: 4px 6px; }
.isr-comparison > section > div:first-child { gap: 5px; flex-wrap: wrap; }
.isr-comparison .tax-breakdown { margin-top: 3px; padding-top: 3px; }
@media (max-width: 560px) {
  .cfdi-summary-card { grid-template-columns: minmax(0,1fr); }
  .cfdi-summary-card > strong { white-space: normal; overflow-wrap: anywhere; }
}
