:root {
    --primary: #2563eb;
    --secondary: #0f172a;
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --text: #172033;
    --muted: #64748b;
    --border: #e2e8f0;
    --danger: #dc2626;
    --success: #059669;
    --warning: #d97706;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .04);
    font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
    color-scheme: light;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { margin: 0; min-height: 100vh; color: var(--text); background: var(--bg); font-size: 14px; }
body.dark {
    --bg: #0b1120; --surface: #111827; --surface-2: #182235; --text: #e5e7eb;
    --muted: #94a3b8; --border: #263449; --shadow: 0 10px 30px rgba(0,0,0,.16); color-scheme: dark;
}
a { color: var(--primary); text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: 25px; margin-bottom: 4px; letter-spacing: -.02em; }
h2 { font-size: 17px; margin-bottom: 4px; }
h3 { font-size: 15px; }
p { color: var(--muted); line-height: 1.6; }
small, .muted { color: var(--muted); }
code { padding: 3px 6px; border-radius: 6px; background: var(--surface-2); color: var(--text); }
.app-icon { display: inline-block; flex: 0 0 auto; width: 18px; height: 18px; stroke-width: 2; vertical-align: -3px; }
.btn .app-icon { width: 16px; height: 16px; }
.icon-btn .app-icon, .kebab .app-icon { width: 18px; height: 18px; }
.theme-icon { display: inline-flex; align-items: center; justify-content: center; }
.theme-icon-dark { display: none; }
body.dark .theme-icon-light { display: none; }
body.dark .theme-icon-dark { display: inline-flex; }

.app-shell { display: grid; grid-template-columns: 244px minmax(0, 1fr); }
.sidebar { position: fixed; z-index: 30; inset: 0 auto 0 0; width: 244px; display: flex; flex-direction: column; padding: 20px 14px; color: #dbe4f0; background: var(--secondary); overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 11px; color: inherit; min-width: 0; }
.brand img { width: 42px; height: 42px; border-radius: 11px; object-fit: contain; background: #fff; }
.brand-mark { display: inline-grid; place-items: center; flex: 0 0 auto; width: 42px; height: 42px; border-radius: 12px; color: #fff; background: var(--primary); font-weight: 800; }
.brand span:last-child { display: grid; min-width: 0; }
.brand strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand small { color: #8392a7; font-size: 11px; margin-top: 2px; }
.nav { display: grid; gap: 3px; margin-top: 30px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 9px; color: #9eacc0; font-weight: 600; transition: .15s; }
.nav a:hover, .nav a.active { color: #fff; background: rgba(255,255,255,.09); }
.nav a.active { box-shadow: inset 3px 0 var(--primary); }
.nav a .app-icon { width: 18px; height: 18px; opacity: .92; }
.nav-label { margin: 19px 12px 6px; color: #64748b; font-size: 10px; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }
.sidebar-footer { display: grid; gap: 14px; margin-top: auto; padding-top: 25px; }
.sidebar-footer > a { display: inline-flex; align-items: center; gap: 7px; color: #9eacc0; padding: 0 8px; font-size: 12px; }
.user-chip, .user-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.user-chip { padding: 10px 7px; border-top: 1px solid rgba(255,255,255,.09); }
.user-chip > span:last-child, .user-cell > span:last-child { display: grid; min-width: 0; }
.user-chip strong, .user-cell strong { overflow: hidden; text-overflow: ellipsis; }
.user-chip small { color: #8392a7; }
.avatar { display: inline-grid; place-items: center; flex: 0 0 36px; width: 36px; height: 36px; border-radius: 50%; color: #fff; background: var(--primary); font-weight: 700; }
.main { grid-column: 2; min-width: 0; }
.topbar { position: sticky; z-index: 20; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 76px; padding: 0 28px; border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px); }
.topbar h1 { font-size: 20px; }
.topbar p { margin: 0; font-size: 12px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.page { max-width: 1540px; padding: 24px 28px 42px; margin: auto; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding: 8px 13px; border: 1px solid var(--border); border-radius: 9px; color: var(--text); background: var(--surface); font-weight: 600; transition: .15s; }
.btn:hover { border-color: color-mix(in srgb, var(--primary) 45%, var(--border)); transform: translateY(-1px); }
.btn-primary { color: #fff; border-color: var(--primary); background: var(--primary); box-shadow: 0 5px 14px color-mix(in srgb, var(--primary) 20%, transparent); }
.btn-danger { color: var(--danger); }
.btn-ghost { color: #aab7c9; border-color: rgba(255,255,255,.12); background: transparent; }
.btn-sm { min-height: 31px; padding: 5px 9px; font-size: 12px; }
.btn-lg { min-height: 46px; padding: 11px 18px; }
.btn-block { width: 100%; }
.icon-btn, .kebab { display: inline-grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 1px solid var(--border); border-radius: 9px; color: var(--text); background: var(--surface); }
.icon-btn.danger { color: var(--danger); }
.mobile-only { display: none; }

.alert { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 12px 15px; margin-bottom: 16px; border: 1px solid; border-radius: 10px; }
.alert button { border: 0; color: inherit; background: none; font-size: 20px; }
.alert-success { color: #047857; border-color: #a7f3d0; background: #ecfdf5; }
.alert-error { color: #b91c1c; border-color: #fecaca; background: #fef2f2; }
.alert-warning { color: #b45309; border-color: #fde68a; background: #fffbeb; }

.panel { padding: 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 18px; }
.panel-head p { margin: 0; font-size: 12px; }
.panel-head h2 { margin-bottom: 3px; }
.stack { display: grid; gap: 18px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.filter-bar { display: flex; align-items: end; flex-wrap: wrap; gap: 9px; }
.search-field { display: flex; align-items: center; gap: 8px; min-width: min(330px, 100%); padding: 0 11px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); }
.search-field input { width: 100%; height: 38px; padding: 0; border: 0; outline: 0; background: transparent; color: var(--text); }
.filter-bar > select, .catalog-filters select { height: 40px; padding: 0 34px 0 11px; border: 1px solid var(--border); border-radius: 9px; color: var(--text); background: var(--surface); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card { display: flex; align-items: center; gap: 14px; min-width: 0; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.stat-card > div { display: grid; min-width: 0; }
.stat-card strong { margin: 3px 0 2px; font-size: 21px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-card small { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.stat-card span:last-child { color: var(--muted); font-size: 11px; }
.stat-icon { display: inline-grid; place-items: center; flex: 0 0 43px; height: 43px; border-radius: 11px; font-size: 18px; font-weight: 700; }
.stat-icon .app-icon { width: 21px; height: 21px; stroke-width: 2.2; }
.stat-icon.blue { color: #2563eb; background: #eff6ff; }.stat-icon.amber { color: #d97706; background: #fffbeb; }.stat-icon.green { color: #059669; background: #ecfdf5; }.stat-icon.violet { color: #7c3aed; background: #f5f3ff; }
.dashboard-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.span-2 { grid-column: span 2; }.span-3 { grid-column: span 3; }
.bar-chart { display: flex; align-items: end; gap: 9px; min-height: 205px; padding-top: 20px; overflow-x: auto; }
.bar-column { display: grid; flex: 1 0 38px; justify-items: center; gap: 6px; }
.bar { position: relative; width: min(28px, 75%); min-height: 8px; border-radius: 6px 6px 2px 2px; background: color-mix(in srgb, var(--primary) 75%, white); overflow: hidden; }
.bar i { position: absolute; inset: auto 0 0; background: color-mix(in srgb, var(--success) 75%, white); }
.bar-value { display: none; font-size: 9px; }
.rank-list { display: grid; }
.rank-list > div { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 9px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.rank-list > div:last-child { border: 0; }
.rank-list span:nth-child(2) { display: grid; }
.rank { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 7px; background: var(--surface-2); font-weight: 700; }
.empty-inline, .empty-cell { padding: 25px; color: var(--muted); text-align: center; }

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 10px 12px; color: var(--muted); background: var(--surface-2); font-size: 10px; text-align: left; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.table-sub { display: block; margin-top: 3px; }
.actions { display: flex; align-items: center; gap: 6px; }
.actions form { display: inline-flex; }
.badge { display: inline-flex; align-items: center; min-height: 24px; padding: 3px 8px; border-radius: 99px; font-size: 11px; font-weight: 700; }
.badge-success { color: #047857; background: #d1fae5; }.badge-danger { color: #b91c1c; background: #fee2e2; }.badge-warning { color: #b45309; background: #fef3c7; }.badge-muted { color: var(--muted); background: var(--surface-2); }.badge-dark { color: #fff; background: #172033; }
.text-success { color: var(--success) !important; }.text-danger { color: var(--danger) !important; }

.product-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.product-card { position: relative; min-width: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; transition: .18s; }
.product-card:hover { transform: translateY(-2px); box-shadow: 0 12px 30px rgba(15,23,42,.09); }
.product-card.is-inactive { opacity: .64; }
.product-image { position: relative; height: 180px; background: var(--surface-2); }
.product-image img { width: 100%; height: 100%; object-fit: cover; }
.product-image .badge { position: absolute; top: 11px; left: 11px; }
.stock-warning { position: absolute; right: 11px; bottom: 10px; padding: 4px 8px; border-radius: 7px; color: #fff; background: var(--danger); font-size: 10px; font-weight: 700; }
.product-body { padding: 15px; }
.product-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.product-heading small { text-transform: uppercase; letter-spacing: .05em; font-size: 9px; }
.product-heading h2 { margin-top: 3px; }
.kebab { width: 29px; height: 29px; border: 0; }
.product-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; padding: 13px 0; margin-top: 8px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); color: var(--muted); font-size: 11px; }
.product-meta span { display: grid; }
.product-meta b { color: var(--text); font-size: 10px; }
.product-price { display: flex; align-items: end; justify-content: space-between; gap: 10px; padding-top: 13px; }
.product-price span { display: grid; }
.product-price strong { font-size: 19px; }
.product-actions { display: flex; gap: 7px; padding: 0 15px 15px; }
.product-actions .btn { flex: 1; }
.card-menu { display: none; position: absolute; z-index: 3; top: 217px; right: 12px; width: 180px; padding: 6px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); box-shadow: 0 12px 30px rgba(15,23,42,.16); }
.card-menu.open { display: grid; }
.card-menu button { width: 100%; padding: 9px; border: 0; border-radius: 6px; color: var(--text); background: none; text-align: left; }
.card-menu button:hover { background: var(--surface-2); }

.field { display: grid; gap: 6px; color: var(--text); font-size: 12px; font-weight: 600; }
.field input, .field select, .field textarea { width: 100%; min-height: 40px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; outline: none; color: var(--text); background: var(--surface); font-weight: 400; }
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 12%, transparent); }
.field input[readonly] { color: var(--muted); background: var(--surface-2); }
.field.inline { display: flex; align-items: center; }
.field.inline input { width: auto; }
.field-error { color: var(--danger); font-size: 12px; }
.form-grid { display: grid; gap: 14px; }.form-grid.two { grid-template-columns: 1fr 1fr; }
.form-layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(300px, .75fr); gap: 18px; align-items: start; }
.dropzone { display: grid; place-items: center; min-height: 100px; padding: 15px; border: 1px dashed #94a3b8; border-radius: 10px; color: var(--muted); background: var(--surface-2); cursor: pointer; }
.dropzone input { max-width: 100%; margin-bottom: 8px; }
.dropzone span { font-weight: 700; color: var(--primary); }
.image-preview { width: 100%; height: 180px; margin-bottom: 12px; border-radius: 10px; object-fit: contain; background: var(--surface-2); }
.switch-list { display: grid; gap: 12px; margin-top: 17px; }.switch-list.horizontal { display: flex; flex-wrap: wrap; gap: 25px; margin: 0; }
.switch { display: flex; align-items: center; gap: 9px; cursor: pointer; font-weight: 600; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch span { position: relative; width: 38px; height: 21px; border-radius: 99px; background: #cbd5e1; transition: .2s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 15px; height: 15px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: .2s; }
.switch input:checked + span { background: var(--primary); }.switch input:checked + span::after { transform: translateX(17px); }
.sticky-actions { position: sticky; z-index: 10; bottom: 12px; display: flex; justify-content: flex-end; gap: 9px; padding: 12px; border: 1px solid var(--border); border-radius: 11px; background: color-mix(in srgb, var(--surface) 94%, transparent); box-shadow: 0 8px 30px rgba(15,23,42,.12); backdrop-filter: blur(10px); }

.sale-layout, .detail-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(320px, .65fr); gap: 18px; align-items: start; }
.sale-lines { display: grid; gap: 10px; }
.sale-line { display: flex; align-items: end; gap: 9px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.sale-line .grow { flex: 1; }.sale-line .qty { flex: 0 0 85px; }
.line-total { display: grid; flex: 0 0 115px; padding-bottom: 4px; }
.line-total strong { margin-top: 5px; }
.debt-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin-top: 15px; }
.debt-fields .field:last-child { grid-column: span 2; }
.sale-summary { padding: 20px; border-radius: var(--radius); color: #dce6f5; background: var(--secondary); }
.sale-summary > div { display: flex; justify-content: space-between; gap: 15px; margin-bottom: 11px; }
.sale-summary .total { align-items: center; padding-top: 14px; margin-top: 12px; border-top: 1px solid rgba(255,255,255,.16); }
.sale-summary .total strong { color: #fff; font-size: 25px; }
.detail-head { display: flex; justify-content: space-between; align-items: start; margin-bottom: 18px; }
.data-list { margin: 15px 0 0; }
.data-list > div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.data-list dt { color: var(--muted); }.data-list dd { margin: 0; font-weight: 600; text-align: right; }
.invoice-totals { display: grid; justify-content: end; gap: 8px; margin-top: 18px; }
.invoice-totals > div { display: grid; grid-template-columns: 110px 120px; text-align: right; }
.invoice-totals > div:last-child { padding-top: 10px; border-top: 1px solid var(--border); font-size: 17px; }
.wrap-actions { flex-wrap: wrap; justify-content: flex-end; }
.muted-row { opacity: .64; }
.share-box { padding: 10px; border: 1px dashed var(--border); border-radius: 9px; background: var(--surface-2); color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.share-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.btn-whatsapp-inline { color: #fff; border-color: #16a34a; background: #16a34a; }
.sale-danger { align-items: flex-start; }
.tabs { display: flex; align-items: center; gap: 5px; padding: 4px; margin-bottom: 18px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); width: max-content; max-width: 100%; overflow-x: auto; }
.tabs a { padding: 7px 12px; border-radius: 7px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.tabs a.active, .tabs a:hover { color: var(--text); background: var(--surface-2); }

.admin-split { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(270px, .5fr); gap: 18px; align-items: start; }
.permission-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 14px; margin-top: 8px; border-radius: 10px; background: var(--surface-2); }
.settings-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.danger-zone { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 18px; border-color: #fecaca; }
.danger-zone p { margin-bottom: 0; }
.module-settings { display: grid; gap: 10px; }
.module-option { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 15px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface-2); }
.module-option > span:first-child { display: grid; gap: 3px; }
.module-option.is-disabled { opacity: .48; }
.module-links { margin-top: 16px; }

.cash-sale-status { display: flex; align-items: center; gap: 9px; padding: 11px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.cash-sale-status a { margin-left: auto; font-weight: 700; }
.cash-sale-status.is-open { border-color: #a7f3d0; background: #ecfdf5; color: #047857; }
.cash-sale-status.is-closed { border-color: #fde68a; background: #fffbeb; color: #b45309; }
.live-dot { display: inline-block; flex: 0 0 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 15%, transparent); }
.is-closed .live-dot { background: var(--warning); box-shadow: 0 0 0 4px color-mix(in srgb, var(--warning) 15%, transparent); }
.pos-panel { min-width: 0; }
.pos-line .price-kind { flex: 0 0 135px; }
.pos-line .price { flex: 0 0 115px; }
.pos-line .cost { flex: 0 0 105px; }
.custom-line { border-color: color-mix(in srgb, var(--primary) 25%, var(--border)); background: color-mix(in srgb, var(--primary) 4%, var(--surface)); }
.pos-hint { padding: 12px; margin-top: 12px; border-radius: 9px; color: var(--muted); background: var(--surface-2); font-size: 12px; line-height: 1.5; }

.cash-welcome { display: grid; grid-template-columns: minmax(0, .8fr) minmax(320px, 1.2fr); gap: 40px; align-items: start; max-width: 980px; margin: 30px auto; padding: 34px; }
.cash-welcome > div h2 { font-size: 27px; }
.cash-welcome form { display: grid; gap: 15px; }
.cash-status { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.cash-status > div:first-child { display: flex; align-items: center; gap: 12px; }
.cash-status > div:first-child > span:last-child { display: grid; }
.cash-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, .5fr); gap: 18px; align-items: start; }
.denomination-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.denomination-item { display: grid; grid-template-columns: minmax(0, 1fr) 75px 105px; align-items: center; gap: 9px; padding: 10px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); }
.denomination-item > span { display: grid; }
.denomination-item input { width: 75px; min-height: 38px; padding: 7px; border: 1px solid var(--border); border-radius: 7px; color: var(--text); background: var(--surface); }
.denomination-item b { text-align: right; white-space: nowrap; }
.count-total { display: flex; align-items: center; justify-content: space-between; padding: 14px; margin-top: 10px; border-radius: 9px; color: #fff; background: var(--secondary); }
.count-total strong { font-size: 20px; }
.payment-breakdown { margin-top: 18px; }
.payment-summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.payment-summary-grid article { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.payment-summary-grid article > span { display: grid; }
.payment-summary-grid article b { white-space: nowrap; }
.product-price.product-price-stack { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; }
.product-price-stack span { padding: 9px; border-radius: 9px; background: var(--surface-2); }

.receipt-shell { min-height: 100vh; padding: 28px; color: #111827; background: #f3f4f6; font-size: 15px; }
.receipt-page { width: min(860px, 100%); margin: auto; }
.receipt-card { position: relative; min-height: 980px; padding: 58px 62px 46px; border: 1px solid #e5e7eb; border-radius: 3px; background: #fff; box-shadow: 0 18px 55px rgba(15,23,42,.08); }
.receipt-actions { display: flex; justify-content: flex-end; gap: 8px; margin: -22px 0 28px; }
.receipt-invoice-head { display: grid; grid-template-columns: minmax(0, 1fr) 190px; gap: 28px; align-items: start; }
.receipt-company { display: grid; grid-template-columns: 76px minmax(0, 1fr); align-items: center; gap: 18px; }
.receipt-logo, .receipt-company img { width: 76px !important; height: 76px !important; max-width: 76px !important; max-height: 76px !important; border-radius: 50%; object-fit: contain; }
.receipt-company h1 { margin-bottom: 12px; color: #111827; font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.receipt-company-info { display: grid; grid-template-columns: repeat(3, minmax(120px, max-content)); gap: 7px 22px; color: #1f2937; line-height: 1.45; }
.receipt-company-info span { max-width: 230px; }
.receipt-document { display: grid; justify-items: end; gap: 6px; color: #111827; text-align: right; }
.receipt-document span { color: #6b7280; font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.receipt-document strong { font-size: 20px; }
.receipt-document small { font-weight: 800; }
.receipt-rule { height: 1px; margin: 32px 0 34px; background: #d9dde3; }
.receipt-info-grid { display: grid; gap: 0; margin-bottom: 18px; }
.receipt-info-row { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(230px, 1fr); align-items: baseline; gap: 24px; padding: 9px 0; }
.receipt-info-row span { color: #111827; font-weight: 500; }
.receipt-info-row strong { color: #111827; font-weight: 800; text-align: right; }
.receipt-table { width: 100%; border-collapse: collapse; margin-top: 18px; border-top: 1px solid #cfd5dd; }
.receipt-table th { padding: 12px 0 10px; border-bottom: 1px solid #cfd5dd; color: #111827; background: transparent; font-size: 14px; font-weight: 800; letter-spacing: 0; text-transform: none; }
.receipt-table td { padding: 17px 0; border-bottom: 1px solid #e5e7eb; color: #111827; vertical-align: top; white-space: normal; }
.receipt-table th:first-child, .receipt-table td:first-child { width: 50%; text-align: left; }
.receipt-table th:not(:first-child), .receipt-table td:not(:first-child) { text-align: right; }
.receipt-table td:first-child strong { display: block; margin-bottom: 5px; font-weight: 500; line-height: 1.35; }
.receipt-table td:first-child small { display: block; margin-top: 2px; color: #111827; line-height: 1.35; }
.receipt-required-warning { color: #b91c1c !important; font-weight: 800; }
.receipt-payment { display: grid; gap: 0; padding-top: 22px; margin-top: 8px; border-bottom: 1px solid #d9dde3; }
.receipt-payment h2 { margin-bottom: 12px; color: #111827; font-size: 16px; font-weight: 800; }
.receipt-payment div { display: flex; justify-content: space-between; gap: 20px; padding: 9px 0; color: #1f2937; }
.receipt-payment b { font-weight: 600; }
.receipt-grand-total { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; padding-top: 42px; color: #111827; }
.receipt-grand-total span { font-size: 34px; font-weight: 800; letter-spacing: -.02em; }
.receipt-grand-total strong { font-size: 38px; font-weight: 800; letter-spacing: -.03em; }
.receipt-notes, .receipt-cancelled { margin-top: 22px; padding: 13px 15px; border-radius: 8px; background: #f8fafc; }
.receipt-cancelled { color: #991b1b; background: #fee2e2; font-weight: 700; }
.receipt-footer { margin-top: 36px; padding-top: 18px; border-top: 1px solid #eef0f3; text-align: center; }

.provider-shell { min-height: 100vh; padding: 26px; background: #0f172a; color: var(--text); }
.provider-main { width: min(1400px, 100%); margin: 0 auto; }
.provider-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; color: #dbe4f0; }
.provider-head h1 { color: #fff; font-size: 34px; }
.provider-head p { color: #9eacc0; margin-bottom: 0; }
.provider-login { margin-top: 8vh; }
.provider-feature-grid { margin-bottom: 12px; }

.modal { width: min(480px, calc(100% - 28px)); padding: 0; border: 1px solid var(--border); border-radius: 14px; color: var(--text); background: var(--surface); box-shadow: 0 24px 80px rgba(15,23,42,.3); }
.modal.modal-lg { width: min(720px, calc(100% - 28px)); }
.modal::backdrop { background: rgba(15,23,42,.6); backdrop-filter: blur(3px); }
.modal > form { display: grid; gap: 15px; padding: 20px; }
.modal-head { display: flex; justify-content: space-between; align-items: start; gap: 15px; }
.modal-head p { margin: 0; }
.modal-head > button { border: 0; color: var(--muted); background: none; font-size: 25px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 5px; }

.empty-state { display: grid; place-items: center; padding: 70px 20px; text-align: center; }
.empty-state p { max-width: 480px; }.empty-code { color: var(--primary); font-size: 70px; font-weight: 800; }
.eyebrow { display: block; margin-bottom: 9px; color: var(--primary); font-size: 10px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }

.guest-shell { display: grid; place-items: center; padding: 30px; background: radial-gradient(circle at 15% 20%, #dbeafe, transparent 35%), radial-gradient(circle at 85% 80%, #e0e7ff, transparent 35%), #f8fafc; }
.guest-main { width: min(1120px, 100%); }
.login-card { width: min(420px, 100%); padding: 36px; margin: auto; border: 1px solid #e2e8f0; border-radius: 18px; background: #fff; box-shadow: 0 20px 70px rgba(15,23,42,.11); color: #172033; }
.login-card form { display: grid; gap: 15px; margin-top: 25px; }
.login-brand { display: flex; align-items: center; gap: 11px; padding-bottom: 28px; margin-bottom: 28px; border-bottom: 1px solid #e2e8f0; }
.login-brand > div { display: grid; }.login-brand small { font-size: 11px; }
.install-card { display: grid; grid-template-columns: minmax(260px, .7fr) minmax(0, 1.3fr); border-radius: 20px; background: #fff; box-shadow: 0 20px 70px rgba(15,23,42,.12); overflow: hidden; color: #172033; }
.install-intro { padding: 55px 42px; color: #dbe4f0; background: #0f172a; }
.install-intro h1 { color: #fff; font-size: 38px; }
.install-intro p { color: #9eacc0; }
.steps { display: grid; gap: 18px; padding: 0; margin: 45px 0 0; list-style-position: inside; }
.steps li { color: #728198; font-weight: 700; }.steps li.active { color: #fff; }
.install-form { display: grid; gap: 26px; padding: 38px 42px; }
.install-form fieldset { padding: 0; border: 0; }
.install-form legend { margin-bottom: 16px; font-size: 17px; font-weight: 700; }

.catalog-shell { background: #f8fafc; color: #172033; }
.catalog-header { position: sticky; z-index: 20; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 20px; height: 76px; padding: 0 max(24px, calc((100% - 1180px) / 2)); border-bottom: 1px solid #e2e8f0; background: rgba(255,255,255,.94); backdrop-filter: blur(12px); }
.catalog-header .brand { color: #172033; }.catalog-header nav { display: flex; align-items: center; gap: 20px; }
.catalog-main { width: min(1180px, calc(100% - 36px)); min-height: calc(100vh - 160px); margin: 0 auto; padding: 35px 0 60px; }
.catalog-hero { display: flex; align-items: center; justify-content: space-between; gap: 40px; min-height: 270px; padding: 48px; border-radius: 22px; color: #dbe4f0; background: linear-gradient(125deg, var(--secondary), color-mix(in srgb, var(--primary) 45%, var(--secondary))); overflow: hidden; }
.catalog-hero > div { max-width: 680px; }.catalog-hero h1 { color: #fff; font-size: clamp(32px, 5vw, 56px); line-height: 1.05; }.catalog-hero p { color: #c4d0e2; margin-bottom: 0; }
.catalog-hero img { width: 240px; height: 240px; border-radius: 50%; object-fit: cover; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.catalog-filters { display: grid; grid-template-columns: minmax(250px, 1fr) 210px 190px auto; gap: 10px; padding: 14px; margin: -25px 30px 40px; position: relative; border: 1px solid #e2e8f0; border-radius: 14px; background: #fff; box-shadow: 0 14px 40px rgba(15,23,42,.1); }
.catalog-section-head { display: flex; justify-content: space-between; align-items: end; margin-bottom: 18px; }
.catalog-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; }
.catalog-card { display: grid; grid-template-rows: auto 1fr auto; gap: 14px; padding: 12px; border: 1px solid #e2e8f0; border-radius: 16px; background: #fff; transition: .18s; }
.catalog-card:hover { transform: translateY(-4px); box-shadow: 0 16px 40px rgba(15,23,42,.1); }
.catalog-card-image { position: relative; display: block; height: 220px; border-radius: 11px; background: #f1f5f9; overflow: hidden; }
.catalog-card-image img { width: 100%; height: 100%; object-fit: cover; transition: .3s; }.catalog-card:hover img { transform: scale(1.025); }
.catalog-card-image .badge { position: absolute; top: 10px; left: 10px; }
.catalog-card > div { padding: 0 4px; }.catalog-card h3 { margin: 5px 0 9px; font-size: 17px; }.catalog-card h3 a { color: #172033; }
.catalog-specs { display: flex; flex-wrap: wrap; gap: 5px; min-height: 25px; }.catalog-specs span { padding: 4px 7px; border-radius: 6px; color: #64748b; background: #f1f5f9; font-size: 10px; }
.catalog-price { display: flex; align-items: end; justify-content: space-between; gap: 8px; margin-top: 14px; }.catalog-price strong { color: #172033; font-size: 20px; }.catalog-price small { font-size: 10px; }
.catalog-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 28px max(24px, calc((100% - 1180px) / 2)); color: #94a3b8; background: #0f172a; }
.back-link { display: inline-block; margin-bottom: 22px; font-weight: 700; }
.catalog-detail { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr); gap: 45px; padding: 30px; border: 1px solid #e2e8f0; border-radius: 20px; background: #fff; }
.gallery-main { height: 520px; border-radius: 14px; background: #f1f5f9; overflow: hidden; }.gallery-main img { width: 100%; height: 100%; object-fit: contain; }
.gallery-thumbs { display: flex; gap: 9px; margin-top: 11px; overflow-x: auto; }.gallery-thumbs button { flex: 0 0 70px; width: 70px; height: 70px; padding: 3px; border: 2px solid transparent; border-radius: 9px; background: #f1f5f9; overflow: hidden; }.gallery-thumbs button.active { border-color: var(--primary); }.gallery-thumbs img { width: 100%; height: 100%; object-fit: cover; }
.catalog-info { padding: 20px 8px; }.catalog-info h1 { font-size: 38px; }.catalog-detail-price { margin: 20px 0; color: var(--primary); font-size: 31px; font-weight: 800; }
.catalog-detail-specs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }.catalog-detail-specs > div { display: grid; padding: 12px; border-radius: 9px; background: #f8fafc; }.catalog-detail-specs small { margin-bottom: 4px; }
.catalog-description { padding: 20px 0; margin: 20px 0; border-top: 1px solid #e2e8f0; border-bottom: 1px solid #e2e8f0; }.catalog-description p { margin-bottom: 0; }
.btn-whatsapp { margin-top: 20px; border-color: #16a34a; background: #16a34a; color: #fff; }.catalog-note { display: block; margin-top: 12px; text-align: center; }.catalog-disabled { min-height: 60vh; }

.sidebar-backdrop { display: none; }

@media (max-width: 1200px) {
    .product-grid, .catalog-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
    .app-shell { display: block; }
    .sidebar { transform: translateX(-100%); transition: .22s; }
    .sidebar.open { transform: translateX(0); }
    .main { grid-column: auto; }
    .sidebar-backdrop { position: fixed; z-index: 25; inset: 0; background: rgba(15,23,42,.55); }
    .sidebar-backdrop.open { display: block; }
    .mobile-only { display: inline-grid; }
    .topbar { padding: 0 18px; }.page { padding: 20px 18px 35px; }
    .dashboard-grid { grid-template-columns: 1fr; }.dashboard-grid .span-2, .dashboard-grid .span-3 { grid-column: auto; }
    .product-grid, .catalog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .form-layout, .sale-layout, .detail-grid, .admin-split, .settings-layout, .cash-layout, .cash-welcome { grid-template-columns: 1fr; }
    .install-card { grid-template-columns: 1fr; }.install-intro { padding: 36px; }.steps { grid-template-columns: repeat(3,1fr); margin-top: 25px; }
    .catalog-filters { grid-template-columns: 1fr 1fr; margin-inline: 15px; }
    .catalog-detail { grid-template-columns: 1fr; }.gallery-main { height: 440px; }
}
@media (max-width: 620px) {
    .topbar-actions .btn { display: none; }
    .topbar { height: 66px; }.topbar h1 { font-size: 17px; }
    .page { padding-inline: 12px; }
    .stat-grid, .product-grid, .catalog-grid, .form-grid.two, .permission-grid { grid-template-columns: 1fr; }
    .form-grid .span-2 { grid-column: auto; }
    .toolbar { align-items: stretch; flex-direction: column; }.filter-bar { display: grid; grid-template-columns: 1fr 1fr; }.filter-bar .search-field { grid-column: span 2; min-width: 0; }
    .filter-bar > select { width: 100%; }.filter-bar > .btn { grid-column: span 2; }
    .sale-line { display: grid; grid-template-columns: minmax(0, 1fr) 74px 38px; align-items: end; }
    .sale-line .grow { grid-column: span 3; }
    .sale-line .price, .sale-line .cost, .sale-line .qty, .sale-line .price-kind { min-width: 0; width: auto; flex: auto; }
    .sale-line .price-kind { grid-column: span 3; }
    .sale-line .price { grid-column: span 1; }
    .sale-line .cost { grid-column: span 1; }
    .custom-line { grid-template-columns: 1fr 1fr 74px 38px; }
    .custom-line .grow { grid-column: span 4; }
    .custom-line .line-total { grid-column: span 3; }
    .line-total { min-width: 0; flex: auto; padding-bottom: 7px; }
    .pos-panel .panel-head { align-items: stretch; flex-direction: column; }
    .pos-panel .panel-head .actions { display: grid; grid-template-columns: 1fr 1fr; }
    .panel { padding: 15px; }.product-image { height: 230px; }
    .debt-fields { grid-template-columns: 1fr; }.debt-fields .field:last-child { grid-column: auto; }
    .install-form, .install-intro { padding: 28px 22px; }.install-intro h1 { font-size: 31px; }.steps { display: none; }
    .guest-shell { padding: 14px; }.login-card { padding: 26px 20px; }
    .catalog-header { height: 66px; padding: 0 15px; }.catalog-header nav > a:first-child { display: none; }.catalog-header .btn { padding: 7px 9px; font-size: 11px; }
    .catalog-main { width: min(100% - 24px, 1180px); padding-top: 20px; }
    .catalog-hero { min-height: 240px; padding: 28px 22px; }.catalog-hero img { display: none; }
    .catalog-filters { grid-template-columns: 1fr; margin: 14px 0 30px; }.catalog-filters .search-field { min-width: 0; }
    .catalog-card-image { height: 270px; }.catalog-footer { align-items: flex-start; flex-direction: column; padding: 25px 18px; }
    .catalog-detail { gap: 20px; padding: 12px; }.gallery-main { height: 340px; }.catalog-info { padding: 10px 4px; }.catalog-info h1 { font-size: 29px; }
    .danger-zone, .cash-status { align-items: stretch; flex-direction: column; }
    .cash-status .actions { display: grid; grid-template-columns: 1fr 1fr; }
    .provider-shell { padding: 14px; }
    .provider-head { flex-direction: column; }
    .provider-head .actions { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
    .detail-head { gap: 12px; flex-direction: column; }
    .detail-head .actions { justify-content: stretch; width: 100%; }
    .detail-head .actions .btn { flex: 1; }
    .module-option { align-items: flex-start; }
    .module-links { display: grid; }
    .denomination-grid { grid-template-columns: 1fr; }
    .denomination-item { grid-template-columns: minmax(0, 1fr) 65px 90px; }
    .denomination-item input { width: 65px; }
    .cash-welcome { margin: 0; padding: 20px 15px; }
    .modal { max-height: calc(100dvh - 20px); overflow-y: auto; }
    .sticky-actions { bottom: 6px; }
    table.responsive-table thead { display: none; }
    table.responsive-table, table.responsive-table tbody, table.responsive-table tr, table.responsive-table td { display: block; width: 100%; }
    table.responsive-table tr { padding: 10px 0; border-bottom: 1px solid var(--border); }
    table.responsive-table tr:last-child { border-bottom: 0; }
    table.responsive-table td { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 7px 4px; border: 0; text-align: right; white-space: normal; }
    table.responsive-table td::before { content: attr(data-label); color: var(--muted); font-size: 10px; font-weight: 700; text-align: left; text-transform: uppercase; }
    table.responsive-table td.actions { justify-content: flex-end; }
    table.responsive-table td.actions::before, table.responsive-table td:empty::before { display: none; }
    table.responsive-table .empty-cell { display: block; text-align: center; }
    table.responsive-table .empty-cell::before { display: none; }
    .receipt-shell { padding: 10px; font-size: 13px; }
    .receipt-card { padding: 24px 18px; border-radius: 8px; }
    .receipt-actions { margin: 0 0 16px; }
    .receipt-invoice-head { grid-template-columns: 1fr; gap: 18px; }
    .receipt-company { grid-template-columns: 58px minmax(0, 1fr); gap: 12px; }
    .receipt-logo, .receipt-company img { width: 58px !important; height: 58px !important; max-width: 58px !important; max-height: 58px !important; }
    .receipt-company h1 { font-size: 21px; }
    .receipt-company-info { grid-template-columns: 1fr; gap: 4px; }
    .receipt-company-info span { max-width: none; }
    .receipt-document { justify-items: start; text-align: left; }
    .receipt-info-row { grid-template-columns: 1fr; gap: 4px; padding: 8px 0; }
    .receipt-info-row strong { text-align: left; }
    .receipt-table { font-size: 12px; }
    .receipt-table th, .receipt-table td { padding: 9px 5px; }
    .receipt-grand-total { padding-top: 24px; }
    .receipt-grand-total span { font-size: 26px; }
    .receipt-grand-total strong { font-size: 29px; }
}

@media print {
    html, body { background: #fff !important; }
    .receipt-shell { padding: 0; background: #fff; }
    .receipt-page { width: 100%; }
    .receipt-card { padding: 0; border: 0; border-radius: 0; box-shadow: none; }
    .receipt-logo, .receipt-company img { width: 76px !important; height: 76px !important; max-width: 76px !important; max-height: 76px !important; }
    .receipt-footer { padding-bottom: 0; }
    .no-print { display: none !important; }
}
