/* 3J Inventory Center: layout and components. No inline styles anywhere (the admin CSP forbids them). */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 15px/1.45 var(--font); }
button, input, select { font: inherit; color: inherit; }
a { color: var(--brand-text); }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--brand); color: var(--on-brand); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---- shell: sidebar on desktop, top bar + bottom tab bar on phones ---- */
.app { min-height: 100dvh; display: grid; grid-template-columns: var(--nav-w) minmax(0, 1fr); }
.side { position: sticky; top: 0; height: 100dvh; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: var(--s4) var(--s3); gap: var(--s4); }
.brand { display: flex; align-items: center; gap: var(--s3); padding: 0 var(--s2); font-weight: 700; font-size: 17px; letter-spacing: .01em; }
.brand .mark { width: 34px; height: 34px; border-radius: 9px; background: var(--brand); color: var(--on-brand); display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.brand small { display: block; font-weight: 400; font-size: 12px; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: var(--s3); min-height: var(--tap); padding: 0 var(--s3); border-radius: var(--r-md); color: var(--text); text-decoration: none; font-weight: 500; }
.nav a:hover { background: var(--surface-2); }
.nav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand-text); }
.nav a { white-space: nowrap; }
.nav .soon { margin-left: auto; font-size: 11px; font-weight: 600; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 10px; padding: 0 6px; }
.side .grow { flex: 1; }
.navgroup { margin: var(--s3) 0 var(--s1); padding: 0 var(--s3); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.nav.sub a { font-size: 14px; color: var(--muted); min-height: 40px; }
.side > .btn { width: 100%; }
.tabbar button.tab { flex: 1 1 auto; min-height: var(--tabbar-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; font-weight: 500; color: var(--muted); background: none; border: 0; padding: 0 4px; cursor: pointer; }
.sheet { display: none; }
@media (max-width: 860px) {
  .sheet:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 60; }
  .sheet .scrim { position: absolute; inset: 0; background: var(--scrim, rgba(0,0,0,.4)); }
  .sheet .sheetbody { position: absolute; left: 0; right: 0; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); max-height: 70dvh; overflow-y: auto; background: var(--surface); border-radius: var(--r-lg) var(--r-lg) 0 0; border-top: 1px solid var(--line); padding: var(--s3); display: grid; gap: var(--s3); }
  .sheet .nav a { min-height: 48px; } .sheet .tools .btn { width: 100%; }
}
.tools { display: flex; flex-direction: column; gap: var(--s2); }
.main-col { min-width: 0; display: flex; flex-direction: column; }
.bar { display: none; }
main { padding: var(--s5); outline: none; max-width: 1280px; width: 100%; }
.legacy { font-size: 13px; color: var(--muted); }

.seg { display: inline-flex; border: 1px solid var(--control-border); border-radius: var(--r-md); overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; min-height: 36px; min-width: 44px; padding: 0 var(--s3); cursor: pointer; font-weight: 500; }
.seg button[aria-pressed="true"] { background: var(--brand); color: var(--on-brand); }

@media (max-width: 860px) {
  .app { display: block; padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
  .side { display: none; }
  .bar { display: flex; align-items: center; gap: var(--s3); position: sticky; top: 0; z-index: 20; height: var(--bar-h); padding: 0 var(--s4); background: var(--surface); border-bottom: 1px solid var(--line); }
  .bar .brand { padding: 0; font-size: 16px; }
  .bar .grow { flex: 1; }
  main { padding: var(--s3) var(--s3) var(--s5); }
  .tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a { flex: 1 1 auto; min-height: var(--tabbar-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; font-weight: 500; text-decoration: none; color: var(--muted); text-align: center; line-height: 1.15; padding: 0 4px; min-width: 0; }
  .tabbar .tablabel { display: block; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; hyphens: none; overflow-wrap: normal; word-break: keep-all; }
  .tabbar a[aria-current="page"] { color: var(--brand-text); }
  .tabbar a[aria-current="page"] svg { stroke-width: 2.4; }
}
@media (min-width: 861px) { .tabbar { display: none; } }

/* ---- controls ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); min-height: var(--tap); padding: 0 var(--s4); border-radius: var(--r-md); border: 1px solid var(--brand); background: var(--brand); color: var(--on-brand); font-weight: 600; cursor: pointer; text-decoration: none; }
.btn.ghost { background: var(--surface); color: var(--brand-text); border-color: var(--control-border); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn.small { min-height: 36px; padding: 0 var(--s3); font-size: 14px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 var(--s3); border-radius: 18px; border: 1px solid var(--control-border); background: var(--surface); cursor: pointer; font-weight: 500; font-size: 14px; white-space: nowrap; }
.chip[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand-text); border-color: var(--brand); }
.badge { display: inline-flex; align-items: center; gap: 6px; min-height: 24px; padding: 0 10px; border-radius: 12px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); } .badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.crit { background: var(--crit-bg); color: var(--crit); } .badge.info { background: var(--info-bg); color: var(--info); } .badge.mute { background: var(--mute-bg); color: var(--mute); }
.badge .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---- Explorer ---- */
.page-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s4); }
h1 { margin: 0; font-size: 24px; font-weight: 600; }
.search { position: sticky; top: 0; z-index: 10; background: var(--bg); padding: var(--s2) 0; }
@media (max-width: 860px) { .search { top: var(--bar-h); } }
.searchbox { display: flex; align-items: center; gap: var(--s2); background: var(--surface); border: 1.5px solid var(--control-border); border-radius: var(--r-md); padding: 0 var(--s3); min-height: 48px; }
.searchbox:focus-within { border-color: var(--brand); }
.searchbox input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; min-height: 44px; font-size: 16px; }
.searchbox kbd { font: 500 12px var(--mono); color: var(--muted); border: 1px solid var(--line-strong); border-radius: 6px; padding: 0 6px; }
.searchbox .clear { border: 0; background: transparent; cursor: pointer; color: var(--muted); min-width: 32px; min-height: 32px; }
.filters { display: flex; gap: var(--s2); margin-top: var(--s3); overflow-x: auto; padding-bottom: 2px; }
.hint { margin: var(--s2) 2px 0; font-size: 13px; color: var(--muted); }
.results-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3); margin: var(--s3) 0; font-size: 14px; color: var(--muted); }
.split { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s4); align-items: start; }
@media (min-width: 1100px) { .split.open { grid-template-columns: minmax(420px, 1fr) minmax(340px, 440px); } }
.list { display: grid; gap: var(--s3); }
.card { position: relative; display: grid; grid-template-columns: 88px minmax(0, 1fr) auto; gap: var(--s3); align-items: center; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s3); cursor: pointer; color: inherit; text-decoration: none; box-shadow: var(--shadow); }
.card:hover { border-color: var(--line-strong); }
.card[aria-current="true"] { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand); }
.card.sev-critical { border-left: 5px solid var(--crit); } .card.sev-warning { border-left: 5px solid var(--warn); }
.photo { width: 88px; height: 88px; border-radius: var(--r-md); background: var(--photo-bg); display: grid; place-items: center; overflow: hidden; color: var(--muted); font-weight: 600; position: relative; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo .tagless { position: absolute; left: 4px; bottom: 4px; font-size: 10px; font-weight: 600; background: var(--surface); color: var(--muted); padding: 0 5px; border-radius: 6px; }
.card h2 { margin: 0; font-size: 17px; font-weight: 600; overflow-wrap: anywhere; }
.card .sub { color: var(--muted); font-size: 13px; }
.card .desc { font-size: 14px; margin: 2px 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
.card .facts { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s3); align-items: center; margin-top: 6px; font-size: 13px; }
.qtybox { text-align: right; min-width: 64px; }
.qtybox .n { font-size: 28px; font-weight: 600; line-height: 1; }
.qtybox .l { font-size: 12px; color: var(--muted); }
.chan { display: inline-flex; align-items: center; gap: 6px; }
.chan b { font-weight: 600; }
@media (max-width: 600px) {
  .card { grid-template-columns: 72px minmax(0, 1fr); }
  .photo { width: 72px; height: 72px; }
  .qtybox { grid-column: 2; text-align: left; display: flex; align-items: baseline; gap: 8px; }
  .qtybox .n { font-size: 22px; }
}
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--line), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s linear infinite; border-radius: var(--r-md); min-height: 104px; }
@keyframes sk { to { background-position: -200% 0; } }
.empty { text-align: center; padding: var(--s6) var(--s4); background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--r-lg); }
.empty h2 { margin: 0 0 var(--s2); font-size: 18px; }

/* ---- detail panel: side panel on wide screens, full sheet on phones/tablets ---- */
.detail { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; }
@media (min-width: 1100px) { .detail { position: sticky; top: 76px; max-height: calc(100dvh - 92px); overflow-y: auto; } }
@media (max-width: 1099px) { .detail { position: fixed; inset: 0; z-index: 50; border-radius: 0; border: 0; overflow-y: auto; padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); } }
.detail header { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4); border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.detail header h2 { margin: 0; font-size: 18px; flex: 1; overflow-wrap: anywhere; }
.iconbtn { border: 0; background: transparent; min-width: var(--tap); min-height: var(--tap); border-radius: var(--r-md); cursor: pointer; display: grid; place-items: center; color: var(--text); }
.iconbtn:hover { background: var(--surface-2); }
.dsec { padding: var(--s4); border-bottom: 1px solid var(--line); }
.dsec:last-child { border-bottom: 0; }
.dsec h3 { margin: 0 0 var(--s3); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.gallery { display: grid; grid-template-columns: 1fr; gap: var(--s2); }
.gallery .big.none { aspect-ratio: auto; min-height: 72px; font-size: 14px; }
.gallery .big { aspect-ratio: 4 / 3; border-radius: var(--r-md); background: var(--photo-bg); display: grid; place-items: center; overflow: hidden; color: var(--muted); }
.gallery .big img { width: 100%; height: 100%; object-fit: contain; }
.thumbs { display: flex; gap: var(--s2); overflow-x: auto; }
.thumbs button { border: 2px solid transparent; padding: 0; border-radius: var(--r-sm); width: 56px; height: 56px; overflow: hidden; cursor: pointer; background: var(--photo-bg); }
.thumbs button[aria-pressed="true"] { border-color: var(--brand); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px var(--s4); margin: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s2); }
.src { border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s3); background: var(--surface-2); }
.src .name { font-size: 12px; color: var(--muted); font-weight: 600; }
.src .n { font-size: 26px; font-weight: 600; line-height: 1.1; }
.src .when { font-size: 12px; color: var(--muted); }
.src.diff { border-color: var(--warn); background: var(--warn-bg); }
.callout { padding: var(--s3); border-radius: var(--r-md); background: var(--info-bg); color: var(--info); font-size: 14px; }
.callout.warn { background: var(--warn-bg); color: var(--warn); } .callout.crit { background: var(--crit-bg); color: var(--crit); }
.callout strong { display: block; }
.history { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.history li { display: grid; grid-template-columns: 56px 1fr auto; gap: var(--s3); padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; align-items: baseline; }
.history .delta { font: 600 14px var(--mono); }
.history .delta.pos { color: var(--ok); } .history .delta.neg { color: var(--crit); }
.history small { color: var(--muted); display: block; }
.actions { display: flex; flex-wrap: wrap; gap: var(--s2); }
.qr { font-size: 13px; word-break: break-all; padding: var(--s2) var(--s3); background: var(--surface-2); border-radius: var(--r-sm); border: 1px solid var(--line); }

/* ---- toast + misc ---- */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + 12px); z-index: 80; display: grid; gap: 8px; width: min(92vw, 420px); }
@media (min-width: 861px) { .toasts { bottom: 24px; } }
.toast { background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: var(--r-md); box-shadow: var(--shadow); font-weight: 500; }
.toast.err { background: var(--crit-bg); color: var(--crit); border: 1.5px solid var(--crit); }
.soon-page { max-width: 640px; }
.soon-page .btn { margin-top: var(--s3); }
@media (max-width: 480px) { .bar .brand > span:last-child { display: none; } .bar { gap: var(--s2); } .seg button { padding: 0 var(--s2); min-width: 40px; } }

/* ---- P2: certainty badges, tiles, dashboard, Mismatch Center, saved views ---- */
.badge .icon { width: 14px; height: 14px; stroke-width: 2.4; }
.badge.dashed { background: transparent; border: 1.5px dashed var(--line-strong); color: var(--mute); }
.badges { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.sub-title { margin: 2px 0 0; }
.head-tools { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--s3); margin-bottom: var(--s4); }
.tile { display: flex; flex-direction: column; gap: 2px; padding: var(--s3) var(--s4); border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); border-top-width: 4px; text-decoration: none; color: var(--text); box-shadow: var(--shadow); min-height: 112px; }
.tile:hover { border-color: var(--line-strong); }
.tile .n { font-size: 34px; font-weight: 600; line-height: 1.05; font-variant-numeric: tabular-nums; }
.tile .l { font-weight: 600; font-size: 14px; }
.tile .d { font-size: 12px; color: var(--muted); }
.tile.crit { border-top-color: var(--crit); } .tile.warn { border-top-color: var(--warn); } .tile.info { border-top-color: var(--info); } .tile.mute { border-top-color: var(--line-strong); }
.tile.crit .n { color: var(--crit); } .tile.warn .n { color: var(--warn); } .tile.info .n { color: var(--info); }
.tile.zero .n { color: var(--muted); }
@media (max-width: 1180px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); } .tile { min-height: 96px; padding: var(--s3); } .tile .n { font-size: 28px; } }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: var(--s4); align-items: start; }
@media (max-width: 1000px) { .dash-grid { grid-template-columns: minmax(0, 1fr); } }
.col { display: grid; gap: var(--s4); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s4); box-shadow: var(--shadow); }
.panel h2 { margin: 0 0 var(--s3); font-size: 17px; font-weight: 600; }
.panel .hint { margin: 0 0 var(--s3); }
.plist { display: grid; gap: var(--s2); margin-bottom: var(--s3); }
.prow { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: var(--s3); align-items: center; padding: var(--s3); border-radius: var(--r-md); border: 1px solid var(--line); border-left-width: 5px; text-decoration: none; color: var(--text); background: var(--surface-2); min-height: var(--tap); }
.prow:hover { border-color: var(--line-strong); }
.prow.sev-critical { border-left-color: var(--crit); } .prow.sev-warning { border-left-color: var(--warn); } .prow.sev-info { border-left-color: var(--info); }
.ptitle { font-weight: 600; overflow-wrap: anywhere; } .psub { font-size: 13px; color: var(--muted); } .pwhy { font-size: 13px; margin-top: 2px; }
@media (max-width: 700px) { .prow { grid-template-columns: minmax(0, 1fr) auto; } .prow .badges { grid-column: 1 / -1; } .prow > .icon:last-child { display: none; } }
.rd { padding: var(--s2) 0; border-bottom: 1px solid var(--line); } .rd:last-of-type { border-bottom: 0; }
.rd-head { display: flex; justify-content: space-between; align-items: center; gap: var(--s2); margin-bottom: 2px; }
.mixbar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--mute-bg); border: 1px solid var(--line); }
.mixbar .mix-seg.verified { background: var(--ok); } .mixbar .mix-seg.stale { background: var(--line-strong); } .mixbar .mix-seg.ambiguous { background: var(--warn); } .mixbar .mix-seg.unverified { background: var(--muted); opacity: .55; }
.mixlegend { list-style: none; margin: var(--s3) 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); }
.mixlegend li { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); } .mixlegend .cnt { font-weight: 600; font-variant-numeric: tabular-nums; }
.qa { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); }
.qa .btn { justify-content: flex-start; text-align: left; }
@media (max-width: 420px) { .qa { grid-template-columns: minmax(0, 1fr); } }
.clist { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.clist li { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; padding: var(--s2) 0; border-bottom: 1px solid var(--line); }
.clist li:last-child { border-bottom: 0; } .clist small { flex-basis: 100%; }

/* filters, views */
.filter-groups { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); margin-top: var(--s3); align-items: center; }
.fgroup { display: flex; align-items: center; gap: var(--s2); min-width: 0; }
.flabel { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); white-space: nowrap; }
.fgroup select, .views select { min-height: 40px; border: 1px solid var(--control-border); border-radius: var(--r-md); background: var(--surface); padding: 0 var(--s3); max-width: 100%; }
@media (max-width: 860px) { .filter-groups { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; } .fgroup { flex: none; } }
.views { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); margin-top: var(--s3); }
.views-add { display: inline-flex; gap: var(--s2); align-items: center; }
.views-add input { min-height: 36px; border: 1.5px solid var(--control-border); border-radius: var(--r-md); background: var(--surface); padding: 0 var(--s3); width: 180px; max-width: 100%; }
.views-note { margin: 0; }

/* Mismatch card + explanation */
.legend { margin-bottom: var(--s3); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s2) var(--s4); }
.legend summary { cursor: pointer; min-height: var(--tap); display: flex; align-items: center; gap: var(--s2); font-weight: 600; }
.legend ul { list-style: none; margin: 0 0 var(--s3); padding: 0; display: grid; gap: var(--s2); } .legend li { display: flex; gap: var(--s3); align-items: baseline; flex-wrap: wrap; } .legend h3 { margin: var(--s3) 0 var(--s2); font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.mm-card { grid-template-columns: 72px minmax(0, 1fr); align-items: start; }
.mm-card .photo { width: 72px; height: 72px; }
.mm-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s2); align-items: flex-start; }
.mm-head h2 { font-size: 16px; }
.mm-trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s2); margin: var(--s2) 0; }
.msrc { border: 1px solid var(--line); border-radius: var(--r-md); padding: 6px 10px; background: var(--surface-2); min-width: 0; }
.msrc .name { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.msrc .n { font-size: 22px; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; } .msrc .when { font-size: 12px; color: var(--muted); }
.msrc.diff { border-color: var(--warn); background: var(--warn-bg); } .msrc.diff .when, .msrc.diff .name { color: var(--warn); }
.msrc.none { border-style: dashed; background: transparent; } .msrc.none .n { color: var(--muted); }
.msrc.oldread { border-style: dashed; } .msrc.oldread .n { color: var(--muted); }
.tag-old { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; color: var(--mute); background: var(--mute-bg); border-radius: 8px; padding: 0 6px; margin-top: 2px; } .tag-old .icon { width: 12px; height: 12px; }
.mm-why { margin: var(--s2) 0 2px; font-size: 14px; } .mm-last { margin: 0; font-size: 13px; }
.card.cert-stale { background: repeating-linear-gradient(135deg, var(--surface), var(--surface) 10px, var(--surface-2) 10px, var(--surface-2) 20px); }
.card.cert-unverified { border-style: dashed; }
@media (max-width: 600px) { .mm-card { grid-template-columns: 56px minmax(0, 1fr); } .mm-card .photo { width: 56px; height: 56px; } .mm-trio { gap: 6px; } .msrc { padding: 6px; } .msrc .n { font-size: 20px; } }
.src.oldread { border-style: dashed; } .src.none { border-style: dashed; background: transparent; }
.why { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.why li { padding: var(--s2) var(--s3); border-radius: var(--r-md); background: var(--surface-2); border-left: 4px solid var(--line-strong); font-size: 14px; }
.why li.why { border-left-color: var(--warn); } .why li.muted { color: var(--muted); } .why li.ours { border-left-color: var(--brand); }
.checks { list-style: none; margin: 0 0 var(--s3); padding: 0; display: grid; gap: var(--s2); }
.checks label { display: flex; gap: var(--s3); align-items: flex-start; min-height: var(--tap); padding: var(--s2) 0; cursor: pointer; }
.checks input { width: 22px; height: 22px; flex: none; margin-top: 1px; accent-color: var(--brand); }

.fold > summary { display: none; list-style: none; cursor: pointer; align-items: center; gap: var(--s2); min-height: var(--tap); padding: 0 var(--s3); border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); font-weight: 600; margin-top: var(--s3); }
.fold > summary::-webkit-details-marker { display: none; }
@media (max-width: 860px) {
  .fold > summary { display: flex; }
  .sub-title { display: none; }
  .page-head { margin-bottom: var(--s2); }
  h1 { font-size: 21px; }
}

/* touch: every control reaches the 44 px target */
@media (pointer: coarse), (max-width: 860px) {
  .chip, .btn.small, .seg button, .fgroup select, .views select, .views-add input, .searchbox .clear { min-height: var(--tap); }
  .searchbox .clear { min-width: var(--tap); }
  .seg button { min-width: var(--tap); }
}
@media (hover: none) { .searchbox kbd { display: none; } }
.pchan i { font-style: normal; color: var(--muted); } .pchan.oldread { color: var(--muted); } .pchan.oldread i::before { content: '⏱ '; }
.abs { font-size: 11px; color: var(--muted); }

.sources { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.sources li { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: var(--s3); align-items: baseline; font-size: 14px; }
.sk { display: inline-block; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: 2px 8px; border-radius: 8px; text-align: center; }
.sk.ledger { background: var(--info-bg); color: var(--info); } .sk.reading { background: var(--mute-bg); color: var(--mute); border: 1px dashed var(--line-strong); }
.sk.count { background: var(--ok-bg); color: var(--ok); } .sk.count.none { background: transparent; color: var(--muted); border: 1px dashed var(--line-strong); }
.why li.basis { border-left-color: var(--brand); font-weight: 500; }

.diffmark { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; color: var(--warn); margin-top: 2px; } .diffmark .icon { width: 12px; height: 12px; }
/* long references never push the page sideways */
.dash-grid > .col, .split > div, .pmain, .mm-main, .card > div { min-width: 0; }
.psub, .pchan, .card .sub, .card .desc, .mm-why, .mm-last, .ptitle { overflow-wrap: anywhere; }
.head-tools .stamp { min-height: 1.5em; min-width: 9ch; display: inline-block; }
@media (max-width: 860px) { .page-head { flex-direction: column; align-items: stretch; } }

/* ---- P3: the Center's writes. Same tokens, no inline styles; every control reaches the 44 px target; state is never colour alone. ---- */
[hidden] { display: none !important; }
.writes-banner { display: flex; align-items: center; gap: var(--s3); margin: var(--s3) var(--s4) 0; padding: var(--s3) var(--s4); border-radius: var(--r-md); background: var(--info-bg); color: var(--info); border: 1px solid var(--line-strong); }
.writes-banner p { margin: 0; } .writes-banner .icon { flex: none; width: 22px; height: 22px; }
@media (max-width: 860px) { .writes-banner { margin: var(--s3) var(--s3) 0; } }

.field { display: grid; gap: 4px; margin-bottom: var(--s4); min-width: 0; }
.field label { font-weight: 600; }
.field .req { color: var(--crit); }
.field input[type="text"], .field input[type="search"], .field select, .field textarea { width: 100%; max-width: 100%; min-height: var(--tap); border: 1.5px solid var(--control-border); border-radius: var(--r-md); background: var(--surface); padding: 8px var(--s3); }
.field textarea { resize: vertical; font: inherit; line-height: 1.4; }
.field input[aria-invalid="true"], .field select[aria-invalid="true"], .field textarea[aria-invalid="true"] { border-color: var(--crit); border-width: 2px; }
.field .hint { margin: 0; }
.field-err { margin: 0; color: var(--crit); font-weight: 600; font-size: 14px; } .field-err:empty { display: none; }
.field-err::before { content: '⚠ '; }
.field-err:empty::before { content: none; }
.check { display: flex; align-items: flex-start; gap: var(--s3); min-height: var(--tap); padding: var(--s2) 0; cursor: pointer; }
.check input { width: 22px; height: 22px; flex: none; margin-top: 1px; accent-color: var(--brand); }
.binpick .check { margin-top: calc(-1 * var(--s2)); margin-bottom: var(--s3); }
.sr-file { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.filebtn { position: relative; display: inline-flex; }
.filebtn label { cursor: pointer; }
.filebtn input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 2px; }
.callout.ok-note { background: var(--ok-bg); color: var(--ok); }
.callout + .callout, .callout + .actions, .callout + .matches { margin-top: var(--s3); }
.callout ul.reasons { margin: 6px 0 0; padding-left: 20px; }

/* quick add */
.intake { max-width: 760px; display: grid; gap: var(--s4); }
.intake h2 { margin: 0; font-size: 20px; } .intake h2:focus { outline: none; }
.intake h3 { margin: 0 0 var(--s2); font-size: 15px; }
.stepper { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); }
.stepper li { display: inline-flex; align-items: center; gap: var(--s2); color: var(--muted); font-weight: 500; }
.stepper li[aria-current="step"] { color: var(--brand-text); font-weight: 700; }
.stepper .sn { width: 26px; height: 26px; border-radius: 50%; border: 2px solid currentColor; display: inline-grid; place-items: center; font-size: 13px; }
.stepper li.done { color: var(--ok); } .stepper li[aria-current="step"] .sn { background: var(--brand-soft); }
.stepcount { margin: 0; }
.findform, .detailsform { display: grid; gap: var(--s3); }
.findform .field, .detailsform .field { margin-bottom: 0; }
.scanbox { display: grid; gap: var(--s2); } .scanvideo { width: 100%; max-height: 50dvh; border-radius: var(--r-md); background: #000; }
.results { display: grid; gap: var(--s3); }
.matches { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s3); }
.match { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: var(--s3); padding: var(--s3); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); }
.match:not(:has(.photo)) { grid-template-columns: minmax(0, 1fr); }
.match .photo { width: 64px; height: 64px; } .match-main { min-width: 0; overflow-wrap: anywhere; } .match .actions { grid-column: 1 / -1; }
.match .sub { font-size: 14px; color: var(--muted); }
.mini { list-style: none; margin: 6px 0 0; padding: 0; font-size: 13px; color: var(--muted); }
.partbox { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s3); border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface-2); }
.formcheck { display: grid; gap: var(--s3); } .formcheck:empty { display: none; }
.photopreview { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); } .photopreview img { max-width: 160px; max-height: 160px; border-radius: var(--r-md); border: 1px solid var(--line); }
.thumb-sm { max-width: 96px; max-height: 96px; border-radius: var(--r-sm); border: 1px solid var(--line); }

/* edit actions, corrections, timeline */
.edit-section .actions { margin-bottom: var(--s3); }
.edit-section [aria-expanded="true"] { background: var(--brand-soft); border-color: var(--brand); }
.inlineform { display: grid; gap: var(--s2); padding: var(--s3); border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface-2); }
.inlineform h4 { margin: 0; font-size: 16px; } .inlineform .field { margin-bottom: var(--s2); }
.corrlist { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s3); }
.corr { display: grid; gap: var(--s2); padding: var(--s3); border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface-2); }
.corr.sensitive { border-left: 5px solid var(--warn); } .corr-reason { margin: 0; overflow-wrap: anywhere; }
.rejectbox { display: grid; }
.timeline li { grid-template-columns: 56px minmax(0, 1fr) auto; } .timeline li > span:nth-child(2) { min-width: 0; overflow-wrap: anywhere; }
.timeline .qtyflow { font: 500 13px var(--mono); color: var(--muted); } .timeline .tldetail { margin-top: 2px; }
.timeline s { opacity: .75; }

/* ---- shared (design system): data table that folds into cards on phones, confirmation dialog, danger button ---- */
.small { font-size: 13px; }
.btn.danger { background: var(--crit-bg); color: var(--crit); border-color: var(--crit); }
.page-head .actions { align-items: center; }
.field input[type="email"], .field input[type="tel"], .field input[type="date"] { width: 100%; max-width: 100%; min-height: var(--tap); border: 1.5px solid var(--control-border); border-radius: var(--r-md); background: var(--surface); padding: 0 var(--s3); }
.fgroup input[type="date"] { min-height: 40px; border: 1px solid var(--control-border); border-radius: var(--r-md); background: var(--surface); padding: 0 var(--s3); max-width: 100%; }
.tablewrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; padding: var(--s3); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.table td { padding: var(--s3); border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
.table tr:last-child td { border-bottom: 0; }
.table .trow { cursor: pointer; } .table .trow:hover { background: var(--surface-2); }
.table .trow[aria-current="true"] { background: var(--brand-soft); box-shadow: inset 4px 0 0 var(--brand); }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table a { display: inline-flex; align-items: center; min-height: 32px; font-weight: 600; }
.dialog-scrim { position: fixed; inset: 0; z-index: 90; background: var(--scrim); display: grid; place-items: center; padding: var(--s4); }
.dialog { background: var(--surface); color: var(--text); border: 1px solid var(--line-strong); border-radius: var(--r-lg); box-shadow: var(--shadow); width: min(560px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; padding: var(--s5); display: grid; gap: var(--s3); }
.dialog h2 { margin: 0; font-size: 19px; } .dialog-body { display: grid; gap: var(--s3); } .dialog-body p { margin: 0; } .dialog .actions { justify-content: flex-end; }
@media (max-width: 860px) {
  .tablewrap { background: transparent; border: 0; box-shadow: none; overflow: visible; }
  .table, .table tbody, .table tr, .table td { display: block; }
  .table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table tbody { display: grid; gap: var(--s3); }
  .table tr { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: var(--s2) var(--s3); }
  .table tr[aria-current="true"] { box-shadow: 0 0 0 2px var(--brand); }
  .table td { display: flex; gap: var(--s3); justify-content: space-between; align-items: baseline; padding: 6px 0; border-bottom: 0; }
  .table td::before { content: attr(data-label); flex: none; min-width: 84px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
  .table td:nth-child(-n+2)::before { display: none; }
  .table td:nth-child(-n+2) { justify-content: flex-start; }
  .table .num { text-align: left; }
  .table a { min-height: var(--tap); }
  .table td > :last-child { text-align: right; }
  .table td:nth-child(-n+2) > :last-child { text-align: left; }
}
@media (min-width: 1100px) { .split.open .table .opt { display: none; } }

/* ---- Quote Center ---- */
.qnum { font-size: 15px; white-space: nowrap; } .table td:first-child, .table th:first-child { min-width: 5.5em; }
.detail .writes-banner.compact { margin: 0; border-radius: 0; border-width: 0 0 1px; padding: var(--s2) var(--s4); font-size: 13px; } .qreq { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.oldscreen { margin-top: var(--s5); } .oldscreen .icon { vertical-align: -3px; margin-right: 4px; }
.qlines, .stagedlist, .pickres, .qfiles { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s3); }
.qline { display: grid; gap: var(--s2); padding: var(--s3); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); }
.qline .field { margin-bottom: 0; } .qline-meta { color: var(--muted); font-size: 13px; } .qline-meta .out { color: var(--crit); font-weight: 600; } .qprice { margin: 0; font-weight: 600; }
.staged { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s2) var(--s3); border: 1px dashed var(--line-strong); border-radius: var(--r-md); }
.pickres:empty { display: none; } .pickres { gap: 4px; }
.pickbtn { width: 100%; min-height: var(--tap); text-align: left; border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); padding: 6px var(--s3); cursor: pointer; }
.pickbtn:hover { border-color: var(--brand); } .picked { margin: 0; font-weight: 600; color: var(--ok); } .picked::before { content: '✓ '; }
.msg:empty { display: none; } .msg { margin-top: var(--s3); }
.previewbox:empty { display: none; } .previewbox { margin-top: var(--s3); padding: var(--s3); border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface-2); }
.previewbox h4, .dsec h4 { margin: 0 0 var(--s2); font-size: 15px; }
.mailtext { white-space: pre-wrap; overflow-wrap: anywhere; margin: var(--s3) 0 0; padding: var(--s3); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); font: 400 13px/1.5 var(--mono); max-height: 320px; overflow: auto; }
.prewrap { white-space: pre-wrap; overflow-wrap: anywhere; } .quote-message { margin: 0; padding: var(--s3); background: var(--surface-2); border-radius: var(--r-sm); }
.qfiles li { display: flex; align-items: center; gap: var(--s2); min-height: var(--tap); } .status-actions { margin-top: var(--s3); }
.timeline .tlicon { display: grid; place-items: center; color: var(--muted); } .timeline .tlwhen { text-align: right; display: grid; gap: 2px; justify-items: end; } .timeline .tlerr { color: var(--crit); font-weight: 600; }
.sub-title + .actions, .page-head > .actions { margin-left: auto; }
@media (min-width: 1100px) { .detail .writes-banner.compact { display: none; } }   /* beside the list the page banner above is visible */
.dialog p, .dialog dd, .dialog strong { overflow-wrap: anywhere; }

/* ---- Quote operations: create, edit, preview, send, follow up ---- */
.btn.cta { min-height: 48px; padding: 0 var(--s5); font-size: 16px; box-shadow: var(--shadow); }
@media (max-width: 860px) {   /* the one action of the screen stays under the thumb, above the tab bar, and gives way to the record sheet */
  .btn.cta { position: fixed; z-index: 40; right: var(--s3); bottom: calc(var(--tabbar-h) + var(--s2)); min-height: 44px; padding: 0 var(--s4); font-size: 15px; border-radius: 999px; }
  .split .list { padding-bottom: 88px; }   /* the last card is never hidden under the floating button */
  body:has(.detail[role="dialog"]) .btn.cta { display: none; }
}
.navbadge, .errbadge { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn); font-size: 12px; font-weight: 700; margin-left: auto; }
.navbadge[hidden], .errbadge[hidden] { display: none; }
.tabbar a { position: relative; } .tabbar .navbadge { position: absolute; top: 4px; left: 50%; margin: 0; min-width: 20px; height: 20px; }
.quote-top { display: grid; gap: var(--s2); margin-bottom: var(--s3); } .notices:empty { display: none; } .notices { display: grid; gap: var(--s2); }
.testctl { border: 1px solid var(--line-strong); border-radius: var(--r-md); padding: var(--s2) var(--s3); background: var(--surface); } .testctl summary { min-height: var(--tap); display: flex; align-items: center; cursor: pointer; font-weight: 600; }
.reminders { border: 1px solid var(--line-strong); border-radius: var(--r-md); padding: 0 var(--s3); background: var(--surface); } .reminders:empty { display: none; }
.reminders summary { min-height: var(--tap); display: flex; align-items: center; gap: var(--s2); cursor: pointer; font-weight: 600; font-size: 15px; } .reminders[open] { padding-bottom: var(--s2); } .remcount { display: inline-block; min-width: 24px; padding: 0 8px; border-radius: 12px; background: var(--warn-bg); color: var(--warn); font-size: 14px; text-align: center; }
.remlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; } .remlist li { min-height: 36px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px var(--s2); overflow-wrap: anywhere; } .remlist .remwhen { flex-basis: 100%; }   /* the dates sit on their own line: no separator can start a wrapped line */ .remlist a { min-height: 32px; display: inline-flex; align-items: center; font-weight: 600; }
.row2, .row3, .row4 { display: grid; gap: var(--s3); grid-template-columns: 1fr; } .row2 .field, .row3 .field, .row4 .field { margin-bottom: var(--s2); }
@media (min-width: 560px) { .row2 { grid-template-columns: 1fr 1fr; } .row3 { grid-template-columns: 1fr 1fr 1fr; } .row4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.qamount { display: block; min-height: var(--tap); padding: 10px 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.totals { display: grid; gap: 6px; } .trow2 { display: flex; justify-content: space-between; gap: var(--s3); } .trow2 .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.trow2.grand { border-top: 2px solid var(--line-strong); padding-top: var(--s2); font-size: 18px; font-weight: 700; }
.internal-flag { margin: 0 0 var(--s3); } .errtext { margin-top: 6px; overflow-wrap: anywhere; font-family: var(--mono); }
.dlv { display: grid; gap: var(--s3); } .dlv p { margin: 0; } .dlv .callout { margin: 0; }
.fu-row { align-items: end; } .fu-actions { padding-bottom: var(--s4); }
.dsec h3 + .row2 { margin-top: 0; }

/* ---- Quote operations polish (captures review) ---- */
.notices .callout { padding: var(--s2) var(--s3); font-size: 13px; } .notices .callout strong { display: inline; margin-right: var(--s2); }
.mailinfo { font-size: 13px; } .mailinfo summary { min-height: 32px; display: flex; align-items: center; cursor: pointer; color: var(--muted); } .mailinfo .hint { margin: var(--s1, 4px) 0; }
.dlv-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s2); }
.callout + .kv, .callout + .previewbox, .kv + .callout, .kv + .row2, .kv + .fu-row, .actions + h4, .callout + dl { margin-top: var(--s3); }
.dsec .actions + h4 { margin-top: var(--s4); }
.detail[role="dialog"]:focus { outline: none; }
@media (max-width: 860px) { .toasts { bottom: auto; top: calc(env(safe-area-inset-top, 0px) + 8px); pointer-events: none; } }   /* a toast never covers the bottom of a form */
/* the menu group that holds the current screen (the entry itself carries aria-current) */
.navgroup[data-active] { color: var(--brand-text); }
.navgroup[data-active]::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 6px; border-radius: 50%; background: var(--brand); vertical-align: middle; }
/* Orders (Sales menu) */
.pre { white-space: pre-line; overflow-wrap: anywhere; }
.olines { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s3); }
.olines li { display: grid; gap: 2px; padding: var(--s3); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); overflow-wrap: anywhere; }
.plain { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.orders-refresh { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); } .orders-refresh .callout { flex-basis: 100%; margin: 0; }

/* ---- Shipping (Sales menu): zones, carriers, tariff editor, simulator. Same tokens, no inline styles, 44 px targets, bands fold to cards on a phone. ---- */
.sh-zones { display: grid; gap: var(--s3); grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1000px) { .sh-zones { grid-template-columns: minmax(0, 1fr); } }
.sh-zone-card h3 { margin: 0 0 var(--s2); font-size: 16px; }
.sh-fixed { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); margin: var(--s2) 0 var(--s3); }
.sh-fixed .sh-lab { min-width: 0; }
.sh-sec { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); margin-top: var(--s2); }
.sh-head { display: flex; align-items: center; gap: var(--s2); width: 100%; min-height: var(--tap); padding: 0 var(--s3); border: 0; background: transparent; cursor: pointer; text-align: left; font: inherit; color: inherit; }
.sh-head .icon { flex: none; transition: transform .12s; }
.sh-head[aria-expanded="true"] .icon { transform: rotate(90deg); }
.sh-headtext { display: flex; flex-wrap: wrap; align-items: center; gap: 2px var(--s2); min-width: 0; overflow-wrap: anywhere; }
.sh-body { padding: var(--s2) var(--s3) var(--s3); border-top: 1px solid var(--line); }
.sh-carrier > .sh-head { font-size: 16px; background: var(--surface-2); border-radius: var(--r-md); }
.sh-services { display: grid; gap: 0; }
.sh-grid { display: grid; gap: 0 var(--s3); grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.sh-search { width: 100%; min-height: var(--tap); border: 1.5px solid var(--control-border); border-radius: var(--r-md); background: var(--surface); padding: 0 var(--s3); margin-bottom: var(--s2); }
.sh-chips { margin: var(--s2) 0; }
.sh-zone { border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s3); margin: var(--s3) 0 0; min-width: 0; }
.sh-zone legend { font-weight: 700; padding: 0 var(--s2); }
.sh-zone h4 { margin: var(--s3) 0 var(--s1, 4px); font-size: 14px; }
.sh-bands { display: grid; gap: var(--s2); margin: var(--s2) 0; }
.sh-band { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s2) var(--s3); padding: var(--s2) var(--s3); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); }
.sh-lab { display: grid; gap: 2px; font-size: 12px; font-weight: 600; color: var(--muted); min-width: 120px; flex: 1 1 130px; }
.sh-lab.grow2 { flex: 2 1 200px; }
.sh-lab input, .sh-lab select, .sh-search { font-size: 15px; color: var(--text); }
.sh-lab input[type="text"], .sh-lab select { width: 100%; min-height: var(--tap); border: 1.5px solid var(--control-border); border-radius: var(--r-md); background: var(--surface); padding: 0 var(--s3); }
.sh-in { display: flex; align-items: center; gap: 6px; } .sh-in i { font-style: normal; color: var(--muted); }
.sh-pnote { min-height: 24px; }
.sh-gap { margin-top: var(--s3); }
.sh-desc { overflow-wrap: anywhere; }
.sh-savebar { position: sticky; bottom: 0; z-index: 20; display: flex; align-items: center; gap: var(--s3); margin-top: var(--s4); padding: var(--s3) var(--s4); border: 1px solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); box-shadow: var(--shadow); }
.sh-savebar { flex-wrap: wrap; }
.sh-savebar .msg { flex: 1 1 100%; margin: 0; }
.sh-savebar .msg:empty { display: none; }
.sh-savebar .grow { flex: 1; }
.sh-status.dirty { color: var(--warn); font-weight: 700; }
@media (max-width: 860px) {
  .sh-savebar { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); flex-wrap: wrap; }
  .sh-savebar .btn.cta { position: static; border-radius: var(--r-md); box-shadow: none; }
}
.sh-sim .row2, .sh-sim .row3 { margin-bottom: var(--s2); }
.sh-results { display: grid; gap: var(--s3); margin-top: var(--s3); }
.sh-opt { border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s3); background: var(--surface); }
.sh-opt.on_request { border-left: 5px solid var(--warn); } .sh-opt.unavailable { border-left: 5px solid var(--line-strong); opacity: .9; } .sh-opt.priced { border-left: 5px solid var(--ok); }
.sh-opt header { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s3); }
.sh-total { font-size: 20px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sh-steps { margin: var(--s2) 0 0; padding-left: 1.2em; display: grid; gap: 2px; font-size: 14px; overflow-wrap: anywhere; }

/* Quote screen: fixed shipping rate menu */
.qship { margin: var(--s3) 0; padding: var(--s3); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); }
.qship h4 { margin: 0 0 var(--s1, 4px); }

/* Counts: the quantity typed on a count sheet line (a 44px target on a phone, the number never cut) */
.cnt-input { width: 7rem; max-width: 100%; min-height: var(--tap); border: 1.5px solid var(--control-border); border-radius: var(--r-md); background: var(--surface); padding: 0 var(--s3); font-variant-numeric: tabular-nums; }

/* CRM campaigns: the message as the recipient reads it (plain text) */
.mailbody { white-space: pre-wrap; font: inherit; margin: 0 0 8px; padding: 10px 12px; border: 1px solid var(--line, #d0d7de); border-radius: 8px; max-height: 360px; overflow: auto; }

/* group admin: the sign-in and password cards */
.auth-card { max-width: 420px; margin: 0 auto; text-align: left; }
.auth-card h1 { font-size: 1.25rem; margin: 0 0 .5rem; }
/* a plain section box (forms, settings) — the stock `.card` is a list card with a photo column */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s4, 16px); margin-block: 0 var(--s3, 12px); box-shadow: var(--shadow); }
.panel h2 { font-size: 1.05rem; margin: 0 0 var(--s2, 8px); }
.panel .field { margin-block: var(--s2, 8px); }
.app-gate { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
