/*
 * ELV8 Admin, Phase 1.
 * Load after theme.css; uses its tokens only. Square corners, no shadows.
 * Layout switches with a container query on .app, so the same markup serves
 * phone (default, designed at 390px) and desktop (1024px and up).
 * Touch only: nothing depends on :hover. Every control is 44px or taller.
 */

*, *::before, *::after { box-sizing: border-box; }
body:has(> .app) { margin: 0; background: var(--ink); }

.app {
  container: app / inline-size;
  position: relative;
  height: 100dvh;
  overflow: hidden;
  background: var(--ink);
  color: var(--cream);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}
.app :where(h1, h2, h3, h4, p, ul, ol, dl, dd, figure, address) { margin: 0; padding: 0; font: inherit; font-style: normal; }
.app :where(ul, ol) { list-style: none; }
.app :where(button, input, select, textarea) { font: inherit; color: inherit; letter-spacing: inherit; margin: 0; }
.app :where(button) { background: none; border: 0; padding: 0; cursor: pointer; text-align: inherit; }
.app :where(img) { display: block; max-width: 100%; }
.app a { color: inherit; }
.app :focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-ring-offset); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Shell */
.shell { height: 100%; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; grid-template-areas: "top" "main" "bottom"; }
.shell--bare { grid-template-rows: minmax(0, 1fr); grid-template-areas: "main"; }
.topbar { grid-area: top; }
.main { grid-area: main; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.tabbar, .actionbar { grid-area: bottom; }
.sidebar { display: none; grid-area: side; }

/* Type */
.lbl { font-stretch: 125%; font-weight: 600; font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; }
.mono { font-family: var(--font-mono); }

/* Top bar */
.topbar { position: relative; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px; height: var(--bar-h); padding: 0 4px 0 16px; border-bottom: 1px solid var(--line-2); background: var(--ink); }
.brand { display: flex; align-items: center; gap: 10px; min-height: 44px; text-decoration: none; }
.brand__mark { width: 64px; height: auto; }
.brand__tag { font-family: var(--font-mono); font-size: 10px; line-height: 1; letter-spacing: 0.14em; text-transform: uppercase; color: var(--soft); border: 1px solid var(--line-3); padding: 4px 6px 3px; }
.back { display: flex; align-items: center; gap: 10px; min-height: 44px; padding-right: 12px; text-decoration: none; font-stretch: 125%; font-weight: 600; font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; }
.back::before { content: ""; width: 8px; height: 8px; margin-left: 2px; border-left: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(45deg); }
.menubtn { display: flex; align-items: center; gap: 12px; min-height: 44px; min-width: 44px; padding: 0 12px; font-stretch: 125%; font-weight: 600; font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; }
.menubtn__icon { display: grid; gap: 4.5px; width: 15px; }
.menubtn__icon::before, .menubtn__icon::after { content: ""; height: 1.5px; background: currentColor; }
.menubtn__icon::after { width: 11px; }

/* Bottom tabs */
.tabbar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid var(--line-2); background: var(--ink-2); padding-bottom: env(safe-area-inset-bottom); }
.tab { position: relative; display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 60px; color: var(--soft); text-decoration: none; font-stretch: 125%; font-weight: 600; font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; }
.tab + .tab { border-left: 1px solid var(--line-2); }
.tab[aria-current="page"] { color: var(--cream); }
.tab[aria-current="page"]::before { content: ""; position: absolute; top: -1px; left: 0; right: 0; height: 2px; background: var(--cream); }
.count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; background: var(--cream); color: var(--ink); font-family: var(--font-mono); font-size: 12px; font-weight: 600; letter-spacing: 0; line-height: 1; }
.count--quiet { background: transparent; color: var(--soft); border: 1px solid var(--line-3); }

/* Action bar (detail screens) */
.actionbar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line-2); background: var(--ink-2); }
.actionbar--one { grid-template-columns: minmax(0, 1fr); }
.actionbar .btn { padding: 0 10px; letter-spacing: 0.16em; }

/* Page head */
.pagehead { display: grid; gap: 10px; padding: 22px 16px 16px; }
.pagehead__title { font-stretch: 125%; font-style: italic; font-weight: 800; font-size: 30px; line-height: 0.92; letter-spacing: -0.01em; text-transform: uppercase; }
.pagehead__sub { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-family: var(--font-mono); font-size: 12px; color: var(--soft); }
.live { display: inline-flex; align-items: center; gap: 7px; color: var(--cream); text-transform: uppercase; letter-spacing: 0.1em; }
.live::before { content: ""; width: 6px; height: 6px; background: var(--cream); }

/* Buttons and links */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 0 18px; border: 1px solid var(--cream); background: var(--cream); color: var(--ink); font-stretch: 125%; font-weight: 700; font-size: 11.5px; line-height: 1.2; letter-spacing: 0.22em; text-transform: uppercase; text-decoration: none; text-align: center; }
.btn--ghost { background: transparent; color: var(--cream); border-color: var(--line-3); }
.btn--block { display: flex; width: 100%; }
.btn--sm { min-height: 44px; padding: 0 14px; font-size: 10.5px; letter-spacing: 0.18em; }
.btn--done { background: var(--ink-4); color: var(--cream); border-color: var(--cream); }
.btn:disabled, .btn[aria-disabled="true"] { background: var(--ink-3); border-color: var(--line-2); color: var(--dim); cursor: not-allowed; }
.btn--busy::before { content: ""; width: 10px; height: 10px; border: 1.5px solid currentColor; animation: spin 1s var(--ease-io) infinite; }
.ext::after { content: "\2197"; font-family: var(--font-mono); font-size: 1.1em; letter-spacing: 0; }
.link { display: inline-flex; align-items: center; min-height: 44px; color: var(--cream); font-size: 14px; text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 1px; }
.link--mono { font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.02em; }
@keyframes spin { to { transform: rotate(180deg); } }

/* Fields */
.field { display: grid; gap: 8px; }
.field__label { font-stretch: 125%; font-weight: 600; font-size: 10.5px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--soft); }
.field__hint { font-size: 13px; color: var(--soft); }
.field__error { font-size: 14px; color: var(--color-error); }
.input { width: 100%; min-height: 52px; padding: 0 14px; border: 1px solid var(--line-3); background: var(--ink); color: var(--cream); font-size: 16px; border-radius: 0; appearance: none; }
.input::placeholder { color: var(--dim); }
.input--mono { font-family: var(--font-mono); letter-spacing: 0.03em; }
.input--focus { border-color: var(--cream); box-shadow: inset 0 0 0 1px var(--cream); }
.input--big { min-height: 72px; font-stretch: 125%; font-weight: 700; font-size: 34px; text-align: center; }
.input[aria-invalid="true"] { border-color: var(--color-error); box-shadow: inset 0 0 0 1px var(--color-error); }
.input:disabled, .input[readonly] { color: var(--soft); background: var(--ink-3); border-color: var(--line-2); }
.inputwrap { position: relative; display: flex; }
.inputwrap .input { padding-right: 84px; }
.inputwrap__btn { position: absolute; top: 1px; right: 1px; bottom: 1px; min-width: 72px; padding: 0 14px; font-stretch: 125%; font-weight: 600; font-size: 10.5px; letter-spacing: 0.2em; text-transform: uppercase; }
.selectwrap { position: relative; }
.selectwrap::after { content: ""; position: absolute; right: 20px; top: 50%; width: 8px; height: 8px; border-right: 1.5px solid var(--cream); border-bottom: 1.5px solid var(--cream); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.selectwrap .input { padding-right: 48px; }

/* Notices, tags, status */
.notice { display: grid; gap: 4px; padding: 14px 16px; border: 1px solid var(--line-3); background: var(--ink-3); font-size: 14px; line-height: 1.45; }
.notice__title { font-weight: 600; font-size: 15px; color: var(--cream); }
.notice__body { color: var(--muted); }
.notice__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.notice--ok { border-color: var(--cream); }
.notice--err { border-color: var(--color-error); background: var(--color-error-soft); }
.notice--err .notice__title { color: var(--color-error); }
.tag { display: inline-flex; align-items: center; height: 22px; padding: 0 7px; border: 1px solid var(--line-3); color: var(--muted); font-family: var(--font-mono); font-size: 10.5px; font-weight: 500; line-height: 1; letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap; }
.tag--solid { background: var(--cream); border-color: var(--cream); color: var(--ink); }
.tag--err { background: var(--color-error-soft); border-color: var(--color-error); color: var(--color-error); }
.tag--xs { height: 17px; padding: 0 4px; font-size: 9.5px; letter-spacing: 0.06em; }
.status { display: inline-flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 12px; color: var(--soft); }
.status::before { content: ""; flex: none; width: 7px; height: 7px; border: 1px solid currentColor; }
.status--on { color: var(--cream); }
.status--on::before { background: currentColor; }
.status--err { color: var(--color-error); }
.status--err::before { background: currentColor; }

/* Chips and segmented control */
.filters { display: flex; gap: 8px; overflow-x: auto; padding: 0 16px 14px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border: 1px solid var(--line-3); color: var(--muted); font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; text-decoration: none; }
.chip__n { color: var(--soft); }
.chip[aria-pressed="true"] { background: var(--cream); border-color: var(--cream); color: var(--ink); }
.chip[aria-pressed="true"] .chip__n { color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0 16px 16px; border: 1px solid var(--line-3); }
.seg__item { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; color: var(--soft); text-decoration: none; font-stretch: 125%; font-weight: 600; font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase; }
.seg__item + .seg__item { border-left: 1px solid var(--line-3); }
.seg__item[aria-current="page"] { background: var(--cream); color: var(--ink); }
.seg__item[aria-current="page"] .count { background: var(--ink); color: var(--cream); }

/* Inventory */
.legend { padding: 0 16px 12px; font-family: var(--font-mono); font-size: 11.5px; line-height: 1.5; color: var(--soft); }
.inv { display: grid; gap: 18px; padding: 0 16px 28px; }
.inv__cols { display: none; }
.prod { display: grid; gap: 10px; }
.prod__head { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.prod__img { width: 32px; height: 48px; object-fit: cover; background: var(--ink-3); }
.prod__name { font-stretch: 125%; font-weight: 600; font-size: 12px; line-height: 1.3; letter-spacing: 0.08em; text-transform: uppercase; }
.prod__color { font-size: 13px; color: var(--soft); }
.prod__sum { font-family: var(--font-mono); font-size: 11px; color: var(--soft); text-align: right; }
.sizes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.size { position: relative; display: grid; grid-template-rows: 18px minmax(0, 1fr) auto 14px; gap: 4px; min-height: 84px; padding: 8px 9px; border: 1px solid var(--line-3); background: var(--ink-2); color: var(--cream); text-decoration: none; text-align: left; }
.size__top { display: flex; align-items: center; justify-content: space-between; gap: 4px; }
.size__k { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.04em; color: var(--soft); }
.size__n { align-self: end; font-stretch: 125%; font-weight: 700; font-size: 26px; line-height: 1; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.size__none { font-stretch: 100%; font-weight: 600; font-size: 13px; letter-spacing: 0; color: var(--muted); }
.size__detail { display: none; font-family: var(--font-mono); font-size: 11px; color: var(--soft); }
.size__foot { font-family: var(--font-mono); font-size: 10.5px; line-height: 14px; color: var(--soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.size--out { background: var(--ink); border-color: var(--line-2); }
.size--out .size__k { color: var(--dim); text-decoration: line-through; }
.size--out .size__n { color: var(--dim); }
.size--over { background: var(--color-error-soft); border-color: var(--color-error); }
.size--over .size__n, .size--over .size__foot { color: var(--color-error); }
.size--unc { background: transparent; border-style: dashed; }
.size--unc .size__foot { color: var(--dim); }
.size--selected { border-color: var(--cream); box-shadow: inset 0 0 0 1px var(--cream); }
.size--fresh { background: var(--ink-4); border-color: var(--cream); }
.panel { display: none; }

/* First visit */
.setup { display: grid; gap: 12px; margin: 0 16px 20px; padding: 18px 16px; border: 1px solid var(--line-3); background: var(--ink-2); }
.setup__title { font-stretch: 125%; font-weight: 700; font-size: 16px; line-height: 1.2; letter-spacing: 0.02em; text-transform: uppercase; }
.setup__body { font-size: 14px; color: var(--muted); text-wrap: pretty; }
.meter { display: grid; gap: 8px; }
.meter__label { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 12px; color: var(--soft); }
.meter progress { width: 100%; height: 2px; border: 0; appearance: none; background: var(--line-3); color: var(--cream); }
.meter progress::-webkit-progress-bar { background: var(--line-3); }
.meter progress::-webkit-progress-value { background: var(--cream); }
.meter progress::-moz-progress-bar { background: var(--cream); }

/* Sheets and dialogs */
.layer { position: absolute; inset: 0; z-index: 30; display: flex; flex-direction: column; justify-content: flex-end; background: rgb(11 11 10 / 0.74); }
.sheet { display: flex; flex-direction: column; max-height: calc(100% - 36px); background: var(--ink-2); border-top: 1px solid var(--line-3); }
.sheet__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 12px 4px 12px 16px; border-bottom: 1px solid var(--line-2); }
.sheet__title { padding-top: 13px; font-stretch: 125%; font-weight: 600; font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase; }
.sheet__body { display: grid; gap: 20px; padding: 16px; overflow-y: auto; }
.sheet__foot { display: grid; gap: 8px; padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line-2); }
.sheet--dialog .sheet__body { gap: 14px; padding: 24px 16px 20px; }
.close { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; font-stretch: 125%; font-weight: 600; font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; }
.close__x { position: relative; width: 12px; height: 12px; }
.close__x::before, .close__x::after { content: ""; position: absolute; left: 50%; top: 50%; width: 15px; height: 1.5px; background: currentColor; transform: translate(-50%, -50%) rotate(45deg); }
.close__x::after { transform: translate(-50%, -50%) rotate(-45deg); }
.question { font-stretch: 125%; font-weight: 700; font-size: 20px; line-height: 1.25; text-wrap: pretty; overflow-wrap: anywhere; }
.question__sub { font-size: 15px; color: var(--muted); text-wrap: pretty; }

/* Size detail (sheet on phone, side panel on desktop) */
.sd-id { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 12px; }
.sd-id__img { width: 40px; height: 60px; object-fit: cover; }
.sd-id__size { font-stretch: 125%; font-weight: 800; font-style: italic; font-size: 34px; line-height: 1; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line-2); }
.stat { display: grid; align-content: start; gap: 8px; padding: 12px; }
.stat + .stat { border-left: 1px solid var(--line-2); }
.stat--key { background: var(--ink-3); }
.stat__k { font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--soft); }
.stat__v { display: flex; align-items: center; gap: 8px; font-stretch: 125%; font-weight: 700; font-size: 28px; line-height: 1; font-variant-numeric: tabular-nums; }
.stat__was { font-family: var(--font-mono); font-size: 11px; color: var(--soft); }
.stat__was s { text-decoration-thickness: 1px; }
.block { display: grid; gap: 10px; }
.block__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stepper { display: grid; grid-template-columns: 64px minmax(0, 1fr) 64px; border: 1px solid var(--line-3); }
.stepper__btn { display: grid; place-items: center; min-height: 64px; font-size: 26px; font-weight: 300; line-height: 1; color: var(--cream); }
.stepper__btn:first-child { border-right: 1px solid var(--line-3); }
.stepper__btn:last-child { border-left: 1px solid var(--line-3); }
.stepper__btn:disabled { color: var(--dim); }
.stepper__val { display: grid; place-items: center; align-content: center; gap: 4px; }
.stepper__input { width: 100%; padding: 0; border: 0; background: none; text-align: center; font-stretch: 125%; font-weight: 700; font-size: 30px; line-height: 1; font-variant-numeric: tabular-nums; }
.stepper__delta { font-family: var(--font-mono); font-size: 12px; color: var(--soft); }
.stepper__delta--on { color: var(--cream); }
.stepper--sm { display: inline-grid; grid-template-columns: 44px 48px 44px; }
.stepper--sm .stepper__btn { min-height: 44px; font-size: 20px; }
.stepper--sm .stepper__input { font-family: var(--font-mono); font-stretch: 100%; font-weight: 500; font-size: 16px; }
.is-disabled { opacity: 0.45; pointer-events: none; }
.rowlink { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 0; border-top: 1px solid var(--line-2); color: var(--cream); text-decoration: none; font-size: 15px; }
.rowlink::after { content: ""; flex: none; width: 8px; height: 8px; margin-right: 4px; border-right: 1.5px solid var(--soft); border-top: 1.5px solid var(--soft); transform: rotate(45deg); }
.rowlink__sub { margin-left: auto; font-family: var(--font-mono); font-size: 12px; color: var(--soft); }
.lowrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 14px; border-top: 1px solid var(--line-2); }
.lowrow__txt { display: grid; gap: 2px; }
.lowrow__k { font-size: 15px; }
.lowrow__sub { font-size: 13px; color: var(--soft); }

/* Change history */
.histhead { display: grid; gap: 14px; padding: 20px 16px 16px; border-bottom: 1px solid var(--line-2); }
.hist { display: grid; }
.hist__item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 16px; padding: 14px 16px; border-bottom: 1px solid var(--line-2); color: var(--cream); text-decoration: none; }
.hist__when { font-family: var(--font-mono); font-size: 12px; color: var(--soft); }
.hist__what { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-size: 15px; font-weight: 600; }
.hist__order { font-family: var(--font-mono); font-size: 13px; font-weight: 400; text-decoration: underline; text-underline-offset: 4px; }
.hist__by { font-size: 13px; color: var(--soft); }
.hist__note { font-size: 14px; color: var(--muted); }
.hist__delta { grid-column: 2; grid-row: 1 / span 2; align-self: start; font-stretch: 125%; font-weight: 700; font-size: 20px; line-height: 1.1; text-align: right; font-variant-numeric: tabular-nums; }
.hist__after { grid-column: 2; grid-row: 3; font-family: var(--font-mono); font-size: 12px; color: var(--soft); text-align: right; white-space: nowrap; }
.hist__item--sale .hist__delta { color: var(--muted); }

/* Toast */
.toast { position: absolute; left: 12px; right: 12px; bottom: 74px; z-index: 40; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 8px 8px 8px 16px; background: var(--cream); color: var(--ink); font-size: 14px; font-weight: 500; line-height: 1.35; }
.toast--high { bottom: 86px; }
.toast__btn { flex: none; min-height: 44px; padding: 0 12px; font-stretch: 125%; font-weight: 700; font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink); text-decoration: underline; text-underline-offset: 4px; }

/* Orders */
.orders { display: grid; gap: 10px; padding: 0 16px 28px; }
.orders__cols { display: none; }
.order { display: grid; gap: 12px; padding: 14px; border: 1px solid var(--line-2); background: var(--ink-2); color: var(--cream); text-decoration: none; }
.order--overdue { border-color: var(--cream); }
.order__alert { margin: -14px -14px 0; padding: 9px 14px; background: var(--cream); color: var(--ink); font-stretch: 125%; font-weight: 700; font-size: 10.5px; line-height: 1.3; letter-spacing: 0.16em; text-transform: uppercase; }
.order__id { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 4px 12px; }
.order__num { font-family: var(--font-mono); font-size: 15px; font-weight: 500; letter-spacing: 0.02em; }
.order__age { font-family: var(--font-mono); font-size: 12px; color: var(--soft); text-align: right; }
.order--overdue .order__age { color: var(--cream); font-weight: 600; }
.order__placed { font-family: var(--font-mono); font-size: 12px; color: var(--soft); }
.order__who { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.order__name { font-size: 16px; font-weight: 600; }
.order__dest { font-size: 14px; color: var(--soft); }
.order__items { display: grid; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line-2); }
.order__count { font-stretch: 125%; font-weight: 600; font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--soft); }
.oitem { display: grid; grid-template-columns: 28px minmax(0, 1fr); align-items: center; gap: 0 12px; }
.oitem__img { grid-row: span 2; width: 28px; height: 42px; object-fit: cover; }
.oitem__name { font-size: 14px; font-weight: 500; }
.oitem__var { font-size: 13px; color: var(--soft); }
.order__ship { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; padding-top: 12px; border-top: 1px solid var(--line-2); }
.order__service { font-size: 13px; color: var(--muted); }
.order__flags { display: grid; gap: 6px; padding: 10px 12px; border: 1px solid var(--color-error); background: var(--color-error-soft); }
.order__flagtxt { font-size: 13px; color: var(--muted); }
.order__track { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.order--shipped { background: transparent; }

/* Empty, loading, error */
.empty { display: grid; justify-items: start; gap: 12px; padding: 36px 16px; }
.empty__title { font-stretch: 125%; font-style: italic; font-weight: 800; font-size: 26px; line-height: 1; text-transform: uppercase; }
.empty__body { max-width: 34ch; font-size: 15px; color: var(--muted); text-wrap: pretty; }
.skel { position: relative; overflow: hidden; background: var(--ink-3); }
.skel::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgb(239 232 221 / 0.06), transparent); transform: translateX(-100%); animation: shimmer 1.4s var(--ease-io) infinite; }
.skel--line { height: 12px; }
.skel--w30 { width: 30%; } .skel--w45 { width: 45%; } .skel--w60 { width: 60%; } .skel--w80 { width: 80%; }
.skel--thumb { width: 32px; height: 48px; }
.skel--cell { height: 84px; }
.skel--card { display: grid; gap: 12px; padding: 16px 14px; border: 1px solid var(--line-2); background: var(--ink-2); }
.skel-row { display: grid; grid-template-columns: 32px minmax(0, 1fr); align-items: center; gap: 12px; }
.skel-stack { display: grid; gap: 8px; }
.loading-note { padding: 0 16px 14px; font-family: var(--font-mono); font-size: 12px; color: var(--soft); }
@keyframes shimmer { to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .skel::after, .btn--busy::before { animation: none; } }

/* Order detail */
.banner { padding: 12px 16px 0; }
.dhead { display: grid; gap: 10px; padding: 20px 16px; border-bottom: 1px solid var(--line-2); }
.dhead__num { font-family: var(--font-mono); font-size: 22px; font-weight: 500; letter-spacing: 0.01em; }
.dhead__tags { display: flex; flex-wrap: wrap; gap: 6px; }
.dhead__when { font-family: var(--font-mono); font-size: 12.5px; color: var(--soft); }
.sect { display: grid; gap: 14px; padding: 20px 16px; border-bottom: 1px solid var(--line-2); }
.sect__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 22px; }
.sect__title { font-stretch: 125%; font-weight: 600; font-size: 10.5px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--soft); }
.address { display: grid; font-size: 17px; line-height: 1.5; }
.address__name { font-weight: 600; }
.address__phone { margin-top: 4px; font-family: var(--font-mono); font-size: 14px; color: var(--muted); }
.ditems { display: grid; gap: 14px; }
.ditem { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; align-items: start; gap: 14px; }
.ditem__img { width: 56px; height: 84px; object-fit: cover; }
.ditem__txt { display: grid; gap: 4px; }
.ditem__name { font-stretch: 125%; font-weight: 600; font-size: 12.5px; line-height: 1.3; letter-spacing: 0.08em; text-transform: uppercase; }
.ditem__var { font-size: 14px; color: var(--muted); }
.ditem__size { font-family: var(--font-mono); font-size: 13px; color: var(--soft); }
.ditem__size strong { color: var(--cream); font-weight: 600; }
.ditem__price { font-family: var(--font-mono); font-size: 14px; }
.kv { display: grid; gap: 10px; }
.kv__row { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; font-size: 15px; }
.kv__k { color: var(--muted); }
.kv__sub { display: block; font-size: 13px; color: var(--soft); }
.kv__v { font-family: var(--font-mono); font-size: 14px; text-align: right; white-space: nowrap; }
.kv__row--total { padding-top: 12px; border-top: 1px solid var(--line-2); }
.kv__row--total .kv__k { color: var(--cream); font-stretch: 125%; font-weight: 700; font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; }
.kv__row--total .kv__v { font-size: 18px; }
.tl { display: grid; }
.tl__item { position: relative; display: grid; gap: 2px; padding: 0 0 18px 24px; }
.tl__item::before { content: ""; position: absolute; left: 0; top: 6px; width: 9px; height: 9px; background: var(--cream); }
.tl__item::after { content: ""; position: absolute; left: 4px; top: 19px; bottom: 2px; width: 1px; background: var(--line-3); }
.tl__item:last-child { padding-bottom: 0; }
.tl__item:last-child::after { display: none; }
.tl__item--muted::before { background: transparent; border: 1px solid var(--soft); }
.tl__item--err::before { background: var(--color-error); }
.tl__title { font-size: 15px; font-weight: 600; }
.tl__when { font-family: var(--font-mono); font-size: 12px; color: var(--soft); }
.tl__body { font-size: 14px; color: var(--muted); }
.stack { display: grid; gap: 8px; }

/* Navigation menu and desktop sidebar */
.sidebar { flex-direction: column; gap: 28px; padding: 22px 14px 18px; border-right: 1px solid var(--line-2); background: var(--ink-2); overflow-y: auto; }
.sidebar .brand { padding: 0 8px; }
.sidebar .brand__mark { width: 88px; }
.sidenav { display: grid; gap: 2px; }
.sidenav__label { padding: 14px 12px 8px; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--soft); }
.sidenav__item { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; padding: 0 12px; color: var(--muted); text-decoration: none; font-stretch: 125%; font-weight: 600; font-size: 11.5px; letter-spacing: 0.16em; text-transform: uppercase; }
.sidenav__item[aria-current="page"] { background: var(--ink-4); color: var(--cream); box-shadow: inset 0 0 0 1px var(--line-3); }
.sidenav__item--later { min-height: 44px; color: var(--dim); cursor: default; }
.sidebar__foot { display: grid; gap: 10px; margin-top: auto; }
.session { font-family: var(--font-mono); font-size: 11.5px; line-height: 1.5; color: var(--soft); }

/* Log in */
.login { display: grid; align-content: start; gap: 28px; width: 100%; max-width: 420px; min-height: 100%; margin: 0 auto; padding: 56px 24px 28px; }
.login__brand { display: grid; justify-items: start; gap: 16px; }
.login__logo { width: 128px; height: auto; }
.login__title { font-stretch: 125%; font-style: italic; font-weight: 800; font-size: 38px; line-height: 0.92; letter-spacing: -0.01em; text-transform: uppercase; }
.login__form { display: grid; gap: 16px; }
.login__hint { font-size: 14px; color: var(--soft); text-wrap: pretty; }
.login__foot { align-self: end; font-family: var(--font-mono); font-size: 11.5px; color: var(--dim); }

/* Desktop, 1024px and up */
@container app (min-width: 1024px) {
  .shell:not(.shell--bare) { grid-template-columns: 248px minmax(0, 1fr); grid-template-areas: "side top" "side main" "side bottom"; }
  .sidebar { display: flex; }
  .topbar--main, .tabbar { display: none; }
  .topbar--sub { padding: 0 24px; }
  .topbar--sub .menubtn { display: none; }
  .toast { left: auto; right: 24px; bottom: 24px; width: 400px; }
  .layer { justify-content: center; align-items: center; }
  .sheet { width: 480px; max-height: 86%; border: 1px solid var(--line-3); }
  .actionbar { display: flex; justify-content: flex-end; padding: 12px 24px; }
  .actionbar .btn { min-width: 200px; }

  .pagehead { grid-template-columns: minmax(0, 1fr) auto; align-items: end; padding: 32px 32px 20px; }
  .pagehead__title { font-size: 40px; }
  .filters { padding: 0 32px 16px; }
  .legend { padding: 0 32px 16px; }
  .seg { width: 420px; margin: 0 32px 20px; }

  .invwrap { display: grid; grid-template-columns: minmax(0, 1fr) 380px; align-items: start; min-height: 100%; }
  .inv { gap: 0; padding: 0 32px 40px; }
  .inv__cols { display: grid; grid-template-columns: 236px repeat(4, minmax(0, 1fr)); column-gap: 8px; padding-bottom: 10px; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--soft); }
  .prod { grid-template-columns: 228px minmax(0, 1fr); align-items: center; gap: 8px; padding: 12px 0; border-top: 1px solid var(--line-2); }
  .prod__head { grid-template-columns: 44px minmax(0, 1fr); padding-right: 12px; }
  .prod__img { grid-row: span 2; width: 44px; height: 66px; }
  .prod__sum { grid-column: 2; text-align: left; }
  .sizes { gap: 8px; }
  .size { min-height: 100px; padding: 10px 12px; grid-template-rows: 18px minmax(0, 1fr) auto 14px; }
  .size__n { font-size: 30px; }
  .size__detail { display: block; }
  .panel { position: sticky; top: 0; display: grid; align-content: start; gap: 20px; min-height: 100%; padding: 24px 24px 32px; border-left: 1px solid var(--line-2); background: var(--ink-2); }
  .panel .hist__item { padding: 12px 0; }

  .orders { gap: 0; padding: 0 32px 40px; }
  .orders__cols { display: grid; grid-template-columns: 190px 210px minmax(0, 1fr) 250px; column-gap: 24px; padding: 0 20px 10px; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--soft); }
  .order { grid-template-columns: 190px 210px minmax(0, 1fr) 250px; grid-template-areas: "alert alert alert alert" "id who items ship" "id who flags flags"; column-gap: 24px; row-gap: 0; padding: 18px 20px; border-width: 1px 0 0; border-color: var(--line-2); background: transparent; }
  .order:last-child { border-bottom-width: 1px; }
  .order--overdue { border: 1px solid var(--cream); background: var(--ink-2); }
  .order__alert { grid-area: alert; margin: -18px -20px 16px; padding: 8px 20px; }
  .order__id { grid-area: id; grid-template-columns: minmax(0, 1fr); align-content: start; }
  .order__age { text-align: left; }
  .order__who { grid-area: who; flex-direction: column; align-items: flex-start; align-content: start; }
  .order__items { grid-area: items; padding-top: 0; border-top: 0; align-content: start; }
  .order__count { display: none; }
  .order__ship { grid-area: ship; flex-direction: column; align-items: flex-start; justify-content: flex-start; padding-top: 0; border-top: 0; }
  .order__flags { grid-area: flags; margin-top: 14px; }
}

/*
 * Build additions (Claude Code). States the static mockups show with helper
 * classes, mapped onto the real ones, and one fix.
 */
/* `hidden` must win over the display values above (.field is a grid). */
.app [hidden] { display: none !important; }
/* The mockups show focus with .input--focus; real inputs get it on :focus. */
.input:focus { outline: none; border-color: var(--cream); box-shadow: inset 0 0 0 1px var(--cream); }
.input[aria-invalid="true"]:focus { border-color: var(--color-error); box-shadow: inset 0 0 0 1px var(--color-error); }
.stepper__input:focus { outline: none; }
/* `.app a { color: inherit }` outranks `.btn`, which left solid link buttons
   (Refund in Stripe) cream on cream. Restore the button colors on links. */
.app a.btn { color: var(--ink); }
.app a.btn--ghost { color: var(--cream); }
/* The desktop panel's save buttons. */
.panel > .stack { gap: 8px; }
/* The first-visit counting card follows the desktop page margins too. */
@container app (min-width: 1024px) {
  .setup { margin: 0 32px 20px; }
}
