:root {
    --bg: #f5f6f8;
    --panel: #ffffff;
    --text: #17202a;
    --muted: #667085;
    --line: #d9dee7;
    --primary: #146c5c;
    --primary-dark: #0f5146;
    --accent: #b7791f;
    --danger: #b42318;
}

* { box-sizing: border-box; }
html, body { max-width: 100%; overflow-x: hidden; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 Arial, sans-serif; }
img, svg { max-width: 100%; }
a { color: inherit; text-decoration: none; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 240px; background: #101820; color: white; padding: 22px; overflow: auto; }
.brand { font-size: 20px; font-weight: 700; margin-bottom: 28px; }
.sidebar nav { display: grid; gap: 8px; }
.sidebar a { padding: 11px 12px; border-radius: 6px; color: #d7dee8; display: flex; align-items: center; gap: 10px; }
.sidebar a:hover { background: rgba(255,255,255,.08); color: #fff; }
.ui-icon { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; min-width: 18px; color: currentColor; opacity: .9; }
.ui-icon::before, .ui-icon::after { content: ""; position: absolute; box-sizing: border-box; }
.button { gap: 8px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand .ui-icon { color: #e7f3ef; }
.ui-icon[data-icon="brand"]::before { width: 4px; height: 4px; background: currentColor; left: 3px; top: 3px; box-shadow: 6px 0 currentColor, 12px 0 currentColor, 0 6px currentColor, 6px 6px currentColor, 12px 6px currentColor, 0 12px currentColor, 6px 12px currentColor, 12px 12px currentColor; }
.ui-icon[data-icon="dashboard"]::before { width: 14px; height: 10px; left: 2px; bottom: 2px; border: 2px solid currentColor; border-top: 0; border-radius: 2px; }
.ui-icon[data-icon="dashboard"]::after { width: 9px; height: 9px; left: 4px; top: 2px; border-left: 2px solid currentColor; border-top: 2px solid currentColor; transform: rotate(45deg); border-radius: 2px 0 0 0; }
.ui-icon[data-icon="products"]::before, .ui-icon[data-icon="image"]::before { width: 14px; height: 14px; border: 2px solid currentColor; border-radius: 3px; }
.ui-icon[data-icon="products"]::after { width: 6px; height: 6px; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; right: 3px; bottom: 3px; }
.ui-icon[data-icon="categories"]::before, .ui-icon[data-icon="reports"]::before { width: 14px; height: 12px; border-top: 2px solid currentColor; border-bottom: 2px solid currentColor; top: 3px; }
.ui-icon[data-icon="categories"]::after, .ui-icon[data-icon="reports"]::after { width: 14px; height: 2px; background: currentColor; top: 8px; }
.ui-icon[data-icon="brands"]::before { width: 13px; height: 13px; border: 2px solid currentColor; border-radius: 3px; transform: rotate(45deg); }
.ui-icon[data-icon="brands"]::after { width: 3px; height: 3px; background: currentColor; border-radius: 50%; left: 5px; top: 5px; }
.ui-icon[data-icon="manufacturers"]::before, .ui-icon[data-icon="settings"]::before { width: 14px; height: 14px; border: 2px solid currentColor; border-radius: 50%; }
.ui-icon[data-icon="manufacturers"]::after, .ui-icon[data-icon="settings"]::after { width: 5px; height: 5px; border: 2px solid currentColor; border-radius: 50%; }
.ui-icon[data-icon="contacts"]::before { width: 7px; height: 7px; border: 2px solid currentColor; border-radius: 50%; left: 2px; top: 2px; box-shadow: 7px 3px 0 -1px transparent; }
.ui-icon[data-icon="contacts"]::after { width: 15px; height: 7px; border: 2px solid currentColor; border-top: 0; border-radius: 0 0 8px 8px; left: 1px; bottom: 2px; }
.ui-icon[data-icon="purchases"]::before, .ui-icon[data-icon="sales"]::before, .ui-icon[data-icon="logout"]::before { width: 11px; height: 11px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; }
.ui-icon[data-icon="purchases"]::before { transform: rotate(45deg); top: 2px; }
.ui-icon[data-icon="sales"]::before { transform: rotate(-135deg); bottom: 2px; }
.ui-icon[data-icon="logout"]::before { width: 9px; height: 9px; transform: rotate(135deg); left: 2px; }
.ui-icon[data-icon="logout"]::after { width: 12px; height: 2px; background: currentColor; right: 2px; top: 8px; }
.ui-icon[data-icon="stock"]::before { width: 3px; height: 12px; background: currentColor; left: 3px; bottom: 3px; box-shadow: 5px -4px currentColor, 10px -1px currentColor; }
.ui-icon[data-icon="payments"]::before { width: 15px; height: 11px; border: 2px solid currentColor; border-radius: 3px; top: 4px; }
.ui-icon[data-icon="payments"]::after { width: 11px; height: 2px; background: currentColor; top: 7px; }
.ui-icon[data-icon="save"]::before { width: 14px; height: 14px; border: 2px solid currentColor; border-radius: 3px; }
.ui-icon[data-icon="save"]::after { width: 8px; height: 4px; border-left: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); top: 6px; }
.ui-icon[data-icon="cancel"]::before, .ui-icon[data-icon="delete"]::before { width: 14px; height: 2px; background: currentColor; transform: rotate(45deg); }
.ui-icon[data-icon="cancel"]::after, .ui-icon[data-icon="delete"]::after { width: 14px; height: 2px; background: currentColor; transform: rotate(-45deg); }
.ui-icon[data-icon="edit"]::before { width: 12px; height: 4px; border: 2px solid currentColor; border-radius: 2px; transform: rotate(-35deg); }
.ui-icon[data-icon="edit"]::after { width: 5px; height: 2px; background: currentColor; right: 1px; bottom: 3px; }
.app-shell { margin-left: 240px; padding: 24px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.topbar h1 { margin: 0; font-size: 26px; }
.topbar p { margin: 2px 0 0; color: var(--muted); }
.userbar { display: flex; align-items: center; gap: 12px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 18px; margin-bottom: 18px; box-shadow: 0 1px 2px rgba(16,24,40,.04); overflow-x: auto; }
.panel h2 { margin: 0 0 14px; font-size: 18px; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.metrics div { background: white; border: 1px solid var(--line); border-radius: 8px; padding: 18px; }
.metrics span { color: var(--muted); display: block; }
.metrics strong { display: block; margin-top: 6px; font-size: 24px; }
.grid.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: end; }
.form-grid .wide { grid-column: 1 / -1; }
label { display: grid; gap: 6px; color: var(--muted); font-weight: 600; }
input, select, textarea { width: 100%; min-height: 42px; border: 1px solid var(--line); border-radius: 6px; padding: 10px 11px; background: #fff; color: var(--text); font: inherit; }
textarea { min-height: 86px; resize: vertical; }
.button { min-height: 42px; border: 1px solid var(--line); background: #fff; color: var(--text); border-radius: 6px; padding: 10px 14px; cursor: pointer; font-weight: 700; display: inline-flex; justify-content: center; align-items: center; }
.button.primary { background: var(--primary); border-color: var(--primary); color: white; }
.button.primary:hover { background: var(--primary-dark); }
.button.ghost { background: transparent; color: var(--muted); }
.button.small { padding: 6px 10px; font-size: 12px; }
.button.danger { border-color: #f3b3ad; color: var(--danger); }
.thumb { width: 44px; height: 44px; object-fit: cover; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.link-strong { color: var(--primary); font-weight: 700; }
.section-head { display: flex; justify-content: space-between; gap: 16px; }
.section-head p { color: var(--muted); margin: 4px 0 0; }
.item-form-grid { display: grid; grid-template-columns: minmax(320px, 1fr) minmax(360px, .9fr); gap: 28px; align-items: start; }
.product-form-card { display: block; }
.category-form-card { display: block; }
.product-modal-close, .category-modal-close { display: none; }
body.product-modal-open, body.category-modal-open { overflow: hidden; }
.product-edit-panel.is-edit-modal { position: fixed; inset: 0; z-index: 60; display: grid; align-items: start; margin: 0; padding: 22px; border: 0; border-radius: 0; background: rgba(16,24,32,.72); overflow-y: auto; box-shadow: none; }
.product-edit-panel.is-edit-modal .product-form-card { width: min(1120px, 100%); margin: auto; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 18px; box-shadow: 0 24px 70px rgba(0,0,0,.28); }
.product-edit-panel.is-edit-modal .product-modal-close { display: inline-flex; }
.category-edit-panel.is-edit-modal { position: fixed; inset: 0; z-index: 60; display: grid; align-items: start; margin: 0; padding: 22px; border: 0; border-radius: 0; background: rgba(16,24,32,.72); overflow-y: auto; box-shadow: none; }
.category-edit-panel.is-edit-modal .category-form-card { width: min(760px, 100%); margin: auto; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 18px; box-shadow: 0 24px 70px rgba(0,0,0,.28); }
.category-edit-panel.is-edit-modal .category-modal-close { display: inline-flex; }
.item-main-fields { display: grid; gap: 14px; }
.select-action { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.segmented { display: flex; flex-wrap: wrap; gap: 10px; }
.segmented label { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; color: var(--text); }
.segmented input { width: auto; }
.image-uploader { border: 1px solid var(--line); border-radius: 8px; padding: 16px; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; background: #fbfcfe; }
.image-uploader.single { grid-template-columns: 1fr; }
.image-uploader h3 { margin: 0 0 8px; font-size: 16px; font-weight: 500; }
.upload-tile { min-height: 112px; border: 1px dashed #cbd5e1; border-radius: 8px; display: grid; place-items: center; text-align: center; color: var(--primary); background: white; cursor: pointer; padding: 18px; }
.image-preview-tile { min-height: 260px; position: relative; overflow: hidden; }
.image-preview-tile img { width: 100%; height: 100%; object-fit: contain; position: absolute; inset: 0; padding: 8px; background: #fff; }
.upload-help { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.upload-inline { min-height: 76px; border: 1px dashed #cbd5e1; border-radius: 8px; display: grid; place-items: center; text-align: center; color: var(--primary); background: white; cursor: pointer; padding: 10px; position: relative; overflow: hidden; }
.upload-inline input { display: none; }
.upload-inline img { width: 100%; height: 100%; object-fit: contain; position: absolute; inset: 0; padding: 6px; background: #fff; }
.upload-inline span { color: #667085; font-weight: 600; }
.upload-tile.tall { min-height: 250px; }
.upload-tile input { display: none; }
.upload-tile span { display: block; color: #667085; font-weight: 400; margin-top: 8px; }
.form-divider { border-top: 1px solid var(--line); margin: 20px -18px 18px; }
.sticky-actions { border-top: 1px solid var(--line); padding-top: 14px; }
.table-actions { display: flex; gap: 8px; align-items: center; }
.table-actions form { margin: 0; }
.item-topbar { display: flex; justify-content: space-between; align-items: start; gap: 16px; margin-bottom: 10px; }
.item-topbar h2 { margin: 0; font-size: 28px; }
.item-topbar p { margin: 4px 0 0; color: var(--muted); }
.tabs { display: flex; gap: 28px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs a { padding: 12px 0; color: var(--muted); font-weight: 700; }
.tabs a:hover { color: var(--primary); }
.item-detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 22px; }
.detail-list { display: grid; grid-template-columns: 170px 1fr; gap: 10px 18px; }
.detail-list dt { color: #7a7f89; }
.detail-list dd { margin: 0; }
.image-uploader.compact { grid-template-columns: 1fr 1fr; }
.image-preview, .gallery-mini { min-height: 96px; border: 1px dashed var(--line); border-radius: 8px; display: grid; place-items: center; color: var(--muted); overflow: hidden; background: white; }
.image-preview img { width: 100%; height: 100%; object-fit: cover; }
.gallery-mini { grid-template-columns: repeat(2, 1fr); gap: 6px; padding: 6px; }
.gallery-mini img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; }
.dropdown { position: relative; }
.dropdown-menu { display: none; position: absolute; right: 0; top: calc(100% + 8px); min-width: 210px; background: #fff; border: 1px solid var(--line); box-shadow: 0 12px 30px rgba(16,24,40,.14); border-radius: 8px; padding: 8px; z-index: 5; }
.dropdown.open .dropdown-menu { display: grid; gap: 4px; }
.dropdown-menu button { width: 100%; border: 0; background: transparent; text-align: left; padding: 10px 12px; border-radius: 6px; cursor: pointer; font: inherit; }
.dropdown-menu button:hover { background: #eef4ff; color: #1d4ed8; }
.setup-shell { display: grid; grid-template-columns: minmax(0, 760px) 360px; gap: 28px; align-items: start; justify-content: center; }
.setup-card { border-top: 3px solid var(--accent); }
.setup-card h2 { text-align: center; font-size: 26px; margin: 20px 0 28px; }
.setup-card h3 { color: #9aa0aa; text-transform: uppercase; letter-spacing: 2px; font-size: 13px; margin: 12px 0 0; }
.setup-note { background: #fbfcfe; border-top: 1px solid var(--line); padding: 14px; color: var(--muted); }
.setup-aside { display: grid; gap: 18px; }
table { width: 100%; min-width: 760px; border-collapse: collapse; }
th, td { padding: 11px 9px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; }
.stack { display: grid; gap: 14px; }
.line-box { display: grid; gap: 10px; }
.line-row { display: grid; grid-template-columns: 2fr .7fr .8fr .7fr .8fr; gap: 10px; align-items: center; }
.billing-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 340px); gap: 18px; align-items: start; }
.billing-main { display: grid; gap: 16px; min-width: 0; }
.billing-lines { display: grid; gap: 10px; min-width: 0; }
.billing-line { grid-template-columns: minmax(170px, 1fr) 68px 86px 68px 96px 76px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfe; align-items: end; gap: 8px; min-width: 0; }
.billing-line label { margin: 0; }
.billing-line input { min-width: 0; }
.billing-line [data-remove-line] { align-self: end; padding-left: 8px; padding-right: 8px; }
.line-stock { color: var(--muted); font-weight: 800; align-self: end; padding-bottom: 10px; overflow-wrap: anywhere; }
.line-stock.is-low { color: var(--danger); }
.line-total-box { display: grid; gap: 6px; align-self: end; padding-bottom: 8px; }
.line-total-box span { color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.line-total-box strong { font-size: 16px; }
.billing-summary { position: sticky; top: 18px; border: 1px solid var(--line); border-radius: 8px; padding: 16px; background: #fff; display: grid; gap: 14px; width: 100%; margin-left: 0; }
.billing-summary h3 { margin: 0; }
.billing-summary dl { display: grid; grid-template-columns: 1fr auto; gap: 10px 12px; margin: 0; align-items: center; }
.billing-summary dt { color: var(--muted); font-weight: 800; }
.billing-summary dd { margin: 0; font-weight: 900; }
.billing-summary dd input { min-width: 120px; }
.paid-quick-fill { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px; align-items: center; }
.paid-quick-fill .button { min-height: 42px; padding-left: 10px; padding-right: 10px; }
.sale-detail-row td { background: #fbfcfe; padding-top: 0; }
.sale-detail-box { display: grid; gap: 10px; border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.sale-detail-box > div { display: flex; flex-wrap: wrap; gap: 10px 16px; color: var(--muted); }
.sale-detail-box strong { color: var(--text); }
.sale-detail-totals { display: flex; flex-wrap: wrap; gap: 10px 16px; color: var(--muted); }
.sale-detail-totals strong { color: var(--text); }
.mini-table { min-width: 0; font-size: 13px; }
.mini-table th, .mini-table td { padding: 7px 8px; }
.whatsapp-button { background: #16a34a; border-color: #16a34a; color: #fff; }
.whatsapp-button:hover { background: #15803d; border-color: #15803d; }
.sale-detail-modal[hidden] { display: none; }
.sale-detail-modal { position: fixed; inset: 0; z-index: 80; background: rgba(16,24,32,.72); padding: 22px; overflow-y: auto; display: grid; place-items: start center; }
.sale-detail-modal-card { width: min(920px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 18px; box-shadow: 0 24px 70px rgba(0,0,0,.28); }
body.sale-detail-modal-open { overflow: hidden; }
.actions, .filters { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.table-bulk-actions { justify-content: flex-end; margin-bottom: 10px; }
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(135deg, #101820, #20443e); }
.login-panel { width: min(860px, 100%); display: grid; grid-template-columns: 1fr 360px; gap: 28px; color: white; align-items: center; }
.login-panel h1 { font-size: 44px; margin: 0 0 10px; }
.login-panel p { color: #d7dee8; font-size: 17px; }
.login-panel .panel { color: var(--text); margin: 0; }
.alert { border-radius: 6px; padding: 10px; margin-bottom: 12px; }
.alert.danger { background: #fee4e2; color: var(--danger); }
.muted { color: var(--muted); }
.plain-list { margin: 10px 0 16px; padding-left: 18px; color: var(--muted); }
.status-ok { color: #166534; font-weight: 800; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 8px; background: #edf4ef; color: var(--primary); font-weight: 800; font-size: 12px; }
.badge.danger { background: #fee4e2; color: var(--danger); }
.invoice { background: white; max-width: 880px; margin: 0 auto; padding: 28px; border: 1px solid var(--line); }
.invoice-head { display: flex; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--line); margin-bottom: 18px; padding-bottom: 18px; }
.invoice-logo { width: 72px; height: 72px; object-fit: contain; margin-bottom: 8px; }
.invoice-total { margin-left: auto; width: min(320px, 100%); text-align: right; padding-top: 16px; }
.invoice-note { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 12px; color: var(--muted); }
.invoice-customer { margin: 12px 0 16px; display: grid; gap: 4px; }
.invoice-customer p { margin: 0; }
.public-shell { min-height: 100vh; background: #f4f7f5; }
.stock-front { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 26px 0 0; color: #14212b; }
.stock-front-header { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 8px 0 22px; }
.stock-front-header h1 { margin: 2px 0 4px; font-size: 32px; line-height: 1.1; }
.stock-front-header p { margin: 0; color: #667085; }
.stock-kicker { color: #9a5b13; font-weight: 800; text-transform: uppercase; font-size: 12px; }
.stock-login { background: #14212b; color: #fff; border-color: #14212b; }
.stock-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, .72fr); gap: 22px; align-items: stretch; background: #14212b; color: white; border-radius: 8px; padding: 30px; }
.stock-hero-copy { display: grid; align-content: center; }
.stock-hero h2 { margin: 0 0 8px; font-size: 38px; line-height: 1.05; }
.stock-hero p { margin: 0; max-width: 620px; color: #d9e1e7; font-size: 16px; }
.stock-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stock-stats div { background: #ffffff; color: #14212b; border-radius: 8px; padding: 18px; border-top: 4px solid #d18b24; }
.stock-stats span { display: block; color: #667085; font-size: 12px; text-transform: uppercase; font-weight: 800; }
.stock-stats strong { display: block; margin-top: 8px; font-size: 24px; }
.stock-tools { position: sticky; top: 0; z-index: 4; display: grid; grid-template-columns: minmax(260px, 380px) 1fr; gap: 16px; align-items: end; padding: 16px 0; background: #f4f7f5; }
.stock-search span { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.stock-search input { border-color: #b7c8c2; min-height: 44px; }
.stock-category-tabs { display: flex; gap: 8px; overflow: visible; flex-wrap: wrap; padding-bottom: 2px; }
.stock-category-tab-wrap { position: relative; flex: 0 0 auto; }
.stock-category-tabs button { flex: 0 0 auto; border: 1px solid #cbd5e1; background: #fff; color: #344054; border-radius: 999px; padding: 8px 14px 8px 10px; cursor: pointer; font-weight: 800; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; }
.stock-category-tabs button.active { background: #146c5c; border-color: #146c5c; color: #fff; }
.stock-category-tab-icon { width: 28px; height: 28px; border-radius: 50%; background: #f7f8fa; object-fit: cover; border: 1px solid #d9dee7; }
.stock-category-tabs button.active .stock-category-tab-icon { background: #fff; border-color: rgba(255,255,255,.55); }
.stock-subcategory-menu { display: none; position: absolute; left: 0; top: calc(100% + 8px); min-width: 220px; background: #fff; border: 1px solid #d9dee7; border-radius: 8px; box-shadow: 0 16px 34px rgba(20,33,43,.18); padding: 8px; z-index: 8; }
.stock-category-tab-wrap:hover .stock-subcategory-menu, .stock-category-tab-wrap:focus-within .stock-subcategory-menu { display: grid; gap: 6px; }
.stock-subcategory-menu button { width: 100%; border-radius: 6px; justify-content: flex-start; min-height: 40px; padding: 7px 9px; }
.stock-subcategory-menu button.active { background: #edf4ef; color: #146c5c; border-color: #b7c8c2; }
.stock-groups { display: grid; gap: 28px; }
.stock-brand-section { display: grid; gap: 16px; }
.stock-brand-section.is-hidden, .stock-category.is-hidden, .stock-product.is-hidden { display: none; }
tr.is-hidden { display: none; }
tr.is-out { background: #fff1f1; }
tr.is-out .stock-name-cell strong { color: #b42318; }
tr.is-out .stock-qty-pill { background: #dc2626; color: #fff; }
.stock-brand-head { display: flex; align-items: center; gap: 14px; padding: 6px 0; }
.stock-brand-mark { width: 58px; height: 58px; border-radius: 8px; background: #fff; border: 1px solid #d9dee7; display: grid; place-items: center; overflow: hidden; box-shadow: 0 8px 22px rgba(20,33,43,.07); }
.stock-brand-mark img { width: 100%; height: 100%; object-fit: contain; padding: 7px; }
.stock-brand-mark span { color: #146c5c; font-size: 22px; font-weight: 900; }
.stock-brand-head h2 { margin: 0; font-size: 24px; }
.stock-brand-head p { margin: 2px 0 0; color: #667085; }
.stock-category { background: #fff; border: 1px solid #d9dee7; border-radius: 8px; overflow: hidden; box-shadow: 0 12px 30px rgba(20,33,43,.06); }
.stock-category-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: #edf4ef; padding: 14px 18px; border-bottom: 1px solid #d9dee7; }
.stock-category-head h3 { margin: 0; font-size: 16px; }
.stock-category-head span { color: #667085; font-weight: 800; }
.stock-table-image { width: var(--product-image-size, 70px); height: var(--product-image-size, 70px); border: 1px solid #e4e7ec; border-radius: 8px; overflow: hidden; background: #f7f8fa; display: grid; place-items: center; color: #98a2b3; font-size: 12px; }
.stock-table-image img { width: 100%; height: 100%; object-fit: cover; }
.stock-front-table td { font-size: var(--product-font-size, 15px); }
.stock-name-cell strong { font-size: calc(var(--product-font-size, 15px) + 1px); }
.stock-product-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stock-product { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 16px; min-height: 150px; padding: 18px; border-right: 1px solid #edf0f3; border-bottom: 1px solid #edf0f3; }
.stock-product:nth-child(2n) { border-right: 0; }
.stock-product-image { width: 112px; height: 112px; background: #f7f8fa; border: 1px solid #e4e7ec; border-radius: 8px; overflow: hidden; display: grid; place-items: center; color: #98a2b3; font-size: 12px; }
.stock-product-image img { width: 100%; height: 100%; object-fit: cover; }
.stock-product-body { min-width: 0; display: grid; align-content: space-between; gap: 10px; }
.stock-product h4 { margin: 0; font-size: 15px; line-height: 1.3; }
.stock-product p { margin: 3px 0 0; color: #667085; }
.stock-product-meta { font-size: 12px; }
.stock-product-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.stock-product-foot span { font-weight: 900; color: #14212b; }
.stock-product-foot strong { border-radius: 999px; padding: 6px 10px; font-size: 12px; white-space: nowrap; }
.stock-product.is-available .stock-product-foot strong { background: #dcfce7; color: #166534; }
.stock-product.is-low .stock-product-foot strong { background: #fff7ed; color: #9a3412; }
.stock-product.is-out { background: #fff1f1; }
.stock-product.is-out h4 { color: #b42318; }
.stock-product.is-out .stock-product-foot strong { background: #dc2626; color: #fff; }
.stock-empty { background: #fff; border: 1px dashed #b7c8c2; border-radius: 8px; text-align: center; padding: 42px; }
.stock-empty h2 { margin: 0 0 6px; }
.stock-empty p { margin: 0; color: #667085; }
.stock-front-footer { display: grid; place-items: center; gap: 8px; margin-top: 38px; padding: 34px 18px; background: #14212b; color: #fff; text-align: center; }
.stock-front-footer span { color: #d9e1e7; }

@media print {
    .sidebar, .topbar, .no-print { display: none !important; }
    .app-shell { margin: 0; padding: 0; }
    body { background: #fff; }
    .invoice { border: 0; max-width: none; }
}

@media (max-width: 1280px) {
    .billing-grid { grid-template-columns: minmax(0, 1fr) minmax(280px, 320px); }
    .billing-summary { position: sticky; top: 18px; width: 100%; margin-left: 0; }
    .billing-line { grid-template-columns: minmax(150px, 1fr) 62px 78px 62px 88px 68px; gap: 6px; }
    .billing-line [data-remove-line] { font-size: 0; min-width: 42px; }
    .billing-line [data-remove-line]::after { content: "X"; font-size: 12px; }
    .line-stock { font-size: 12px; }
    .line-total-box strong { font-size: 14px; }
}

@media (max-width: 920px) {
    .sidebar { position: sticky; top: 0; z-index: 20; width: auto; max-height: none; padding: 14px; }
    .brand { margin-bottom: 12px; }
    .sidebar nav { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
    .sidebar a { flex: 0 0 auto; white-space: nowrap; }
    .app-shell { margin-left: 0; padding: 16px; }
    .topbar { flex-direction: column; align-items: stretch; }
    .userbar { justify-content: space-between; }
    .metrics, .grid.two, .form-grid, .login-panel { grid-template-columns: 1fr; }
    .item-form-grid, .item-detail-grid, .setup-shell { grid-template-columns: 1fr; }
    .billing-grid { grid-template-columns: 1fr; }
    .billing-summary { position: static; }
    .billing-line { grid-template-columns: minmax(0, 1fr) minmax(90px, .55fr) minmax(110px, .65fr); }
    .select-action, .image-uploader, .image-uploader.compact { grid-template-columns: 1fr; }
    .line-row { grid-template-columns: 1fr; }
    .image-preview-tile { min-height: clamp(180px, 42vw, 260px); }
    .section-head, .item-topbar, .invoice-head { flex-direction: column; }
    .actions, .filters, .table-bulk-actions { align-items: stretch; justify-content: flex-start; }
    .actions .button, .filters .button, .table-bulk-actions .button { flex: 1 1 auto; }
}

@media (max-width: 820px) {
    .stock-front { width: min(100% - 22px, 1180px); padding-top: 14px; }
    .stock-front-header { flex-direction: column; align-items: flex-start; }
    .stock-hero, .stock-tools { grid-template-columns: 1fr; }
    .stock-tools { position: relative; }
    .stock-hero { padding: 22px; }
    .stock-hero h2 { font-size: 30px; }
    .stock-stats, .stock-product-grid { grid-template-columns: 1fr; }
    .stock-category-tabs { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 8px; }
    .stock-subcategory-menu { position: static; min-width: 0; margin-top: 6px; box-shadow: none; }
    .stock-product { grid-template-columns: 88px minmax(0, 1fr); min-height: 126px; border-right: 0; }
    .stock-product-image { width: 88px; height: 88px; }
    .stock-product-foot { align-items: start; flex-direction: column; }
}

@media (max-width: 560px) {
    body { font-size: 13px; }
    .sidebar { padding: 12px; }
    .brand { font-size: 18px; }
    .sidebar a { padding: 9px 10px; font-size: 13px; }
    .app-shell { padding: 12px; }
    .topbar h1, .item-topbar h2 { font-size: 22px; }
    .panel { padding: 14px; border-radius: 6px; }
    .metrics { gap: 10px; }
    .metrics div { padding: 14px; }
    .metrics strong { font-size: 20px; }
    .segmented label { flex: 1 1 130px; justify-content: center; }
    .button, input, select, textarea { min-height: 44px; }
    .tabs { gap: 18px; overflow-x: auto; }
    .detail-list { grid-template-columns: 1fr; gap: 4px; }
    .stock-hero h2 { font-size: 28px; }
    .stock-front-table { min-width: 760px; }
    .login-panel h1 { font-size: 32px; }
    .auth-shell { padding: 14px; }
}
