/* Screen styles: flows (החתמה / יציאה לזיכוי / חזרה מזיכוי) + the scan sheet — Direction A "לוח הכרטיסים".
   Tokens from css/tokens.css only (plus fixed material colours for paper, canvas and the gunmetal dock, which
   are physical objects and look the same in both themes). Prefix fl- . RTL: logical properties.
   Rules that must beat the old compat block in app.css (".view .fl-…") are scoped ".fl .fl-…" (same
   specificity, later file). */

.fl {
  --cw: 72px; --ch: 114px;
  display: flex; flex-direction: column; gap: 22px; max-width: 1180px; margin: 0 auto; min-width: 0;
}
.fl > .page-head { margin-bottom: -4px; }
.fl-head p { max-width: 90ch; }
.fl-notice:empty { display: none; }
.fl-detail { display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.fl.is-leaving .fl-sec, .fl.is-leaving > .page-head { transition: opacity .5s var(--ease) .25s; opacity: .55; }

/* ---------------------------------------------------------------- steps: stamped metal tag + display title */
.fl-sec { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.fl-sec__head { display: flex; align-items: center; gap: 10px; }
.fl-sec__title { font: 700 27px/1 var(--font-display); letter-spacing: .01em; padding-top: 3px; }
.fl-sec__body { min-width: 0; }
.fl .fl-step {
  position: relative; flex: none; display: inline-grid; place-items: center; width: 30px; height: 30px; padding: 0;
  border-radius: 8px; background: linear-gradient(180deg, #3A423D, #1F2522); color: var(--amber);
  font: 700 15px/1 var(--font-mono);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), inset 0 -2px 0 rgba(0, 0, 0, .3), 0 1px 2px rgba(0, 0, 0, .25);
  transition: background .3s var(--ease), color .3s;
}
.fl-step__ok { display: none; width: 17px; height: 17px; stroke-width: 2.6; }
.fl-sec.is-done .fl-step { background: linear-gradient(180deg, #5C7A3A, #3D5A22); color: #F0F6E4; }
.fl-sec.is-done .fl-step__n { display: none; }
.fl-sec.is-done .fl-step__ok { display: block; animation: flPop .45s var(--spring); }
@keyframes flPop { from { transform: scale(.3); opacity: 0; } }

.fl-plate { padding: 16px 18px; }
.fl-plate > * { position: relative; z-index: 1; }
.fl-fields { display: flex; flex-direction: column; gap: 14px; }
.fl-req { color: var(--signal); font-weight: var(--fw-semibold); }
.fl-inline-err { color: var(--signal-ink); font-size: var(--fs-small); margin-top: 6px; line-height: 1.4; }
.fl-inline-err::before { content: "⚠ "; }
.fl-textarea { min-height: 64px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.fl-big-input { font-size: 18px; min-height: 52px; }
.fl-form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.fl-plate.fl-form-grid { padding: 18px; }

/* ---------------------------------------------------------------- the pegboard + zone plates */
.fl-board {
  position: relative; border-radius: 12px; padding: 16px; min-width: 0;
  background-color: var(--board);
  background-image: radial-gradient(circle at 50% 50%, var(--hole) 0 1.7px, transparent 2.3px);
  background-size: 16px 16px; background-position: 8px 8px;
  box-shadow: 0 0 0 1px var(--board-edge), inset 0 2px 5px rgba(0, 0, 0, .08), inset 0 0 0 5px color-mix(in srgb, var(--board-edge) 40%, transparent);
}
.fl-zone { padding: 12px 16px 16px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.fl-zone > * { position: relative; z-index: 1; }
.fl-zone .plate__head { min-height: 30px; }
.fl-zone__sub { margin: -4px 0 0; font-size: 12.5px; color: var(--ink-3); }
.fl-zone__empty {
  flex: 1; min-height: calc(var(--ch) + 4px); border: 1.5px dashed var(--line-2); border-radius: 8px;
  display: grid; place-items: center; align-content: center; text-align: center; color: var(--ink-3); font-size: 12.5px; padding: 12px;
}
.fl-count { font: 600 12px/1 var(--font-mono); color: var(--ink-3); background: var(--plate-2); box-shadow: 0 0 0 1px var(--line) inset; border-radius: 5px; padding: 5px 7px; direction: rtl; white-space: nowrap; }
.fl-count.is-on { background: var(--ink); color: var(--bg); box-shadow: none; }
.fl-tag--full { background: var(--ok-bg); color: var(--ok-c); }

/* pegs, slots and pins */
.fl-pegs { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; min-height: calc(var(--ch) + 4px); padding-top: 14px; }
.fl-pegs--since { row-gap: 28px; padding-bottom: 18px; }
.fl-slot { position: relative; width: var(--cw); height: calc(var(--ch) + 4px); flex: none; }
.fl-slot .pin { top: calc(var(--cw) * .138 - 4.5px); }
.fl-since { position: absolute; top: calc(100% + 3px); inset-inline: -8px; text-align: center; font-size: 10.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* the card you pick off its pin */
.fl-pick, .fl-hang {
  position: absolute; inset: 0 0 auto; display: block; width: var(--cw); height: var(--ch); padding: 0; border: 0; background: none;
  border-radius: calc(var(--cw) * .105); cursor: pointer; color: inherit; font: inherit;
  transform-origin: 50% calc(var(--cw) * .138);
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .22)) drop-shadow(0 4px 5px rgba(20, 25, 20, .18));
  transition: transform .38s var(--spring), filter .3s var(--ease), opacity .25s;
  -webkit-tap-highlight-color: transparent;
}
.fl-hang { cursor: default; }
a.fl-hang { cursor: pointer; }
:root[data-theme="dark"] .fl-pick, :root[data-theme="dark"] .fl-hang { filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .6)) drop-shadow(0 5px 6px rgba(0, 0, 0, .55)); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .fl-pick, :root:not([data-theme="light"]) .fl-hang { filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .6)) drop-shadow(0 5px 6px rgba(0, 0, 0, .55)); } }
@media (hover: hover) {
  .fl-pick:hover, a.fl-hang:hover { transform: translateY(-5px) rotate(-2deg); filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .2)) drop-shadow(0 12px 12px rgba(20, 25, 20, .3)); }
}
.fl-pick:active { transform: translateY(-2px) scale(.97); transition-duration: .12s; }
.fl-pick:focus-visible, .fl-hang:focus-visible { outline: 2.5px solid var(--focus); outline-offset: 4px; }
.fl-pick > .fcard, .fl-hang > .fcard { pointer-events: none; }
/* picked: lifted off the pin, shadow under it, amber tick */
.fl-pick[aria-pressed="true"]:not(.is-vacant) {
  transform: translateY(-13px) rotate(-4deg);
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .2)) drop-shadow(0 18px 14px rgba(20, 25, 20, .34));
}
.fl-pick__tick, .fl-pick__x {
  position: absolute; top: -7px; inset-inline-end: -7px; z-index: 3; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; background: var(--amber); color: var(--amber-ink);
  box-shadow: 0 0 0 2px var(--plate), 0 2px 4px rgba(0, 0, 0, .3);
  transform: scale(0); transition: transform .32s var(--spring);
}
.fl-pick__tick svg.icon, .fl-pick__x svg.icon { width: 15px; height: 15px; stroke-width: 2.8; }
.fl-pick[aria-pressed="true"] .fl-pick__tick { transform: scale(1); }
.fl-pick.is-flash { animation: flFlash 1.1s var(--ease); }
@keyframes flFlash { 0%, 40% { filter: drop-shadow(0 0 0 var(--amber)) drop-shadow(0 0 10px color-mix(in srgb, var(--amber) 80%, transparent)); } }
/* in the pouch: tap to take it out (the ✕ appears on hover / focus) */
.fl-pick--bag .fl-pick__x { background: var(--plate); color: var(--ink-2); box-shadow: 0 0 0 1px var(--line-2), 0 2px 4px rgba(0, 0, 0, .3); }
.fl-pick--bag:hover .fl-pick__x, .fl-pick--bag:focus-visible .fl-pick__x { transform: scale(1); }
@media (hover: none) { .fl-pick--bag .fl-pick__x { transform: scale(.85); } }
/* the outline a card leaves on the board when it is in the pouch */
.fl-pick.is-vacant { filter: none; }
.fl-vacant {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border-radius: calc(var(--cw) * .105); border: 1.5px dashed var(--line-2); color: var(--ink-3); font-size: 11px;
  background: color-mix(in srgb, var(--plate-2) 60%, transparent);
}
.fl-vacant__n { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.fl-vacant[data-fuel="diesel"] { box-shadow: inset 0 -5px 0 color-mix(in srgb, var(--amber) 45%, transparent); }
.fl-vacant[data-fuel="petrol"] { box-shadow: inset 0 -5px 0 color-mix(in srgb, var(--card-p-top) 45%, transparent); }
.fl-pick.is-vacant:hover .fl-vacant { border-color: var(--ink-3); color: var(--ink); }

/* result boards: cards drop onto their new pins, then swing */
.fl-slot.is-drop .fl-hang { animation: flDrop .7s var(--spring) both, flSwing 1.1s cubic-bezier(.3, .6, .3, 1) both; animation-delay: calc(var(--i, 0) * 70ms + 120ms), calc(var(--i, 0) * 70ms + 760ms); }
.fl-slot.is-drop.is-late-drop .fl-hang { animation-delay: calc(var(--i, 0) * 80ms + 520ms), calc(var(--i, 0) * 80ms + 1160ms); }
@keyframes flDrop { 0% { opacity: 0; transform: translateY(-46px) rotate(9deg) scale(.92); } 35% { opacity: 1; } 100% { opacity: 1; transform: none; } }
@keyframes flSwing { 0% { transform: rotate(8deg); } 22% { transform: rotate(-5deg); } 44% { transform: rotate(3deg); } 64% { transform: rotate(-1.5deg); } 82% { transform: rotate(.6deg); } 100% { transform: rotate(0); } }
.fl-slot--credited .fcard { filter: saturate(.35) brightness(.96); opacity: .72; }
.fl-credited {
  position: absolute; top: 46%; left: 50%; z-index: 2; transform: translate(-50%, -50%) rotate(-12deg);
  font: 700 17px/1 var(--font-display); letter-spacing: .05em; color: var(--ok-c); background: var(--plate);
  border: 2px solid var(--ok-c); border-radius: 4px; padding: 3px 6px 0; white-space: nowrap;
}

/* ghosts on the fixed layer (cards in flight between plates) */
.fl-ghost { position: fixed; z-index: 60; pointer-events: none; }
.fl-ghost > .fcard { width: 100%; height: 100%; filter: drop-shadow(0 14px 16px rgba(0, 0, 0, .35)); }
.fl-ghost > .fl-hang { position: absolute; inset: 0; width: 100%; height: 100%; animation: none; }
.fl-ghost__stamp {
  position: absolute; top: 45%; left: 50%; z-index: 2; transform: translate(-50%, -50%) rotate(-12deg);
  font: 700 17px/1 var(--font-display); letter-spacing: .05em; color: var(--ok-c); background: var(--plate);
  border: 2px solid var(--ok-c); border-radius: 4px; padding: 3px 6px 0; white-space: nowrap;
}

/* ---------------------------------------------------------------- swap: company picker */
.fl-companies { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.fl-co {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto auto; align-items: center; gap: 2px 10px;
  min-height: 68px; padding: 10px 14px; border: 0; border-radius: 10px; text-align: start;
  background: var(--plate); color: var(--ink); font: inherit; cursor: pointer;
  box-shadow: var(--shadow-plate);
  transition: transform .25s var(--spring), box-shadow .2s, background-color .2s, color .2s;
}
.fl-co:hover { transform: translateY(-2px); box-shadow: var(--shadow-plate), 0 10px 18px -12px rgba(0, 0, 0, .4); }
.fl-co:active { transform: scale(.98); }
.fl-co__name { font: 700 27px/1 var(--font-display); padding-top: 3px; }
.fl-co__sub { grid-column: 1; font-size: 12px; color: var(--ink-3); }
.fl-co__cards { grid-column: 2; grid-row: 1 / span 2; display: flex; flex-wrap: wrap; gap: 3px; max-width: 64px; justify-content: flex-end; }
.fl-co__cards .sw { width: 10px; height: 15px; border-radius: 2px; }
.fl-co[aria-pressed="true"] {
  background: var(--ink); color: var(--bg);
  box-shadow: 0 0 0 1px var(--ink), inset 0 -4px 0 var(--amber), 0 10px 18px -10px rgba(0, 0, 0, .45);
}
.fl-co[aria-pressed="true"] .fl-co__sub { color: color-mix(in srgb, var(--bg) 70%, var(--ink)); }

/* ---------------------------------------------------------------- swap: the exchange board */
.fl-xboard { display: grid; grid-template-columns: minmax(0, 1fr) 236px minmax(0, 1fr); gap: 14px; align-items: stretch; }
.fl-xmid { display: flex; flex-direction: column; gap: 12px; align-self: start; position: sticky; top: calc(var(--topbar-h) + var(--navstrip-h) + 12px); }
.fl-h2h {
  position: relative; display: flex; flex-direction: column; gap: 12px; align-items: center; text-align: center;
  padding: 14px 12px; border-radius: 10px; background: var(--plate); box-shadow: var(--shadow-plate);
}
.fl-tally { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: start; gap: 6px; width: 100%; }
.fl-tally__side { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 0; }
.fl-tally__n { font: 700 52px/.8 var(--font-display); padding-top: 6px; transition: color .3s; }
.fl-tally__w { font-size: 11.5px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.fl-tally__mix { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--ink-3); }
.fl-tally__mix span { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.fl-tally__mix .sw { width: 9px; height: 6px; }
.fl-tally__x { display: grid; place-items: center; width: 34px; height: 34px; margin-top: 8px; border-radius: 50%; background: var(--plate-2); color: var(--ink-3); box-shadow: 0 0 0 1px var(--line) inset; }
.fl-tally__x svg.icon { width: 18px; height: 18px; }
.fl-h2h.is-match .fl-tally__x { background: var(--ok-bg); color: var(--ok-c); }
.fl-h2h.is-off .fl-tally__x { background: var(--signal-bg); color: var(--signal); }
.fl-h2h__wait { font-size: 12.5px; color: var(--ink-3); border-top: 1px dashed var(--line-2); padding-top: 10px; width: 100%; }
.fl-h2h__ok { display: flex; flex-direction: column; align-items: center; gap: 10px; border-top: 1px dashed var(--line-2); padding-top: 14px; width: 100%; }
.fl-h2h__ok .stamp { font-size: 30px; }
.fl-h2h__ok .small { color: var(--ink-2); }
.fl-h2h.is-off { box-shadow: var(--shadow-plate), 0 0 0 2px color-mix(in srgb, var(--signal) 55%, transparent); }
.fl-mismatch {
  width: 100%; display: flex; flex-direction: column; gap: 6px; text-align: start; overflow: hidden;
  padding: 14px 10px 10px; border-radius: 8px; background: var(--signal-bg); color: var(--ink);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--signal) 30%, transparent) inset;
}
.fl-mismatch__title { display: flex; align-items: center; gap: 6px; font-weight: 700; color: var(--signal-ink); }
.fl-mismatch .small { color: var(--ink-2); }
.fl .fl-mini {
  width: 100%; border-collapse: separate; border-spacing: 0 3px; margin-top: 2px; font-size: 12.5px; color: var(--ink);
  background: transparent; border-radius: 0; overflow: visible;
}
.fl .fl-mini th, .fl .fl-mini td { padding: 4px 6px; text-align: start; border: 0; }
.fl .fl-mini thead th { font-size: 10.5px; color: var(--ink-3); font-weight: 600; padding-block: 0; }
.fl .fl-mini tbody th, .fl .fl-mini tbody td { background: var(--plate); }
.fl .fl-mini tbody th { border-start-start-radius: 5px; border-end-start-radius: 5px; font-weight: 600; white-space: nowrap; }
.fl .fl-mini tbody th .sw { margin-inline-end: 5px; }
.fl .fl-mini tbody td:last-child { border-start-end-radius: 5px; border-end-end-radius: 5px; }
.fl .fl-mini tr.is-off th, .fl .fl-mini tr.is-off td { background: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--signal) 9%, var(--plate)) 0 6px, var(--plate) 6px 12px); }
.fl .fl-mini tr.is-off td:last-child { color: var(--signal); font-weight: 700; }
.fl-reason {
  position: relative; overflow: hidden; padding: 16px 12px 12px; border-radius: 10px;
  background: var(--plate); box-shadow: var(--shadow-plate), 0 0 0 2px color-mix(in srgb, var(--signal) 55%, transparent);
}
.fl-reason::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 5px; background: repeating-linear-gradient(-45deg, var(--signal) 0 8px, #1a1a1a 8px 16px); }
.fl-reason label { color: var(--signal-ink); }
.fl-reason[hidden] { display: none; }

/* ---------------------------------------------------------------- number entry */
.fl-entry { margin-top: 2px; }
.fl-entry__row { display: flex; gap: 8px; }
.fl-entry__field { flex: 1 1 auto; min-width: 0; }
.fl-entry__row .btn { min-height: var(--touch-min); flex: none; }
.fl-entry__scan svg.icon { color: var(--ink-2); }

/* ---------------------------------------------------------------- the clipboard (photo of a paper form) */
.fl-clip {
  position: relative; min-width: 0; padding: 26px 14px 14px; border-radius: 12px;
  background:
    radial-gradient(120% 80% at 30% 0%, rgba(255, 255, 255, .12), transparent 60%),
    repeating-linear-gradient(92deg, rgba(0, 0, 0, .035) 0 2px, transparent 2px 7px),
    linear-gradient(180deg, #9A7650, #7C5C3A);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), inset 0 -2px 0 rgba(0, 0, 0, .2), 0 1px 2px rgba(0, 0, 0, .2), 0 8px 18px -10px rgba(0, 0, 0, .45);
  transition: box-shadow .2s;
}
.fl-clip__clip {
  position: absolute; top: -6px; left: 50%; z-index: 3; width: 104px; height: 30px; margin-left: -52px; border-radius: 6px 6px 10px 10px;
  background: linear-gradient(180deg, #E4E8E3, #9BA39D 55%, #C5CBC6); box-shadow: inset 0 1px 0 #fff, 0 3px 5px rgba(0, 0, 0, .35);
}
.fl-clip__clip::after { content: ""; position: absolute; left: 50%; top: 7px; width: 26px; height: 8px; margin-left: -13px; border-radius: 4px; background: #6F7872; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .5); }
/* the paper is a physical sheet: light in both themes (local light tokens so text and controls on it stay readable) */
.fl-clip__paper, .fl-doc {
  --ink: #171C19; --ink-2: #4A534C; --ink-3: #6A736B; --line: rgba(23, 28, 25, .12); --line-2: rgba(23, 28, 25, .22);
  --plate: #FFFFFF; --plate-2: #F1F1EA; --plate-3: #E6E7E0; --plate-hi: rgba(255, 255, 255, .9);
  --ok-c: #3D5A22; --ok-bg: #E3EAD6; --signal: #CF4510; --signal-ink: #7E2804; --signal-bg: #F8E6DB; --amber-text: #8F5E00; --amber-bg: rgba(242, 169, 0, .17);
  --bg: #E4E7E1;
  color: var(--ink); color-scheme: light;
}
.fl-clip__paper {
  position: relative; min-height: 172px; padding: 18px 16px 16px; border-radius: 3px;
  background: #FBFAF4; box-shadow: 0 1px 2px rgba(0, 0, 0, .25), 0 6px 10px -6px rgba(0, 0, 0, .3);
}
:root[data-theme="dark"] .fl-clip__paper { background: #E9E6DB; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .fl-clip__paper { background: #E9E6DB; } }
.fl-clip.is-drag { box-shadow: 0 0 0 3px var(--amber), 0 8px 18px -10px rgba(0, 0, 0, .45); }
.fl-photo__empty { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 140px; text-align: center; }
.fl-photo__lines { position: absolute; inset: 4px 0 auto; height: 60px; background: repeating-linear-gradient(180deg, transparent 0 11px, rgba(23, 28, 25, .07) 11px 12px); pointer-events: none; }
.fl-photo__icon { position: relative; width: 30px; height: 30px; color: var(--ink-3); }
.fl-photo__text { position: relative; color: var(--ink-2); }
.fl-photo__btns { position: relative; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.fl-photo__done { display: flex; gap: 14px; align-items: flex-start; min-width: 0; }
.fl-photo__frame { position: relative; flex: none; padding: 5px 5px 14px; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transform: rotate(-2.5deg); }
.fl-photo__frame::before { content: ""; position: absolute; top: -7px; left: 50%; width: 46px; height: 14px; margin-left: -23px; background: rgba(242, 222, 160, .75); transform: rotate(3deg); box-shadow: 0 1px 1px rgba(0, 0, 0, .1); }
.fl-photo__img { display: block; width: 112px; height: 136px; object-fit: cover; background: #E6E7E0; }
.fl-photo__meta { display: flex; flex-direction: column; gap: 8px; min-width: 0; padding-top: 4px; align-items: flex-start; }
.fl-photo__meta .fl-photo__btns { justify-content: flex-start; }
.fl-photo__name { overflow-wrap: anywhere; color: var(--ink-3); }
.fl-clip > .fl-inline-err { color: #FFE2D3; }

/* ---------------------------------------------------------------- the action dock (gunmetal, at the thumb) */
.fl .fl-actions {
  position: sticky; bottom: 14px; z-index: 20; margin: 2px 0 0; padding: 10px 10px 10px 10px; padding-inline-start: 18px;
  display: flex; flex-direction: column; gap: 8px; border: 0; border-radius: 12px;
  background: var(--head); color: var(--head-ink);
  -webkit-backdrop-filter: none; backdrop-filter: none;
  box-shadow: 0 16px 34px -12px rgba(0, 0, 0, .5), 0 0 0 1px rgba(255, 255, 255, .06) inset, 0 0 0 1px rgba(0, 0, 0, .25);
}
/* dark: the page is near-black, so the dock is lifted one step and gets a steel hairline */
:root[data-theme="dark"] .fl .fl-actions { background: #1E2421; box-shadow: 0 18px 40px -10px rgba(0, 0, 0, .8), 0 0 0 1px rgba(255, 255, 255, .1) inset, 0 -1px 0 rgba(255, 255, 255, .06); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .fl .fl-actions { background: #1E2421; box-shadow: 0 18px 40px -10px rgba(0, 0, 0, .8), 0 0 0 1px rgba(255, 255, 255, .1) inset, 0 -1px 0 rgba(255, 255, 255, .06); } }
.fl-actions__row { display: flex; align-items: center; gap: 14px; min-width: 0; }
.fl-dock__status { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.fl-hint { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 6px; font-size: 12.5px; min-width: 0; }
.fl-hint__lbl { display: inline-flex; align-items: center; gap: 5px; color: var(--head-ink-2); font-weight: 600; margin-inline-end: 2px; }
.fl-hint__lbl svg.icon { width: 14px; height: 14px; }
.fl-need { display: inline-flex; align-items: center; min-height: 22px; padding: 2px 8px; border-radius: 5px; background: rgba(242, 169, 0, .13); color: #F5BC3A; box-shadow: inset 0 0 0 1px rgba(242, 169, 0, .22); white-space: nowrap; }
.fl-hint__ready { display: inline-flex; align-items: center; gap: 6px; color: #B9DA8A; font-weight: 600; }
.fl-hint__ready svg.icon { width: 16px; height: 16px; stroke-width: 2.4; }
.fl-dock__sum { font-size: 13px; color: var(--head-ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fl-dock__sum b { color: var(--head-ink); font-weight: 600; }
.fl-dock__arr { color: var(--amber); font-weight: 700; }
.fl-dock__warn { color: #FFB089; font-weight: 600; }
.fl .fl-submit { flex: none; min-height: 50px; padding: 0 24px; font-size: 15.5px; border-radius: 9px; }
.fl .fl-submit:not(:disabled) { box-shadow: 0 1px 0 rgba(255, 255, 255, .45) inset, 0 -2px 0 rgba(0, 0, 0, .14) inset, 0 0 0 1px rgba(0, 0, 0, .2), 0 6px 18px -6px rgba(242, 169, 0, .55); }
.fl .fl-actions.is-ready .fl-submit:not(:disabled) { animation: flReady .6s var(--spring); }
@keyframes flReady { 0% { transform: scale(.94); } 60% { transform: scale(1.03); } }
/* disabled = a locked steel key, not a muddy amber (both themes: the dock is always gunmetal) */
.fl .fl-submit:disabled, .fl .fl-submit.is-locked {
  opacity: 1; cursor: not-allowed; transform: none;
  background: rgba(255, 255, 255, .055); color: #8E978F;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1), inset 0 1px 0 rgba(255, 255, 255, .04);
}
.fl .fl-submit[aria-busy="true"] { background: var(--amber); color: var(--amber-ink); opacity: .85; cursor: progress; }
.fl-spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(39, 27, 0, .3); border-top-color: var(--amber-ink); animation: spin .8s linear infinite; }
.fl .fl-error { margin: 0; background: rgba(255, 106, 42, .14); color: #FFC3A6; box-shadow: inset 0 0 0 1px rgba(255, 106, 42, .35); }

/* ---------------------------------------------------------------- trip-out: the empties plate → the pouch */
.fl-sendboard { display: grid; grid-template-columns: minmax(0, 1.25fr) 34px minmax(0, 1fr); gap: 12px; align-items: stretch; }
.fl-recvboard { display: grid; grid-template-columns: minmax(0, .9fr) 34px minmax(0, 1.5fr); gap: 12px; align-items: start; }
.fl-sendboard__arrow { align-self: center; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--plate); color: var(--ink-3); box-shadow: var(--shadow-plate); }
.fl-sendboard__arrow svg.icon { width: 18px; height: 18px; }
.fl-groups { display: flex; flex-direction: column; gap: 14px; }
.fl-group__head { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; margin-bottom: 6px; }
.fl-group__name { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13.5px; }
.fl-allbtn {
  margin-inline-start: auto; display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 10px; border: 0; border-radius: 7px;
  background: var(--plate-2); color: var(--ink); font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
  box-shadow: 0 0 0 1px var(--line-2) inset; transition: background-color .15s;
}
.fl-allbtn svg.icon { width: 15px; height: 15px; }
.fl-allbtn:hover { background: var(--plate-3); }
.fl-allbtn[aria-pressed="true"] { background: var(--ink); color: var(--bg); box-shadow: none; }
.fl-pouchslot { min-width: 0; display: flex; }
.fl-pouchslot > .fl-pouch { flex: 1; }

/* the canvas pouch with its paper luggage tag */
.fl-pouch {
  position: relative; min-width: 0; display: flex; gap: 12px; align-items: stretch; padding: 12px 12px 14px;
  border-radius: 10px; color: #EEF0E6;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .035) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, .05) 0 1px, transparent 1px 3px),
    var(--pouch);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .18), inset 0 2px 0 rgba(255, 255, 255, .08), inset 0 0 0 5px rgba(0, 0, 0, .06), 0 2px 4px rgba(0, 0, 0, .18);
}
.fl-pouch::before { /* stitched seam */
  content: ""; position: absolute; inset: 6px; border-radius: 6px; border: 1.5px dashed rgba(255, 255, 255, .16); pointer-events: none;
}
.fl-pouch.is-late { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .18), 0 0 0 2px color-mix(in srgb, var(--signal) 60%, transparent); }
.fl-pouch__tag {
  position: relative; z-index: 1; flex: none; align-self: flex-start; width: 132px; display: flex; flex-direction: column; gap: 4px;
  padding: 22px 12px 12px; margin-top: 6px; border-radius: 4px 4px 4px 4px;
  background: linear-gradient(180deg, #F4ECD6, #E9DFC2); color: #2B2618; transform: rotate(-2.5deg);
  clip-path: polygon(16% 0, 84% 0, 100% 9%, 100% 100%, 0 100%, 0 9%);
  box-shadow: 0 2px 4px rgba(0, 0, 0, .3);
}
.fl-pouch__eyelet { position: absolute; top: 7px; left: 50%; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: var(--pouch); box-shadow: 0 0 0 2.5px #C9B98A; }
.fl-pouch__kicker { font-size: 10.5px; font-weight: 600; color: #6E6448; letter-spacing: .02em; line-height: 1.3; }
.fl-pouch__name { font: 700 25px/1 var(--font-display); padding-top: 3px; overflow-wrap: anywhere; }
.fl-pouch__name.is-placeholder { color: #A39A7E; border-bottom: 1.5px dashed #BFB291; padding-bottom: 2px; }
.fl-pouch__line { font-size: 11.5px; color: #4E4733; line-height: 1.35; }
.fl-pouch__line .age { font-weight: 600; }
.fl-pouch__body { position: relative; z-index: 1; flex: 1; min-width: 0; display: flex; }
.fl-pegs--pouch { --gap: 10px; gap: 10px; flex: 1; align-content: flex-start; }
.fl-pouch__empty { flex: 1; display: grid; place-items: center; text-align: center; min-height: calc(var(--ch) + 4px); padding: 8px; border-radius: 8px; border: 1.5px dashed rgba(255, 255, 255, .25); color: rgba(238, 240, 230, .75); font-size: 12.5px; }
.fl-pouch .fl-pick__tick { box-shadow: 0 0 0 2px var(--pouch), 0 2px 4px rgba(0, 0, 0, .3); }
.fl-pouch.is-sealed::after { content: ""; position: absolute; inset: auto 10px 8px; height: 6px; border-radius: 3px; background: repeating-linear-gradient(90deg, #C9CFC9 0 4px, #8C948E 4px 6px); z-index: 2; }

/* the big confirmation summary */
.fl-summary-card { padding: 18px 20px; box-shadow: var(--shadow-plate), inset 0 3px 0 var(--ink); }
.fl-summary { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 14px; }
.fl-summary__none { display: flex; align-items: center; gap: 8px; color: var(--ink-3); }
.fl-summary__lead { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 28px; }
.fl-summary__big { font: 700 40px/1 var(--font-display); letter-spacing: .01em; }
.fl-summary__big b { font-weight: 700; }
.fl-summary__k { font: 600 14px/1 var(--font-sans); color: var(--ink-3); letter-spacing: 0; vertical-align: middle; }
.fl-summary__who { font: 700 28px/1 var(--font-display); }
.fl-summary__who .fl-req { font: 600 14px/1 var(--font-sans); }
.fl-summary__cards { display: flex; flex-wrap: wrap; gap: 12px 14px; }
.fl-summary__card { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; color: var(--ink-2); }
.fl-summary__card .fcard { box-shadow: var(--shadow-card); }
.fl-after { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; padding: 9px 12px; border-radius: 8px; background: var(--plate-2); color: var(--ink-2); font-size: 13px; box-shadow: 0 0 0 1px var(--line) inset; }
.fl-after b.mono { color: var(--ink); font-weight: 600; }
.fl-after > svg.icon { width: 17px; height: 17px; flex: none; }
.fl-after.is-ok > svg.icon { color: var(--ok-c); }
.fl-after.is-warn { background: var(--amber-bg); box-shadow: 0 0 0 1px color-mix(in srgb, var(--amber) 30%, transparent) inset; }
.fl-after.is-warn > svg.icon { color: var(--amber-text); }
.fl-after .stamp { margin-inline-start: auto; }
.fl-after[hidden] { display: none; }

/* confirm sheet */
.fl-confirm .modal__body { gap: 12px; }
.fl-confirm__body { display: flex; flex-direction: column; gap: 12px; }
.fl-confirm__body .mono { overflow-wrap: anywhere; }
.fl-confirm__hero { display: flex; align-items: center; gap: 20px; padding: 14px; border-radius: 10px; background: var(--plate-2); box-shadow: 0 0 0 1px var(--line) inset; }
.fl-confirm__fan { position: relative; flex: none; width: 104px; height: 84px; }
.fl-confirm__fan > span { position: absolute; top: 4px; left: 50%; margin-left: -23px; transform-origin: 50% 120%; transform: translateX(calc((var(--i) - (var(--n) - 1) / 2) * -14px)) rotate(calc((var(--i) - (var(--n) - 1) / 2) * 12deg)); }
.fl-confirm__fan .fcard { box-shadow: var(--shadow-card); }
.fl-confirm__who { font: 700 26px/1.1 var(--font-display); margin-top: 6px; }
.fl-confirm__who .muted { font: 600 13px/1 var(--font-sans); }
.fl-confirm .fl-summary__big { font-size: 32px; }

/* ---------------------------------------------------------------- key/value lines + result screens */
.fl-kv { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 4px 14px; padding: 10px 0; border-top: 1px solid var(--line); align-items: center; position: relative; z-index: 1; }
.fl-done .plate__head + .fl-kv { border-top: 0; }
.fl-kv__k { font-size: var(--fs-small); color: var(--ink-2); font-weight: var(--fw-medium); }
.fl-kv__v { min-width: 0; overflow-wrap: anywhere; }
.fl-done { padding: 14px 20px 10px; }
.fl-done .plate__head { position: relative; z-index: 1; margin-bottom: 4px; }
.fl-done__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.fl-done__actions .btn { min-height: 46px; padding: 0 20px; }
.fl-xboard--done { grid-template-columns: minmax(0, 1fr) 200px minmax(0, 1fr); }
.fl-xmid--done { position: static; align-self: center; align-items: center; text-align: center; gap: 10px; padding: 12px 0; }
.fl-xmid--done .stamp, .fl-h2h__ok .stamp { white-space: nowrap; }
.fl-xmid--done .stamp { font-size: 34px; background: color-mix(in srgb, var(--plate) 70%, transparent); }

/* ---------------------------------------------------------------- the delivery note (paper slip pinned to the board) */
.fl-slipboard { padding: 34px 16px 30px; display: grid; justify-items: center; }
.fl-doc {
  position: relative; width: 100%; max-width: 700px; display: flex; flex-direction: column; gap: 16px;
  padding: 34px 30px 26px; border-radius: 2px;
  background:
    repeating-linear-gradient(180deg, transparent 0 27px, rgba(40, 70, 120, .05) 27px 28px),
    #FBFAF4;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .15), 0 14px 26px -12px rgba(0, 0, 0, .45);
  transform: rotate(-.5deg);
  animation: flSlip .7s var(--spring) both;
}
:root[data-theme="dark"] .fl-doc { background: repeating-linear-gradient(180deg, transparent 0 27px, rgba(40, 70, 120, .05) 27px 28px), #E9E6DB; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .fl-doc { background: repeating-linear-gradient(180deg, transparent 0 27px, rgba(40, 70, 120, .05) 27px 28px), #E9E6DB; } }
@keyframes flSlip { from { opacity: 0; transform: translateY(-30px) rotate(2deg); } }
.fl-doc::before { /* perforated tear-off edge */
  content: ""; position: absolute; inset: -5px 0 auto; height: 10px;
  background: radial-gradient(circle at 8px 5px, var(--board) 0 3.4px, transparent 3.9px) 0 0 / 16px 10px repeat-x;
}
.fl-doc__clip {
  position: absolute; top: -18px; left: 50%; width: 120px; height: 34px; margin-left: -60px; border-radius: 6px 6px 12px 12px; z-index: 2;
  background: linear-gradient(180deg, #E4E8E3, #9BA39D 55%, #C5CBC6); box-shadow: inset 0 1px 0 #fff, 0 3px 6px rgba(0, 0, 0, .35);
}
.fl-doc__clip::after { content: ""; position: absolute; left: 50%; top: 9px; width: 30px; height: 9px; margin-left: -15px; border-radius: 4px; background: #6F7872; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .5); }
.fl-doc__head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; border-bottom: 2.5px solid var(--ink); padding-bottom: 12px; }
.fl-doc__head h2 { font: 700 44px/.9 var(--font-display); padding-top: 4px; }
.fl-doc__kicker { font-size: 11.5px; letter-spacing: .06em; color: var(--ink-2); font-weight: 700; }
.fl-doc__meta { font: 500 12.5px/1.6 var(--font-mono); color: var(--ink-2); text-align: end; direction: rtl; }
.fl-doc__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.fl-doc__grid > div { border-bottom: 1px dashed var(--line-2); padding-bottom: 6px; }
.fl-doc__k { font-size: 11px; font-weight: 700; letter-spacing: .04em; color: var(--ink-3); }
.fl-doc__val { font-weight: 600; font-size: 15px; overflow-wrap: anywhere; margin-top: 2px; }
.fl-doc__table { width: 100%; border-collapse: collapse; background: rgba(255, 255, 255, .45); }
.fl-doc__table th, .fl-doc__table td { border: 1px solid var(--line-2); padding: 7px 12px; text-align: start; }
.fl-doc__table th { background: rgba(23, 28, 25, .06); font-size: 11.5px; color: var(--ink-2); font-weight: 700; }
.fl-doc__table td.mono { font-size: 14px; font-weight: 600; }
.fl-doc__table td:first-child, .fl-doc__table th:first-child { width: 44px; text-align: center; font-family: var(--font-mono); }
.fl-doc__type { display: inline-flex; align-items: center; gap: 6px; }
.fl-doc__total { font-weight: 700; font-size: 15px; }
.fl-doc__rule { font-size: var(--fs-small); color: var(--ink-2); background: rgba(23, 28, 25, .05); padding: 9px 12px; border-inline-start: 3px solid var(--ink); }
.fl-doc__signs { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 12px; font-size: var(--fs-small); color: var(--ink-2); text-align: center; }
.fl-doc__line { display: block; border-bottom: 1.5px solid var(--ink); height: 34px; margin-bottom: 4px; }
.fl-doc__stamp { position: absolute; inset-inline-end: 64px; bottom: 54px; pointer-events: none; }
.fl-doc__stamp .stamp { --c: #2F5A8A; font-size: 30px; transform: rotate(-11deg); box-shadow: none; opacity: .88; }
.fl-doc__stamp .stamp.thump { animation: flStampDoc .6s var(--spring) .45s both; }
@keyframes flStampDoc { 0% { transform: rotate(-11deg) scale(1.6); opacity: 0; } 60% { opacity: .9; } 100% { transform: rotate(-11deg) scale(1); opacity: .88; } }

/* ---------------------------------------------------------------- trip-in: open trips as pouches */
.fl-trips { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.fl-tripbtn {
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; text-align: start;
  min-width: 0; padding: 12px 14px; border: 0; border-radius: 10px; cursor: pointer; font: inherit; color: #EEF0E6;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, .035) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, .05) 0 1px, transparent 1px 3px),
    var(--pouch);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .18), inset 0 2px 0 rgba(255, 255, 255, .08), 0 2px 4px rgba(0, 0, 0, .15);
  transition: transform .25s var(--spring), box-shadow .2s;
}
.fl-tripbtn:hover { transform: translateY(-2px); }
.fl-tripbtn:active { transform: scale(.985); }
.fl-tripbtn.hazard { padding-top: 16px; }
.fl-tripbtn[aria-checked="true"] { transform: translateY(-3px); box-shadow: 0 0 0 2.5px var(--amber), 0 14px 22px -10px rgba(0, 0, 0, .5); }
.fl-tripbtn__no { font: 700 34px/.8 var(--font-display); color: #fff; padding-top: 4px; }
.fl-tripbtn__main { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.fl-tripbtn__top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.fl-trip__who { flex: 1; min-width: 0; font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fl-tripbtn__sub { font-size: 12px; color: rgba(238, 240, 230, .75); }
.fl-tripbtn__cards { display: flex; gap: 4px; flex-wrap: wrap; }
.fl-tripbtn__cards .fcard { box-shadow: 0 1px 2px rgba(0, 0, 0, .35); }
.fl-tripbtn .pill--warn { background: var(--amber); color: var(--amber-ink); box-shadow: none; }
.fl-tripbtn .pill--muted { background: rgba(255, 255, 255, .1); color: #EEF0E6; box-shadow: none; }
.fl-tripbtn__tick { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .1); color: transparent; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .25); transition: background-color .2s, color .2s; }
.fl-tripbtn__tick svg.icon { width: 15px; height: 15px; stroke-width: 2.8; }
.fl-tripbtn[aria-checked="true"] .fl-tripbtn__tick { background: var(--amber); color: var(--amber-ink); box-shadow: none; }

/* trip-in: what was sent (the pouch) → per-type lanes of new-card slots */
.fl-sentslot { min-width: 0; display: flex; }
.fl-sentslot > .fl-pouch { flex: 1; flex-direction: column; }
.fl-pouch--sent .fl-pouch__tag { width: auto; align-self: stretch; transform: rotate(-1deg); margin: 4px 4px 0; }
.fl-pouch.hazard { padding-top: 16px; }
.fl-zone--recv .plate__aside { flex-wrap: wrap; justify-content: flex-end; }
.fl-lanes { display: flex; flex-direction: column; gap: 12px; }
.fl-lane {
  position: relative; display: flex; flex-direction: column; gap: 10px; padding: 10px 12px 12px; border-radius: 10px;
  background: var(--plate-2); box-shadow: 0 0 0 1px var(--line) inset; overflow: hidden;
  transition: box-shadow .2s, background-color .2s;
}
.fl-lane[data-state="ok"] { box-shadow: 0 0 0 1px color-mix(in srgb, var(--ok-c) 35%, transparent) inset; }
.fl-lane.hazard { padding-top: 15px; background: var(--signal-bg); box-shadow: 0 0 0 1.5px color-mix(in srgb, var(--signal) 50%, transparent) inset; }
.fl-lane__head { display: flex; align-items: center; gap: 10px; min-height: 26px; }
.fl-lane__name { display: inline-flex; align-items: center; gap: 7px; font: 700 22px/1 var(--font-display); padding-top: 3px; }
.fl-lane__name .sw { width: 13px; height: 9px; margin-top: -3px; }
.fl-lane__pips { display: inline-flex; gap: 3px; margin-inline-start: auto; }
.fl-pip { width: 9px; height: 14px; border-radius: 2px; box-shadow: inset 0 0 0 1.5px var(--line-2); }
.fl-lane[data-fuel="diesel"] .fl-pip.is-on { background: linear-gradient(180deg, #3A4044 0 64%, var(--amber) 64%); box-shadow: none; }
.fl-lane[data-fuel="petrol"] .fl-pip.is-on { background: linear-gradient(180deg, #15A877 0 64%, var(--mint) 64%); box-shadow: none; }
.fl-pip.is-extra { box-shadow: 0 0 0 1.5px var(--signal); }
.fl-lane__count { font-size: 15px; font-weight: 700; }
.fl-lane[data-state="short"] .fl-lane__count { color: var(--amber-text); }
.fl-lane[data-state="over"] .fl-lane__count { color: var(--signal); }
.fl-lane__ok { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--ok-c); color: var(--plate); }
.fl-lane__ok svg.icon { width: 14px; height: 14px; stroke-width: 2.8; }
.fl-lane__slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); gap: 10px; }
.fl-lane__ghosts { display: flex; flex-wrap: wrap; gap: 10px; }
.fl-lane__ghosts:empty { display: none; }

.fl-tile {
  --cw: 56px; --ch: 88px;
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: start;
  padding: 10px; border-radius: 9px; background: var(--plate); box-shadow: var(--shadow-plate); min-width: 0;
  transition: box-shadow .2s;
}
.fl-tile.is-ok { box-shadow: var(--shadow-plate), 0 0 0 1.5px color-mix(in srgb, var(--ok-c) 45%, transparent); }
.fl-tile.is-bad { box-shadow: var(--shadow-plate), 0 0 0 2px var(--signal); }
.fl-tile.is-exc { padding-top: 14px; background: color-mix(in srgb, var(--signal) 6%, var(--plate)); }
.fl-tile__face { width: var(--cw); height: var(--ch); flex: none; }
.fl-tile__face .fcard { box-shadow: var(--shadow-card); }
.fl-tile__body { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.fl-tile__top { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.fl-tile__idx { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; flex: none; background: var(--plate-2); color: var(--ink-3); font: 700 12px/1 var(--font-mono); box-shadow: 0 0 0 1px var(--line) inset; }
.fl-tile.is-ok .fl-tile__idx { background: var(--ok-c); color: var(--plate); box-shadow: none; }
.fl-tile.is-bad .fl-tile__idx { background: var(--signal); color: #fff; box-shadow: none; }
.fl-tile__for { font-size: 11.5px; color: var(--ink-3); white-space: nowrap; }
.fl-tile__for .mono { color: var(--ink-2); }
.fl-tile__exc { font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 4px; background: var(--signal); color: #fff; white-space: nowrap; }
.fl-tile__exc[hidden] { display: none; }
.fl-tile__body > .input { min-height: 42px; font-size: 15.5px; }
.fl-tile__ctl { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.fl-tile .fl-fuelseg button { min-height: 32px; padding: 0 11px; font-size: 13px; }
.fl-newrow__btns { display: inline-flex; gap: 2px; margin-inline-start: auto; }
.fl-tile__btn { width: 36px; padding: 0; }
.fl-tile .fl-inline-err { margin: 0; }

/* an empty card slot (shadow-board outline in the card's shape) */
.fl-slotcard {
  position: relative; display: grid; place-items: center; width: var(--cw, 56px); height: var(--ch, 88px); border-radius: 6px; overflow: hidden;
  border: 1.5px dashed var(--line-2); background: color-mix(in srgb, var(--plate-2) 70%, transparent); color: var(--ink-3);
}
.fl-slotcard__mark { font: 400 26px/1 var(--font-display); margin-top: -12px; }
.fl-slotcard__band { position: absolute; inset: auto 0 0; height: 20%; display: grid; place-items: center; font-size: 9.5px; font-weight: 700; }
.fl-slotcard[data-fuel="diesel"] .fl-slotcard__band { background: color-mix(in srgb, var(--amber) 28%, transparent); color: var(--amber-text); }
.fl-slotcard[data-fuel="petrol"] .fl-slotcard__band { background: color-mix(in srgb, var(--card-p-top) 22%, transparent); color: var(--petrol-text); }
.fl-slotcard.is-bad { border-color: var(--signal); color: var(--signal); background: var(--signal-bg); }
.fl-ghostslot {
  --cw: 56px; --ch: 88px;
  display: inline-flex; align-items: center; gap: 10px; padding: 8px 14px 8px 8px; border: 0; border-radius: 9px; cursor: pointer;
  background: transparent; color: var(--ink-2); font: inherit; font-size: 13px; font-weight: 600;
  box-shadow: inset 0 0 0 1.5px var(--line-2); transition: background-color .15s;
}
.fl-ghostslot:hover { background: var(--plate); }
.fl-lane.hazard .fl-ghostslot { color: var(--signal-ink); }

.fl-meter { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.fl-meter:empty { display: none; }
.fl-meter > .banner { flex-basis: 100%; }
.fl-meter__item, .fl-meter__total {
  display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 12px; border-radius: 6px;
  font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums;
}
.fl-meter__item svg.icon, .fl-meter__total svg.icon { width: 15px; height: 15px; }
.fl-meter__item.is-ok, .fl-meter__total.is-ok { background: var(--ok-bg); color: var(--ok-c); }
.fl-meter__item.is-off, .fl-meter__total.is-off { background: var(--amber-bg); color: var(--amber-text); }
.fl-meter__item[data-fuel="diesel"] { box-shadow: inset -4px 0 0 #3A4044; }
.fl-meter__item[data-fuel="petrol"] { box-shadow: inset -4px 0 0 #15A877; }
.fl-meter__total { background: transparent; box-shadow: inset 0 0 0 1.5px currentColor; }
.fl-zone--recv .fl-reason { margin: 0; }

/* ================================================================ the scan sheet (viewfinder) */
.fl-scan .modal__body { gap: 14px; }
.fl-scan__stage { display: flex; flex-direction: column; gap: 14px; min-width: 0; animation: flViewIn .38s var(--spring); }
@keyframes flViewIn { from { opacity: 0; transform: translateX(-14px); } }
.fl-vf {
  position: relative; display: block; width: 100%; height: 214px; padding: 0; border: 0; border-radius: 12px; overflow: hidden; cursor: pointer;
  background: radial-gradient(80% 70% at 50% 45%, #2B312D 0%, #141816 70%), #141816; color: #C8CFC9; font: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06), inset 0 2px 10px rgba(0, 0, 0, .5);
}
.fl-vf:disabled { cursor: progress; }
.fl-vf::before { content: ""; position: absolute; inset: 0; opacity: .22; background: repeating-radial-gradient(circle at 30% 40%, rgba(255, 255, 255, .05) 0 1px, transparent 1px 3px); z-index: 1; }
.fl-vf:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.fl-vf.is-drag { box-shadow: inset 0 0 0 3px var(--amber); }
.fl-vf__photo { position: absolute; inset: 0; background: center / cover no-repeat; opacity: .5; filter: grayscale(.35) contrast(1.05); }
.fl-vf__frame { position: absolute; z-index: 2; width: 240px; height: 150px; left: 50%; top: 50%; transform: translate(-50%, -56%); }
.fl-vf__frame i { position: absolute; width: 26px; height: 26px; border: 3px solid var(--amber); transition: border-color .2s; }
.fl-vf__frame i:nth-child(1) { top: 0; right: 0; border-left: 0; border-bottom: 0; border-radius: 0 8px 0 0; }
.fl-vf__frame i:nth-child(2) { top: 0; left: 0; border-right: 0; border-bottom: 0; border-radius: 8px 0 0 0; }
.fl-vf__frame i:nth-child(3) { bottom: 0; right: 0; border-left: 0; border-top: 0; border-radius: 0 0 8px 0; }
.fl-vf__frame i:nth-child(4) { bottom: 0; left: 0; border-right: 0; border-top: 0; border-radius: 0 0 0 8px; }
.fl-vf__ghost { position: absolute; inset: 16px 22px; border: 1.5px dashed rgba(255, 255, 255, .18); border-radius: 10px; }
.fl-vf__laser { position: absolute; z-index: 2; left: 12px; right: 12px; height: 2px; top: 20%; border-radius: 2px; background: var(--amber); box-shadow: 0 0 12px 2px rgba(242, 169, 0, .7); animation: flLaser 2.2s ease-in-out infinite alternate; }
@keyframes flLaser { from { top: 14%; } to { top: 82%; } }
.fl-vf__cta {
  position: absolute; z-index: 3; left: 50%; top: 50%; transform: translate(-50%, -62%);
  display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 18px; border-radius: 22px;
  background: var(--amber); color: var(--amber-ink); font-weight: 700; font-size: 15px; white-space: nowrap;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .45) inset, 0 -2px 0 rgba(0, 0, 0, .14) inset, 0 8px 20px -6px rgba(0, 0, 0, .6);
  transition: transform .25s var(--spring);
}
.fl-vf:hover .fl-vf__cta { transform: translate(-50%, -62%) scale(1.04); }
.fl-vf__cta svg.icon { width: 20px; height: 20px; }
.fl-vf__hint { position: absolute; z-index: 3; bottom: 14px; left: 12px; right: 12px; text-align: center; font-size: 12.5px; color: #C8CFC9; }
.fl-vf__bar { position: absolute; z-index: 3; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255, 255, 255, .08); opacity: 0; }
.fl-vf__bar i { display: block; width: 0; height: 100%; background: var(--amber); transition: width .3s var(--ease); }
.fl-vf__card { position: absolute; z-index: 3; left: 50%; top: 50%; --cw: 76px; --ch: 120px; width: 76px; height: 120px; margin: -70px 0 0 -38px; opacity: 0; transform: translateY(40px) rotate(-8deg) scale(.85); transition: transform .6s var(--spring), opacity .25s; }
.fl-vf__card .fcard { box-shadow: 0 10px 20px -6px rgba(0, 0, 0, .7); }
.fl-vf.is-busy .fl-vf__cta, .fl-vf.is-got .fl-vf__cta { opacity: 0; pointer-events: none; }
.fl-vf.is-busy .fl-vf__laser { animation-duration: .45s; }
.fl-vf.is-busy .fl-vf__bar { opacity: 1; }
.fl-vf.is-got .fl-vf__card { opacity: 1; transform: none; }
.fl-vf.is-got .fl-vf__laser { opacity: 0; }
.fl-vf.is-got .fl-vf__frame i { border-color: #5BD69E; }
.fl-vf.is-got .fl-vf__hint { color: var(--amber); font-family: var(--font-mono); font-weight: 600; }
.fl-scan__alt { display: flex; justify-content: center; margin-top: -6px; }
.fl-scan__manual { display: flex; flex-direction: column; gap: 6px; padding-top: 12px; border-top: 1px solid var(--line); }
.fl-scan__manual-row { display: flex; gap: 8px; }
.fl-scan__manual-row .input { flex: 1; min-width: 0; text-align: right; }
.fl-scan__manual-row .btn { min-height: var(--touch-min); }
.is-shake { animation: flShake .4s; box-shadow: 0 0 0 2px var(--signal) inset; }
@keyframes flShake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

.fl-scan__result { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 20px; align-items: start; }
.fl-scan__card { position: relative; --cw: 118px; --ch: 187px; width: 118px; height: 187px; transition: opacity .2s; animation: flDrop .6s var(--spring) both; }
.fl-scan__card .fcard { box-shadow: var(--shadow-lift); }
.fl-scan__card .pin { top: calc(var(--cw) * .138 - 4.5px); }
.fl-scan__card.is-unknown .fcard { filter: grayscale(.8) brightness(1.05); opacity: .55; box-shadow: none; outline: 2px dashed var(--line-2); outline-offset: 3px; }
.fl-scan__card.is-blank .fcard { opacity: .25; }
.fl-scan__info { display: flex; flex-direction: column; gap: 10px; min-width: 0; padding-top: 2px; }
.fl-scan__eyebrow { color: var(--ink-2); }
.fl-scan__num { font-size: 22px; font-weight: 600; min-height: 48px; letter-spacing: .03em; text-align: right; }
.fl-scan__where:empty { display: none; }
.fl-scan__state { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13.5px; color: var(--ink-2); }
.fl-life { list-style: none; margin: 2px 0 0; padding: 0; display: flex; align-items: center; flex-wrap: wrap; row-gap: 6px; }
.fl-life[hidden] { display: none; }
.fl-life li { display: flex; align-items: center; font-size: 11.5px; color: var(--ink-3); white-space: nowrap; }
.fl-life li:not(:last-child)::after { content: ""; width: 12px; height: 1.5px; background: var(--line-2); margin: 0 4px; }
.fl-life li.is-done { color: var(--ink-2); }
.fl-life li.is-done:not(:last-child)::after { background: var(--ink-3); }
.fl-life li.is-now span { padding: 3px 7px; border-radius: 5px; background: var(--amber); color: var(--amber-ink); font-weight: 700; }
.fl-life li.is-now.is-late span { background: var(--signal); color: #fff; }
.fl-scan__photo summary { cursor: pointer; font-size: 12.5px; color: var(--ink-3); }
.fl-scan__photo img { display: block; max-height: 160px; margin-top: 8px; border-radius: 8px; object-fit: contain; background: var(--plate-2); }
.fl-scan__next { display: flex; flex-direction: column; gap: 8px; }
.fl-scan__next:empty { display: none; }
.fl-scan__label { margin: 4px 0 0; font-size: 12px; font-weight: 600; color: var(--ink-3); letter-spacing: .04em; }
.fl-scan__none { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 13px; color: var(--ink-3); }
.fl-next {
  display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: center; text-align: start; text-decoration: none;
  padding: 12px 14px; border-radius: 10px; background: var(--plate-2); color: var(--ink); box-shadow: 0 0 0 1px var(--line) inset;
  transition: transform .2s var(--spring), box-shadow .2s, background-color .2s;
}
.fl-next:hover { transform: translateY(-2px); box-shadow: 0 0 0 1px var(--line-2) inset, 0 8px 16px -8px rgba(0, 0, 0, .3); }
.fl-next:active { transform: scale(.985); }
.fl-next__ico { width: 40px; height: 40px; border-radius: 9px; display: grid; place-items: center; background: var(--plate); box-shadow: 0 0 0 1px var(--line) inset; }
.fl-next__main b { display: block; font-size: 15px; font-weight: 600; }
.fl-next__flow { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 2px; font-size: 12px; color: var(--ink-3); }
.fl-next__flow em { font-style: normal; color: var(--ink-2); font-weight: 500; }
.fl-next__go { color: var(--ink-3); }
.fl-next.is-primary { background: var(--ink); color: var(--bg); box-shadow: none; }
.fl-next.is-primary .fl-next__ico { background: var(--amber); color: var(--amber-ink); box-shadow: none; }
.fl-next.is-primary .fl-next__flow, .fl-next.is-primary .fl-next__go { color: color-mix(in srgb, var(--bg) 62%, transparent); }
.fl-next.is-primary .fl-next__flow em { color: var(--bg); }
.fl-next.is-primary.is-late .fl-next__ico { background: var(--signal); color: #fff; }
@media (min-width: 900px) {
  dialog.modal.fl-scan { width: min(640px, calc(100vw - 32px)); }
}

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1100px) {
  .fl-xboard { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .fl-xboard > .fl-panel--ret { grid-column: 1; grid-row: 1; }
  .fl-xboard > .fl-panel--iss { grid-column: 2; grid-row: 1; }
  .fl-xboard > .fl-xmid { grid-column: 1 / -1; grid-row: 2; position: static; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .fl-xboard > .fl-xmid:has(> .fl-reason[hidden]) { grid-template-columns: minmax(0, 1fr); }
  .fl-xboard--done { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .fl-xboard--done > .fl-xmid--done { grid-column: 1 / -1; grid-row: 2; display: flex; flex-direction: row; justify-content: center; }
  .fl-recvboard { grid-template-columns: minmax(0, 1fr); }
  .fl-recvboard > .fl-sendboard__arrow { justify-self: center; transform: rotate(-90deg); }
}
@media (max-width: 899px) {
  .fl { --cw: 56px; --ch: 88px; gap: 18px; }
  .fl .fl-actions {
    bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    margin: 0 -16px -20px; padding: 10px 16px 30px; border-radius: 16px 16px 0 0;
    box-shadow: 0 -10px 24px -14px rgba(0, 0, 0, .55), 0 1px 0 rgba(255, 255, 255, .06) inset;
  }
  .fl-actions__row { flex-wrap: wrap; gap: 8px; }
  .fl-dock__status { flex-basis: 100%; }
  .fl-dock__sum { display: none; }
  .fl-hint { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-mask-image: linear-gradient(to left, #000 88%, transparent); mask-image: linear-gradient(to left, #000 88%, transparent); padding-inline-end: 16px; }
  .fl-hint::-webkit-scrollbar { display: none; }
  .fl .fl-submit { flex: 1 1 100%; min-height: 48px; }
  .fl-form-grid { grid-template-columns: minmax(0, 1fr); }
  .fl-companies { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .fl-co { min-height: 62px; padding: 8px 12px; }
  .fl-co__name { font-size: 24px; }
  .fl-board { padding: 10px; border-radius: 10px; background-size: 12px 12px; }
  .fl-xboard, .fl-sendboard { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .fl-xboard > .fl-panel--ret, .fl-xboard > .fl-panel--iss, .fl-xboard > .fl-xmid { grid-column: auto; grid-row: auto; }
  .fl-xboard > .fl-xmid { display: flex; }
  .fl-xboard--done { grid-template-columns: minmax(0, 1fr); }
  .fl-xboard--done > .fl-xmid--done { grid-column: auto; grid-row: auto; }
  .fl-sendboard__arrow { justify-self: center; transform: rotate(-90deg); width: 30px; height: 30px; }
  .fl-zone { padding: 10px 10px 12px; gap: 8px; }
  .fl-zone .plate__title { font-size: 22px; }
  .fl-pegs { gap: 9px; }
  .fl-pegs--since { row-gap: 24px; }
  .fl-entry__row .btn { padding: 0 12px; }
  .fl-tally__n { font-size: 44px; }
  .fl-h2h { padding: 12px 10px; }
  .fl-pouch { flex-direction: column; gap: 10px; padding: 10px 10px 12px; }
  .fl-pouch__tag { width: auto; align-self: stretch; transform: rotate(-1deg); margin: 2px 2px 0; padding: 18px 12px 10px; flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; clip-path: none; border-radius: 4px; }
  .fl-pouch__eyelet { top: 50%; left: auto; inset-inline-end: 10px; margin: -5px 0 0; }
  .fl-pouch__kicker { flex-basis: 100%; }
  .fl-pouch__name { font-size: 23px; }
  .fl-pouch__line { padding-inline-end: 18px; }
  .fl-summary-card { padding: 14px; }
  .fl-summary__big { font-size: 32px; }
  .fl-summary__who { font-size: 24px; }
  .fl-summary__lead { gap: 6px 18px; }
  .fl-kv { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .fl-done { padding: 12px 14px 8px; }
  .fl-done__actions .btn { flex: 1 1 auto; }
  .fl-slipboard { padding: 26px 8px 18px; }
  .fl-doc { padding: 28px 16px 20px; gap: 12px; transform: rotate(-.3deg); }
  .fl-doc__head h2 { font-size: 36px; }
  .fl-doc__grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .fl-doc__table th, .fl-doc__table td { padding: 6px 7px; }
  .fl-doc__table td.mono { font-size: 13px; }
  .fl-doc__stamp { inset-inline-end: 22px; bottom: 46px; }
  .fl-doc__stamp .stamp { font-size: 22px; }
  .fl-doc__signs { gap: 18px; }
  .fl-trips { grid-template-columns: minmax(0, 1fr); }
  .fl-tripbtn { gap: 10px; padding: 10px 12px; }
  .fl-tripbtn__no { font-size: 28px; }
  .fl-lane { padding: 8px 8px 10px; }
  .fl-lane.hazard { padding-top: 13px; }
  .fl-tile { --cw: 50px; --ch: 79px; gap: 10px; padding: 8px; }
  .fl-zone--recv .plate__head { flex-wrap: wrap; }
  .fl-zone--recv .plate__aside { margin-inline-start: 0; width: 100%; justify-content: flex-start; }
  .fl-zone--recv .plate__aside .btn--scan { flex: 1; }
  .fl-confirm__hero { gap: 14px; padding: 12px; }
  .fl-confirm .fl-summary__big { font-size: 28px; }

  .fl-vf { height: 200px; }
  .fl-scan__result { gap: 14px; }
  .fl-scan__card, .fl-scan__card .fcard { --cw: 84px; --ch: 133px; }
  .fl-scan__card { width: 84px; height: 133px; }
  .fl-scan__num { font-size: 19px; }
  .fl-life li { font-size: 11px; }
  .fl-life li:not(:last-child)::after { width: 8px; margin: 0 3px; }
}
@media (max-width: 380px) {
  .fl { --cw: 52px; --ch: 82px; }
  .fl-entry__row .btn { padding: 0 10px; }
  .fl-entry__add { display: none; } /* Enter adds; the scan button stays */
  .fl-confirm__fan { width: 80px; }
}

/* ---------------------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) {
  .fl-pick, .fl-hang, .fl-co, .fl-tripbtn, .fl-next { transition: none; }
  .fl-pick:hover, a.fl-hang:hover, .fl-co:hover, .fl-tripbtn:hover, .fl-next:hover { transform: none; }
  .fl-pick[aria-pressed="true"]:not(.is-vacant) { transform: translateY(-8px); }
  .fl-vf__laser { animation: none; top: 50%; }
  .fl-doc { transform: none; }
}
