/* Version C, "Record". Cards have fixed sizes; the station line is one line,
   the status two, and stamps keep only the last three, so nothing grows. */
.j-board { display: flex; flex-direction: column; gap: 18px; }
.j-desk { position: relative; height: 368px; display: grid; grid-template-columns: minmax(0, 460px); justify-content: center; align-items: start; gap: 28px; }
.j-desk.two { grid-template-columns: repeat(2, minmax(0, 440px)); }
.jc { position: relative; height: 368px; padding: 18px 20px 14px; border-radius: 10px; background: var(--color-bg);
  border: 1.5px solid var(--color-neutral-800);
  display: flex; flex-direction: column; overflow: hidden; transition: border-color .3s, box-shadow .3s; }
.jc[hidden] { display: none; }
.jc { container-type: inline-size; }
.jc-kind { margin: 0; font-size: 15px; font-weight: 600; color: var(--color-neutral-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* The name is in the card's label already. */
.jc-rec .jc-rows > :nth-child(-n+2) { display: none; }
/* Field names take only the room they need, so the values (a long position title) get the rest. */
.jc-rec .jc-rows { grid-template-columns: max-content minmax(0, 1fr); }
.jc-station { margin: 2px 0 0; font: 600 30px/1.1 var(--font-heading); color: var(--color-neutral-100); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jc-station.swap { animation: station-in .4s ease both; }
.jc-sub { margin: 2px 0 10px; font-size: 16px; line-height: 1.3; height: 2.6em; overflow: hidden; color: var(--color-accent); font-weight: 600;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.jc-track { list-style: none; margin: 0 0 12px; padding: 0; display: flex; gap: 6px; }
.jc-track li { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.seg { height: 6px; border-radius: 3px; background: var(--color-neutral-800); position: relative; overflow: hidden; }
.seg::after { content: ""; position: absolute; inset: 0; background: var(--color-accent); transform: scaleX(0); transform-origin: left; transition: transform .45s ease; }
.seg-label { font-size: 12.5px; line-height: 1.2; color: var(--color-neutral-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jc-track li[data-s=run] .seg::after { transform: scaleX(.5); animation: blink 1s ease-in-out infinite; }
.jc-track li[data-s=run] .seg-label { color: var(--color-accent); font-weight: 600; }
.jc-track li[data-s=done] .seg::after { transform: scaleX(1); }
.jc-track li[data-s=done] .seg-label { color: var(--color-neutral-300); }
.jc-track li[data-s=skip] .seg::after { transform: scaleX(1); background: none; border-top: 1px dotted var(--color-neutral-600); }
.jc-track li[data-s=skip] .seg-label { color: var(--color-neutral-500); }
.jc-track li[data-s=bad] .seg::after, .jc-track li[data-s=warn] .seg::after { transform: scaleX(1); background: var(--warn); }
.jc-track li[data-s=bad] .seg-label, .jc-track li[data-s=warn] .seg-label { color: var(--warn); font-weight: 600; }

.jc-body { flex: 1; min-height: 0; }
.jc-rows { display: grid; grid-template-columns: 7.5em 1fr; gap: 3px 12px; margin: 0; font-size: 16px; }
.jc-rows dt { color: var(--color-neutral-500); }
/* Values wrap rather than cut off; the card has room for every row at two lines. */
.jc-rows dd { margin: 0; font-weight: 600; color: var(--color-neutral-100); overflow-wrap: anywhere; }
.jc-rows dd.skip { color: var(--color-neutral-400); font-weight: 400; }
.jc-rows dd.pending { color: var(--color-neutral-500); font-weight: 400; }
.jc-rows dd.live { color: var(--color-accent); }
.jc-acc .jc-rows, .jc-lap .jc-rows { margin-bottom: 10px; font-size: 15px; }
.jc-rows dd.blank { color: var(--warn); font-style: italic; }
.jc-tiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.tile { height: 48px; display: flex; align-items: flex-end; padding: 5px 6px; border-radius: 6px; font-size: 12px; font-weight: 600; line-height: 1.1;
  color: var(--color-neutral-500); border: 1.5px dashed var(--color-neutral-700); overflow: hidden; transition: background .3s, border-color .3s, color .3s; }
/* The label stays fully opaque; only the border pulses, so the app name keeps its contrast. */
.tile[data-s=run], .tile[data-s=retry] { border-style: solid; border-color: var(--color-accent); color: var(--color-accent); animation: tile-pulse .9s ease-in-out infinite; }
.tile[data-s=done] { border-style: solid; border-color: var(--color-neutral-600); background: var(--color-neutral-600); color: var(--color-bg); }
.tile[data-s=fail] { border-style: solid; border-color: var(--warn); background: var(--warn-tint); color: var(--warn); }
.jc-final { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.jc-final li { padding: 8px 10px; border-radius: 6px; border: 1.5px dashed var(--color-neutral-700); font-weight: 600; color: var(--color-neutral-500); font-size: 15px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: border-color .3s, color .3s, background .3s; }
/* The tick always takes its space and only changes colour, so the label never shifts. */
.jc-final li::before { content: "\2713\00a0"; color: transparent; transition: color .3s; }
.jc-final li[data-s=run] { border-style: solid; border-color: var(--color-accent-700); color: var(--color-accent); }
.jc-final li[data-s=ok] { border-style: solid; border-color: var(--color-accent); color: var(--color-neutral-100); background: var(--color-accent-900); }
.jc-final li[data-s=ok]::before { color: var(--color-accent); }
.jc-outcome { margin: 14px 0 0; height: 1.3em; font: 600 21px/1.3 var(--font-heading); color: var(--color-accent); opacity: 0; transition: opacity .35s ease; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jc-outcome.on { opacity: 1; }
.jc-outcome.bad { color: var(--warn); }

.jc-stamps { height: 64px; display: flex; flex-wrap: wrap; align-content: flex-end; gap: 6px; overflow: hidden; }
.stamp { padding: 3px 9px; border: 1.5px solid var(--color-accent); border-radius: 5px; color: var(--color-accent); font: 600 13.5px/1.2 var(--font-heading);
  animation: stamp-in .25s ease both; white-space: nowrap; }
.stamp.bad { border-color: var(--warn); color: var(--warn); }

.jc[data-state=active], .jc[data-state=wait] { border-color: var(--color-accent-700); }
.jc[data-state=wait] { border-style: dashed; border-color: var(--color-accent); }
.jc[data-state=done] { border-color: var(--color-accent-700); }
.jc[data-state=blocked] { border-color: var(--warn); }
.jc[data-state=blocked] .jc-sub, .jc[data-state=warn] .jc-sub { color: var(--warn); }
.jc[data-state=blocked]::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--warn); }
.jc.halt { animation: halt .42s ease; }
.jc.hl { box-shadow: 0 0 0 3px var(--color-accent-700); }

.note { position: absolute; left: 20px; right: 20px; bottom: 80px; z-index: 2; display: flex; flex-direction: column; gap: 1px; padding: 8px 12px; border-radius: 6px;
  background: var(--warn); color: var(--color-bg); font-size: 14px; }
.note b { font-size: 13px; }
.note.info { background: var(--info); }
.note.ok { background: var(--color-accent); color: var(--color-on-accent); }
.tray .note { position: static; padding: 4px 8px; font-size: 13px; }
/* A tray shows its newest note; older ones still waiting sit underneath it. */
.tray .note:not(:last-child) { display: none; }
.tray .note b { font-size: 12px; }

/* One column per owner (the flow says how many, as --n). */
.j-trays { display: grid; grid-template-columns: auto repeat(var(--n, 4), minmax(0, 1fr)); gap: 10px; align-items: stretch; }
.j-trays-label { margin: 0; align-self: center; font-size: 13px; font-weight: 650; color: var(--color-neutral-500); }
.tray { height: 86px; display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; border-radius: 8px; background: var(--color-surface);
  border: 1.5px solid transparent; transition: border-color .3s, background .3s; overflow: hidden; }
.tray-name { font-size: 14px; font-weight: 650; color: var(--color-neutral-400); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tray[data-state=alert] { border-color: var(--warn); background: var(--warn-tint); }
.tray[data-state=alert] .tray-name { color: var(--warn); }
.tray[data-state=info] { border-color: var(--info); }

::view-transition-group(*) { animation-duration: .32s; animation-timing-function: cubic-bezier(.3, .7, .2, 1); }
::view-transition-old(*), ::view-transition-new(*) { animation-duration: .32s; }
::view-transition-new(jc-acc):only-child { animation: emerge .32s cubic-bezier(.3, .7, .2, 1) both; }
::view-transition-old(jc-acc):only-child { animation: fold .28s ease both; }

@media (max-width: 700px) {
  .j-desk, .j-desk.two { height: 412px; }
  .j-desk.two { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .jc { height: 412px; padding: 12px 11px 10px; }
  .two .jc-station { font-size: 21px; white-space: normal; height: 2.2em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .two .jc-sub { display: none; }
  .two .jc-station { margin-bottom: 8px; }
  .two .jc-stamps { height: 60px; }
  .two .seg-label { display: none; }
  .two .jc-tiles { grid-template-columns: repeat(2, 1fr); gap: 4px; }
  .two .jc-rows { grid-template-columns: 1fr; gap: 0; font-size: 13px; }
  .two .jc-rows dt { font-size: 11.5px; }
  .two .tile { height: 24px; font-size: 11px; padding: 3px 5px; }
  .jc-final { grid-template-columns: 1fr; }
  .jc-stamps { height: 84px; }
  .stamp { font-size: 11.5px; padding: 2px 6px; }
  .note { left: 10px; right: 10px; bottom: 96px; font-size: 13px; }
  .jc-outcome { font-size: 17px; height: 2.6em; white-space: normal; }
  .j-trays { grid-template-columns: repeat(var(--n, 4), minmax(0, 1fr)); gap: 6px; }
  .j-trays-label { display: none; }
  .tray { height: 92px; padding: 6px; }
  .tray-name { font-size: 12.5px; }
  .tray .note { font-size: 11.5px; padding: 3px 5px; }
}
@keyframes station-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes tile-pulse { 50% { border-color: var(--color-accent-800); } }
@keyframes blink { 50% { opacity: .45; } }
@keyframes flip { 0% { transform: rotateX(90deg); } 100% { transform: none; } }
@keyframes stamp-in { from { opacity: 0; } }
@keyframes wait { 50% { box-shadow: 0 0 0 5px var(--color-accent-800); } }
@keyframes halt { 20% { transform: translateX(-3px); } 45% { transform: translateX(3px); } 70% { transform: translateX(-2px); } 100% { transform: none; } }
@keyframes emerge { from { opacity: 0; transform: scale(.96); } }
@keyframes fold { to { opacity: 0; transform: scale(.96); } }
/* Kept last so it wins over the base tile rules. A narrow card puts the app tiles in three columns so every name fits. */
@container (max-width: 380px) {
  .jc-tiles { grid-template-columns: repeat(3, 1fr); }
  .tile { height: 30px; }
}
/* The smallest phones (320px): two tile columns and slightly smaller owner names. */
@container (max-width: 270px) {
  .jc-tiles { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 359px) { .j-trays { gap: 4px; } .tray-name { font-size: 12px; } .tray { padding: 8px 3px; } }
/* Narrow phones: three or four owners go two to a row, so each tray is wide enough for its note. */
@media (max-width: 479px) { .j-trays[data-n="3"], .j-trays[data-n="4"] { grid-template-columns: repeat(2, minmax(0, 1fr)); } .j-trays[data-n="3"] .tray, .j-trays[data-n="4"] .tray { height: 78px; padding: 6px 8px; } }
@container (max-width: 120px) {
  .jc .jc-tiles, .two .jc-tiles { gap: 3px; }
  .jc .tile, .two .tile { font-size: 10px; padding-left: 2px; padding-right: 2px; }
}
