/* Manufacturing Engineering Hub: sober technical look.
   Graphite neutrals, one signal accent, status colours with meaning only. */
:root {
  --hub-ink: #1d2327;
  --hub-ink-2: #4a545b;
  --hub-muted: #6b757c;
  --hub-line: #dfe3e6;
  --hub-paper: #f6f7f8;
  --hub-surface: #ffffff;
  --hub-side: #22292e;
  --hub-side-ink: #c9d0d5;
  --hub-accent: #d9692a;      /* safety orange, used sparingly */
  --hub-ok: #2f7d4f;
  --hub-soon: #a66a00;
  --hub-future: #7a838a;
  --hub-down: #b23b3b;
  --hub-mono: "Cascadia Mono", Consolas, "SFMono-Regular", Menlo, monospace;
  --hub-sans: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

body { background: var(--hub-paper); color: var(--hub-ink); font-family: var(--hub-sans); }

.hub-shell { display: flex; min-height: 100vh; }

.hub-sidebar {
  width: 264px; flex: 0 0 264px; background: var(--hub-side); color: var(--hub-side-ink);
  padding: 20px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.hub-brand { padding: 4px 12px 20px; border-bottom: 1px solid #333c42; margin-bottom: 12px; }
.hub-brand-top { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--hub-accent); }
.hub-brand-bottom { font-size: 18px; font-weight: 600; color: #fff; }
.hub-nav-link { color: var(--hub-side-ink) !important; padding: 7px 12px; border-radius: 4px; font-size: 14px; }
.hub-nav-link:hover { background: #2c353b; color: #fff !important; }
.hub-nav-link.active { background: #2f393f; color: #fff !important; box-shadow: inset 3px 0 0 var(--hub-accent); }
.hub-nav-id { font-family: var(--hub-mono); font-size: 12px; color: #8a959c; margin-right: 10px; }

.hub-main { flex: 1; min-width: 0; padding: 32px 40px 64px; }
.hub-page { max-width: 1180px; }

.hub-header { margin-bottom: 28px; }
.hub-header h1 { font-size: 26px; font-weight: 600; margin: 0 0 4px; }
.hub-eyebrow { font-size: 13px; color: var(--hub-muted); margin-bottom: 6px; }
.hub-eyebrow a { color: var(--hub-ink-2); }
.hub-subtitle { color: var(--hub-ink-2); margin: 0; }

section { margin-bottom: 36px; }
section h2 { font-size: 15px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
             color: var(--hub-ink-2); margin-bottom: 12px; }

.hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.hub-card-link, .hub-card-link:hover { color: inherit; text-decoration: none; }
.hub-card {
  background: var(--hub-surface); border: 1px solid var(--hub-line); border-radius: 6px;
  padding: 14px 16px; height: 100%; transition: border-color .12s;
}
.hub-card:hover { border-color: var(--hub-ink-2); }
.hub-card-future, .hub-card-not_installed { background: transparent; }
.hub-card-future .hub-card-title, .hub-card-future .hub-card-text,
.hub-card-not_installed .hub-card-title, .hub-card-not_installed .hub-card-text { color: var(--hub-muted); }
.hub-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.hub-card-title { font-weight: 600; margin-bottom: 2px; }
.hub-card-text { font-size: 13.5px; color: var(--hub-ink-2); }

.hub-code { font-family: var(--hub-mono); font-size: 12.5px; color: var(--hub-ink-2); }
.hub-status { font-size: 12px; font-weight: 600; white-space: nowrap; }
.hub-status::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%;
                      margin-right: 6px; vertical-align: 1px; background: currentColor; }
.hub-status-available { color: var(--hub-ok); }
.hub-status-coming_soon { color: var(--hub-soon); }
.hub-status-future { color: var(--hub-future); }
.hub-status-not_installed { color: var(--hub-future); }

.hub-health { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.hub-health-item { background: var(--hub-surface); border: 1px solid var(--hub-line); border-radius: 6px; padding: 14px 16px; }
.hub-health-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.hub-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.hub-dot-up { background: var(--hub-ok); }
.hub-dot-degraded { background: var(--hub-soon); }
.hub-dot-down { background: var(--hub-down); }

.hub-table { background: var(--hub-surface); border: 1px solid var(--hub-line); font-size: 14px; }
.hub-table th { font-size: 12px; color: var(--hub-muted); font-weight: 600; }
.hub-num { text-align: right; font-variant-numeric: tabular-nums; width: 110px; }
.hub-facts { width: auto; font-size: 14px; margin-bottom: 20px; }
.hub-facts th { color: var(--hub-muted); font-weight: 500; padding-right: 32px; }

.hub-muted { color: var(--hub-muted); }
.hub-small { font-size: 12.5px; }
.hub-ml { margin-left: 12px; }
.hub-note { border-left: 3px solid var(--hub-line); padding: 6px 12px; color: var(--hub-ink-2); }

/* user box */
.hub-user { margin-top: 20px; padding: 14px 12px 0; border-top: 1px solid #333c42; font-size: 13px; }
.hub-user-name { color: #fff; font-weight: 600; }
.hub-user-role { color: #8a959c; margin-bottom: 8px; }
.hub-user-account { display: block; color: #c9d1d6; font-size: 0.85rem; margin-bottom: 8px; text-decoration: none; }
.hub-user-account:hover { color: #ffffff; text-decoration: underline; }
.hub-logout { background: none; border: 1px solid #46515a; color: var(--hub-side-ink); border-radius: 4px;
              padding: 3px 12px; font-size: 13px; }
.hub-logout:hover { border-color: var(--hub-side-ink); color: #fff; }

/* login page */
.hub-login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.hub-login { width: 340px; background: var(--hub-surface); border: 1px solid var(--hub-line);
             border-radius: 6px; padding: 28px; }
.hub-login-title { font-size: 20px; font-weight: 600; margin-bottom: 20px; }
.hub-login label { display: block; font-size: 13px; color: var(--hub-ink-2); margin-bottom: 14px; }
.hub-login input { display: block; width: 100%; margin-top: 4px; padding: 7px 9px; font-size: 14px;
                   border: 1px solid var(--hub-line); border-radius: 4px; }
.hub-login input:focus { outline: 2px solid var(--hub-accent); outline-offset: -1px; }
.hub-login button { width: 100%; padding: 8px; background: var(--hub-ink); color: #fff; border: 0;
                    border-radius: 4px; font-weight: 600; }
.hub-login-error { color: var(--hub-down); font-size: 13.5px; }
.hub-login-note { color: var(--hub-muted); font-size: 12.5px; margin: 16px 0 0; }

/* ---------------------------------------------------------------- core pages (phase 2) */
.hub-form-row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin: .75rem 0 1rem; }
.hub-input { max-width: 22rem; }
.hub-input-sm { max-width: 6rem; }
.hub-field { display: flex; flex-direction: column; gap: .15rem; }
.hub-field .hub-input-sm { max-width: 9rem; }
.hub-dropdown { min-width: 14rem; }
.hub-actions { display: flex; gap: .4rem; flex-wrap: wrap; margin: .5rem 0 1rem; }
.hub-alert { margin: .5rem 0 1rem; }
.hub-facts { max-width: 34rem; }
.hub-facts th { color: var(--hub-muted); font-weight: 500; width: 11rem; }
.hub-plan-status { font-size: .8rem; padding: .1rem .5rem; border-radius: 3px; border: 1px solid var(--hub-line);
                   color: var(--hub-ink); background: var(--hub-paper); white-space: nowrap; }
.hub-plan-in_analysis, .hub-plan-planning, .hub-plan-review { border-color: var(--hub-soon); color: var(--hub-soon); }
.hub-plan-approved, .hub-plan-released { border-color: var(--hub-ok); color: var(--hub-ok); }
.hub-plan-superseded, .hub-plan-archived { color: var(--hub-future); }
.hub-card-head { display: flex; justify-content: space-between; gap: .5rem; }

/* ---------------------------------------------------------------- casting (phase 3) */
.hub-page h3 { font-size: 1rem; margin: 1.25rem 0 .5rem; color: var(--hub-ink); }
.hub-form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: .6rem 1rem;
                 margin: .5rem 0 .75rem; }
.hub-form-grid label, .hub-block { font-size: .8rem; color: var(--hub-muted); display: block; }
.hub-textarea { width: 100%; min-height: 6.5rem; font-family: var(--hub-mono); font-size: .85rem;
                border: 1px solid var(--hub-line); border-radius: 4px; padding: .4rem .5rem; color: var(--hub-ink); }
.hub-chart { max-width: 46rem; border: 1px solid var(--hub-line); border-radius: 4px; margin: .5rem 0 1rem; }
.hub-sev { font-size: .75rem; padding: .05rem .45rem; border-radius: 3px; border: 1px solid var(--hub-line); }
.hub-sev-alta { border-color: var(--hub-down); color: var(--hub-down); }
.hub-sev-media { border-color: var(--hub-soon); color: var(--hub-soon); }
.hub-sev-baja { color: var(--hub-muted); }

/* Process chains (MPC) */
.hub-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 8px; vertical-align: baseline; }
.hub-lead { font-size: 1.05rem; margin-bottom: .5rem; }
.hub-link { font-size: .9rem; }

pre.hub-code { max-height: 26rem; overflow: auto; padding: .75rem; background: var(--hub-surface-2, #f5f6f8); border-radius: 6px; white-space: pre; }

/* Setup planning / gate (CNC-003, CNC-012): status badges and the per-part tabs */
.hub-badge { display: inline-block; font-size: .75rem; padding: .05rem .45rem; border-radius: 3px;
             border: 1px solid var(--hub-line); font-family: var(--hub-mono); white-space: nowrap; }
.hub-badge-ok { border-color: var(--hub-up, #2b8a3e); color: var(--hub-up, #2b8a3e); }
.hub-badge-info { border-color: #1c7ed6; color: #1c7ed6; }
.hub-badge-warn { border-color: var(--hub-soon); color: var(--hub-soon); }
.hub-badge-bad { border-color: var(--hub-down); color: var(--hub-down); }
.hub-badge-muted { color: var(--hub-muted); }
.hub-tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--hub-line); margin: .25rem 0 1rem; }
.hub-tab { padding: .35rem .75rem; font-size: .9rem; color: var(--hub-muted); text-decoration: none;
           border-bottom: 2px solid transparent; }
.hub-tab:hover { color: var(--hub-ink); }
.hub-tab-active { color: var(--hub-ink); border-bottom-color: var(--hub-ink); }

/* 3D viewer (HubViewer, a React component) */
.hub-viewer { position: relative; width: 100%; background: #2a2e33; border-radius: 6px; overflow: hidden;
              margin: .5rem 0 1rem; }
.hub-viewer-empty, .hub-viewer-error { position: absolute; inset: 0; display: grid; place-items: center;
              color: #3a4148; font-size: .9rem; z-index: 2; pointer-events: none; }
.hub-viewer-error { inset: 1rem 1rem auto 1rem; place-items: start; color: #ffd6d6; background: rgba(120, 20, 20, .85);
              padding: .4rem .6rem; border-radius: 4px; }
.hub-viewer-bar { position: absolute; top: .5rem; right: .5rem; display: flex; flex-wrap: wrap; gap: .25rem;
              justify-content: flex-end; max-width: 75%; z-index: 3; }
.hub-viewer-btn, .hub-viewer-select { font-size: .75rem; padding: .15rem .45rem; border-radius: 3px;
              border: 1px solid #5a636d; background: rgba(20, 24, 28, .8); color: #e6edf3; cursor: pointer; }
.hub-viewer-btn-on { border-color: #ff9520; color: #ffb35c; }
/* overlay text sits on a dark pill: readable on any background the user picks */
.hub-viewer-hint { position: absolute; bottom: .5rem; right: .75rem; font-size: .72rem; color: #e6edf3; z-index: 3;
              max-width: 55%; text-align: right; background: rgba(20, 24, 28, .72); padding: .15rem .45rem;
              border-radius: 3px; }
.hub-viewer-color { width: 2rem; height: 1.45rem; padding: 0; border: 1px solid #5a636d; border-radius: 3px;
              background: transparent; cursor: pointer; }
.hub-viewer-play { position: absolute; left: .5rem; right: .5rem; bottom: .5rem; display: flex; flex-wrap: wrap;
              align-items: center; gap: .5rem; font-size: .75rem; color: #e6edf3; z-index: 3;
              background: rgba(20, 24, 28, .8); padding: .35rem .5rem; border-radius: 4px; }
.hub-viewer-play input[type=range] { flex: 1 1 12rem; }
.hub-viewer-move { font-family: var(--hub-mono); }
.hub-viewer-legend { display: flex; gap: .75rem; flex-wrap: wrap; }
.hub-viewer-legend i { display: inline-block; width: 10px; height: 3px; margin-right: 4px; vertical-align: middle; }
.hub-checklist label { display: block; font-size: .85rem; }
.hub-checklist input { margin-right: .4rem; }

/* 3-D casting simulation: field legend and controls */
.hub-radio label { margin-right: 1rem; font-size: 0.85rem; }
.hub-radio input { margin-right: 0.3rem; }
.hub-slider-row { display: flex; align-items: center; gap: 0.75rem; margin: 0.4rem 0; }
.hub-slider-row > div:last-child { flex: 1; }
.hub-legend { margin: 0.5rem 0; }
.hub-ramp-row { display: flex; align-items: center; gap: 0.5rem; max-width: 420px; }
.hub-ramp { flex: 1; height: 10px; border-radius: 2px; }

/* result mode (solver fields): panel over the canvas */
.hub-viewer-results { position: absolute; bottom: .5rem; right: .5rem; z-index: 3; display: flex; flex-direction: column;
              gap: .3rem; font-size: .75rem; color: #e6edf3; background: rgba(20, 24, 28, .8); padding: .4rem .5rem;
              border-radius: 4px; max-width: 46%; }
.hub-viewer-row { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.hub-viewer-row input[type=range] { flex: 1 1 8rem; }
.hub-viewer-colorbar i { display: inline-block; width: 10rem; height: 10px; border-radius: 2px; }
.hub-viewer-colorbar span { font-family: var(--hub-mono); }
.hub-viewer-results { max-height: calc(100% - 1rem); overflow-y: auto; }
.hub-viewer-tools { display: flex; flex-direction: column; gap: .3rem; border-top: 1px solid rgba(230, 237, 243, .15);
              padding-top: .3rem; }
.hub-viewer-stats, .hub-viewer-probes { display: flex; flex-direction: column; gap: .25rem; }
.hub-viewer-axis span { font-family: var(--hub-mono); color: #aeb8c2; }
.hub-viewer-axis .hub-grow { flex: 1; }
.hub-histogram-in { fill: #6da7ec; }
.hub-histogram-out { fill: #59616b; }
.hub-histogram-axis { stroke: #aeb8c2; stroke-width: 1; }
.hub-viewer-table { border-collapse: collapse; font-size: .72rem; }
.hub-viewer-table th, .hub-viewer-table td { padding: .05rem .4rem .05rem 0; text-align: left; font-weight: normal; }
.hub-viewer-table th { color: #aeb8c2; }
.hub-viewer-table td { font-family: var(--hub-mono); }
.hub-viewer-note { color: #aeb8c2; font-size: .7rem; }
/* cae-viewer's post-processing (FASE 11.1 / 11.2): strip at the top left, its panels below it on the left */
.hub-viewer-post { position: absolute; top: .5rem; left: .5rem; z-index: 3; display: flex; flex-wrap: wrap;
              align-items: center; gap: .3rem; max-width: 52%; }
.hub-viewer-post a.hub-viewer-btn { text-decoration: none; }
.hub-viewer-post-panels { position: absolute; top: 2.75rem; left: 0; width: 444px; bottom: 0; z-index: 3;
              pointer-events: none; }
.hub-viewer-post-panels > * { pointer-events: auto; }
.hub-viewer-post-summary { display: grid; grid-template-columns: auto auto; column-gap: .6rem; row-gap: .1rem;
              border-top: 1px solid rgba(230, 237, 243, .15); padding-top: .3rem; }
.hub-viewer-post-summary span { color: #aeb8c2; }
.hub-viewer-post-summary b { font-weight: normal; font-family: var(--hub-mono); text-align: right; }
.hub-probe-tag { display: inline-block; transform: translate(10px, -10px); background: #1f2328; color: #fff;
              border: 1px solid #fff; border-radius: 3px; padding: 0 .25rem; font: 600 .7rem var(--hub-mono); }

/* production: stat tiles and collapsible forms */
.hub-stat-row { display: flex; gap: .75rem; flex-wrap: wrap; margin: .25rem 0 1rem; }
.hub-stat-tile { border: 1px solid var(--hub-line, #d9dde2); border-radius: 4px; padding: .5rem .75rem; min-width: 8rem; }
.hub-stat { font-size: 1.6rem; font-weight: 600; line-height: 1.2; }
.hub-details { margin: .5rem 0 1rem; }
.hub-details > summary { cursor: pointer; font-size: .85rem; font-weight: 600; margin-bottom: .5rem; }
.hub-tooling-req { border-top: 1px solid #e3e7ea; padding-top: 10px; margin-top: 10px; }
.hub-tight { margin: 2px 0 0; padding-left: 1.1rem; }
.hub-tight li { margin: 0; }
.hub-machine-warning { font-weight: 600; font-size: .9rem; margin: 8px 0; }

/* MR-006 cell grids: the mark carries the verdict, colour only repeats it */
.hub-mark-pass { color: #1f7a3a; font-weight: 600; }
.hub-mark-partial { color: #9a6b00; font-weight: 600; }
.hub-mark-fail { color: #b3261e; font-weight: 600; }

/* BA-006 system monitoring: state with icon + label, never colour alone */
.hub-state { font-weight: 600; white-space: nowrap; }
.hub-state-ok { color: var(--hub-ok); }
.hub-state-warning { color: var(--hub-soon); }
.hub-state-critical { color: var(--hub-down); }
.hub-state-unknown { color: var(--hub-future); }
.hub-alerts { padding-left: 1.1rem; }
.hub-alerts li { margin: 4px 0; }

/* EI-002 copilot: conversation beside its list */
.hub-two-col { display: grid; grid-template-columns: minmax(0, 3fr) minmax(12rem, 1fr); gap: 1.5rem; align-items: start; }
.hub-two-col .hub-health-item + .hub-health-item { margin-top: .75rem; }
.hub-strong { font-weight: 600; }
.hub-error { color: var(--hub-down); }
/* language switch (sidebar and login page) */
.hub-lang-switch { display: flex; gap: 4px; margin: 0 0 8px; }
.hub-lang-switch button { background: none; border: 1px solid #46515a; color: #c9d1d6; border-radius: 4px;
  font-size: 0.72rem; padding: 1px 6px; cursor: pointer; }
.hub-lang-switch button.active { border-color: #c9d1d6; color: #fff; font-weight: 600; }
.hub-login .hub-lang-switch { justify-content: flex-end; }
.hub-login .hub-lang-switch button { border-color: #c4cbd1; color: #4a545c; }
.hub-login .hub-lang-switch button.active { border-color: #2a2e33; color: #2a2e33; }
