/*
 * Order detail panel utility classes — BF-486.
 *
 * ROOT CAUSE: `shared/order-panel.js` (added CR-A116-16, commit bc8af9be5)
 * was ported from the admin app's `inspection-panel.js` and renders its
 * entire DOM using Tailwind utility class names (`fixed`, `translate-x-full`,
 * `bg-blue-100`, `rounded-xl`, ...). The admin app (`apps/tenant-admin`)
 * loads Tailwind; the CLIENT app (`apps/tenant-client`) never has — every
 * other file here uses this app's own bespoke, token-based CSS (tokens.css/
 * shell.css/modal.css/client-table.css etc.), never Tailwind class names.
 * With no framework defining them, EVERY class in order-panel.js's markup
 * was a no-op: the "panel" rendered as a plain unstyled <aside> laid out in
 * normal document flow at the very bottom of <body> (not the intended fixed
 * right-hand overlay), and `open()`'s `document.body.style.overflow =
 * 'hidden'` locked the page before the user could ever scroll down far
 * enough to see it. One root cause, both of Drew's reports (row click
 * "opens nothing" + page scroll-locked) — see BF-486 for the live repro.
 *
 * FIX: define, as real CSS, exactly the Tailwind utility classes
 * order-panel.js already references — nothing invented, nothing this file
 * doesn't use. Values are Tailwind v3's own documented defaults (the same
 * palette/spacing/radius scale the admin app's Tailwind build already
 * renders these exact class names as), so the client panel now matches the
 * admin inspection panel's intended look byte-for-byte instead of a new,
 * unreviewed design. Scoped to order-panel.js's own class vocabulary only —
 * no collision risk with this app's other (differently-named) CSS.
 *
 * Loaded after client-table.css / before modal.css in index.html — order
 * doesn't matter (zero shared selectors with any other stylesheet here).
 */

/* ---- shell: backdrop + sliding panel ---------------------------------- */

.fixed { position: fixed; }
.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }
.right-0 { right: 0; }
.top-0 { top: 0; }
.h-full { height: 100%; }
.w-full { width: 100%; }
@media (min-width: 640px) {
    .sm\:w-\[480px\] { width: 480px; }
}
.z-40 { z-index: 40; }
.z-50 { z-index: 50; }
.min-h-\[5rem\] { min-height: 5rem; }
.max-w-\[16rem\] { max-width: 16rem; }

.transform { /* legacy Tailwind marker class — translate-x-* below carries the actual transform */ }
.translate-x-0 { transform: translateX(0); }
.translate-x-full { transform: translateX(100%); }
.transition-opacity { transition-property: opacity; }
.transition-transform { transition-property: transform; }
.duration-200 { transition-duration: 200ms; }
.duration-300 { transition-duration: 300ms; }
.ease-in-out { transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); }

.opacity-0 { opacity: 0; }
.opacity-50 { opacity: 0.5; }
.opacity-100 { opacity: 1; }
.pointer-events-none { pointer-events: none; }

/* ---- layout ------------------------------------------------------------ */

.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }
.flex-col { flex-direction: column; }
.flex-1 { flex: 1 1 0%; }
.flex-shrink-0 { flex-shrink: 0; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.gap-1 { gap: 0.25rem; }
.gap-1\.5 { gap: 0.375rem; }
.gap-2\.5 { gap: 0.625rem; }
.gap-6 { gap: 1.5rem; }
.space-y-5 > * + * { margin-top: 1.25rem; }
.overflow-hidden { overflow: hidden; }
.overflow-y-auto { overflow-y: auto; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.whitespace-pre-wrap { white-space: pre-wrap; }

/* ---- sizing -------------------------------------------------------------- */

.w-4 { width: 1rem; }
.w-5 { width: 1.25rem; }
.w-7 { width: 1.75rem; }
.w-12 { width: 3rem; }
.w-16 { width: 4rem; }
.w-20 { width: 5rem; }
.h-2\.5 { height: 0.625rem; }
.h-3 { height: 0.75rem; }
.h-3\.5 { height: 0.875rem; }
.h-4 { height: 1rem; }
.h-5 { height: 1.25rem; }
.h-7 { height: 1.75rem; }
.h-12 { height: 3rem; }

/* ---- spacing -------------------------------------------------------------- */

.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-5 { padding-left: 1.25rem; padding-right: 1.25rem; }
.py-0\.5 { padding-top: 0.125rem; padding-bottom: 0.125rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-5 { padding-top: 1.25rem; padding-bottom: 1.25rem; }
.py-10 { padding-top: 2.5rem; padding-bottom: 2.5rem; }
.p-1\.5 { padding: 0.375rem; }
.p-5 { padding: 1.25rem; }
.pr-3 { padding-right: 0.75rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-4 { margin-top: 1rem; }
.mx-auto { margin-left: auto; margin-right: auto; }

/* ---- typography -------------------------------------------------------- */

.text-\[15px\] { font-size: 15px; }
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-base { font-size: 1rem; line-height: 1.5rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.uppercase { text-transform: uppercase; }
.tracking-wide { letter-spacing: 0.025em; }
.leading-snug { line-height: 1.375; }
.leading-normal { line-height: 1.5; }
.break-words { overflow-wrap: break-word; }
.text-center { text-align: center; }

/* ---- borders / radius / shadow ------------------------------------------ */

.border { border-width: 1px; border-style: solid; border-color: #e5e7eb; }
.border-b { border-bottom-width: 1px; border-bottom-style: solid; }
.border-l { border-left-width: 1px; border-left-style: solid; }
.border-l-4 { border-left-width: 4px; border-left-style: solid; }
.rounded { border-radius: 0.25rem; }
.rounded-md { border-radius: 0.375rem; }
.rounded-xl { border-radius: 0.75rem; }
.rounded-full { border-radius: 9999px; }
.shadow-sm { box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); }
.shadow-lg { box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1); }

/* ---- animation ----------------------------------------------------------- */

@keyframes op-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.animate-pulse { animation: op-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }

/* ---- neutrals -------------------------------------------------------------- */

.bg-white { background-color: #ffffff; }
.bg-black\/30 { background-color: rgba(0, 0, 0, 0.3); }
.bg-gray-50 { background-color: #f9fafb; }
.bg-gray-100 { background-color: #f3f4f6; }
.bg-gray-200 { background-color: #e5e7eb; }
.border-gray-100 { border-color: #f3f4f6; }
.border-gray-200 { border-color: #e5e7eb; }
.border-l-gray-200 { border-left-color: #e5e7eb; }
.border-l-gray-300 { border-left-color: #d1d5db; }
.text-gray-400 { color: #9ca3af; }
.text-gray-500 { color: #6b7280; }
.text-gray-600 { color: #4b5563; }
.text-gray-700 { color: #374151; }
.text-gray-800 { color: #1f2937; }
.text-gray-900 { color: #111827; }
@media (hover: hover) {
    .hover\:text-gray-600:hover { color: #4b5563; }
    .hover\:bg-gray-200:hover { background-color: #e5e7eb; }
}

/* ---- accent palette (card headers/chips + status badges) ------------------
   Tailwind v3 default hex values — matches the admin inspection panel's own
   Tailwind build renders these exact class names as (CARD_ACCENTS / status
   badge tables in order-panel.js), not a new palette choice. */

.bg-blue-50 { background-color: #eff6ff; }
.bg-blue-100 { background-color: #dbeafe; }
.text-blue-700 { color: #1d4ed8; }
.text-blue-800 { color: #1e40af; }
.text-blue-900 { color: #1e3a8a; }
.border-l-blue-400 { border-left-color: #60a5fa; }

.bg-indigo-50 { background-color: #eef2ff; }
.bg-indigo-100 { background-color: #e0e7ff; }
.text-indigo-700 { color: #4338ca; }
.text-indigo-800 { color: #3730a3; }
.text-indigo-900 { color: #312e81; }
.border-l-indigo-400 { border-left-color: #818cf8; }

.bg-emerald-50 { background-color: #ecfdf5; }
.bg-emerald-100 { background-color: #d1fae5; }
.text-emerald-700 { color: #047857; }
.text-emerald-800 { color: #065f46; }
.text-emerald-900 { color: #064e3b; }
.border-l-emerald-400 { border-left-color: #34d399; }

.bg-amber-50 { background-color: #fffbeb; }
.bg-amber-100 { background-color: #fef3c7; }
.text-amber-700 { color: #b45309; }
.text-amber-900 { color: #78350f; }
.border-l-amber-400 { border-left-color: #fbbf24; }

.bg-violet-50 { background-color: #f5f3ff; }
.bg-violet-100 { background-color: #ede9fe; }
.text-violet-700 { color: #6d28d9; }
.text-violet-900 { color: #4c1d95; }
.border-l-violet-400 { border-left-color: #a78bfa; }

.bg-orange-100 { background-color: #ffedd5; }
.text-orange-800 { color: #9a3412; }

.bg-yellow-100 { background-color: #fef9c3; }
.text-yellow-800 { color: #854d0e; }

.bg-green-100 { background-color: #dcfce7; }
.text-green-800 { color: #166534; }

.bg-purple-100 { background-color: #f3e8ff; }
.text-purple-800 { color: #6b21a8; }

.bg-rose-100 { background-color: #ffe4e6; }
.text-rose-800 { color: #9f1239; }

.bg-red-100 { background-color: #fee2e2; }
.text-red-800 { color: #991b1b; }

/* =====================================================================
 * CR-A116-42 — Order detail panel, r2. Matches the ratified Claude Design
 * card ("🟢 Orders · Detail panel — r2", preview/order-panel-r2.html).
 *
 * CORRECTION ROUND (same day, before any gate dispatched): the first pass
 * was built from the CR's prose Technical Spec (DesignSync unavailable in
 * that build session) with a `.op-*` class vocabulary and guessed pixel
 * values. /jonathan read the ratified card directly via DesignSync (worked
 * in that session) and relayed literal class names + CSS values — this
 * section REPLACES the first pass's `.op-*` rules with the card's own
 * literal selectors (`.hero`, `.draw-wrap`, `.opening`, `.qcards`,
 * `.refstrip`, `.p-foot`, `.spec-row`, `.p-ref`, etc.), not a second
 * parallel system — old `.op-*`/`.dh-*`/`.detail-notes` rules are REMOVED,
 * not left dead (the exact BF-490-class trap the CR itself warned about:
 * a card can keep dead CSS from a superseded round; this file must not
 * repeat that mistake in the other direction by keeping a superseded
 * round's OWN dead rules around after the literal ones land).
 *
 * What's literal-from-card (relayed verbatim by /jonathan) vs. this file's
 * own necessary layout plumbing is called out inline below. `.badge`/
 * status-color classes are still NOT redefined here — unchanged from
 * BF-488, the badge's shape/color still come from client-table.css's
 * `.badge` + ORDER_STATUSES/statusInfo()'s Tailwind-shimmed classes above.
 * ===================================================================== */

/* ---- Header (`.p-head`) — literal. The close button stays a shell-level
   sibling of the title fragment (see order-panel.js file header) rather
   than literally nested inside this row; `.detail-head-bar` (the shell's
   existing bar wrapper) carries `.p-head`'s padding/background/border so
   the two together are visually equivalent to the card's single `.p-head`
   element. ---------------------------------------------------------- */
.detail-head-bar {
  padding: 14px 20px;
  background: var(--field);
  border-bottom: 1px solid var(--line);
}
.p-head-row { display: flex; align-items: center; gap: 10px; }
.p-ref {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .02em;
}

.detail-body-scroll { padding: 22px 24px; }
/* `min-height: 100%` is this file's own plumbing (not a literal card
   value) — required so `.p-foot`'s literal `margin-top: auto` can actually
   push the footer to the bottom of the scroll area on short content,
   instead of collapsing to sit directly under the refstrip. */
.p-body { display: flex; flex-direction: column; gap: 20px; min-height: 100%; }

/* ---- Hero (`.hero`) — literal 232px-drawing / 1fr-text grid ------------ */

.hero { display: grid; grid-template-columns: 232px 1fr; gap: 20px; align-items: start; }

.draw-wrap {
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px 14px 10px;
}
.draw-wrap-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 186px; }

.draw-dimtop {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--blue-deep);
  text-align: center;
  margin-bottom: 4px;
}
.draw-row { display: flex; align-items: stretch; gap: 8px; }
.draw-dimside {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--blue-deep);
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  flex-shrink: 0;
}
.opening {
  border: 2px solid var(--navy);
  border-radius: 3px;
  background: #fff;
  display: flex;
  height: 132px;
  overflow: hidden;
  flex: none; /* width is set inline per-order (openingPixelWidth()) — never the class default */
}
.opening .pane { flex: 1; border-right: 1px solid var(--line); position: relative; }
.opening .pane:last-child { border-right: none; }
.opening .pane::after {
  content: '';
  position: absolute;
  inset: 7px;
  border: 1px solid #E8EDF4;
  border-radius: 1px;
}
.draw-cap {
  font-size: 10px;
  color: var(--faint);
  text-align: center;
  margin-top: 8px;
  letter-spacing: .02em;
}

.draw-nom-title { margin: 0; font-size: 12px; color: var(--muted); font-weight: 600; text-align: center; }
.draw-nom-sub { margin: 4px 0 0; font-size: 11px; color: var(--faint); text-align: center; }

.hero-text { min-width: 0; }
.you-ordered {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.product-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  margin: 2px 0 12px;
}
.spec-rows { width: 100%; }

/* ---- `.spec-row` — literal ---------------------------------------------- */

.spec-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  font-size: 12.5px;
  border-bottom: 1px solid var(--line-soft);
}
.spec-row:last-child { border-bottom: none; }
.spec-row .sl { color: var(--muted); flex-shrink: 0; }
.spec-row .sv { font-weight: 600; color: var(--ink); text-align: right; }
.spec-row .sv.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---- "Going to" / "Arriving" qcards (`.qcards`/`.qcard`) --------------- */

.qcards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.qcard {
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 12px;
}
.qcard h5 {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
/* Address line — literal 16px/700/navy. */
.qc-main { font-size: 16px; font-weight: 700; color: var(--navy); }
.qc-main.qc-mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.qc-main.qc-muted { color: var(--muted); font-weight: 500; }
/* No-due-date placeholder — literal: var(--font) (not mono), 15px, --muted. */
.qc-main.qc-placeholder { font-family: var(--font); font-size: 15px; font-weight: 700; color: var(--muted); }
.sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---- Reference strip (`.refstrip`) — literal ---------------------------- */

.refstrip {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}
.rf-item { display: flex; flex-direction: column; gap: 2px; }
.rf-label {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--faint);
}
.rf-value {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
}
/* Total — literal: bigger + bolder than PO/Ordered. */
.rf-value.rf-total { font-size: 15px; font-weight: 800; color: var(--ink); }

/* ---- Footer (`.p-foot`) — literal --------------------------------------- */

.p-foot {
  margin-top: auto;
  padding: 13px 20px;
  border-top: 1px solid var(--line);
  background: var(--field);
  font-size: 11.5px;
  color: var(--muted);
}

/* ---- Loading skeleton (order-panel.js loadingMarkup()) — reuses `.skel`,
   this app's own canonical shimmer primitive (job-site.css, loaded
   globally). ---------------------------------------------------------- */
.dr-skel-title { display: block; width: 56px; height: 10px; margin-bottom: 8px; }
.dr-skel-label { width: 44px; height: 11px; }

@media (max-width: 480px) {
  .hero { grid-template-columns: 1fr; }
  .draw-wrap { max-width: 232px; margin: 0 auto; }
  .qcards { grid-template-columns: 1fr; }
}

/* ---- Error state retry button (UAT fix round, S7) — `.btn-create` is the
   app's own global CTA (client-table.css, loaded in every view including
   this one); this just adds the top spacing it needs sitting under two
   stacked <p> lines in the panel's centered error block. --------------- */
.op-err-retry { margin-top: 14px; }
