/* ============================================================================
   Stepline MES — design system
   Extracted from the product mockups (Documents/mes-*.html). Dark theme only in
   Phase 1 — matches the shop floor. Fonts are self-hosted (offline / on-prem).
   ========================================================================= */

@font-face {
  font-family: 'Archivo';
  src: url('/fonts/archivo-var.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('/fonts/jetbrains-mono-var.woff2') format('woff2-variations');
  font-weight: 100 800;
  font-display: swap;
}

:root {
  /* Surface ladder — each step is a visibly distinct value so containers read
     apart from their contents without borders doing all the work. */
  --bg: #10151a;
  --panel: #171e24;          /* sidebar, table headers, sunken sections */
  --panel-raised: #1e262d;   /* cards, panels — clearly above --panel */
  --panel-sunken: #0d1216;   /* inputs, NOTE wells — below --bg */
  --line: #2c3740;
  --line-soft: #222a31;
  --line-2: #3b4a55;         /* stronger: control borders, focus */

  --text: #eef2f5;
  --text-dim: #adb8c1;       /* ~8:1 on a panel */
  --text-faint: #7d8b95;     /* ~4.4:1 on a panel — was ~2.7:1 */

  --amber: #eaa63c;
  --amber-hi: #f2b658;       /* primary-button hover */
  --amber-ink: #1c1305;      /* text on an amber fill */
  --amber-dim: #3c3019;
  --green: #4fb98a;
  --green-dim: #173026;
  --red: #eb6b70;
  --red-dim: #351d1f;
  --blue: #64a4de;
  --blue-dim: #182a3a;
  --purple: #b199e6;
  --purple-dim: #2a2438;

  --radius: 6px;

  --space-1: 4px;  --space-2: 8px;  --space-3: 12px; --space-4: 16px;
  --space-5: 20px; --space-6: 24px; --space-8: 32px; --space-10: 40px;

  --font-sans: 'Archivo', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; font-weight: 700; margin: 0 0 12px; }
/* <FocusOnNavigate> moves focus to the h1 on every navigation for screen-reader users;
   it's not a tab stop, so suppress the focus ring for everyone else. */
h1:focus, h1:focus-visible { outline: none; }
h2 { font-size: 16px; font-weight: 700; margin: 24px 0 10px; }
code, .mono { font-family: var(--font-mono); }

/* ---- app shell ---------------------------------------------------------- */
.mes-shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
@media (max-width: 820px) { .mes-shell { grid-template-columns: 1fr; } }

.mes-body { display: flex; flex-direction: column; min-height: 100vh; min-width: 0; }

.mes-sidebar {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 14px 0;
}
.mes-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 18px 14px;
  font-weight: 700; font-size: 14.5px;
}
.mes-brand-mark {
  width: 26px; height: 26px; border-radius: 6px;
  background: linear-gradient(135deg, var(--amber), #b9781f);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px; color: var(--amber-ink);
}

.mes-nav { display: flex; flex-direction: column; }
.mes-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 18px; font-size: 12.5px; color: var(--text-dim);
  border-left: 2px solid transparent;
}
.mes-nav a:hover { background: rgba(255,255,255,0.025); color: var(--text); text-decoration: none; }
.mes-nav a.active { border-left-color: var(--amber); color: var(--amber); background: rgba(234,166,60,0.08); }
.mes-nav a svg { width: 16px; height: 16px; flex: none; }

.nav-group { padding: 10px 0 2px; }
.nav-group + .nav-group { border-top: 1px solid var(--line-soft); }
.nav-group-label {
  font-size: 10px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase;
  color: var(--text-faint); padding: 0 18px 6px;
}
.nav-group:not(:has(a)) { display: none; }

.mes-main { padding: 26px 30px 50px; max-width: 1100px; margin-inline: auto; flex: 1; width: 100%; }

/* Slim application bar — page context on the left, environment + user on the right. */
.mes-appbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: 52px; padding: 0 24px; flex: none;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.mes-appbar-l { flex: 1; min-width: 0; }
.mes-appbar-r { display: flex; align-items: center; gap: 16px; flex: none; }

.mes-crumbs { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-faint); overflow: hidden; }
.mes-crumbs a { color: var(--text-dim); white-space: nowrap; }
.mes-crumbs a:hover { color: var(--text); text-decoration: none; }
.mes-crumbs .sep { color: var(--line-2); flex: none; }
.mes-crumbs > span:not(.sep) { white-space: nowrap; }
.mes-crumbs .cur { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.mes-user { display: flex; align-items: center; gap: 9px; text-decoration: none; color: inherit; border-radius: 6px; padding: 2px 4px; }
a.mes-user:hover { background: var(--panel-raised); }
.mes-bell {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 7px; color: var(--text-dim);
  border: 1px solid var(--line-2); background: var(--panel); flex: none;
}
.mes-bell:hover { color: var(--text); background: var(--panel-raised); }
.mes-bell svg { width: 17px; height: 17px; }
.mes-bell-dot {
  position: absolute; top: -6px; right: -6px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: var(--amber); color: #1a1206;
  font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
}
.mes-user-avatar {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  background: var(--panel-raised); border: 1px solid var(--line-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 10.5px; font-weight: 700; color: var(--text-dim);
}
.mes-user-meta { line-height: 1.25; }
.mes-user-meta b { display: block; font-size: 12px; font-weight: 600; color: var(--text); }
.mes-user-meta span { font-size: 10.5px; color: var(--text-faint); }
@media (max-width: 640px) {
  .mes-appbar { padding: 0 14px; }
  .mes-appbar .status, .mes-user-meta { display: none; }
}

/* legacy full-bleed run header — kept for Run.razor until that screen is reworked */
.mes-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 20px; background: var(--panel-sunken); border-bottom: 1px solid var(--line);
  font-size: 12.5px; color: var(--text-dim);
}

/* ---- buttons ---------------------------------------------------------- */
.btn {
  font-family: var(--font-sans); font-weight: 600; font-size: 13px;
  padding: 9px 15px; border-radius: var(--radius);
  border: 1px solid var(--line-2); background: var(--panel-raised); color: var(--text);
  cursor: pointer;
}
.btn:hover { border-color: #4b5b67; background: #262f38; }
.btn:focus-visible { outline: 2px solid var(--amber); outline-offset: 1px; }
.btn-amber { background: var(--amber); border-color: var(--amber); color: var(--amber-ink); }
.btn-amber:hover { background: var(--amber-hi); border-color: var(--amber-hi); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn-ghost:hover { background: var(--panel-raised); border-color: transparent; color: var(--text); }
.btn-sm { padding: 7px 12px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---- surfaces ---------------------------------------------------------- */
.card {
  background: var(--panel-raised); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px;
}

/* ---- onboarding checklist (P2.20 — a fresh trial org's empty dashboard) --- */
.onboarding-card { margin-bottom: 20px; }
.onboarding-head { margin-bottom: 14px; }
.onboarding-title { font-weight: 700; font-size: 15px; }
.onboarding-sub { font-size: 12.5px; color: var(--text-dim); margin-top: 2px; }
.onboarding-list { display: grid; gap: 2px; }
.onboarding-row {
  display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: var(--radius-sm, 6px);
  text-decoration: none; color: var(--text); font-size: 13.5px;
}
.onboarding-row:hover { background: var(--panel); }
.onboarding-row.is-done { color: var(--text-faint); text-decoration: line-through; }
.onboarding-check {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--line-2);
  font-size: 12px; color: var(--green);
}
.onboarding-row.is-done .onboarding-check { background: var(--green-dim); border-color: transparent; }

/* ---- forms ---------------------------------------------------------- */
.field { display: grid; gap: 5px; margin-bottom: 14px; }
.field > label, label.field-label {
  font-size: 11.5px; font-weight: 600; color: var(--text-dim);
}
.input, .select, input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="number"], select, textarea.input {
  width: 100%; background: var(--panel-sunken); border: 1px solid var(--line-2);
  border-radius: var(--radius); padding: 10px 12px; color: var(--text);
  font-size: 13.5px; font-family: var(--font-sans);
}
.input:focus, .select:focus, input:focus, select:focus, textarea.input:focus {
  outline: 2px solid var(--amber); outline-offset: -1px; border-color: var(--amber);
}
.input::placeholder, input::placeholder, textarea::placeholder { color: var(--text-faint); }
.input.mono { font-family: var(--font-mono); }

/* ---- data grid ---------------------------------------------------------- */
.grid { border-collapse: collapse; width: 100%; font-size: 13px; }
.grid th, .grid td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line-soft); }
.grid th { font-size: 10.5px; text-transform: uppercase; letter-spacing: .03em; color: var(--text-dim); font-weight: 600; }
.grid tr:hover td { background: rgba(255,255,255,0.035); }
.grid .empty { color: var(--text-faint); }

/* ---- chips / notices / status ------------------------------------------ */
.chip {
  display: inline-block; font-family: var(--font-mono); font-size: 10.5px;
  border: 1px solid var(--line-2); border-radius: 999px; padding: 2px 8px; color: var(--text-dim);
}

/* Shared status pill — semantic, with a leading dot. Reusable across pages. */
.status {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--font-mono); font-size: 11px; line-height: 1;
  padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--line-2); color: var(--text-dim);
}
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.status--ok { color: var(--green); background: var(--green-dim); border-color: #265041; }
.status--info { color: var(--blue); background: var(--blue-dim); border-color: #2b4257; }
.status--warn { color: var(--amber); background: var(--amber-dim); border-color: #524421; }
.status--danger { color: var(--red); background: var(--red-dim); border-color: #4d2c2e; }
.status--neutral { color: var(--text-faint); }

.notice { padding: 9px 13px; border-radius: var(--radius); font-size: 13px; margin: 10px 0; }
.notice-ok { background: var(--green-dim); color: #9ad9bd; border: 1px solid #2b5741; }
.notice-err { background: var(--red-dim); color: #f2adb0; border: 1px solid #4a2528; }
.notice-warn { background: var(--amber-dim); color: #f0d19b; border: 1px solid #4a3d24; }

.op-checkpoint-count { margin-left: 8px; font-family: var(--font-mono); font-size: 11.5px; opacity: .85; }
.op-checkpoint-next { margin: 8px 0 12px; font-size: 13px; }

/* ---- scrollbars ------------------------------------------------------- */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #4a5b67; }
::-webkit-scrollbar-track { background: transparent; }

/* ---- page head (greeting / title + primary action) -------------------- */
.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 24px;
}
.page-head .ph-main { min-width: 0; }
.page-head h1 { font-size: 24px; margin: 0; }
.page-head .ph-sub { font-size: 13px; color: var(--text-dim); margin: 4px 0 0; }
.page-head .btn { flex: none; }
.eyebrow {
  font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: var(--text-faint); margin-bottom: 6px;
}

/* ---- home dashboard ---------------------------------------------------- */
.section-heading {
  font-size: 11px; color: var(--text-dim); font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase; margin: 28px 0 12px;
}

.lookup-card {
  background: var(--panel-raised); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px; margin: 0 0 24px;
}
.lookup-title { font-size: 14px; font-weight: 700; }
.lookup-sub { font-size: 11.5px; color: var(--text-dim); margin-bottom: 10px; }
.lookup-row { display: flex; gap: 10px; flex-wrap: wrap; }
.lookup-field { position: relative; flex: 1; min-width: 200px; display: flex; }
.lookup-field .input { flex: 1; padding-left: 34px; }
.lookup-ico {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-faint); pointer-events: none;
}

.stat-strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px;
  background: var(--line); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden;
}
.stat-cell { background: var(--panel-raised); padding: 15px 18px; }
.stat-label { font-size: 10.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 5px; }
.stat-value { font-family: var(--font-mono); font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stat-value.amber { color: var(--amber); }
.stat-value.green { color: var(--green); }
.stat-value.red { color: var(--red); }
.stat-value.blue { color: var(--blue); }
.stat-delta { font-size: 10.5px; color: var(--text-faint); margin-top: 3px; }

.tile-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.tile {
  display: block; background: var(--panel-raised); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 17px; transition: border-color .12s ease, background .12s ease;
}
.tile:hover { border-color: var(--line-2); background: #232c34; text-decoration: none; }
.tile-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.tile-icon {
  width: 32px; height: 32px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center; font-size: 15px;
  background: var(--blue-dim); color: var(--blue);
}
.tile-badge {
  font-family: var(--font-mono); font-size: 10.5px; padding: 2px 7px; border-radius: 10px;
  border: 1px solid var(--line-soft); color: var(--text-dim);
}
.tile-badge.attn { border-color: var(--amber); color: var(--amber); background: var(--amber-dim); }
.tile-title { font-size: 14px; font-weight: 700; margin-bottom: 4px; color: var(--text); }
.tile-sub { font-size: 11.5px; color: var(--text-dim); line-height: 1.5; }

.activity-list { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.activity-row {
  display: flex; align-items: center; gap: 11px; padding: 10px 16px;
  background: var(--panel-raised); border-bottom: 1px solid var(--line-soft); font-size: 12.5px;
}
.activity-row:last-child { border-bottom: none; }
.activity-avatar {
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
  background: var(--panel-sunken); border: 1px solid var(--line-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700; color: var(--text-dim);
}
.activity-text { color: var(--text-dim); flex: 1; min-width: 0; }
.activity-text b { color: var(--text); font-weight: 600; }
.activity-tag { font-family: var(--font-mono); font-size: 10px; letter-spacing: .04em; text-transform: uppercase; color: var(--text-faint); border: 1px solid var(--line); border-radius: 999px; padding: 2px 7px; flex: none; }
.activity-time { color: var(--text-faint); font-family: var(--font-mono); font-size: 10.5px; flex: none; width: 66px; text-align: right; }
.activity-empty { padding: 26px 16px; text-align: center; color: var(--text-faint); font-size: 12.5px; background: var(--panel-raised); }

.notif-list { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; max-width: 640px; }
.notif-row {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px;
  border-bottom: 1px solid var(--line); border-left: 3px solid transparent;
}
.notif-row:last-child { border-bottom: none; }
.notif-row:hover { background: var(--panel-raised); }
.notif-row.is-unread { border-left-color: var(--amber); background: color-mix(in srgb, var(--amber) 6%, transparent); }
.notif-check { flex: none; margin-top: 3px; accent-color: var(--amber); }
.notif-main { display: block; flex: 1; min-width: 0; text-decoration: none; color: inherit; }
.notif-main b { color: var(--text); font-weight: 600; font-size: 13px; }
.notif-body { display: block; color: var(--text-dim); font-size: 12.5px; margin-top: 2px; }
.notif-meta { display: block; color: var(--text-faint); font-family: var(--font-mono); font-size: 10.5px; margin-top: 5px; }

/* ---- help centre ------------------------------------------------------ */
.help-head { margin-bottom: 18px; }
.help-head p { margin: 4px 0 0; color: var(--text-dim); font-size: 13.5px; }

.help-shell { display: grid; grid-template-columns: 250px 1fr; gap: 24px; align-items: start; }

.help-nav { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px 10px; position: sticky; top: 16px; }
.help-mod { margin-bottom: 16px; }
.help-mod:last-of-type { margin-bottom: 6px; }
.help-mod-label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-faint); padding: 0 8px 6px; }
.help-topic { display: block; padding: 7px 9px; border-radius: 6px; color: var(--text-dim); font-size: 13.5px; line-height: 1.35; }
.help-topic:hover { background: var(--panel-raised); text-decoration: none; color: var(--text); }
.help-topic.is-active { background: var(--blue-dim); color: var(--text); font-weight: 600; border-left: 2px solid var(--blue); padding-left: 7px; }
.help-nav-note { font-size: 12px; color: var(--text-faint); padding: 8px 8px 2px; border-top: 1px solid var(--line-soft); margin-top: 6px; }

.help-content { background: var(--panel-raised); border: 1px solid var(--line); border-radius: 8px; padding: 26px 30px 30px; max-width: 720px; }
.help-eyebrow { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--blue); font-weight: 700; margin-bottom: 6px; }
.help-content h2 { font-size: 21px; margin: 0 0 14px; }
.help-content h3 { font-size: 15px; margin: 26px 0 8px; color: var(--text); }
.help-content p { line-height: 1.6; color: var(--text-dim); margin: 0 0 12px; max-width: 62ch; }
.help-content ol, .help-content ul { padding-left: 22px; margin: 0 0 14px; color: var(--text-dim); line-height: 1.65; max-width: 62ch; }
.help-content li { margin-bottom: 4px; }
.help-content li b { color: var(--text); }
.help-content code { font-family: var(--font-mono); background: var(--panel-sunken); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; font-size: 12.5px; color: var(--amber-hi); }

.help-step { display: flex; gap: 14px; align-items: flex-start; margin: 0 0 16px; }
.help-step-num {
  flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--panel-sunken);
  border: 1px solid var(--line-2); color: var(--text-dim); font-weight: 700; font-size: 12px;
  display: grid; place-items: center; margin-top: 2px;
}
.help-step-body { flex: 1; min-width: 0; }
.help-step-body p { margin: 0; }
.shot-frame { margin-top: 10px; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; max-width: 480px; }
.shot-frame img { display: block; width: 100%; height: auto; }
.shot-caption { font-size: 12px; color: var(--text-faint); margin-top: 7px; }

/* ---- operator run (unit + batch) ------------------------------------- */
/* A station surface: high contrast, generous type, large touch targets. */
.btn-lg { padding: 14px 20px; font-size: 15px; font-weight: 700; }
.btn-danger { background: var(--red-dim); border-color: #4a2528; color: #f2adb0; }
.btn-danger:hover { background: #45262a; border-color: #5c3236; }

.run-bar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  margin: -26px -30px 22px; padding: 12px 24px;
  background: #0b0f12; border-bottom: 1px solid var(--line-2);
}
.run-bar .wo { font-family: var(--font-mono); font-size: 16px; font-weight: 600; color: var(--amber); }
.run-bar .pt { font-size: 13.5px; color: var(--text); }
.run-bar .spacer { flex: 1; }
.run-bar .meta { display: flex; align-items: center; gap: 10px; font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); }
.run-bar .sn {
  font-family: var(--font-mono); font-size: 12px; color: var(--text);
  border: 1px solid var(--line-2); border-radius: 999px; padding: 3px 11px;
}

.run-grid { display: grid; grid-template-columns: 244px 1fr; gap: 30px; align-items: start; }
@media (max-width: 900px) { .run-grid { grid-template-columns: 1fr; } }

/* operation / step rail — a real stepper */
.op-rail-label {
  font-size: 10px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase;
  color: var(--text-faint); margin-bottom: 10px;
}
.op-step {
  display: flex; gap: 12px; align-items: flex-start; position: relative;
  padding: 12px; border-radius: var(--radius); text-decoration: none;
}
a.op-step:hover { background: rgba(255,255,255,.03); }
/* connector between an operation and whatever row follows it (op or sub-steps) */
.op-step:not(:last-child)::after {
  content: ""; position: absolute; left: 23px; top: 34px; bottom: -4px; width: 2px; background: var(--line);
}
.op-mk {
  width: 24px; height: 24px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 12px;
  border: 1.5px solid var(--line-2); color: var(--text-faint); background: var(--bg);
}
.op-step.is-done .op-mk { background: var(--green-dim); border-color: #2b5741; color: var(--green); }
.op-step.is-current .op-mk { background: var(--amber); border-color: var(--amber); color: var(--amber-ink); font-weight: 700; }
.op-step.is-available .op-mk { border-color: var(--line-2); color: var(--text-dim); }
.op-step.is-blocked .op-mk { background: var(--red-dim); border-color: #4a2528; color: var(--red); }
.op-name { font-size: 13px; font-weight: 600; color: var(--text-dim); }
.op-step.is-current .op-name, a.op-step:hover .op-name { color: var(--text); }
.op-sub { font-size: 11px; color: var(--text-faint); margin-top: 2px; }
.op-count { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); flex: none; }
.op-rail .hint { font-size: 11px; color: var(--text-faint); margin: 10px 4px 0; }

/* the current operation's steps, nested under it in the rail */
.op-substeps { list-style: none; margin: 0 0 6px; padding: 2px 0 4px 36px; position: relative; }
.op-substeps::before {
  content: ""; position: absolute; left: 23px; top: -6px; bottom: 6px; width: 2px; background: var(--line);
}
.op-substeps li {
  display: flex; gap: 9px; align-items: baseline; padding: 4px 10px 4px 0;
  font-size: 12px; line-height: 1.4; color: var(--text-dim);
}
.op-substeps li .n {
  font-family: var(--font-mono); font-size: 10.5px; width: 13px; flex: none;
  text-align: center; color: var(--text-faint);
}
.op-substeps li.is-current { color: var(--amber); font-weight: 500; }
.op-substeps li.is-current .n { color: var(--amber); }
.op-substeps li.is-locked { color: var(--text-faint); }
.op-substeps li.is-done .n { color: var(--green); }
.op-substeps li.is-fail { color: var(--red); }
.op-substeps li.is-fail .n { color: var(--red); }

/* current-step panel */
.step-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.step-eyebrow { font-family: var(--font-mono); font-size: 12px; color: var(--text-faint); }
.step-kind {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .05em; text-transform: uppercase;
  color: var(--blue); background: var(--blue-dim); border: 1px solid #2b4257; border-radius: 999px; padding: 2px 9px;
}
.step-title { font-size: 21px; font-weight: 700; letter-spacing: -.01em; margin: 0 0 16px; text-wrap: balance; }
.step-cols { display: grid; gap: 22px; align-items: start; }
.step-cols.has-pic { grid-template-columns: minmax(0,1fr) minmax(240px,360px); }
@media (max-width: 720px) { .step-cols.has-pic { grid-template-columns: 1fr; } }
.step-body { font-size: 15px; line-height: 1.7; color: var(--text); white-space: pre-wrap; margin: 0; }
.step-note {
  margin-top: 16px; padding: 13px 15px;
  background: var(--panel-sunken); border: 1px solid var(--line-soft);
  border-left: 3px solid var(--amber); border-radius: 6px;
}
.step-note b { display: block; font-size: 10.5px; letter-spacing: .08em; color: var(--amber); margin-bottom: 3px; }
.step-note span { font-size: 13.5px; line-height: 1.6; color: var(--text); white-space: pre-wrap; }
.step-figs { display: grid; gap: 10px; }
.step-figs figure { margin: 0; }
.step-figs img { width: 100%; border: 1px solid var(--line-2); border-radius: 6px; display: block; }
.step-figs figcaption { font-size: 11.5px; color: var(--text-faint); margin-top: 4px; }

.step-form { margin-top: 22px; display: grid; gap: 12px; max-width: 620px; }
.passfail { display: flex; gap: 12px; }
.passfail .btn { flex: 1; justify-content: center; }
.fallout { border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 10px 12px; }
.fallout > summary { cursor: pointer; font-size: 12px; color: #f2adb0; }
.fallout > div { display: grid; gap: 8px; margin-top: 10px; }

/* step list for the current operation / batch */
.run-progress { margin-top: 16px; max-width: 620px; }
.run-progress-head { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-faint); margin-bottom: 7px; }
.run-track { height: 6px; border-radius: 999px; background: var(--panel); overflow: hidden; }
.run-track i { display: block; height: 100%; background: var(--amber); border-radius: 999px; transition: width .25s ease; }

.run-actions { display: flex; gap: 10px; margin-top: 16px; }

/* shared status / timing / hold-pause bar, above the step card on both run screens */
.run-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.run-controls .grow { flex: 1 1 auto; }
.run-controls form { display: flex; gap: 6px; align-items: center; margin: 0; }
.run-controls .select { width: auto; }
.run-controls .held-note { font-size: 12px; color: var(--amber); }

/* ---- server-rendered popup (shared: sign-in dialogs, operator flag/note, list-page create) ---- */
.pm-scrim { position: fixed; inset: 0; background: rgba(0,0,0,.62); z-index: 60;
  display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; }
.pm-scrim-bg { position: absolute; inset: 0; }
.pm-box { position: relative; z-index: 1; background: var(--panel-raised); border: 1px solid var(--line);
  border-radius: var(--radius); width: 100%; max-width: 460px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.pm-head { padding: 18px 22px; border-bottom: 1px solid var(--line); }
.pm-head h2 { margin: 0; font-size: 16px; }
.pm-head .sub { color: var(--text-dim); font-size: 12.5px; margin-top: 3px; }
.pm-body { padding: 18px 22px 22px; }
.pm-close { position: absolute; top: 12px; right: 15px; color: var(--text-dim); font-size: 17px; line-height: 1; }
.pm-close:hover { color: var(--text); text-decoration: none; }
.pm-box.pm-wide { max-width: 620px; }

/* ---- list / index pages (parts, jobs, shared blocks, users) ---------- */
.list-toolbar {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 12px; flex-wrap: wrap; margin: 4px 0 14px;
}
.list-filter { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.list-filter .input, .list-filter .select { font-size: 12.5px; padding: 7px 10px; }
.list-filter .select { width: auto; flex: none; }
.list-filter input[type="search"] { min-width: 170px; flex: 1 1 200px; max-width: 320px; }
.list-filter .btn { flex: none; }
.list-count { font-size: 12px; color: var(--text-faint); font-family: var(--font-mono); margin-bottom: 10px; }

.data-table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; }
.data-table thead th {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-dim);
  font-weight: 600; text-align: left; padding: 9px 12px; white-space: nowrap;
  border-bottom: 1px solid var(--line); background: var(--panel);
}
.data-table td { padding: 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.data-table tbody tr:hover td { background: rgba(255,255,255,.035); }
.data-table tr:last-child td { border-bottom: none; }
.data-table .num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.data-table .col-actions { text-align: right; white-space: nowrap; }
.data-table .col-actions .btn + .btn { margin-left: 5px; }
.data-table .empty { color: var(--text-faint); }
/* Reserves the History button's width even when a row has none (e.g. a batch job), so Run
   sits at the same position on every row instead of drifting right on its own. */
.job-history-slot { display: inline-block; min-width: 72px; margin-left: 5px; text-align: left; }
.job-history-slot .btn { margin-left: 0 !important; }
.job-progress { white-space: nowrap; }
.job-progress-ops { font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--text); }
.job-progress-next { display: block; font-size: 11px; color: var(--text-faint); margin-top: 2px; }

.pager { display: flex; align-items: center; gap: 14px; margin-top: 14px; font-size: 12px; color: var(--text-dim); }

/* ---- sign-in (split panel) ------------------------------------------- */
.auth-split { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; background: var(--bg); }
@media (max-width: 860px) {
  .auth-split { grid-template-columns: 1fr; }
  .si-brand { display: none; }
}

.si-brand {
  position: relative; overflow: hidden;
  padding: 44px; background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
}
.si-brand::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 40px 40px; opacity: .3;
  -webkit-mask-image: radial-gradient(115% 80% at 12% 0%, #000, transparent 68%);
          mask-image: radial-gradient(115% 80% at 12% 0%, #000, transparent 68%);
}
.si-brand > * { position: relative; z-index: 1; }
.si-lock { display: flex; align-items: center; gap: 11px; font-weight: 800; font-size: 18px; }
.si-lock .m {
  width: 34px; height: 34px; border-radius: 8px;
  background: linear-gradient(150deg, var(--amber), #b9781f);
  display: flex; align-items: center; justify-content: center;
  color: var(--amber-ink); font-weight: 800;
}
.si-headline { font-size: 24px; font-weight: 700; letter-spacing: -.01em; margin-top: auto; max-width: 16ch; text-wrap: balance; }
.si-sub { color: var(--text-dim); font-size: 13.5px; line-height: 1.55; margin: 10px 0 0; max-width: 38ch; }
.si-feats { display: flex; flex-direction: column; gap: 10px; margin-top: 24px; }
.si-feats div { display: flex; align-items: flex-start; gap: 9px; font-size: 12.5px; color: var(--text-dim); }
.si-feats svg { width: 15px; height: 15px; color: var(--amber); flex: none; margin-top: 1px; }
.si-foot { margin-top: 26px; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); }

.si-form-col { display: flex; align-items: center; justify-content: center; padding: 44px 24px; }
.si-form { width: 100%; max-width: 360px; }
.si-form h1 { font-size: 20px; font-weight: 700; margin: 0; }
.si-form .si-lead { font-size: 12.5px; color: var(--text-dim); margin: 5px 0 24px; }
.si-form .field { margin-bottom: 15px; }
.si-form .si-help { font-size: 11.5px; color: var(--text-faint); line-height: 1.5; margin: 4px 0 18px; }
.si-form button[type="submit"] { width: 100%; justify-content: center; padding: 11px; font-size: 13.5px; }
