:root {
    color-scheme: dark;
    font: 100%/1.5 system-ui, -apple-system, "Segoe UI", sans-serif;
    --bg: #101719;
    --surface: #182326;
    --surface-2: #1e2c30;
    --line: #34454b;
    --text: #f0f4ef;
    --muted: #aabdbc;
    --accent: #c9f789;
    --good: #a9e7ae;
    --danger: #ffb1ae;
    --warn: #ffd08f;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--text); }
a { color: var(--accent); text-underline-offset: .2em; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #e0ffd1; outline-offset: 3px; }
h1, h2, h3, p { margin: 0; overflow-wrap: anywhere; }
h1 { font-size: clamp(1.9rem, 4vw, 3rem); line-height: 1.1; letter-spacing: -.045em; }
h2 { font-size: 1.2rem; letter-spacing: -.015em; }
h3 { font-size: 1.06rem; }
img { display: block; max-width: 100%; }
ul { margin: 0; padding: 0; list-style: none; }
form { margin: 0; }
.shell { width: min(100% - 2rem, 1080px); margin-inline: auto; }
.topbar { border-bottom: 1px solid var(--line); background: #131d20; }
.topbar-inner { display: flex; flex-wrap: wrap; align-items: center; min-height: 4.7rem; gap: .35rem 1.5rem; padding-block: .65rem; }
.brand { display: inline-flex; align-items: center; gap: .7rem; color: var(--text); font-weight: 760; font-size: 1.24rem; text-decoration: none; }
.brand-mark, .login-icon { width: 2.3rem; aspect-ratio: 1; display: grid; place-items: center; border-radius: .62rem; color: #13201a; background: var(--accent); }
.brand-mark svg, .login-icon svg { width: 68%; }
.main-nav, .small-nav { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .35rem; }
.small-nav { margin-inline-start: auto; }
.main-nav a, .small-nav a { padding: .7rem .8rem; min-height: 44px; border-radius: .62rem; text-decoration: none; color: var(--muted); font-weight: 650; font-size: .91rem; }
.topbar a[aria-current], .topbar a:hover { color: var(--text); background: var(--surface-2); }
main.shell { padding-block: clamp(1.65rem, 5vw, 3.2rem) 4rem; }
.page-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.55rem; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 1.15rem; }
.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; margin-bottom: 1rem; }
.metric { display: flex; flex-direction: column; gap: .4rem; background: #253731; border: 1px solid #3d5748; color: #d6e8d6; padding: clamp(.9rem, 3vw, 1.5rem); border-radius: 1rem; min-width: 0; }
.metric strong { color: var(--accent); font-size: clamp(2.1rem, 5vw, 3.2rem); font-variant-numeric: tabular-nums; line-height: 1.1; }
.metric-order { background: #292921; border-color: #524b35; color: #f1dcbf; }
.metric-order strong { color: var(--warn); }
.metric span:last-child:not(:first-child) { font-size: .875rem; }
.inventory-bar { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: .8rem; padding: 1rem 1.25rem; }
.inventory .inventory-bar { border-bottom: 1px solid var(--line); }
.search { width: min(100%, 355px); }
.search input { width: 100%; }
.stock-row, .order-list li { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .95rem 1.25rem; }
.stock-row + .stock-row, .order-list li + li { border-top: 1px solid var(--line); }
.item-text { min-width: 0; display: grid; gap: .22rem; overflow-wrap: anywhere; }
.sku, time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .875rem; }
.item-text .sku { overflow-wrap: anywhere; }
.muted { color: var(--muted); }
.badge { width: fit-content; display: inline-flex; align-items: center; padding: .24rem .65rem; border-radius: .45rem; font-size: .875rem; font-weight: 650; }
.badge.good { background: #263b2c; color: var(--good); }
.badge.warn { background: #473520; color: var(--warn); }
.badge.danger { background: #502e30; color: var(--danger); }
.badge.neutral { background: #2b383e; color: #d0dce0; }
.danger { color: var(--danger); }
.good { color: var(--good); }
.stepper { display: flex; gap: .35rem; align-items: center; justify-content: space-between; }
.step { display: grid; place-items: center; width: 2.75rem; height: 2.75rem; flex: 0 0 2.75rem; border: 1px solid #52656a; border-radius: .8rem; background: #263539; color: var(--text); font-size: 1.37rem; font-weight: 700; touch-action: manipulation; }
.step.plus { background: #2d443c; border-color: #4b665a; color: #d8f9cf; }
.stepper output { min-width: 2.8rem; text-align: center; font-size: 1.35rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.stepper input { width: min(6rem, 100%); text-align: center; }
.button { min-height: 2.75rem; display: inline-flex; align-items: center; justify-content: center; text-align: center; padding: .64rem 1rem; border: 1px solid transparent; border-radius: .64rem; font-weight: 720; text-decoration: none; touch-action: manipulation; }
.button.primary { background: var(--accent); color: #152017; }
.button.secondary { background: var(--surface-2); color: var(--text); border-color: #4b6066; }
.button.destructive { background: #822e37; color: #fff; }
.button.text { background: transparent; }
.button:hover, .step:hover { filter: brightness(1.12); }
button:disabled { opacity: .5; cursor: default; filter: none; }
.bottom-actions { display: flex; justify-content: center; text-align: center; margin-top: 1.25rem; }
.bottom-actions .primary { min-width: min(100%, 21rem); }
.notice { padding: .85rem 1rem; border: 1px solid #506069; border-radius: .85rem; background: #27363b; margin-bottom: 1rem; }
.notice p { margin-top: .25rem; }
.notice.pending { background: #302a1e; border-color: #735439; color: var(--warn); }
div.notice.pending { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.notice.error { background: #49272a; border-color: #99545a; color: #ffe0dd; }
.notice.success { background: #253b2b; border-color: #56785d; color: #dcfce0; }
.compact { margin-bottom: .9rem; }
.article-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr)); gap: .85rem; }
.article-card { overflow: hidden; display: grid; grid-template-rows: auto 1fr auto; }
.article-card .item-text, .article-card .actions { padding: .8rem 1rem; }
.article-card .actions { border-top: 1px solid var(--line); }
.article-photo { display: grid; align-content: center; justify-items: center; gap: .45rem; height: 10.5rem; background: #222f32; color: var(--muted); text-decoration: none; }
.article-photo img { width: 100%; height: 10.5rem; object-fit: contain; }
.placeholder svg { width: 3.1rem; color: #8eabaa; }
.placeholder span { font-size: .88rem; }
.card-stock { color: var(--accent); font-weight: 700; }
.summary { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-wrap; }
.form-stack, .narrow { padding: clamp(1rem, 3vw, 1.5rem); }
.form-stack { display: grid; gap: 1rem; }
.form-stack label { display: grid; align-content: start; gap: .35rem; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .85rem; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
input, textarea { background: #0f1a1d; color: var(--text); border: 1px solid #51636a; border-radius: .55rem; min-width: 0; width: 100%; padding: .55rem .65rem; min-height: 44px; }
input::placeholder { color: #aabdbc; }
textarea { resize: vertical; }
input[type="checkbox"] { width: 1.25rem; min-height: 1.25rem; }
input[type="file"] { height: auto; }
.form-stack .check { display: flex; flex-wrap: wrap; align-items: center; margin-block: .65rem; }
.photo-form img { max-height: 11rem; border-radius: .5rem; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.narrow { width: min(100%, 680px); }
.narrow > * + * { margin-top: .65rem; }
.form-stack.narrow > * + * { margin-top: 0; }
.empty { padding: 1.2rem; color: var(--muted); }
.order-list { margin-top: .8rem; border: 1px solid var(--line); border-radius: .7rem; }
.order-list li { padding: .75rem; }
.qty { width: 7.4rem; flex-shrink: 0; }
.receipt-list li { display: grid; grid-template-columns: 1fr auto; }
.received > label { margin-bottom: .25rem; }
.receipt-summary { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: .35rem 1.2rem; color: var(--muted); font-size: .9rem; }
.receipt-summary strong { color: var(--text); }
.history-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; }
.history-list li { padding-block: .75rem; display: flex; justify-content: space-between; gap: .5rem; border-top: 1px solid var(--line); }
.quantity { font-size: 1.15rem; font-weight: 700; text-align: end; flex-shrink: 0; }
.quantity small { display: block; color: var(--muted); font-size: .875rem; }
.history-order { border-top: 1px solid var(--line); padding: .65rem 0; }
.history-order summary { cursor: pointer; padding: .3rem 0; }
.history-order summary span { margin-inline-start: .45rem; }
.line-history li { padding-block: .35rem; }
dialog { width: min(94vw, 760px); max-height: 90vh; background: var(--surface); border: 1px solid var(--line); color: var(--text); border-radius: 1rem; padding: .85rem; }
dialog::backdrop { background: #000b; }
.dialog-bar { display: flex; justify-content: space-between; align-items: center; gap: .6rem; margin-bottom: .7rem; }
dialog img { max-height: 72vh; width: 100%; object-fit: contain; }
.login-card { width: min(100%, 410px); margin: min(10vh, 5rem) auto 0; padding: clamp(1.2rem, 5vw, 2rem); }
.login-card h1 { margin: .9rem 0 .4rem; }
.login-card .form-stack { padding: 1.3rem 0 0; gap: .65rem; }
.login-icon { width: 2.85rem; }
.skip, .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip:focus { inset: .5rem auto auto .5rem; z-index: 1; padding: .5rem; width: auto; height: auto; clip-path: none; background: var(--surface-2); }

@media (max-width: 710px) {
    .topbar-inner { gap: .4rem .65rem; }
    .main-nav { order: 3; width: 100%; }
    .main-nav a { flex: 1; text-align: center; }
    .small-nav a { padding: .6rem .45rem; }
    .history-grid { grid-template-columns: 1fr; }
    .receipt-list li { grid-template-columns: 1fr; }
    .received .stepper { width: fit-content; }
}
@media (max-width: 480px) {
    .shell { width: calc(100% - 1.2rem); }
    .brand { font-size: 1.04rem; gap: .38rem; }
    .brand-mark { width: 1.9rem; }
    .small-nav a { padding-inline: .35rem; font-size: .85rem; }
    .metrics { gap: .55rem; }
    .metric { overflow-wrap: anywhere; }
    .inventory-bar, .stock-row { padding: .8rem .7rem; }
    .stock-row { gap: .2rem; }
    .stock-stepper { gap: .15rem; }
    .stock-stepper output { min-width: 1.5rem; font-size: 1.08rem; }
    .step { border-radius: .6rem; }
    .form-grid, .form-grid.two { grid-template-columns: 1fr; }
    .form-stack .actions .button { flex: 1; }
}

.module-nav { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: 1.4rem; }
.module-nav a { display: inline-flex; align-items: center; padding: .48rem .8rem; min-height: 44px; border-radius: .6rem; color: var(--muted); }
.module-nav a:hover, .module-nav a[aria-current] { color: var(--text); background: var(--surface-2); }
.service-grid, .detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: .85rem; }
.module-card { padding: clamp(1rem, 3vw, 1.55rem); display: grid; align-content: start; gap: .4rem; text-decoration: none; color: var(--text); }
.module-card:hover { border-color: var(--accent); }
.module-card strong { font-size: 1.32rem; }
.module-stock { background: #253731; }
.module-service { background: #1e2c30; }
.module-number { font-size: 2.2rem; font-weight: 750; color: var(--accent); line-height: 1.2; }
.spaced { margin-block-start: 1rem; }
select { min-width: 0; width: 100%; min-height: 44px; font: inherit; border: 1px solid #52656a; background: #111c20; color: var(--text); border-radius: .63rem; padding: .45rem .7rem; }
.form-stack .inline-check { display: flex; align-items: center; gap: .65rem; min-height: 44px; }
.inline-check input:is([type="checkbox"], [type="radio"]) { inline-size: 1.2rem; block-size: 1.2rem; min-height: 0; flex-shrink: 0; accent-color: var(--accent); }
.form-stack fieldset { border: 1px solid var(--line); border-radius: .65rem; min-width: 0; }
.preserve { white-space: pre-wrap; overflow-wrap: anywhere; }
.ticket-fields { margin: 0; }
.ticket-fields dt { color: var(--muted); }
.ticket-fields dd { margin: .18rem 0 0; }
.address-navigation { white-space: normal; }
.address-navigation summary { min-height: 44px; cursor: pointer; color: var(--accent); padding-block: .25rem; }
.address-navigation summary span { white-space: pre-wrap; text-decoration: underline; text-underline-offset: .2em; }
.address-navigation .actions { gap: .4rem; margin-block: .25rem .5rem; }
.address-navigation textarea { margin-top: .4rem; }
.demo-banner {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #ffd084;
    color: #35230a;
    padding: .42rem .8rem;
    font-weight: 750;
    text-align: center;
}
.skip:focus { z-index: 3; }
.line-summary { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
