:root {
  --bg: #f5f6f2;
  --panel: #ffffff;
  --ink: #1c2723;
  --muted: #6e7974;
  --line: #e2e7e3;
  --green: #1f7357;
  --green-dark: #15543f;
  --green-soft: #dcefe6;
  --amber: #9b5d16;
  --amber-soft: #fff1d6;
  --blue-soft: #e3eef8;
  --lilac-soft: #ece8f6;
  --danger: #b63d43;
  --danger-soft: #fbe9ea;
  --shadow: 0 12px 38px rgba(39, 57, 49, .07);
  --radius: 18px;
}

/* Benchmark-led controls: visible state, meaningful filters and touch-sized actions. */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

* { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: "DM Sans", "Noto Sans SC", sans-serif; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(31,115,87,.22); outline-offset: 2px; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 236px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; background: #17382d; color: #fff; padding: 28px 18px 20px; display: flex; flex-direction: column; z-index: 30; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 10px 30px; }
.brand-mark { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; color: #17382d; background: #b9e5cf; }
.brand-mark svg { width: 22px; }
.brand strong { display: block; font-size: 18px; letter-spacing: -.2px; }
.brand span { display: block; color: #9eb8ae; font-size: 13px; margin-top: 2px; }
.nav { display: grid; gap: 5px; }
.nav-item { width: 100%; border: 0; background: transparent; color: #b8cbc4; min-height: 48px; display: flex; align-items: center; gap: 12px; padding: 0 13px; border-radius: 12px; cursor: pointer; transition: .18s ease; text-align: left; }
.nav-item svg { width: 19px; height: 19px; }
.nav-item span { flex: 1; }
.nav-item b { font-size: 11px; font-weight: 600; min-width: 24px; text-align: center; padding: 3px 7px; color: #cfe2db; background: rgba(255,255,255,.1); border-radius: 10px; }
.nav-item:hover { color: #fff; background: rgba(255,255,255,.07); }
.nav-item.active { color: #15362b; background: #c9ead9; font-weight: 600; }
.nav-item.active b { color: #fff; background: var(--green); }
.sidebar-bottom { margin-top: auto; display: grid; gap: 5px; }
.local-note { display: flex; align-items: center; gap: 8px; color: #a8bdb5; border-top: 1px solid rgba(255,255,255,.1); font-size: 12px; margin: 14px 8px 0; padding-top: 18px; }
.local-note svg { width: 15px; }
.main { padding: 34px 40px 64px; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 18px; margin-bottom: 30px; }
.topbar > div:nth-child(2) { flex: 1; }
.eyebrow, .modal-kicker { margin: 0 0 5px; color: var(--green); font-size: 11px; font-weight: 700; letter-spacing: 1.5px; }
h1 { font-size: clamp(27px, 3vw, 38px); line-height: 1.05; letter-spacing: -1.2px; margin: 0; }
.header-actions { display: flex; gap: 10px; }
.language-switch { display: flex; align-items: center; gap: 6px; width: auto; flex: 0 0 auto; padding: 0 9px; height: 44px; border: 1px solid var(--line); background: var(--panel); border-radius: 11px; color: var(--muted); }
.language-switch svg { width: 17px; height: 17px; }
.language-switch select { width: auto; height: 38px; max-width: 104px; padding: 0 20px 0 2px; border: 0; background: transparent; color: var(--ink); font-size: 13px; font-weight: 600; cursor: pointer; box-shadow: none; }
.language-switch select:focus { box-shadow: none; }
.button { height: 44px; border: 0; border-radius: 11px; padding: 0 17px; display: inline-flex; justify-content: center; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; transition: transform .15s, background .15s; white-space: nowrap; }
.button:hover { transform: translateY(-1px); }
.button svg { width: 18px; }
.button.primary { background: var(--green); color: #fff; box-shadow: 0 7px 17px rgba(31,115,87,.18); }
.button.primary:hover { background: var(--green-dark); }
.button.secondary { background: var(--panel); color: var(--ink); border: 1px solid var(--line); }
.button.ghost { background: transparent; color: var(--muted); }
.button.danger { background: var(--danger); color: #fff; }
.icon-button { width: 42px; height: 42px; display: grid; place-items: center; border: 1px solid var(--line); background: var(--panel); border-radius: 11px; cursor: pointer; }
.icon-button svg { width: 19px; }
.menu-button { display: none; }
.view { display: none; animation: fade .2s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.stat-card { min-width: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: flex; gap: 15px; align-items: center; box-shadow: var(--shadow); }
.stat-icon { width: 45px; height: 45px; border-radius: 14px; display: grid; place-items: center; flex: 0 0 auto; }
.stat-icon svg { width: 21px; }
.accent-mint .stat-icon { background: var(--green-soft); color: var(--green); }
.accent-amber .stat-icon { background: var(--amber-soft); color: var(--amber); }
.accent-blue .stat-icon { background: var(--blue-soft); color: #406f99; }
.accent-lilac .stat-icon { background: var(--lilac-soft); color: #6d5a99; }
.stat-card span, .stat-card small { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-card span { font-size: 14px; font-weight: 600; }
.stat-card strong { display: block; font-size: 25px; letter-spacing: -.7px; margin: 2px 0; }
.stat-card small { font-size: 12px; }
.attention-card { display: flex; align-items: center; gap: 13px; border: 1px solid #f1dcba; background: #fff9ec; border-radius: 15px; padding: 15px 18px; margin-bottom: 16px; }
.attention-card.ok { border-color: #cae6d7; background: #f2faf6; }
.attention-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; background: var(--amber-soft); color: var(--amber); }
.attention-card.ok .attention-icon { background: var(--green-soft); color: var(--green); }
.attention-card strong { font-size: 14px; }
.attention-card p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.text-button { margin-left: auto; border: 0; background: transparent; color: var(--green); display: flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 600; font-size: 14px; }
.text-button svg { width: 15px; }
.section-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.toolbar { display: flex; align-items: center; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.search-box { flex: 1; min-width: 180px; position: relative; }
.search-box svg { position: absolute; left: 13px; top: 12px; width: 17px; color: #8b9691; }
.search-box input { width: 100%; height: 42px; background: #f6f7f4; border: 1px solid transparent; border-radius: 10px; padding: 0 13px 0 40px; color: var(--ink); }
.search-box input:focus { background: #fff; border-color: #a7cdbc; outline: 0; }
.filter-group { display: flex; gap: 5px; }
.filter-chip { border: 0; background: transparent; color: var(--muted); border-radius: 9px; min-height: 36px; padding: 0 11px; font-size: 14px; cursor: pointer; }
.filter-chip.active { color: var(--green-dark); background: var(--green-soft); font-weight: 600; }
.filter-chip b { display: inline-block; min-width: 20px; text-align: center; border-radius: 99px; background: #eef2f0; color: var(--ink); padding: 2px 5px; font-size: 11px; }
.inventory-list { width: 100%; }
.inventory-header, .inventory-row { display: grid; grid-template-columns: minmax(220px,1.6fr) minmax(120px,.8fr) 110px 120px 190px; align-items: center; column-gap: 16px; }
.inventory-header { padding: 12px 20px; background: #fafbf9; color: #7a8580; font-size: 10px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; }
.inventory-row { padding: 15px 20px; border-top: 1px solid #edf0ed; transition: background .15s; }
.inventory-row:hover { background: #fbfcfa; }
.item-main { min-width: 0; display: flex; align-items: center; gap: 12px; }
.item-avatar { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; color: var(--green); background: var(--green-soft); flex: 0 0 auto; }
.item-avatar.consumable { color: #426f99; background: var(--blue-soft); }
.item-avatar.antibody { color: #765e9e; background: var(--lilac-soft); }
.item-avatar.sample { color: #9a5d15; background: var(--amber-soft); }
.item-avatar svg { width: 20px; }
.item-title { min-width: 0; }
.item-title strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.item-title span, .meta-cell small { color: var(--muted); font-size: 12px; }
.stock-cell strong { font-size: 16px; }
.stock-cell span { font-size: 12px; color: var(--muted); margin-left: 3px; }
.status-pill { display: inline-flex; align-items: center; gap: 5px; width: max-content; padding: 5px 8px; border-radius: 8px; background: #ebf6f0; color: var(--green); font-size: 10px; font-weight: 700; }
.status-pill.low { color: var(--amber); background: var(--amber-soft); }
.status-pill.out { color: var(--danger); background: var(--danger-soft); }
.status-pill .dot { width: 6px; height: 6px; background: currentColor; border-radius: 50%; }
.row-actions { display: flex; justify-content: flex-end; gap: 7px; }
.quick-use { min-height: 36px; border: 0; border-radius: 9px; color: #fff; background: var(--green); padding: 0 12px; font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 6px; cursor: pointer; }
.quick-use:disabled { background: #c6ceca; cursor: not-allowed; }
.quick-use svg { width: 15px; }
.mini-action { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line); background: #fff; border-radius: 9px; cursor: pointer; }
.mini-action svg { width: 16px; }
.view-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.view-heading h2 { margin: 0 0 5px; font-size: 24px; }
.view-heading p { margin: 0; color: var(--muted); font-size: 14px; }
.order-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.order-tab { border: 0; background: transparent; color: var(--muted); padding: 10px 14px 12px; cursor: pointer; border-bottom: 2px solid transparent; }
.order-tab.active { color: var(--green); border-bottom-color: var(--green); font-weight: 600; }
.order-tab span { margin-left: 5px; background: #e6eae7; padding: 2px 7px; border-radius: 9px; font-size: 10px; }
.orders-list { display: grid; gap: 11px; }
.order-card { background: var(--panel); border: 1px solid var(--line); border-radius: 15px; box-shadow: var(--shadow); padding: 17px 18px; display: grid; grid-template-columns: minmax(220px,1.4fr) repeat(3,minmax(110px,.6fr)) auto; align-items: center; gap: 18px; }
.load-more { display: flex; margin: 17px auto 0; }
.order-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.order-main .item-avatar { background: var(--blue-soft); color: #426f99; }
.order-main strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.order-main span, .order-data span { display: block; color: var(--muted); font-size: 10px; margin-bottom: 3px; }
.order-data strong { font-size: 12px; }
.receive-button { border: 0; height: 38px; border-radius: 10px; background: var(--green); color: white; font-weight: 600; font-size: 12px; padding: 0 13px; cursor: pointer; }
.arrived-label { color: var(--green); background: var(--green-soft); padding: 8px 11px; border-radius: 9px; font-size: 11px; font-weight: 600; }
.order-details { grid-column: 1 / -1; border-top: 1px solid var(--line); padding-top: 10px; }
.order-details summary { color: var(--green); font-size: 12px; font-weight: 600; cursor: pointer; }
.order-detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 20px; padding: 12px 0 2px; }
.order-detail-grid p { margin: 0; min-width: 0; }
.order-detail-grid strong, .order-detail-grid span { display: block; font-size: 12px; overflow-wrap: anywhere; }
.order-detail-grid strong { color: var(--muted); margin-bottom: 3px; }
.timeline { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px 22px; }
.timeline-item { display: grid; grid-template-columns: 42px minmax(0,1fr) auto; gap: 14px; padding: 16px 0; border-bottom: 1px solid #edf0ed; align-items: center; }
.timeline-item:last-child { border-bottom: 0; }
.timeline-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; background: var(--green-soft); color: var(--green); }
.timeline-icon.use { background: var(--amber-soft); color: var(--amber); }
.timeline-icon.delete { background: var(--danger-soft); color: var(--danger); }
.timeline-icon svg { width: 17px; }
.timeline-copy strong { font-size: 13px; }
.timeline-copy p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.timeline-qty { font-size: 13px; font-weight: 700; }
.timeline-qty.negative { color: var(--amber); }
.activity-summary { margin-bottom: 15px; color: var(--muted); font-size: 12px; }
.empty-state { text-align: center; padding: 64px 20px; }
.empty-icon { margin: 0 auto 14px; width: 52px; height: 52px; display: grid; place-items: center; border-radius: 16px; background: var(--green-soft); color: var(--green); }
.empty-state h3 { margin: 0 0 6px; font-size: 16px; }
.empty-state p { margin: 0 auto 18px; color: var(--muted); font-size: 12px; }
.modal { width: min(620px, calc(100vw - 30px)); max-height: calc(100vh - 34px); border: 0; border-radius: 20px; padding: 0; color: var(--ink); box-shadow: 0 26px 80px rgba(19,42,33,.25); overflow: auto; }
.modal.small { width: min(470px, calc(100vw - 30px)); }
.modal::backdrop { background: rgba(14,31,25,.48); backdrop-filter: blur(3px); }
.modal form, .modal > div, .modal > p { margin: 0; }
.modal form, #confirmDialog { padding: 24px; }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 21px !important; }
.modal-header h2 { margin: 0; font-size: 21px; }
.modal-header .icon-button { border: 0; background: #f2f4f1; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.form-grid .full { grid-column: 1 / -1; }
label { color: #53605a; display: grid; gap: 7px; font-size: 14px; font-weight: 600; }
label > span { color: inherit; }
input, select, textarea { width: 100%; color: var(--ink); border: 1px solid #dce2de; background: #fff; border-radius: 10px; padding: 10px 11px; font-size: 13px; }
input, select { height: 42px; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: #79ae98; outline: 0; box-shadow: 0 0 0 3px rgba(31,115,87,.09); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.modal-hint { display: flex; gap: 9px; align-items: flex-start; margin-top: 17px; padding: 12px; color: #587066; background: #f0f7f3; border-radius: 10px; font-size: 13px; line-height: 1.5; }
.modal-hint svg { width: 16px; flex: 0 0 auto; color: var(--green); }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: #f1f3f0; padding: 4px; border-radius: 11px; margin-bottom: 17px; }
.segmented button { height: 37px; border: 0; background: transparent; color: var(--muted); border-radius: 8px; display: flex; align-items: center; justify-content: center; gap: 7px; cursor: pointer; font-weight: 600; }
.segmented button.active { background: #fff; color: var(--green); box-shadow: 0 2px 8px rgba(30,45,38,.08); }
.segmented svg { width: 16px; }
.quantity-input { display: grid; grid-template-columns: 42px 1fr 42px; }
.quantity-input input { border-radius: 0; text-align: center; }
.quantity-input button { border: 1px solid #dce2de; background: #f7f8f6; cursor: pointer; }
.quantity-input button:first-child { border-radius: 10px 0 0 10px; }
.quantity-input button:last-child { border-radius: 0 10px 10px 0; }
.quantity-input svg { width: 15px; }
#adjustForm > label { margin-top: 15px; }
.checkbox { grid-template-columns: 18px 1fr; align-items: flex-start; font-weight: 400; color: var(--muted); line-height: 1.45; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--green); padding: 0; }
.checkbox span { color: inherit; }
.confirm-text { color: var(--muted); line-height: 1.6; font-size: 14px; }
#excelDialog { padding: 24px; }
.import-explainer, .import-footnote { color: var(--muted); font-size: 13px; line-height: 1.5; margin: 0 0 15px; }
.import-footnote { margin: 12px 0 0; }
.import-sheet-label { margin-bottom: 13px; }
.import-summary { padding: 11px 13px; margin-bottom: 12px; border-radius: 10px; background: #eef6f1; color: var(--green-dark); font-size: 13px; font-weight: 600; }
.import-preview-wrap { max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.import-preview { width: 100%; border-collapse: collapse; font-size: 14px; }
.import-preview th, .import-preview td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.import-preview th { position: sticky; top: 0; background: #f6f8f5; color: var(--muted); font-weight: 700; }
.import-preview tr:last-child td { border-bottom: 0; }
.import-preview td:nth-child(2) { min-width: 160px; }
.import-preview .match-status { min-width: 160px; font-weight: 650; }
.import-preview .pasteMatchSeparate { color: var(--danger); }
.button:disabled { opacity: .48; cursor: not-allowed; transform: none; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); z-index: 80; display: flex; align-items: center; gap: 10px; min-width: 280px; max-width: calc(100vw - 28px); padding: 11px 14px; background: #193b30; color: #fff; border-radius: 12px; box-shadow: 0 15px 45px rgba(15,42,32,.25); opacity: 0; pointer-events: none; transition: .2s; font-size: 12px; }
.toast.show { opacity: 1; transform: translate(-50%,0); pointer-events: auto; }
.toast-icon { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 8px; color: #193b30; background: #b9e5cf; }
.toast-icon svg { width: 14px; }
.toast span { flex: 1; }
.toast button { border: 0; background: transparent; color: #b9e5cf; font-weight: 700; cursor: pointer; }
.sidebar-scrim { display: none; }

@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .inventory-header { display: none; }
  .inventory-row { grid-template-columns: minmax(200px,1fr) 100px 170px; }
  .inventory-row .meta-cell, .inventory-row .status-cell { display: none; }
  .order-card { grid-template-columns: minmax(220px,1.4fr) repeat(2,minmax(100px,.6fr)) auto; }
  .order-card .eta-data { display: none; }
}

@media (max-width: 800px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; left: 0; transform: translateX(-105%); width: 248px; transition: transform .22s ease; box-shadow: 15px 0 40px rgba(0,0,0,.15); }
  body.menu-open .sidebar { transform: translateX(0); }
  .sidebar-scrim { position: fixed; inset: 0; z-index: 25; background: rgba(10,24,19,.35); }
  body.menu-open .sidebar-scrim { display: block; }
  .main { padding: 24px 18px 60px; }
  .menu-button { display: grid; }
  .topbar { margin-bottom: 22px; }
  .topbar { flex-wrap: wrap; }
  .topbar > div:nth-child(2) { min-width: 160px; }
  .header-actions .secondary { display: none; }
  .toolbar { flex-wrap: wrap; }
  .search-box { flex-basis: 100%; }
  .filter-group { width: 100%; overflow-x: auto; order: 3; padding-bottom: 2px; }
  .inventory-row { grid-template-columns: 1fr auto; gap: 11px; padding: 15px; }
  .inventory-row .stock-cell { grid-column: 1; padding-left: 54px; }
  .row-actions { grid-row: 1 / span 2; grid-column: 2; align-self: center; }
  .quick-use span { display: none; }
  .quick-use { width: 38px; padding: 0; justify-content: center; }
  .order-card { grid-template-columns: 1fr auto; gap: 12px; }
  .order-card .order-data { grid-column: 1; margin-left: 54px; }
  .order-card .supplier-data { display: none; }
  .order-card > .order-end { grid-column: 2; grid-row: 1 / span 2; }
  .order-detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .view-heading { align-items: center; }
}

@media (max-width: 540px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .stat-card { padding: 14px; gap: 10px; }
  .stat-icon { width: 38px; height: 38px; border-radius: 11px; }
  .stat-card strong { font-size: 21px; }
  .stat-card span { white-space: normal; font-size: 12px; line-height: 1.25; }
  .stat-card small { display: none; }
  .attention-card { align-items: flex-start; }
  .attention-card .text-button { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .header-actions .button span { display: none; }
  .header-actions .button { width: 43px; padding: 0; }
  .language-switch { order: 4; margin-left: auto; }
  .topbar { gap: 10px; }
  h1 { font-size: 25px; }
  .view-heading .button { padding: 0 12px; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; } }

/* Catalog and purchase workflow */
.page-heading { flex: 1; min-width: 190px; }
.topbar > .page-heading { flex: 1; }
.notice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }
.notice-grid .attention-card { margin-bottom: 0; min-width: 0; }
.expiry-notice { background: #f2f8f5; border-color: #d6e7dd; }
.expiry-notice:not(.ok) { background: #fff9ec; border-color: #f1dcba; }
.reminder-setting { margin-left: auto; width: 128px; flex: 0 0 auto; font-size: 12px; gap: 4px; }
.reminder-setting span { color: var(--muted); }
.reminder-setting select { height: 36px; font-size: 12px; padding: 6px; }
.source-note { margin: 15px 4px 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.family-card { border-top: 1px solid #edf0ed; }
.family-card:first-child { border-top: 0; }
.family-card .inventory-row { border-top: 0; }
.inventory-row, .variant-row { grid-template-columns: minmax(240px, 1.8fr) minmax(130px, .8fr) minmax(120px, .7fr) minmax(150px, .9fr) auto; column-gap: 13px; }
.inventory-row { display: grid; }
.variant-row { display: grid; align-items: center; padding: 14px 18px; border-top: 1px solid var(--line); }
.variant-row .item-avatar { background: var(--blue-soft); color: #426f99; }
.item-title strong { white-space: normal; line-height: 1.35; }
.item-title span { display: block; overflow-wrap: anywhere; line-height: 1.4; margin-top: 2px; }
.meta-cell { min-width: 0; }
.meta-cell strong, .meta-cell small { display: block; overflow-wrap: anywhere; }
.meta-cell strong { font-size: 12px; line-height: 1.35; }
.stock-cell strong { font-size: 14px; overflow-wrap: anywhere; }
.status-cell { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.status-pill { font-size: 11px; white-space: normal; line-height: 1.2; }
.status-pill.uncounted { color: #655b83; background: #eeeaf6; }
.status-pill.estimate { color: #664500; background: #fff2cf; font-size: .875rem; max-width: 100%; }
.estimate-details { grid-column: 1 / -1; min-width: 0; color: var(--muted); font-size: .875rem; line-height: 1.5; }
.estimate-details summary { cursor: pointer; width: fit-content; padding: 5px 0; }
.estimate-details p { margin: 5px 0; overflow-wrap: anywhere; }
.order-pill { color: #406f99; background: var(--blue-soft); }
.quick-use { min-width: 88px; justify-content: center; }
.row-actions { flex-wrap: nowrap; }
.mark-used-up { width: auto; padding: 0 9px; display: inline-flex; align-items: center; gap: 5px; color: var(--danger); font-size: 12px; font-weight: 600; white-space: nowrap; }
.mark-used-up:disabled { opacity: .45; cursor: not-allowed; }
.family-summary { padding: 18px 20px; display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.family-summary .item-title strong { font-size: 15px; }
.family-details { padding: 0 20px 14px; }
.family-details summary { color: var(--green); font-size: 13px; font-weight: 600; cursor: pointer; width: fit-content; }
.family-details p { color: var(--muted); font-size: 12px; margin: 8px 0 0; }
.family-detail-controls { display: flex; align-items: end; flex-wrap: wrap; gap: 12px 20px; padding: 9px 0 2px; }
.family-category-control { display: grid; gap: 5px; min-width: 190px; color: var(--muted); font-size: 12px; font-weight: 600; }
.family-category-control select { border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--ink); padding: 8px 10px; font: inherit; font-size: 13px; max-width: 240px; }
.family-detail-controls p { margin: 0 0 7px; }
.conversion-preview { color: var(--green); background: var(--green-soft); border-radius: 8px; padding: 9px 11px; margin: 0; font-size: 13px; font-weight: 700; }
.variant-accordion[open] { padding-bottom: 0; }
.variant-accordion .variant-row { margin: 11px -20px 0; }
.variant-accordion .variant-row + .variant-row { margin-top: 0; }
.inline-orders, .lot-list { grid-column: 1 / -1; display: grid; gap: 6px; margin-top: 7px; }
.inline-order { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; background: #f2f7fa; border: 1px solid #dce9f2; border-radius: 9px; padding: 7px 9px; font-size: 12px; }
.inline-order span { flex: 1; min-width: 180px; color: #3d617a; font-weight: 600; }
.inline-order button { border: 0; border-radius: 7px; background: white; color: var(--green); padding: 6px 9px; cursor: pointer; font-size: 12px; font-weight: 600; }
.inline-order button:last-child { color: var(--danger); }
.lot-list { display: flex; flex-wrap: wrap; gap: 6px; }
.lot-list span { color: var(--amber); background: var(--amber-soft); border-radius: 7px; padding: 5px 7px; font-size: 11px; }
.paste-panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 19px; box-shadow: var(--shadow); margin-bottom: 22px; display: grid; grid-template-columns: 1fr auto; gap: 13px; }
.paste-panel strong { font-size: 16px; }
.paste-panel p { color: var(--muted); font-size: 13px; line-height: 1.5; margin: 4px 0 0; }
.paste-panel textarea { grid-column: 1 / -1; min-height: 115px; font-size: 13px; white-space: pre; }
.paste-controls { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.paste-controls span { color: var(--muted); font-size: 13px; }
.order-tab b { margin-left: 5px; font-size: 11px; padding: 2px 7px; border-radius: 9px; background: #e6eae7; }
.order-card { grid-template-columns: minmax(230px, 1.5fr) minmax(110px, .7fr) minmax(100px, .6fr) minmax(120px, .7fr) auto; gap: 13px; }
.order-state { justify-self: end; }
.order-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.order-actions:empty { display: none; }
.order-actions .button { height: 36px; font-size: 12px; padding: 0 10px; }
.order-details { grid-column: 1 / -1; }
.order-main strong { white-space: normal; line-height: 1.35; }
.order-main span { overflow-wrap: anywhere; line-height: 1.4; }
.modal-description { color: var(--muted); font-size: 13px; line-height: 1.5; margin: 0 0 15px; }
#pasteDialog, #excelDialog { padding: 24px; }
#pasteDialog { width: min(900px, calc(100vw - 30px)); }
#pasteDialog .import-preview { min-width: 740px; }
#pasteDialog .modal-header, #excelDialog .modal-header { margin-bottom: 15px !important; }
.spaced-label { margin-top: 15px; }
.import-preview-wrap { margin-top: 12px; }
.import-footnote { margin-top: 12px; }

@media (max-width: 1300px) {
  .inventory-row, .variant-row { grid-template-columns: minmax(230px, 1.5fr) minmax(100px, .7fr) minmax(110px, .6fr) auto; }
  .inventory-row .meta-cell, .variant-row .meta-cell { display: none; }
  .order-card { grid-template-columns: minmax(230px, 1.5fr) minmax(100px, .6fr) minmax(100px, .6fr) auto; }
  .order-card .order-data:nth-of-type(4) { display: none; }
}
@media (max-width: 950px) {
  .notice-grid { grid-template-columns: 1fr; }
  .inventory-row, .variant-row { grid-template-columns: minmax(200px, 1fr) auto; gap: 9px; }
  .inventory-row .stock-cell, .variant-row .stock-cell { grid-column: 1; padding-left: 54px; }
  .inventory-row .status-cell, .variant-row .status-cell { grid-column: 1; padding-left: 54px; }
  .inventory-row .row-actions, .variant-row .row-actions { grid-column: 2; grid-row: 1 / span 3; align-self: center; }
  .order-card { grid-template-columns: 1fr auto; }
  .order-card .order-data { grid-column: 1; margin-left: 54px; }
  .order-card .order-state { grid-column: 2; grid-row: 1; }
  .order-card .order-actions { grid-column: 1 / -1; }
}
@media (max-width: 540px) {
  .page-heading { min-width: 0; }
  .topbar .header-actions { width: 100%; justify-content: flex-end; }
  .topbar .header-actions .button { width: auto; padding: 0 12px; }
  .topbar .header-actions .button span { display: inline; }
  .notice-grid .attention-card { flex-wrap: wrap; }
  .reminder-setting { margin-left: 49px; width: 150px; }
  .paste-panel { grid-template-columns: 1fr; }
  .paste-panel .button { justify-self: start; }
  .paste-controls { align-items: flex-start; flex-direction: column; }
  .filter-group { min-width: 0; }
  .inventory-row, .variant-row { padding: 14px; }
  .inventory-row .stock-cell, .variant-row .stock-cell, .inventory-row .status-cell, .variant-row .status-cell { padding-left: 0; }
  .item-avatar { display: none; }
  .inventory-row .row-actions, .variant-row .row-actions { grid-column: 1 / -1; grid-row: auto; flex-direction: row; justify-content: flex-start; flex-wrap: wrap; padding-top: 4px; }
  .quick-use { width: auto; min-width: 38px; }
  .quick-use span { display: inline; }
  .family-summary { padding: 15px; }
  .order-tabs { overflow-x: auto; white-space: nowrap; }
  .order-tab { flex: 0 0 auto; }
  .order-detail-grid { grid-template-columns: 1fr; }
}
body:not(.signed-in) .app-shell { display: none; }
body.signed-in .access-gate { display: none; }
.access-gate { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 20% 15%, #dcefe5, transparent 40%), #f5f6f2; }
.access-card { width: min(100%, 440px); background: #fff; border: 1px solid #dce6df; border-radius: 24px; padding: 34px; box-shadow: 0 20px 60px rgba(20, 55, 42, .1); }
.access-brand { display: flex; align-items: center; gap: 12px; color: #17382d; font-size: 20px; margin-bottom: 25px; }
.access-language { display: flex; align-items: center; gap: 8px; margin-bottom: 24px; }
.access-language select { border: 1px solid #d8e2da; border-radius: 8px; padding: 8px; background: white; }
.access-card h1 { font-size: 28px; line-height: 1.2; margin: 0 0 10px; color: #17382d; }
.access-card h2 { font-size: 19px; margin-top: 24px; }
.access-card p { color: #597063; line-height: 1.5; }
.access-form { display: grid; gap: 15px; margin-top: 24px; }
.access-form label { display: grid; gap: 7px; color: #294c3e; font-weight: 600; }
.access-form input { width: 100%; padding: 12px 13px; border: 1px solid #cad9cf; border-radius: 10px; font: inherit; }
.access-form .button { justify-content: center; margin-top: 7px; }
.access-message { min-height: 1.5em; color: #9a332f !important; }
.setup-backup { display: grid; gap: 8px; margin: 16px 0; color: #294c3e; font-weight: 600; }
.setup-backup input { max-width: 100%; }
.sync-block { position: fixed; inset: 0; z-index: 9999; display: grid; place-items: center; padding: 22px; background: rgba(17, 35, 28, .38); }
.sync-block[hidden], .sync-card [hidden] { display: none !important; }
.sync-card { width: min(100%, 520px); border-radius: 18px; padding: 28px; background: white; box-shadow: 0 18px 55px rgba(0, 0, 0, .18); text-align: center; }
.sync-card p { line-height: 1.5; }
#syncActions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }

/* Keep search, filters and stock actions readable at ordinary laptop widths. */
.toolbar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(190px, 230px); align-items: end; }
.search-box, .category-picker { min-width: 0; }
.filter-group { grid-column: 1 / -1; display: flex; flex-wrap: wrap; width: auto; overflow: visible; }
.filter-chip { white-space: nowrap; }
.item-location { color: var(--green-dark) !important; font-weight: 600; }
.item-title .item-spec { color: #355e8a; font-size: 14px; line-height: 1.45; }
.item-spec a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.action-label { display: none; }
.invite-link-panel { margin-top: 12px; padding: 13px; border: 1px solid #cfe3d8; border-radius: 11px; background: #f4faf6; }
.invite-link-panel input { font-size: 13px; }
.invite-link-panel p { margin: 9px 0; font-size: 13px; line-height: 1.45; }
#inviteDialog .modal-actions { flex-wrap: wrap; }

@media (max-width: 1300px) {
  .inventory-row, .variant-row { grid-template-columns: minmax(0, 1fr) minmax(105px, 140px) minmax(130px, 180px); }
  .inventory-row > *, .variant-row > * { min-width: 0; }
  .inventory-row .status-cell, .variant-row .status-cell { display: flex; }
  .inventory-row .row-actions, .variant-row .row-actions { grid-column: 1 / -1; justify-content: flex-start; flex-wrap: wrap; }
  .stock-cell { overflow-wrap: anywhere; }
}
@media (max-width: 950px) {
  .inventory-row, .variant-row { grid-template-columns: minmax(0, 1fr) auto; }
  .inventory-row .row-actions, .variant-row .row-actions { grid-column: 2; grid-row: 1 / span 3; align-self: center; }
}
@media (max-width: 540px) {
  .toolbar { grid-template-columns: minmax(0, 1fr); }
  .filter-group { grid-column: 1; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 3px; }
  .inventory-row .row-actions, .variant-row .row-actions { grid-column: 1 / -1; grid-row: auto; }
}
@media (min-width: 951px) and (max-width: 1300px), (max-width: 540px) {
  .labeled-action { width: auto; padding: 0 10px; display: inline-flex; align-items: center; gap: 6px; }
  .action-label { display: inline; font-size: 12px; font-weight: 600; white-space: nowrap; }
}

/* Inventory usability audit: keep counters readable and make grouped stock explicit. */
.stat-card > div:last-child { min-width: 0; }
.stat-card span, .stat-card small { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.3; }
.group-stock { color: var(--green-dark); font-weight: 700; font-size: 13px; margin-top: 5px !important; }
.order-pack-preview { margin: 14px 0 0; }
body[data-view="orders"] .topbar .header-actions, body[data-view="activity"] .topbar .header-actions { display: none; }

@media (min-width: 1301px) {
  .inventory-row, .variant-row { grid-template-columns: minmax(0, 1.8fr) minmax(130px, .8fr) minmax(110px, .7fr) minmax(130px, .8fr); }
  .inventory-row .row-actions, .variant-row .row-actions { grid-column: 1 / -1; justify-content: flex-end; padding-top: 5px; }
  .labeled-action { width: auto; padding: 0 10px; display: inline-flex; align-items: center; gap: 6px; }
  .action-label { display: inline; font-size: 12px; font-weight: 600; white-space: nowrap; }
}

/* Inventory and purchase wayfinding. Keep these overrides after legacy layouts. */
.toolbar { grid-template-columns: minmax(220px, 1.5fr) minmax(160px, 1fr) minmax(160px, 1fr); }
.toolbar .search-box { align-self: end; }
.results-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 12px 18px; border-bottom: 1px solid var(--line); background: #fafbf9; }
.results-toolbar p { flex: 1 1 230px; color: #53645b; font-size: 12px; margin: 0; line-height: 1.5; }
.results-toolbar .text-button { margin: 0; min-height: 36px; }
.sort-picker, .density-picker { display: flex; align-items: center; gap: 7px; font-size: 12px; }
.sort-picker select, .density-picker select { width: auto; max-width: 190px; height: 36px; padding: 5px 8px; font-size: 12px; }
.location-picker { min-width: 0; }
.order-search { display: block; margin: 0 0 14px; }
.order-search input { background: white; border-color: var(--line); }
.order-results { padding: 0 0 14px; background: transparent; border: 0; }
.stat-card[data-stock-shortcut] { cursor: pointer; text-align: left; font: inherit; width: 100%; transition: border-color .15s; }
.stat-card[data-stock-shortcut]:hover { border-color: #8dbda4; }
.count-help { padding: 11px 15px; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); background: #fff; font-size: 12px; }
.count-help summary { cursor: pointer; line-height: 1.5; }
.count-help p { margin: 8px 0 0; line-height: 1.5; }
.notice-grid { align-items: start; }
.notice-grid .attention-card { margin-bottom: 0; padding: 11px 14px; }
.notice-grid { margin-bottom: 16px; }
.order-identity { margin-top: 13px; color: var(--green-dark); }
.form-error { color: var(--danger); background: var(--danger-soft); padding: 11px; border-radius: 9px; font-size: 13px; line-height: 1.5; }
.quick-use, .mini-action, .filter-chip, .inline-order button { min-height: 44px; }
.mini-action:disabled { opacity: .45; cursor: not-allowed; }
.inventory-list.compact .inventory-row, .inventory-list.compact .variant-row { padding-top: 9px; padding-bottom: 9px; }
.inventory-list.compact .family-summary { padding-top: 10px; padding-bottom: 10px; }
.inventory-list.compact .item-avatar { width: 32px; height: 32px; }
.inventory-list.compact .family-details { padding-bottom: 9px; }
@media (min-width: 541px) and (max-width: 950px) {
  .inventory-row, .variant-row { grid-template-columns: minmax(0, 1fr) auto; }
  .inventory-row .row-actions, .variant-row .row-actions { grid-column: 1 / -1; grid-row: auto; justify-content: flex-start; flex-wrap: wrap; }
  .labeled-action { width: auto; padding: 0 10px; display: inline-flex; align-items: center; gap: 6px; }
  .action-label { display: inline; font-size: 12px; font-weight: 600; }
}
@media (max-width: 1100px) {
  .toolbar { grid-template-columns: 1fr 1fr; }
  .toolbar .search-box { grid-column: 1 / -1; }
}
@media (max-width: 540px) {
  .toolbar { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding: 14px; }
  .toolbar .filter-group { grid-column: 1 / -1; }
  .results-toolbar { padding: 10px 14px; gap: 8px 10px; }
  .results-toolbar p { flex-basis: 100%; }
  .sort-picker, .density-picker { flex: 1; display: grid; gap: 4px; min-width: 0; }
  .sort-picker select, .density-picker select { width: 100%; max-width: none; height: 42px; }
  .stat-card { padding: 11px; gap: 0; }
  .stat-card .stat-icon { display: none; }
  .stat-card > div:last-child { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  .stat-card strong { font-size: 22px; }
  .stat-card small { font-size: 11px; }
  .notice-grid { gap: 9px; }
  .expiry-notice .attention-icon { display: none; }
  .expiry-notice p { display: none; }
  .expiry-notice .reminder-setting { margin-left: auto; width: 110px; }
  .order-results { padding: 0 0 14px; }
  .filter-chip { font-size: 12px; padding: 0 9px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
@media (max-width: 800px) {
  .sidebar { box-shadow: none; }
  body.menu-open .sidebar { box-shadow: 15px 0 40px rgba(0,0,0,.15); }
}
@media (max-width: 540px) {
  .topbar { display: grid; grid-template-columns: 42px minmax(0, 1fr); align-items: center; gap: 10px 12px; }
  .topbar > .menu-button { grid-column: 1; grid-row: 1; }
  .topbar > .page-heading { grid-column: 2; grid-row: 1; min-width: 0; }
  .topbar > .language-switch { grid-column: 1 / -1; grid-row: 2; margin-left: 0; justify-self: start; }
  .topbar > .header-actions { grid-column: 1 / -1; grid-row: 3; width: 100%; justify-content: stretch; }
  .topbar .header-actions .secondary { display: inline-flex; }
  .topbar .header-actions .button { flex: 1; min-width: 0; padding: 0 8px; font-size: 12px; }
  .topbar .header-actions .button svg { flex: 0 0 auto; width: 16px; }
  .filter-group { flex-wrap: wrap; overflow: visible; }
  .filter-chip { white-space: normal; text-align: left; }
  .order-tabs { flex-wrap: wrap; overflow: visible; white-space: normal; gap: 6px; border-bottom: 0; }
  .order-tab { flex: 1 1 calc(50% - 6px); padding: 9px 6px; border: 1px solid var(--line); border-radius: 9px; text-align: center; }
  .order-tab.active { border-color: #aacfb9; background: var(--green-soft); }
}
:root { --in-use-ink: #176454; --in-use-bg: #edf8f3; }
.stock-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.stock-inline > strong { font-size: 15px; color: #243b32; overflow-wrap: anywhere; }
.in-use-tag { font-size: 13px; line-height: 1.4; color: var(--in-use-ink); background: var(--in-use-bg); border-radius: 6px; padding: 2px 6px; white-space: nowrap; }
.in-use-tag.inactive { color: var(--muted); background: #f0f2f0; }
.stock-baseline { display: block; font-size: 11px; color: #607068; margin-top: 6px; max-width: 180px; }
.status-pill.in-use, .open-one { color: var(--in-use-ink); background: var(--in-use-bg); }
.mini-action.open-one { width: auto; padding: 0 12px; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; color: var(--in-use-ink); background: var(--in-use-bg); }
.tracking-option { display: flex !important; align-items: center; gap: 9px; }
.tracking-option input[type="checkbox"] { width: 18px; min-height: 18px; height: 18px; flex-shrink: 0; }
/* Installed/mobile navigation and local label recognition. */
.mobile-nav { display:none; }
.mobile-dialog-body { padding:24px; }
.install-entry { margin-top:18px; width:100%; }
.install-group { border-top:1px solid var(--border,#e1e6df); margin-top:18px; padding-top:12px; }
.install-group summary { cursor:pointer; color:#203f34; font-size:15px; font-weight:700; min-height:34px; }
.install-group summary:focus-visible { outline:3px solid #519276; outline-offset:3px; border-radius:4px; }
.install-platform { margin:12px 0 0 14px; padding:0 0 8px 0; }
.install-platform h3 { font-size:15px; margin:0 0 8px; }
.install-platform p,.mobile-note { color:#5d6d64; font-size:13px; line-height:1.65; }
.offline-banner { position:fixed; top:0; left:0; right:0; background:#7b4107; color:white; padding:12px 20px; text-align:center; z-index:10000; font-size:14px; }
.offline-banner[hidden] { display:none; }
.is-offline .app-shell { opacity:.65; }
.scan-inputs { display:flex; gap:10px; flex-wrap:wrap; }
.scan-inputs label { position:relative; cursor:pointer; min-height:44px; }
.scan-inputs input { position:absolute; opacity:0; width:100%; height:100%; inset:0; cursor:pointer; }
.scan-inputs label:focus-within { outline:3px solid #519276; outline-offset:3px; }
.scan-preview { width:100%; max-height:200px; object-fit:contain; background:#eff2ed; border-radius:12px; margin-top:16px; }
.scan-text-label { display:grid; gap:8px; margin:16px 0 12px; font-size:13px; }
.scan-text-label textarea { width:100%; resize:vertical; }
.scan-matches { display:grid; gap:10px; margin:16px 0; }
.scan-match { border:1px solid #dce4dc; border-radius:12px; padding:16px; overflow-wrap:anywhere; }
.scan-match h3 { font-size:15px; margin:0 0 6px; }
.scan-match p { font-size:12px; line-height:1.6; color:#5d6d64; }
.scan-match .button { margin:4px 5px 4px 0; white-space:normal; text-align:left; }
#scanNewBtn { max-width:100%; height:auto; min-height:44px; padding:10px 12px; white-space:normal; text-align:left; }
.pack-breakdown { margin:8px 0; color:#5d6d64; font-size:12px; line-height:1.6; }
.pack-breakdown summary { cursor:pointer; }
.pack-review { display:block; font-size:12px; color:#856326; margin-top:6px; }
@media(max-width:800px) {
  .main { padding-bottom:calc(112px + env(safe-area-inset-bottom)); }
  .mobile-nav { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); position:fixed; left:0; right:0; bottom:0; z-index:20; padding:8px 6px calc(8px + env(safe-area-inset-bottom)); background:#fff; border-top:1px solid #dce4dc; box-shadow:0 -4px 18px #17382d08; }
  .mobile-nav .nav-item { display:flex; flex-direction:column; justify-content:center; gap:4px; min-height:48px; padding:5px 3px; font-size:12px; border-radius:10px; color:#36564b; }
  .mobile-nav .nav-item.active { color:#17382d; }
  .mobile-nav .nav-item:hover { color:#17382d; background:#eef5f0; }
  .mobile-nav .nav-item svg { width:20px; height:20px; }
  .mobile-nav .scan-nav { color:#17382d; background:#e6f2eb; }
  .topbar .header-actions .desktop-scan { display:none; }
  .toast { bottom:calc(88px + env(safe-area-inset-bottom)); }
  .modal { max-height:calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
  input,select,textarea { font-size:16px !important; }
  .mobile-dialog-body { padding:20px; }
  .topbar { padding-top:env(safe-area-inset-top); }
}
