/* Work Orders tab (public/work-orders.js). Every class is prefixed wom-.
   Uses the Hub tokens from hub.css :root. Colors always come with text or an
   icon (red = overdue / critical / attention, amber = approaching / priority /
   uncertain, green = current / parts in / completed). */

:root {
  --wom-red: #f87171;
  --wom-red-bg: rgba(239, 68, 68, 0.14);
  --wom-red-bd: rgba(239, 68, 68, 0.55);
  --wom-amber: #fbbf24;
  --wom-amber-bg: rgba(245, 158, 11, 0.14);
  --wom-amber-bd: rgba(245, 158, 11, 0.6);
  --wom-green: #4ade80;
  --wom-green-bg: rgba(74, 222, 128, 0.12);
  --wom-green-bd: rgba(74, 222, 128, 0.5);
  --wom-blue: #93c5fd;
  --wom-blue-bg: rgba(96, 165, 250, 0.14);
  --wom-blue-bd: rgba(96, 165, 250, 0.5);
  --wom-row-line: #2a2a2a;
  --wom-head-bg: #242424;
}

.wom [hidden], .wom-overlay [hidden], .wom-pop [hidden] { display: none !important; }
.wom { width: 100%; min-width: 0; }
.wom-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.wom-grow { flex: 1 1 auto; }
.wom-help { font-size: 0.78rem; line-height: 1.4; margin-top: 4px; }
.wom-t-red { color: var(--wom-red); }
.wom-t-amber { color: var(--wom-amber); }
.wom-t-green { color: var(--wom-green); }

/* Visible keyboard focus everywhere in the module */
.wom :focus-visible, .wom-overlay :focus-visible, .wom-pop :focus-visible {
  outline: 2px solid var(--jd-yellow);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------- header */
.wom-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.wom-head-main { min-width: 0; }
.wom-title { margin-bottom: 4px; }
.wom-lastimport { font-size: 0.82rem; }
.wom-lastimport b { color: var(--text-primary); font-weight: 600; }
.wom-head-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.wom-btn { padding: 9px 16px; font-size: 0.88rem; border-radius: 8px; white-space: nowrap; }
.btn-secondary.wom-btn { color: var(--text-primary); }
.btn-secondary.wom-btn:disabled, .btn-primary.wom-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.wom-btn-danger { border-color: var(--wom-red-bd) !important; color: var(--wom-red) !important; }
.wom-btn-danger:hover:not(:disabled) { background: var(--wom-red-bg) !important; }

.wom-btn-sm {
  display: inline-flex; align-items: center; gap: 4px;
  background: #262626; color: var(--text-primary); border: 1px solid var(--border);
  border-radius: 6px; padding: 5px 10px; font: inherit; font-size: 0.78rem; font-weight: 600;
  cursor: pointer; white-space: nowrap; transition: background 0.15s, border-color 0.15s;
}
.wom-btn-sm:hover:not(:disabled) { background: #2f2f2f; border-color: #4a4a4a; }
.wom-btn-sm:disabled { opacity: 0.5; cursor: not-allowed; }
.wom-btn-go { background: var(--jd-green); border-color: var(--jd-green-light); color: #fff; }
.wom-btn-go:hover:not(:disabled) { background: var(--jd-green-light); border-color: var(--jd-green-light); }
.wom-link { background: none; border: none; color: var(--jd-yellow); font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; padding: 0; }

/* ---------------------------------------------------------------- banners & alerts */
.wom-banner { margin-bottom: 14px; }
.wom-alert { border-radius: 8px; padding: 10px 14px; margin: 10px 0; font-size: 0.85rem; line-height: 1.45; border: 1px solid var(--border); background: #1a1a1a; }
.wom-alert-err { border-color: var(--wom-red-bd); background: var(--wom-red-bg); color: #fecaca; }
.wom-alert-warn { border-color: var(--wom-amber-bd); background: var(--wom-amber-bg); color: #fde68a; }
.wom-alert-info { border-color: var(--wom-blue-bd); background: var(--wom-blue-bg); color: #dbeafe; }
.wom-alert .wom-btn-sm { margin-left: 6px; }

/* ---------------------------------------------------------------- upload */
.wom-upload-intro { margin: -8px 0 12px !important; }
.wom-drop {
  border: 2px dashed var(--border-green); border-radius: 10px; background: rgba(26, 46, 26, 0.45);
  padding: 22px 16px; text-align: center; cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.wom-drop:hover { border-color: var(--jd-green-light); background: rgba(54, 124, 43, 0.12); }
.wom-drop .wom-help { margin: 4px 0 0; }
.wom-drop-icon { font-size: 1.8rem; line-height: 1; margin-bottom: 6px; }
.wom-drop-busy { opacity: 0.55; cursor: progress; }
.wom-upload.wom-drag .wom-drop { border-color: var(--jd-yellow); background: rgba(255, 222, 0, 0.08); }
.wom-upload.wom-drag { border-color: var(--jd-yellow); }

.wom-thumbs { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.wom-thumb {
  position: relative; width: 140px; margin: 0; background: #181818; border: 1px solid var(--border);
  border-radius: 8px; overflow: hidden; display: flex; flex-direction: column;
}
.wom-thumb-img { display: block; width: 100%; height: 92px; padding: 0; border: none; background: #0d0d0d; cursor: zoom-in; }
.wom-thumb-img img { width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block; }
.wom-thumb figcaption { padding: 5px 7px; font-size: 0.7rem; line-height: 1.3; display: flex; flex-direction: column; min-width: 0; }
.wom-thumb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-primary); }
.wom-thumb-x {
  position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3); background: rgba(0, 0, 0, 0.75); color: #fff;
  font-size: 0.75rem; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.wom-thumb-x:hover { background: #b91c1c; }
.wom-thumb-state {
  position: absolute; top: 4px; left: 4px; min-width: 24px; height: 24px; padding: 0 5px; border-radius: 12px;
  background: rgba(0, 0, 0, 0.78); font-size: 0.8rem; display: flex; align-items: center; justify-content: center;
}
.wom-thumb-failed { border-color: var(--wom-red-bd); }
.wom-thumb-done { border-color: var(--wom-green-bd); }
.wom-thumb-uploading, .wom-thumb-reading { border-color: var(--wom-blue-bd); }
.wom-thumb-prep { width: 140px; min-height: 92px; align-items: center; justify-content: center; color: var(--text-muted); font-size: 0.8rem; }

.wom-upload-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }
.wom-upload-btns { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.wom-upload-btns .wom-help { margin: 0; }
.wom-check { display: inline-flex; align-items: center; gap: 8px; font-size: 0.85rem; cursor: pointer; }
.wom-check input { width: 16px; height: 16px; accent-color: var(--jd-green); }
.wom-check-off { cursor: not-allowed; color: var(--text-muted); }
.wom-full { display: flex; flex-direction: column; min-width: 0; max-width: 560px; }

.wom-progress { margin-top: 14px; padding: 12px 14px; border: 1px solid var(--wom-blue-bd); border-radius: 8px; background: var(--wom-blue-bg); }
.wom-progress-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; font-size: 0.88rem; }
.wom-bar { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.1); overflow: hidden; margin: 8px 0; }
.wom-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--jd-green), var(--jd-green-light)); transition: width 0.4s; }
.wom-progress-msg { font-size: 0.82rem; }
.wom-filestat { list-style: none; margin: 8px 0 0; padding: 0; font-size: 0.78rem; display: grid; gap: 3px; }

/* ---------------------------------------------------------------- summary cards */
/* 11 cards: narrow enough to sit on one row on a normal desktop. */
.wom-cards { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; margin-bottom: 20px; }
.wom-cards .stat-card.wom-stat {
  font: inherit; color: inherit; width: 100%; padding: 12px 8px 10px; border-top-width: 3px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
}
.wom-stat .stat-num, .wom-stat .stat-label { display: block; }
.wom-stat .stat-num { font-size: 1.6rem; line-height: 1.1; }
.wom-stat .stat-label { font-size: 0.74rem; line-height: 1.25; }
.wom-stat.wom-lvl-red { border-top-color: #ef4444; }
.wom-stat.wom-lvl-red:not(.wom-zero) .stat-num { color: var(--wom-red); }
.wom-stat.wom-lvl-amber { border-top-color: #f59e0b; }
.wom-stat.wom-lvl-amber:not(.wom-zero) .stat-num { color: var(--wom-amber); }
.wom-stat.wom-lvl-green { border-top-color: #22c55e; }
.wom-stat.wom-lvl-green:not(.wom-zero) .stat-num { color: var(--wom-green); }
.wom-stat.wom-lvl-blue { border-top-color: #60a5fa; }
.wom-stat.wom-lvl-blue:not(.wom-zero) .stat-num { color: var(--wom-blue); }
.wom-stat.wom-zero .stat-num { color: var(--text-muted); }
.wom-stat.wom-on { border-color: var(--jd-yellow); background: #262414; box-shadow: 0 0 0 1px var(--jd-yellow) inset; }

/* ---------------------------------------------------------------- view tabs + toolbar */
.wom-tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 14px; }
.wom-tab {
  background: none; border: none; border-bottom: 3px solid transparent; margin-bottom: -2px;
  color: var(--text-muted); font: inherit; font-size: 0.9rem; font-weight: 600; padding: 9px 12px; cursor: pointer;
}
.wom-tab:hover { color: var(--text-primary); }
.wom-tab-on { color: var(--jd-yellow); border-bottom-color: var(--jd-yellow); }
.wom-tab-n { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: #2b2b2b; color: var(--text-primary); font-size: 0.72rem; text-align: center; }
.wom-tab-on .wom-tab-n { background: rgba(255, 222, 0, 0.18); color: var(--jd-yellow); }

.wom-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.wom-input {
  background: var(--bg-input); border: 1px solid var(--border-green); border-radius: 6px;
  color: var(--text-primary); font: inherit; font-size: 0.85rem; padding: 7px 10px; min-width: 0; max-width: 100%;
}
.wom-input:focus { border-color: var(--jd-green-light); outline: none; box-shadow: 0 0 0 3px rgba(54, 124, 43, 0.25); }
.wom-input:disabled { opacity: 0.55; }
textarea.wom-input { width: 100%; resize: vertical; line-height: 1.4; }
.wom-input-on { border-color: var(--jd-yellow); }
.wom-search { flex: 1 1 260px; }
.wom-count { font-size: 0.8rem; margin-left: auto; }
.wom-more { margin: 0 0 10px; padding: 7px 12px; border-radius: 6px; background: var(--wom-blue-bg); border: 1px solid var(--wom-blue-bd); font-size: 0.82rem; }
.wom-empty { padding: 18px 4px; }

/* ---------------------------------------------------------------- tables */
/* width:0 + min-width:100% keeps a wide table from stretching the page: it
   scrolls inside its own box (the Hub's flex layout has no min-width: 0). */
.wom-table-wrap {
  width: 0; min-width: 100%; overflow: auto; max-height: calc(100vh - 170px);
  border: 1px solid var(--border); border-radius: 8px; background: #191919;
}
.wom-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 0.8rem; line-height: 1.35; }
.wom-table thead th {
  position: sticky; top: 0; z-index: 2; background: var(--wom-head-bg); color: var(--text-muted);
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
  text-align: left; padding: 8px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.wom-table td { padding: 6px 8px; border-bottom: 1px solid var(--wom-row-line); vertical-align: top; white-space: nowrap; }
.wom-table tbody tr:hover > td { background: rgba(255, 255, 255, 0.025); }
.wom-table tbody th { text-align: left; }
.wom-c-desc { white-space: normal !important; min-width: 180px; max-width: 280px; }
.wom-c-chg { white-space: normal !important; min-width: 200px; max-width: 320px; }
.wom-c-notes { white-space: normal !important; min-width: 150px; max-width: 240px; }
.wom-c-att { white-space: normal !important; min-width: 130px; max-width: 220px; }
.wom-c-num { text-align: right; font-variant-numeric: tabular-nums; }
.wom-c-serial { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 0.76rem; }
.wom-c-sel { width: 32px; text-align: center; }
.wom-c-sel input { width: 16px; height: 16px; accent-color: var(--jd-green); cursor: pointer; }

.wom-grp th {
  background: #151515; color: var(--jd-yellow); font-size: 0.8rem; font-weight: 700;
  padding: 9px 10px; border-bottom: 1px solid var(--border); border-top: 1px solid var(--border);
}
.wom-grp-b1 th, .wom-grp-b2 th, .wom-grp-h.wom-grp-b1, .wom-grp-h.wom-grp-b2 { color: var(--wom-red); }
.wom-row-critical > td:first-child { box-shadow: inset 3px 0 0 #ef4444; }
.wom-row-priority > td:first-child { box-shadow: inset 3px 0 0 #f59e0b; }
.wom-row-archived > td { opacity: 0.6; }

.wom-wo {
  background: none; border: none; padding: 1px 4px; margin: -1px -4px; border-radius: 4px;
  font: inherit; font-weight: 700; color: #fff; cursor: pointer; text-decoration: underline dotted rgba(255, 255, 255, 0.4);
  text-underline-offset: 3px; white-space: nowrap;
}
.wom-wo:hover { color: var(--jd-yellow); }
.wom-wo-po { background: rgba(34, 197, 94, 0.22); }
.wom-sub { font-size: 0.68rem; color: var(--text-muted); margin-top: 2px; white-space: nowrap; }

/* ---------------------------------------------------------------- badges */
.wom-badges { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.wom-b {
  display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border-radius: 999px;
  font-size: 0.72rem; font-weight: 600; line-height: 1.4; white-space: nowrap;
  border: 1px solid var(--border); background: #262626; color: var(--text-primary);
}
.wom-b-red { background: var(--wom-red-bg); border-color: var(--wom-red-bd); color: var(--wom-red); }
.wom-b-amber { background: var(--wom-amber-bg); border-color: var(--wom-amber-bd); color: var(--wom-amber); }
.wom-b-green { background: var(--wom-green-bg); border-color: var(--wom-green-bd); color: var(--wom-green); }
.wom-b-blue { background: var(--wom-blue-bg); border-color: var(--wom-blue-bd); color: var(--wom-blue); }
.wom-b-muted { background: transparent; border-color: #3a3a3a; color: var(--text-muted); }
.wom-b-ghost { background: transparent; border: 1px dashed #4a4a4a; color: var(--text-muted); }
.wom-b-btn { font-family: inherit; cursor: pointer; }
.wom-b-btn:hover { filter: brightness(1.2); border-color: var(--jd-yellow); }

/* ---------------------------------------------------------------- row controls */
.wom-cat {
  background: var(--bg-input); color: var(--text-primary); border: 1px solid #3a3a3a; border-left-width: 4px;
  border-radius: 6px; font: inherit; font-size: 0.76rem; padding: 3px 6px; max-width: 170px; cursor: pointer;
}
.wom-cat-amber { border-left-color: #f59e0b; }
.wom-cat-green { border-left-color: #22c55e; }
.wom-cat-blue { border-left-color: #60a5fa; }
.wom-cat-muted, .wom-cat-none { border-left-color: #555; }

.wom-note-cell {
  display: flex; flex-direction: column; gap: 1px; width: 100%; text-align: left; background: none;
  border: 1px dashed transparent; border-radius: 6px; padding: 2px 4px; color: var(--text-primary);
  font: inherit; font-size: 0.76rem; cursor: pointer; white-space: normal;
}
.wom-note-cell:hover { border-color: #4a4a4a; background: rgba(255, 255, 255, 0.03); }
.wom-note-empty { color: var(--text-muted); }
.wom-note-txt { display: block; overflow-wrap: anywhere; }
.wom-note-meta { display: block; font-size: 0.68rem; color: var(--text-muted); }

.wom-acts { display: flex; gap: 4px; align-items: center; flex-wrap: nowrap; }
.wom-ib {
  width: 30px; height: 28px; display: inline-flex; align-items: center; justify-content: center;
  background: #262626; border: 1px solid var(--border); border-radius: 6px; color: var(--text-primary);
  font-size: 0.9rem; cursor: pointer; padding: 0;
}
.wom-ib:hover { border-color: var(--jd-yellow); background: #2f2f2f; }

/* ---------------------------------------------------------------- narrow screens: cards */
.wom-grp-h { font-size: 0.9rem; color: var(--jd-yellow); margin: 16px 0 8px; }
.wom-grp-h:first-child { margin-top: 0; }
.wom-rcards { display: grid; gap: 10px; }
.wom-rcard { background: #191919; border: 1px solid var(--border); border-radius: 10px; padding: 12px; font-size: 0.82rem; min-width: 0; }
.wom-rcard.wom-row-critical { box-shadow: inset 4px 0 0 #ef4444; }
.wom-rcard.wom-row-priority { box-shadow: inset 4px 0 0 #f59e0b; }
.wom-rcard.wom-row-archived { opacity: 0.7; }
.wom-rcard-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; }
.wom-rcard-head .wom-wo { font-size: 1rem; }
.wom-rcard-cust { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.wom-rcard-badges { margin-bottom: 8px; }
.wom-rcard-dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; margin: 0 0 10px; }
.wom-rcard-dl dt { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.wom-rcard-dl dd { margin: 0; overflow-wrap: anywhere; }
.wom-rcard-wide { grid-column: 1 / -1; }
.wom-rcard-ctrls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 8px; }
.wom-rcard-ctrls .wom-cat { max-width: 100%; font-size: 0.85rem; padding: 7px 8px; }
.wom-rcard-ctrls .wom-b-btn, .wom-rcard-head .wom-b-btn { padding: 6px 10px; font-size: 0.8rem; }
.wom-rcard-note { margin-bottom: 8px; }
.wom-rcard-foot .wom-ib { width: 44px; height: 40px; font-size: 1.05rem; }

/* ---------------------------------------------------------------- review */
.wom-rv-sum { font-size: 0.88rem; margin: -6px 0 6px; line-height: 1.6; }
.wom-rv-wrap { max-height: 70vh; }
.wom-uncertain { background: var(--wom-amber-bg); box-shadow: inset 0 0 0 1px var(--wom-amber-bd); color: var(--wom-amber); }
.wom-unc-btn {
  background: none; border: none; padding: 0; color: var(--wom-amber); font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; text-align: left; white-space: normal;
}
.wom-rv-ignored > td:not(.wom-c-act):not(.wom-c-sel) { opacity: 0.45; }
.wom-rv-ignored .wom-rc-woNumber { text-decoration: line-through; }
.wom-rv-confirmed > td { background: rgba(74, 222, 128, 0.05); }
.wom-chg { margin-bottom: 3px; overflow-wrap: anywhere; }
.wom-chg-warn { color: var(--wom-amber); }
.wom-src { display: flex; gap: 3px; margin-top: 3px; }
.wom-src-btn {
  background: #262626; border: 1px solid var(--border); border-radius: 4px; color: var(--text-muted);
  font: inherit; font-size: 0.66rem; padding: 0 4px; cursor: zoom-in;
}
.wom-src-btn:hover { color: var(--text-primary); border-color: var(--jd-yellow); }
.wom-rv-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

.wom-shots { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0 12px; }
.wom-shot-fig { margin: 0; width: 150px; font-size: 0.72rem; }
.wom-shot-fig figcaption { margin-top: 4px; line-height: 1.5; overflow-wrap: anywhere; }
.wom-shot-n { font-weight: 700; color: var(--jd-yellow); }
.wom-shot {
  display: flex; flex-direction: column; gap: 3px; width: 150px; padding: 0; background: #0d0d0d;
  border: 1px solid var(--border); border-radius: 6px; overflow: hidden; cursor: zoom-in; color: var(--text-muted);
  font: inherit; font-size: 0.7rem; text-align: left;
}
.wom-shot:hover { border-color: var(--jd-yellow); }
.wom-shot img { width: 100%; height: 96px; object-fit: cover; object-position: top center; display: block; background: #0d0d0d; }
.wom-shot span { padding: 2px 6px 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wom-shot-failed .wom-shot { border-color: var(--wom-red-bd); }
.wom-img-err { min-height: 40px; }

/* ---------------------------------------------------------------- import history */
.wom-imp-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; font-size: 0.82rem; }
.wom-imp-row { cursor: pointer; }
.wom-h4 { font-size: 0.85rem; color: var(--text-primary); margin: 14px 0 6px; }

/* ---------------------------------------------------------------- modal */
body.wom-modal-open { overflow: hidden; }
/* Toasts must stay readable above an open dialog. */
body.wom-modal-open #toast { z-index: 10200; }
.wom-overlay {
  position: fixed; inset: 0; z-index: 10000; background: rgba(0, 0, 0, 0.66);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.wom-modal {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; color: var(--text-primary);
  width: 100%; max-width: 560px; max-height: calc(100vh - 32px); display: flex; flex-direction: column;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.55);
}
.wom-modal-wide { max-width: 1120px; }
.wom-modal-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.wom-modal-title { flex: 1; min-width: 0; font-size: 1.05rem; font-weight: 700; color: var(--jd-yellow); overflow-wrap: anywhere; }
.wom-x {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border);
  background: #262626; color: var(--text-primary); font-size: 0.95rem; cursor: pointer;
}
.wom-x:hover { border-color: var(--jd-yellow); }
.wom-modal-body { padding: 16px 18px; overflow: auto; flex: 1 1 auto; min-height: 0; font-size: 0.88rem; }
.wom-modal-err { margin: 0 18px 10px; padding: 8px 12px; border-radius: 6px; border: 1px solid var(--wom-red-bd); background: var(--wom-red-bg); color: #fecaca; font-size: 0.85rem; }
.wom-modal-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); }
.wom-confirm-msg { line-height: 1.5; overflow-wrap: anywhere; }
.wom-pop-label { display: block; font-size: 0.74rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin: 10px 0 5px; }
.wom-row-ctrl { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }

/* image lightbox */
.wom-modal-lb { max-width: 96vw; }
.wom-lb { text-align: center; }
.wom-lb img { max-width: 100%; max-height: calc(100vh - 140px); cursor: zoom-in; background: #fff; }
.wom-lb-zoom { text-align: left; }
.wom-lb-zoom img { max-width: none; max-height: none; cursor: zoom-out; }

/* row editor */
.wom-ef-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.wom-ef { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.wom-ef > label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.wom-ef-wide { grid-column: 1 / -1; }
.wom-ef-unc { padding: 8px; border-radius: 8px; background: var(--wom-amber-bg); border: 1px solid var(--wom-amber-bd); }
.wom-ef-unc > label { color: var(--wom-amber); }
.wom-unc-note { font-size: 0.76rem; color: var(--wom-amber); }
.wom-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.wom-chip {
  background: #262626; border: 1px solid #4a4a4a; border-radius: 999px; color: var(--text-primary);
  font: inherit; font-size: 0.76rem; padding: 3px 10px; cursor: pointer; font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}
.wom-chip:hover { border-color: var(--jd-yellow); }
.wom-chip-on { background: rgba(255, 222, 0, 0.15); border-color: var(--jd-yellow); color: var(--jd-yellow); }
.wom-chip-keep { font-family: inherit; }

/* ---------------------------------------------------------------- popover */
.wom-pop {
  position: fixed; z-index: 10100; width: 310px; max-width: calc(100vw - 16px); max-height: calc(100vh - 16px); overflow: auto;
  background: #232323; border: 1px solid #444; border-radius: 10px; padding: 12px; color: var(--text-primary);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6); font-size: 0.85rem;
}
.wom-pop-title { font-weight: 700; color: var(--jd-yellow); margin-bottom: 8px; }
.wom-pop .wom-input { width: 100%; }
.wom-pop-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 12px; }
.wom-seg { display: flex; gap: 4px; }
.wom-seg-btn {
  flex: 1; background: #1b1b1b; border: 1px solid #444; border-radius: 6px; color: var(--text-muted);
  font: inherit; font-size: 0.8rem; font-weight: 600; padding: 7px 4px; cursor: pointer;
}
.wom-seg-btn[aria-checked="true"] { color: var(--text-primary); border-color: var(--jd-yellow); }
.wom-seg-red[aria-checked="true"] { background: var(--wom-red-bg); color: var(--wom-red); border-color: var(--wom-red-bd); }
.wom-seg-amber[aria-checked="true"] { background: var(--wom-amber-bg); color: var(--wom-amber); border-color: var(--wom-amber-bd); }
.wom-seg-muted[aria-checked="true"] { background: #2b2b2b; }
.wom-menu { display: flex; flex-direction: column; gap: 2px; }
.wom-menu-item {
  text-align: left; background: none; border: none; border-radius: 6px; color: var(--text-primary);
  font: inherit; font-size: 0.86rem; padding: 8px 10px; cursor: pointer;
}
.wom-menu-item:hover:not(:disabled), .wom-menu-item:focus-visible { background: #2f2f2f; }
.wom-menu-item:disabled { color: var(--text-muted); cursor: default; }

/* ---------------------------------------------------------------- detail */
.wom-d-badges { margin-bottom: 12px; }
.wom-d-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px 16px; margin: 0; }
.wom-d-f { min-width: 0; }
.wom-d-f dt { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin-bottom: 2px; }
.wom-d-f dd { margin: 0; overflow-wrap: anywhere; }
.wom-d-wide { grid-column: 1 / -1; }
.wom-sec { border-top: 1px solid var(--border); padding-top: 14px; margin-top: 16px; }
.wom-sec-h, .wom-d-edit > summary { font-size: 0.95rem; font-weight: 700; color: var(--jd-yellow); margin: 0 0 10px; }
.wom-d-edit > summary { cursor: pointer; }
.wom-d-edit[open] > summary { margin-bottom: 12px; }
.wom-manage { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px 18px; }
.wom-mg { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.wom-mg > label { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); }
.wom-mg .wom-row-ctrl { margin-top: 0; }
.wom-mg .wom-row-ctrl + .wom-row-ctrl { margin-top: 6px; }
.wom-noteform { margin-bottom: 12px; }

.wom-notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.wom-note { background: #191919; border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.wom-note-head { font-size: 0.74rem; color: var(--text-muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.wom-note-body { margin-top: 4px; white-space: pre-wrap; overflow-wrap: anywhere; }
.wom-notes-sm .wom-note { padding: 6px 8px; font-size: 0.82rem; }
.wom-note-fu { margin-top: 4px; font-size: 0.84rem; color: var(--wom-amber); overflow-wrap: anywhere; }
.wom-note-ev { background: transparent; border-style: dashed; }
.wom-shots-btn { margin-top: 6px; }

.wom-hist-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.wom-hist { border-left: 3px solid #3a3a3a; padding: 4px 0 4px 10px; }
.wom-hist-when { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 2px; }
.wom-hist-items { margin: 2px 0 0; padding-left: 16px; }
.wom-hist-items li { margin: 1px 0; overflow-wrap: anywhere; }
.wom-hist-note { margin-top: 3px; white-space: pre-wrap; overflow-wrap: anywhere; }
.wom-hist .wom-badges { margin: 3px 0; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 900px) {
  .wom-head { align-items: stretch; }
  .wom-head-actions { width: 100%; }
  .wom-head-actions .wom-btn { flex: 1 1 auto; min-height: 44px; }
  .wom-toolbar .wom-input, .wom-toolbar .wom-btn-sm { min-height: 40px; }
  .wom-search { flex-basis: 100%; }
  .wom-count { margin-left: 0; }
  .wom-tab { padding: 10px 10px; min-height: 44px; }
  .wom-upload-btns { width: 100%; }
  .wom-upload-btns .wom-btn { flex: 1 1 auto; min-height: 44px; }
}
@media (max-width: 640px) {
  .wom-cards { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
  .wom-overlay { padding: 0; align-items: stretch; }
  .wom-modal, .wom-modal-wide { max-width: none; max-height: none; height: 100%; border-radius: 0; }
  .wom-manage, .wom-ef-grid { grid-template-columns: 1fr; }
  .wom-thumb, .wom-thumb-prep { width: calc(50% - 5px); }
  .wom-pop { width: calc(100vw - 16px); }
  /* Hub's .panel keeps 28px 32px padding on phones; the lot audit cards need the width.
     Only the outer panels: the Lot Audit's inner section panels stay flat (padding 0). */
  #page-workorders .wom > .panel { padding: 16px 12px; }
}
