/* Work Orders — Lot Audit view (work-orders-lot.js). Hub dark theme tokens from
   hub.css :root; every class is prefixed woml-. Status colours are always paired
   with an icon and a word (✔ FOUND / ✖ NOT FOUND / — N/A / ⚠ NO WORK ORDER FOUND). */

.woml, .woml-form, .woml-ovl {
  --woml-surface: #181818;
  --woml-ok: #7fd36f;
  --woml-ok-bg: rgba(74, 154, 58, 0.16);
  --woml-ok-bd: #4a9a3a;
  --woml-bad: #ff8f8f;
  --woml-bad-bg: rgba(239, 68, 68, 0.14);
  --woml-bad-bd: #ef4444;
  --woml-na: #bcc6d2;
  --woml-na-bg: rgba(148, 163, 184, 0.14);
  --woml-na-bd: #64748b;
  --woml-warn: #fcd34d;
  --woml-warn-bg: rgba(245, 158, 11, 0.14);
  --woml-warn-bd: #f59e0b;
  --woml-mono: ui-monospace, 'SFMono-Regular', Menlo, Consolas, 'Liberation Mono', 'Courier New', monospace;
}

.woml { display: flex; flex-direction: column; width: 100%; min-width: 0; }

/* ui-core mounts this view inside its own .panel (the work-orders list panel):
   there, flatten our sections into one surface with separators so panels never nest. */
.panel .woml > div > .panel {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  margin: 0;
}
.panel .woml > div:not(:first-child) > .panel {
  border-top: 1px solid var(--border);
  margin-top: 24px;
  padding-top: 22px;
}
.panel .woml > div:first-child > .panel { margin-top: 6px; }
.woml [hidden], .woml-form [hidden] { display: none !important; }
.woml-sr { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.woml-small { font-size: 0.82rem; line-height: 1.45; }
.woml-loading { min-height: 120px; }

.woml button:focus-visible, .woml input:focus-visible, .woml select:focus-visible, .woml textarea:focus-visible,
.woml-form button:focus-visible, .woml-form input:focus-visible, .woml-form select:focus-visible, .woml-form textarea:focus-visible {
  outline: 2px solid var(--jd-yellow);
  outline-offset: 2px;
}

/* Smaller variants of the Hub buttons for toolbars */
.btn-primary.woml-sm, .btn-secondary.woml-sm {
  padding: 8px 14px;
  font-size: 0.86rem;
  border-radius: 8px;
  min-height: 40px;
  line-height: 1.2;
}
.btn-secondary.woml-danger-txt { color: var(--woml-bad, #ff8f8f); border-color: rgba(239, 68, 68, 0.45); }
.btn-secondary.woml-danger-txt:hover { background: rgba(239, 68, 68, 0.1); color: #ffb3b3; }

/* ---------------------------------------------------------------- intro */
.woml-intro-row { display: flex; gap: 18px 24px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.woml-purpose { flex: 1 1 380px; color: var(--text-muted); line-height: 1.6; font-size: 0.92rem; max-width: 760px; }
.woml-purpose b { color: var(--text-primary); }
.woml-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.woml-actions .btn-primary, .woml-actions .btn-secondary { padding: 11px 18px; font-size: 0.95rem; min-height: 44px; }
.woml-actions .btn-secondary { color: var(--text-primary); }

.woml-counts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.woml-count {
  background: var(--woml-surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--jd-green);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.woml-count.is-missing { border-top-color: var(--woml-bad-bd); }
.woml-count.is-nowo { border-top-color: var(--woml-warn-bd); }
.woml-count-n { font-size: 1.7rem; font-weight: 800; color: var(--jd-yellow); line-height: 1.1; font-variant-numeric: tabular-nums; }
.woml-count.is-missing .woml-count-n { color: var(--woml-bad); }
.woml-count.is-nowo .woml-count-n { color: var(--woml-warn); }
.woml-count-l { font-size: 0.8rem; color: var(--text-muted); }

.woml-err {
  margin-top: 14px;
  padding: 10px 12px;
  border: 1px solid var(--woml-warn-bd);
  background: var(--woml-warn-bg);
  color: var(--woml-warn);
  border-radius: 8px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 0.88rem;
}

/* ---------------------------------------------------------------- badges */
.woml-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  white-space: nowrap;
  line-height: 1.4;
  color: var(--text-muted);
}
.woml-b-found { color: var(--woml-ok); background: var(--woml-ok-bg); border-color: var(--woml-ok-bd); }
.woml-b-missing { color: var(--woml-bad); background: var(--woml-bad-bg); border-color: var(--woml-bad-bd); }
.woml-b-na { color: var(--woml-na); background: var(--woml-na-bg); border-color: var(--woml-na-bd); }
.woml-b-nowo { color: var(--woml-warn); background: var(--woml-warn-bg); border-color: var(--woml-warn-bd); }
.woml-b-live { color: var(--jd-yellow); background: rgba(255, 222, 0, 0.08); border-color: rgba(255, 222, 0, 0.5); }
.woml-b-none { color: var(--text-muted); background: transparent; }
.woml-pill {
  display: inline-block;
  min-width: 26px;
  padding: 1px 8px;
  border-radius: 999px;
  background: #2b2b2b;
  border: 1px solid var(--border);
  font-size: 0.78rem;
  text-align: center;
  color: var(--text-primary);
  margin-left: 4px;
  vertical-align: 2px;
}

/* ---------------------------------------------------------------- audit section */
.panel h2 .woml-badge { vertical-align: 3px; margin-left: 6px; }
.woml-audit-head { display: flex; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; align-items: flex-start; margin-bottom: 14px; }
.woml-audit-head h2 { margin-bottom: 4px; padding-bottom: 0; border-bottom: 0; }
.woml-audit-head .muted { line-height: 1.5; }
.woml-audit-tools { display: flex; gap: 8px; flex-wrap: wrap; }

/* Sticky progress: spans the panel width (panel padding is 32px on desktop). */
.woml-sticky {
  position: sticky;
  top: 0;
  z-index: 6;
  background: var(--bg-card);
  margin: 0 -32px 12px;
  padding: 10px 32px 10px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 8px 12px -10px rgba(0, 0, 0, 0.9);
}
.woml-progress-line { display: flex; justify-content: space-between; gap: 10px; font-size: 0.9rem; margin-bottom: 6px; }
.woml-progress-line b { color: var(--jd-yellow); font-variant-numeric: tabular-nums; }
.woml-bar { height: 10px; background: #2a2a2a; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.woml-bar > div { height: 100%; background: linear-gradient(90deg, var(--jd-green), var(--jd-green-light)); transition: width 0.25s ease; }
.woml-tally { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; font-size: 0.82rem; color: var(--text-muted); }
.woml-t b { color: var(--text-primary); font-variant-numeric: tabular-nums; }
.woml-t.found b { color: var(--woml-ok); }
.woml-t.missing b { color: var(--woml-bad); }
.woml-t.na b { color: var(--woml-na); }
.woml-t.nowo b { color: var(--woml-warn); }

.woml-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.woml-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.woml-chip {
  min-height: 44px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
.woml-chip b { color: var(--text-primary); margin-left: 3px; font-variant-numeric: tabular-nums; }
.woml-chip:hover { background: rgba(255, 255, 255, 0.05); color: var(--text-primary); }
.woml-chip.is-on { background: var(--jd-green-dark); border-color: var(--jd-green-light); color: #fff; }
.woml-chip.is-on b { color: #fff; }
.woml-search-in {
  flex: 1 1 260px;
  min-width: 0;
  min-height: 44px;
  background: var(--bg-input);
  border: 2px solid var(--border-green);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text-primary);
  font: inherit;
  font-size: 1rem; /* >= 16px keeps iOS from zooming */
}

.woml-items { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.woml-empty { color: var(--text-muted); padding: 16px; border: 1px dashed var(--border); border-radius: 10px; text-align: center; line-height: 1.5; }

/* ---------------------------------------------------------------- cards */
.woml-card {
  background: var(--woml-surface);
  border: 1px solid var(--border);
  border-left: 5px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.woml-card.woml-s-found { border-left-color: var(--woml-ok-bd); }
.woml-card.woml-s-missing { border-left-color: var(--woml-bad-bd); }
.woml-card.woml-s-na { border-left-color: var(--woml-na-bd); }
.woml-card.woml-s-nowo { border-left-color: var(--woml-warn-bd); }
.woml-card.woml-s-resolved { border-left-color: var(--woml-ok-bd); opacity: 0.92; }
.woml-card.is-busy { opacity: 0.8; }
.woml-card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px 10px; flex-wrap: wrap; }
.woml-wo {
  background: none;
  border: 0;
  padding: 4px 0;
  min-height: 36px;
  color: var(--jd-yellow);
  font: inherit;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: rgba(255, 222, 0, 0.35);
  text-underline-offset: 3px;
}
.woml-wo:hover { text-decoration-color: var(--jd-yellow); }
.woml-wo.woml-wo-sm { font-size: 0.95rem; min-height: 0; padding: 0; }
.woml-cust { font-weight: 700; font-size: 1rem; overflow-wrap: anywhere; }
.woml-mach { font-size: 0.95rem; overflow-wrap: anywhere; }
.woml-mm { color: var(--text-muted); }
.woml-mach .woml-mm::before { content: '· '; }
.woml-line { font-size: 0.9rem; display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; overflow-wrap: anywhere; }
.woml-lbl { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); font-weight: 700; }
.woml-serial {
  font-family: var(--woml-mono);
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #fff;
  word-break: break-all;
}
.woml-serial-xl {
  font-size: 1.35rem;
  display: inline-block;
  background: #0d0d0d;
  border: 1px dashed #555;
  border-radius: 6px;
  padding: 4px 10px;
}
.woml-checked { font-size: 0.8rem; color: var(--text-muted); line-height: 1.45; }
.woml-note {
  font-size: 0.86rem;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 6px;
  padding: 6px 8px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.45;
}
.woml-missing {
  border: 1px solid var(--woml-bad-bd);
  background: var(--woml-bad-bg);
  color: var(--woml-bad);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
}
.woml-saving { font-size: 0.8rem; color: var(--jd-yellow); }

/* Big result buttons: >= 48px tall, readable without colour. */
.woml-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.woml-btn {
  flex: 1 1 96px;
  min-height: 48px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 2px solid var(--border);
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  touch-action: manipulation;
}
.woml-btn:disabled { opacity: 0.5; cursor: progress; }
.woml-btn-found { border-color: var(--woml-ok-bd); color: var(--woml-ok); }
.woml-btn-found:hover { background: var(--woml-ok-bg); }
.woml-btn-found[aria-pressed="true"] { background: var(--jd-green); border-color: var(--jd-green-light); color: #fff; }
.woml-btn-missing { border-color: var(--woml-bad-bd); color: var(--woml-bad); }
.woml-btn-missing:hover { background: var(--woml-bad-bg); }
.woml-btn-missing[aria-pressed="true"], .woml-btn-missing.is-solid { background: #b91c1c; border-color: #ef4444; color: #fff; }
.woml-btn-na { border-color: var(--woml-na-bd); color: var(--woml-na); }
.woml-btn-na:hover { background: var(--woml-na-bg); }
.woml-btn-na[aria-pressed="true"], .woml-btn-na.is-solid { background: #475569; border-color: #94a3b8; color: #fff; }
.woml-btn-undo { flex: 0 1 auto; color: var(--text-muted); font-weight: 600; }
.woml-btn-undo:hover { background: rgba(255, 255, 255, 0.05); color: var(--text-primary); }
.woml-btn-resolve { border-color: var(--woml-warn-bd); color: var(--woml-warn); }
.woml-btn-resolve:hover { background: var(--woml-warn-bg); }

/* Inline FOUND / NOT FOUND / N/A panel */
.woml-panel {
  margin-top: 8px;
  padding: 12px;
  border-radius: 8px;
  background: #121212;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.woml-panel-missing { border-color: var(--woml-bad-bd); }
.woml-panel p { margin: 0; }
.woml-compare { font-size: 0.85rem; color: var(--text-muted); display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.woml-panel-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.woml-panel-actions > button { flex: 1 1 140px; min-height: 48px; padding: 10px 16px; font-size: 1rem; }

/* ---------------------------------------------------------------- forms (cards + modals) */
.woml-form { display: flex; flex-direction: column; gap: 12px; color: var(--text-primary); text-align: left; }
.woml-form p { margin: 0; line-height: 1.5; }
.woml-check { display: flex; gap: 10px; align-items: flex-start; min-height: 44px; padding: 6px 0; cursor: pointer; font-size: 0.95rem; line-height: 1.4; }
.woml-check input { width: 22px; height: 22px; margin: 0; flex: none; accent-color: var(--jd-green); cursor: pointer; }
.woml-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.woml-field input, .woml-field select, .woml-field textarea {
  font: inherit;
  font-size: 1rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  width: 100%;
  min-height: 44px;
  background: var(--bg-input);
  border: 2px solid var(--border-green);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text-primary);
}
.woml-field textarea { resize: vertical; min-height: 64px; }
.woml-field input[type="file"] { padding: 8px; min-height: 0; }
.woml-field input:focus, .woml-field select:focus, .woml-field textarea:focus { border-color: var(--jd-green-light); box-shadow: 0 0 0 3px rgba(54, 124, 43, 0.2); outline: none; }
.woml-mono, .woml-field input.woml-mono { font-family: var(--woml-mono); letter-spacing: 0.05em; }
.woml-req { text-transform: none; color: var(--woml-warn); font-weight: 600; }
.woml-photo-prev { max-width: 180px; max-height: 180px; border-radius: 8px; border: 1px solid var(--border); object-fit: cover; }
.woml-sn-hint, .woml-wo-hint { color: var(--woml-warn); min-height: 0; }
.woml-sn-hint:empty, .woml-wo-hint:empty { display: none; }
.woml-mstatus { min-height: 1.2em; font-size: 0.88rem; color: var(--text-muted); }
.woml-mstatus:empty { min-height: 0; }
.woml-mstatus.is-err { color: var(--woml-bad); font-weight: 700; }
.woml-warn { color: var(--woml-warn); background: var(--woml-warn-bg); border: 1px solid var(--woml-warn-bd); border-radius: 8px; padding: 8px 10px; }
.woml-okline { color: var(--woml-ok); }

/* ---------------------------------------------------------------- summary grid */
.woml-sumgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 10px; margin: 6px 0 12px; }
.woml-sum {
  background: var(--woml-surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.woml-sum b { font-size: 1.45rem; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.woml-sum span { font-size: 0.75rem; color: var(--text-muted); }
.woml-sum.is-found b { color: var(--woml-ok); }
.woml-sum.is-missing b { color: var(--woml-bad); }
.woml-sum.is-na b { color: var(--woml-na); }
.woml-sum.is-nowo b { color: var(--woml-warn); }

/* ---------------------------------------------------------------- exceptions */
.woml-sub-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin: 22px 0 10px; }
.woml-sub-head h3, .woml-h3 { font-size: 1rem; font-weight: 700; color: var(--text-primary); margin: 10px 0 4px; }
.woml-sub-head h3 { margin: 0; }
.woml-exc-list, .woml-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin-top: 8px; }
.woml-exc-body { display: flex; gap: 12px; align-items: flex-start; }
.woml-exc-info { display: flex; flex-direction: column; gap: 5px; min-width: 0; flex: 1; }
.woml-thumb {
  flex: none;
  width: 88px;
  height: 88px;
  padding: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #0d0d0d;
  cursor: zoom-in;
}
.woml-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.woml-thumb.is-broken { cursor: default; }
.woml-thumb.is-broken img { display: none; }
.woml-thumb.is-broken::after { content: 'No photo'; display: flex; height: 100%; align-items: center; justify-content: center; font-size: 0.72rem; color: var(--text-muted); }
.woml-match {
  font-size: 0.86rem;
  border: 1px dashed var(--woml-warn-bd);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}
.woml-match > span { flex: 1 1 200px; min-width: 0; overflow-wrap: anywhere; }

/* + MACHINE NOT ON LIST: a sticky bar at the bottom of the screen on phones. */
.woml-fab-wrap { display: none; }
.woml-fab {
  width: 100%;
  min-height: 54px;
  border-radius: 12px;
  border: 2px solid #c9b000;
  background: var(--jd-yellow);
  color: #111;
  font: inherit;
  font-size: 1.02rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
  cursor: pointer;
  touch-action: manipulation;
}
.woml-audit-foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.woml-audit-foot > button { min-height: 48px; }

/* ---------------------------------------------------------------- open exceptions + history */
.woml-open-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 28px; }
.woml-open .woml-empty { margin-top: 8px; }
/* width 0 + min-width 100%: a wide table scrolls inside its wrapper instead of
   widening Hub's .content flex item (whose min-width is auto). */
.woml-table-wrap { position: relative; width: 0; min-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.woml-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.woml-table th {
  text-align: left;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 8px 10px;
  border-bottom: 2px solid var(--border);
  vertical-align: bottom;
}
.woml-table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.woml-table tbody tr:hover td { background: rgba(54, 124, 43, 0.06); }
.woml-num { text-align: right; font-variant-numeric: tabular-nums; }
.woml-table-hist th:nth-child(n+5):nth-child(-n+10) { text-align: right; }
.woml-row-acts { text-align: right; }
.woml-row-acts .btn-secondary { margin: 0 0 4px 4px; white-space: nowrap; }
.woml-view .woml-table td .btn-secondary.woml-sm { margin-top: 6px; }

/* ---------------------------------------------------------------- fallback modal (only if WO.modal is missing) */
.woml-ovl {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 1100;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.woml-dlg {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 560px;
  max-width: 100%;
  max-height: 92vh;
  overflow: auto;
  padding: 20px;
  color: var(--text-primary);
}
.woml-dlg-wide { width: 1100px; }
.woml-dlg-title { font-weight: 800; color: var(--jd-yellow); font-size: 1.1rem; margin-bottom: 12px; }
.woml-dlg-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 16px; }
.woml-dlg-actions > button { padding: 11px 18px; min-height: 44px; font-size: 0.95rem; }
.btn-primary.woml-btn-danger { background: #b91c1c; border-color: #ef4444; }

/* ---------------------------------------------------------------- responsive */
@media (min-width: 1180px) {
  .woml-items { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .woml-audit .woml-exc-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1000px) {
  .woml-open-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 768px) {
  .woml .panel { padding: 16px 14px; }
  .woml .panel h2 { margin-bottom: 12px; }
  /* Below the Hub's fixed mobile header */
  .woml-sticky { top: var(--header-h, 56px); margin: 0 -14px 12px; padding: 8px 14px; }
  .woml-desk { display: none !important; }
  .woml-fab-wrap {
    display: block;
    position: sticky;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    z-index: 7;
    margin-top: 16px;
  }
  .woml-actions { width: 100%; }
  .woml-actions > button { flex: 1 1 140px; }
  .woml-audit-tools { width: 100%; }
  .woml-audit-foot > button { flex: 1 1 140px; }
  .woml-audit-tools > button { flex: 1 1 auto; }
  .woml-search-in { flex-basis: 100%; }
  .woml-card { padding: 12px 12px 12px; }
  /* FOUND / NOT FOUND / N/A fit on one row on a 360 px phone */
  .woml-btns { gap: 6px; }
  .woml-serial-xl { font-size: 1.12rem; letter-spacing: 0.03em; padding: 4px 8px; }
  .woml-btn { flex: 1 1 auto; font-size: 0.88rem; padding: 8px 4px; letter-spacing: 0; }
  .woml-btn-undo { flex: 0 1 auto; padding: 8px 12px; }
  .woml-chips { width: 100%; }
  .woml-chip { flex: 1 1 auto; padding: 8px 10px; }

  /* Tables become stacked cards */
  .woml-table thead { display: none; }
  .woml-table, .woml-table tbody, .woml-table tr, .woml-table td { display: block; width: 100%; }
  .woml-table tr { border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; background: var(--woml-surface); }
  .woml-table tbody tr:hover td { background: transparent; }
  .woml-table td { border: 0; padding: 5px 0; display: flex; justify-content: space-between; align-items: baseline; gap: 12px; text-align: right; }
  .woml-table td::before {
    content: attr(data-label);
    flex: none;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: left;
  }
  .woml-table td.woml-row-acts { justify-content: flex-end; padding-top: 8px; }
  .woml-table td.woml-row-acts::before { content: none; }
  .woml-table-items td { flex-wrap: wrap; }
}

@media (max-width: 480px) {
  .woml-counts { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .woml-count { flex-direction: row; align-items: baseline; gap: 10px; padding: 10px 12px; }
  .woml-count-n { font-size: 1.4rem; min-width: 2ch; }
  .woml-wo { font-size: 1.25rem; }
  .woml-exc-body { flex-direction: column; align-items: stretch; }
  .woml-thumb { width: 100%; height: 180px; }
}

@media (prefers-reduced-motion: reduce) {
  .woml-bar > div, .woml-btn { transition: none; }
}
