/* Order detail (the console's Order detail screen): the page's own layout classes. Every component (chips, codes,
   the banner, the timeline, the phase bar, the stat strip, the source tile, bot avatars, buttons, panels) comes
   from app.css; this file only places them: the head with its actions and drawer, the meta strip, the wide column
   (timeline, attempts, messages) with its side column (proof, items, billing, notes). Nothing moves under the
   pointer. */

.od { display: flex; flex-direction: column; gap: 16px; }

/* ── the head: tile · reference · chips · actions, then the strip, then the action drawer ── */
.od__head { overflow: visible; }
.od__top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 14px 16px; min-width: 0; }
.od__crumb { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; color: var(--ink-3); border: 1px solid transparent; }
.od__crumb:hover { color: var(--ink); background: var(--panel-2); border-color: var(--line-2); text-decoration: none; }
.od__top > .src { margin-right: 2px; }
.od__ref { margin: 0; font: 600 20px/1.1 var(--mono); letter-spacing: -.01em; color: var(--ink); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.od__phase { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.od__phase-g { font: 10px/1 var(--mono); }
.od__phase--neutral { color: var(--neutral); } .od__phase--wait { color: var(--wait); } .od__phase--info { color: var(--info); } .od__phase--run { color: var(--run); }
.od__phase--ok { color: var(--ok); } .od__phase--warn { color: var(--warn); } .od__phase--attn { color: var(--attn); } .od__phase--bad { color: var(--bad); } .od__phase--mute { color: var(--mute); }
.od__actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.od__actions .btn { height: 30px; }
.od__actions .btn.is-on { border-color: var(--accent); background: var(--accent-bg); color: var(--accent); }
.od__actions .btn--danger.is-on { border-color: color-mix(in oklab, var(--bad) 45%, transparent); background: var(--bad-bg); color: var(--bad); }
.od__meta { border-top: 1px solid var(--line); grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.od__cell { display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%; }
.od__cell .bavatar { --sz: 20px; }
.od__cell .bavatar__game { border-width: 1.5px; }
.od__cell .pill { margin-left: 2px; }
.od__cell--wrap { flex-wrap: wrap; white-space: normal; row-gap: 3px; }
.od__clip { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.od__pc { color: var(--ink-3); }
.od__pc:hover { color: var(--accent); }
.od__avatar { width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--panel-2); object-fit: cover; flex: none; display: inline-grid; place-items: center; font: 600 8px/1 var(--mono); color: var(--ink-3); }
.od__cell .sla { width: 40px; margin-left: 2px; }

/* the drawer: the form of the action pressed in the head */
.od__drawer { border-top: 1px solid var(--line); background: var(--panel-2); }
.od__form { display: flex; flex-direction: column; gap: 12px; padding: 14px 16px; }
.od__form-title { font-weight: 600; font-size: 13.5px; }
.od__form-title .faint { font-weight: 400; }
.od__fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.od__form-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ── the banner that says what happens next ── */
.od__next--done .banner__glyph { background: var(--panel-2); }
.od__buyer-does strong { font-weight: 600; color: var(--ink); }
.od__next .next__blockers { margin-top: 2px; }

/* ── the two columns ── */
.od__main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); gap: 16px; align-items: start; }
.od__col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
@media (max-width: 1100px) { .od__main { grid-template-columns: minmax(0, 1fr); } }

/* ── timeline: the phase bar while trading, the milestones, the log under them ── */
.od__stepper { padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.od__stepper .pbar { gap: 3px; }
.od__stepper .pbar__s { height: 6px; border-radius: 2px; }
.od__stepper-words { display: flex; justify-content: space-between; font: 11px/1.2 var(--mono); color: var(--ink-3); }
.od__stepper-now { color: var(--ink); }
.od__tl { padding: 8px 16px 12px; }
.od__log { border-top: 1px solid var(--line); }
.od__log-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 16px 6px; font-size: 12px; font-weight: 500; color: var(--ink-2); }
.od__log-n { font: 600 11px/18px var(--mono); padding: 0 6px; border-radius: 9px; background: var(--panel-2); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.od__log-head .timeline__note { margin: 0; font-weight: 400; }
.od__events { margin: 0 16px 12px 20px; max-height: 320px; overflow: auto; font-size: 12.5px; }
.od__ev-kind { font-size: 11px; font-family: var(--mono); }

/* ── delivery attempts: #n · chip · code · bot · when, then the message and the items ── */
.od__attempt { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 4px 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); align-items: start; }
.od__attempt:last-child { border-bottom: 0; }
.od__attempt-n { font: 600 12px/20px var(--mono); color: var(--ink-3); }
.od__attempt-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-width: 0; min-height: 20px; }
.od__attempt-bot { font: 12px/1 var(--mono); color: var(--ink-2); }
.od__running { display: inline-flex; align-items: center; gap: 2px; font-size: 11.5px; color: var(--run); }
.od__running .spinner { margin-left: 0; margin-right: 4px; width: 10px; height: 10px; }
.od__attempt-when { font: 11.5px/20px var(--mono); color: var(--ink-3); white-space: nowrap; }
.od__attempt-body { grid-column: 2 / -1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.od__attempt-msg { color: var(--ink-2); text-wrap: pretty; overflow-wrap: anywhere; }
.od__attempt-items { font-size: 12px; color: var(--ink-2); display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; }
.od__attempt-items .iname { display: inline-flex; }
.od__attempt-meta { font: 11px/1.4 var(--mono); color: var(--ink-3); overflow-wrap: anywhere; }
.od__phases { margin-top: 2px; }
.od__phases li { font-size: 10.5px; height: 18px; }

/* ── buyer messages and notes ── */
.od__msg, .od__note { display: flex; flex-direction: column; gap: 5px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.od__msg:last-of-type, .od__note:last-of-type { border-bottom: 0; }
.od__msg-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12px; }
.od__msg-head strong { font-weight: 600; font-size: 12.5px; }
.od__msg-time { margin-left: auto; font: 11.5px/1 var(--mono); color: var(--ink-3); white-space: nowrap; }
.od__bubble { align-self: flex-start; padding: 8px 10px; border-radius: 2px 8px 8px 8px; background: var(--panel-2); border: 1px solid var(--line); color: var(--ink-2); text-wrap: pretty; max-width: 560px; overflow-wrap: anywhere; }
.od__bubble--in { border-radius: 8px 2px 8px 8px; align-self: flex-end; background: var(--accent-bg); border-color: color-mix(in oklab, var(--accent) 30%, transparent); color: var(--ink); }
.od__msg--failed .od__bubble { border-color: color-mix(in oklab, var(--bad) 50%, transparent); }
.od__msg-err { font-size: 12px; }
.od__send { display: flex; gap: 8px; align-items: center; padding: 10px 16px; border-top: 1px solid var(--line); }
.od__send--top { border-top: 0; border-bottom: 1px solid var(--line); }
.od__send .input { flex: 1; height: 32px; }
.od__send .btn { flex: none; }
.od__note--pinned { background: color-mix(in oklab, var(--warn-bg) 50%, transparent); }
.od__pin { color: var(--warn); font: 10px/1 var(--mono); }
.od__note-body { color: var(--ink); overflow-wrap: anywhere; }
.od__note-acts { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.od__note-acts details { display: contents; }
.od__note-acts .od__send { padding: 6px 0 0; border: 0; width: 100%; }

/* ── proof: tabs in the head, the picture with its stamp, the foot with the download ── */
.od__proof-head { padding: 6px 8px 6px 16px; }
.od__tab { height: 28px; padding: 0 10px; border: 0; border-radius: 5px; background: transparent; color: var(--ink-2); font-size: 12.5px; font-weight: 500; cursor: pointer; }
.od__tab:hover { color: var(--ink); }
.od__tab.is-on { background: var(--accent-bg); color: var(--accent); }
.od__proof { position: relative; aspect-ratio: 16 / 10; background: repeating-linear-gradient(135deg, var(--sunk) 0 10px, var(--panel-2) 10px 20px); display: flex; align-items: center; justify-content: center; border-bottom: 1px solid var(--line); overflow: hidden; }
.od__proof-img { width: 100%; height: 100%; object-fit: contain; border: 0; border-radius: 0; background: transparent; cursor: zoom-in; display: block; }
.od__proof-img.is-missing { opacity: 1; width: auto; height: auto; min-width: 120px; min-height: 60px; }
.od__proof--video { background: #000; }
.od__video { width: 100%; height: 100%; display: block; background: #000; }
.od__stamp { position: absolute; left: 8px; top: 8px; font: 500 10.5px/1 var(--mono); padding: 4px 6px; border-radius: 3px; background: var(--ink); color: var(--on-ink); pointer-events: none; }
.od__proof-foot { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 10px 16px; }
.od__proof-meta { font-size: 12px; flex: 1 1 140px; }
.od__rec + .od__rec { border-top: 1px solid var(--line); }
.od__others { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 12px; }
.od__other { margin: 0; width: 96px; }
.od__other .thumb { width: 96px; height: 54px; display: block; cursor: zoom-in; }
.od__other figcaption { font-size: 10.5px; color: var(--ink-3); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.story__phase { list-style: none; margin: 10px 0 4px; font-size: 11.5px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; color: var(--ink-2); }
.story__box { margin: 6px 0 12px; }
.story__box > summary { cursor: pointer; font-size: 12px; padding: 4px 0; }
.story__box-rows { list-style: none; margin: 4px 0 0; padding: 8px 10px; max-height: 420px; overflow: auto; font-size: 11px; line-height: 1.5; background: var(--sunk); border-radius: 6px; }
.story__box-row { white-space: pre-wrap; word-break: break-word; }
.story__box-row time { color: var(--ink-3); }
.story__box-row.is-bad { color: var(--bad, #c0392b); }
.od__attempt-proof { border-top: 1px solid var(--line); }
.od__attempt-proof-head { font-size: 12px; padding: 8px 16px 6px; }
.od__all-pictures { border-top: 1px solid var(--line); }
.od__all-pictures > summary { cursor: pointer; font-size: 12px; padding: 8px 16px; }
.od__all-pictures .od__other { width: 120px; }
.od__all-pictures .od__other .thumb { width: 120px; height: 68px; }
.od__other--interim .thumb { opacity: .7; }

/* ── items: picture · name and qty · handed over · total ── */
.od__item { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 10px 18px; border-bottom: 1px dashed var(--line-2); }
.od__item:last-child { border-bottom: 0; }
.od__item-pic { position: relative; width: 44px; height: 44px; border-radius: 11px; background: var(--panel-2); border: 1px solid var(--line-2); overflow: hidden; display: block; }
.od__item-img { width: 100%; height: 100%; object-fit: cover; display: block; border: 0; border-radius: 0; }
.od__item-img.is-missing { opacity: 1; background: repeating-linear-gradient(135deg, var(--stripe) 0 5px, var(--panel-2) 5px 10px); }
.od__item-img--empty { display: grid; place-items: center; background: repeating-linear-gradient(135deg, var(--stripe) 0 5px, var(--panel-2) 5px 10px); }
.od__item-img--empty .glogo { opacity: .55; }
.od__item-text { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.od__item-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.od__item-name .iname { max-width: 100%; }
.od__item-sub { font: 12px/1.3 var(--mono); color: var(--ink-3); }
.od__item-done { font: 12px/1 var(--mono); color: var(--ink-3); white-space: nowrap; }
.od__item-done--ok { color: var(--ok); } .od__item-done--bad { color: var(--bad); }
.od__item-total { font: 12.5px/1 var(--mono); min-width: 64px; text-align: right; white-space: nowrap; }

/* ── billing line ── */
.od__inv { font: 500 11.5px/1 var(--mono); color: var(--ink-3); white-space: nowrap; }
a.od__inv { color: var(--accent); }
.od__bill { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; padding: 12px 16px; align-items: center; }
.od__bill-k { color: var(--ink-2); }
.od__bill-v { font-family: var(--mono); text-align: right; white-space: nowrap; }
.od__bill-row { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.od__bill-row .od__bill-k { margin-right: auto; }
.od__bill-row .inline-form { margin-left: 4px; }
.od__bill-k--sum { font-weight: 600; color: var(--ink); padding-top: 6px; border-top: 1px solid var(--line); }
.od__bill-v--sum { font: 600 14px/1.2 var(--mono); padding-top: 6px; border-top: 1px solid var(--line); }
.od__bill-note { grid-column: 1 / -1; font-size: 12px; color: var(--ink-3); text-wrap: pretty; }

/* ── the whole story, the raw payload ── */
.od__story .story__head { margin-top: 0; }
.od__raw > summary { font-size: 12.5px; }
.od__pre { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 11.5px; margin: 8px 0 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--sunk); max-height: 420px; overflow: auto; }

/* ── a phone: the head stacks, the actions wrap, the attempts fold their time under the line ── */
@media (max-width: 760px) {
  .od__top { padding: 12px; }
  .od__actions { margin-left: 0; width: 100%; }
  .od__attempt { grid-template-columns: 28px minmax(0, 1fr); }
  .od__attempt-when { grid-column: 2; line-height: 1.2; }
  .od__item { padding: 10px 14px; gap: 10px; }
  .od__item-total { min-width: 0; }
  .od__bubble { max-width: 100%; }
  .od__events { margin-left: 16px; }
  /* a long meta (the attempts' counts, the notes' hint) drops under its title instead of squeezing it */
  .od .panel__head { flex-wrap: wrap; row-gap: 4px; }
  .od .panel__head .panel__meta { white-space: normal; }
}
