/* WIB console. Visual system: ACP "Scandinavian" (data-style="scandi").
   Hierarchy comes from the alpha-black ink ladder and space; colour is for status only. */

:root,
:root[data-style="scandi"] {
  --bg: #fff;
  --surface: #fff;
  --raise: #fff;
  --fg: #000;
  --muted: rgb(0 0 0 / 64%);
  --tertiary: rgb(0 0 0 / 48%);
  --line: rgb(0 0 0 / 10%);
  --fill: rgb(0 0 0 / 4%);
  --fill-selected: rgb(0 0 0 / 9%);
  --accent: #000;
  --on-accent: #fff;
  --road: #000;
  --on-road: #fff;
  --future: rgb(0 0 0 / 24%);
  --alert: #b23c2a;
  --on-alert: #fff;
  --ok: #2e7a4c;
  --scrim: rgb(0 0 0 / 44%);

  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --display: var(--sans);
  --h1-weight: 600;
  --h1-track: -0.025em;
  --label-font: var(--sans);
  --label-size: 13px;
  --label-track: 0;
  --label-case: none;

  --r-btn: 8px;
  --r-card: 12px;
  --r-chip: 6px;
  --r-s: 6px;
  --r-m: 8px;
  --r-l: 12px;
  --r-xl: 16px;

  --pad: 56px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
}
button, input, textarea { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }

.label {
  font: 400 var(--label-size)/1.4 var(--label-font);
  letter-spacing: var(--label-track);
  text-transform: var(--label-case);
  color: var(--tertiary);
  margin: 0;
}
.muted { color: var(--muted); }
.tertiary { color: var(--tertiary); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 36px; padding: 0 16px;
  border-radius: var(--r-btn);
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 14px; font-weight: 500;
  cursor: pointer;
  transition: background .12s;
}
.btn:hover { background: var(--fill); }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); min-height: 44px; padding: 0 20px; }
.btn.primary:hover { background: rgb(0 0 0 / 82%); }
.btn.primary.alert { background: var(--alert); border-color: var(--alert); color: var(--on-alert); }
.btn:disabled, .btn.primary:disabled { background: var(--fill-selected); border-color: transparent; color: var(--tertiary); cursor: default; }
.btn.text { border: 0; background: none; padding: 0 8px; color: var(--muted); }
.btn.text:hover { color: var(--fg); background: none; }
.btn.option[aria-pressed="true"] { background: var(--fill-selected); border-color: var(--fg); }

.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--future); display: inline-block; }
.dot.alert { background: var(--alert); }
.dot.ok { background: var(--ok); }

/* ---------- app frame ---------- */
.app { display: grid; grid-template-rows: 56px 1fr; height: 100vh; min-height: 0; }

.titlebar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; border-bottom: 1px solid var(--line); background: var(--surface);
}
.titlebar .brand { display: flex; align-items: baseline; gap: 12px; }
.titlebar .brand strong { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.titlebar .actions { display: flex; align-items: center; gap: 4px; }

.customer {
  display: grid;
  grid-template-columns: 228px minmax(0, 1fr) 344px;
  min-height: 0;
}
.customer > * { min-height: 0; overflow-y: auto; }

/* ---------- rail ---------- */
.rail { padding: 24px 12px; border-right: 1px solid var(--line); }
.rail .label { padding: 0 12px 8px; }
.rail-group + .rail-group { margin-top: 28px; }
.rail-row {
  display: block; width: 100%; text-align: left;
  padding: 10px 12px; border: 0; background: none; border-radius: var(--r-card);
  cursor: pointer;
}
.rail-row:hover { background: var(--fill); }
.rail-row .name { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 15px; font-weight: 500; line-height: 1.35; }
.rail-row .meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.rail-row[aria-current="true"] { background: var(--fill); }
.segments { display: grid; gap: 2px; margin: 10px 0 6px; }
.segments i { height: 3px; border-radius: 2px; background: var(--line); }
.segments i.on { background: var(--road); }
.segments i.wait { background: var(--alert); }
.rail-row .caption { font-size: 13px; color: var(--tertiary); }

.inbox-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; }
.inbox-row .meta { grid-column: 1 / -1; }

/* ---------- center ---------- */
.center { padding: 40px var(--pad) 56px; }
.center-inner { max-width: 760px; }
.eyebrow { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 12px; }
h1.status {
  font: var(--h1-weight) 48px/1.1 var(--display);
  letter-spacing: var(--h1-track);
  margin: 0 0 12px;
}
h1.status .suffix { font-weight: 400; color: var(--tertiary); }
h1.status.blocked { color: var(--alert); }
h1.status.blocked .suffix { color: var(--tertiary); }
.lede { font-size: 15px; color: var(--muted); margin: 0 0 32px; }
.lede a { text-decoration-color: var(--line); text-underline-offset: 3px; }

h2.section { font: 600 20px/1.3 var(--sans); letter-spacing: -0.01em; margin: 40px 0 4px; }

/* notice */
.notice {
  background: var(--fill); border-radius: var(--r-card);
  padding: 24px; margin-bottom: 12px;
}
.notice h3 { font: 600 20px/1.35 var(--sans); letter-spacing: -0.01em; margin: 6px 0 6px; }
.notice p { margin: 0 0 4px; color: var(--muted); }
.notice .files { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; padding: 0; list-style: none; }
.notice .files li { font: 13px/1 var(--mono); padding: 6px 8px; border-radius: var(--r-chip); background: var(--surface); border: 1px solid var(--line); }
.notice .row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; align-items: center; }
.notice textarea {
  width: 100%; min-height: 88px; margin-top: 16px; padding: 12px;
  border: 1px solid var(--line); border-radius: var(--r-btn); background: var(--surface); resize: vertical;
}
.notice .sent { display: flex; align-items: center; gap: 8px; margin-top: 16px; color: var(--muted); font-size: 14px; }
.notice .error { color: var(--alert); font-size: 14px; margin-top: 12px; }

/* road */
.road { list-style: none; margin: 8px 0 0; padding: 0; }
.road li {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: start;
  padding: 14px 0; border-bottom: 1px solid var(--line);
}
.road .step-name { font-size: 15px; font-weight: 500; line-height: 1.4; }
.road .step-note { font-size: 13px; color: var(--muted); margin-top: 2px; }
.road .step-date { font-size: 13px; color: var(--tertiary); padding-left: 16px; white-space: nowrap; }
.mark {
  width: 20px; height: 20px; border-radius: 50%; margin-top: 1px;
  display: grid; place-items: center; font-size: 12px; font-weight: 600; line-height: 1;
  border: 1.5px solid var(--future);
}
.road .done .mark { background: var(--road); border-color: var(--road); color: var(--on-road); }
.road .waiting .mark { background: var(--alert); border-color: var(--alert); color: var(--on-alert); }
.road .waiting .step-name { font-weight: 600; }
.road .waiting .step-state { color: var(--alert); }
.road .active .mark, .road .decided .mark { border-color: var(--fg); }
.road .active .mark::after, .road .decided .mark::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--fg); }
.road .todo .step-name { color: var(--tertiary); }
.road .step-state { font-size: 13px; color: var(--muted); }

/* ---------- updates ---------- */
.updates { border-left: 1px solid var(--line); padding: 24px 28px 40px; }
.updates .head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.update { padding: 14px 0; border-top: 1px solid var(--line); }
.update:first-of-type { border-top: 0; }
.update time { display: block; font-size: 13px; color: var(--tertiary); margin-bottom: 4px; }
.update p {
  margin: 0; font-size: 14px; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.update.open p { -webkit-line-clamp: unset; display: block; }
.updates > .btn { margin-top: 8px; }
.update button { border: 0; background: none; padding: 0; margin-top: 4px; font-size: 13px; color: var(--tertiary); cursor: pointer; min-height: 0; }
.update button:hover { color: var(--fg); }

.empty { color: var(--tertiary); font-size: 14px; padding: 16px 0; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login form { width: 100%; max-width: 360px; }
.login h1 { font: var(--h1-weight) 34px/1.15 var(--display); letter-spacing: var(--h1-track); margin: 8px 0 32px; }
.field { display: block; margin-bottom: 16px; }
.field span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%; height: 44px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--r-btn); background: var(--surface);
}
.field input:focus { border-color: var(--fg); outline: none; }
.login .btn.primary { width: 100%; margin-top: 8px; }
.login .back { margin-top: 24px; }
.login .back a { color: inherit; text-underline-offset: 3px; text-decoration-color: var(--line); }
.login .error { color: var(--alert); font-size: 14px; min-height: 22px; margin: 12px 0 0; }

/* ---------- narrow screens ---------- */
@media (max-width: 1180px) {
  .customer { grid-template-columns: 224px minmax(0, 1fr); }
  .updates { grid-column: 2; border-left: 0; border-top: 1px solid var(--line); padding: 24px var(--pad); }
  .customer { overflow-y: auto; }
  .customer > * { overflow: visible; }
}
@media (max-width: 760px) {
  :root, :root[data-style="scandi"] { --pad: 16px; }
  .app { height: auto; }
  .titlebar { padding: 0 8px 0 16px; }
  .titlebar .brand strong { white-space: nowrap; }
  .titlebar .brand .label, #who { display: none; }
  .titlebar .btn.text { padding: 0 6px; font-size: 13px; }
  .customer { grid-template-columns: 1fr; }
  .rail { border-right: 0; border-bottom: 1px solid var(--line); padding: 16px 4px; }
  .updates { grid-column: 1; }
  .center { padding-top: 28px; }
  h1.status { font-size: 34px; }
}
