/* Order Rail — the right-edge column driven by js/rail/rail.js.
 *
 * Isolation (ORDER_RAIL_SPEC §6): every class here is prefixed `rail-`, and the
 * only app hook is the `.app` grid's third column (var(--rail-w) in styles.css).
 * Colours come entirely from the app's own CSS variables, so the rail is
 * theme-aware for free — no palette of its own to keep in sync.
 *
 * Section 1 reuses the existing .confq-card markup (styled in styles.css); the
 * full-screen detail overlay reuses .cook-detail (also styles.css). This file
 * owns only the rail shell, its ticket rows, and the collapse/peek behaviour.
 */

#orderRail {
  grid-area: rail;
  min-width: 0;
  overflow: hidden;              /* collapsed → the 0-width track clips the inner */
  border-left: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
}
/* Off entirely (no cook access / toggle off): nothing to show. */
body:not(.rail-on) #orderRail { display: none; }

/* Fixed width so collapsing (track → 0) clips the content rather than reflowing
   it, exactly like the left nav. */
.rail-inner {
  box-sizing: border-box;
  width: 300px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px;
}

.rail-head { display: flex; align-items: center; gap: 8px; padding: 2px 2px 6px; }
.rail-toggle {
  border: 0; background: none; cursor: pointer; color: var(--text-muted);
  padding: 4px; border-radius: 6px; display: inline-flex; align-items: center;
}
.rail-toggle:hover { background: var(--surface-3); color: var(--text); }
.rail-chevr { font-size: 16px; line-height: 1; }
.rail-title {
  font-size: 12px; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--text-muted);
}

.rail-sec { display: flex; flex-direction: column; gap: 6px; padding: 6px 0; }
.rail-h {
  margin: 2px 0; font-size: 11px; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--text-muted);
}
.rail-empty { margin: 0; padding: 4px 2px; font-size: 12px; color: var(--text-soft); }

/* Section-1 cards borrow .confq-card, but the corner popup's drop shadow is out
   of place inside a flat column. */
#orderRail .confq-card { box-shadow: none; }

/* ---- Section 2: the ticket rows ---- */
.rail-ticket {
  display: flex; flex-direction: column; gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--text-soft);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer; text-align: left;
}
.rail-ticket:hover { border-color: var(--border-strong); }
.rail-ticket.s-red      { border-left-color: var(--danger); }
.rail-ticket.s-yellow   { border-left-color: var(--warn); }
.rail-ticket.s-normal   { border-left-color: var(--accent); }
.rail-ticket.s-pending  { border-left-color: var(--accent); }
.rail-ticket.s-completed { opacity: 0.55; }

.rail-t-main { display: flex; align-items: center; gap: 8px; }
.rail-t-num { font-family: var(--mono); font-weight: 800; font-size: 14px; color: var(--text); }
.rail-t-place {
  flex: 1 1 auto; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 12px; color: var(--text-muted);
}
.rail-t-timer {
  flex: 0 0 auto; font-variant-numeric: tabular-nums;
  font-size: 12px; font-weight: 700; color: var(--text-muted);
}
.rail-ticket.s-red .rail-t-timer    { color: var(--danger); }
.rail-ticket.s-yellow .rail-t-timer { color: var(--warn-strong, var(--warn)); }

.rail-t-action {
  align-self: stretch; padding: 7px 10px; border-radius: 8px;
  border: 1px solid var(--accent); background: var(--accent-bg); color: var(--accent-700);
  font-weight: 700; font-size: 13px; cursor: pointer;
}
.rail-t-action:hover { background: var(--accent); color: #fff; }
:root[data-theme="dark"] .rail-t-action { color: var(--accent); }
:root[data-theme="dark"] .rail-t-action:hover { color: #0b1411; }

/* ---- collapse / peek — mirror the left nav (desktop/tablet only) ---- */
@media (min-width: 721px) {
  #railPeekZone { position: fixed; top: 0; right: 0; bottom: 0; width: 12px; z-index: 59; }
  body:not(.rail-on) #railPeekZone,
  body:not(.rail-collapsed) #railPeekZone { display: none; }
  /* Collapsed the rail rides the grid's 0-width column; peeking floats it over
     the content from the right edge, no layout shift. */
  body.rail-on.rail-collapsed.rail-peek #orderRail {
    position: fixed; top: 0; right: 0; bottom: 0; width: 300px; z-index: 60;
    border-left: 1px solid var(--border);
    box-shadow: -16px 0 44px rgba(0, 0, 0, 0.22);
  }
}

/* ---- phones: no rail at all — the pinned Cook tab covers the same need ---- */
@media (max-width: 720px) {
  #orderRail,
  #railPeekZone { display: none !important; }
}
