/* LeanFlow Shift 3D test page: full-screen scene with floating cards. */
:root {
  --navy: #0C1744;
  --ink: #1B2550;
  --muted: #5B6480;
  --faint: #8A91A8;
  --line: #E6E3DA;
  --orange: #F97316;
  --orange-strong: #C2410C;
  --orange-soft: #FFF1E6;
  --green: #15803D;
  --green-soft: #ECFDF3;
  --red: #B91C1C;
  --bg: #EEEDE9;
  --shadow: 0 1px 2px rgba(12, 23, 68, 0.05), 0 8px 24px rgba(12, 23, 68, 0.10);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; color: var(--ink); background: var(--bg); -webkit-user-select: none; user-select: none; }

.top {
  position: fixed; top: 0; left: 0; right: 0; height: 56px; z-index: 5;
  display: flex; align-items: center; gap: 12px; padding: 0 20px;
  background: rgba(255, 255, 255, 0.92); border-bottom: 1px solid var(--line);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.top .logo img { height: 24px; display: block; }
.top .title { font-weight: 700; color: var(--navy); }
.top .badge { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--orange-strong); background: var(--orange-soft); border-radius: 999px; padding: 4px 10px; }
.top .back { margin-left: auto; font-size: 14px; font-weight: 600; color: var(--orange-strong); text-decoration: none; }
.top .back:hover { color: var(--navy); }

#scene { position: fixed; top: 56px; left: 0; right: 0; bottom: 0; }
#scene canvas { display: block; touch-action: none; }
.loading { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); color: var(--muted); font-weight: 600; z-index: 1; }

.card { position: fixed; z-index: 4; background: #FFFFFF; border: 1px solid rgba(230, 227, 218, 0.8); border-radius: 14px; box-shadow: var(--shadow); }

/* KPI cards */
.kpis { position: fixed; top: 72px; left: 16px; z-index: 4; display: flex; gap: 10px; }
.kpi { position: static; display: flex; gap: 10px; align-items: center; padding: 10px 14px; min-width: 170px; }
.kpi-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 16px; }
.kpi-icon.orange { background: var(--orange-soft); color: var(--orange); }
.kpi-icon.navy { background: #E8EBF5; color: var(--navy); }
.kpi-icon.green { background: var(--green-soft); color: var(--green); }
.kpi-label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); }
.kpi strong { display: block; font-size: 20px; font-weight: 800; color: var(--navy); font-variant-numeric: tabular-nums; line-height: 1.2; }
.kpi-sub { display: block; font-size: 11px; color: var(--faint); }
.kpi-sub.up { color: var(--green); font-weight: 600; }
.kpi-sub.down { color: var(--red); font-weight: 600; }

/* Camera buttons */
.mapctl { top: 72px; right: 372px; display: flex; flex-direction: column; padding: 4px; }
.mapctl button { width: 34px; height: 34px; border: 0; background: none; font-size: 18px; color: var(--ink); cursor: pointer; border-radius: 8px; }
.mapctl button:hover { background: #F2F1EC; }

/* Right card */
.side { top: 72px; right: 16px; width: 340px; max-height: calc(100vh - 88px - 96px); overflow-y: auto; padding: 16px 18px; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--orange-strong); }
.side h2 { font-size: 20px; margin: 2px 0 8px; color: var(--navy); }
.side .close { position: absolute; top: 12px; right: 12px; border: 1px solid var(--line); background: #FFF; border-radius: 8px; width: 28px; height: 28px; cursor: pointer; color: var(--muted); }
.pill { display: inline-block; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 3px 10px; background: #F1F0EC; color: var(--muted); }
.pill.run { background: var(--orange-soft); color: var(--orange-strong); }
.pill.ok { background: var(--green-soft); color: var(--green); }
.pill.short { background: #FEF2F2; color: var(--red); }
.progress { height: 8px; border-radius: 999px; background: #F1F0EC; overflow: hidden; margin: 6px 0 2px; }
.progress span { display: block; height: 100%; background: var(--orange); transition: width 0.2s; }
.progress.done span { background: var(--green); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.mini { background: #FAF9F6; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.mini span { display: block; font-size: 11px; color: var(--muted); font-weight: 600; }
.mini strong { font-size: 18px; color: var(--navy); font-variant-numeric: tabular-nums; }
.side h3 { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin: 14px 0 6px; }
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid #F1F0EC; font-size: 14px; }
.steps li:last-child { border-bottom: 0; }
.steps .n { width: 22px; height: 22px; border-radius: 50%; background: var(--navy); color: #FFF; font-size: 11px; font-weight: 700; display: grid; place-items: center; flex-shrink: 0; }
.steps li.on .n { background: var(--orange); }
.steps li.on { font-weight: 700; color: var(--navy); }
.steps .where { margin-left: auto; font-size: 12px; color: var(--faint); }
.hint { font-size: 13px; color: var(--muted); margin: 12px 0 0; line-height: 1.5; }
.result { background: #FAF9F6; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 10px 0; }
.result strong { color: var(--navy); }
.result .up { color: var(--green); font-weight: 700; }
.result .down { color: var(--red); font-weight: 700; }
.kv { display: flex; justify-content: space-between; font-size: 14px; padding: 6px 0; border-bottom: 1px solid #F1F0EC; }
.kv span { color: var(--muted); }
.kv strong { color: var(--navy); }

/* Bottom-left tracker */
.tracker { left: 16px; bottom: 16px; padding: 12px 16px; min-width: 520px; }
.tracker .head { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 8px; }
.tracker .head strong { color: var(--navy); }
.tracker .head span { color: var(--muted); }
.track { display: flex; align-items: flex-start; }
.track .stop { flex: 1; text-align: center; position: relative; font-size: 12px; color: var(--muted); }
.track .stop::before { content: ''; position: absolute; top: 13px; left: -50%; right: 50%; height: 3px; background: #E6E3DA; z-index: 0; }
.track .stop:first-child::before { display: none; }
.track .stop.done::before, .track .stop.on::before { background: var(--orange); }
.track .dot { position: relative; z-index: 1; width: 28px; height: 28px; margin: 0 auto 4px; border-radius: 50%; background: #FFF; border: 3px solid #E6E3DA; display: grid; place-items: center; font-weight: 700; font-size: 12px; color: var(--muted); }
.track .stop.done .dot { background: var(--orange); border-color: var(--orange); color: #FFF; }
.track .stop.on .dot { border-color: var(--orange); color: var(--orange-strong); box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.18); }
.track .stop.on { color: var(--navy); font-weight: 700; }

/* Bottom-right controls */
.controls { right: 16px; bottom: 16px; display: flex; align-items: center; gap: 10px; padding: 10px 12px; flex-wrap: wrap; max-width: 600px; }
.btn-main, .btn-alt { font: inherit; font-size: 14px; font-weight: 700; border-radius: 10px; padding: 10px 16px; cursor: pointer; }
.btn-main { background: #EA580C; color: #FFF; border: 1px solid #EA580C; }
.btn-main:hover { background: var(--orange-strong); }
.btn-alt { background: #FFF; color: var(--navy); border: 1px solid #D4D0C4; }
.btn-link { font: inherit; font-size: 13px; font-weight: 600; color: var(--muted); background: none; border: 0; cursor: pointer; }
.btn-link:hover { color: var(--navy); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg button { font: inherit; font-size: 13px; font-weight: 600; border: 0; background: #FFF; color: var(--muted); padding: 6px 10px; cursor: pointer; }
.seg button.on { background: var(--navy); color: #FFF; }
.toggle { font-size: 13px; font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 6px; cursor: pointer; }
.toggle input { accent-color: var(--orange); }
[hidden] { display: none !important; }

/* Labels pinned to 3D positions */
.lbl {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  background: rgba(255, 255, 255, 0.95); border-radius: 999px; padding: 3px 9px 3px 3px;
  font: 700 11px 'Inter', sans-serif; color: var(--ink); box-shadow: 0 2px 6px rgba(12, 23, 68, 0.15);
  pointer-events: none; transition: background 0.15s, color 0.15s;
}
.lbl .n { width: 17px; height: 17px; border-radius: 50%; background: var(--navy); color: #FFF; display: grid; place-items: center; font-size: 10px; }
.lbl.plain { padding: 3px 9px; }
.lbl.on { background: var(--orange); color: #FFF; }
.lbl.on .n { background: #FFF; color: var(--orange-strong); }
.lbl.truck { font-size: 13px; padding: 4px 12px; }
.lbl.truck.done { background: var(--green); color: #FFF; }
.lbl.keep { background: rgba(255, 248, 220, 0.95); color: #7A5A00; padding: 3px 9px; }

.toast {
  position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%) translateY(20px); z-index: 6;
  background: var(--navy); color: #FFF; font-size: 14px; font-weight: 600; padding: 10px 16px; border-radius: 10px;
  opacity: 0; transition: opacity 0.2s, transform 0.2s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 1180px) {
  .tracker { display: none; }
  .kpi { min-width: 0; }
  .kpi-sub { display: none; }
}
@media (max-width: 900px) {
  .kpis { top: 64px; left: 8px; right: 8px; gap: 6px; }
  .kpi { flex: 1; padding: 6px 8px; gap: 6px; }
  .kpi-icon { display: none; }
  .kpi strong { font-size: 16px; }
  .mapctl { top: auto; bottom: 230px; right: 8px; }
  .side { top: auto; bottom: 76px; left: 8px; right: 8px; width: auto; max-height: 150px; padding: 10px 12px; }
  .side h2 { font-size: 16px; }
  .side .steps, .side h3, .side .row2 { display: none; }
  .controls { left: 8px; right: 8px; bottom: 8px; padding: 8px; gap: 6px; }
  .controls .toggle, .controls .btn-link { display: none; }
  .top .title { display: none; }
}

/* Change points and improvement cards */
.points { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--navy); }
.points span:first-child { margin-right: 4px; }
.pt { width: 13px; height: 13px; border-radius: 50%; border: 2px solid #FDBA8C; background: #FFF; }
.pt.on { background: var(--orange); border-color: var(--orange); }
.legend { font-size: 11px; color: var(--faint); margin: 3px 0 8px; }
.imps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.imp { font: inherit; text-align: left; display: flex; flex-direction: column; gap: 2px; background: #FAF9F6; border: 1px solid var(--line); border-radius: 10px; padding: 7px 8px; cursor: pointer; }
.imp strong { font-size: 12px; color: var(--navy); }
.imp span { font-size: 11px; color: var(--muted); line-height: 1.3; }
.imp em { font-style: normal; font-size: 11px; font-weight: 700; color: var(--orange-strong); }
.imp.on { border-color: var(--orange); background: var(--orange-soft); box-shadow: 0 0 0 1px var(--orange); }
.imp.done { opacity: 0.7; cursor: default; }
.imp.done em { color: var(--green); }
.imp:disabled { cursor: default; }
.hint.warn { color: #B45309; font-weight: 600; }
.btn-alt.small { padding: 7px 12px; font-size: 13px; }
.btn-alt:disabled, .btn-link:disabled { opacity: 0.45; cursor: not-allowed; }
.lbl.warn { background: var(--red); color: #FFF; padding: 3px 9px; }

/* Levels 2 and 3 */
.levels { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; margin-left: 8px; }
.levels button { font: inherit; font-size: 13px; font-weight: 600; border: 0; background: #FFF; color: var(--muted); padding: 6px 12px; cursor: pointer; }
.levels button.on { background: var(--navy); color: #FFF; }
.lbl.num { width: 20px; height: 20px; padding: 0; justify-content: center; font-size: 11px; color: #FFF; background: var(--orange); }
.lbl.num.worker2 { background: #7C3AED; }
.lbl.num.restocker { width: auto; height: auto; padding: 3px 9px; background: rgba(240, 253, 250, 0.95); color: #0F766E; }
.lbl.bubble { background: #FFF; color: var(--red); border: 2px solid var(--red); padding: 0 8px; font-size: 16px; line-height: 16px; letter-spacing: 1px; }
.lbl.empty { background: var(--red); color: #FFF; }
.lbl.empty .n { background: #FFF; color: var(--red); }
.side h3 .free { font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--faint); }
.splits { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 8px; }
.split { font: inherit; text-align: left; display: flex; flex-direction: column; gap: 1px; background: #FAF9F6; border: 1px solid var(--line); border-radius: 10px; padding: 6px 9px; cursor: pointer; font-size: 12px; font-weight: 600; }
.split .w1 { color: var(--orange-strong); }
.split .w2 { color: #6D28D9; }
.split.on { border-color: var(--navy); background: #FFF; box-shadow: 0 0 0 1px var(--navy); }
.steps li.w1 .n { background: var(--orange); }
.steps li.w2 .n { background: #7C3AED; }
.hint.teal { color: #0F766E; font-weight: 600; margin-top: 0; }
.mini small { font-size: 13px; color: #6D28D9; font-weight: 700; }
@media (max-width: 900px) { .levels button { padding: 5px 8px; font-size: 12px; } .top .badge { display: none; } }
