@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Thai:wght@400;500;600;700&family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
  font-family: 'IBM Plex Sans Thai', sans-serif;
  color: #172235;
  background: #f4f7fb;
  font-synthesis: none;
  --ink: #172235;
  --muted: #8290a4;
  --line: #e8edf4;
  --primary: #4f5de4;
  --primary-dark: #3f4cc8;
  --primary-rgb: 79, 93, 228;
  --panel: #fff;
  --shadow: 0 12px 35px rgba(31, 48, 78, .055);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: #f4f7fb; }
.app-shell { min-height: 100vh; }
.login-page[hidden], .app-shell[hidden], [hidden] { display: none !important; }
.login-page { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(380px, .85fr); background: #fff; }
.login-aside { min-height: 100vh; padding: 35px clamp(28px, 7vw, 100px); display: flex; flex-direction: column; color: white; background: radial-gradient(circle at 85% 20%, #ffffff25, transparent 28%), linear-gradient(145deg, var(--primary-dark), var(--primary) 70%, color-mix(in srgb, var(--primary) 66%, white)); }
.login-brand { color: white; padding: 0; }
.login-brand .brand-mark { background: #ffffff25; color: #fff; }
.login-brand small { color: #d1d6ff; }
.login-message { margin: auto 0; max-width: 490px; }
.login-message .banner-kicker { color: #d4d9ff; }
.login-message h1 { font-size: clamp(32px, 4vw, 49px); line-height: 1.35; margin: 14px 0; letter-spacing: -.7px; }
.login-message p { max-width: 370px; font-size: 14px; line-height: 1.9; color: #e0e4ff; }
.login-aside-footer { font: 600 9px Manrope, sans-serif; letter-spacing: 1.3px; color: #d2d7ff; }
.login-main { min-height: 100vh; padding: 35px; display: grid; place-items: center; background: #f9faff; }
.login-card { width: min(100%, 390px); padding: 34px; border: 1px solid #edf0f5; border-radius: 16px; background: #fff; box-shadow: 0 18px 55px #26376812; }
.login-card h2 { font-size: 24px; margin: 7px 0 2px; }
.login-description { color: #8894a6; font-size: 11px; margin: 0 0 24px; }
.login-card .field { margin-top: 14px; }
.login-card .text-input { width: 100%; }
.login-submit { width: 100%; margin-top: 22px; display: flex; justify-content: center; align-items: center; gap: 9px; }
.login-submit span { font-size: 17px; }
.login-error { color: #c33e52; background: #fff0f2; border: 1px solid #ffdade; border-radius: 8px; padding: 9px 11px; font-size: 10px; margin: 13px 0 0; }
.demo-accounts { margin-top: 21px; padding-top: 15px; border-top: 1px solid #edf0f5; color: #738096; }
.demo-accounts summary { font-size: 10px; cursor: pointer; }
.demo-accounts > div { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; margin-top: 10px; }
.demo-accounts p { font-size: 9px; line-height: 1.8; margin: 0; }
.demo-accounts strong { color: #4f5de4; }
.sidebar { width: 248px; height: 100vh; position: fixed; inset: 0 auto 0 0; overflow-y: auto; background: #fff; border-right: 1px solid var(--line); padding: 28px 18px; display: flex; flex-direction: column; z-index: 3; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); padding: 0 8px 38px; }
.brand-mark { height: 40px; width: 40px; border-radius: 13px; background: color-mix(in srgb, var(--primary) 11%, white); color: var(--primary); display: grid; place-items: center; font: 800 21px Manrope, sans-serif; overflow: hidden; }
.brand-mark.has-logo { background: transparent; }
.brand-logo-image { width: 100%; height: 100%; object-fit: contain; border-radius: 10px; }
.brand-letter { line-height: 1; }
.brand strong, .brand small { display: block; }
.brand strong { font: 800 17px Manrope, sans-serif; letter-spacing: -.5px; }
.brand small { font: 600 8px Manrope, sans-serif; letter-spacing: 1.25px; color: #9aa6b7; margin-top: 2px; }
.workspace-label, .eyebrow { font: 700 9px Manrope, sans-serif; letter-spacing: 1.25px; color: #98a3b3; }
.workspace-label { padding: 0 12px 12px; }
.nav-list { display: grid; gap: 5px; }
.nav-item { border: 0; background: transparent; color: #77849a; text-align: left; border-radius: 10px; padding: 12px; font: 500 13px 'IBM Plex Sans Thai', sans-serif; display: flex; align-items: center; gap: 12px; cursor: pointer; transition: .18s; }
.nav-item:hover { background: #f6f7ff; color: var(--primary); }
.nav-item.active { background: color-mix(in srgb, var(--primary) 10%, white); color: var(--primary); font-weight: 600; }
.nav-icon { width: 18px; text-align: center; font-size: 18px; }
.sidebar-bottom { margin-top: auto; border-top: 1px solid var(--line); padding: 16px 2px 0; color: #7c899b; font-size: 10px; display: grid; grid-template-columns: 38px 1fr; align-items: center; gap: 5px 8px; }
.sidebar-bottom .user-avatar { grid-column: 1; grid-row: 1 / 3; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: #eef0ff; color: var(--primary); font: 700 14px Manrope, sans-serif; }
.signed-in-user { min-width: 0; display: flex; flex-direction: column; }
.signed-in-user strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #344158; font-size: 10px; }
.signed-in-user small { font: 700 8px Manrope, sans-serif; color: #6877df; letter-spacing: .8px; }
.logout-button { grid-column: 1 / -1; border: 1px solid #f0dfe2; background: #fff9fa; color: #c45b6b; border-radius: 7px; padding: 7px; font: 500 10px 'IBM Plex Sans Thai', sans-serif; cursor: pointer; }
.sidebar-bottom .status-dot { grid-column: 1; grid-row: 4; margin-left: 5px; }
.sidebar-bottom > span:nth-last-child(2) { grid-column: 2; grid-row: 4; font-size: 9px; }
.sidebar-bottom > small:last-child { grid-column: 2; grid-row: 5; font: 600 8px Manrope, sans-serif; letter-spacing: 1px; color: #aab3c0; }
.nav-item[hidden], button[hidden] { display: none !important; }
.status-dot, .live-pill i { height: 7px; width: 7px; border-radius: 50%; background: #20b982; display: inline-block; box-shadow: 0 0 0 3px #e2f7ee; }
.main-content { margin-left: 248px; padding: 29px 42px 60px; max-width: 1600px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.topbar h1 { font-size: 21px; margin: 4px 0 0; letter-spacing: -.45px; }
.top-actions { display: flex; align-items: center; gap: 18px; }
.today-label { font-size: 11px; color: var(--muted); }
.sync-status { font-size: 9px; color: #168c68; white-space: nowrap; }
.sync-status.pending { color: #bd8218; }
.sync-status.offline { color: #c44c5d; }
.button { font: 600 12px 'IBM Plex Sans Thai', sans-serif; border: 1px solid transparent; border-radius: 9px; padding: 10px 15px; cursor: pointer; transition: transform .15s, background .15s, color .15s; }
.button:active { transform: translateY(1px); }
.button-primary { background: var(--primary); color: white; box-shadow: 0 4px 10px rgba(var(--primary-rgb), .18); }
.button-primary:hover, .button-submit:hover { background: var(--primary-dark); }
.button-outline { border-color: #e2e7ef; background: white; color: #59677c; }
.button-outline:hover { border-color: #b9c0ff; color: var(--primary); }
.page { display: none; animation: fadein .2s ease; }
.page.active { display: block; }
@keyframes fadein { from { opacity: .3; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.welcome-banner { min-height: 147px; background: linear-gradient(110deg, var(--primary-dark) 0%, var(--primary) 58%, color-mix(in srgb, var(--primary) 72%, white) 100%); border-radius: 14px; color: white; padding: 25px 30px; display: flex; justify-content: space-between; align-items: center; position: relative; overflow: hidden; }
.banner-kicker { font: 700 9px Manrope, sans-serif; letter-spacing: 1.5px; color: #cbd1ff; }
.welcome-banner h2 { font-size: 20px; margin: 8px 0 2px; }
.welcome-banner p { font-size: 11px; margin: 0; color: #e1e4ff; }
.banner-art { font: 100px Manrope, sans-serif; color: #ffffff20; transform: rotate(-14deg); margin-right: 55px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 17px 0; }
.stat-card, .panel { background: var(--panel); border: 1px solid #edf0f5; border-radius: 12px; box-shadow: var(--shadow); }
.stat-card { padding: 16px 18px; min-height: 130px; position: relative; display: flex; flex-direction: column; align-items: flex-start; }
.stat-icon { position: absolute; right: 16px; top: 15px; border-radius: 10px; width: 31px; height: 31px; display: grid; place-items: center; font-size: 18px; }
.stat-icon.indigo { background: #eef0ff; color: #5965db; }
.stat-icon.mint { background: #e6f8f1; color: #17a77a; }
.stat-icon.amber { background: #fff4df; color: #d9941d; }
.stat-icon.rose { background: #fff0f1; color: #d76173; }
.stat-label { font-size: 10px; color: var(--muted); }
.stat-card strong { font: 800 27px Manrope, sans-serif; letter-spacing: -1px; margin: 7px 0 2px; }
.stat-card small { font-size: 9px; color: #a0aaba; }
.dashboard-grid { display: grid; grid-template-columns: 1fr; gap: 15px; }
.transaction-page-content { max-width: 900px; }
.report-filter-panel { display: flex; align-items: flex-end; gap: 13px; margin-bottom: 15px; }
.report-filter-panel .field { min-width: 180px; }
.report-filter-panel .text-input { width: 100%; }
.report-filter-panel > button { flex-shrink: 0; }
.date-range-separator { padding: 0 0 10px; color: #929eae; font-size: 10px; }
.report-summary-grid { margin-top: 0; }
.report-summary-grid .stat-card { min-height: 115px; }
.panel { padding: 19px 20px; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.panel-heading h3 { font-size: 14px; margin: 4px 0 0; }
.live-pill { font-size: 9px; color: #239a72; border-radius: 20px; background: #ecfaf4; padding: 6px 9px; display: flex; align-items: center; gap: 7px; }
.live-pill i { height: 6px; width: 6px; box-shadow: none; }
.mode-switch { display: grid; grid-template-columns: repeat(3, 1fr); background: #f3f5f9; border-radius: 8px; padding: 3px; margin: 18px 0 17px; }
.mode-button { font: 500 11px 'IBM Plex Sans Thai', sans-serif; border: 0; background: transparent; color: #7d899b; padding: 9px 5px; border-radius: 6px; cursor: pointer; }
.mode-button.active { background: #fff; color: var(--primary); font-weight: 600; box-shadow: 0 2px 7px #192c4b11; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 10px; color: #536177; font-weight: 600; }
.field label span { font-weight: 400; color: #9ba6b5; }
.field input { font: 400 11px 'IBM Plex Sans Thai', sans-serif; color: var(--ink); }
.field input::placeholder { color: #b1bac7; }
.form-row { display: flex; gap: 14px; margin-top: 15px; }
.grow { flex: 1; min-width: 0; }
.input-with-icon { height: 39px; border: 1px solid #e5e9f0; border-radius: 8px; display: flex; align-items: center; padding: 0 10px; gap: 8px; background: #fff; color: #a7b0be; }
.input-with-icon:focus-within { border-color: #8790ed; box-shadow: 0 0 0 3px #5965db12; }
.input-with-icon input { border: 0; outline: 0; width: 100%; height: 100%; background: transparent; }
.clear-input { border: 0; background: none; color: #b0b9c6; font-size: 18px; cursor: pointer; }
.camera-button { align-self: flex-end; height: 39px; white-space: nowrap; }
.camera-panel { margin-top: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 9px; }
.camera-panel[hidden] { display: none; }
.camera-panel #camera-reader { max-width: 360px; margin: auto; }
.product-preview { margin-top: 14px; padding: 12px; border: 1px solid #edf0f5; background: #fafbfe; border-radius: 9px; display: flex; align-items: center; gap: 10px; }
.preview-icon { width: 33px; height: 33px; border-radius: 9px; background: #eceeff; color: var(--primary); display: grid; place-items: center; font-size: 17px; }
.product-preview > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.product-preview strong { font-size: 11px; }
.product-preview small { font-size: 9px; color: #8e9aab; overflow-wrap: anywhere; }
.stock-tag { margin-left: auto; font-size: 9px; color: #79869a; white-space: nowrap; }
.stock-tag.good { color: #15976c; }
.stock-tag.low { color: #d9941d; }
.stock-tag.out { color: #d45466; }
.quantity-control { height: 39px; display: flex; align-items: center; border: 1px solid #e5e9f0; border-radius: 8px; overflow: hidden; }
.quantity-control button { height: 100%; width: 33px; border: 0; background: #f8f9fc; color: #667489; cursor: pointer; }
.quantity-control input { width: 48px; border: 0; outline: 0; text-align: center; }
.nfc-row { margin-top: 15px; padding: 11px 12px; background: #f5f7ff; border: 1px solid #e8eaff; border-radius: 9px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.nfc-info-banner { margin: 0 0 15px; padding: 16px 18px; background: #f1f3ff; border: 1px solid #e4e8ff; border-radius: 11px; display: flex; align-items: center; gap: 12px; }
.nfc-info-banner .nfc-icon { flex: 0 0 36px; width: 36px; height: 36px; font-size: 23px; }
.nfc-info-banner strong { font-size: 11px; }
.nfc-info-banner p { margin: 3px 0 0; font-size: 10px; line-height: 1.7; color: #77849a; }
.nfc-helper { color: #8994a7; font-size: 9px; line-height: 1.6; }
.nfc-copy { display: flex; align-items: center; gap: 9px; }
.nfc-icon { width: 29px; height: 29px; display: grid; place-items: center; background: #e7eaff; border-radius: 8px; color: #5b65dc; font-size: 20px; }
.nfc-copy > span:last-child { display: flex; flex-direction: column; }
.nfc-copy strong { font-size: 10px; }
.nfc-copy small { font-size: 8px; color: #8994a7; margin-top: 2px; }
.button-nfc { background: #fff; border-color: #dfe3fa; color: #515ed6; padding: 8px 11px; white-space: nowrap; }
.note-field { margin-top: 13px; }
.text-input, .filter-select { height: 38px; border: 1px solid #e5e9f0; border-radius: 8px; padding: 0 10px; outline: 0; background: #fff; }
.text-input:focus, .filter-select:focus { border-color: #8790ed; box-shadow: 0 0 0 3px #5965db12; }
.button-submit { width: 100%; background: var(--primary); color: white; margin-top: 16px; height: 42px; display: flex; justify-content: center; align-items: center; gap: 10px; }
.button-submit span { font-size: 17px; }
.recent-list { margin-top: 15px; }
.recent-item { display: grid; grid-template-columns: 29px minmax(0, 1fr) auto; gap: 9px; align-items: center; padding: 10px 0; border-bottom: 1px solid #f0f2f6; }
.recent-item:last-child { border: 0; }
.activity-icon { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font-size: 13px; }
.activity-icon.withdraw { background: #fff2e8; color: #d78328; }
.activity-icon.return { background: #e9f8f1; color: #17976c; }
.activity-icon.restock { background: #edf0ff; color: #5864d9; }
.activity-copy { display: flex; flex-direction: column; min-width: 0; }
.activity-copy strong { font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.activity-copy small, .activity-time { font-size: 8px; color: #929eae; }
.activity-qty { font-size: 9px; color: #657286; white-space: nowrap; }
.text-button { background: none; border: 0; color: #5965d5; font: 500 10px 'IBM Plex Sans Thai', sans-serif; cursor: pointer; padding: 5px; }
.empty-state { padding: 27px 12px; text-align: center; color: #9aa5b4; font-size: 10px; }
.low-stock-panel { margin-top: 15px; }
.low-stock-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.low-stock-item { border: 1px solid #f0edf0; border-radius: 9px; padding: 10px; display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.low-stock-item strong { font-size: 10px; }
.low-stock-item small { display: block; font-size: 8px; color: #9aa5b4; margin-top: 2px; }
.low-stock-item .low-qty { font-size: 9px; color: #ce891a; white-space: nowrap; }
.page-intro { display: flex; align-items: center; justify-content: space-between; margin: 9px 0 18px; }
.page-intro .eyebrow, .page-intro h2 { display: none; }
.page-intro { margin-top: 0; }
.page-intro h2 { font-size: 19px; margin: 5px 0 2px; }
.page-intro p { font-size: 10px; color: #8793a4; margin: 0; }
.table-panel { padding: 0; overflow: hidden; }
.users-layout { display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); align-items: start; gap: 15px; }
.settings-panel { display: grid; gap: 22px; max-width: 850px; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.settings-grid .text-input { width: 100%; }
.settings-logo-field { grid-column: 1 / -1; }
.color-picker-row { display: flex; align-items: center; gap: 11px; height: 38px; }
.color-picker-row input { width: 42px; height: 36px; padding: 3px; border: 1px solid #e4e8ef; border-radius: 8px; background: #fff; cursor: pointer; }
.color-picker-row span { color: #7c899b; font: 600 10px Manrope, sans-serif; letter-spacing: .7px; }
.logo-upload-row { display: flex; align-items: center; gap: 14px; }
.logo-preview-box { width: 74px; height: 74px; border: 1px dashed #d8deea; border-radius: 12px; background: #f8f9fc; display: grid; place-items: center; overflow: hidden; color: var(--primary); font: 800 28px Manrope, sans-serif; }
.logo-preview-box img { width: 100%; height: 100%; object-fit: contain; }
.logo-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 5px; }
.upload-logo-button { display: inline-flex; align-items: center; min-height: 35px; }
.logo-actions small { color: #929eae; font-size: 9px; }
.settings-footer { padding-top: 15px; border-top: 1px solid #edf0f5; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.settings-footer small { font-size: 9px; color: #929eae; }
.user-create-panel { display: grid; gap: 13px; }
.user-create-panel .panel-heading { margin-bottom: 4px; }
.user-create-panel .text-input { width: 100%; }
.user-create-panel > .button { justify-self: start; }
.security-note { color: #929eae; font-size: 9px; line-height: 1.7; }
.users-table-panel .table-toolbar > strong { font-size: 11px; }
.role-pill { border-radius: 20px; padding: 4px 8px; font: 700 8px Manrope, sans-serif; letter-spacing: .5px; }
.role-pill.dev { color: #5965d5; background: #eef0ff; }
.role-pill.admin { color: #c17c18; background: #fff4df; }
.role-pill.staff { color: #168c68; background: #e9f8f1; }
.tiny-button:disabled { opacity: .4; cursor: not-allowed; }
.table-toolbar { padding: 13px 17px; border-bottom: 1px solid #edf0f5; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.search-box { display: flex; align-items: center; gap: 8px; border: 1px solid #e8ebf1; border-radius: 8px; padding: 0 10px; height: 34px; width: min(340px, 70%); color: #9aa5b4; }
.search-box input { border: 0; outline: 0; font: 400 10px 'IBM Plex Sans Thai', sans-serif; width: 100%; background: transparent; }
.muted-label { font-size: 9px; color: #929eae; }
.filter-select { height: 34px; font: 400 10px 'IBM Plex Sans Thai', sans-serif; color: #667489; }
.table-scroll { overflow: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th { text-align: left; font-size: 9px; color: #96a1b0; background: #fafbfd; font-weight: 600; padding: 11px 14px; }
td { padding: 11px 14px; border-top: 1px solid #f0f2f6; font-size: 10px; color: #657286; }
td strong { font-size: 10px; color: #27344a; }
.product-cell { display: flex; align-items: center; gap: 9px; }
.product-cell-icon { width: 29px; height: 29px; border-radius: 8px; background: #f0f1ff; color: #616bdd; display: grid; place-items: center; }
.code-label { font: 600 9px Manrope, sans-serif; letter-spacing: .3px; color: #657286; }
.table-actions { display: flex; gap: 5px; justify-content: flex-end; }
.tiny-button { border: 1px solid #e6eaf0; background: #fff; border-radius: 6px; color: #66748a; padding: 5px 7px; font: 500 9px 'IBM Plex Sans Thai', sans-serif; cursor: pointer; }
.tiny-button:hover { color: var(--primary); border-color: #c5c9f4; }
.status-pill { border-radius: 20px; font-size: 8px; padding: 4px 8px; }
.status-pill.ok { background: #e9f8f1; color: #15966b; }
.status-pill.low { background: #fff5df; color: #c88518; }
.status-pill.out { background: #fff0f1; color: #d15366; }
.kind-pill { display: inline-flex; align-items: center; gap: 4px; font-size: 9px; }
.kind-pill.withdraw { color: #cf7b25; }
.kind-pill.return { color: #15966b; }
.kind-pill.restock { color: #5965d5; }
.modal { border: 0; border-radius: 15px; padding: 24px; width: min(540px, calc(100vw - 28px)); box-shadow: 0 22px 80px #1c2b4650; color: var(--ink); }
.modal::backdrop { background: #17223570; backdrop-filter: blur(3px); }
.modal-heading { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; }
.modal-heading h2 { font-size: 17px; margin: 4px 0 0; }
.icon-button { width: 30px; height: 30px; border: 0; border-radius: 7px; background: #f4f6fa; color: #778397; font-size: 20px; cursor: pointer; }
.modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.modal-grid .full { grid-column: 1 / -1; }
.barcode-edit-row { display: flex; gap: 8px; }
.barcode-edit-row .text-input { flex: 1; min-width: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; padding-top: 15px; border-top: 1px solid #edf0f5; }
.barcode-modal { width: min(410px, calc(100vw - 28px)); }
.barcode-card { min-height: 155px; border: 1px dashed #dfe4ed; border-radius: 10px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 10px; padding: 20px; }
.barcode-card svg { max-width: 100%; height: auto; }
.barcode-card strong { font: 600 11px Manrope, sans-serif; letter-spacing: 2px; }
.toast-region { position: fixed; right: 22px; bottom: 20px; z-index: 10; display: grid; gap: 8px; }
.toast { background: #1d2b41; color: white; border-radius: 9px; padding: 11px 15px; font-size: 11px; box-shadow: 0 8px 25px #18294430; animation: fadein .2s; }
.toast.error { background: #a9394a; }
.toast.success { background: #197c5d; }
body.printing .sidebar, body.printing .main-content, body.printing .toast-region { display: none; }

@media (max-width: 1100px) {
  .main-content { padding: 25px 25px 50px; }
  .sidebar { width: 215px; }
  .main-content { margin-left: 215px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .recent-panel { min-height: 180px; }
}
@media (max-width: 700px) {
  .login-page { grid-template-columns: 1fr; }
  .login-aside { min-height: 195px; padding: 20px 23px; }
  .login-brand { padding: 0; }
  .login-message { margin: 22px 0 0; }
  .login-message h1 { font-size: 25px; margin: 5px 0; }
  .login-message p, .login-aside-footer { display: none; }
  .login-main { min-height: auto; padding: 24px 15px; }
  .login-card { padding: 25px 21px; }
  .sidebar { position: static; width: auto; height: auto; overflow: visible; padding: 12px 14px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { padding: 0 2px 12px; }
  .workspace-label { display: none; }
  .sidebar-bottom { display: grid; margin-top: 10px; padding-top: 10px; }
  .nav-list { display: flex; gap: 5px; overflow-x: auto; }
  .nav-item { flex: 1; justify-content: center; white-space: nowrap; padding: 9px 8px; font-size: 11px; }
  .main-content { margin: 0; padding: 19px 14px 35px; }
  .topbar { align-items: flex-start; }
  .topbar h1 { font-size: 17px; }
  .top-actions { gap: 7px; flex-direction: column-reverse; align-items: flex-end; }
  .today-label { font-size: 9px; }
  .top-actions .button { padding: 8px 10px; }
  .welcome-banner { padding: 21px 19px; min-height: 135px; }
  .welcome-banner h2 { font-size: 17px; }
  .welcome-banner p { max-width: 260px; line-height: 1.7; }
  .banner-art { font-size: 70px; margin-right: 0; }
  .stats-grid { gap: 9px; }
  .stat-card { min-height: 112px; padding: 13px; }
  .stat-card strong { font-size: 23px; }
  .stat-icon { width: 26px; height: 26px; right: 11px; top: 11px; }
  .panel { padding: 15px 13px; }
  .report-filter-panel { align-items: stretch; flex-direction: column; }
  .report-filter-panel .field { min-width: 0; }
  .date-range-separator { display: none; }
  .form-row { gap: 9px; }
  .camera-button span { display: none; }
  .camera-button { width: 42px; padding: 5px; }
  .nfc-row { align-items: flex-start; }
  .nfc-copy small { max-width: 170px; }
  .low-stock-list { grid-template-columns: 1fr; }
  .page-intro { gap: 10px; align-items: flex-start; }
  .page-intro h2 { font-size: 17px; }
  .page-intro p { max-width: 250px; line-height: 1.6; }
  .page-intro > .button { white-space: nowrap; padding: 9px; }
  .table-toolbar { padding: 11px 10px; }
  .search-box { width: 70%; }
  .modal { padding: 19px; }
  .users-layout { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-logo-field { grid-column: auto; }
  .settings-footer { align-items: flex-start; flex-direction: column; }
  .toast-region { left: 14px; right: 14px; bottom: 14px; }
  .toast { text-align: center; }
}
@media (max-width: 410px) {
  .nav-item { flex: 0 0 auto; font-size: 10px; gap: 5px; }
  .nav-icon { font-size: 16px; }
  .form-row:has(#transaction-quantity) { flex-wrap: wrap; }
  .form-row:has(#transaction-quantity) .field { width: 100%; }
  .nfc-row { flex-direction: column; }
  .button-nfc { width: 100%; }
  .modal-grid { grid-template-columns: 1fr; }
  .modal-grid .full { grid-column: auto; }
}
@media print {
  body { background: white; }
  .sidebar, .topbar, .welcome-banner, .stats-grid, .dashboard-grid, .low-stock-panel, .page:not(#page-products), .page-intro, .table-toolbar, th, td:not(.print-cell) { display: none !important; }
  body.printing .barcode-modal { display: block; position: static; box-shadow: none; width: 100%; max-width: 100%; padding: 35px; }
  body.printing .barcode-modal::backdrop { display: none; }
  .barcode-modal .modal-heading .icon-button, .barcode-modal .modal-actions { display: none; }
  .barcode-card { border: 0; }
  .barcode-card svg { width: 320px !important; height: auto !important; }
}

/* Tablet and compact laptop layouts */
@media (max-width: 900px) and (min-width: 701px) {
  .sidebar { width: 195px; padding-inline: 13px; }
  .main-content { margin-left: 195px; padding: 23px 20px 45px; }
  .nav-item { padding: 10px 9px; gap: 9px; font-size: 12px; }
  .stats-grid { gap: 10px; }
  .report-filter-panel { align-items: stretch; flex-direction: column; }
  .report-filter-panel .field { min-width: 0; }
  .date-range-separator { display: none; }
  .users-layout { grid-template-columns: minmax(0, 1fr); }
  .settings-grid { grid-template-columns: minmax(0, 1fr); }
  .settings-logo-field { grid-column: auto; }
  .low-stock-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Phones: use a scrollable navigation strip and prevent narrow-content overflow */
@media (max-width: 700px) {
  .sidebar { padding: 12px 14px 10px; }
  .nav-list { display: flex; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin; }
  .nav-item { flex: 0 0 auto; min-height: 40px; }
  .sidebar-bottom > .status-dot,
  .sidebar-bottom > span:nth-last-child(2),
  .sidebar-bottom > small:last-child { display: none; }
  .sidebar-bottom { grid-template-columns: 34px minmax(0, 1fr) auto; gap: 5px 8px; }
  .sidebar-bottom .user-avatar { width: 32px; height: 32px; }
  .logout-button { grid-column: 3; grid-row: 1 / 3; padding: 7px 9px; }
  .page-intro { flex-wrap: wrap; }
  .page-intro > .button { white-space: normal; }
  .search-box { min-width: 0; }
  .table-scroll { overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
}

@media (max-width: 520px) {
  .login-aside { min-height: 175px; }
  .login-card { width: 100%; }
  .topbar { gap: 10px; }
  .topbar > div:first-child { min-width: 0; }
  .top-actions { flex-shrink: 0; }
  .topbar h1 { font-size: 16px; }
  .welcome-banner { gap: 8px; }
  .welcome-banner > div:first-child { min-width: 0; }
  .banner-art { flex: 0 0 auto; }
  .stat-card { min-width: 0; }
  .stat-label, .stat-card small { overflow-wrap: anywhere; }
  .product-preview { align-items: flex-start; }
  .product-preview .stock-tag { white-space: normal; text-align: right; }
  .table-toolbar { flex-wrap: wrap; }
  .search-box { width: 100%; flex: 1 1 100%; }
  .table-toolbar > .muted-label,
  .table-toolbar > strong { margin-left: auto; }
  .page-intro > .button { flex: 0 1 auto; }
  .barcode-edit-row { flex-wrap: wrap; }
  .barcode-edit-row .button { flex: 0 0 auto; }
  .modal-actions { flex-wrap: wrap; }
}

@media (max-width: 360px) {
  .main-content { padding-inline: 10px; }
  .topbar { align-items: flex-start; }
  .top-actions .button { font-size: 10px; }
  .welcome-banner { padding: 17px 14px; }
  .banner-art { display: none; }
  .stats-grid { gap: 7px; }
  .stat-card { padding: 11px; }
  .stat-icon { display: none; }
  .form-row { flex-direction: column; }
  .form-row .field { width: 100%; }
  .camera-button { width: auto; align-self: stretch; }
  .camera-button span { display: inline; }
  .nfc-info-banner { align-items: flex-start; padding: 12px; }
  .page-intro > .button { width: 100%; }
  .modal { padding: 16px; }
}
