:root {
    color-scheme: light;
    --ink: #172130;
    --muted: #6b7280;
    --line: #e6e9ee;
    --paper: #ffffff;
    --navy: #061029;
    --navy-hover: #111d35;
    --nav-active: #344153;
    --red: #c64b48;
    --red-soft: #fff0ef;
    --green: #18764f;
    --green-soft: #e9f5ee;
    --shadow: 0 8px 26px rgba(17, 29, 53, .05);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-width: 320px;
    background: var(--paper);
    color: var(--ink);
    font: 15px/1.55 "Segoe UI", Arial, sans-serif;
}

h1, h2, h3, p { margin-top: 0; }
h1, h2, h3, .brand { font-family: "Segoe UI", Arial, sans-serif; }
h1 { margin-bottom: 8px; font-size: clamp(1.7rem, 5vw, 2.2rem); line-height: 1.2; letter-spacing: -.035em; }
h2 { margin-bottom: 5px; font-size: 1.15rem; letter-spacing: -.02em; }
h3 { margin-bottom: 4px; font-size: 1.03rem; }
a { color: var(--navy); text-underline-offset: 3px; }
button, input { font: inherit; }
button, summary { -webkit-tap-highlight-color: transparent; }

.app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.app-shell-dashboard { flex-direction: row; }
.sidebar {
    width: 210px;
    min-height: 100vh;
    flex: 0 0 210px;
    display: flex;
    flex-direction: column;
    background: var(--navy);
    color: #fff;
}
.sidebar-topbar { display: flex; align-items: center; border-bottom: 1px solid rgba(255,255,255,.1); }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-size: 1.07rem; font-weight: 700; }
.brand-image { width: 30px; height: 30px; object-fit: contain; }
.brand-light { font-weight: 500; color: #718096; }
.sidebar-brand { min-width: 0; min-height: 72px; flex: 1; padding: 0 20px; color: #fff; }
.sidebar-brand .brand-light { color: #c7ced9; }
.sidebar-brand-copy { min-width: 0; display: grid; gap: 2px; }
.sidebar-brand-title { line-height: 1.2; white-space: nowrap; }
.sidebar-brand-shop { color: #c7ced9; font-size: .72rem; font-weight: 500; line-height: 1.25; overflow-wrap: anywhere; }
.sidebar-toggle { display: none; }
.sidebar-menu { min-height: 0; flex: 1; display: flex; flex-direction: column; }
.sidebar-nav { display: grid; gap: 4px; padding: 18px 9px; }
.nav-link {
    min-height: 44px;
    width: 100%;
    padding: 9px 11px;
    display: flex;
    align-items: center;
    gap: 11px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: #f7f8fb;
    text-align: left;
    text-decoration: none;
    font: inherit;
    font-size: .88rem;
    cursor: pointer;
    transition: background .15s, color .15s;
}
.nav-link svg { width: 18px; height: 18px; flex: 0 0 18px; fill: currentColor; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.nav-link:hover, .nav-link[aria-current="page"] { background: var(--nav-active); color: #fff; }
.sidebar-footer { margin-top: auto; padding: 13px 9px 15px; border-top: 1px solid rgba(255,255,255,.16); }
.sidebar-account { padding: 0 2px 8px; display: grid; gap: 1px; }
.sidebar-account span { color: #aab4c5; font-size: .75rem; }
.sidebar-account strong { color: #fff; font-size: .8rem; }
.sidebar-footer form { margin: 0; }
.nav-logout { color: #f28a8b; }
.nav-logout:hover { background: rgba(255,255,255,.08); color: #ffaaaa; }

.workspace { min-width: 0; flex: 1; display: flex; flex-direction: column; background: var(--paper); }
.workspace-header {
    min-height: 62px;
    padding: 0 4%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
    color: #343c4b;
    font-size: .88rem;
}
.workspace-user { color: var(--muted); font-size: .82rem; }
.page-content { width: min(1120px, 92%); margin: 0 auto; padding: 35px 0 44px; flex: 1; }
.site-footer { padding: 14px 4%; color: #87909c; font-size: .76rem; }
.topbar { min-height: 66px; padding: 0 5.5%; display: flex; align-items: center; background: #fff; border-bottom: 1px solid var(--line); }

.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.page-heading .muted { margin: 0; }
.eyebrow { margin-bottom: 7px; color: #41516a; font-size: .82rem; font-weight: 600; }
.muted { color: var(--muted); font-size: .92rem; }
.role-badge { flex: 0 0 auto; padding: 6px 11px; border: 1px solid #e1e5eb; border-radius: 4px; background: #f7f8fa; color: #455064; font-size: .77rem; font-weight: 600; }

.panel { margin-bottom: 20px; padding: 24px; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); box-shadow: var(--shadow); }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.section-heading .muted { margin: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.field { display: flex; flex-direction: column; gap: 7px; }
label { color: #354052; font-size: .87rem; font-weight: 600; }
.label-hint { color: #818a98; font-size: .76rem; font-weight: 400; }
input:not([type="checkbox"]) {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 1px solid #dce1e8;
    border-radius: 5px;
    outline: none;
    background: #fff;
    color: var(--ink);
    transition: border-color .15s, box-shadow .15s;
}
select {
    width: 100%;
    min-height: 44px;
    padding: 9px 34px 9px 12px;
    border: 1px solid #dce1e8;
    border-radius: 5px;
    outline: none;
    background: #fff;
    color: var(--ink);
    font: inherit;
}
select:focus { border-color: #5e6c85; box-shadow: 0 0 0 3px rgba(6, 16, 41, .09); }
[hidden] { display: none !important; }
input:not([type="checkbox"]):focus { border-color: #5e6c85; box-shadow: 0 0 0 3px rgba(6, 16, 41, .09); }
.password-control { position: relative; }
.password-control input:not([type="checkbox"]) { padding-right: 45px; }
.password-toggle {
    width: 36px;
    height: 36px;
    padding: 8px;
    position: absolute;
    top: 50%;
    right: 5px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: #697386;
    cursor: pointer;
    transform: translateY(-50%);
}
.password-toggle:hover { background: #f0f2f5; color: var(--navy); }
.password-toggle:focus-visible { outline: 2px solid #53627a; outline-offset: 1px; }
.password-toggle svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.password-eye-off, .password-toggle[aria-pressed="true"] .password-eye { display: none; }
.password-toggle[aria-pressed="true"] .password-eye-off { display: block; }
.form-action { display: flex; align-items: flex-end; }
.shop-name-heading { font-size: clamp(2rem, 5vw, 2.8rem); overflow-wrap: anywhere; }
.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.stat-card { min-width: 0; min-height: 112px; padding: 17px 18px; display: flex; flex-direction: column; justify-content: space-between; gap: 9px; border: 1px solid var(--line); border-radius: 6px; background: #fff; box-shadow: var(--shadow); }
.stat-card > span { color: #647084; font-size: .82rem; }
.stat-card > span small { color: #8992a0; font-size: .73rem; }
.stat-card strong { color: #172130; font-size: clamp(1.05rem, 2vw, 1.35rem); line-height: 1.2; overflow-wrap: anywhere; }
.profit-negative { color: #b53c39 !important; }
.field-span { grid-column: 1 / -1; }
.products-page { padding-bottom: 108px; }
.profit-preview { padding: 14px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; border: 1px solid var(--line); border-radius: 5px; background: #f8f9fb; }
.profit-preview > div { display: grid; gap: 4px; }
.profit-preview span { color: #687386; font-size: .78rem; }
.profit-preview strong { color: #1a2638; font-size: .95rem; }
.price-warning, .loss-note { color: #ad3633; font-size: .8rem; font-weight: 600; }
.price-warning { margin: 9px 0 0; }
.image-processing-status { margin: 8px 0 0; color: var(--muted); font-size: .8rem; }
.image-processing-status.is-error { color: #ad3633; }
.image-upload-control { position: relative; }
.image-upload-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.image-upload-control .image-file-input {
    width: 1px;
    height: 1px;
    min-height: 0;
    margin: -1px;
    padding: 0;
    position: absolute;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
}
.button.image-capture-button, .button.image-gallery-button { min-height: 48px; flex: 1 1 180px; gap: 9px; }
.camera-action-icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.image-file-input:focus-visible + .button { outline: 3px solid rgba(6, 16, 41, .25); outline-offset: 3px; }
.camera-hint { margin: 0; color: var(--muted); font-size: .78rem; }
.current-image { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .8rem; }
.current-image img { border: 1px solid var(--line); border-radius: 5px; object-fit: cover; }
.product-list { display: grid; gap: 12px; }
.product-card { padding: 17px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.product-card-main { display: flex; align-items: center; gap: 13px; }
.product-image { width: 76px; height: 76px; flex: 0 0 76px; border: 1px solid var(--line); border-radius: 5px; background: #f4f5f7; object-fit: cover; }
.product-image-empty { display: grid; place-items: center; color: #87909c; font-size: .7rem; }
.product-title { min-width: 0; }
.product-title h3 { margin: 5px 0 0; overflow-wrap: anywhere; }
.product-stock { display: inline-block; color: var(--green); font-size: .72rem; font-weight: 600; }
.product-stock-empty { color: #9c5b12; }
.product-metrics { margin-top: 16px; padding: 13px 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.product-metrics-readonly { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.product-metrics > div { min-width: 0; display: grid; align-content: start; gap: 4px; }
.product-metrics span { color: #778193; font-size: .72rem; }
.product-metrics strong { font-size: .81rem; overflow-wrap: anywhere; }
.product-actions { padding-top: 13px; display: flex; align-items: flex-start; flex-wrap: wrap; gap: 8px; }
.product-actions > a { color: inherit; }
.product-action-details { position: relative; }
.product-action-details summary.button { width: fit-content; color: var(--red); }
.button {
    min-height: 44px;
    padding: 8px 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    font-size: .85rem;
    font-weight: 600;
    transition: background .15s, border-color .15s, transform .15s;
}
.button:hover { transform: translateY(-1px); }
.button:focus-visible, summary:focus-visible { outline: 3px solid rgba(6, 16, 41, .22); outline-offset: 2px; }
.button-primary { background: var(--navy); color: #fff; }
.button-primary:hover { background: var(--navy-hover); }
.button-secondary { border-color: #dce1e8; background: #fff; color: #354052; }
.button-secondary:hover { border-color: #aeb8c7; background: #f8f9fb; }
.button-danger { background: var(--red-soft); color: var(--red); }
.button-danger:hover { background: #ffe2e0; }
.button-quiet { min-height: 34px; padding: 6px 10px; background: transparent; color: #657082; }
.button-quiet:hover { background: #f1f3f6; }
.button-small { min-height: 44px; padding: 6px 10px; font-size: .77rem; }
.button-wide { width: 100%; margin-top: 8px; }
.product-bottom-bar {
    position: fixed;
    z-index: 20;
    right: 0;
    bottom: 0;
    left: 210px;
    padding: 12px 4%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    border-top: 1px solid var(--line);
    background: rgba(255, 255, 255, .97);
    box-shadow: 0 -7px 22px rgba(17, 29, 53, .07);
    backdrop-filter: blur(12px);
}
.product-bottom-bar .button { min-height: 52px; font-size: .92rem; }
.product-bottom-bar-single { grid-template-columns: minmax(0, 1fr); }
.app-dialog {
    width: min(660px, calc(100vw - 24px));
    max-width: 660px;
    max-height: min(90vh, 880px);
    max-height: min(90dvh, 880px);
    margin: auto;
    padding: clamp(18px, 4vw, 28px);
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fff;
    color: var(--ink);
    box-shadow: 0 24px 80px rgba(6, 16, 41, .25);
}
.app-dialog::backdrop { background: rgba(6, 16, 41, .62); backdrop-filter: blur(2px); }
.dialog-heading { margin-bottom: 18px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dialog-heading h2 { margin-bottom: 4px; }
.dialog-heading .muted { margin: 0; }
.dialog-close { flex: 0 0 auto; }
.sale-product-list { display: grid; gap: 9px; }
.sale-product-row { min-width: 0; padding: 10px; display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.sale-product-image { width: 56px; height: 56px; flex: 0 0 56px; border: 1px solid var(--line); border-radius: 6px; background: #f4f5f7; object-fit: cover; }
.sale-product-info { min-width: 0; display: grid; gap: 2px; }
.sale-product-info strong { overflow-wrap: anywhere; font-size: .9rem; }
.sale-product-info span { font-size: .82rem; font-weight: 600; }
.sale-product-info small { color: var(--muted); font-size: .75rem; }
.sale-product-row button:disabled { opacity: .58; cursor: not-allowed; }
.sale-back-button { margin-bottom: 14px; }
.sale-selected-product { margin-bottom: 16px; padding: 12px; display: flex; align-items: center; gap: 12px; border-radius: 7px; background: #f7f8fa; }
.sale-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.sale-profit-preview { padding: 13px; display: grid; grid-column: 1 / -1; grid-template-columns: minmax(0, 1fr); gap: 10px; border: 1px solid var(--line); border-radius: 6px; background: #f8f9fb; }
.sale-profit-preview > div { min-width: 0; display: grid; align-content: start; gap: 4px; }
.sale-profit-preview span { color: var(--muted); font-size: .74rem; }
.sale-profit-preview strong { overflow-wrap: anywhere; font-size: .88rem; }
.sale-profit-note { margin: -4px 0 0; grid-column: 1 / -1; font-size: .8rem; }
.sale-submit { min-height: 48px; grid-column: 1 / -1; }
.sales-filter-panel { padding-bottom: 17px; }
.sales-filter-form { display: grid; grid-template-columns: minmax(150px, 1fr) repeat(2, minmax(155px, .8fr)) auto; align-items: end; gap: 12px; }
.sales-filter-submit { width: 100%; min-height: 44px; }
.sales-period { margin: 13px 0 0; color: var(--muted); font-size: .82rem; }
.sales-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 20px; }
.sales-summary-manager { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.sales-transactions .section-heading { margin-bottom: 14px; }
.sales-list { display: grid; gap: 10px; }
.sales-transaction { min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.sales-transaction-heading { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: .77rem; }
.sales-transaction-heading span { flex: 0 0 auto; }
.sales-transaction-product { margin-top: 6px; font-size: .98rem; font-weight: 650; overflow-wrap: anywhere; }
.sales-transaction-metrics { margin-top: 12px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.sales-transaction-metrics-manager { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.sales-transaction-metrics > div { min-width: 0; display: grid; gap: 3px; }
.sales-transaction-metrics span { color: var(--muted); font-size: .72rem; }
.sales-transaction-metrics strong { font-size: .84rem; overflow-wrap: anywhere; }
.sales-transaction-seller { margin-top: 11px; padding-top: 9px; border-top: 1px solid var(--line); color: var(--muted); font-size: .76rem; }
.sales-pagination { margin-top: 17px; display: flex; align-items: center; justify-content: center; gap: 16px; }
.sales-pagination > span { color: var(--muted); font-size: .82rem; }
.sales-pagination [aria-disabled="true"] { opacity: .55; cursor: default; }
.print-report-header { padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.print-report-header p { margin: 5px 0; color: var(--muted); font-size: .86rem; }
.print-report-summary { margin: 16px 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.print-report-summary > div { min-width: 0; padding: 11px; display: grid; gap: 4px; border: 1px solid var(--line); border-radius: 5px; }
.print-report-summary span { color: var(--muted); font-size: .75rem; }
.print-report-summary strong { overflow-wrap: anywhere; font-size: .9rem; }
.print-report-note { color: var(--muted); font-size: .78rem; }
.sales-print-table-wrap { overflow-x: auto; }
.sales-print-table { width: 100%; min-width: 1040px; border-collapse: collapse; font-size: .76rem; }
.sales-print-table th, .sales-print-table td { padding: 8px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.sales-print-table th { background: #f5f6f8; color: #394456; font-weight: 650; }
.sales-print-table td:nth-child(5), .sales-print-table tfoot td:nth-child(2) { text-align: right; }
.sales-print-table tfoot { font-weight: 700; }
.sales-print-actions { margin-top: 18px; display: flex; justify-content: flex-end; gap: 10px; }

.shop-list { display: grid; gap: 13px; }
.shop-card { padding: 18px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.shop-card-top { display: flex; justify-content: space-between; gap: 20px; }
.shop-card h3 { margin-top: 8px; }
.shop-card p { margin-bottom: 0; }
.status { display: inline-block; padding: 3px 8px; border-radius: 3px; font-size: .7rem; font-weight: 600; }
.status-active { background: var(--green-soft); color: var(--green); }
.status-inactive { background: #f0f1f3; color: #687281; }
.admin-summary { min-width: 180px; display: flex; flex-direction: column; gap: 2px; font-size: .83rem; }
.admin-summary strong { margin-top: 3px; }
.admin-summary > span:last-child { color: var(--muted); overflow-wrap: anywhere; }
.shop-edit { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.shop-edit summary, .delete-details summary { width: fit-content; color: #273853; cursor: pointer; font-size: .82rem; font-weight: 600; }
.compact-grid { padding-top: 15px; }
.shop-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin-top: 15px; }
.shop-actions form { margin: 0; }
.delete-details { position: relative; }
.delete-details summary.button { color: var(--red); }
.delete-confirm { width: min(320px, 88vw); margin-top: 10px; padding: 13px; display: grid; gap: 12px; border: 1px solid #f1d2cd; border-radius: 6px; background: #fffafa; }
.check-label { display: flex; align-items: flex-start; gap: 8px; line-height: 1.4; font-size: .78rem; }
.check-label input { margin-top: 3px; accent-color: var(--red); }
.empty-state { padding: 30px 16px; text-align: center; color: var(--muted); }
.empty-state h3 { color: var(--ink); }
.empty-state p { margin: 0; font-size: .88rem; }
.empty-icon { width: 34px; height: 34px; margin: 0 auto 10px; display: grid; place-items: center; border-radius: 50%; background: #f0f2f6; color: var(--navy); font-size: 1.2rem; }
.dashboard-grid { display: grid; grid-template-columns: minmax(260px, .82fr) minmax(0, 1.18fr); gap: 20px; align-items: start; }
.form-stack { display: flex; flex-direction: column; gap: 9px; }
.form-stack label:not(:first-of-type) { margin-top: 5px; }
.form-stack .button { margin-top: 8px; }
.manager-list { display: flex; flex-direction: column; }
.manager-row { min-height: 64px; display: flex; align-items: center; gap: 12px; border-top: 1px solid var(--line); }
.manager-row:first-child { border-top: 0; }
.manager-row form { margin-left: auto; }
.avatar { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: #eff1f5; color: var(--navy); font-weight: 600; }
.manager-info { display: flex; flex-direction: column; min-width: 0; }
.manager-info strong { font-size: .87rem; }
.manager-info span { color: var(--muted); font-size: .78rem; overflow-wrap: anywhere; }
.compact-empty { padding: 24px 10px; }
.welcome-panel { display: flex; align-items: center; gap: 18px; }
.welcome-panel h2 { margin-bottom: 4px; }
.welcome-panel p { margin: 0; }
.welcome-icon { width: 44px; height: 44px; display: grid; flex: 0 0 auto; place-items: center; border-radius: 50%; background: #f0f2f6; color: var(--navy); font-size: 1.2rem; font-weight: 600; }

.notice { margin-bottom: 18px; padding: 12px 14px; border: 1px solid transparent; border-radius: 5px; font-size: .87rem; }
.notice-success { border-color: #cde7d7; background: #f0faf4; color: #216442; }
.notice-error { border-color: #f0d2cf; background: #fff4f2; color: #9f3f37; }
.auth-wrap { width: min(450px, 100%); margin: 5vh auto; }
.auth-card { padding: 30px; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); box-shadow: var(--shadow); }
.auth-card > .muted { margin-bottom: 24px; }
.auth-footnote { margin: 19px 0 0; color: var(--muted); text-align: center; font-size: .82rem; }

@media (max-width: 760px) {
    .app-shell-dashboard { flex-direction: column; }
    .sidebar { width: 100%; min-height: 0; flex: 0 0 auto; }
    .sidebar-topbar { min-height: 70px; padding-right: 10px; }
    .sidebar-brand { min-height: 68px; padding: 0 16px; }
    .sidebar-brand-shop { max-width: min(60vw, 260px); }
    .sidebar-toggle {
        width: 44px;
        height: 44px;
        flex: 0 0 44px;
        padding: 10px;
        display: grid;
        place-items: center;
        border: 1px solid rgba(255,255,255,.24);
        border-radius: 6px;
        background: transparent;
        color: #fff;
        cursor: pointer;
    }
    .sidebar-toggle:hover { background: rgba(255,255,255,.08); }
    .sidebar-toggle:focus-visible { outline: 3px solid rgba(255,255,255,.55); outline-offset: 2px; }
    .sidebar-toggle svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
    .sidebar-toggle[aria-expanded="true"] .menu-icon-open,
    .sidebar-toggle[aria-expanded="false"] .menu-icon-close { display: none; }
    .sidebar-menu { display: none; }
    .sidebar.is-open .sidebar-menu { display: flex; }
    .sidebar-nav { display: grid; gap: 4px; overflow: visible; padding: 8px 12px; }
    .nav-link { width: 100%; min-width: 0; }
    .sidebar-footer { margin: 0; padding: 10px 12px max(10px, env(safe-area-inset-bottom)); display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid rgba(255,255,255,.12); }
    .sidebar-footer form { flex: 0 0 auto; }
    .sidebar-account { min-width: 0; padding: 0; }
    .sidebar-account strong { overflow-wrap: anywhere; }
    .nav-logout { width: auto; }
    .workspace-header { min-height: 50px; padding: 8px 16px; gap: 10px; }
    .workspace-header > :first-child { min-width: 0; overflow-wrap: anywhere; }
    .workspace-user { flex: 0 0 auto; text-align: right; }
    .page-content { width: 94%; padding: 22px 0 30px; }
    .product-bottom-bar { right: 0; bottom: 0; left: 0; padding: 10px 3% max(10px, env(safe-area-inset-bottom)); gap: 9px; }
    .product-bottom-bar .button { min-height: 54px; }
    .panel { padding: 19px; }
    .form-grid, .dashboard-grid { grid-template-columns: 1fr; }
    .field-span { grid-column: auto; }
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .stat-card { min-height: 98px; padding: 13px; }
    .product-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .profit-preview { grid-template-columns: 1fr; }
    .sale-form { grid-template-columns: 1fr; }
    .sale-profit-preview { grid-template-columns: 1fr; }
    .sale-profit-note, .sale-submit { grid-column: auto; }
    .sales-filter-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sales-filter-form > .field:first-child, .sales-filter-submit { grid-column: 1 / -1; }
    .sales-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sales-transaction-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .print-report-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sales-print-actions .button { flex: 1; }
    .app-dialog { width: calc(100vw - 16px); max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px); padding: 17px; }
    .form-action .button { width: 100%; min-height: 48px; }
    .page-heading { flex-wrap: wrap; }
    .page-heading > div { min-width: 0; }
    .page-heading > .button { width: 100%; }
    .shop-card-top { flex-direction: column; gap: 14px; }
    .admin-summary { min-width: 0; padding-top: 12px; border-top: 1px solid var(--line); }
    .page-heading { margin-bottom: 21px; }
    .auth-wrap { margin: 2vh auto; }
}

@page { size: landscape; margin: 12mm; }
@media print {
    body { min-width: 0; background: #fff; color: #000; font-size: 8pt; }
    .app-shell-dashboard, .workspace { min-height: 0; display: block; background: #fff; }
    .sidebar, .workspace-header, .site-footer, .sales-print-actions { display: none !important; }
    .page-content { width: 100%; margin: 0; padding: 0; }
    .print-report-header { border-color: #888; }
    .print-report-header p, .print-report-note { color: #333; }
    .print-report-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 5px; margin: 10px 0; }
    .print-report-summary > div { padding: 6px; border-color: #888; }
    .print-report-summary span { color: #333; }
    .sales-print-table-wrap { overflow: visible; }
    .sales-print-table { min-width: 0; font-size: 6.5pt; }
    .sales-print-table th, .sales-print-table td { padding: 4px; border-color: #888; }
    .sales-print-table th { background: #eee !important; color: #000; print-color-adjust: exact; }
    .sales-print-table tr { break-inside: avoid; }
}

@media (max-width: 430px) {
    .auth-card { padding: 23px 19px; }
    .panel { padding: 16px; }
    .shop-card { padding: 14px; }
    .page-heading { gap: 10px; }
    .role-badge { padding: 5px 8px; }
    .stat-card strong { font-size: 1rem; }
    .product-card { padding: 14px; }
    .product-actions { gap: 7px; }
    .product-actions .button-small { padding: 6px 9px; }
    .image-capture-button, .image-gallery-button { flex-basis: 100%; }
    .sale-product-row { grid-template-columns: 48px minmax(0, 1fr) auto; gap: 8px; padding: 8px; }
    .sale-product-image { width: 48px; height: 48px; flex-basis: 48px; }
}
