/* ==========================================================
   FACTORY TOWN PRODUCTION OS — SKIN v1 (ft-skin.css)
   Loads after the app's own styles. Brand fonts, bigger type and tap targets,
   the Factory Town placeholder mark, daylight palette, and the motion layer.
   Pairs with ft-motion.css (kit) + ft-skin.js.
   ========================================================== */
:root {
  --mono: "FT Mono", "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --disp: "FT Display", "Big Shoulders", "Archivo Narrow", "Arial Narrow", sans-serif;
  --stencil: "FT Stencil", "FT Display", sans-serif;
  --bg: #000000; --hover: #0E0D0B; --line: #2A2826; --line2: #46423D; --grid: #121110;
  --fg: #ECE9E2; --dim: #9A968E; --faint: #625E57;
  --acc: #FFA41B;            /* sodium-vapor amber: the one accent */
  --warn: #F2C94C;           /* yellow, so "waiting" never reads as the accent */
  --ok: #5BD68A; --crit: #FF3B30; --onCrit: #140404; --vio: #B2A4FF;
  --ft-bg: #000000;
}
body { font-size: 14px; line-height: 1.55; }
body::after { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 48px 48px; opacity: .55; }

/* ---------- header (spine) ---------- */
.spine { background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(6px); }
.brand { display: flex; align-items: center; gap: 12px; font-size: 0; letter-spacing: 0; }
.brand .ft-mark { height: 34px; width: auto; display: block; }
.brand .ft-sub { font: 500 11.5px/1.35 var(--mono); letter-spacing: .06em; color: var(--dim); text-transform: none; }
.brand small { display: none; }
.tag { font-size: 11.5px; padding: 6px 9px; min-height: 34px; display: inline-flex; align-items: center; gap: 6px; }
.ft-ctl { display: inline-flex; gap: 6px; }
.ft-ctl button { min-width: 40px; min-height: 36px; justify-content: center; }
.ft-ctl svg { width: 16px; height: 16px; }
.nav button { display: inline-flex; align-items: center; gap: 8px; padding: 0 16px; min-height: 50px; font-size: 12.5px; letter-spacing: .14em; position: relative; transition: color .16s, background .16s; }
.nav button svg { width: 18px; height: 18px; flex: none; opacity: .75; }
.nav button[aria-current="true"] { color: var(--acc); box-shadow: inset 0 -3px 0 var(--acc); background: color-mix(in srgb, var(--acc) 7%, transparent); }
.nav button[aria-current="true"] svg { opacity: 1; }
.tag.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 var(--ok); animation: ft-live 2s infinite; }
.tag.live { color: var(--ok); }
@keyframes ft-live { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent); } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* ---------- type + targets ---------- */
.pnl > h3 { font-size: 11.5px; padding: 7px 12px; }
.pnl > h3::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 8px; vertical-align: 1px; background: var(--acc); }
.btn { font-size: 11.5px; min-height: 42px; padding: 0 14px; transition: border-color .16s, background .16s, color .16s, transform .12s; }
.btn:active { transform: scale(.97); }
.btn.sm { min-height: 34px; padding: 0 10px; }
.btn.on { color: #000; }
.kpi { padding: 14px 14px 12px; position: relative; overflow: hidden; }
.kpi b { font: 800 44px/1 var(--disp); letter-spacing: .01em; }
.kpi span { font-size: 11px; }
.kpi::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: currentColor; opacity: .0; }
.chip { font-size: 10.5px; padding: 2px 7px; }
.rr b { font: 800 19px/1.05 var(--disp); letter-spacing: .03em; display: flex; align-items: center; gap: 8px; }
.rr b svg { width: 22px; height: 22px; color: var(--acc); flex: none; }
.rr small { font-size: 11.5px; }
.bar { height: 8px; }
.bar i { transition: width .9s cubic-bezier(.2,.8,.2,1); }
.wo .t { font-size: 14px; } .wo .m { font-size: 11.5px; }
.feed li { font-size: 12.5px; }
label.f { font-size: 11px; }
input.in, select.in, textarea.in { font-size: 15px; padding: 10px; min-height: 44px; }
.wx .lv { font: 800 40px/1 var(--stencil); letter-spacing: .14em; }
.hero-empty h2 { font: 800 34px/1 var(--disp); text-transform: uppercase; }

/* ---------- login ---------- */
.lg-brand { font-size: 0 !important; }
.lg-brand .ft-mark-lg { width: min(280px, 72vw); height: auto; display: block; margin: 0 auto 6px; }
.dots span { transition: background .15s, transform .15s; }
.dots span.on { transform: scale(1.25); background: var(--acc) !important; border-color: var(--acc) !important; }
.pad .pk { font: 800 30px/1 var(--disp); min-height: 64px; transition: background .12s, transform .1s; }
.pad .pk:active { transform: scale(.94); background: color-mix(in srgb, var(--acc) 22%, transparent); }
.pad .pk.go { font-family: var(--stencil); letter-spacing: .12em; color: var(--acc); }
.ft-shake { animation: ft-shake .42s cubic-bezier(.36,.07,.19,.97); }
@keyframes ft-shake { 10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(4px); } 30%, 50%, 70% { transform: translateX(-8px); } 40%, 60% { transform: translateX(8px); } }

/* ---------- weather hold banner: rail crossing ---------- */
.bcast { position: relative; padding-left: 52px; overflow: hidden; }
.bcast::before, .bcast::after { content: ""; position: absolute; top: 50%; width: 11px; height: 11px; margin-top: -5.5px; border-radius: 50%; background: var(--onCrit); animation: ftm-xing .5s steps(1) infinite; }
.bcast::before { left: 12px; } .bcast::after { left: 28px; animation-delay: .25s; }
.bcast b { font: 800 18px/1 var(--stencil); letter-spacing: .1em; }

/* ---------- screen enter (only when you switch screens, never on the 4-second refresh) ---------- */
.ft-enter > * { animation: ft-up .42s cubic-bezier(.2,.8,.2,1) both; }
.ft-enter > *:nth-child(2) { animation-delay: .05s; } .ft-enter > *:nth-child(3) { animation-delay: .1s; }
.ft-enter > *:nth-child(4) { animation-delay: .15s; } .ft-enter > *:nth-child(5) { animation-delay: .2s; } .ft-enter > *:nth-child(n+6) { animation-delay: .24s; }
@keyframes ft-up { from { opacity: 0; transform: translateY(12px); } }
.ft-wipe { position: fixed; z-index: 25; left: 0; right: 0; height: 3px; background: var(--acc); transform-origin: left; animation: ft-wipe .45s cubic-bezier(.2,.8,.2,1) forwards; pointer-events: none; }
@keyframes ft-wipe { from { transform: scaleX(0); } 70% { transform: scaleX(1); opacity: 1; } to { transform: scaleX(1); opacity: 0; } }

/* ---------- stage marquee on Command ---------- */
#ftmq { max-width: 1440px; margin: 12px auto 0; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); box-sizing: border-box; }
#ftmq .ftm-marquee { border: 1px solid var(--line); }
[data-skin="tx"] { text-transform: none; font-weight: 700; }
.ft-mq .ftm-marquee { border: 0; }

/* ---------- big stamp ---------- */
.ft-stamp { position: fixed; inset: 0; z-index: 9600; display: grid; place-items: center; pointer-events: none; }
.ft-stamp div { border: 5px solid var(--c, var(--ok)); color: var(--c, var(--ok)); background: color-mix(in srgb, var(--bg) 70%, transparent); padding: .1em .4em; font: 800 clamp(48px, 13vw, 120px)/1 var(--stencil); letter-spacing: .08em; rotate: -8deg; animation: ftm-stamp .5s cubic-bezier(.2,.8,.2,1) both, ft-stamp-out .4s 1.3s forwards; }
.ft-stamp small { display: block; font: 600 12px/1.4 var(--mono); letter-spacing: .2em; text-align: center; }
@keyframes ft-stamp-out { to { opacity: 0; scale: .9; } }

/* toasts use the train alert now */
#toast { display: none !important; }

/* chain loader in the connecting screen */
.hero-empty .ftm-loader { max-width: 320px; margin: 18px auto 0; }

/* ---------- DAYLIGHT (sun) palette ---------- */
.ft-day {
  --bg: #FFFFFF; --hover: #F1EFEA; --line: #D3CFC6; --line2: #8E897F; --grid: #F2F0EB;
  --fg: #0A0A0A; --dim: #4B4740; --faint: #7A766E;
  --acc: #B45300; --warn: #8A6A00; --ok: #0A7A3B; --crit: #C4141F; --onCrit: #FFFFFF; --vio: #5B47C8;
  --ft-bg: #FFFFFF; --ft-surface: #F3F1EC; --ft-surface-2: #E6E3DC; --ft-on-accent: #FFFFFF;
  --ft-ink: #0A0A0A; --ft-dim: #4B4740; --ft-line: #CFCBC2; --ft-line-2: #8E897F; --ft-steel: #3B4450; --ft-amber: #B45300; --ft-signal: #C4141F; --ft-ok: #0A7A3B;
  color-scheme: light;
}
.ft-day .brand .ft-mark, .ft-day .lg-brand .ft-mark-lg { filter: invert(1) hue-rotate(180deg) saturate(1.4); }
.ft-day .thumb { background: #ddd; }
.ft-day .btn.on { color: #fff; }

@media (max-width: 640px) {
  .brand .ft-mark { height: 28px; }
  .brand .ft-sub { display: none; }
  .nav button { padding: 0 13px; min-height: 48px; }
  .kpi b { font-size: 38px; }
}
html.nomo .ft-enter > *, html.nomo .ft-wipe, html.nomo .ft-stamp div, html.nomo .tag.live::before, html.nomo .bcast::before, html.nomo .bcast::after { animation: none !important; }
@media (prefers-reduced-motion: reduce) {
  .ft-enter > *, .ft-wipe, .ft-stamp div, .tag.live::before, .bcast::before, .bcast::after { animation: none !important; }
  .bar i { transition: none; }
}

/* alert trains stay inside the screen at every text size (body zoom scales fixed elements too) */
.ftm-toasts { width: min(380px, calc((100vw - 28px) / var(--ftz, 1))); right: calc(14px / var(--ftz, 1)); }

/* ---------- phones: tabs at the bottom (thumb reach), compact top bar ---------- */
@media (max-width: 640px) {
  .spine { backdrop-filter: none; }
  .spine-top { padding-block: 8px 6px; gap: 6px 10px; }
  .spine-meta { gap: 4px; }
  .spine-meta .tag { font-size: 10px; padding: 4px 7px; min-height: 30px; letter-spacing: .08em; }
  .ft-ctl [data-skin="mode"] span { display: none; }
  .ft-ctl button { min-width: 34px; min-height: 30px; }
  .spine-meta .tag[title="Logged in as"] { max-width: 52vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; line-height: 20px; }
  .nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; background: var(--bg); border-top: 1px solid var(--line2);
         padding-bottom: env(safe-area-inset-bottom, 0px); box-shadow: 0 -8px 24px rgba(0,0,0,.45); }
  .nav button { flex: 1 0 auto; min-width: 74px; flex-direction: column; justify-content: center; gap: 4px; min-height: 60px;
                padding: 6px 6px; font-size: 9.5px; letter-spacing: .08em; border-right: 0; }
  .nav button svg { width: 20px; height: 20px; }
  .nav button[aria-current="true"] { box-shadow: inset 0 3px 0 var(--acc); }
  .nb { top: 4px; right: calc(50% - 22px); }
  body { padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 480px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kpis > .kpi:last-child:nth-child(odd) { grid-column: span 2; } }

/* daylight screen: the console panels (hero, go-live, stage board, work board, countdowns, alerts) turn light too */
.ft-day .spine, .ft-day .pnl, .ft-day .kpi, .ft-day .hero, .ft-day .hs, .ft-day .st, .ft-day .kcol, .ft-day .gg, .ft-day .tb,
.ft-day .cd, .ft-day .bdg, .ft-day .lg-in, .ft-day .cam-fab, .ft-day .pod, .ft-day .ntp { background: var(--bg) !important; }
.ft-day .hero::before { opacity: .35; }
.ft-day .kcol { background: var(--hover, #f2f2f2) !important; }
.ft-day .code { filter: brightness(.55) saturate(1.5); }
