:root {
    color-scheme: light;
    --ink: #0a2831;
    --text: #17353d;
    --muted: #56696d;
    --teal: #14594e;
    --paper: #f7f8f5;
    --surface: #fff;
    --line: #dce5e1;
    --mint: #d8efec;
    --lime: #d9f77a;
    --danger: #9d3032;
    --radius: 0.9rem;
    font: 100%/1.5 system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); color: var(--text); }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { color: var(--ink); line-height: 1.15; letter-spacing: -0.025em; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: 0.55; }
:focus-visible { outline: 2px solid #1c7464; outline-offset: 3px; }
svg:not(.icon-library) { width: 1.15rem; height: 1.15rem; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: fixed; top: 0.5rem; left: 0.5rem; z-index: 5; transform: translateY(-200%); padding: 0.6rem 1rem; border-radius: 0.35rem; background: var(--lime); color: var(--ink); font-weight: 700; }
.skip-link:focus { transform: translateY(0); }

.app-shell { display: grid; grid-template-columns: 15rem minmax(0, 1fr); min-height: 100dvh; }
.sidebar {
    --sidebar-ink: #10294b;
    --sidebar-muted: #bfd2e4;
    --sidebar-line: #3c5672;
    --sidebar-hover: #213d5e;
    --sidebar-accent: #d8eff8;
    position: sticky;
    top: 0;
    z-index: 3;
    align-self: start;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow: auto;
    padding: 1.35rem 0.9rem 1rem;
    background: var(--sidebar-ink);
    color: #edf5fb;
}
.sidebar :focus-visible { outline-color: var(--sidebar-accent); }
.sidebar-heading { display: flex; align-items: center; justify-content: space-between; gap: 0.7rem; }
.wordmark { display: inline-flex; align-items: center; gap: 0.7rem; margin: 0 0.4rem; text-decoration: none; font-size: 1.2rem; font-weight: 800; letter-spacing: -0.04em; line-height: 1.1; }
.wordmark small { display: block; margin-top: 0.35rem; color: #bed4ce; font-size: 0.59rem; letter-spacing: 0.12em; }
.brand-mark { display: grid; place-items: center; width: 2.2rem; height: 2.2rem; flex: none; border-radius: 0.65rem; background: var(--lime); color: var(--ink); }
.brand-mark svg { width: 1.4rem; height: 1.4rem; stroke-width: 2.3; }
.sidebar .wordmark small { color: var(--sidebar-muted); }
.sidebar .brand-mark { background: var(--sidebar-accent); color: var(--sidebar-ink); }
.panel-menu-toggle { display: none; }
.sidebar-menu { flex: 1 0 auto; display: flex; flex-direction: column; gap: 1rem; margin-top: 1.65rem; }
.panel-nav { display: grid; gap: 1rem; }
.nav-group { display: grid; gap: 0.18rem; align-content: start; min-width: 0; }
.nav-label { margin: 0 0.65rem 0.18rem; color: var(--sidebar-muted); font-size: 0.65rem; font-weight: 760; letter-spacing: 0.105em; }
.panel-nav a, .sidebar-action { display: flex; align-items: center; gap: 0.62rem; min-height: 2.75rem; padding: 0.55rem 0.65rem; border: 0; border-radius: 0.55rem; background: transparent; color: inherit; font-size: 0.9rem; font-weight: 650; text-align: left; text-decoration: none; white-space: nowrap; }
.sidebar-action:hover { background: #24434a; }
.panel-nav a:hover, .sidebar .sidebar-action:hover:not(:disabled) { background: var(--sidebar-hover); }
.panel-nav a[aria-current="page"] { background: var(--sidebar-accent); color: var(--sidebar-ink); font-weight: 780; }
.sidebar-footer { display: grid; gap: 0.12rem; margin-top: auto; padding-top: 0.65rem; border-top: 1px solid var(--sidebar-line); }
.sidebar-action { width: 100%; color: #cde1dc; }
.sidebar .sidebar-action { color: var(--sidebar-muted); }

.workspace { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 2; display: flex; min-height: 4.4rem; align-items: center; justify-content: space-between; gap: 0.7rem; padding: 0.55rem clamp(1.1rem, 4vw, 3rem); background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-context { display: flex; align-items: baseline; gap: 0.48rem; min-width: 0; color: var(--muted); font-size: 0.88rem; overflow-wrap: anywhere; }
.topbar-home { text-decoration: none; }
.topbar-home:hover { text-decoration: underline; text-underline-offset: 0.18em; }
.topbar-context strong { color: var(--ink); }
.topbar .button { flex: none; min-height: 2.75rem; }
.content { max-width: 92rem; margin-inline: auto; padding: clamp(1.2rem, 4vw, 3rem); scroll-margin-top: 4.5rem; }
.page-intro { display: flex; align-items: end; justify-content: space-between; gap: 1.2rem; margin-bottom: 1.7rem; }
.kicker { color: var(--teal); font-size: 0.68rem; font-weight: 800; letter-spacing: 0.14em; }
h1 { margin-top: 0.32rem; font-size: clamp(1.9rem, 5vw, 3rem); font-weight: 800; }
.page-intro h1 + p { margin-top: 0.48rem; color: var(--muted); }
.button, .icon-button { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; border: 1px solid transparent; border-radius: 0.55rem; font-weight: 700; line-height: 1.2; text-decoration: none; white-space: nowrap; }
.button { min-height: 2.55rem; padding: 0.55rem 0.9rem; font-size: 0.875rem; }
.button-primary { background: var(--ink); color: #fff; }
.button-primary:hover:not(:disabled) { background: var(--teal); }
.button-light { border-color: var(--line); background: var(--surface); color: var(--text); }
.button-light:hover:not(:disabled) { background: #eff5f2; }
.button-small { min-height: 2.15rem; padding-inline: 0.7rem; font-size: 0.8rem; }
.icon-button { width: 2.5rem; height: 2.5rem; padding: 0; border-color: var(--line); background: var(--surface); color: var(--ink); }
.icon-button:hover { background: var(--paper); }
.text-button { padding: 0; border: 0; background: transparent; color: var(--teal); font-weight: 700; text-underline-offset: 0.18em; }
.text-button:hover { text-decoration: underline; }
.text-button.danger { color: var(--danger); }

.notice { margin-bottom: 1rem; padding: 0.7rem 0.85rem; border: 1px solid #b8d8ce; border-radius: 0.55rem; background: #e9f5f0; color: #204d41; overflow-wrap: anywhere; }
.notice.error { border-color: #eed1ce; background: #fdf0ef; color: #853031; }
.notice.demo-note { border-color: #ebddb4; background: #fdf7e7; color: #6b5320; font-size: 0.86rem; }
.card, .metric { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.9rem; }
.metric { display: grid; grid-template-columns: 1fr auto; gap: 0.45rem; align-items: start; padding: 1.15rem; text-decoration: none; }
.metric:hover { border-color: #91b8ad; }
.metric-icon { grid-column: 2; grid-row: 1 / 3; display: grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 0.65rem; background: var(--mint); color: var(--teal); }
.metric-label { font-size: 0.87rem; font-weight: 700; color: var(--muted); }
.metric strong { font-size: 2rem; color: var(--ink); line-height: 1.05; font-variant-numeric: tabular-nums; }
.metric-note { grid-column: 1 / -1; margin-top: 0.35rem; color: var(--muted); font-size: 0.78rem; }
.activity { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.9rem; margin-top: 1rem; }
.activity-card { min-width: 0; padding: 1.05rem 1.1rem; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 0.65rem; margin-bottom: 0.8rem; }
.card-head h2 { font-size: 1.05rem; }
.card-head a { display: inline-flex; align-items: center; gap: 0.25rem; color: var(--teal); font-size: 0.78rem; font-weight: 700; text-decoration: none; white-space: nowrap; }
.card-head a:hover { text-decoration: underline; }
.card-head a svg { width: 0.9rem; height: 0.9rem; }
.activity-list { list-style: none; margin: 0; padding: 0; }
.activity-list li { border-top: 1px solid var(--line); }
.activity-list .empty { padding: 1.05rem 0; text-align: left; }
.activity-item { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; width: 100%; padding: 0.65rem 0.1rem; border: 0; background: transparent; color: var(--ink); text-align: left; }
.activity-item:hover strong { text-decoration: underline; }
.activity-item strong, .product-label strong { display: block; font-size: 0.91rem; overflow-wrap: anywhere; }
.secondary { display: block; color: var(--muted); font-size: 0.76rem; overflow-wrap: anywhere; }

.overview-intro { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 1.15rem; margin-bottom: 1.25rem; padding: clamp(1rem, 3.4vw, 2.25rem); border: 1px solid #c8ded7; border-radius: 1.1rem; background: linear-gradient(115deg, #ebf5ed, #f4f8ee 80%); }
.overview-intro h1 + p { margin-top: .45rem; color: var(--muted); }
.overview-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.overview-actions .button { min-height: 2.7rem; }
.overview-stock { grid-column: 1 / -1; }
.overview-stock .card-head p { margin-top: .2rem; color: var(--muted); font-size: .82rem; }
.overview-stock-list .activity-item { min-height: 3.2rem; }
.overview-stock-more { padding-top: .65rem; }

@media (max-width: 38rem) {
    .overview-actions { display: grid; grid-template-columns: minmax(0, 1fr); width: 100%; }
    .overview-actions .button { white-space: normal; }
    .overview-stock .card-head { flex-wrap: wrap; }
}

.data-tools { display: flex; align-items: center; gap: 0.65rem; flex-wrap: wrap; padding: 0.8rem 1rem; }
.finance-filters { display: flex; flex-wrap: wrap; gap: 0.65rem 0.9rem; margin-bottom: 1rem; padding: 0.85rem 1rem; }
.finance-filters label { display: grid; flex: 0 1 13.5rem; gap: 0.3rem; min-width: 0; color: var(--ink); font-size: 0.86rem; font-weight: 700; }
.finance-filters :is(input, select) { width: 100%; min-width: 0; min-height: 2.75rem; padding: 0.46rem 0.6rem; border: 1px solid var(--line); border-radius: 0.5rem; color: var(--text); background: var(--surface); font-weight: 550; }
.finance-totals { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 10.75rem), 1fr)); gap: 0.65rem; margin-bottom: 1rem; }
.finance-totals:empty, .finance-report-table:has(#finance-report-products:empty) { display: none; }
.finance-total { display: grid; align-content: start; gap: 0.24rem; min-width: 0; padding: 0.75rem 0.85rem; border: 1px solid var(--line); border-radius: 0.64rem; background: var(--surface); overflow-wrap: anywhere; }
.finance-total span { color: var(--muted); font-size: 0.8rem; font-weight: 650; }
.finance-total strong { color: var(--ink); font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.finance-report-table .card-head { margin: 0; padding: 0.8rem 1rem; }
.finance-report-table .table-scroll:focus-visible { outline-offset: -3px; }
.search-field { display: flex; align-items: center; gap: 0.5rem; flex: 1 1 15rem; max-width: 28rem; min-height: 2.55rem; padding-left: 0.65rem; border: 1px solid var(--line); border-radius: 0.55rem; color: var(--muted); }
.search-field:focus-within { outline: 2px solid #1c7464; outline-offset: 2px; }
.search-field input { width: 100%; min-width: 0; height: 2.4rem; border: 0; background: transparent; outline: none; color: var(--ink); font-size: 0.88rem; }
.filter-field { max-width: 100%; }
.filter-field select { min-height: 2.55rem; max-width: min(100%, 15rem); padding: 0.35rem 0.55rem; border: 1px solid var(--line); border-radius: 0.55rem; background: var(--surface); color: var(--ink); font-size: 0.86rem; }
.table-scroll { overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; font-size: 0.87rem; }
thead { background: #f1f6f3; color: #3d5658; font-size: 0.76rem; }
th, td { padding: 0.66rem 0.95rem; vertical-align: middle; }
th { font-weight: 750; white-space: nowrap; }
tbody td { border-top: 1px solid var(--line); }
tbody tr:last-child td:first-child { border-bottom-left-radius: var(--radius); }
tbody tr:last-child td:last-child { border-bottom-right-radius: var(--radius); }
.product-label { display: flex; align-items: center; gap: 0.65rem; min-width: 13rem; }
.products-table .product-label > div { min-width: 0; }
.thumb { display: grid; place-items: center; width: 2.7rem; height: 2.7rem; flex: none; overflow: hidden; border: 1px solid var(--line); border-radius: 0.45rem; background: #f1f6f3; color: #547471; }
.thumb img { width: 100%; height: 100%; object-fit: contain; }
.row-actions { display: flex; justify-content: end; gap: 0.65rem; align-items: center; white-space: nowrap; }
.row-actions .text-button { font-size: 0.8rem; }
.product-table-container { container: product-catalog / inline-size; }
.product-mobile-summary { display: none; }
.product-stock-button { min-height: 2rem; text-align: start; text-decoration: underline; }

@container product-catalog (max-width: 58rem) {
    .products-table { table-layout: fixed; }
    .products-table :is(th, td):not(:first-child):not(:last-child) { display: none; }
    .products-table :is(th, td):last-child { width: 17rem; }
    .products-table .product-label { min-width: 0; align-items: start; }
    .product-mobile-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 0.2rem 0.55rem; margin-top: 0.28rem; }
    .product-mobile-summary .product-mobile-price { font-size: 0.8rem; }
}

@container product-catalog (max-width: 35rem) {
    .products-table :is(th, td) { padding-inline: 0.55rem; }
    .products-table :is(th, td):last-child { width: 7.25rem; }
    .products-table .row-actions { align-items: end; flex-direction: column; gap: 0.25rem; white-space: normal; }
    .products-table .row-actions button { min-height: 2rem; text-align: end; }
    .products-table .product-label { gap: 0.45rem; }
    .products-table .thumb { width: 2.1rem; height: 2.1rem; }
}
.badge { display: inline-flex; align-items: center; width: fit-content; min-height: 1.45rem; padding: 0.2rem 0.53rem; border-radius: 999px; background: #edf1ee; color: #3f5754; font-size: 0.72rem; font-weight: 750; line-height: 1.1; white-space: nowrap; }
.badge.good { background: #e2f4e9; color: #20533e; }
.badge.info { background: #e0f0f5; color: #22556a; }
.badge.warn { background: #fbf0d6; color: #705817; }
.badge.bad { background: #fae8e7; color: #8a3335; }
.badges { display: flex; flex-wrap: wrap; gap: 0.28rem; }
.empty { padding: 1.7rem 0.95rem; color: var(--muted); text-align: center; }
.number { font-variant-numeric: tabular-nums; white-space: nowrap; }
.adaptive-label { display: none; }

@media (max-width: 47rem) {
    .adaptive-table, .adaptive-table tbody { display: block; }
    .adaptive-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
    .adaptive-table tr { display: grid; gap: .48rem; padding: .85rem 1rem; border-top: 1px solid var(--line); }
    .adaptive-table td { display: grid; grid-template-columns: minmax(4rem, .7fr) minmax(0, 1.3fr); align-items: baseline; gap: .6rem; min-width: 0; padding: 0; border: 0; white-space: normal; overflow-wrap: anywhere; }
    .adaptive-table td:first-child, .adaptive-table td:last-child:not(:has(.adaptive-label)) { display: block; }
    .adaptive-table td:first-child { padding-bottom: .3rem; }
    .adaptive-table td:last-child:not(:has(.adaptive-label)) { padding-top: .3rem; }
    .adaptive-table td:last-child .row-actions { justify-content: start; flex-wrap: wrap; white-space: normal; }
    .adaptive-table td:last-child .button { min-height: 2.65rem; }
    .adaptive-table .product-label { min-width: 0; }
    .adaptive-label { display: block; color: var(--muted); font-size: .76rem; font-weight: 700; }
}

.content-tools { display: grid; gap: 0.85rem; padding: 0.95rem 1rem; }
.content-filters, .content-shortcuts, .content-save-actions { display: flex; align-items: end; flex-wrap: wrap; gap: 0.55rem 0.75rem; }
.content-section-field { display: grid; gap: 0.3rem; flex: 0 1 17rem; color: var(--ink); font-size: 0.83rem; font-weight: 700; }
.content-section-field select { width: 100%; max-width: none; }
.content-shortcuts { align-items: center; }
.content-shortcuts > span, .content-results-count { color: var(--muted); font-size: 0.81rem; }
.content-shortcuts > span { font-weight: 700; }
.content-results-count { margin-block: 0.8rem 0.5rem; }
.content-groups { display: grid; gap: 0.9rem; }
.content-group { min-width: 0; padding: 0.9rem 1rem 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.content-group h2 { margin-bottom: 0.85rem; font-size: 1.06rem; }
.content-field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
.content-field { display: grid; align-content: start; gap: 0.42rem; min-width: 0; padding: 0.65rem; border: 1px solid var(--line); border-radius: 0.6rem; }
.content-field-wide { grid-column: 1 / -1; }
.content-field-head { display: flex; align-items: center; justify-content: space-between; gap: 0.45rem; }
.content-label { display: block; color: var(--ink); font-size: 0.88rem; font-weight: 700; overflow-wrap: anywhere; }
.content-input { width: 100%; min-width: 0; min-height: 2.55rem; padding: 0.52rem 0.62rem; border: 1px solid #bfcfc9; border-radius: 0.5rem; background: var(--surface); color: var(--ink); font-size: 0.91rem; }
textarea.content-input { resize: vertical; }
.content-reset { justify-self: start; font-size: 0.76rem; }
.content-field-actions { display: flex; flex-wrap: wrap; gap: 0.3rem 0.8rem; }
.content-image-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 0.55rem; }
.content-image-source { color: var(--muted); font-size: 0.81rem; overflow-wrap: anywhere; }
.content-save-bar { position: sticky; bottom: 0.65rem; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 0.65rem; margin-top: 0.85rem; padding: 0.75rem 0.95rem; box-shadow: 0 0.2rem 0.9rem #0a283115; }
.content-save-bar p { color: var(--ink); font-size: 0.87rem; font-weight: 700; }
.content-save-bar .content-save-feedback { margin-top: 0.2rem; color: var(--teal); font-size: 0.78rem; font-weight: 600; overflow-wrap: anywhere; }
.content-save-bar .content-save-feedback.error { color: var(--danger); }

dialog { width: min(42rem, calc(100% - 1.5rem)); max-height: calc(100dvh - 1.5rem); margin: auto; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); color: var(--text); background: var(--surface); box-shadow: 0 1.5rem 4rem #0a283144; }
#stock-dialog { width: min(50rem, calc(100% - 1.5rem)); height: fit-content; }
#order-finance-dialog { width: min(49rem, calc(100% - 1.5rem)); height: fit-content; }
.order-finance-body .finance-totals { grid-template-columns: repeat(auto-fit, minmax(min(100%, 9.5rem), 1fr)); margin-bottom: 0; }
.order-finance-body > * + * { margin-top: 0.75rem; }
.finance-detail-section { min-width: 0; padding: 0.8rem; border: 1px solid var(--line); border-radius: 0.65rem; }
.finance-detail-section:has(.finance-records:empty) { display: none; }
.finance-detail-section h3 { font-size: 1.02rem; }
.finance-records { display: grid; gap: 0.45rem; margin-top: 0.55rem; overflow-wrap: anywhere; }
.finance-records > :is(div, p, ul) { margin: 0; }
.finance-form { display: grid; gap: 0.65rem; }
.finance-form > .field-note { margin: 0; }
.finance-form > button { justify-self: start; }
.finance-form .finance-restock { display: flex; align-items: center; gap: 0.5rem; min-height: 2.4rem; }
.finance-restock input { width: 1.1rem; height: 1.1rem; margin: 0; accent-color: var(--teal); }
.stock-inventory-controls { margin-bottom: 1.15rem; }
.stock-inventory-summary { margin-bottom: 0.65rem; padding: 0.7rem 0.85rem; border: 1px solid var(--line); border-radius: 0.55rem; color: var(--text); background: var(--paper); font-size: 0.88rem; font-weight: 650; overflow-wrap: anywhere; white-space: pre-line; }
.stock-inventory-forms { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.7rem; }
.stock-inventory-card { display: grid; align-content: start; gap: 0.65rem; min-width: 0; padding: 0.8rem; border: 1px solid var(--line); border-radius: 0.65rem; }
.stock-inventory-card h3, .stock-history h3 { font-size: 1.02rem; }
.stock-inventory-card > .field-note { margin-top: 0; }
.stock-inventory-card .form-grid { gap: 0.58rem; }
.stock-inventory-card > button { justify-self: start; }
.stock-inventory-card label .field-note { margin-top: 0; font-weight: 550; }
.stock-history:not(:has(#stock-table:not([hidden]), #stock-empty:not([hidden]))) { display: none; }
.stock-history h3 { margin-bottom: 0.55rem; }
.stock-history .table-scroll { border: 1px solid var(--line); border-radius: 0.55rem; }
dialog[open] { display: flex; flex-direction: column; }
dialog::backdrop { background: #071c24a3; }
body:has(dialog[open]) { overflow: hidden; }
dialog form { min-height: 0; display: flex; flex-direction: column; }
.dialog-head, .dialog-foot { display: flex; align-items: center; gap: 0.6rem; padding: 0.95rem 1.15rem; }
.dialog-head { justify-content: space-between; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin-top: 0.22rem; font-size: 1.3rem; overflow-wrap: anywhere; }
.dialog-body { min-height: 0; overflow: auto; padding: 1.15rem; }
.dialog-foot { justify-content: end; border-top: 1px solid var(--line); }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.9rem; }
.form-grid .wide { grid-column: 1 / -1; }
.dialog-body label, .login-card label { display: grid; gap: 0.32rem; color: var(--ink); font-size: 0.86rem; font-weight: 700; }
.dialog-body input:not([type="checkbox"]):not([type="file"]), .dialog-body textarea, .dialog-body select, .login-card input { width: 100%; min-height: 2.55rem; padding: 0.52rem 0.62rem; border: 1px solid #bfcfc9; border-radius: 0.5rem; background: var(--surface); color: var(--ink); font-size: 0.91rem; font-weight: 500; }
.dialog-body textarea { resize: vertical; }
.image-editor { display: grid; grid-template-columns: 6rem minmax(0, 1fr); gap: 0.75rem; align-items: start; margin-top: 1rem; padding: 0.75rem; border: 1px solid var(--line); border-radius: 0.6rem; background: #f7faf8; }
.image-preview { display: grid; place-items: center; width: 100%; aspect-ratio: 1; overflow: hidden; border: 1px solid var(--line); border-radius: 0.5rem; background: var(--surface); color: var(--muted); }
.image-preview img { width: 100%; height: 100%; object-fit: contain; }
.image-preview svg { width: 1.65rem; height: 1.65rem; }
.image-fields > input { margin-top: 0.3rem; }
.image-fields .file-field { position: relative; display: inline-flex; align-items: center; min-height: 2.3rem; gap: 0.35rem; margin-top: 0.55rem; padding: 0.28rem 0.6rem; border: 1px dashed #8eaaa0; border-radius: 0.5rem; background: var(--surface); cursor: pointer; }
.file-field input { position: absolute; inset: 0; width: 100%; opacity: 0; cursor: pointer; }
.file-field:focus-within { outline: 2px solid #1c7464; outline-offset: 3px; }
.field-note { margin-top: 0.35rem; color: var(--muted); font-size: 0.76rem; overflow-wrap: anywhere; }
#product-dialog { width: min(54rem, calc(100% - 1.5rem)); height: min(44rem, calc(100dvh - 1.5rem)); }
#product-dialog > form, #product-dialog .dialog-body { flex: 1; }
#product-dialog:has(.product-category-step:not([hidden])) { width: min(46rem, calc(100% - 1.5rem)); height: fit-content; }
#product-dialog > .product-category-step { flex: 0 1 auto; }
.product-dialog-item { margin-top: 0.2rem; color: var(--muted); font-size: 0.82rem; overflow-wrap: anywhere; }
.product-category-intro { margin-bottom: 0.85rem; }
.product-category-intro h3 { margin-block: 0.3rem; font-size: 1.2rem; }
.product-category-intro > p:last-child { color: var(--muted); font-size: 0.88rem; }
.product-step-count { display: inline-flex; flex: none; padding: 0.18rem 0.48rem; border-radius: 0.34rem; color: var(--teal); background: var(--mint); font-size: 0.72rem; font-weight: 780; font-variant-numeric: tabular-nums; }
.product-category-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
.product-category-options:empty { display: none; }
.product-category-option { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: 0.65rem; min-width: 0; min-height: 5.35rem; padding: 0.72rem; border: 1px solid var(--line); border-radius: 0.65rem; color: var(--ink); background: var(--surface); text-align: left; }
.product-category-option:hover { border-color: var(--teal); background: var(--paper); }
.product-category-option[aria-current="true"] { border-color: var(--teal); background: var(--mint); }
.product-category-icon { display: grid; place-items: center; width: 2.55rem; height: 2.55rem; border-radius: 0.53rem; color: var(--teal); background: var(--mint); }
.product-category-option-copy { min-width: 0; overflow-wrap: anywhere; }
.product-category-option-copy strong { display: block; font-size: 0.93rem; }
.product-category-option-copy small { display: -webkit-box; overflow: hidden; margin-top: 0.2rem; color: var(--muted); font-size: 0.8rem; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.product-category-option-arrow { align-self: center; color: var(--teal); }
.product-category-context { display: flex; flex: none; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.45rem 0.7rem; padding: 0.6rem 1.15rem; border-bottom: 1px solid var(--line); }
.product-category-context > div { display: flex; min-width: 0; align-items: center; gap: 0.45rem; font-size: 0.88rem; overflow-wrap: anywhere; }
.product-category-context .button { min-height: 2.55rem; }
.product-editor-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); flex: none; gap: 0.35rem; padding: 0.6rem 1.15rem; border-bottom: 1px solid var(--line); background: #f3f7f5; }
.product-editor-tabs button { min-height: 2.55rem; padding: 0.42rem; border: 1px solid transparent; border-radius: 0.48rem; background: transparent; color: var(--text); font-size: 0.85rem; font-weight: 700; }
.product-editor-tabs button:hover { border-color: var(--line); background: var(--surface); }
.product-editor-tabs button[aria-selected="true"] { border-color: var(--ink); background: var(--ink); color: white; }
.product-editor-panel { display: grid; min-width: 0; gap: 0.9rem; }
.product-editor-intro h3 { margin-bottom: 0.28rem; font-size: 1.06rem; }
.product-editor-intro p { color: var(--muted); font-size: 0.82rem; }
.product-editor-card { display: grid; min-width: 0; gap: 0.55rem; padding: 0.75rem; border: 1px solid var(--line); border-radius: 0.65rem; }
.product-editor-card h4 { margin: 0; color: var(--ink); font-size: 0.9rem; }
.product-editor-card > .field-note, .product-editor-actions .field-note { margin-top: 0; }
.product-editor-panel .product-cover-editor { margin-top: 0; }
.product-publish-options { display: grid; gap: 0.5rem; }
.product-publish-options legend { margin-bottom: 0.4rem; color: var(--ink); font-size: 0.9rem; font-weight: 750; }
.product-publish-options label { display: flex; align-items: start; gap: 0.55rem; padding: 0.65rem; border: 1px solid var(--line); border-radius: 0.5rem; background: #f7faf8; cursor: pointer; }
.product-publish-options input { flex: none; width: 1rem; height: 1rem; margin: 0.12rem 0 0; accent-color: var(--teal); }
.product-publish-options small { display: block; color: var(--muted); font-size: 0.76rem; font-weight: 500; }
.product-editor-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem 0.65rem; }
.product-editor-actions .button { min-height: 2.45rem; }
.product-detail-list { display: grid; gap: 0.45rem; }
.product-detail-list:empty { display: none; }
.product-detail-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.45rem; align-items: end; min-width: 0; padding: 0.55rem; border: 1px solid var(--line); border-radius: 0.55rem; background: #f7faf8; }
.product-detail-specs { grid-template-columns: minmax(0, .78fr) minmax(0, 1.12fr) minmax(0, 1.25fr) auto; align-items: start; }
.product-detail-documents { grid-template-columns: minmax(0, .75fr) minmax(0, 1.25fr) auto; }
.product-detail-row label, .product-detail-row .image-fields { min-width: 0; }
.product-detail-row .icon-button { width: 2.55rem; height: 2.55rem; color: var(--danger); }
.product-detail-specs > .icon-button { align-self: end; }
.product-detail-row .image-editor { margin: 0; padding: 0; border: 0; background: transparent; }
.product-detail-gallery > .icon-button { align-self: start; }
.checks { display: flex; flex-wrap: wrap; gap: 0.7rem 1rem; margin-top: 0.9rem; }
.checks label { display: inline-flex; align-items: center; gap: 0.35rem; }
.checks input { width: 1rem; height: 1rem; accent-color: var(--teal); }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; margin: 0 0 1rem; }
.detail-grid dt { margin-bottom: 0.12rem; color: var(--muted); font-size: 0.76rem; font-weight: 700; }
.detail-grid dd { margin: 0; color: var(--ink); font-size: 0.9rem; overflow-wrap: anywhere; white-space: pre-wrap; }
.detail-grid .detail-wide { grid-column: 1 / -1; }
.detail-items { margin: 0.6rem 0 1rem; padding-left: 1.2rem; font-size: 0.88rem; overflow-wrap: anywhere; }
.detail-items li + li { margin-top: 0.4rem; }
.status-field { max-width: 22rem; }
.detail-section { align-items: start; gap: 0.6rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.detail-section h3 { font-size: 1rem; }
.detail-section .notice { width: 100%; margin-bottom: 0; }
.detail-section .form-grid { width: 100%; }
#reset-content { margin-top: 0.9rem; }

.login-page { display: grid; grid-template-columns: minmax(20rem, 0.85fr) minmax(0, 1.15fr); min-height: 100dvh; }
.login-hero { display: flex; flex-direction: column; justify-content: space-between; gap: 2rem; padding: clamp(1.5rem, 5vw, 4rem); background: var(--ink); color: #e4efed; }
.login-hero .wordmark { align-self: flex-start; margin: 0; color: #fff; }
.login-hero .kicker { color: var(--lime); }
.login-hero h1 { margin-block: 0.55rem 1rem; color: #fff; max-width: 12ch; }
.login-hero p { max-width: 34ch; }
.login-hero .sidebar-action { width: fit-content; padding-inline: 0; }
.login-main { display: grid; place-items: center; padding: 1.2rem; }
.login-card { width: min(100%, 28rem); padding: clamp(1.15rem, 4vw, 2rem); }
.login-card h2 { margin-top: 0.3rem; font-size: 1.6rem; }
.login-card h2 + p { margin-top: 0.45rem; color: var(--muted); font-size: 0.89rem; }
.login-logo { display: block; max-width: 8rem; max-height: 4rem; margin-bottom: 0.9rem; object-fit: contain; }
.login-card form { display: grid; gap: 0.8rem; margin-top: 1.05rem; }
.login-card .notice { margin-bottom: 0; }

@media (max-width: 58rem) {
    .app-shell { grid-template-columns: 12rem minmax(0, 1fr); }
    .activity { grid-template-columns: 1fr; }
}

@media (max-width: 50rem) {
    .app-shell { display: block; }
    .sidebar { height: auto; max-height: 100dvh; padding: 0.55rem 0.85rem; }
    .sidebar .wordmark { margin: 0; font-size: 1.12rem; }
    .sidebar .wordmark small { margin-top: 0.27rem; font-size: 0.55rem; }
    .sidebar .brand-mark { width: 2.05rem; height: 2.05rem; }
    .panel-menu-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem; min-height: 2.75rem; padding: 0.5rem 0.7rem; border: 1px solid var(--sidebar-line); border-radius: 0.55rem; color: inherit; background: transparent; font-size: 0.88rem; font-weight: 700; }
    .panel-menu-toggle:hover, .panel-menu-toggle[aria-expanded="true"] { background: var(--sidebar-hover); }
    .panel-menu-toggle :is(.panel-menu-close, .panel-close-label), .panel-menu-toggle[aria-expanded="true"] :is(.panel-menu-icon, .panel-menu-label) { display: none; }
    .panel-menu-toggle[aria-expanded="true"] :is(.panel-menu-close, .panel-close-label) { display: block; }
    .sidebar-menu { display: none; gap: 0.7rem; margin-top: 0.65rem; padding-top: 0.65rem; border-top: 1px solid var(--sidebar-line); }
    .sidebar[data-menu-open] .sidebar-menu { display: flex; }
    .panel-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.72rem 0.45rem; }
    .nav-overview, .nav-store { grid-column: 1 / -1; }
    .panel-nav a, .sidebar .sidebar-action { gap: 0.46rem; padding-inline: 0.55rem; font-size: 0.87rem; white-space: normal; overflow-wrap: anywhere; }
    .sidebar-footer { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.45rem; }
    .topbar { position: static; min-height: 3.55rem; padding: 0.43rem 0.85rem; }
    .topbar-home, .topbar-divider { display: none; }
    .topbar-context { font-size: 0.95rem; }
}

@media (max-width: 45rem) {
    .metric { padding: 0.75rem; }
    .metric-icon { width: 1.65rem; height: 1.65rem; }
    .metric-icon svg { width: 0.95rem; height: 0.95rem; }
    .login-page { grid-template-columns: 1fr; }
    .login-hero { gap: 1rem; }
    .login-hero h1 { max-width: none; }
    .product-detail-specs, .product-detail-documents { grid-template-columns: repeat(2, minmax(0, 1fr)) auto; }
    .product-detail-specs label:last-of-type, .product-detail-documents label:last-of-type { grid-row: 2; grid-column: 1 / 3; }
    .product-detail-documents label:first-of-type { grid-column: 1 / 3; }
    .product-detail-specs > .icon-button, .product-detail-documents > .icon-button { grid-column: 3; grid-row: 2; }
    .stock-inventory-forms { grid-template-columns: minmax(0, 1fr); }
    .content-field-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 30rem) {
    .page-intro { align-items: start; flex-direction: column; }
    .metrics { grid-template-columns: 1fr; gap: 0.5rem; }
    .metric { grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .15rem .6rem; }
    .metric-icon { grid-column: 1; grid-row: 1 / 3; }
    .metric-label { grid-column: 2; grid-row: 1; }
    .metric strong { grid-column: 3; grid-row: 1 / 3; font-size: 1.65rem; }
    .metric-note { grid-column: 2; grid-row: 2; margin-top: 0; }
    .form-grid { grid-template-columns: 1fr; gap: 0.65rem; }
    .image-editor { grid-template-columns: 4rem minmax(0, 1fr); }
    .product-detail-gallery .image-editor { grid-template-columns: minmax(0, 1fr); }
    .product-detail-gallery .image-preview { width: 4rem; }
    .product-editor-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 0.5rem 0.8rem; }
    .product-editor-tabs button { min-height: 2.75rem; }
    .product-category-options { grid-template-columns: minmax(0, 1fr); }
    .product-category-option { min-height: 4.6rem; }
    .product-category-context { padding-inline: 0.8rem; }
    .finance-filters label { flex: 1 1 100%; }
    .finance-filters :is(input, select) { font-size: 1rem; }
    .finance-totals, .order-finance-body .finance-totals {
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr));
    }
    .dialog-head, .dialog-body, .dialog-foot { padding: 0.8rem; }
    .dialog-head { align-items: start; }
    .button, .button-small { min-height: 2.75rem; }
    .dialog-head > .icon-button, .product-detail-row .icon-button { flex: none; width: 2.75rem; height: 2.75rem; }
    .dialog-body input:not([type="checkbox"]):not([type="file"]), .dialog-body textarea, .dialog-body select,
    .login-card input, .search-field input, .filter-field select, .finance-filters :is(input, select), .content-input { font-size: 1rem; }
    .content-filters > label { flex-basis: 100%; max-width: none; }
    .content-save-bar { align-items: start; flex-direction: column; }
    .content-image-row .button { grid-column: 2; justify-self: start; }
}

@media (prefers-reduced-motion: no-preference) {
    .notice:is([role="alert"], [role="status"]):not([hidden]),
    .content-save-feedback:not([hidden]) { animation: admin-notice-in 180ms cubic-bezier(.2, .72, .3, 1); }
}

@keyframes admin-notice-in {
    from { opacity: 0; transform: translateY(-0.4rem); }
    to { opacity: 1; transform: translateY(0); }
}
