/* =========================================================
   Bluegrass Specialty Welding & Fabrication — design system
   Brand-navy rail + light canvas, welding-amber accent.
   All JS hooks (ids, .selector-table-row, .ops-nav-btn,
   .badge-*, data-* attrs) are preserved.
   ========================================================= */

:root {
  color-scheme: light;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Roboto Mono", Menlo, monospace;

  /* canvas + surfaces */
  --canvas: #f3f4f6;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --surface-sunken: #f6f7f9;

  /* ink + text */
  --ink: #15181e;
  --ink-2: #3b4250;
  --muted: #6b7280;
  --faint: #9aa1ad;

  /* lines */
  --line: #e7e9ee;
  --line-strong: #d6dae1;

  /* rail (sidebar) — matched to the logo badge navy so the oval blends in */
  --rail: #003860;
  --rail-2: #0c4a73;
  --rail-line: rgba(248, 224, 176, 0.16); /* cream-tinted hairline, from the badge */
  --rail-text: #c7d6e6;
  --rail-muted: #8aa1bb;

  /* primary accent — brand navy-blue, used across the main content area */
  --accent: #1e4d77;
  --accent-strong: #15324f;
  --accent-2: #2c6196;
  --accent-soft: #eaf1f7;
  --accent-ring: rgba(30, 77, 119, 0.22);

  /* welding amber — confined to the left pane (sidebar) */
  --rail-accent: #f97316;
  --rail-accent-strong: #ea580c;
  --rail-accent-soft: rgba(234, 88, 12, 0.16);
  --rail-accent-border: rgba(234, 88, 12, 0.42);

  /* status */
  --good: #15803d;
  --good-soft: #e9f6ee;
  --warn: #b45309;
  --warn-soft: #fdf1e1;
  --danger: #b91c1c;
  --danger-soft: #fdecec;

  /* shape */
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --pill: 999px;

  /* shadow */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.05);
  --shadow: 0 4px 14px rgba(15, 23, 42, 0.07);
  --shadow-pop: 0 12px 30px rgba(15, 23, 42, 0.14);
  --topbar-bg: rgba(243, 244, 246, 0.85);
  --rail-edge: #000;
  --toast-border: #000;
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --canvas: #0f1b30;
  --surface: #14243b;
  --surface-2: #112037;
  --surface-sunken: #0e1a2d;

  --ink: #e5e7eb;
  --ink-2: #cbd5e1;
  --muted: #94a3b8;
  --faint: #64748b;

  --line: #2a415f;
  --line-strong: #365274;

  --rail: #032343;
  --rail-2: #0a355c;
  --rail-line: rgba(148, 163, 184, 0.26);
  --rail-text: #dbe6f3;
  --rail-muted: #9fb2c7;

  --accent: #3b82f6;
  --accent-strong: #2563eb;
  --accent-2: #60a5fa;
  --accent-soft: #1a304c;
  --accent-ring: rgba(59, 130, 246, 0.3);

  --good: #16a34a;
  --good-soft: #0f2718;
  --warn: #d97706;
  --warn-soft: #33210e;
  --danger: #dc2626;
  --danger-soft: #36171a;

  --shadow-sm: 0 1px 2px rgba(6, 16, 35, 0.42), 0 2px 8px rgba(6, 16, 35, 0.34);
  --shadow: 0 10px 26px rgba(6, 16, 35, 0.42);
  --shadow-pop: 0 16px 38px rgba(6, 16, 35, 0.54);
  --topbar-bg: rgba(15, 27, 48, 0.84);
  --rail-edge: #2c4e74;
  --toast-border: #3b5f87;
}

* {
  box-sizing: border-box;
}

html {
  overscroll-behavior: none;
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--canvas);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overscroll-behavior: none;
  height: 100%;
  overflow: hidden;
}

h1,
h2,
h3 {
  color: var(--ink);
  font-weight: 650;
  letter-spacing: -0.01em;
}

h1 {
  margin: 0;
  font-size: 1.5rem;
}

h2 {
  margin: 0 0 0.15rem;
  font-size: 1.05rem;
}

h3 {
  margin: 1.25rem 0 0.6rem;
  font-size: 0.9rem;
  letter-spacing: 0.01em;
}

p {
  color: var(--muted);
  line-height: 1.5;
}

a {
  color: var(--accent-strong);
}

code {
  font-family: var(--font-mono);
}

/* ============================ SHELL ============================ */

.app-shell {
  min-height: 100dvh;
  height: 100dvh;
  display: grid;
  grid-template-columns: 244px 1fr;
  overflow: hidden;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  background: var(--rail);
  border-right: 1px solid var(--rail-edge);
  padding: 1.1rem 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.brand {
  padding: 0.35rem 0.5rem 1rem;
  border-bottom: 1px solid var(--rail-line);
}

.brand-logo {
  display: block;
  width: 100%;
  /* lift the badge slightly off the matching navy so it reads as the logo */
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.35));
}

/* legacy titles kept for safety; hidden in favor of .brand */
.sidebar-title,
.sidebar-subtitle {
  display: none;
}

.nav-label {
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--rail-muted);
  padding: 0 0.55rem;
  margin-bottom: -0.3rem;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--rail-text);
  border-radius: var(--r-sm);
  padding: 0.55rem 0.6rem;
  font-size: 0.9rem;
  font-weight: 500;
  border: 1px solid transparent;
  transition: background 130ms ease, color 130ms ease;
}

.sidebar-link svg {
  width: 18px;
  height: 18px;
  flex: none;
  opacity: 0.85;
}

.sidebar-link:hover {
  background: var(--rail-2);
  color: #fff;
}

.sidebar-link.active {
  background: var(--rail-accent-soft);
  border-color: var(--rail-accent-border);
  color: #fff;
}

.sidebar-link.active svg {
  color: var(--rail-accent);
  opacity: 1;
}

.workspace-disabled {
  opacity: 0.38;
  pointer-events: none;
}

.sidebar-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.role-block {
  border: 1px solid var(--rail-line);
  border-radius: var(--r-sm);
  padding: 0.6rem 0.7rem;
  background: var(--rail-2);
  display: grid;
  gap: 0.2rem;
}

.role-block .label {
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--rail-muted);
  margin: 0;
}

.theme-toggle-btn {
  width: 100%;
  border: 1px solid var(--rail-line);
  background: rgba(255, 255, 255, 0.07);
  color: #f8fafc;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 0.5rem 0.65rem;
}

.theme-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.26);
}

#role-indicator {
  font-size: 0.85rem;
  font-weight: 600;
  color: #fff;
}

.sys-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.76rem;
  color: var(--rail-muted);
  padding: 0 0.1rem;
}

.sys-status .status-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
}

.shortcut-hint {
  margin: 0;
  font-size: 0.74rem;
  line-height: 1.5;
  color: var(--rail-muted);
}

.shortcut-hint code {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--rail-line);
  border-radius: 5px;
  padding: 0.05rem 0.32rem;
  color: #e7eaf0;
  font-size: 0.72rem;
}

/* ============================ CONTENT ============================ */

.app-content {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.05rem 2rem;
  background: var(--topbar-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar .page-sub {
  margin: 0.2rem 0 0;
  font-size: 0.88rem;
}

.hero-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.hero-chip {
  border: 1px solid var(--line-strong);
  border-radius: var(--pill);
  padding: 0.22rem 0.6rem;
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--ink-2);
  background: var(--surface);
}

/* page hero used as topbar wrapper on legacy markup */
.page-hero {
  margin: 0;
}

.container {
  width: min(1180px, 100%);
  margin: 0 auto;
}

main.container,
.page {
  padding: 1.6rem 2rem 2.5rem;
}

/* generic responsive grid of cards */
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.1rem;
}

.span-2 {
  grid-column: span 2;
}

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

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.card-kicker,
.eyebrow {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent-strong);
  margin-bottom: 0.4rem;
}

.workspace-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.3rem;
}

.workspace-card h2 {
  margin-top: 0.1rem;
}

/* ============================ TASK NAVIGATOR ============================ */

.task-rail {
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  padding: 1.3rem 1.4rem;
  box-shadow: var(--shadow);
}

.task-rail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.task-rail-head h2 {
  margin: 0;
}

.progress-pill {
  flex: none;
  font-size: 0.76rem;
  font-weight: 600;
  border: 1px solid var(--line-strong);
  border-radius: var(--pill);
  padding: 0.3rem 0.7rem;
  color: var(--ink-2);
  background: var(--surface);
  white-space: nowrap;
}

.task-rail-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.rail-dismiss {
  flex: none;
  width: 30px;
  height: 30px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--muted);
}

.rail-dismiss:hover {
  background: var(--surface-sunken);
  border-color: var(--faint);
  color: var(--ink);
}

/* horizontal stepper (replaces the old vertical checklist) */
.stepper {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
}

.stepper li {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  text-align: center;
  padding: 0 0.25rem;
}

.stepper li::before {
  content: "";
  position: absolute;
  top: 13px;
  right: 50%;
  width: 100%;
  height: 2px;
  background: var(--line-strong);
  z-index: 0;
}

.stepper li:first-child::before {
  display: none;
}

.step-label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
}

/* the "next task" call-to-action */
.next-action {
  margin-top: 1.3rem;
  padding-top: 1.2rem;
  border-top: 1px dashed var(--line-strong);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.2rem;
  flex-wrap: wrap;
}

.next-action .next-copy {
  min-width: 240px;
  flex: 1;
}

.next-action h2,
.next-action h3 {
  margin: 0 0 0.25rem;
  font-size: 1.05rem;
}

.next-action p {
  margin: 0;
  font-size: 0.9rem;
}

/* ============================ BUTTONS ============================ */

button,
.btn {
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.55rem 0.95rem;
  border-radius: var(--r-sm);
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  transition: background 130ms ease, border-color 130ms ease, box-shadow 130ms ease, transform 80ms ease;
}

button:hover,
.btn:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

button:active,
.btn:active {
  transform: translateY(1px);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.secondary-button {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--ink-2);
}

.secondary-button:hover {
  background: var(--surface-sunken);
  border-color: var(--faint);
}

.page-action-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--r-sm);
  padding: 0.55rem 0.95rem;
  transition: background 130ms ease;
}

.page-action-link:hover {
  background: var(--accent-strong);
  color: #fff;
}

.danger-button {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

.danger-button:hover {
  background: #991b1b;
  border-color: #991b1b;
}

.danger-button:disabled {
  opacity: 0.6;
}

.danger-note {
  color: var(--danger);
  font-size: 0.86rem;
}

/* ============================ FORMS ============================ */

form {
  display: grid;
  gap: 0.85rem;
}

label {
  display: grid;
  gap: 0.3rem;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--ink-2);
}

input,
select,
textarea {
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.55rem 0.65rem;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  transition: border-color 130ms ease, box-shadow 130ms ease;
}

input::placeholder {
  color: var(--faint);
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible,
.sidebar-link:focus-visible,
.page-action-link:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.form-grid {
  display: grid;
  gap: 0.85rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
}

.form-grid fieldset {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 0.5rem 0.7rem 0.65rem;
  margin: 0;
}

.form-grid fieldset legend {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  padding: 0 0.3rem;
}

.form-grid button,
.form-grid .page-action-link {
  align-self: end;
}

.inline-control {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.45rem;
  font-weight: 500;
}

.inline-control input[type="checkbox"],
.inline-control input[type="radio"] {
  width: auto;
  margin: 0;
  accent-color: var(--accent);
}

.label {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.muted {
  color: var(--muted);
  font-size: 0.86rem;
}

.guided-note {
  margin: 0.7rem 0 0;
  padding: 0.7rem 0.85rem;
  background: var(--accent-soft);
  border: 1px solid var(--accent-ring);
  border-radius: var(--r-sm);
  color: var(--accent-strong);
  font-size: 0.86rem;
  line-height: 1.45;
}

/* ============================ STATS ============================ */

.kpi-grid,
.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.summary-grid {
  margin-top: 0.85rem;
}

.kpi-grid > div,
.summary-grid > div {
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 0.75rem 0.85rem;
}

strong {
  font-weight: 700;
}

.kpi-grid strong,
.summary-grid strong,
.ops-context strong {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.summary-badge-row {
  margin-top: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

/* ============================ BADGES ============================ */

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: var(--pill);
  padding: 0.22rem 0.65rem;
  font-size: 0.76rem;
  font-weight: 600;
  border: 1px solid;
}

.badge-good {
  color: var(--good);
  background: var(--good-soft);
  border-color: rgba(21, 128, 61, 0.3);
}

.badge-warning {
  color: var(--warn);
  background: var(--warn-soft);
  border-color: rgba(180, 83, 9, 0.3);
}

.badge-danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: rgba(185, 28, 28, 0.3);
}

.badge-neutral {
  color: var(--muted);
  background: var(--surface-sunken);
  border-color: var(--line-strong);
}

.variance-positive {
  color: var(--good);
  font-weight: 600;
}

.variance-negative {
  color: var(--danger);
  font-weight: 600;
}

.utilization-high {
  color: var(--danger);
  font-weight: 600;
}

.utilization-medium {
  color: var(--warn);
  font-weight: 600;
}

.utilization-low {
  color: var(--good);
  font-weight: 600;
}

/* ============================ TABLES ============================ */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

thead th {
  position: sticky;
  top: 0;
  text-align: left;
  padding: 0.55rem 0.6rem;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface-sunken);
  border-bottom: 1px solid var(--line-strong);
}

tbody td {
  padding: 0.6rem;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
}

tbody tr:last-child td {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--surface-sunken);
}

/* numeric-ish cells read better in mono */
tbody td:first-child {
  font-family: var(--font-mono);
  font-size: 0.84rem;
  color: var(--ink);
}

.compact-table {
  font-size: 0.84rem;
}

.compact-table thead th {
  padding: 0.45rem 0.55rem;
}

.compact-table tbody td {
  padding: 0.5rem 0.55rem;
}

.table-toolbar {
  margin: 0.9rem 0 0.7rem;
  display: flex;
  gap: 0.9rem;
  align-items: end;
  flex-wrap: wrap;
}

.table-toolbar label {
  font-size: 0.78rem;
}

.list-header {
  margin-top: 0.4rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
}

.list-header h3 {
  margin: 0;
}

/* a scroll wrapper for wide tables */
.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--r);
  overscroll-behavior: contain;
}

/* ============================ OPERATIONS ============================ */

/* tabbed work panel: tab bar header owns the body below it.
   No overflow:hidden so sticky children (selector panel) can pin. */
.ops-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}

.ops-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem;
  padding: 0 0.65rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  border-top-left-radius: var(--r-lg);
  border-top-right-radius: var(--r-lg);
  position: sticky;
  top: 72px;
  z-index: 16;
}

.ops-nav-btn {
  position: relative;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.85rem 1.15rem;
  margin-bottom: -1px;
}

.ops-nav-btn:hover {
  background: transparent;
  color: var(--ink);
}

.ops-nav-btn.active {
  background: transparent;
  color: var(--accent-strong);
  border-bottom-color: var(--accent);
  box-shadow: none;
}

.ops-panel-body {
  padding: 1.25rem;
  background: var(--surface-sunken);
  display: grid;
  gap: 1rem;
  border-bottom-left-radius: var(--r-lg);
  border-bottom-right-radius: var(--r-lg);
}

.ops-panel-body .guided-note {
  margin: 0;
}

.ops-panel-body .operations-layout {
  margin-top: 0;
}

.quick-task-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.quick-start-card h2 {
  margin-bottom: 0.75rem;
}

.quick-task-row .secondary-button.active {
  border-color: var(--accent);
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.sidebar-guide-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.65rem;
  margin-top: 0.4rem;
  border-radius: var(--r-sm);
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-muted);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.sidebar-guide-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.sidebar-guide-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.guided-workflow-list .secondary-button {
  min-width: 220px;
}

.guided-flow-panel {
  margin-top: 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  padding: 0.7rem 0.85rem 0.75rem;
}

.guided-flow-panel strong {
  display: block;
  margin-bottom: 0.35rem;
}

.guided-flow-panel ol {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.2rem;
  color: var(--muted);
}

.ops-context {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.ops-context > span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  padding: 0.4rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
}

.ops-context strong {
  font-size: 0.85rem;
  font-family: var(--font-sans);
  font-weight: 600;
  color: var(--ink);
}

.operations-layout {
  display: grid;
  grid-template-columns: minmax(300px, 34%) minmax(0, 1fr);
  gap: 1.1rem;
  align-items: start;
}

.selector-panel,
.workflow-panel {
  display: grid;
  gap: 1.1rem;
  align-content: start;
}

/* left selector pane pins while the workflow column scrolls */
.selector-panel {
  position: sticky;
  top: 90px;
  align-self: start;
  max-height: calc(100vh - 106px);
  overflow: auto;
  overscroll-behavior: contain;
}

.selector-panel .card h2 {
  margin-bottom: 0.7rem;
}

.selector-panel input {
  width: 100%;
  margin-bottom: 0.6rem;
}

.selector-table-row {
  cursor: pointer;
}

.selector-table-row:hover {
  background: var(--accent-soft);
}

.selector-table-row.selected {
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}

.selector-table-row.selected td {
  color: var(--ink);
  font-weight: 600;
}

.setup-nav {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.25rem;
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  margin-bottom: 1rem;
}

.setup-nav-btn,
.capture-nav-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--ink-2);
  border-radius: 6px;
  padding: 0.4rem 0.85rem;
  font-size: 0.84rem;
}

.setup-nav-btn:hover,
.capture-nav-btn:hover {
  color: var(--ink);
}

.setup-nav-btn.active,
.capture-nav-btn.active {
  background: var(--surface);
  border-color: var(--line-strong);
  color: var(--accent-strong);
  box-shadow: var(--shadow-sm);
}

/* guided step flow */
.step-instruction {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
  max-width: 60ch;
}

.step-actions {
  margin-top: 1.2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.step-num {
  display: inline-grid;
  place-items: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.3rem;
  margin-right: 0.15rem;
  border-radius: var(--pill);
  background: var(--surface-sunken);
  border: 1px solid var(--line-strong);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
}

.ops-nav-btn.active .step-num {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.job-admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 0.8rem;
}

button.job-admin-card {
  text-align: left;
  display: grid;
  gap: 0.3rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--ink);
  padding: 0.85rem 0.9rem;
}

.job-admin-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.job-admin-card-stats {
  margin-top: 0.5rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem 0.7rem;
}

.job-admin-card-stats > div {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.job-admin-card-stats .label {
  margin: 0;
}

.job-admin-card-stats strong {
  font-size: 0.95rem;
}

.job-admin-card-stats .badge {
  width: fit-content;
}

.line-items-totals {
  display: flex;
  flex-wrap: wrap;
  gap: 1.4rem;
  margin: 0.4rem 0 0.85rem;
  padding: 0.7rem 0.9rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
}

.line-items-totals > div {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.line-items-totals .label {
  margin: 0;
}

.line-items-totals .badge {
  width: fit-content;
}

.settings-details > summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink-2);
  list-style-position: inside;
}

.settings-details > summary:hover {
  color: var(--ink);
}

button.job-admin-card:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

button.job-admin-card.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.job-admin-card-num {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--muted);
}

.job-edit-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
}

.job-edit-modal.underlay {
  z-index: 110;
}

.job-edit-modal.underlay .job-edit-modal-panel {
  pointer-events: none;
}

.job-edit-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.56);
}

.job-edit-modal-panel {
  position: relative;
  width: min(980px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop);
  padding: 1rem 1rem 1.1rem;
}

.job-edit-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.job-edit-modal-header h3 {
  margin: 0;
}

.job-workspace-actions {
  margin-top: 0.9rem;
}

.ops-modal {
  position: fixed;
  inset: 0;
  z-index: 118;
  display: grid;
  place-items: center;
}

#line-item-artifacts-modal {
  z-index: 220;
}

.ops-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.56);
}

.ops-modal-panel {
  position: relative;
  width: min(700px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop);
  padding: 1rem 1rem 1.1rem;
}

.ops-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.ops-modal-header h3 {
  margin: 0;
}

/* ============================ FOCUS HIGHLIGHT ============================ */

.task-focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring), var(--shadow-pop);
}

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

.toast {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 100;
  background: var(--ink);
  color: #fff;
  border: 1px solid var(--toast-border);
  border-radius: var(--r-sm);
  padding: 0.7rem 1rem;
  font-size: 0.86rem;
  font-weight: 500;
  box-shadow: var(--shadow-pop);
  max-width: 320px;
}

.hidden {
  display: none !important;
}

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

@media (max-width: 980px) {
  html,
  body {
    height: auto;
    overflow: auto;
  }

  .app-shell {
    min-height: 100vh;
    height: auto;
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    border-right: 0;
    border-bottom: 1px solid var(--rail-edge);
    overflow: visible;
  }

  .app-content {
    overflow: visible;
  }

  .brand {
    flex: 0 0 auto;
    padding: 0;
  }

  .brand-logo {
    width: auto;
    height: 46px;
  }

  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    flex: 1;
    justify-content: flex-end;
  }

  .nav-label {
    display: none;
  }

  .sidebar-foot {
    margin: 0;
    flex-direction: row;
    align-items: center;
    width: 100%;
  }

  .theme-toggle-btn {
    width: auto;
    white-space: nowrap;
  }

  .shortcut-hint {
    display: none;
  }

  .topbar,
  main.container,
  .page {
    padding-left: 1.1rem;
    padding-right: 1.1rem;
  }

  .operations-layout {
    grid-template-columns: 1fr;
  }

  .ops-nav {
    top: 104px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .grid {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: auto;
  }
}

@media (max-width: 560px) {
  .stepper {
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .stepper li {
    flex: 0 0 calc(50% - 0.5rem);
  }

  .stepper li::before {
    display: none;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ---- Analytics visualizations ---- */
.analytics-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.analytics-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}

.analytics-filter {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.78rem;
  color: var(--ink-2);
  min-width: 220px;
}

.analytics-kpi-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 0.4rem 0 0.6rem;
}

.analytics-kpi {
  flex: 1 1 140px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm, 8px);
  background: var(--surface-sunken);
  padding: 0.6rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.analytics-kpi .label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-2);
}

.analytics-kpi strong {
  font-size: 1.15rem;
}

.analytics-kpi strong.pos {
  color: var(--good);
}

.analytics-kpi strong.neg {
  color: var(--danger);
}

.chart-host {
  width: 100%;
  margin-top: 0.4rem;
}

.chart-host svg {
  width: 100%;
  height: auto;
  display: block;
}

.chart-empty {
  padding: 1.5rem 0.5rem;
  text-align: center;
  color: var(--ink-2);
  font-size: 0.9rem;
}

.chart-grid {
  stroke: var(--line);
  stroke-width: 1;
}

.chart-grid.dashed {
  stroke-dasharray: 4 4;
}

.chart-zero {
  stroke: var(--line-strong);
  stroke-width: 1.4;
}

.chart-axis-label {
  fill: var(--ink-2);
  font-size: 10px;
  font-family: inherit;
}

.chart-axis-title {
  fill: var(--ink-2);
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-top: 0.6rem;
  font-size: 0.78rem;
  color: var(--ink-2);
}

.chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.chart-legend-item .swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  display: inline-block;
}

.chart-legend-item .swatch.line {
  height: 0;
  border-top: 2.4px dashed var(--accent-strong);
  border-radius: 0;
}

.status-kanban {
  display: grid;
  grid-template-columns: repeat(var(--col-count, 8), minmax(0, 1fr));
  gap: 0.45rem;
  margin-top: 0.7rem;
  padding-bottom: 0.25rem;
  align-items: start;
}

.kanban-column {
  min-width: 0;
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  border-top: 3px solid var(--status-color, var(--accent));
  border-radius: var(--r-sm, 8px);
  padding: 0.5rem 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.kanban-column-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.3rem;
}

.kanban-column-title {
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kanban-count {
  flex: none;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink);
  background: color-mix(in srgb, var(--status-color, var(--accent)) 18%, transparent);
  border-radius: 999px;
  min-width: 1.3rem;
  text-align: center;
  padding: 0.05rem 0.4rem;
}

.kanban-column-value {
  font-size: 0.74rem;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kanban-cards {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-height: 1.5rem;
}

.kanban-card {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--status-color, var(--accent));
  border-radius: 6px;
  padding: 0.45rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(0, 0, 0, 0.05));
  min-width: 0;
}

.kanban-card-title {
  display: flex;
  flex-wrap: wrap;
  gap: 0.05rem 0.35rem;
  font-size: 0.8rem;
  color: var(--ink);
  line-height: 1.25;
  min-width: 0;
}

.kanban-card-code {
  font-weight: 700;
}

.kanban-card-name {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kanban-card-sub {
  font-size: 0.72rem;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kanban-card-foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem;
  font-size: 0.74rem;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.kanban-card-margin {
  color: var(--ink-2);
}

.kanban-card-flag {
  align-self: flex-start;
  font-size: 0.66rem;
  font-weight: 600;
  color: var(--warn);
  background: var(--warn-soft);
  border-radius: 4px;
  padding: 0.05rem 0.35rem;
}

.kanban-empty {
  margin: 0;
  font-size: 0.74rem;
  color: var(--ink-2);
  opacity: 0.6;
  padding: 0.1rem;
  text-align: center;
}

/* Compact density: hide customer + margin, keep code/name/value. */
.status-kanban.density-compact .kanban-card-sub,
.status-kanban.density-compact .kanban-card-margin,
.status-kanban.density-compact .kanban-card-flag {
  display: none;
}

.status-kanban.density-compact .kanban-card-name {
  white-space: nowrap;
}

.status-kanban.density-compact .kanban-card {
  padding: 0.35rem 0.4rem;
  gap: 0.1rem;
}

/* Chip density: cards collapse to tight job-number chips, wrapping in rows. */
.status-kanban.density-chip .kanban-cards {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.status-kanban.density-chip .kanban-card {
  flex-direction: row;
  padding: 0.12rem 0.4rem;
  border-radius: 999px;
  border-left-width: 1px;
  background: color-mix(in srgb, var(--status-color, var(--accent)) 12%, var(--surface));
  border-color: color-mix(in srgb, var(--status-color, var(--accent)) 35%, var(--line-strong));
}

.status-kanban.density-chip .kanban-card-name,
.status-kanban.density-chip .kanban-card-sub,
.status-kanban.density-chip .kanban-card-foot,
.status-kanban.density-chip .kanban-card-flag {
  display: none;
}

.status-kanban.density-chip .kanban-card-title {
  flex-wrap: nowrap;
}

.status-kanban.density-chip .kanban-card-code {
  font-size: 0.72rem;
}

.matrix-tip {
  margin-top: 0.5rem;
  font-size: 0.82rem;
}

/* ---- Lifecycle (status history) widgets ---- */
.lifecycle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.2rem;
  margin-top: 0.6rem;
}

.lifecycle-block {
  margin-top: 1.1rem;
}

.lifecycle-grid .lifecycle-block {
  margin-top: 0;
}

.lifecycle-block h3 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
}

.dwell-chart,
.status-bars {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.dwell-row {
  display: grid;
  grid-template-columns: 110px 1fr auto;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.83rem;
}

.dwell-label {
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dwell-track {
  height: 14px;
  background: var(--surface-sunken);
  border-radius: 7px;
  overflow: hidden;
}

.dwell-fill {
  display: block;
  height: 100%;
  border-radius: 7px;
  min-width: 3px;
  transition: width 0.3s ease;
}

.dwell-value {
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: right;
}

.timeline-from {
  color: var(--ink-2);
}

.timeline-arrow {
  color: var(--ink-2);
  margin: 0 0.2rem;
}

.timeline-to {
  font-weight: 600;
}

.assignment-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
}

.assignment-chip-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--ink-muted);
  cursor: pointer;
  font-size: 0.7rem;
  padding: 0;
  line-height: 1;
  transition: background 0.1s, color 0.1s;
}

.assignment-chip-remove:hover {
  background: var(--danger);
  color: #fff;
}

.fin-summary-detail {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 2px solid var(--accent-soft);
}

.fin-summary-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}

.fin-summary-selected-label {
  font-weight: 700;
  font-size: 1rem;
  color: var(--ink);
}

.customer-projects {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line-strong);
}

.customer-projects .list-header {
  align-items: center;
}

.list-header-main {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}

.list-header-main h4 {
  margin: 0;
}

.customer-projects .table-toolbar {
  margin-bottom: 0.6rem;
}

.customer-projects .table-scroll {
  max-height: 320px;
  overflow: auto;
}
