:root {
    --red: #D00225;
    --white: #ffffff;
    --black: #000000;
    --line: rgba(0, 0, 0, .12);
    --soft: rgba(0, 0, 0, .55);
    --tint: rgba(208, 2, 37, .08);
    color-scheme: light;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    color: var(--black);
    background: var(--white);
}
* { box-sizing: border-box; }
body { margin: 0; font-size: 14px; background: var(--white); }
a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font: inherit; }
.topbar { height: 74px; background: var(--black); border-bottom: 3px solid var(--red); }
.topbar-inner { height: 100%; display: flex; align-items: center; justify-content: space-between; padding: 0 34px; }
.brand { display: flex; align-items: center; gap: 11px; color: var(--white); font-size: 18px; font-weight: 700; line-height: 1; }
.brand:hover { text-decoration: none; }
.brand strong { color: var(--red); }
.brand small { display: block; margin-top: 5px; font-size: 9px; color: rgba(255, 255, 255, .6); letter-spacing: 1.15px; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--red); color: var(--white); font-weight: 800; }
.header-label { color: rgba(255, 255, 255, .7); font-size: 12px; line-height: 1.5; text-align: right; }
.header-label strong { color: var(--white); }
.userbox { display: flex; align-items: center; gap: 16px; }
.userbox form { margin: 0; }
.logout { background: var(--red); color: var(--white); }
.logout:hover { background: var(--white); color: var(--black); }
.auth-page { min-height: 100vh; display: grid; place-items: center; background: var(--black); padding: 20px; }
.auth-card { width: 100%; max-width: 400px; padding: 32px; }
.auth-brand { color: var(--black); margin-bottom: 22px; }
.auth-card h1 { font-size: 22px; margin-bottom: 14px; }
.auth-card .muted { margin-bottom: 16px; }
.full { width: 100%; flex: none; margin-top: 6px; }
.subhead { padding-left: 0; margin: 4px 0 14px; color: var(--red); }
.spaced { margin-top: 20px; }
.layout { display: flex; min-height: calc(100vh - 74px); }
.sidebar { flex: 0 0 224px; background: var(--white); border-right: 1px solid var(--line); padding: 31px 16px; }
.nav-label { color: var(--soft); font-size: 10px; letter-spacing: 1px; font-weight: 700; padding-left: 14px; }
.catalogs-label { margin-top: 35px; }
.sidebar nav a { display: flex; align-items: center; gap: 11px; padding: 12px 14px; color: var(--black); font-weight: 600; border-radius: 8px; margin: 3px 0; }
.sidebar nav a:hover { background: var(--tint); text-decoration: none; }
.sidebar nav a.active { color: var(--white); background: var(--red); }
.nav-icon { font-size: 18px; width: 20px; text-align: center; }
main { flex: 1; min-width: 0; padding: 37px 38px 24px; }
.page-heading { margin-bottom: 27px; }
.eyebrow { font-size: 10px; font-weight: 700; letter-spacing: 1px; color: var(--red); margin: 0 0 10px; }
h1 { margin: 0 0 7px; color: var(--black); font-size: 27px; letter-spacing: -.5px; }
h2 { color: var(--black); font-size: 16px; margin: 0 0 6px; }
p { margin: 0; }
.muted { color: var(--soft); font-size: 12px; line-height: 1.5; }
.content-grid { display: grid; grid-template-columns: minmax(265px, 340px) minmax(0, 1fr); gap: 20px; align-items: start; }
.card { background: var(--white); border: 1px solid var(--line); border-top: 3px solid var(--red); border-radius: 12px; box-shadow: 0 4px 18px rgba(0, 0, 0, .06); padding: 23px; }
.card-heading { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 23px; }
.card-symbol { display: grid; place-items: center; color: var(--white); background: var(--red); border-radius: 8px; width: 30px; height: 30px; font-size: 19px; }
label:not(.check) { display: block; font-size: 12px; font-weight: 650; color: var(--black); margin: 0 0 7px; }
.required { color: var(--red); }
.optional { font-weight: 400; color: var(--soft); font-size: 11px; }
input:not([type=checkbox]):not([type=hidden]), select { width: 100%; height: 40px; border: 1px solid rgba(0, 0, 0, .25); border-radius: 7px; background: var(--white); padding: 0 11px; color: var(--black); outline: none; margin-bottom: 17px; }
input::placeholder { color: rgba(0, 0, 0, .4); }
input:focus, select:focus { border-color: var(--red) !important; box-shadow: 0 0 0 3px rgba(208, 2, 37, .15); }
.switches { border-top: 1px solid var(--line); padding-top: 6px; }
.check { display: flex; align-items: center; gap: 10px; padding: 12px 0; cursor: pointer; }
.check input { accent-color: var(--red); width: 17px; height: 17px; }
.check strong, .check small { display: block; }
.check strong { font-size: 12px; color: var(--black); }
.check small { color: var(--soft); font-size: 11px; margin-top: 4px; }
.form-actions { display: flex; gap: 8px; margin-top: 17px; }
.button, button { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 10px 16px; border-radius: 8px; border: 1px solid transparent; background: var(--red); color: var(--white); font-weight: 650; font-size: 12px; cursor: pointer; white-space: nowrap; box-shadow: 0 3px 0 rgba(0, 0, 0, .24), 0 4px 8px rgba(0, 0, 0, .08); transition: background-color .15s, border-color .15s, box-shadow .15s, transform .15s; }
.button:hover, button:hover { text-decoration: none; background: var(--black); color: var(--white); transform: translateY(-1px); box-shadow: 0 4px 0 rgba(0, 0, 0, .24), 0 6px 12px rgba(0, 0, 0, .12); }
.button:active, button:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, .24), 0 2px 4px rgba(0, 0, 0, .08); }
.button:focus-visible, button:focus-visible { outline: 3px solid rgba(208, 2, 37, .35); outline-offset: 2px; }
.button:disabled, button:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; transform: none; }
.primary { color: var(--white); background: var(--red); flex: 1; }
.primary:hover { background: var(--black); }
.secondary { background: #F1F2F4; border-color: #6B7280; color: var(--black); }
.secondary:hover { background: #E4E6E9; color: var(--black); }
.search { display: flex; gap: 9px; margin-bottom: 18px; }
.search input:not([type=hidden]) { margin: 0; }
.table-wrap { width: 100%; overflow-x: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; }
th { padding: 12px 10px; background: var(--black); color: var(--white); text-transform: uppercase; font-size: 10px; letter-spacing: .45px; white-space: nowrap; }
td { padding: 15px 10px; border-bottom: 1px solid var(--line); color: var(--black); font-size: 12px; vertical-align: middle; }
td strong { color: var(--black); }
.actions { white-space: nowrap; }
.actions a, .link { font-size: 12px; font-weight: 600; }
.inline { display: inline; }
.link { background: #F1F2F4; border-color: #6B7280; color: var(--black); }
.link:hover { background: #E4E6E9; color: var(--black); }
.danger { color: var(--red); border-color: var(--red); text-decoration: none; }
.empty { text-align: center; padding: 35px 10px; color: var(--soft); }
.notice { background: var(--white); color: var(--black); border: 1px solid var(--black); border-left: 5px solid var(--black); border-radius: 8px; padding: 12px 15px; margin-bottom: 18px; }
.notice.error { background: var(--tint); color: var(--red); border-color: var(--red); border-left-color: var(--red); }
.notice ul { padding-left: 18px; margin: 0; }
.invoice-lines { min-width: 760px; table-layout: fixed; }
.invoice-lines th:first-child { width: auto; }
.invoice-lines th:nth-child(2) { width: 110px; }
.invoice-lines th:nth-child(3) { width: 135px; }
.invoice-lines th:nth-child(4), .invoice-lines th:nth-child(5) { width: 110px; }
.invoice-lines th:last-child { width: 95px; }
.invoice-lines th:nth-child(2), .invoice-lines th:nth-child(3), .invoice-lines th:nth-child(4), .invoice-lines th:nth-child(5) { text-align: right; }
.invoice-lines td:nth-child(4), .invoice-lines td:nth-child(5) { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 600; }
.invoice-lines td:first-child { min-width: 240px; }
.product-search input.venta-busqueda { margin-bottom: 0; }
.product-results { max-height: 190px; overflow-y: auto; margin-top: 4px; background: var(--white); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 5px 16px rgba(0, 0, 0, .1); }
.product-results[hidden] { display: none; }
.product-result { padding: 10px 12px; cursor: pointer; }
.product-result:hover, .product-result[aria-selected="true"] { background: var(--tint); }
.product-result small { display: block; margin-top: 3px; color: var(--soft); }
.product-empty { padding: 10px 12px; color: var(--soft); }
.sale-totals { width: 100%; max-width: 440px; margin: 22px 0 22px auto; padding: 22px 24px; border: 1px solid rgba(208, 2, 37, .25); border-left: 6px solid var(--red); border-radius: 12px; background: linear-gradient(110deg, rgba(208, 2, 37, .07), var(--white) 70%); box-shadow: 0 8px 24px rgba(0, 0, 0, .08); }
.sale-totals h3 { margin: 0 0 14px; font-size: 16px; }
.sale-totals dl { margin: 0; }
.sale-totals dl div { display: flex; justify-content: space-between; gap: 20px; padding: 6px 0; }
.sale-totals dd { margin: 0; font-variant-numeric: tabular-nums; }
.sale-totals .sale-total { border-top: 1px solid rgba(0, 0, 0, .18); margin-top: 8px; padding-top: 13px; font-size: 22px; font-weight: 800; color: var(--red); }
.sale-totals .muted { margin-top: 10px; }
.invoice-actions { justify-content: flex-end; }
.invoice-actions .primary { flex: 0 1 auto; }
.payment-modal { width: min(560px, calc(100% - 32px)); max-height: calc(100% - 32px); padding: 24px; border: 0; border-top: 4px solid var(--red); border-radius: 12px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.payment-modal::backdrop { background: rgba(0, 0, 0, .55); }
.payment-modal .muted { margin: 8px 0 18px; }
.payment-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.invoice-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 16px; }
.filter-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.pagination { display: flex; align-items: center; gap: 12px; margin-top: 18px; }
.invoice-detail-header { margin-bottom: 24px; padding: 22px; border: 1px solid var(--line); border-radius: 12px; background: linear-gradient(120deg, rgba(208, 2, 37, .06), #fff 65%); }
.invoice-detail-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.invoice-detail-heading h2 { margin: 4px 0 0; font-size: 21px; overflow-wrap: anywhere; }
.invoice-detail-kicker, .invoice-detail-grid dt, .invoice-amounts dt { color: var(--soft); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.invoice-status { padding: 6px 11px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.invoice-status-active { background: #e6f4ea; color: #176b36; }
.invoice-status-cancelled { background: var(--tint); color: var(--red); }
.invoice-detail-grid, .invoice-amounts { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 16px; margin: 20px 0 0; }
.invoice-detail-grid dd, .invoice-amounts dd { margin: 6px 0 0; font-weight: 650; overflow-wrap: anywhere; }
.invoice-fiscal-details { border-top: 1px solid var(--line); padding-top: 16px; }
.invoice-detail-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.invoice-detail-actions .primary { flex: 0 0 auto; }
.invoice-amounts { border-top: 1px solid var(--line); padding-top: 18px; font-variant-numeric: tabular-nums; }
.invoice-amounts dd { font-size: 16px; }
.invoice-amount-total dd { color: var(--red); font-size: 20px; font-weight: 800; }
.invoice-cancellation { margin-top: 18px; color: var(--red); overflow-wrap: anywhere; }
.invoice-navigation { border-top: 1px solid var(--line); padding-top: 18px; margin-top: 24px; }
footer { color: var(--soft); font-size: 11px; margin-top: 28px; }
footer span { padding: 0 5px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (max-width: 1100px) { .content-grid { grid-template-columns: 1fr; } }
@media (max-width: 700px) {
    .topbar-inner { padding: 0 18px; }
    .header-label { display: none; }
    .layout { display: block; }
    .sidebar { padding: 12px; border-right: 0; border-bottom: 1px solid var(--line); }
    .sidebar nav { display: flex; gap: 4px; overflow-x: auto; }
    .sidebar nav a { flex-shrink: 0; padding: 10px; }
    .sidebar .nav-label { display: none; }
    main { padding: 25px 16px; }
    .card { padding: 18px; }
    .sale-totals { padding: 18px; }
    .payment-fields { grid-template-columns: 1fr; }
    .invoice-detail-header { padding: 16px; }
    .invoice-detail-grid, .invoice-amounts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
