/* Page-specific styles for BuildEx Engine */

/* ============= APP LAYOUT ============= */
.app {
  display: grid;
  grid-template-columns: 264px 1fr;
  grid-template-rows: 60px 1fr 28px;
  grid-template-areas:
    "side top"
    "side main"
    "side foot";
  height: 100vh;
  position: relative;
  z-index: 1;
}

/* ============= SIDEBAR ============= */
.sidebar {
  grid-area: side;
  background: linear-gradient(180deg, rgba(10,18,34,0.85), rgba(8,14,28,0.95));
  border-right: 1px solid var(--glass-border);
  display: flex; flex-direction: column;
  padding: 20px 14px 12px;
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 6px 18px; }
.brand-mark { display: flex; align-items: center; justify-content: center; }
.brand-title { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.brand-title span { color: var(--accent); font-weight: 500; }
.brand-sub { font-size: 10px; color: var(--fg-2); letter-spacing: 0.08em; text-transform: uppercase; margin-top: 2px; }

.env-card { padding: 12px; margin-bottom: 16px; display: flex; flex-direction: column; gap: 8px; }
/* R2.1e: the sidebar env-card is a ~212px column. Its BAS-sync row holds a
   label + a status pill; the longest state ("SYNC AWAITING APPROVAL") cannot fit
   beside the label, so keep the pill a single-line lozenge (nowrap) and let the
   row wrap it onto its own line instead of wrapping the pill text to 2-3 lines. */
.env-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; row-gap: 4px; font-size: 11px; }
.env-row .pill { white-space: nowrap; }
.env-label { color: var(--fg-2); letter-spacing: 0.06em; text-transform: uppercase; font-size: 10px; }
.env-val { color: var(--fg-1); display: inline-flex; align-items: center; gap: 6px; font-size: 11px; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px currentColor; animation: pulse-soft 2s ease-in-out infinite; color: var(--accent); }
.live-dot.ok { background: var(--ok); color: var(--ok); }
.live-dot.warn { background: var(--warn); color: var(--warn); }

.nav { display: flex; flex-direction: column; gap: 14px; flex: 1; }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group-title { font-size: 10px; color: var(--fg-3); letter-spacing: 0.1em; text-transform: uppercase; padding: 8px 10px 4px; }
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border-radius: var(--r-sm);
  color: var(--fg-1);
  font-size: 13px;
  text-align: left;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(120,170,230,0.05); color: var(--fg-0); }
.nav-item.is-active { background: rgba(56,189,248,0.08); color: var(--fg-0); }
.nav-item.is-active .nav-rail { position: absolute; left: -14px; top: 8px; bottom: 8px; width: 2px; background: var(--accent); border-radius: 0 2px 2px 0; box-shadow: 0 0 8px var(--accent-glow); }

.side-foot { padding: 12px 6px 0; border-top: 1px solid var(--glass-border); margin-top: 12px; font-size: 10px; color: var(--fg-2); }
.side-foot .dim { color: var(--fg-3); margin-top: 2px; }

/* ============= TOPBAR ============= */
.topbar {
  grid-area: top;
  display: flex; align-items: center; gap: 16px;
  padding: 0 24px;
  border-bottom: 1px solid var(--glass-border);
  background: rgba(8, 14, 28, 0.55);
  backdrop-filter: blur(12px);
}
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 11px; color: var(--fg-1); }
.crumb.dim { color: var(--fg-2); }
.topbar-search {
  display: flex; align-items: center; gap: 8px;
  flex: 1; max-width: 540px;
  margin-left: 12px;
  padding: 7px 12px;
  border-radius: var(--r-md);
}
.topbar-search input { flex: 1; background: transparent; border: 0; outline: 0; font-size: 13px; color: var(--fg-0); }
.topbar-search input::placeholder { color: var(--fg-3); }
.kbd { font-size: 10px; color: var(--fg-2); border: 1px solid var(--glass-border); padding: 2px 6px; border-radius: 4px; }

.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.language-switch {
  display: inline-grid;
  grid-template-columns: 18px 38px 42px;
  align-items: center;
  min-height: 30px;
  padding: 2px 3px;
  border: 1px solid var(--glass-border);
  border-radius: var(--r-md);
  background: rgba(8, 14, 28, 0.45);
  color: var(--fg-2);
}
.language-icon { justify-self: center; }
.language-switch button {
  width: 100%;
  min-height: 24px;
  padding: 0 6px;
  border-radius: var(--r-sm);
  color: var(--fg-2);
  font-size: 10px;
  line-height: 1;
}
.language-switch button:hover { color: var(--fg-0); background: rgba(120,170,230,0.06); }
.language-switch button.is-active {
  color: #DCF1FF;
  background: rgba(56,189,248,0.13);
  box-shadow: inset 0 0 0 1px rgba(56,189,248,0.28);
}
.language-switch button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.clock { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--fg-1); padding: 6px 12px; border: 1px solid var(--glass-border); border-radius: var(--r-md); }
.ghost-btn {
  position: relative;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 11px;
  font-size: 12px;
  color: var(--fg-1);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-md);
  background: rgba(255,255,255,0.01);
  transition: background .15s, border-color .15s, color .15s;
}
.ghost-btn:hover { background: rgba(120,170,230,0.07); border-color: var(--glass-border-strong); color: var(--fg-0); }
.ghost-btn.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}
.buildex-kpis {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.readiness-checks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 20px;
  margin-top: 8px;
}

/* BuildEx project disclosure: business data, not a terminal dump. */
.buildex-section {
  padding: 18px 20px;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  background: rgba(9, 17, 31, 0.42);
}
.buildex-section-head,
.buildex-table-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}
.buildex-section-title { display: flex; align-items: flex-start; gap: 11px; min-width: 0; }
.buildex-section-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border: 1px solid rgba(56, 189, 248, 0.24);
  border-radius: 7px;
  background: rgba(56, 189, 248, 0.08);
  color: var(--accent);
}
.buildex-section h2,
.buildex-table-section h2 {
  margin: 0;
  color: var(--fg-0);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0;
}
.buildex-section-head p,
.buildex-table-section-head p {
  margin: 4px 0 0;
  color: var(--fg-2);
  font-size: 11.5px;
  line-height: 1.45;
  letter-spacing: 0;
}
.buildex-project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 28px;
  margin: 17px 0 0;
}
.buildex-project-value {
  min-width: 0;
  padding: 12px 0;
  border-top: 1px solid rgba(120, 170, 230, 0.09);
}
.buildex-project-value.is-wide { grid-column: 1 / -1; }
.buildex-project-value dt {
  margin: 0 0 5px;
  color: var(--fg-2);
  font-size: 10.5px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: 0;
}
.buildex-project-value dd {
  margin: 0;
  color: var(--fg-0);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.55;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}
.buildex-project-value.is-wide dd { max-width: 1120px; font-weight: 400; }
.buildex-profile-issues {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(245, 181, 68, 0.2);
  color: var(--warn);
  font-size: 11.5px;
}
.buildex-profile-issues span { display: inline-flex; align-items: center; gap: 6px; }
.buildex-requirement-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 22px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}
.buildex-requirement-list li {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  color: var(--fg-1);
  font-size: 12.5px;
  line-height: 1.4;
}
.buildex-check-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  border-radius: 50%;
  background: rgba(52, 211, 153, 0.08);
  color: var(--ok);
}
.buildex-table-section { display: flex; flex-direction: column; gap: 10px; }
@media (max-width: 900px) {
  .buildex-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .buildex-kpis, .readiness-checks, .buildex-project-grid,
  .buildex-requirement-list { grid-template-columns: 1fr; }
  .buildex-section { padding: 16px; }
  .buildex-section-head, .buildex-table-section-head { flex-direction: column; gap: 10px; }
  .buildex-project-value.is-wide { grid-column: auto; }
}
.ghost-btn.sm { padding: 4px 8px; font-size: 11px; }
.ghost-btn .badge { position: absolute; top: -4px; right: -4px; min-width: 16px; height: 16px; padding: 0 4px; background: var(--err); color: white; font-size: 9px; font-weight: 600; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; border: 2px solid var(--bg-0); }

.primary-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  font-size: 12px; font-weight: 500;
  background: linear-gradient(180deg, rgba(56,189,248,0.25), rgba(56,189,248,0.10));
  border: 1px solid rgba(56,189,248,0.45);
  color: #DCF1FF;
  border-radius: var(--r-md);
  box-shadow: 0 0 0 1px rgba(56,189,248,0.10), 0 4px 16px rgba(56,189,248,0.18);
  transition: transform .15s, box-shadow .15s;
}
.primary-btn:hover { transform: translateY(-1px); box-shadow: 0 0 0 1px rgba(56,189,248,0.18), 0 8px 24px rgba(56,189,248,0.28); }
.primary-btn.is-running { background: linear-gradient(180deg, rgba(245,181,68,0.20), rgba(245,181,68,0.08)); border-color: rgba(245,181,68,0.45); color: #FFE9C4; }

/* ============= SHARED BUTTON INTERACTION SYSTEM (overnight 2026-07-16) ====
   One model for every actionable control: immediate pressed feedback
   (subtle downward translate + compressed inset shadow), a short release
   transition, no layout shift; disabled controls neither animate nor
   respond; async controls flip to a stable .is-busy spinner (aria-busy);
   keyboard focus stays visible; prefers-reduced-motion kills movement. */
.primary-btn, .ghost-btn, .nav-item, .language-switch button {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.primary-btn:active:not(:disabled):not(.is-busy) {
  transform: translateY(1px) scale(0.985);
  box-shadow: inset 0 2px 6px rgba(2,10,22,0.45),
              0 0 0 1px rgba(56,189,248,0.14);
  transition-duration: .05s;
}
.ghost-btn:active:not(:disabled):not(.is-busy),
.nav-item:active:not(:disabled),
.language-switch button:active:not(:disabled) {
  transform: translateY(1px) scale(0.985);
  box-shadow: inset 0 2px 5px rgba(2,10,22,0.40);
  transition-duration: .05s;
}
.primary-btn:disabled, .ghost-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none;
}
.primary-btn:focus-visible, .ghost-btn:focus-visible, .nav-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
/* Stable busy state: spinner replaces movement, double submits blocked in
   JS (busy flags) AND visually communicated here. */
.primary-btn.is-busy, .ghost-btn.is-busy {
  pointer-events: none;
  position: relative;
  color: transparent !important;
}
.primary-btn.is-busy::after, .ghost-btn.is-busy::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 12px; height: 12px;
  margin: -7px 0 0 -7px;
  border: 2px solid rgba(220,241,255,0.35);
  border-top-color: #DCF1FF;
  border-radius: 50%;
  animation: btn-spin .7s linear infinite;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }
/* Inline form errors: the form STAYS OPEN on failure; the reason renders
   next to the actions, never only in a distant banner. */
.form-error {
  border: 1px solid rgba(240,82,82,0.45);
  background: rgba(240,82,82,0.08);
  color: #FFD7D7;
  border-radius: var(--r-md);
  padding: 8px 10px;
  font-size: 11.5px;
  line-height: 1.45;
  white-space: pre-wrap;
}
.field-hint { color: var(--fg-2); font-size: 10.5px; margin-top: 3px; line-height: 1.4; }
.field-hint.is-bad { color: #FFC9C9; }
@media (prefers-reduced-motion: reduce) {
  .primary-btn, .ghost-btn, .nav-item, .language-switch button {
    transition: none;
  }
  .primary-btn:hover, .primary-btn:active:not(:disabled),
  .ghost-btn:active:not(:disabled), .nav-item:active:not(:disabled),
  .language-switch button:active:not(:disabled) {
    transform: none;
  }
  .primary-btn.is-busy::after, .ghost-btn.is-busy::after {
    animation-duration: 1.6s;
  }
}

.avatar { width: 30px; height: 30px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; background: linear-gradient(135deg, #2A4267, #15233D); color: var(--fg-0); border: 1px solid var(--glass-border-strong); }
.avatar-sm { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 600; background: linear-gradient(135deg, #1F2F4D, #0E1A2E); color: var(--fg-1); border: 1px solid var(--glass-border-strong); flex-shrink: 0; }

/* ============= MAIN ============= */
.main {
  grid-area: main;
  overflow-y: auto;
  padding: 28px 32px 60px;
  position: relative;
}
.page { display: flex; flex-direction: column; gap: 20px; max-width: 1480px; margin: 0 auto; }

.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.eyebrow { font-size: 10px; color: var(--fg-2); letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 6px; }
.page-title { font-size: 28px; font-weight: 600; letter-spacing: -0.015em; margin: 0; line-height: 1.15; }
.page-sub { color: var(--fg-1); font-size: 13px; margin-top: 6px; }
.page-header-actions { display: flex; align-items: center; gap: 8px; }

/* ============= STATUSBAR ============= */
.statusbar {
  grid-area: foot;
  display: flex; align-items: center; gap: 12px;
  padding: 0 18px;
  border-top: 1px solid var(--glass-border);
  background: rgba(8, 14, 28, 0.7);
  font-size: 10px; color: var(--fg-2);
  letter-spacing: 0.04em;
}
.statusbar .sep { width: 3px; height: 3px; background: var(--fg-3); border-radius: 50%; }
.statusbar .grow { flex: 1; }

/* ============= HERO FLOW ============= */
.hero-flow {
  position: relative;
  padding: 22px 24px 18px;
  overflow: hidden;
}
.hero-flow::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(800px 200px at 10% 50%, rgba(56,189,248,0.12), transparent 60%),
    radial-gradient(700px 200px at 95% 50%, rgba(52,211,153,0.10), transparent 60%);
  pointer-events: none;
}
.hero-flow-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; position: relative; z-index: 1; }
.hero-flow-title { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; margin-top: 4px; }
.hero-flow-meta { display: flex; align-items: center; gap: 12px; font-size: 11px; color: var(--fg-1); }
.hero-flow-meta .sep { width: 3px; height: 3px; background: var(--fg-3); border-radius: 50%; }

.hero-flow-stage { position: relative; padding: 28px 0 16px; height: 240px; }
.flow-etch { position: absolute; inset: 0; width: 100%; height: 100%; }
.flow-particles { position: absolute; left: 6%; right: 6%; top: 50%; height: 0; pointer-events: none; }
.flow-particle {
  position: absolute; top: -2px; width: 4px; height: 4px;
  border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 10px 2px rgba(56,189,248,0.7), 0 0 20px rgba(56,189,248,0.3);
  transform: translateX(-50%);
}

.flow-nodes {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0;
  padding: 0 4px;
}
.flow-node { position: relative; display: flex; flex-direction: column; align-items: center; padding: 6px 8px; }
.flow-node-ring { position: relative; width: 56px; height: 56px; display: flex; align-items: center; justify-content: center; }
.flow-node-icon {
  position: relative; z-index: 1;
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(56,189,248,0.18), rgba(56,189,248,0.04));
  border: 1px solid rgba(56,189,248,0.35);
  color: #BEE5FF;
  transition: all .25s;
}
.ring-svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); transition: stroke .25s; }
.flow-node.is-flashing .flow-node-icon { background: linear-gradient(180deg, rgba(245,181,68,0.20), rgba(245,181,68,0.06)); border-color: rgba(245,181,68,0.55); color: #FFE9C4; animation: pulse-soft 0.8s ease-in-out infinite; }
.flow-node.is-success .flow-node-icon  { background: linear-gradient(180deg, rgba(52,211,153,0.22), rgba(52,211,153,0.06)); border-color: rgba(52,211,153,0.55); color: #C6F6E0; }

.flow-node-label { font-size: 12px; font-weight: 500; margin-top: 10px; color: var(--fg-0); }
.flow-node-sub { font-size: 10px; color: var(--fg-2); margin-top: 2px; letter-spacing: 0.05em; }
.flow-node-counter { font-size: 13px; color: var(--accent); margin-top: 8px; }
.flow-node-counter .num { font-weight: 600; }
.flow-node-counter .dim { color: var(--fg-3); }
.flow-node-sample { font-size: 10px; color: var(--fg-2); margin-top: 4px; padding: 2px 6px; border: 1px dashed var(--glass-border-strong); border-radius: 3px; }

.flow-connector { position: absolute; right: -8px; top: 22px; color: var(--fg-3); }

.hero-flow-foot { display: flex; align-items: center; justify-content: space-between; padding-top: 8px; border-top: 1px solid var(--glass-border); margin-top: 4px; position: relative; z-index: 1; }
.legend { display: flex; gap: 14px; font-size: 10px; color: var(--fg-2); }
.legend .lg { display: inline-flex; align-items: center; gap: 6px; }
.legend .lg-dot { width: 6px; height: 6px; border-radius: 50%; box-shadow: 0 0 8px currentColor; }
.hero-flow-foot-right { font-size: 10px; color: var(--fg-2); }

/* ============= KPI ============= */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kpi-grid-2 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kpi { padding: var(--pad-card); display: flex; flex-direction: column; gap: 8px; min-height: 130px; transition: transform .2s, box-shadow .2s; }
.kpi:hover { transform: translateY(-1px); box-shadow: var(--shadow-2); }
.kpi-head { display: flex; align-items: center; justify-content: space-between; }
.kpi-label { font-size: 10px; color: var(--fg-2); letter-spacing: 0.1em; text-transform: uppercase; }
.kpi-value { font-size: 26px; font-weight: 600; letter-spacing: -0.015em; line-height: 1.05; font-feature-settings: "tnum"; }
.kpi-frac { font-size: 14px; color: var(--fg-2); font-weight: 400; }
.kpi-sub { font-size: 11px; color: var(--fg-1); }
.warn-text { color: var(--warn); }
.err-text  { color: var(--err); }
.ok-text   { color: var(--ok); }
.kpi-spark { margin-top: auto; }

/* ============= CARDS / SHARED ============= */
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 14px; border-bottom: 1px solid var(--glass-border); margin-bottom: 14px; }
.card-eyebrow { font-size: 10px; color: var(--fg-2); letter-spacing: 0.1em; text-transform: uppercase; }
.card-title { font-size: 15px; font-weight: 600; margin-top: 4px; }

/* ============= STEPPER ============= */
.stepper { padding: 18px 20px; flex: 1; }
.stepper-track { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; padding: 8px 0 4px; }
.stepper-step { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 0 8px; }
.step-dot { width: 24px; height: 24px; border-radius: 50%; background: rgba(120,140,170,0.06); border: 1px solid var(--glass-border-strong); color: var(--fg-2); display: inline-flex; align-items: center; justify-content: center; font-size: 11px; position: relative; z-index: 2; }
.step-num { font-size: 10px; }
.stepper-step.is-done .step-dot { background: rgba(52,211,153,0.12); border-color: var(--ok-border); color: var(--ok); }
.stepper-step.is-active .step-dot { background: rgba(56,189,248,0.12); border-color: var(--accent); color: var(--accent); }
.stepper-step.kind-warn.is-done .step-dot { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn); }
.step-line { position: absolute; left: calc(50% + 14px); right: -50%; top: 11px; height: 1px; background: linear-gradient(90deg, var(--glass-border-strong), var(--glass-border)); z-index: 1; }
.stepper-step.is-done .step-line { background: linear-gradient(90deg, var(--ok-border), var(--glass-border)); }
.step-body { font-size: 11px; }
.step-label { font-size: 12px; color: var(--fg-0); }
.step-meta { font-size: 11px; color: var(--fg-1); margin-top: 2px; }
.step-count { color: var(--fg-0); font-weight: 500; }
.step-spinner { width: 12px; height: 12px; border: 1.5px solid currentColor; border-top-color: transparent; border-radius: 50%; animation: spin 0.8s linear infinite; display: inline-block; }

/* ============= AUDIT ============= */
.audit { padding: 18px 20px; }
.audit-list { display: flex; flex-direction: column; }
.audit-row { display: grid; grid-template-columns: 80px 16px 1fr 140px; align-items: center; gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--glass-border); }
.audit-row:last-child { border-bottom: 0; }
.audit-time { font-size: 11px; color: var(--fg-2); }
.audit-bullet { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px currentColor; color: var(--accent); }
.audit-bullet.kind-ok { background: var(--ok); color: var(--ok); }
.audit-bullet.kind-warn { background: var(--warn); color: var(--warn); }
.audit-bullet.kind-info { background: var(--info); color: var(--info); }
.audit-act { font-size: 13px; }
.audit-meta { font-size: 11px; color: var(--fg-2); margin-top: 2px; }
.audit-who { font-size: 11px; color: var(--fg-2); text-align: right; }

/* ============= BAS MINI ============= */
.bas-mini { padding: 18px 20px; flex: 1; }
.bas-list { display: flex; flex-direction: column; gap: 6px; }
.bas-row { display: grid; grid-template-columns: 110px 1fr 90px 50px 50px 90px; align-items: center; gap: 12px; padding: 8px 6px; border-radius: var(--r-sm); font-size: 12px; }
.bas-row:hover { background: rgba(120,170,230,0.04); }
.bas-id { color: var(--fg-1); font-size: 11px; }
.bas-site { color: var(--fg-1); }
.bas-state { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--fg-1); }
.bas-last { font-size: 11px; color: var(--fg-2); text-align: right; }
.bas-reads { font-size: 11px; color: var(--fg-0); text-align: right; font-weight: 500; }
.bas-bar { height: 4px; background: rgba(120,140,170,0.08); border-radius: 2px; overflow: hidden; }
.bas-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

.dash-row { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; }

/* ============= TABLES ============= */
.toolbar { display: flex; flex-wrap: wrap; row-gap: 8px; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r-md); }
.toolbar-search { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: rgba(120,140,170,0.05); border: 1px solid var(--glass-border); border-radius: var(--r-sm); flex: 1; min-width: 0; max-width: 380px; }
/* min-width:0 is REQUIRED: a flex item's default min-width is `auto`, which for
   an <input> resolves to its intrinsic text width — so without this the input
   refuses to shrink and OVERFLOWS its `.toolbar-search` parent (which itself has
   flex:1;min-width:0 and collapses), overlapping the next control at narrow
   widths. Containment here fixes the overlap at EVERY width. */
.toolbar-search input { background: transparent; border: 0; outline: 0; flex: 1; min-width: 0; color: var(--fg-0); font-size: 12px; }
.toolbar-search input::placeholder { color: var(--fg-3); }
.select { background: rgba(120,140,170,0.05); border: 1px solid var(--glass-border); color: var(--fg-1); padding: 6px 10px; border-radius: var(--r-sm); font-size: 12px; outline: 0; max-width: 100%; }
.select:focus { border-color: var(--accent); }
.grow { flex: 1; }
.dim { color: var(--fg-2); }

/* Narrow widths: give the search field its own full-width row so it stays
   usable, and let the status filter + Reload wrap onto the row below — never
   overlapping or clipping. Desktop (>600px) layout is unchanged. */
@media (max-width: 600px) {
  .toolbar-search { flex-basis: 100%; max-width: none; }
}

.table { padding: 0; overflow: hidden; }
.buildex-preview-table { overflow-x: auto; }
.buildex-preview-table .thead,
.buildex-preview-table .tr { min-width: 980px; column-gap: 14px; }
.buildex-preview-table .tr > div,
.buildex-preview-table .thead > div { min-width: 0; }
.table.buildex-preview-table.dev-generic .tr > div {
  overflow: visible; text-overflow: clip; white-space: normal; overflow-wrap: anywhere;
}
.buildex-preview-table .pill { margin-left: 6px; }
@media (max-width: 620px) {
  .buildex-preview-table { overflow: visible; }
  .buildex-preview-table .thead { display: none; }
  .buildex-preview-table .tr {
    min-width: 0 !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 14px 18px;
    padding: 14px;
  }
  .buildex-preview-table .tr > div::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 4px;
    color: var(--fg-2);
    font-family: var(--mono);
    font-size: 9px;
    text-transform: uppercase;
  }
  .buildex-preview-table .tr > div:nth-child(5) { grid-column: 1 / -1; }
}
.thead { display: grid; padding: 12px 18px; font-size: 10px; color: var(--fg-2); letter-spacing: 0.1em; text-transform: uppercase; border-bottom: 1px solid var(--glass-border); background: rgba(8,14,28,0.3); }
.page-workers .thead { grid-template-columns: 1.6fr 1.2fr 1fr 0.7fr 0.9fr 0.9fr 1.1fr 1.4fr; }
.tbody { display: flex; flex-direction: column; }
.tr {
  display: grid;
  align-items: center;
  padding: 10px 18px;
  font-size: 12px;
  text-align: left;
  color: var(--fg-1);
  border-bottom: 1px solid rgba(120,170,230,0.05);
  cursor: pointer;
  transition: background .12s;
}
.page-workers .tr { grid-template-columns: 1.6fr 1.2fr 1fr 0.7fr 0.9fr 0.9fr 1.1fr 1.4fr; }
.tr:hover { background: rgba(120,170,230,0.04); }
.tr.is-static { cursor: default; }
.tr.is-static:hover { background: transparent; }
.tr.is-selected { background: rgba(56,189,248,0.06); }
.t-right { text-align: right; }
.td-worker { display: flex; align-items: center; gap: 10px; }
.td-name { color: var(--fg-0); font-size: 13px; font-weight: 500; }
.td-meta { font-size: 10px; }
.compliance-cell { display: flex; align-items: center; gap: 8px; }
.compliance-cell .bar { flex: 1; height: 4px; background: rgba(120,140,170,0.08); border-radius: 2px; overflow: hidden; max-width: 80px; }
.compliance-cell .bar span { display: block; height: 100%; }
.tfoot { display: flex; align-items: center; padding: 10px 18px; font-size: 11px; color: var(--fg-2); border-top: 1px solid var(--glass-border); }

.heatmap { display: grid; grid-template-columns: repeat(15, 1fr); gap: 2px; max-width: 160px; margin-left: auto; }
.heat { width: 100%; aspect-ratio: 1; border-radius: 1px; background: rgba(120,140,170,0.08); }
.heat-1 { background: rgba(56,189,248,0.25); }
.heat-2 { background: rgba(56,189,248,0.55); }
.heat-3 { background: rgba(56,189,248,0.9); box-shadow: 0 0 4px rgba(56,189,248,0.4); }

/* ============= BAS PAGE ============= */
.bas-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.bas-stat { padding: 18px 20px; display: flex; flex-direction: column; gap: 8px; min-height: 120px; }
.bas-stat-big { font-size: 28px; font-weight: 600; letter-spacing: -0.015em; line-height: 1; font-feature-settings: "tnum"; }
.bas-stat-big .dim { font-size: 14px; color: var(--fg-3); font-weight: 400; }
.bas-stat-sub { font-size: 11px; color: var(--fg-1); display: flex; align-items: center; gap: 6px; }

.bas-stream { padding: 18px 20px; }
.stream-table { display: flex; flex-direction: column; }
.stream-table .thead { grid-template-columns: 110px 130px 130px 90px 110px 1fr; padding: 10px 0; }
.stream-row { display: grid; grid-template-columns: 110px 130px 130px 90px 110px 1fr; align-items: center; padding: 10px 0; font-size: 12px; color: var(--fg-1); border-bottom: 1px solid rgba(120,170,230,0.05); }
.stream-row.is-new { animation: streamIn 0.4s ease-out; }
@keyframes streamIn { from { opacity: 0; transform: translateY(-4px); background: rgba(56,189,248,0.1); } to { opacity: 1; transform: translateY(0); background: transparent; } }

/* ============= VALIDATION ============= */
.val-shell { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; align-items: start; }
.val-list { padding: 0; overflow: hidden; }
.val-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--glass-border); padding: 4px 4px 0; }
.val-tab { display: flex; align-items: center; gap: 8px; padding: 12px 16px; font-size: 12px; color: var(--fg-2); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.val-tab.is-active { color: var(--fg-0); border-bottom-color: var(--accent); }
.val-rows { display: flex; flex-direction: column; max-height: 480px; overflow-y: auto; }
.val-row {
  display: grid;
  grid-template-columns: 22px 70px 100px 1.4fr 1.6fr 100px;
  align-items: center; gap: 12px;
  padding: 12px 18px;
  text-align: left;
  font-size: 12px; color: var(--fg-1);
  border-bottom: 1px solid rgba(120,170,230,0.05);
  border-left: 2px solid transparent;
}
.val-row:hover { background: rgba(120,170,230,0.04); }
.val-row.is-open { background: rgba(56,189,248,0.05); border-left-color: var(--accent); }
.val-row.kind-err .val-sev { color: var(--err); }
.val-row.kind-warn .val-sev { color: var(--warn); }
.val-id { color: var(--fg-0); }
.val-rule { color: var(--fg-2); font-size: 11px; }
.val-title { color: var(--fg-0); }
.val-who { font-size: 11px; }
.val-date { font-size: 11px; }

.val-drawer { padding: 20px 22px; position: sticky; top: 12px; }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--glass-border); margin-bottom: 14px; }
.drawer-title { font-size: 16px; font-weight: 600; margin-top: 4px; }
.drawer-section { padding: 12px 0; border-bottom: 1px solid var(--glass-border); }
.drawer-section:last-child { border-bottom: 0; }
.drawer-label { font-size: 10px; color: var(--fg-2); letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 8px; }
.drawer-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.drawer-detail { font-size: 12px; line-height: 1.55; color: var(--fg-1); margin: 0; }
.evidence { display: flex; flex-direction: column; gap: 6px; }
.evi-row { display: grid; grid-template-columns: 1.4fr 1fr 0.6fr 0.5fr; font-size: 11px; padding: 6px 8px; border: 1px dashed var(--glass-border-strong); border-radius: var(--r-sm); color: var(--fg-1); }
.drawer-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }

/* ============= SUBMIT ============= */
.submit-shell { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.submit-pipeline { padding: 20px 24px; }
.submit-stages { display: flex; flex-direction: column; gap: 0; padding: 8px 0; margin: 0; list-style: none; }
.submit-stage { position: relative; display: grid; grid-template-columns: 36px 1fr auto; align-items: center; gap: 14px; padding: 14px 0; }
.ss-dot { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: rgba(120,140,170,0.06); border: 1px solid var(--glass-border-strong); color: var(--fg-2); font-size: 11px; position: relative; z-index: 2; }
.submit-stage.is-done .ss-dot { background: rgba(52,211,153,0.12); border-color: var(--ok-border); color: var(--ok); }
.submit-stage.is-active .ss-dot { background: rgba(56,189,248,0.12); border-color: var(--accent); color: var(--accent); }
.ss-label { font-size: 13px; font-weight: 500; }
.ss-sub { font-size: 11px; color: var(--fg-2); margin-top: 2px; }
.ss-meta { font-size: 11px; }
.ss-line { position: absolute; left: 17px; top: 42px; bottom: -14px; width: 1px; background: var(--glass-border); z-index: 1; }
.submit-stage.is-done .ss-line { background: linear-gradient(180deg, var(--ok-border), var(--glass-border)); }

.submit-side { display: flex; flex-direction: column; gap: 14px; }
.payload { padding: 18px 20px; }
.code {
  font-size: 11px;
  line-height: 1.6;
  color: #C9D6EC;
  background: rgba(8,14,28,0.5);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-sm);
  padding: 14px;
  margin: 0;
  white-space: pre-wrap;
  max-height: 320px;
  overflow: auto;
}
.receipt { padding: 18px 20px; }
.receipt-grid { display: grid; grid-template-columns: 110px 1fr; gap: 10px 14px; font-size: 12px; align-items: center; }

/* ============= HISTORY ============= */
.history { padding: 0; }
.history .thead { grid-template-columns: 110px 1.6fr 0.7fr 0.9fr 0.9fr 1.4fr 1fr 160px; }
.history .tr { grid-template-columns: 110px 1.6fr 0.7fr 0.9fr 0.9fr 1.4fr 1fr 160px; }
.history-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 4px; }
.hist-stat { padding: 18px 20px; }

/* ============= TWEAKS POSITIONING ============= */
[data-density="compact"] .page-title { font-size: 24px; }
[data-density="compact"] .kpi { min-height: 110px; }
[data-density="compact"] .kpi-value { font-size: 22px; }
