:root {
    color-scheme: light;
    --ink: #20242d;
    --muted: #657080;
    --blue: #0076be;
    --green: #168251;
    --line: #dfe4ea;
    --surface: #ffffff;
    --background: #f4f6f8;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    min-height: 100vh;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--ink);
    background: var(--background);
}
.bar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    padding: 22px max(24px, calc((100vw - 1720px) / 2));
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    box-shadow: 0 8px 24px rgba(20,32,48,.07);
}
.brand { font-size: 23px; font-weight: 800; }
.brand span { color: var(--blue); }
.api-tag { color: var(--muted); font-size: 14px; }
main { max-width: 1720px; margin: 0 auto; padding: 64px 28px; }
.eyebrow { color: var(--blue); font-size: 13px; font-weight: 800; letter-spacing: 2px; }
h1 { font-size: clamp(36px, 6vw, 62px); margin: 12px 0; }
.lead { color: var(--muted); font-size: 20px; margin: 0 0 38px; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-left: 5px solid var(--blue);
    border-radius: 16px;
    padding: 26px;
    box-shadow: 0 16px 36px rgba(20, 32, 48, .07);
}
.card.ok { border-left-color: var(--green); }
.label { color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: 1.4px; }
.value { font-size: 28px; font-weight: 800; margin-top: 10px; }
.detail { color: var(--muted); margin-top: 9px; line-height: 1.5; }
.endpoint {
    margin-top: 28px; padding: 24px; background: #eef7fc; border: 1px solid #cce6f5;
    border-radius: 14px; overflow-wrap: anywhere;
}
.endpoint code { font-size: 15px; }
@media (max-width: 760px) { .grid { grid-template-columns: 1fr; } .bar { align-items: flex-start; gap: 8px; flex-direction: column; padding-block: 14px; } }
.accounting { margin-top: 46px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 28px; box-shadow: 0 16px 36px rgba(20,32,48,.07); }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
h2 { font-size: 30px; margin: 8px 0 0; }
.filter { display: flex; align-items: end; gap: 8px; }
.filter label { color: var(--muted); font-size: 12px; font-weight: 800; display: block; }
.filter select, .filter button { min-height: 44px; border-radius: 9px; border: 1px solid var(--line); padding: 0 14px; font: inherit; }
.filter button { color: white; background: var(--ink); border-color: var(--ink); font-weight: 800; cursor: pointer; }
.mini-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin: 26px 0; }
.mini-grid div { background: #f7f9fb; border: 1px solid var(--line); border-radius: 12px; padding: 18px; }
.mini-grid span { display: block; color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; }
.mini-grid strong { display: block; font-size: 20px; margin-top: 8px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; min-width: 900px; }
th { color: var(--muted); background: #fafbfc; font-size: 12px; letter-spacing: 1px; text-transform: uppercase; }
th, td { padding: 16px; text-align: left; border-bottom: 1px solid var(--line); }
tbody tr:last-child td { border-bottom: 0; }
.empty { color: var(--muted); text-align: center; padding: 40px; }
.local-note { color: var(--muted); font-size: 13px; margin: 16px 0 0; }
@media (max-width: 760px) { .section-head { align-items: stretch; flex-direction: column; } .filter { align-items: stretch; } .mini-grid { grid-template-columns: 1fr; } .accounting { padding: 20px; } }
.account-nav { display: flex; min-width: 0; align-items: center; justify-content: flex-end; gap: 12px; }
.nav-link { color: #404854; text-decoration: none; font-weight: 800; padding: 10px 12px; border-radius: 8px; }
.nav-link:hover, .nav-link.active { color: var(--blue); background: #eef7fc; }
.account-nav form { margin: 0; }
@media(max-width:1180px) { .bar { align-items:flex-start; flex-direction:column; } .account-nav { width:100%; justify-content:flex-start; overflow-x:auto; padding-bottom:4px; scrollbar-width:thin; } .account-nav > * { flex:0 0 auto; } }
.logout-button { border: 0; background: none; color: #bd1328; font: inherit; font-weight: 800; cursor: pointer; padding: 8px; }
.login-page { display: grid; place-items: center; padding: 28px; background: #eaf1f5; }
.login-shell { width: min(1120px, 100%); min-height: 680px; padding: 0; display: grid; grid-template-columns: 1fr 1.08fr; background: white; border-radius: 24px; overflow: hidden; box-shadow: 0 26px 70px rgba(17,33,50,.16); }
.login-brand { background: var(--ink); color: white; padding: 58px; display: flex; flex-direction: column; justify-content: space-between; }
.login-logo { font-size: 27px; font-weight: 900; }
.login-logo span { color: #42b9f1; }
.login-brand h2 { font-size: 42px; max-width: 430px; margin: 14px 0; }
.login-brand p { color: #c9d1da; font-size: 18px; line-height: 1.5; }
.login-card { padding: 72px 64px; align-self: center; }
.login-card h1 { font-size: 48px; margin: 12px 0 8px; }
.login-card > p { color: var(--muted); font-size: 18px; margin-bottom: 30px; }
.login-form { display: grid; gap: 10px; }
.login-form label { font-weight: 800; margin-top: 8px; }
.login-form input { width: 100%; min-height: 54px; border: 1px solid #cbd3dc; border-radius: 10px; padding: 0 16px; font: inherit; }
.login-form input:focus { outline: 3px solid rgba(0,118,190,.15); border-color: var(--blue); }
.login-form button { min-height: 54px; margin-top: 14px; border: 0; border-radius: 10px; background: var(--ink); color: white; font: inherit; font-weight: 900; cursor: pointer; }
.login-alert { background: #fff0f2; border-left: 4px solid #cc1530; color: #a20920; padding: 14px; border-radius: 8px; margin-bottom: 18px; }
@media (max-width: 780px) { .login-page { padding: 0; } .login-shell { min-height: 100vh; grid-template-columns: 1fr; border-radius: 0; } .login-brand { min-height: 230px; padding: 34px; } .login-brand h2 { font-size: 30px; } .login-card { padding: 42px 28px; } }
.page-title { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 28px; }
.page-title h1 { font-size: 46px; margin: 8px 0; }
.page-title p { color: var(--muted); font-size: 18px; margin: 0; }
.user-layout { display: grid; grid-template-columns: minmax(0,1fr); gap: 24px; align-items: start; }
.form-card, .users-card { background: white; border: 1px solid var(--line); border-radius: 16px; padding: 26px; box-shadow: 0 16px 36px rgba(20,32,48,.07); }
.form-card h2, .users-card h2 { margin: 8px 0 22px; }
.user-form { display: grid; gap: 9px; max-width: 760px; }
.user-form label { font-weight: 800; margin-top: 7px; }
.user-form input, .user-form select { min-height: 48px; border: 1px solid #cbd3dc; border-radius: 9px; padding: 0 14px; background: #fff; font: inherit; }
.user-form input:focus, .user-form select:focus { outline: 3px solid rgba(0,118,190,.14); border-color: var(--blue); }
.form-help { color: var(--muted); font-size: 13px; margin: -2px 0 4px; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 14px; }
.primary-button, .secondary-button { border: 0; border-radius: 9px; min-height: 46px; padding: 0 18px; font: inherit; font-weight: 900; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.primary-button { color: white; background: var(--ink); }
.secondary-button { color: var(--ink); background: #edf0f4; }
.notice { border-left: 4px solid var(--green); background: #eaf8f1; color: #11683f; border-radius: 9px; padding: 14px 16px; margin-bottom: 20px; }
.notice.error { border-left-color: #ca1832; background: #fff0f2; color: #9d1025; }
.biller-access-card .secondary-button { margin-top: 16px; align-self: flex-start; }
.biller-sync-strip { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 22px; padding: 16px 18px; color: #0f6640; background: linear-gradient(135deg,#f4fbf7 0%,#eaf8f1 100%); border: 1px solid #c8ead7; border-left: 4px solid var(--green); border-radius: 14px; box-shadow: 0 10px 24px rgba(20,32,48,.05); }
.biller-sync-strip.has-error { color: #a51128; background: #fff5f6; border-color: #efc5cc; }
.biller-sync-copy { min-width: 0; }
.biller-sync-heading { display: flex; align-items: center; gap: 12px; }
.biller-sync-heading > .status-dot { width: 11px; height: 11px; flex-basis: 11px; }
.biller-sync-strip.has-error .biller-sync-heading > .status-dot { color: #b71932; }
.biller-sync-strip h2 { margin: 2px 0 4px; font-size: 21px; }
.biller-sync-strip p { max-width: 760px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.biller-sync-actions { display: flex; align-items: center; justify-content: flex-end; gap: 14px; flex: 0 0 auto; }
.biller-sync-actions small { color: var(--muted); line-height: 1.35; text-align: right; white-space: nowrap; }
.biller-sync-actions form { margin: 0; }
.biller-sync-actions button { min-height: 40px; padding: 0 15px; background: #fff; border: 1px solid #d6dde5; }
.biller-sync-actions button:disabled { opacity: .5; cursor: not-allowed; }
.biller-summary { align-items: stretch; margin-bottom: 22px; }
.biller-summary > article { flex: 1 1 180px; }
.biller-summary > .secondary-button { align-self: center; }
.biller-ledger-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 22px; align-items: start; }
.biller-ledger-column { min-width: 0; border-top: 5px solid var(--blue); }
.biller-ledger-column > h2 { font-size: 25px; }
.biller-sales-card { background: linear-gradient(180deg,#f8fcff 0,#fff 150px); }
.biller-purchases-card { margin: 0; border-top-color: #d88900; background: linear-gradient(180deg,#fffbf2 0,#fff 150px); }
.biller-purchases-card .eyebrow { color: #a96700; }
.biller-purchases-summary > article { flex-basis: 210px; }
.biller-ledger-column table { min-width: 760px; }
.biller-purchases-table { min-width: 1080px !important; }
.biller-audit-card { margin-top: 22px; }
.iva-purchase-form { margin: 0; }
.iva-purchase-form select { min-height: 36px; border: 1px solid #cbd3dc; border-radius: 8px; padding: 0 9px; background: #fff; color: var(--ink); font: inherit; font-size: 12px; font-weight: 800; }
.biller-page main { display: flex; flex-direction: column; }
.biller-page main > .page-title { order: 0; }
.biller-page main > .notice { order: 1; }
.biller-page main > .dgi-report-card { order: 2; }
.biller-page main > .biller-sync-strip { order: 3; }
.biller-page main > .stock-summary { order: 4; }
.biller-page main > .biller-ledger-grid { order: 5; }
.biller-page main > .biller-audit-card { order: 6; }
.dgi-report-card { margin: 0 0 22px; border-top: 5px solid #175a43; background: linear-gradient(180deg,#f5fbf8 0,#fff 190px); }
.dgi-report-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 22px; }
.dgi-report-heading h2 { margin: 5px 0 7px; font-size: 28px; }
.dgi-report-heading p { max-width: 820px; margin: 0; color: var(--muted); line-height: 1.5; }
.dgi-period-form { display: flex; align-items: flex-end; gap: 9px; flex: none; }
.dgi-period-form label { color: var(--muted); font-size: 11px; font-weight: 900; letter-spacing: .7px; text-transform: uppercase; }
.dgi-period-form select { display: block; min-height: 42px; margin-top: 6px; border: 1px solid #cbd3dc; border-radius: 9px; padding: 0 32px 0 12px; background: #fff; color: var(--ink); font: inherit; font-weight: 900; text-transform: none; }
.dgi-current-summary { grid-template-columns: repeat(4,minmax(0,1fr)); margin: 22px 0; }
.dgi-current-summary article { border-left-color: #16805b; }
.dgi-current-summary article.dgi-result { background: #eef8f3; border-color: #b9dfcf; border-left-color: #116d45; }
.dgi-current-summary .dgi-result strong { color: #0f6948; }
.dgi-payable { color: #9b4d00; }
.dgi-credit { color: #117045; }
.status.warn { color: #8b5600; background: #fff2cf; }
.dgi-selected-detail { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)) auto; gap: 1px; margin-top: -5px; border: 1px solid #dbe6e1; border-radius: 11px; overflow: hidden; background: #dbe6e1; }
.dgi-selected-detail > div { min-width: 0; padding: 12px 15px; background: #f8fbfa; }
.dgi-selected-detail span:not(.status) { display: block; color: var(--muted); font-size: 10px; font-weight: 900; letter-spacing: .6px; text-transform: uppercase; }
.dgi-selected-detail strong { display: block; margin-top: 5px; font-size: 14px; }
.dgi-selected-detail > div:last-child { display: flex; align-items: center; justify-content: center; min-width: 180px; }
.dgi-adjustments { margin-top: 14px; border: 1px solid #cfe2d9; border-radius: 11px; background: #f7fbf9; }
.dgi-adjustments > summary { padding: 13px 16px; color: #116d45; font-size: 13px; font-weight: 900; cursor: pointer; }
.dgi-adjustment-panel { display: grid; grid-template-columns: minmax(220px,.75fr) minmax(0,2.25fr); gap: 24px; margin-top: 0; padding: 18px 20px 20px; border-top: 1px solid #cfe2d9; background: #f7fbf9; }
.dgi-adjustment-panel h3 { margin: 5px 0; font-size: 22px; }
.dgi-adjustment-panel p { margin: 0; color: var(--muted); line-height: 1.45; }
.dgi-adjustment-form { display: grid; grid-template-columns: repeat(3,minmax(150px,1fr)); gap: 12px; align-items: end; }
.dgi-adjustment-form label { color: #3d4652; font-size: 12px; font-weight: 900; }
.dgi-adjustment-form input { display: block; width: 100%; min-height: 43px; margin-top: 6px; border: 1px solid #cbd3dc; border-radius: 8px; padding: 0 11px; background: #fff; color: var(--ink); font: inherit; }
.dgi-adjustment-form .dgi-notes { grid-column: 1 / 3; }
.dgi-adjustment-form button { min-height: 43px; }
@media(max-width:900px) { .biller-sync-strip { align-items: flex-start; flex-direction: column; } .biller-sync-actions { width: 100%; justify-content: flex-start; flex-wrap: wrap; } .biller-sync-actions small { text-align: left; } }
@media(max-width:1280px) { .biller-ledger-grid { grid-template-columns: 1fr; } }
@media(max-width:900px) { .dgi-report-heading { flex-direction:column; } .dgi-current-summary { grid-template-columns:repeat(2,minmax(0,1fr)); } .dgi-selected-detail { grid-template-columns:repeat(2,minmax(0,1fr)); } .dgi-adjustment-panel { grid-template-columns:1fr; } .dgi-adjustment-form { grid-template-columns:1fr; } .dgi-adjustment-form .dgi-notes { grid-column:auto; } }
@media(max-width:620px) { .dgi-current-summary,.dgi-selected-detail { grid-template-columns:1fr; } .dgi-selected-detail > div:last-child { min-width:0; justify-content:flex-start; } .dgi-period-form { width:100%; flex-direction:column; align-items:stretch; } .dgi-period-form select { width:100%; } }
.status { display: inline-flex; padding: 7px 11px; border-radius: 999px; font-size: 13px; font-weight: 900; background: #e7f6ee; color: #127447; }
.status.off { background: #f1f3f5; color: #69727d; }
.user-actions { display: flex; gap: 13px; align-items: center; white-space: nowrap; }
.user-actions form { margin: 0; }
.text-button { background: none; border: 0; padding: 0; color: var(--blue); font: inherit; font-weight: 800; cursor: pointer; }
.text-button.danger { color: #bb1730; }
.audit { color: var(--muted); font-size: 12px; margin-top: 5px; }
@media(max-width:900px) { .user-layout { grid-template-columns: 1fr; } .account-nav .api-tag { display:none; } .page-title { align-items:flex-start; flex-direction:column; } }
.access-summary { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; margin-bottom: 22px; }
.access-summary div { background: white; border: 1px solid var(--line); border-left: 4px solid var(--blue); border-radius: 12px; padding: 18px; }
.access-summary span { color: var(--muted); font-size: 12px; font-weight: 900; letter-spacing: 1px; text-transform: uppercase; }
.access-summary strong { display: block; font-size: 26px; margin-top: 8px; }
.access-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 22px; }
.access-filters label { color: var(--muted); font-size: 12px; font-weight: 900; }
.access-filters select { display: block; min-width: 220px; min-height: 44px; margin-top: 5px; border: 1px solid #cbd3dc; border-radius: 9px; padding: 0 12px; font: inherit; }
.event-badge { display: inline-flex; padding: 6px 10px; border-radius: 999px; background: #e7f6ee; color: #117045; font-size: 12px; font-weight: 900; }
.event-badge.bad { background: #fff0f2; color: #a51128; }
.event-badge.neutral { background: #edf0f4; color: #5d6671; }
.browser-cell { max-width: 310px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media(max-width:760px) { .access-summary { grid-template-columns:1fr; } }
.branches-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 20px; margin-top: 26px; }
.branch-panel { min-width: 0; border: 1px solid var(--line); border-top: 4px solid var(--blue); border-radius: 14px; background: #fff; overflow: hidden; }
.branch-panel.branch-nova { border-top-color: #79b82a; }
.branch-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 20px; }
.branch-heading h3 { font-size: 23px; margin: 5px 0 0; }
.branch-count { flex: none; color: #116d45; background: #e8f6ef; border-radius: 999px; padding: 8px 11px; font-size: 12px; font-weight: 900; }
.branch-table-wrap { border-width: 1px 0 0; border-radius: 0; max-height: 720px; overflow-y: auto; overflow-x: hidden; }
.branch-table { min-width: 0; width: 100%; table-layout: fixed; font-size: 13px; }
.branch-table th,.branch-table td { padding: 13px 12px; }
.branch-table th { position: sticky; top: 0; z-index: 1; }
.branch-table th:first-child,.branch-table td:first-child { width: 27%; overflow-wrap: anywhere; }
.branch-table th:nth-child(2),.branch-table td:nth-child(2) { width: 21%; }
.branch-table th:nth-child(3),.branch-table td:nth-child(3) { width: 17%; overflow-wrap: anywhere; }
.branch-table th:nth-child(4),.branch-table td:nth-child(4) { width: 14%; overflow-wrap: anywhere; }
.branch-table th:nth-child(5),.branch-table td:nth-child(5) { width: 21%; }
.branch-table th:last-child,.branch-table td:last-child { white-space: nowrap; }
@media(max-width:1240px) { .branches-grid { grid-template-columns:1fr; } }
@media(max-width:700px) { main { padding: 38px 14px; } .accounting { padding: 16px; } .branch-table { font-size: 12px; } .branch-table th,.branch-table td { padding: 10px 7px; } }
.status-grid { grid-template-columns: repeat(3,minmax(0,1fr)); margin-bottom: 30px; }
.system-status { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; border: 1px solid currentColor; border-radius: 999px; padding: 8px 12px; font-size: 12px; font-weight: 900; transition: color .2s ease,background .2s ease,border-color .2s ease; }
.system-status.connected { color: #117045; background: #e8f6ef; border-color: #b9e4cc; }
.system-status.disconnected { color: #aa1830; background: #fff0f2; border-color: #f2bcc5; }
.status-dot { width: 9px; height: 9px; flex: 0 0 9px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px rgba(255,255,255,.72); }
@media(max-width:760px) { .system-status { padding:7px 10px; } }
@media(max-width:900px) { .status-grid { grid-template-columns: 1fr; } }
.branch-report { padding: 20px; background: #f8fafc; border-bottom: 1px solid var(--line); }
.branch-report-title { display: flex; align-items: end; justify-content: space-between; gap: 16px; }
.branch-report-title strong { display: block; margin-top: 6px; font-size: 21px; }
.branch-report-title > span { color: var(--muted); font-size: 12px; font-weight: 700; }
.branch-historical-totals,.period-result { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; margin-top: 15px; }
.branch-historical-totals > div,.period-result > div { min-width: 0; border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 13px; }
.branch-historical-totals span,.period-result span { display: block; color: var(--muted); font-size: 11px; font-weight: 900; letter-spacing: .5px; text-transform: uppercase; }
.branch-historical-totals strong,.period-result strong { display: block; margin-top: 7px; font-size: 16px; overflow-wrap: anywhere; }
.branch-period-form { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.range-fields { display: flex; align-items: end; flex-wrap: wrap; gap: 10px; }
.branch-period-form label { color: var(--muted); font-size: 11px; font-weight: 900; letter-spacing: .5px; text-transform: uppercase; }
.branch-period-form input[type=date] { display: block; min-height: 42px; margin-top: 6px; border: 1px solid #cbd3dc; border-radius: 9px; padding: 0 11px; background: #fff; color: var(--ink); font: inherit; }
.period-buttons { display: flex; flex-wrap: wrap; gap: 7px; }
.period-button { min-height: 42px; border: 1px solid #cbd3dc; border-radius: 9px; padding: 0 13px; background: #fff; color: var(--ink); font: inherit; font-weight: 800; cursor: pointer; }
.period-button:hover,.period-button.active { border-color: var(--ink); background: var(--ink); color: #fff; }
.period-result { grid-template-columns: 1.35fr 1fr 1fr; }
.period-result > div:first-child { border-left: 4px solid var(--blue); }
.stock-grand-totals { margin-top: 24px; border: 1px solid var(--line); border-left: 5px solid var(--blue); border-radius: 18px; padding: 24px; background: var(--surface); box-shadow: 0 16px 36px rgba(20,32,48,.07); }
.stock-grand-totals-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; }
.stock-grand-totals-heading h3 { margin: 5px 0 0; font-size: 24px; }
.stock-grand-totals-heading > span { color: var(--muted); font-size: 12px; font-weight: 700; }
.stock-grand-totals-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; margin-top: 17px; }
.stock-grand-totals-grid article { min-width: 0; border: 1px solid var(--line); border-top: 4px solid var(--blue); border-radius: 11px; padding: 16px; background: #fff; }
.stock-grand-totals-grid article:nth-child(even) { border-top-color: #79b82a; }
.stock-grand-totals-grid span { display: block; color: var(--muted); font-size: 11px; font-weight: 900; letter-spacing: .5px; text-transform: uppercase; }
.stock-grand-totals-grid strong { display: block; margin-top: 8px; font-size: 19px; overflow-wrap: anywhere; }
@media(max-width:760px) { .branch-report-title { align-items:flex-start; flex-direction:column; } .branch-historical-totals,.period-result { grid-template-columns:1fr; } .branch-period-form,.range-fields,.period-buttons { align-items:stretch; flex-direction:column; width:100%; } .branch-period-form input[type=date],.period-button { width:100%; } }
@media(max-width:760px) { .stock-grand-totals-heading { align-items:flex-start; flex-direction:column; } .stock-grand-totals-grid { grid-template-columns:1fr; } }

/* Gestión de stock */
.page-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.stock-page-title { margin-bottom: 22px; }
.stock-summary { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 14px; margin-bottom: 24px; }
.stock-summary article { min-width: 0; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--blue); border-radius: 13px; padding: 19px; box-shadow: 0 10px 24px rgba(20,32,48,.05); }
.stock-summary article.warning { border-left-color: #e39b16; }
.stock-summary span { display: block; color: var(--muted); font-size: 11px; font-weight: 900; letter-spacing: .9px; text-transform: uppercase; }
.stock-summary strong { display: block; margin-top: 8px; font-size: 22px; overflow-wrap: anywhere; }
.stock-summary small { display: block; color: #a15d00; margin-top: 6px; }
.stock-location-summaries { display:grid; gap:16px; margin-bottom:24px; }
.stock-location-summary { border:1px solid var(--line); border-radius:16px; padding:16px; background:#f5f7f9; }
.stock-location-summary.active { border-color:#9bcce7; background:#eef7fc; box-shadow:0 10px 24px rgba(0,118,190,.08); }
.stock-location-summary.location-nova.active { border-color:#afd477; background:#f4fbe9; box-shadow:0 10px 24px rgba(121,184,42,.10); }
.stock-location-summary.location-nova > header span { color:#5f930f; }
.stock-location-summary.location-nova > header > strong { color:#426f00; background:#e3f4ca; }
.stock-location-summary > header { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:0 3px 13px; }
.stock-location-summary > header span { color:var(--blue); font-size:10px; font-weight:900; letter-spacing:1.2px; }
.stock-location-summary > header h2 { margin:3px 0 0; font-size:20px; }
.stock-location-summary > header > strong { padding:6px 9px; border-radius:999px; color:#075f91; background:#dceff9; font-size:10px; text-transform:uppercase; letter-spacing:.6px; }
.stock-location-summary .stock-summary { margin-bottom:0; }
.dashboard-stock-overview { margin:22px 0 30px; }
.dashboard-stock-overview .section-head { align-items:flex-end; margin-bottom:16px; }
.dashboard-stock-overview .section-head p { margin:6px 0 0; color:var(--muted); }
.stock-layout { display: grid; grid-template-columns: minmax(0,1fr) 360px; gap: 20px; align-items: start; }
.stock-catalog-card,.stock-recent-card,.stock-form-shell,.movement-shell { background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 16px 36px rgba(20,32,48,.07); }
.stock-catalog-card { min-width: 0; padding: 24px; }
.stock-section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.stock-section-head h2,.stock-recent-card h2 { margin: 6px 0 0; }
.result-count { color: var(--muted); background: #f1f4f7; border-radius: 999px; padding: 8px 11px; font-size: 12px; font-weight: 800; }
.stock-filters { display: flex; flex-wrap: wrap; align-items: end; gap: 9px; padding: 16px; margin-bottom: 20px; border: 1px solid var(--line); border-radius: 12px; background: #f8fafc; }
.stock-filters label { color: var(--muted); font-size: 11px; font-weight: 900; letter-spacing: .4px; text-transform: uppercase; }
.stock-filters input,.stock-filters select { display: block; min-width: 150px; min-height: 44px; margin-top: 6px; border: 1px solid #cbd3dc; border-radius: 9px; padding: 0 12px; background: #fff; color: var(--ink); font: inherit; text-transform: none; }
.stock-filters label:first-child { flex: 1 1 260px; }
.stock-filters label:first-child input { width: 100%; }
.stock-table-wrap { max-height: 820px; overflow: auto; }
.stock-table { min-width: 920px; font-size: 13px; }
.stock-table th { position: sticky; top: 0; z-index: 2; }
.stock-table th,.stock-table td { padding: 13px 12px; }
.stock-table td:nth-child(2) { min-width: 260px; }
.stock-table td small,.history-table td small { display: block; color: var(--muted); margin-top: 5px; line-height: 1.35; }
.stock-table tr.is-inactive { opacity: .62; }
.product-code { white-space: nowrap; font-variant-numeric: tabular-nums; }
.stock-number { font-size: 18px; font-variant-numeric: tabular-nums; }
.stock-badge,.movement-type { display: inline-flex; border-radius: 999px; padding: 7px 10px; font-size: 11px; font-weight: 900; white-space: nowrap; }
.stock-badge.ok,.movement-type.entrada { color: #0f7547; background: #e5f7ee; }
.stock-badge.low { color: #915a00; background: #fff4d8; }
.stock-badge.out,.stock-badge.negative,.movement-type.salida { color: #a51229; background: #fff0f2; }
.stock-badge.inactive,.movement-type.ajuste { color: #5e6874; background: #edf0f4; }
.stock-actions { display: flex; flex-wrap: wrap; gap: 12px; white-space: nowrap; }
.stock-recent-card { padding: 22px; position: sticky; top: 18px; }
.movement-list { display: grid; gap: 0; margin-top: 16px; }
.movement-list article { padding: 15px 0; border-top: 1px solid var(--line); }
.movement-list article:first-child { border-top: 0; }
.movement-list article > div { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.movement-list time { color: var(--muted); font-size: 11px; }
.movement-list article > strong { display: block; margin-top: 10px; font-size: 13px; line-height: 1.35; }
.movement-list p { color: var(--muted); margin: 7px 0 4px; font-size: 13px; }
.movement-list small,.empty-state { color: var(--muted); line-height: 1.4; }
.stock-form-shell { overflow: hidden; }
.stock-product-form { padding: 28px; }
.stock-form-heading { display: flex; align-items: start; justify-content: space-between; gap: 20px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.stock-form-heading h2 { margin-top: 7px; }
.current-stock { min-width: 180px; border-left: 4px solid var(--blue); border-radius: 10px; background: #eef7fc; padding: 14px 17px; }
.current-stock span { display: block; color: var(--muted); font-size: 11px; font-weight: 900; text-transform: uppercase; }
.current-stock strong { display: block; margin: 4px 0; font-size: 26px; }
.current-stock a { color: var(--blue); font-size: 12px; font-weight: 800; }
.stock-form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 18px; margin-top: 24px; }
.stock-form-grid label,.movement-fields label { color: #3d4652; font-size: 13px; font-weight: 900; }
.stock-form-grid label.full,.movement-fields label.full { grid-column: 1/-1; }
.stock-form-grid input,.stock-form-grid select,.stock-form-grid textarea,.movement-fields input { width: 100%; min-height: 48px; margin-top: 7px; border: 1px solid #cbd3dc; border-radius: 9px; padding: 11px 13px; color: var(--ink); background: #fff; font: inherit; }
.stock-form-grid textarea { resize: vertical; }
.stock-form-grid input:focus,.stock-form-grid select:focus,.stock-form-grid textarea:focus,.movement-fields input:focus { outline: 3px solid rgba(0,118,190,.13); border-color: var(--blue); }
.stock-form-grid label > small { display: block; margin-top: 6px; color: var(--muted); font-weight: 400; line-height: 1.35; }
.stock-form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 25px; }
.stock-state-card { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 24px 28px; background: #f8fafc; border-top: 1px solid var(--line); }
.stock-state-card h2 { margin: 6px 0; font-size: 22px; }
.stock-state-card p { color: var(--muted); margin: 0; max-width: 740px; line-height: 1.5; }
.danger-button { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 18px; border: 0; border-radius: 9px; color: #fff; background: #b4162e; font: inherit; font-weight: 900; cursor: pointer; white-space: nowrap; }
.movement-shell { overflow: hidden; }
.movement-product { display: grid; grid-template-columns: .7fr 1.8fr .7fr; gap: 1px; background: var(--line); border-bottom: 1px solid var(--line); }
.movement-product > div { min-width: 0; background: #f8fafc; padding: 20px 24px; }
.movement-product span { display: block; color: var(--muted); font-size: 11px; font-weight: 900; letter-spacing: .6px; text-transform: uppercase; }
.movement-product strong { display: block; margin-top: 7px; font-size: 17px; overflow-wrap: anywhere; }
.movement-product .movement-current { background: #eaf8f1; }
.movement-product .movement-current strong { color: #116d45; font-size: 30px; }
.movement-form { padding: 28px; }
.movement-options { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin: 12px 0 22px; }
.movement-options label { position: relative; cursor: pointer; }
.movement-options input { position: absolute; opacity: 0; pointer-events: none; }
.movement-options span { display: block; height: 100%; border: 2px solid var(--line); border-radius: 12px; padding: 18px; transition: border-color .15s ease,background .15s ease; }
.movement-options input:checked + span { border-color: var(--blue); background: #eef7fc; }
.movement-options b,.movement-options small { display: block; }
.movement-options small { color: var(--muted); margin-top: 6px; line-height: 1.35; }
.movement-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
.movement-preview { margin-top: 20px; border-left: 4px solid var(--blue); border-radius: 10px; background: #eef7fc; padding: 16px 18px; color: var(--muted); }
.movement-preview strong { color: var(--ink); font-size: 22px; margin-left: 6px; }
.movement-preview strong.is-negative { color: #b4162e; }
.history-filters label:first-child { flex: 2 1 280px; }
.history-table { min-width: 1120px; font-size: 13px; }
.history-table th,.history-table td { padding: 13px 12px; }
.history-table td:nth-child(2) { min-width: 220px; }
.history-table td:nth-child(6) { min-width: 240px; }
.quantity-change.positive { color: #117045; }
.quantity-change.negative { color: #ad142c; }
.stock-history-summary div:nth-child(2) { border-left-color: var(--green); }
.stock-history-summary div:nth-child(3) { border-left-color: #c51a32; }
@media(max-width:1250px) { .stock-summary { grid-template-columns: repeat(3,minmax(0,1fr)); } .stock-layout { grid-template-columns:1fr; } .stock-recent-card { position:static; } }
@media(max-width:900px) { .account-nav { flex-wrap:wrap; gap:8px; } .stock-summary { grid-template-columns: repeat(2,minmax(0,1fr)); } .stock-form-grid,.movement-fields,.movement-options { grid-template-columns:1fr; } .movement-product { grid-template-columns:1fr; } }
@media(max-width:620px) { .stock-summary { grid-template-columns:1fr; } .stock-catalog-card,.stock-product-form,.movement-form { padding:18px; } .stock-form-heading,.stock-state-card { align-items:stretch; flex-direction:column; } .current-stock { width:100%; } .stock-filters,.history-filters { align-items:stretch; flex-direction:column; } .stock-filters label,.stock-filters input,.stock-filters select,.stock-filters .primary-button,.stock-filters .secondary-button { width:100%; } }

/* Ubicaciones de inventario */
.stock-location-nav { display:flex; gap:10px; margin:0 0 24px; padding:6px; width:max-content; max-width:100%; border:1px solid var(--line); border-radius:14px; background:#fff; box-shadow:0 10px 24px rgba(20,32,48,.05); }
.stock-location-nav a { display:flex; flex-direction:column; min-width:210px; padding:13px 18px; border-radius:10px; color:var(--ink); text-decoration:none; }
.stock-location-nav a span { color:var(--muted); font-size:10px; font-weight:900; letter-spacing:1.2px; }
.stock-location-nav a strong { margin-top:4px; font-size:16px; }
.stock-location-nav a.active { color:#fff; background:var(--ink); }
.stock-location-nav a.active span { color:#87cff5; }
.stock-sync-note { display:flex; align-items:center; gap:10px; margin:-4px 0 20px; padding:13px 16px; border:1px solid #b9e4cc; border-radius:10px; color:#116d45; background:#e8f6ef; font-size:13px; }
.workshop-summary { grid-template-columns:repeat(4,minmax(0,1fr)); }
.workshop-category { display:inline-flex; padding:7px 10px; border-radius:999px; color:#075f91; background:#e7f4fb; font-size:11px; font-weight:900; }
.workshop-table { min-width:780px; }
.workshop-table td:nth-child(2) { min-width:340px; }
.workshop-history-table td:nth-child(6) { min-width:260px; }
@media(max-width:900px) { .workshop-summary { grid-template-columns:repeat(2,minmax(0,1fr)); } }
@media(max-width:760px) { .stock-location-nav { width:100%; flex-wrap:wrap; } .stock-location-nav a { flex:1 1 180px; min-width:0; padding:12px; } }
@media(max-width:620px) { .dashboard-stock-overview .section-head { align-items:stretch; flex-direction:column; } .workshop-summary { grid-template-columns:1fr; } }

/* Estados de cuenta de proveedores */
.account-balance-summary { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:16px; margin-bottom:24px; }
.account-balance-summary article { padding:20px 22px; border:1px solid var(--line); border-left:4px solid var(--blue); border-radius:14px; background:#fff; box-shadow:0 12px 28px rgba(20,32,48,.06); }
.account-balance-summary span { display:block; color:var(--muted); font-size:11px; font-weight:900; letter-spacing:.8px; text-transform:uppercase; }
.account-balance-summary strong { display:block; margin-top:8px; font-size:24px; }
.credit-balance { color:var(--green); }
.account-forms-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:20px; margin-bottom:24px; }
.account-form { display:grid; gap:12px; }
.account-form label { color:#3d4652; font-size:13px; font-weight:900; }
.account-form input,.account-form select { width:100%; min-height:48px; margin-top:7px; padding:0 13px; border:1px solid #cbd3dc; border-radius:9px; background:#fff; color:var(--ink); font:inherit; }
.account-form input:focus,.account-form select:focus { outline:3px solid rgba(0,118,190,.13); border-color:var(--blue); }
.account-form-row { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.account-form-row.compact { grid-template-columns:.65fr 1fr 1.35fr; }
.account-balance-summary { display:none; }
.account-page-actions { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:10px; }
.account-page-actions button:disabled { cursor:not-allowed; opacity:.48; }
.account-dialog { width:min(760px,calc(100% - 32px)); max-height:calc(100vh - 32px); padding:0; border:0; border-radius:18px; background:transparent; overflow:auto; box-shadow:0 28px 80px rgba(10,21,34,.32); }
.account-dialog::backdrop { background:rgba(13,23,35,.62); backdrop-filter:blur(3px); }
.account-dialog .form-card { position:relative; border:0; border-radius:18px; box-shadow:none; }
.dialog-close { position:absolute; top:16px; right:16px; width:40px; height:40px; border:0; border-radius:50%; background:#eef2f6; color:var(--ink); font-size:28px; line-height:1; cursor:pointer; }
.dialog-close:hover { background:#dfe6ed; }
body.account-dialog-ready .account-forms-grid { display:none; }
body:has(.account-dialog[open]) { overflow:hidden; }
.account-providers-card,.account-statement-card { margin-top:24px; }
.account-providers-table { min-width:1050px; }
.account-providers-table td small,.account-movements-table td small { display:block; margin-top:5px; color:var(--muted); }
.account-providers-table tr.selected-row td { background:#eef7fc; }
.account-amount { white-space:nowrap; }
.account-statement-head { display:flex; align-items:flex-end; justify-content:space-between; gap:24px; margin-bottom:22px; }
.account-statement-head h2 { margin:7px 0; }
.account-statement-head p { margin:0; color:var(--muted); }
.statement-balances { display:flex; gap:12px; }
.statement-balances span { min-width:180px; padding:13px 16px; border:1px solid var(--line); border-left:4px solid var(--blue); border-radius:10px; background:#f8fafc; color:var(--muted); font-size:11px; font-weight:900; text-transform:uppercase; }
.statement-balances strong { display:block; margin-top:6px; color:var(--ink); font-size:18px; }
.account-movements-table { min-width:1250px; font-size:13px; }
.account-movements-table td:nth-child(4) { min-width:220px; }
.account-movements-table td:nth-child(5),.account-movements-table td:nth-child(6),.account-movements-table td:nth-child(7) { white-space:nowrap; }
@media(max-width:1000px) { .account-forms-grid { grid-template-columns:1fr; } .account-statement-head { align-items:stretch; flex-direction:column; } }
@media(max-width:760px) { .account-balance-summary { grid-template-columns:1fr; } .account-form-row,.account-form-row.compact { grid-template-columns:1fr; } .statement-balances { width:100%; flex-direction:column; } .statement-balances span { min-width:0; } .account-page-actions { width:100%; } .account-page-actions .primary-button,.account-page-actions .secondary-button { flex:1 1 220px; } .account-dialog .form-card { padding:22px 18px; } }

/* Conciliación de ventas */
.sales-card { padding-top:20px; }
.sales-filters { display:flex; align-items:end; gap:12px; margin-bottom:20px; }
.sales-filters label { flex:1 1 220px; color:#3d4652; font-size:12px; font-weight:900; }
.sales-filters label:first-child { flex:2 1 360px; }
.sales-filters input,.sales-filters select { width:100%; min-height:46px; margin-top:7px; padding:0 13px; border:1px solid #cbd3dc; border-radius:9px; background:#fff; font:inherit; }
.sales-table { min-width:1180px; font-size:13px; }
.sales-table td small { display:block; margin-top:5px; color:var(--muted); }
.sales-linked,.sales-pending { display:inline-flex; padding:7px 10px; border-radius:999px; font-size:11px; font-weight:900; }
.sales-linked { color:#087244; background:#e5f5ec; }
.sales-pending { color:#9a5c00; background:#fff1d5; }
.sales-dialog-amount { margin:-10px 0 20px; color:var(--muted); font-weight:800; }
@media(max-width:760px) { .sales-filters { align-items:stretch; flex-direction:column; } .sales-filters label,.sales-filters .primary-button,.sales-filters .secondary-button { width:100%; } }
