/* =========================================================================
   WMS / 3PL Logistics UI — Industrial design system
   Theme: slate/steel neutrals + safety-amber accent, high-contrast, dense.
   One stylesheet drives all surfaces; form factor set via <body class="ff-*">.
   ========================================================================= */

:root {
  /* core palette */
  --bg:        #0f1620;
  --surface:   #1b2433;
  --surface-2: #232f42;
  --surface-3: #2b3a52;
  --border:    #2e3d54;
  --border-2:  #3b4d68;
  --text:      #e7edf5;
  --muted:     #93a4bd;
  --faint:     #647189;

  /* brand / status */
  --accent:    #f5a524;  /* safety amber */
  --accent-d:  #c77f12;
  --ok:        #2dd4a7;  /* jade-mint */
  --warn:      #ef5350;  /* alert red */
  --info:      #4aa3ff;  /* sky */
  --violet:    #a78bfa;

  /* occupancy heat ramp (empty -> full) */
  --heat-0: #1e2a3d;
  --heat-1: #1f5d50;
  --heat-2: #2e8f5b;
  --heat-3: #c9a227;
  --heat-4: #d9762e;
  --heat-5: #cf3b3b;

  --radius:   10px;
  --radius-s: 7px;
  --radius-l: 16px;
  --gap: 16px;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --shadow-s: 0 2px 8px rgba(0,0,0,.30);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: #070b11;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  display: flex; justify-content: center; align-items: flex-start;
  padding: 0;
}

/* ---- device viewports (exact sizes; screenshot window matches) ---------- */
.app { background: var(--bg); position: relative; overflow: hidden; display: flex; }
.ff-web    .app { width: 1440px; height: 900px; }
.ff-tablet .app { width: 1180px; height: 820px; }
.ff-phone  .app { width: 390px;  height: 844px; flex-direction: column; }

/* =========================================================================
   APP SHELL — sidebar (web/tablet) + topbar + content
   ========================================================================= */
.sidebar {
  width: 232px; flex: 0 0 232px; background: var(--surface);
  border-right: 1px solid var(--border); display: flex; flex-direction: column;
}
.ff-tablet .sidebar { width: 200px; flex-basis: 200px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 16px;
  border-bottom: 1px solid var(--border); }
.brand .logo { width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-d));
  display: grid; place-items: center; color: #1a1206; font-weight: 800; font-size: 16px; }
.brand .name { font-weight: 700; letter-spacing: .2px; font-size: 15px; }
.brand .name small { display: block; color: var(--faint); font-weight: 500; font-size: 10.5px;
  letter-spacing: .12em; text-transform: uppercase; }

.nav { padding: 10px 10px; overflow-y: auto; flex: 1; }
.nav .group { color: var(--faint); font-size: 10px; letter-spacing: .14em;
  text-transform: uppercase; padding: 14px 12px 6px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 8px;
  color: var(--muted); text-decoration: none; font-size: 13.5px; font-weight: 500; margin-bottom: 2px; }
.nav a .ic { width: 18px; text-align: center; opacity: .9; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--surface-3); color: var(--text); }
.nav a.active .ic { color: var(--accent); }
.nav a .tag { margin-left: auto; background: var(--warn); color: #fff; font-size: 10.5px;
  font-weight: 700; border-radius: 20px; padding: 1px 7px; }
.sidebar .me { border-top: 1px solid var(--border); padding: 12px 16px; display: flex;
  align-items: center; gap: 10px; font-size: 12.5px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--surface-3);
  display: grid; place-items: center; font-weight: 700; color: var(--accent); font-size: 12px; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { height: 60px; flex: 0 0 60px; border-bottom: 1px solid var(--border);
  background: var(--surface); display: flex; align-items: center; gap: 16px; padding: 0 22px; }
.topbar h1 { font-size: 17px; font-weight: 700; margin: 0; }
.topbar .crumb { color: var(--faint); font-size: 12.5px; }
.topbar .spacer { flex: 1; }
.search { background: var(--bg); border: 1px solid var(--border); border-radius: 9px;
  padding: 8px 12px; color: var(--muted); font-size: 13px; display: flex; align-items: center;
  gap: 8px; min-width: 240px; }
.content { flex: 1; overflow-y: auto; padding: 22px; }
.content.pad-lg { padding: 26px; }

/* =========================================================================
   PRIMITIVES
   ========================================================================= */
.btn { font-family: var(--font); font-size: 13px; font-weight: 600; border-radius: 9px;
  padding: 9px 15px; border: 1px solid var(--border-2); background: var(--surface-2);
  color: var(--text); cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.btn:hover { background: var(--surface-3); }
.btn--primary { background: var(--accent); color: #1a1206; border-color: var(--accent); }
.btn--ok { background: var(--ok); color: #062019; border-color: var(--ok); }
.btn--danger { background: transparent; color: var(--warn); border-color: var(--warn); }
.btn--ghost { background: transparent; }
.btn--lg { padding: 13px 20px; font-size: 14.5px; border-radius: 11px; }
.btn--block { width: 100%; justify-content: center; }
.btn--xl { padding: 18px; font-size: 16px; font-weight: 700; }

.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700;
  padding: 3px 10px; border-radius: 30px; letter-spacing: .02em; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill--ok    { color: var(--ok);    background: rgba(45,212,167,.12); }
.pill--warn  { color: var(--warn);  background: rgba(239,83,80,.13); }
.pill--info  { color: var(--info);  background: rgba(74,163,255,.13); }
.pill--amber { color: var(--accent);background: rgba(245,165,36,.14); }
.pill--muted { color: var(--muted); background: rgba(147,164,189,.12); }
.pill--violet{ color: var(--violet);background: rgba(167,139,250,.14); }
.pill.no-dot::before { display: none; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-s); }
.card .hd { padding: 15px 18px; border-bottom: 1px solid var(--border); display: flex;
  align-items: center; gap: 10px; }
.card .hd h3 { margin: 0; font-size: 14.5px; font-weight: 700; }
.card .hd .spacer { flex: 1; }
.card .bd { padding: 18px; }
.card .bd.flush { padding: 0; }

.grid { display: grid; gap: var(--gap); }
.row { display: flex; gap: var(--gap); }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono { font-family: var(--mono); }
.amber { color: var(--accent); }
.ok { color: var(--ok); }
.warn { color: var(--warn); }
.right { text-align: right; }
.center { text-align: center; }

/* stat tiles */
.stats { display: grid; grid-template-columns: repeat(4,1fr); gap: var(--gap); }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; }
.stat .k { color: var(--muted); font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 7px; }
.stat .v { font-size: 30px; font-weight: 800; margin-top: 8px; letter-spacing: -.5px; }
.stat .d { font-size: 11.5px; margin-top: 4px; }
.stat .ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  font-size: 15px; background: var(--surface-3); }

/* tables */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; color: var(--faint); font-weight: 600; font-size: 11px;
  letter-spacing: .06em; text-transform: uppercase; padding: 11px 14px; border-bottom: 1px solid var(--border); }
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--border); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr:hover td { background: var(--surface-2); }
.tbl td.num, .tbl th.num { text-align: right; font-family: var(--mono); }

/* forms */
.field { margin-bottom: 15px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.input, select.input, textarea.input { width: 100%; background: var(--bg); border: 1px solid var(--border-2);
  border-radius: 9px; padding: 11px 13px; color: var(--text); font-size: 13.5px; font-family: var(--font); }
.input::placeholder { color: var(--faint); }
.input:focus { outline: none; border-color: var(--accent); }
.field .hint { font-size: 11px; color: var(--faint); margin-top: 5px; }
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--border-2); border-radius: 9px; padding: 3px; }
.seg button { border: 0; background: transparent; color: var(--muted); font-weight: 600; font-size: 12.5px;
  padding: 7px 13px; border-radius: 7px; cursor: pointer; }
.seg button.on { background: var(--accent); color: #1a1206; }

/* progress / occupancy bar */
.bar { height: 8px; border-radius: 20px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 20px; background: var(--accent); }
.bar.ok > i { background: var(--ok); }
.bar.warn > i { background: var(--warn); }

/* list rows (work queue / mobile lists) */
.list { display: flex; flex-direction: column; }
.li { display: flex; align-items: center; gap: 13px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.li:last-child { border-bottom: 0; }
.li .lead { width: 40px; height: 40px; border-radius: 9px; background: var(--surface-3);
  display: grid; place-items: center; font-size: 17px; flex: 0 0 40px; }
.li .ti { font-weight: 650; font-size: 13.5px; }
.li .su { color: var(--muted); font-size: 12px; margin-top: 2px; }
.li .end { margin-left: auto; text-align: right; }

/* =========================================================================
   WAREHOUSE MAP — zone/aisle/bin grid with occupancy heatmap
   ========================================================================= */
.wh-map { display: flex; flex-direction: column; gap: 14px; }
.zone { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.zone .zh { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.zone .zh b { font-size: 13.5px; } .zone .zh .muted { font-size: 11.5px; }
.aisles { display: flex; flex-direction: column; gap: 8px; }
.aisle { display: flex; align-items: center; gap: 8px; }
.aisle .alab { width: 54px; flex: 0 0 54px; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.bins { display: flex; gap: 5px; flex-wrap: wrap; }
.bin { width: 30px; height: 26px; border-radius: 5px; display: grid; place-items: center;
  font-size: 8.5px; font-family: var(--mono); color: rgba(255,255,255,.78); cursor: pointer;
  border: 1px solid rgba(0,0,0,.25); }
.bin.h0 { background: var(--heat-0); color: var(--faint); }
.bin.h1 { background: var(--heat-1); } .bin.h2 { background: var(--heat-2); }
.bin.h3 { background: var(--heat-3); color:#1a1206; } .bin.h4 { background: var(--heat-4); }
.bin.h5 { background: var(--heat-5); }
.bin.sel { outline: 3px solid var(--accent); outline-offset: 1px; }
.legend { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--muted); }
.legend .sw { width: 16px; height: 12px; border-radius: 3px; }

/* =========================================================================
   CUSTODY TIMELINE — vertical track of events (track & trace)
   ========================================================================= */
.timeline { position: relative; padding-left: 28px; }
.timeline::before { content: ""; position: absolute; left: 9px; top: 6px; bottom: 6px;
  width: 2px; background: var(--border-2); }
.tl { position: relative; padding: 0 0 22px 6px; }
.tl::before { content: ""; position: absolute; left: -23px; top: 3px; width: 14px; height: 14px;
  border-radius: 50%; background: var(--surface); border: 3px solid var(--accent); }
.tl.done::before { background: var(--ok); border-color: var(--ok); }
.tl.now::before  { background: var(--accent); border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(245,165,36,.2); }
.tl .ev { font-weight: 650; font-size: 13.5px; }
.tl .meta { color: var(--muted); font-size: 12px; margin-top: 3px; line-height: 1.5; }
.tl .ts { color: var(--faint); font-family: var(--mono); font-size: 11px; }

/* scan bar (handheld) */
.scanbar { background: var(--surface-2); border: 1.5px dashed var(--border-2); border-radius: 12px;
  padding: 16px; display: flex; align-items: center; gap: 14px; }
.scanbar .qi { width: 46px; height: 46px; border-radius: 10px; background: var(--bg);
  display: grid; place-items: center; font-size: 22px; }

/* =========================================================================
   PHONE chrome — status bar + bottom nav
   ========================================================================= */
.ff-phone .app { border-radius: 0; }
.statusbar { height: 30px; flex: 0 0 30px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px; font-size: 12px; font-weight: 600; background: var(--surface); }
.phone-top { padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; }
.phone-top h1 { font-size: 16px; margin: 0; font-weight: 700; }
.phone-body { flex: 1; overflow-y: auto; padding: 16px; }
.botnav { height: 64px; flex: 0 0 64px; background: var(--surface); border-top: 1px solid var(--border);
  display: flex; }
.botnav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--faint); text-decoration: none; font-size: 10.5px; font-weight: 600; }
.botnav a .ic { font-size: 19px; }
.botnav a.active { color: var(--accent); }

/* misc helpers */
.divider { height: 1px; background: var(--border); margin: 14px 0; }
.kpi-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; font-size: 12px; }
.tag-lpn { font-family: var(--mono); background: rgba(245,165,36,.12); color: var(--accent);
  padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; }
.owner-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.note { background: var(--surface-2); border-left: 3px solid var(--accent); border-radius: 6px;
  padding: 10px 13px; font-size: 12.5px; color: var(--muted); }
h2.sec { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint);
  margin: 4px 0 12px; font-weight: 700; }
