:root {
    --portal-blue: #1126A8;
    --portal-dark: #0A1A73;
    --portal-soft: #DCEBFF;
    --portal-bg: #F5F7FB;
    --portal-text: #1F2937;
    --portal-muted: #667085;
    --portal-border: #D9E2F1;
    --portal-white: #FFFFFF;
    --portal-success: #16a34a;
    --portal-warning: #d97706;
}
body { color: var(--portal-text); background: var(--portal-bg); margin-bottom: 0; }
.portal-header { position: sticky; top: 0; z-index: 100; border-bottom: 1px solid var(--portal-border); box-shadow: 0 8px 24px rgba(10, 26, 115, .05); }
.portal-header .navbar { min-height: 78px; }
.portal-brand { display: flex; gap: 14px; align-items: center; color: var(--portal-text); font-size: .98rem; font-weight: 800; }
.brand-logo { width: auto; height: 50px; object-fit: contain; }
.brand-copy { display: grid; gap: 1px; line-height: 1.05; }
.brand-copy strong { color: var(--portal-blue); font-size: .95rem; letter-spacing: .02em; }
.brand-copy small { color: var(--portal-muted); font-size: .78rem; font-weight: 700; }
.brand-mark { width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: 10px; color: #fff; background: var(--portal-blue); font-size: .75rem; letter-spacing: -.02em; }
.portal-nav-link { color: #475569; font-weight: 600; }
.portal-nav-link:hover { color: var(--portal-blue); }
.portal-nav-link:focus-visible,
.btn:focus-visible,
.form-control:focus,
.form-select:focus { outline: 3px solid rgba(17, 38, 168, .16); outline-offset: 2px; }
.btn-primary { background: var(--portal-blue); border-color: var(--portal-blue); }
.btn-primary:hover, .btn-primary:focus { background: var(--portal-dark); border-color: var(--portal-dark); }
.btn-outline-primary { color: var(--portal-blue); border-color: var(--portal-blue); }
.btn-outline-primary:hover, .btn-outline-primary:focus { color: #fff; background: var(--portal-blue); border-color: var(--portal-blue); }
.text-primary { color: var(--portal-blue) !important; }
.portal-footer { border-top: 1px solid var(--portal-border); padding: 25px 0; font-size: .85rem; background: #fff; }
.portal-page { min-height: 100vh; }
.home-hero { min-height: calc(100vh - 156px); display: grid; place-items: center; padding: clamp(28px, 5vw, 64px) 16px; background: radial-gradient(circle at 15% 10%, var(--portal-soft), transparent 30%), linear-gradient(180deg, #fff 0%, var(--portal-bg) 100%); }
.home-hero-card { width: min(1040px, 100%); border: 1px solid var(--portal-border); border-radius: 28px; background: rgba(255,255,255,.96); box-shadow: 0 24px 70px rgba(10, 26, 115, .10); padding: clamp(30px, 5vw, 54px); text-align: left; }
.home-brand-row { display: flex; align-items: center; gap: 22px; margin-bottom: 28px; }
.home-logo { max-width: 190px; width: 34vw; height: auto; margin: 0; }
.home-copy { max-width: 780px; }
.home-hero h1 { margin: 0 0 14px; font-size: clamp(2rem, 4vw, 3.25rem); line-height: 1.05; font-weight: 850; letter-spacing: -.045em; }
.home-hero-card p { color: var(--portal-muted); }
.home-copy > p { max-width: 650px; margin: 0; font-size: 1.05rem; line-height: 1.7; }
.home-slogan { margin: 4px 0 0; color: var(--portal-blue) !important; font-weight: 800; font-size: 1.05rem; }
.home-benefits { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 30px; }
.home-benefits > div { border: 1px solid var(--portal-border); border-radius: 16px; background: #fff; padding: 16px; }
.home-benefits span { display: inline-grid; place-items: center; min-width: 34px; height: 34px; margin-bottom: 12px; border-radius: 10px; color: #fff; background: var(--portal-blue); font-size: .72rem; font-weight: 850; }
.home-benefits strong { display: block; color: var(--portal-text); font-size: .92rem; }
.home-benefits small { display: block; color: var(--portal-muted); margin-top: 5px; line-height: 1.45; }
.home-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 32px; }
.home-actions .btn { min-width: 160px; border-radius: 999px; font-weight: 750; }
.portal-shell { min-height: calc(100vh - 78px); display: grid; grid-template-columns: 280px minmax(0, 1fr); }
.portal-sidebar { border-right: 1px solid var(--portal-border); background: #fff; padding: 30px 22px; display: flex; flex-direction: column; }
.sidebar-profile { display: flex; align-items: center; gap: 12px; padding: 0 8px 25px; border-bottom: 1px solid var(--portal-border); }
.profile-avatar { flex: 0 0 auto; width: 43px; height: 43px; display: grid; place-items: center; border-radius: 13px; color: #fff; background: linear-gradient(145deg, var(--portal-blue), var(--portal-dark)); font-weight: 800; }
.sidebar-profile div { min-width: 0; }
.sidebar-profile strong, .sidebar-profile small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-profile strong { font-size: .9rem; color: var(--portal-blue); }
.sidebar-profile small { color: var(--portal-muted); margin-top: 2px; font-size: .75rem; }
.sidebar-context { margin: 18px 8px 0; border: 1px solid var(--portal-border); border-radius: 12px; background: #f8fbff; padding: 12px; }
.sidebar-context span { display: block; color: var(--portal-muted); font-size: .68rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.sidebar-context strong { display: block; margin-top: 4px; color: var(--portal-text); font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.portal-sidebar nav { display: grid; gap: 7px; padding: 24px 0; }
.portal-sidebar nav a, .portal-sidebar nav > span { display: flex; align-items: center; gap: 11px; padding: 11px 13px; border-radius: 10px; color: #475569; text-decoration: none; font-size: .88rem; font-weight: 650; }
.portal-sidebar nav a:hover { color: var(--portal-blue); background: #f2f6ff; }
.portal-sidebar nav a.active { color: var(--portal-blue); background: var(--portal-soft); }
.portal-sidebar nav .disabled { color: #94a3b8; }
.portal-sidebar nav small { margin-left: auto; font-size: .63rem; font-weight: 700; }
.sidebar-help { margin-top: auto; border: 1px solid var(--portal-border); border-radius: 13px; padding: 16px; background: linear-gradient(180deg, #fff, #f6f9ff); }
.sidebar-help strong { font-size: .84rem; }
.sidebar-help p { color: #64748b; font-size: .75rem; line-height: 1.55; margin: 6px 0 0; }
.portal-content { width: 100%; max-width: 1120px; padding: 45px clamp(24px, 5vw, 70px) 70px; }
.content-heading { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 28px; }
.content-heading h1 { font-size: 2rem; font-weight: 800; letter-spacing: -.035em; margin-bottom: 5px; }
.content-heading > div > p:last-child { color: var(--portal-muted); margin: 0; }
.eyebrow { margin: 0 0 7px; font-size: .7rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.read-only-pill, .count-pill { border-radius: 999px; color: var(--portal-blue); background: var(--portal-soft); padding: 6px 10px; font-size: .7rem; font-weight: 750; }
.portal-card { border: 1px solid var(--portal-border); border-radius: 17px; background: #fff; box-shadow: 0 10px 34px rgba(10, 26, 115, .055); padding: 25px; margin-bottom: 20px; }
.card-title-row { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 22px; }
.card-title-row > div { display: flex; gap: 12px; }
.section-icon { flex: 0 0 auto; width: 37px; height: 37px; display: grid; place-items: center; color: var(--portal-blue); background: var(--portal-soft); border-radius: 10px; font-weight: 800; }
.card-title-row h2 { font-size: 1rem; font-weight: 800; margin: 1px 0 4px; }
.card-title-row p { color: var(--portal-muted); font-size: .78rem; margin: 0; }
.account-data-grid { display: grid; grid-template-columns: 1.2fr 1.2fr .8fr; gap: 18px; }
.account-data-grid > div { min-width: 0; border-top: 1px solid var(--portal-border); padding-top: 15px; }
.account-data-grid span, .identity-status span { display: block; color: var(--portal-muted); font-size: .72rem; margin-bottom: 5px; }
.account-data-grid strong { display: block; overflow-wrap: anywhere; font-size: .88rem; }
.identity-list { border: 1px solid var(--portal-border); border-radius: 12px; overflow: hidden; }
.identity-item { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 15px; padding: 16px; }
.identity-item + .identity-item { border-top: 1px solid var(--portal-border); }
.identity-type { width: 43px; height: 36px; display: grid; place-items: center; border-radius: 9px; color: var(--portal-blue); background: var(--portal-soft); font-size: .72rem; font-weight: 800; }
.identity-main strong { font-size: .9rem; }
.identity-main > span { display: block; color: var(--portal-muted); margin-top: 3px; font-size: .76rem; }
.principal-pill { margin-left: 8px; border-radius: 999px; color: #166534; background: #dcfce7; padding: 3px 7px; font-size: .62rem; font-weight: 750; }
.identity-status { min-width: 105px; }
.identity-status strong { font-size: .8rem; }
.status-badge { display: inline-block !important; width: fit-content; border-radius: 999px; padding: 5px 9px; font-size: .7rem !important; }
.status-badge.success { color: #166534; background: #dcfce7; }
.status-badge.warning { color: #92400e; background: #fef3c7; }
.status-badge.neutral { color: #475569; background: #f1f5f9; }
.document-status-row { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--portal-border); padding: 13px 0; }
.document-status-row > div { display: flex; gap: 8px; align-items: center; }
.document-status-row strong { font-size: .85rem; }
.document-status-row > div span { color: var(--portal-muted); font-size: .7rem; }
.info-message { display: flex; align-items: flex-start; gap: 11px; border: 1px solid #bfd2ff; border-radius: 11px; padding: 14px; background: #f3f7ff; color: #475569; }
.info-message > span { flex: 0 0 auto; width: 21px; height: 21px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--portal-blue); font-size: .72rem; font-weight: 800; }
.info-message p { margin: 0; font-size: .78rem; line-height: 1.55; }
.empty-state { border: 1px dashed var(--portal-border); border-radius: 12px; padding: 22px; text-align: center; color: var(--portal-muted); font-size: .85rem; }
.empty-state p { margin: 0; }
.comprobantes-content { max-width: 1220px; }
.sync-alert { display: flex; align-items: center; gap: 11px; border-radius: 12px; padding: 13px 16px; margin-bottom: 20px; font-size: .82rem; }
.sync-alert span { flex: 0 0 auto; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; color: #fff; font-weight: 800; }
.sync-alert p { margin: 0; }
.sync-alert.success { color: #166534; border: 1px solid #bbf7d0; background: #f0fdf4; }
.sync-alert.success span { background: var(--portal-success); }
.sync-alert.warning { color: #92400e; border: 1px solid #fed7aa; background: #fff7ed; }
.sync-alert.warning span { background: var(--portal-warning); }
.filter-card { padding-bottom: 20px; }
.comprobante-filters { display: grid; gap: 16px; }
.filter-group { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; border: 1px solid var(--portal-border); border-radius: 14px; padding: 16px; margin: 0; background: #fbfdff; }
.filter-group legend { float: none; width: auto; margin: 0 0 2px; padding: 0 6px; color: var(--portal-blue); font-size: .74rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.filter-span-2 { grid-column: span 2; }
.comprobante-filters label { display: block; color: #475569; font-size: .72rem; font-weight: 700; margin-bottom: 6px; }
.comprobante-filters .form-control, .comprobante-filters .form-select { min-height: 42px; border-color: var(--portal-border); border-radius: 9px; font-size: .82rem; }
.comprobante-filters .form-control:focus, .comprobante-filters .form-select:focus { border-color: var(--portal-blue); box-shadow: 0 0 0 3px rgba(17, 38, 168, .12); }
.filter-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 9px; padding-top: 3px; }
.filter-actions .btn { min-width: 112px; border-radius: 9px; font-size: .8rem; font-weight: 700; }
.storage-refresh { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 16px; border: 1px solid #bfd2ff; border-radius: 14px; background: linear-gradient(180deg, #fff, #f4f7ff); padding: 15px 16px; }
.storage-refresh strong { display: block; color: var(--portal-text); font-size: .88rem; }
.storage-refresh span { display: block; color: var(--portal-muted); margin-top: 3px; font-size: .75rem; }
.comprobante-list { display: grid; gap: 16px; }
.comprobante-card { margin: 0; padding: 24px 26px; }
.comprobante-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; padding-bottom: 17px; border-bottom: 1px solid var(--portal-border); }
.comprobante-card-head > div:first-child { display: grid; grid-template-columns: auto auto; align-items: center; justify-content: start; gap: 5px 12px; }
.comprobante-card-head > div:first-child strong { color: var(--portal-text); font-size: .95rem; }
.comprobante-card-head > div:first-child small { grid-column: 2; color: var(--portal-muted); font-size: .72rem; }
.document-type { grid-row: 1 / 3; align-self: stretch; display: grid; place-items: center; min-width: 92px; border-radius: 10px; padding: 7px 10px; font-size: .7rem; font-weight: 800; }
.document-type.factura { color: #1126A8; background: #DCEBFF; }
.document-type.credito { color: #6d28d9; background: #ede9fe; }
.document-type.retencion { color: #b45309; background: #fef3c7; }
.document-total { text-align: right; }
.document-total span { display: block; color: var(--portal-muted); font-size: .67rem; }
.document-total strong { font-size: 1.05rem; }
.comprobante-data-grid { display: grid; grid-template-columns: 1fr 1.35fr 1fr; gap: 18px; padding: 18px 0; }
.comprobante-data-grid > div { min-width: 0; }
.comprobante-data-grid span { display: block; color: var(--portal-muted); font-size: .66rem; margin-bottom: 4px; }
.comprobante-data-grid strong { display: block; color: #334155; font-size: .78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comprobante-data-grid .access-key { grid-column: 1 / -1; }
.comprobante-data-grid .access-key strong { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .72rem; }
.comprobante-actions { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding-top: 14px; border-top: 1px solid var(--portal-border); }
.file-states, .download-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.file-state { border-radius: 999px; padding: 5px 9px; font-size: .66rem; font-weight: 750; }
.file-state.available { color: #166534; background: #dcfce7; }
.file-state.missing { color: #64748b; background: #f1f5f9; }
.download-actions .btn { border-radius: 8px; font-size: .72rem; font-weight: 700; }
.comprobantes-empty { text-align: center; padding: 65px 25px; }
.empty-document-icon { width: 58px; height: 58px; margin: 0 auto 17px; display: grid; place-items: center; border-radius: 17px; color: var(--portal-blue); background: var(--portal-soft); font-size: 1.35rem; }
.comprobantes-empty h2 { font-size: 1.05rem; font-weight: 800; }
.comprobantes-empty p { max-width: 560px; margin: 8px auto 0; color: var(--portal-muted); font-size: .82rem; }

@media (max-width: 850px) {
    .portal-shell { grid-template-columns: 1fr; }
    .portal-sidebar { display: none; }
    .portal-content { padding-top: 30px; }
    .account-data-grid { grid-template-columns: 1fr 1fr; }
    .filter-group { grid-template-columns: 1fr 1fr; }
    .comprobante-data-grid { grid-template-columns: 1fr 1fr; }
    .home-benefits { grid-template-columns: 1fr; }
    .storage-refresh { align-items: stretch; flex-direction: column; }
}
@media (max-width: 600px) {
    .portal-brand .brand-copy small { display: none; }
    .brand-logo { height: 42px; }
    .home-brand-row { align-items: flex-start; flex-direction: column; }
    .home-logo { width: 190px; max-width: 80%; }
    .content-heading { gap: 15px; }
    .content-heading h1 { font-size: 1.7rem; }
    .portal-card { padding: 20px 16px; }
    .account-data-grid { grid-template-columns: 1fr; }
    .identity-item { grid-template-columns: auto 1fr; }
    .identity-status { grid-column: 2; }
    .filter-group { grid-template-columns: 1fr; }
    .filter-span-2 { grid-column: auto; }
    .comprobante-card { padding: 18px 15px; }
    .comprobante-card-head, .comprobante-actions { align-items: stretch; flex-direction: column; }
    .document-total { text-align: left; }
    .comprobante-data-grid { grid-template-columns: 1fr; }
    .comprobante-data-grid .access-key { grid-column: auto; }
    .download-actions .btn { flex: 1; }
}
