:root {
  color-scheme: light;
  --bg: #f6f2eb;
  --surface: #fffdf9;
  --surface-2: #f0e9dd;
  --surface-3: #e8dece;
  --text: #241c14;
  --muted: #74685b;
  --line: #dfd4c5;
  --line-strong: #cdbda9;
  --brand: #d68425;
  --brand-strong: #a95e12;
  --brand-soft: #fff0dc;
  --green: #227a55;
  --green-soft: #e5f5ed;
  --red: #b33d34;
  --red-soft: #fdecea;
  --blue: #376fa8;
  --shadow: 0 12px 32px rgba(73, 49, 23, .08);
  --shadow-small: 0 5px 16px rgba(73, 49, 23, .07);
  --radius: 18px;
  --radius-small: 11px;
  --topbar-height: 82px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #151411;
  --surface: #201e1a;
  --surface-2: #2a2721;
  --surface-3: #353027;
  --text: #f5eee4;
  --muted: #b7ac9c;
  --line: #3b352c;
  --line-strong: #524a3e;
  --brand: #efa545;
  --brand-strong: #ffc66f;
  --brand-soft: #3c2b18;
  --green: #6dcc9e;
  --green-soft: #18372a;
  --red: #f18a81;
  --red-soft: #43201d;
  --blue: #79b0e7;
  --shadow: 0 16px 42px rgba(0, 0, 0, .25);
  --shadow-small: 0 7px 18px rgba(0, 0, 0, .2);
}

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 15px; line-height: 1.45; }
button, input, select, textarea { font: inherit; color: inherit; }
button { border: 0; cursor: pointer; }
button:disabled { cursor: wait; opacity: .58; }
input, select, textarea { min-height: 43px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 9px 11px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
button:not(.nav-button,.icon-button,.theme-button,.text-button,.workspace-tabs button,.bottom-nav button,.quick-grid button) { min-height: 42px; padding: 10px 16px; border-radius: 10px; background: var(--brand); color: #211307; font-weight: 750; box-shadow: var(--shadow-small); }
button:not(.nav-button,.icon-button,.theme-button,.text-button,.workspace-tabs button,.bottom-nav button,.quick-grid button):hover { filter: brightness(.97); transform: translateY(-1px); }
button.secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); box-shadow: none; }
button.danger { background: var(--red-soft); color: var(--red); border: 1px solid color-mix(in srgb,var(--red) 30%,var(--line)); box-shadow: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); margin: .35rem 0; }
.small { font-size: .83rem; }
.eyebrow { margin: 0 0 4px; color: var(--brand-strong); font-size: .72rem; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
h1,h2,h3,p,li,dd,dt,label,small { overflow-wrap: anywhere; }
h1,h2,h3 { margin: 0; line-height: 1.16; }
h1 { font-size: clamp(1.35rem,2.2vw,1.75rem); }
h2 { font-size: clamp(1.35rem,2vw,1.8rem); }
h3 { font-size: 1.02rem; }

.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 22px; background: radial-gradient(circle at 75% 10%, color-mix(in srgb,var(--brand) 16%, transparent), transparent 30%), radial-gradient(circle at 5% 95%, color-mix(in srgb,var(--brand) 10%, transparent), transparent 32%), var(--bg); }
.login-card { position: relative; width: min(100%, 430px); padding: 42px; text-align: center; border: 1px solid var(--line); border-radius: 28px; background: color-mix(in srgb,var(--surface) 94%,transparent); box-shadow: var(--shadow); backdrop-filter: blur(16px); }
.login-card img { border-radius: 22px; box-shadow: var(--shadow-small); margin-bottom: 18px; }
.login-card > .eyebrow { font-size: .62rem; letter-spacing: .1em; }
.login-card h1 { margin-top: 4px; font-size: clamp(2.15rem,8vw,2.8rem); letter-spacing: -.04em; }
.login-card > .muted { max-width: 315px; margin: 7px auto 0; font-size: .82rem; }
.login-card form { text-align: left; margin-top: 20px; }
.login-card label, .stack-form label, .form-grid label { display: grid; gap: 6px; color: var(--muted); font-size: .78rem; font-weight: 700; }
.pin-display { width: 100%; margin-top: 7px; text-align: center; font-size: 1.45rem; font-weight: 800; letter-spacing: .58em; padding-left: calc(11px + .58em); caret-color: transparent; user-select: none; }
.pin-keypad { display: grid; grid-template-columns: repeat(3,1fr); gap: 9px; margin-top: 12px; }
.pin-keypad button { min-height: 48px !important; padding: 8px !important; border: 1px solid var(--line) !important; border-radius: 12px !important; background: var(--surface-2) !important; color: var(--text) !important; box-shadow: none !important; font-size: 1.05rem; }
.pin-keypad button:hover,.pin-keypad button:focus-visible { background: var(--brand-soft) !important; color: var(--brand-strong) !important; transform: none !important; }
.pin-keypad .pin-key-action { font-size: .75rem; font-weight: 800; }
.pin-open { width: 100%; margin-top: 11px; }
.login-card small { display: block; margin-top: 26px; color: var(--muted); }
.login-theme { position: absolute; right: 18px; top: 18px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 244px minmax(0,1fr); }
.sidebar-backdrop { display: none; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 24px 18px; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; z-index: 40; }
.brand { display: flex; align-items: center; gap: 11px; padding: 0 7px 24px; }
.brand img { border-radius: 12px; }
.brand span { display: grid; line-height: 1.15; }
.brand b { font-size: 1.12rem; letter-spacing: -.02em; }
.brand small { color: var(--muted); margin-top: 3px; }
.sidebar-close { display: none; margin-left: auto; }
.sidebar nav { display: grid; gap: 5px; }
.nav-button { width: 100%; min-height: 45px; display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 11px; background: transparent; color: var(--muted); text-align: left; font-weight: 700; }
.nav-button span { width: 24px; font-size: 1.05rem; text-align: center; }
.nav-button:hover { background: var(--surface-2); color: var(--text); }
.nav-button.active { background: var(--brand-soft); color: var(--brand-strong); }
.sidebar-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.version-chip,.soft-chip,.dirty-chip { display: inline-flex; align-items: center; min-height: 28px; padding: 4px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: .72rem; font-weight: 800; white-space: nowrap; }
.version-chip { background: var(--brand-soft); color: var(--brand-strong); }
.dirty-chip:not(:empty) { background: var(--brand-soft); color: var(--brand-strong); }
.text-button { background: transparent; color: var(--brand-strong); padding: 5px; font-weight: 750; }

.workspace { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 30; height: var(--topbar-height); display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px clamp(18px,3vw,38px); background: color-mix(in srgb,var(--bg) 88%,transparent); border-bottom: 1px solid color-mix(in srgb,var(--line) 65%,transparent); backdrop-filter: blur(16px); }
.topbar > div:nth-child(2) { margin-right: auto; }
.topbar.compact-title #page-title { font-size: 1.12rem; letter-spacing: -.01em; }
.top-actions { display: flex; gap: 8px; }
.icon-button,.theme-button { width: 42px; height: 42px; border-radius: 50%; background: var(--surface); color: var(--text); border: 1px solid var(--line); display: grid; place-items: center; box-shadow: var(--shadow-small); font-size: 1.1rem; }
.menu-button { display: none; }
main { padding: 28px clamp(16px,3vw,38px) 80px; max-width: 1640px; margin: 0 auto; }
.view { animation: view-in .22s ease both; }
@keyframes view-in { from { opacity: 0; transform: translateY(5px); } }

.card,.sheet-card,.hero-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-small); }
.card { padding: 22px; }
.hero-card { min-height: 170px; padding: clamp(24px,4vw,42px); display: flex; align-items: center; justify-content: space-between; gap: 24px; background: linear-gradient(135deg, var(--surface), color-mix(in srgb,var(--brand-soft) 72%,var(--surface))); }
.hero-card h2 { max-width: 620px; }
.hero-card .muted { max-width: 680px; margin-top: 10px; }
.hero-actions,.page-actions,.sheet-module-heading > div:last-child { display: flex; gap: 9px; flex-wrap: wrap; }
.stat-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; margin: 16px 0; }
.stat-card { min-width: 0; min-height: 130px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-small); display: flex; flex-direction: column; }
.stat-card span { color: var(--muted); font-size: .78rem; font-weight: 750; }
.stat-card strong { display: block; margin: auto 0 2px; font-size: clamp(1.45rem,2.7vw,2.15rem); }
.stat-card small { color: var(--muted); }
.stat-card.warn { border-color: color-mix(in srgb,var(--brand) 38%,var(--line)); }
.two-column { display: grid; grid-template-columns: minmax(0,1.15fr) minmax(0,.85fr); gap: 16px; margin-top: 16px; }
.wide-left { grid-template-columns: minmax(0,1.35fr) minmax(280px,.65fr); }
.card-heading,.page-intro,.sheet-module-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.card-heading > *,.page-intro > *,.sheet-module-heading > *,.modal-shell > *,.vendor-card > * { min-width: 0; max-width: 100%; }
.card-heading { margin-bottom: 14px; }
.page-intro { margin-bottom: 20px; }
.page-intro > div:first-child { max-width: 760px; }
.page-intro .muted { margin-top: 6px; }
.usage-card { margin-top: 16px; }
.usage-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; }
.usage-meter { padding: 13px; border-radius: 12px; background: var(--surface-2); }
.usage-meter span,.usage-meter small { display: block; color: var(--muted); font-size: .74rem; }
.usage-meter b { display: block; margin: 5px 0; }
.meter-track { height: 6px; overflow: hidden; border-radius: 999px; background: var(--line); }
.meter-track i { display: block; height: 100%; background: var(--brand); border-radius: inherit; }
.quick-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 9px; }
.quick-grid button { min-height: 78px; display: grid; place-items: center; gap: 4px; padding: 11px 5px; border-radius: 12px; background: var(--surface-2); color: var(--text); font-weight: 730; }
.quick-grid button:hover { background: var(--brand-soft); color: var(--brand-strong); }

.record-list { display: grid; gap: 9px; }
.record-row { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 12px; background: color-mix(in srgb,var(--surface) 82%,var(--surface-2)); }
.record-row > * { min-width: 0; max-width: 100%; }
.record-row > span:first-child,.record-row .record-main { min-width: 0; display: grid; }
.record-row b,.record-row small,.record-row span { overflow-wrap: anywhere; word-break: normal; white-space: normal; }
.record-row small { color: var(--muted); margin-top: 2px; }
.record-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; flex-wrap: wrap; }
.record-actions button { min-height: 34px !important; padding: 6px 10px !important; font-size: .78rem; }
.record-list.dense .record-row { padding: 10px 12px; }
.amount-credit { color: var(--green); }
.amount-debit { color: var(--red); }
.amount-credit,.amount-debit,.record-actions > b { white-space: nowrap !important; overflow-wrap: normal !important; }
.status { min-height: 20px; margin: 6px 0 0; color: var(--muted); font-size: .84rem; }
.status.success { color: var(--green); }
.status.error { color: var(--red); }

.upload-card { min-height: 355px; }
.drop-zone { min-height: 305px; border: 1.5px dashed var(--line-strong); border-radius: 16px; display: grid; place-items: center; align-content: center; gap: 8px; padding: 24px; text-align: center; background: var(--surface-2); }
.drop-zone.dragging { border-color: var(--brand); background: var(--brand-soft); }
.drop-zone input { display: none; }
.drop-icon { font-size: 2.3rem; color: var(--brand-strong); }
.stack-form { display: grid; gap: 13px; margin-top: 18px; }
.progress-box { display: grid; gap: 7px; margin-top: 16px; }
.progress-track { height: 9px; overflow: hidden; border-radius: 999px; background: var(--surface-3); }
.progress-track span { display: block; width: 0; height: 100%; background: var(--brand); transition: width .2s; }

.sheet-card { overflow: visible; border-radius: 14px; box-shadow: none; }
.sheet-page-intro { align-items: flex-end; }
.sheet-commandbar { display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-height: 46px; padding: 6px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); overflow-x: auto; }
.sheet-commandbar .soft-chip { margin-right: auto; }
.mobile-label { display: none; }
.sheet-toolbar,.sheet-actionbar,.sheet-footer { display: flex; align-items: center; gap: 9px; padding: 12px 14px; background: var(--surface); }
.sheet-toolbar { flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.sheet-toolbar { position: static; }
.sheet-toolbar input[type="search"] { min-width: min(340px,100%); flex: 1; }
.sheet-actionbar { border-bottom: 1px solid var(--line); background: var(--surface-2); }
.sheet-actionbar span { margin-left: auto; color: var(--muted); font-size: .77rem; }
.sheet-footer { justify-content: space-between; border-top: 1px solid var(--line); }
.floating-save { position: fixed; right: clamp(18px,3vw,38px); bottom: 26px; z-index: 36; min-width: 112px; border: 1px solid color-mix(in srgb,var(--brand-strong) 35%,transparent) !important; box-shadow: 0 12px 30px color-mix(in srgb,var(--brand) 30%,transparent) !important; }
.small-button { min-height: 34px !important; padding: 6px 10px !important; font-size: .78rem; box-shadow: none !important; }
.sheet-scroll { width: 100%; overflow-x: auto; overflow-y: visible; overscroll-behavior-x: contain; touch-action: pan-x pan-y; max-height: none; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); scrollbar-gutter: stable; }
.data-sheet { width: 100%; min-width: 1280px; border-collapse: separate; border-spacing: 0; font-size: .82rem; }
.data-sheet th { position: static; padding: 10px 9px; text-align: left; background: var(--surface-3); color: var(--muted); border-right: 1px solid var(--line); border-bottom: 1px solid var(--line-strong); box-shadow: 0 1px 0 var(--line-strong); font-size: .72rem; line-height: 1.2; text-transform: uppercase; letter-spacing: .04em; white-space: normal; overflow-wrap: anywhere; word-break: normal; }
.data-sheet td { height: 42px; padding: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface); vertical-align: middle; overflow-wrap: anywhere; word-break: normal; }
.data-sheet tbody tr:nth-child(even) td { background: color-mix(in srgb,var(--surface) 86%,var(--surface-2)); }
.data-sheet tbody tr.selected td { background: var(--brand-soft); }
.data-sheet tbody tr.dirty td:first-child { box-shadow: inset 4px 0 var(--brand); }
.data-sheet input,.data-sheet select { width: 100%; min-width: 0; max-width: 100%; min-height: 40px; border: 0; border-radius: 0; background: transparent; padding: 7px 9px; box-shadow: none; text-overflow: ellipsis; }
.data-sheet input:focus,.data-sheet select:focus { position: relative; z-index: 2; outline: 2px solid var(--brand); outline-offset: -2px; background: var(--surface); }
.data-sheet .readonly-cell { padding: 7px 9px; line-height: 1.25; white-space: normal; overflow: hidden; overflow-wrap: anywhere; word-break: normal; }
.data-sheet .check-cell { width: 44px; text-align: center; }
.data-sheet .check-cell input { width: 17px; min-height: 17px; }
.data-sheet .product-cell { min-width: 310px; }
.data-sheet .brand-cell { min-width: 150px; }
.data-sheet .category-cell { min-width: 145px; }
.data-sheet .money-cell { min-width: 102px; }
.data-sheet .number-cell { min-width: 82px; }
.data-sheet .money-cell,.data-sheet .number-cell,.data-sheet .check-cell,.data-sheet .history-cell { white-space: nowrap; overflow-wrap: normal; }
.data-sheet .history-cell button,.data-sheet .remove-row { width: 100%; min-height: 40px !important; padding: 5px !important; border-radius: 0 !important; background: transparent !important; color: var(--brand-strong) !important; box-shadow: none !important; }
.data-sheet .remove-row { color: var(--red) !important; }
.price-sheet { min-width: 1420px; }
.price-sheet td.current { padding: 8px; background: var(--surface-2) !important; color: var(--muted); }
.price-sheet td.changed { background: var(--brand-soft) !important; }
.validation-box { margin: 12px 14px; padding: 10px 12px; border-radius: 10px; background: var(--green-soft); color: var(--green); font-size: .82rem; }
.validation-box.error { background: var(--red-soft); color: var(--red); }

.purchase-module-menu { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; }
.purchase-module-menu button { min-height: 150px !important; display: grid; place-items: center; align-content: center; gap: 10px; padding: 20px !important; border: 1px solid var(--line) !important; border-radius: var(--radius) !important; background: var(--surface) !important; color: var(--text) !important; box-shadow: var(--shadow-small) !important; }
.purchase-module-menu button:hover,.purchase-module-menu button:focus-visible { border-color: var(--brand) !important; background: var(--brand-soft) !important; color: var(--brand-strong) !important; transform: translateY(-2px) !important; }
.purchase-module-menu button span { font-size: 2rem; }
.purchase-module-menu button b { font-size: 1.05rem; }
.sheet-module-heading { padding: 17px 16px; border-bottom: 1px solid var(--line); }
.sheet-module-heading .muted { font-size: .82rem; }
.purchase-panel .sheet-actionbar { position: static; }
.order-sheet { min-width: 760px; }
.receive-sheet { min-width: 1500px; }
.section-divider { height: 1px; background: var(--line); margin: 12px 0 18px; }
.purchase-panel > .card-heading,.purchase-panel > .record-list { margin-left: 15px; margin-right: 15px; }
.purchase-panel > .record-list { margin-bottom: 18px; }
.receive-setup-bar { display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 6px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.receive-setup-bar button { flex: 0 0 auto; }
.receive-setup-bar span { min-width: 0; margin: 0; font-size: .78rem; overflow-wrap: anywhere; }
.assignment-list { display: grid; gap: 9px; }
.assignment-row { display: grid; grid-template-columns: minmax(0,1fr) minmax(150px,.7fr) minmax(110px,.42fr); align-items: center; }
.assignment-row select,.assignment-row input { width: 100%; min-width: 0; }

.conflict-card { margin-top: 16px; }
.conflict-list { display: grid; gap: 8px; }
.conflict-row { display: grid; grid-template-columns: minmax(180px,1.2fr) minmax(100px,.45fr) minmax(120px,.7fr) minmax(120px,.7fr); gap: 10px; align-items: center; padding: 11px 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); font-size: .8rem; }
.conflict-row span { min-width: 0; overflow-wrap: anywhere; }
.conflict-row .conflict-old { color: var(--red); text-decoration: line-through; text-decoration-thickness: 1px; }
.conflict-row .conflict-new { color: var(--green); font-weight: 780; }
.import-summary { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 9px; margin-bottom: 12px; }
.import-summary div { padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); }
.import-summary b,.import-summary span { display: block; }
.import-summary b { font-size: 1.2rem; }
.import-summary span { color: var(--muted); font-size: .72rem; }

.vendor-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; }
.vendor-card { padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
.vendor-card header { display: flex; justify-content: space-between; gap: 10px; }
.vendor-card dl { display: grid; grid-template-columns: auto 1fr; gap: 7px 10px; margin: 16px 0 0; font-size: .8rem; }
.vendor-card dt { color: var(--muted); }
.vendor-card dd { min-width: 0; margin: 0; text-align: right; overflow-wrap: anywhere; }
.account-stats { grid-template-columns: repeat(4,minmax(0,1fr)); }
.account-updated { margin: -6px 2px 14px; font-size: .72rem; text-align: right; }
.running-balance { display: block; margin-top: 5px; color: var(--text) !important; font-size: .72rem !important; }
.running-balance b { color: var(--brand-strong); }
.sheet-fetch-choices { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.sheet-fetch-choices article { padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.sheet-fetch-choices b { font-size: 1rem; }
.sheet-fetch-choices p { margin: 7px 0 0; color: var(--muted); font-size: .8rem; line-height: 1.45; }
.account-module-menu { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.account-module-menu button { min-height: 170px !important; display: grid; place-items: center; align-content: center; gap: 8px; padding: 22px !important; border: 1px solid var(--line) !important; border-radius: var(--radius) !important; background: var(--surface) !important; color: var(--text) !important; box-shadow: var(--shadow-small) !important; text-align: center; }
.account-module-menu button:hover,.account-module-menu button:focus-visible { border-color: var(--brand) !important; background: var(--brand-soft) !important; color: var(--brand-strong) !important; transform: translateY(-2px) !important; }
.account-module-menu button > span { font-size: 2rem; }
.account-module-menu button b { font-size: 1.08rem; }
.account-module-menu button small { max-width: 280px; color: var(--muted); font-weight: 650; }
.account-panel { min-height: 360px; }
.sync-summary { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 8px; margin-bottom: 14px; }
.sync-summary div { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); }
.sync-summary b,.sync-summary span { display: block; }
.sync-summary b { font-size: 1.25rem; }
.sync-summary span { margin-top: 2px; color: var(--muted); font-size: .7rem; }
.sheet-sync-preview { max-height: 330px; margin-top: 14px; overflow: auto; }
.reconciliation-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; margin-bottom: 14px; }
.reconciliation-grid > div { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); }
.reconciliation-grid span,.reconciliation-grid b { display: block; overflow-wrap: anywhere; }
.reconciliation-grid span { color: var(--muted); font-size: .72rem; }
.reconciliation-grid b { margin-top: 4px; font-size: 1.05rem; }
.modal-section-title { margin: 18px 0 2px; font-size: .95rem; }
.filter-row { display: flex; gap: 9px; margin-bottom: 15px; }
.filter-row input { flex: 1; }

.modal { width: min(94vw,680px); max-height: 90vh; padding: 0; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); color: var(--text); box-shadow: 0 30px 100px rgba(0,0,0,.32); }
.modal::backdrop { background: rgba(14,10,6,.58); backdrop-filter: blur(5px); }
.wide-modal { width: min(96vw,920px); }
.modal-shell { display: flex; flex-direction: column; max-height: 90vh; margin: 0; overflow: hidden; }
.modal-shell > header { display: flex; justify-content: space-between; gap: 15px; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.modal-shell > footer { display: flex; justify-content: flex-end; gap: 9px; padding: 14px 20px; border-top: 1px solid var(--line); }
#form-dialog-body { min-height: 0; padding: 20px; overflow: auto; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 13px; }
.form-grid > * { min-width: 0; }
.form-grid input,.form-grid select,.form-grid textarea { width: 100%; min-width: 0; }
.form-grid .wide { grid-column: 1 / -1; }
.form-grid textarea { min-height: 90px; resize: vertical; }
.document-preview { padding: 25px; overflow: auto; background: #d9d3ca; color: #211b15; }
.paper { width: min(100%,780px); min-height: 780px; margin: 0 auto; padding: 36px; background: #fff; color: #211b15; box-shadow: 0 10px 28px rgba(0,0,0,.15); }
.paper header { display: flex; justify-content: space-between; gap: 20px; padding-bottom: 18px; border-bottom: 2px solid #d68425; }
.paper header .paper-store { font-size: 1.45rem; letter-spacing: -.03em; }
.paper header h2 { font-size: 1.08rem; }
.paper table { width: 100%; margin-top: 22px; border-collapse: collapse; font-size: 12px; }
.paper th,.paper td { padding: 8px; border: 1px solid #d8d1c8; text-align: left; white-space: normal; overflow-wrap: anywhere; word-break: normal; }
.paper th { background: #f3eee7; }
.paper .paper-total { text-align: right; font-weight: 800; }
.account-paper { padding: 0; overflow: hidden; font-family: Inter,ui-sans-serif,system-ui,sans-serif; }
.account-paper .report-masthead { display: grid; grid-template-columns: 1fr auto; gap: 14px; padding: 28px 32px 22px; background: #d68425; color: #fff; border: 0; }
.account-paper .report-store { font-size: 1.8rem; font-weight: 900; letter-spacing: -.04em; }
.account-paper .report-heading { align-self: start; font-size: .9rem; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.account-paper .report-meta { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 12px; color: rgba(255,255,255,.9); font-size: .72rem; }
.account-paper .report-body { padding: 24px 30px 30px; }
.report-summary-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 8px; }
.report-summary-card { min-width: 0; padding: 11px; border: 1px solid #e2c79f; border-radius: 7px; background: #fcf8f1; }
.report-summary-card span,.report-summary-card b { display: block; }
.report-summary-card span { color: #75695c; font-size: .61rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.report-summary-card b { margin-top: 5px; color: #211b15; font-size: .88rem; overflow-wrap: anywhere; }
.report-summary-card.credit b { color: #227a55; }
.report-summary-card.debit b { color: #b33d34; }
.report-period { display: flex; justify-content: space-between; gap: 12px; margin: 17px 0 9px; color: #75695c; font-size: .72rem; }
.account-paper table { margin-top: 0; border: 0; }
.account-paper th { padding: 8px 7px; border-color: #2d251d; background: #2d251d; color: #fff; font-size: .62rem; text-transform: uppercase; letter-spacing: .04em; }
.account-paper td { padding: 7px; border-width: 0 0 1px; border-color: #ebe4da; font-size: .67rem; }
.account-paper tbody tr:nth-child(even) { background: #fbf8f3; }
.account-paper .report-status { font-weight: 800; color: #227a55; }
.account-paper .report-status.pending { color: #b27512; }
.account-paper .report-amount { text-align: right; font-weight: 850; white-space: nowrap; }
.account-paper .report-amount.credit { color: #227a55; }
.account-paper .report-amount.debit { color: #b33d34; }
.account-paper .report-empty { padding: 30px; text-align: center; color: #75695c; }
.large-search { margin: 16px 20px 0; width: calc(100% - 40px); font-size: 1rem; }
.search-results { padding: 14px 20px 20px; overflow: auto; }
.search-result-row { appearance: none; width: 100%; height: auto !important; min-height: 68px !important; display: grid !important; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 12px; padding: 12px 14px !important; border: 1px solid var(--line) !important; border-radius: 12px !important; background: color-mix(in srgb,var(--surface) 82%,var(--surface-2)) !important; color: var(--text) !important; box-shadow: none !important; text-align: left; white-space: normal; overflow: hidden; }
.search-result-row:hover,.search-result-row:focus-visible { background: var(--brand-soft) !important; color: var(--text) !important; filter: none !important; transform: none !important; }
.search-result-main { min-width: 0; display: grid; gap: 3px; }
.search-result-main b,.search-result-main small { display: block; max-width: 100%; overflow-wrap: anywhere; word-break: normal; white-space: normal; }
.search-result-main b { line-height: 1.28; }
.search-result-main small { color: var(--muted); font-size: .75rem; font-weight: 650; }
.search-result-stock { min-width: 48px; display: grid; justify-items: end; align-content: center; }
.search-result-stock small { color: var(--muted); font-size: .62rem; font-weight: 750; text-transform: uppercase; letter-spacing: .05em; }
.search-result-stock b { font-size: .95rem; white-space: nowrap; }
.cash-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 9px; }
.cash-denom { padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.cash-denom b { display: block; }
.cash-denom input { width: 100%; margin-top: 5px; }
.cash-summary { display: grid; grid-template-columns: repeat(3,1fr); gap: 9px; margin-top: 13px; }
.cash-summary div { padding: 12px; border-radius: 10px; background: var(--surface-2); }
.cash-summary span,.cash-summary strong { display: block; }
.cash-summary span { color: var(--muted); font-size: .72rem; }
.report-presets { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; }
.report-presets button { min-height: 38px !important; padding: 7px 8px !important; font-size: .75rem; }

.loading-layer { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; align-content: center; gap: 12px; background: color-mix(in srgb,var(--bg) 70%,transparent); backdrop-filter: blur(4px); }
.loader { width: 42px; height: 42px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--brand); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; right: 22px; bottom: 24px; z-index: 110; max-width: min(420px,calc(100vw - 40px)); padding: 13px 16px; border-radius: 12px; background: var(--text); color: var(--surface); box-shadow: var(--shadow); font-weight: 700; }
.bottom-nav { display: none; }

@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 1fr; }
  body.nav-open { overflow: hidden; overscroll-behavior: none; }
  body.nav-open .workspace,body.nav-open .bottom-nav { pointer-events: none; user-select: none; }
  .sidebar-backdrop,.sidebar-backdrop:hover { position: fixed; inset: 0; z-index: 45; display: block; width: 100%; min-height: 100vh !important; padding: 0 !important; border: 0 !important; border-radius: 0 !important; background: rgba(14,10,6,.56) !important; box-shadow: none !important; filter: none !important; transform: none !important; opacity: 0; visibility: hidden; pointer-events: none; touch-action: none; transition: opacity .22s ease,visibility .22s ease; }
  .sidebar-backdrop.open { opacity: 1; visibility: visible; pointer-events: auto; }
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-105%); width: min(280px,88vw); overflow-y: auto; transition: transform .22s ease; box-shadow: var(--shadow); z-index: 50; touch-action: auto; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: grid; width: 36px; height: 36px; box-shadow: none; }
  .menu-button { display: grid; }
  .stat-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .usage-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .vendor-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (max-width: 760px) {
  :root { --topbar-height: 60px; --radius: 14px; }
  body { font-size: 14px; }
  .topbar { padding: 7px 9px; }
  .topbar .eyebrow { display: none; }
  .topbar #page-title,.topbar.compact-title #page-title { font-size: 1rem; line-height: 1.1; }
  .top-actions { gap: 5px; }
  .icon-button,.theme-button { width: 36px; height: 36px; }
  main { padding: 8px 7px 84px; }
  .hero-card { min-height: 0; padding: 24px 19px; display: grid; }
  .hero-actions { width: 100%; }
  .hero-actions button { flex: 1; }
  .stat-grid,.account-stats { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
  .stat-card { min-height: 108px; padding: 14px; }
  .two-column,.wide-left { grid-template-columns: 1fr; }
  .page-intro,.sheet-page-intro { align-items: flex-start; flex-direction: column; margin-bottom: 12px; }
  .page-intro .muted { font-size: .78rem; }
  .page-actions { width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .page-actions button { flex: 0 0 auto; }
  .sheet-card { border-radius: 11px; }
  .sheet-commandbar { min-height: 42px; padding: 4px 7px; justify-content: flex-start; }
  .sheet-commandbar > * { flex: 0 0 auto; }
  .sheet-commandbar .soft-chip { margin-right: 0; }
  .floating-save { right: 10px; bottom: calc(66px + env(safe-area-inset-bottom)); min-width: 86px; min-height: 40px !important; padding: 7px 12px !important; width: auto; flex: none !important; font-size: .78rem; }
  .card { padding: 16px; }
  .quick-grid { grid-template-columns: repeat(3,1fr); }
  .usage-grid { grid-template-columns: 1fr 1fr; }
  .sheet-toolbar { align-items: stretch; gap: 6px; padding: 7px; }
  .sheet-toolbar > input,.sheet-toolbar > select,.sheet-toolbar > button { flex: 1 1 130px; min-width: 0; min-height: 38px; }
  .sheet-toolbar input[type="search"] { flex-basis: 100%; }
  .sheet-actionbar { gap: 6px; padding: 7px; overflow-x: auto; white-space: nowrap; }
  .sheet-actionbar button { flex: 0 0 auto; }
  .sheet-actionbar span { display: none; }
  .sheet-scroll { max-height: none; }
  .sheet-footer button { flex: 0 0 auto; }
  .data-sheet { font-size: .76rem; }
  .data-sheet th { padding: 7px 7px; font-size: .66rem; }
  .data-sheet td { height: 38px; }
  .data-sheet input,.data-sheet select { min-height: 37px; padding: 5px 7px; }
  .data-sheet .product-cell { width: 230px; min-width: 230px; max-width: 230px; }
  .data-sheet .brand-cell { width: 128px; min-width: 128px; max-width: 128px; }
  .data-sheet .category-cell { width: 128px; min-width: 128px; max-width: 128px; }
  .data-sheet .money-cell { min-width: 88px; }
  .data-sheet .number-cell { min-width: 66px; }
  #order-table th:first-child,#order-table td:first-child,#receive-table th:first-child,#receive-table td:first-child { width: 44px; min-width: 44px; max-width: 44px; }
  .data-sheet thead,.data-sheet tbody,.data-sheet tr,.data-sheet th,.data-sheet td { position: static !important; top: auto !important; left: auto !important; z-index: auto !important; }
  #product-table th:nth-child(2),#product-table td:nth-child(2),#order-table th:nth-child(2),#order-table td:nth-child(2),#receive-table th:nth-child(2),#receive-table td:nth-child(2),#price-table th:nth-child(1),#price-table td:nth-child(1) { box-shadow: none; }
  .purchase-module-menu { grid-template-columns: 1fr; gap: 10px; }
  .purchase-module-menu button { min-height: 90px !important; grid-template-columns: auto 1fr; justify-items: start; }
  .purchase-module-menu button span { font-size: 1.55rem; }
  .compact-sheet-heading { min-height: 48px; padding: 5px 7px; align-items: center; flex-direction: row; gap: 7px; }
  .compact-sheet-heading > div:first-child { min-width: 0; margin-right: auto; }
  .compact-sheet-heading h3 { font-size: .88rem; white-space: normal; }
  .compact-sheet-heading .muted { display: none; }
  .compact-sheet-heading > div:last-child { display: flex; width: auto; flex: 0 0 auto; gap: 5px; flex-wrap: nowrap; }
  .compact-sheet-heading > div:last-child button { min-height: 36px; padding: 6px 9px; flex: 0 0 auto; font-size: .74rem; box-shadow: none; }
  .mobile-label { display: inline; }
  .compact-sheet-heading .desktop-label { display: none; }
  .receive-setup-bar { min-height: 43px; align-items: center; flex-direction: row; gap: 7px; padding: 5px 7px; }
  .receive-setup-bar button { min-height: 34px; padding: 5px 9px; font-size: .74rem; box-shadow: none; }
  .receive-setup-bar span { white-space: normal; overflow: visible; text-overflow: clip; }
  .vendor-grid { grid-template-columns: 1fr; }
  .account-module-menu { grid-template-columns: 1fr; gap: 10px; }
  .account-module-menu button { min-height: 112px !important; }
  .account-updated { text-align: left; }
  .sheet-fetch-choices { grid-template-columns: 1fr; }
  .sync-summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .filter-row { flex-direction: column; }
  .record-row { align-items: flex-start; flex-direction: column; }
  .assignment-row { display: grid; grid-template-columns: 1fr; }
  .record-actions { width: 100%; justify-content: flex-start; }
  .bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; height: calc(60px + env(safe-area-inset-bottom)); padding: 4px 6px env(safe-area-inset-bottom); background: color-mix(in srgb,var(--surface) 94%,transparent); border-top: 1px solid var(--line); backdrop-filter: blur(18px); display: grid; grid-template-columns: repeat(5,1fr); }
  .bottom-nav button { display: grid; place-items: center; align-content: center; gap: 2px; background: transparent; color: var(--muted); font-size: 1.1rem; }
  .bottom-nav button span { font-size: .64rem; font-weight: 780; }
  .bottom-nav button.active { color: var(--brand-strong); }
  .modal { width: calc(100vw - 18px); max-height: 94vh; border-radius: 16px; }
  .modal-shell { max-height: 94vh; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
  .cash-grid { grid-template-columns: repeat(2,1fr); }
  .cash-summary { grid-template-columns: 1fr; }
  .report-presets { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .large-search { margin: 12px 12px 0; width: calc(100% - 24px); }
  .search-results { padding: 10px 12px 16px; gap: 8px; }
  .search-result-row { min-height: 64px !important; padding: 10px 11px !important; gap: 9px; }
  .search-result-main b { font-size: .86rem; }
  .paper { padding: 22px 16px; }
  .account-paper { padding: 0; }
  .account-paper .report-masthead { padding: 22px 18px 18px; }
  .account-paper .report-body { padding: 18px 14px 22px; }
  .report-summary-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .conflict-row { grid-template-columns: 1fr 1fr; }
  .conflict-row b { grid-column: 1 / -1; }
  .import-summary { grid-template-columns: 1fr 1fr 1fr; }
}

@media (max-width: 420px) {
  .login-screen { padding: 12px; }
  .login-card { padding: 26px 20px 22px; }
  .login-card img { width: 68px; height: 68px; margin-bottom: 12px; }
  .login-card h1 { font-size: 2.2rem; }
  .login-card form { margin-top: 14px; }
  .pin-keypad { gap: 7px; }
  .pin-keypad button { min-height: 44px !important; }
  .login-card small { margin-top: 16px; }
  .stat-grid,.account-stats { grid-template-columns: 1fr 1fr; }
  .stat-card strong { font-size: 1.3rem; }
  .usage-grid { grid-template-columns: 1fr; }
}

@media print {
  body > *:not(#preview-dialog) { display: none !important; }
  #preview-dialog { position: static; display: block; width: 100%; max-height: none; border: 0; }
  #preview-dialog .modal-shell > header,#preview-dialog .modal-shell > footer { display: none; }
  .document-preview { padding: 0; background: #fff; }
  .paper { width: 100%; min-height: 0; box-shadow: none; }
}
