/* ============================================================
   Frai SCM — Live Demo (Slice 1)
   Standalone, on-brand with logistics.blap.dk (tactical dark
   ops-console). Palette mirrors site/style.css :root.
   ============================================================ */

:root {
  --bg:        #0a0b0d;
  --bg-1:      #0e1014;
  --panel:     #12151c;
  --panel-2:   #181c25;
  --line:      #242a34;
  --line-2:    #353d4a;
  --text:      #ccd1d9;
  --text-dim:  #888f9c;
  --text-faint:#565d6a;
  --amber:     #d97706;
  --amber-2:   #f59e0b;
  --green:     #35d6a4;
  --red:       #e5484d;
  --blue:      #5b8def;
  --amber-glow:rgba(217, 119, 6, 0.55);
  --grid:      rgba(150, 162, 178, 0.035);

  --mono:    'IBM Plex Mono', ui-monospace, 'Cascadia Mono', monospace;
  --display: 'Saira Condensed', 'Arial Narrow', sans-serif;

  --wrap: 980px;
  --pad: clamp(18px, 4vw, 40px);

  /* Per-persona accent — swapped by [data-persona] below. */
  --accent: var(--amber);
  --accent-glow: rgba(217, 119, 6, 0.45);
}

body[data-persona="node"]   { --accent: var(--amber); --accent-glow: rgba(217,119,6,0.45); }
body[data-persona="hub"]    { --accent: var(--green); --accent-glow: rgba(53,214,164,0.40); }
body[data-persona="france"] { --accent: var(--blue);  --accent-glow: rgba(91,141,239,0.45); }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(150,162,178,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(150,162,178,0.035) 1px, transparent 1px);
  background-size: 72px 72px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* accent glow that re-tints with the active persona */
body::before {
  content: "";
  position: fixed;
  top: -26vh; left: 50%;
  width: 1100px; height: 700px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, var(--accent-glow), transparent 64%);
  opacity: 0.5;
  pointer-events: none;
  transition: background 0.5s ease;
  z-index: 0;
}

button { font-family: var(--mono); cursor: pointer; }
::selection { background: var(--accent); color: #0a0b0d; }

/* ============================ TOP BAR ============================ */

.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 18px;
  padding: 12px var(--pad);
  background: rgba(10,11,13,0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.brand-mark {
  width: 16px; height: 16px;
  background: var(--accent);
  transform: rotate(45deg);
  box-shadow: 0 0 12px var(--accent-glow);
  transition: background 0.4s ease, box-shadow 0.4s ease;
}
.brand-name { font-family: var(--display); font-weight: 700; letter-spacing: 0.06em; font-size: 19px; }
.brand-dim { color: var(--text-faint); font-weight: 600; }

.progress { list-style: none; display: flex; gap: 6px; flex: 1; justify-content: center; flex-wrap: wrap; }
.progress li {
  font-family: var(--display); font-weight: 600; font-size: 11px; letter-spacing: 0.08em;
  color: var(--text-faint);
  padding: 3px 9px; border: 1px solid var(--line); border-radius: 2px;
  white-space: nowrap; transition: all 0.25s ease;
}
.progress li.done   { color: var(--text-dim); border-color: var(--line-2); }
.progress li.active { color: #0a0b0d; background: var(--accent); border-color: var(--accent); box-shadow: 0 0 10px var(--accent-glow); }

.topbar-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.persona-tag {
  font-family: var(--display); font-weight: 600; font-size: 12px; letter-spacing: 0.06em;
  color: var(--accent); border: 1px solid var(--accent); border-radius: 2px; padding: 3px 9px;
}
.data-mode {
  font-size: 11px; letter-spacing: 0.05em; color: var(--text-faint);
  border: 1px solid var(--line); border-radius: 2px; padding: 3px 8px; cursor: help;
}
.data-mode.live { color: var(--green); border-color: var(--green); }
.v2-link { font-family: var(--display); font-weight: 700; letter-spacing: 0.06em; font-size: 13px;
  color: #0a0b0d; background: var(--amber-2); border-radius: 3px; padding: 5px 11px; transition: all 0.18s ease; }
.v2-link:hover { box-shadow: 0 0 14px var(--amber-glow); transform: translateY(-1px); }

/* ============================ STAGE ============================ */

.stage {
  position: relative; z-index: 1;
  max-width: var(--wrap); margin: 0 auto;
  padding: clamp(28px, 5vh, 64px) var(--pad) 80px;
}
.step { animation: rise 0.5s cubic-bezier(.2,.7,.3,1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.kicker {
  font-family: var(--display); font-weight: 600; letter-spacing: 0.16em; font-size: 12px;
  color: var(--accent); text-transform: uppercase; margin-bottom: 10px;
}
.headline { font-family: var(--display); font-weight: 700; font-size: clamp(28px, 5vw, 46px); line-height: 1.04; letter-spacing: 0.01em; }
.sub { color: var(--text-dim); max-width: 64ch; margin-top: 12px; }

.panel {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: 4px;
  padding: 20px 22px;
}
.panel + .panel, .panel.mt { margin-top: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

/* key-value rows */
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 14px; margin-top: 6px; }
.kv dt { color: var(--text-faint); font-size: 13px; }
.kv dd { color: var(--text); font-weight: 500; }
.mono-id { color: var(--amber-2); }

/* status pills */
.pill { display: inline-block; font-family: var(--display); font-weight: 600; letter-spacing: 0.05em;
  font-size: 12px; padding: 2px 9px; border-radius: 2px; border: 1px solid var(--line-2); }
.pill.ok   { color: var(--green); border-color: var(--green); }
.pill.bad  { color: var(--red);   border-color: var(--red); animation: blink 1s steps(2) infinite; }
.pill.warn { color: var(--amber-2); border-color: var(--amber-2); }
@keyframes blink { 50% { opacity: 0.35; } }

/* ============================ UNIT / CARDS ============================ */

.choice-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 28px; }
.choice {
  text-align: left; background: var(--panel); border: 1px solid var(--line);
  border-radius: 4px; padding: 20px; color: var(--text); transition: all 0.2s ease;
  display: flex; flex-direction: column; gap: 8px; min-height: 168px;
}
.choice:enabled:hover { border-color: var(--accent); transform: translateY(-3px); box-shadow: 0 10px 30px rgba(0,0,0,0.4); }
.choice:disabled { opacity: 0.4; cursor: not-allowed; }
.choice-flag { font-size: 30px; }
.choice-name { font-family: var(--display); font-weight: 700; font-size: 20px; }
.choice-meta { color: var(--text-dim); font-size: 13px; }
.choice-tag { margin-top: auto; font-size: 11px; letter-spacing: 0.06em; color: var(--accent);
  border: 1px solid var(--accent); border-radius: 2px; padding: 2px 7px; align-self: flex-start; }
.choice-tag.soon { color: var(--text-faint); border-color: var(--line-2); }

/* telemetry uplink */
.uplink { display: flex; align-items: center; gap: 12px; }
.uplink-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent-glow); animation: ping 1.8s ease-out infinite; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 var(--accent-glow); } 70% { box-shadow: 0 0 0 12px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

.scan { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; margin-top: 14px; }
.scan > span { display: block; height: 100%; width: 40%; background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: sweep 1.1s linear infinite; }
@keyframes sweep { from { transform: translateX(-120%); } to { transform: translateX(320%); } }

/* analysis thinking dots */
.thinking { display: inline-flex; gap: 5px; vertical-align: middle; }
.thinking i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: bob 1s ease-in-out infinite; }
.thinking i:nth-child(2) { animation-delay: 0.15s; }
.thinking i:nth-child(3) { animation-delay: 0.3s; }
@keyframes bob { 0%,100% { opacity: 0.3; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-4px); } }

/* sourcing nation rows */
.nation { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); }
.nation:first-child { border-top: 0; }
.nation .flag { font-size: 22px; }
.nation .who { flex: 1; }
.nation .who b { font-family: var(--display); font-size: 16px; font-weight: 600; }
.nation .who small { display: block; color: var(--text-faint); font-size: 12px; }
.nation.elig { background: rgba(91,141,239,0.06); margin: 0 -22px; padding: 11px 22px; }
.nation.elig b { color: var(--blue); }

/* quantity stepper */
.qty { display: flex; align-items: center; gap: 14px; margin-top: 18px; }
.qty button { width: 44px; height: 44px; font-size: 22px; background: var(--panel); color: var(--text);
  border: 1px solid var(--line-2); border-radius: 4px; }
.qty button:hover { border-color: var(--accent); color: var(--accent); }
.qty output { font-family: var(--display); font-weight: 700; font-size: 40px; min-width: 64px; text-align: center; color: var(--accent); }
.hint { color: var(--text-dim); font-size: 13px; margin-top: 10px; }
.hint b { color: var(--amber-2); }

/* the two udbud */
.udbud { display: flex; gap: 12px; align-items: flex-start; }
.udbud .num { font-family: var(--display); font-weight: 700; font-size: 26px; color: var(--accent); line-height: 1; }
.udbud-done { color: var(--green); font-weight: 600; }

/* before / after payoff */
.beforeafter { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 10px; }
.ba { padding: 18px; border-radius: 4px; border: 1px solid var(--line); }
.ba.before { background: rgba(229,72,77,0.06); border-color: rgba(229,72,77,0.4); }
.ba.after  { background: rgba(53,214,164,0.06); border-color: rgba(53,214,164,0.4); }
.ba h4 { font-family: var(--display); font-size: 16px; letter-spacing: 0.06em; margin-bottom: 10px; }
.ba.before h4 { color: var(--red); }
.ba.after h4  { color: var(--green); }
.bar { height: 10px; border-radius: 5px; background: var(--line); overflow: hidden; margin: 8px 0 4px; }
.bar > span { display: block; height: 100%; border-radius: 5px; }
.bar.r > span { background: var(--red); }
.bar.g > span { background: var(--green); }

/* ============================ ACTIONS ============================ */

.actions { margin-top: 28px; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.btn {
  font-family: var(--display); font-weight: 700; letter-spacing: 0.05em; font-size: 15px;
  padding: 12px 22px; border-radius: 3px; border: 1px solid var(--accent);
  background: var(--accent); color: #0a0b0d; transition: all 0.18s ease;
}
.btn:hover { box-shadow: 0 0 18px var(--accent-glow); transform: translateY(-1px); }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.ghost:hover { background: rgba(255,255,255,0.04); }
.btn:disabled { opacity: 0.5; cursor: default; transform: none; box-shadow: none; }

/* ============================ PERSONA OVERLAY ============================ */

.persona-overlay {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: rgba(6,7,9,0.0);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity 0.35s ease, background 0.35s ease;
}
.persona-overlay.show { opacity: 1; visibility: visible; background: rgba(6,7,9,0.92); }
.persona-card {
  position: relative; text-align: center; padding: 40px clamp(28px, 7vw, 80px);
  border: 1px solid var(--accent); border-radius: 6px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  box-shadow: 0 0 60px var(--accent-glow);
  transform: scale(0.9) translateY(10px); transition: transform 0.4s cubic-bezier(.2,.8,.2,1);
  overflow: hidden;
}
.persona-overlay.show .persona-card { transform: none; }
.persona-kicker { font-family: var(--display); font-weight: 600; letter-spacing: 0.22em; font-size: 12px; color: var(--text-faint); }
.persona-flag { display: block; font-size: 72px; margin: 14px 0 6px; }
.persona-name { font-family: var(--display); font-weight: 700; font-size: clamp(26px, 5vw, 44px); letter-spacing: 0.04em; color: var(--accent); }
.persona-role { color: var(--text-dim); margin-top: 6px; letter-spacing: 0.04em; }
.persona-sweep { position: absolute; top: 0; left: -60%; width: 40%; height: 100%;
  background: linear-gradient(90deg, transparent, var(--accent-glow), transparent); }
.persona-overlay.show .persona-sweep { animation: psweep 0.9s ease-out 0.2s; }
@keyframes psweep { from { left: -60%; } to { left: 120%; } }

/* ============================ FOOT ============================ */

.foot {
  position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px var(--pad); border-top: 1px solid var(--line);
  color: var(--text-faint); font-size: 12px;
}
.real-toggle { background: transparent; border: 1px solid var(--line); color: var(--text-faint);
  width: 30px; height: 30px; border-radius: 3px; font-size: 14px; opacity: 0.5; transition: all 0.2s ease; }
.real-toggle:hover { opacity: 1; color: var(--accent); border-color: var(--accent); }
body[data-mode="real"] .real-toggle { opacity: 1; color: var(--red); border-color: var(--red); }
.real-banner { background: rgba(229,72,77,0.1); border: 1px solid var(--red); color: var(--red);
  border-radius: 3px; padding: 12px 16px; margin-bottom: 22px; font-size: 13px; line-height: 1.55; }
.real-banner b { font-family: var(--display); letter-spacing: 0.05em; }
.real-banner em { color: var(--amber-2); font-style: normal; }
.real-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.btn.small { font-size: 13px; padding: 7px 14px; }
.real-banner .btn { border-color: var(--red); }
.real-banner .btn:not(.ghost) { background: var(--red); color: #0a0b0d; }
.real-banner .btn.ghost { color: var(--red); background: transparent; }
.real-out { display: block; margin-top: 8px; color: var(--text-dim); font-size: 12px; }

.foot-right { display: flex; align-items: center; gap: 14px; }
.foot-link { color: var(--text-dim); border-bottom: 1px dotted var(--line-2); transition: color 0.2s ease; }
.foot-link:hover { color: var(--accent); }

/* ============================ SCORE / RATING ============================ */

.scoreboard { display: flex; gap: 22px; flex-wrap: wrap; margin-top: 8px; }
.score { display: flex; flex-direction: column; }
.score b { font-family: var(--display); font-weight: 700; font-size: 30px; color: var(--accent); line-height: 1; }
.score small { color: var(--text-faint); font-size: 12px; letter-spacing: 0.04em; margin-top: 4px; }

.rating {
  display: inline-flex; align-items: baseline; gap: 10px; margin-top: 6px;
  font-family: var(--display); font-weight: 700;
}
.rating .grade { font-size: 44px; color: var(--green); }
.rating .lede { color: var(--text-dim); font-weight: 600; letter-spacing: 0.05em; font-size: 13px; }

/* bars animate from 0 → target via the inline --w custom prop */
.bar > span { width: 0; transition: width 1.1s cubic-bezier(.2,.8,.2,1); }
.bar.fill > span { width: var(--w); }

/* ============================ TOAST ============================ */

#toasts {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  font-family: var(--display); font-weight: 600; letter-spacing: 0.03em; font-size: 14px;
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--accent); border-left-width: 3px;
  border-radius: 3px; padding: 9px 16px; box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  animation: toastIn 0.3s ease both, toastOut 0.4s ease 2.4s both;
}
@keyframes toastIn  { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-8px); } }

/* ============================ ACCESS GATE ============================ */
/* Same gate as the showcase (site/style.css), code "glaucus". */

html:not(.authed) { overflow: hidden; }
.authed #gate { display: none; }

.gate {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse at 50% 36%, rgba(217,119,6,0.14), transparent 62%),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: auto, 72px 72px, 72px 72px;
  transition: opacity 0.35s ease;
}
.gate.gate--out { opacity: 0; }
.gate-panel {
  position: relative; width: min(440px, 100%);
  border: 1px solid var(--line-2);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  padding: 40px 38px 36px; text-align: center;
}
.gate-panel::before, .gate-panel::after { content: ""; position: absolute; width: 16px; height: 16px; }
.gate-panel::before { top: -1px; left: -1px; border-top: 2px solid var(--amber); border-left: 2px solid var(--amber); }
.gate-panel::after { bottom: -1px; right: -1px; border-bottom: 2px solid var(--amber); border-right: 2px solid var(--amber); }
.gate-mark { display: inline-block; width: 15px; height: 15px; background: var(--amber);
  transform: rotate(45deg); box-shadow: 0 0 16px var(--amber-glow); margin-bottom: 22px; }
.gate-kicker { font-size: 11px; letter-spacing: 0.15em; color: var(--amber-2); margin-bottom: 14px; }
.gate-title { font-family: var(--display); font-weight: 700; font-size: 1.55rem; letter-spacing: 0.1em; margin-bottom: 8px; }
.gate-title .brand-dim { color: var(--text-faint); }
.gate-sub { font-size: 12.5px; color: var(--text-dim); margin-bottom: 26px; }
.gate-form { display: flex; flex-direction: column; gap: 10px; }
.gate-input { width: 100%; background: var(--bg-1); border: 1px solid var(--line-2); color: var(--text);
  font-family: var(--mono); font-size: 14px; letter-spacing: 0.22em; text-align: center;
  padding: 13px 14px; outline: none; transition: border-color 0.18s; }
.gate-input::placeholder { color: var(--text-faint); letter-spacing: 0.16em; }
.gate-input:focus { border-color: var(--amber); }
.gate-btn { width: 100%; background: var(--amber); color: #140a02; border: none;
  font-family: var(--mono); font-weight: 600; font-size: 12px; letter-spacing: 0.14em;
  text-transform: uppercase; padding: 13px 14px; cursor: pointer; transition: background 0.18s; }
.gate-btn:hover { background: var(--amber-2); }
.gate-error { margin-top: 16px; font-size: 12px; color: #ef8164; letter-spacing: 0.03em; }
@keyframes shake { 0%,100% { transform: translateX(0); } 20%,60% { transform: translateX(-7px); } 40%,80% { transform: translateX(7px); } }
.gate-panel.shake { animation: shake 0.4s ease; }

/* ============================ RESPONSIVE ============================ */

@media (max-width: 760px) {
  .progress { display: none; }
  .grid2, .grid3, .choice-grid, .beforeafter { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 110px 1fr; }
}
