/* =====================================================================
   Scania EPC — design tokens + shell
   Modern Premium direction (approved 2026-04-23 brainstorming)
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@500;700&display=swap');

:root {
  /* Typography — Multi uses Segoe UI / Tahoma natively. Stay system-font. */
  --font-sans: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', 'Courier New', monospace;

  /* Backgrounds — flat Multi greys, not modern SaaS gradients */
  --bg-app:      #F0F0F0;   /* Multi window grey (Win7 ButtonFace) */
  --bg-card:     #FFFFFF;   /* Workspace white */
  --bg-chrome:   #ECECEC;   /* Title bar, slightly darker than panels */
  --bg-pill:    #F0F0F0;
  --bg-muted:   #E8E8E8;
  --bg-divider: #C0C0C0;    /* Multi divider grey */
  --bg-border:  #ABABAB;    /* Multi control border */
  --bg-hairline: #D4D4D4;
  --bg-menu-hover: #DBE9F4; /* Multi menu-hover blue tint */

  /* Text */
  --fg:         #000000;    /* Multi uses pure black */
  --fg-heading: #000000;
  --fg-sub:     #404040;
  --fg-muted:   #808080;
  --fg-faint:   #B0B0B0;

  /* Accents — Scania corporate (used sparsely as in Multi) */
  --scania-red:       #E30613;
  --scania-red-dark:  #a60810;
  --scania-blue-deep: #041E42;
  --scania-blue-mid:  #0a2c5c;

  /* Accents — Multi UI */
  --link:           #0000FF;   /* Classic IE blue */
  --link-visited:   #0000FF;   /* Multi doesn't differentiate */
  --selection:      #3399FF;   /* Win selection blue */
  --selection-bg:   #CCE4F7;   /* Multi list-row selection */
  --multi-orange:   #F39200;   /* The signature active-tab underline */

  /* Status */
  --status-available: #2E7D32;
  --status-available-bg: #E8F5E9;
  --status-warning:  #F57C00;
  --status-warning-bg: #FFF4E6;
  --status-danger:   #C62828;
  --status-danger-bg: #FFEBEE;

  /* Shadows — Multi is flat. Keep these tokens but use sparingly. */
  --shadow-card-sm: none;
  --shadow-card:    none;
  --shadow-card-hover: none;
  --shadow-pop:     0 4px 12px rgba(0,0,0,0.18);
  --shadow-focus-red: 0 0 0 1px rgba(227,6,19,0.4);
  --shadow-glow-red: none;

  /* Radii — Multi has square corners almost everywhere */
  --r-xs: 0;
  --r-sm: 0;
  --r:    0;
  --r-md: 2px;
  --r-lg: 2px;
  --r-xl: 2px;

  /* Spacing unit */
  --gap-1: 4px;
  --gap-2: 8px;
  --gap-3: 12px;
  --gap-4: 16px;
  --gap-5: 20px;
  --gap-6: 24px;

  /* Layout */
  --topbar-h:   48px;
  --gutter-w:   56px;
  --crumb-h:    48px;
  --tabs-h:     38px;

  /* Z */
  --z-topbar: 100;
  --z-drop:   200;
  --z-modal:  500;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  color: var(--fg);
  background: var(--bg-app);
  font-size: 13px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-width: 1280px;  /* desktop-only per design brief */
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }
[x-cloak] { display: none !important; }

/* =====================================================================
   SHELL LAYOUT — base.html structure
   ===================================================================== */

.app-root {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Multi-faithful three-row top bar:
   .titlebar  — windows-style title strip (icon + product name + chassis context)
   .menubar   — File / View / Functions / Tool / History / Notes / Help
   .toolbar   — flat icon strip with mode buttons + omnisearch on the right */
.titlebar {
  height: 26px;
  background: linear-gradient(180deg, #DCE5EE 0%, #A4BBD2 100%);
  border-bottom: 1px solid #6B85A0;
  display: flex; align-items: center;
  padding: 0 8px; gap: 8px;
  font-size: 12px; font-weight: 600;
  color: #1A1A1A;
}
.titlebar .ico {
  width: 16px; height: 16px;
  background: var(--scania-red); color: #fff;
  font-size: 9px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.titlebar .product { font-weight: 700; }
.titlebar .ctx {
  display: inline-flex; align-items: center; gap: 6px;
  color: #404040; margin-left: 12px; font-weight: 400;
  padding: 1px 8px;
  background: #FFF6CF;
  border: 1px solid #E0C870;
  border-radius: 2px;
}
.titlebar .ctx .pin-ico { font-size: 11px; }
.titlebar .ctx .pin-no { color: var(--link); font-weight: 700; }
.titlebar .ctx .pin-unpin {
  font-size: 10px; color: var(--fg-muted, #808080);
  text-decoration: underline; text-decoration-style: dotted;
  margin-left: 4px;
}
.titlebar .ctx .pin-unpin:hover { color: var(--fg, #000); }

/* Home page top-maingroup rows (when a chassis is pinned). Compact list
   with the same area-stripe + heatmap-bucket cues used everywhere else. */
.home-mg-row {
  display: grid;
  grid-template-columns: 32px 1fr max-content;
  gap: 8px;
  padding: 4px 8px;
  border-left: 3px solid transparent;
  text-decoration: none;
  color: var(--fg, #000);
  font-size: 12px;
}
.home-mg-row:hover { background: var(--bg-menu-hover, #DBE9F4); text-decoration: none; }
.home-mg-row[data-area="powertrain"] { border-left-color: var(--area-powertrain); }
.home-mg-row[data-area="drivetrain"] { border-left-color: var(--area-drivetrain); }
.home-mg-row[data-area="electrical"] { border-left-color: var(--area-electrical); }
.home-mg-row[data-area="cab"]        { border-left-color: var(--area-cab);        }
.home-mg-row[data-area="climate"]    { border-left-color: var(--area-climate);    }
.home-mg-row[data-area="frame"]      { border-left-color: var(--area-frame);      }
.home-mg-row[data-area="other"]      { border-left-color: var(--area-other);      }
.home-mg-row .home-mg-num   { font-weight: 700; color: var(--fg-sub, #404040); }
.home-mg-row .home-mg-name  { color: var(--fg, #000); }
.home-mg-row .home-mg-count { font-weight: 600; color: var(--link, #0000FF); }

.recent-chassis-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 8px;
  padding: 4px 8px;
  text-decoration: none;
  font-size: 12px;
  border-bottom: 1px solid var(--bg-hairline, #D4D4D4);
}
.recent-chassis-row:hover { background: var(--bg-menu-hover, #DBE9F4); }
.recent-chassis-row .recent-chassis-no { font-weight: 700; color: var(--link, #0000FF); }
.recent-chassis-row .recent-chassis-meta { color: var(--fg-muted, #808080); }

/* ---------------------------------------------------------------------------
   Tree gutter — parts mode left rail. MG → SG → Section, expandable inline,
   chassis-aware counts on each row when ?chassis=<no> or epc_chassis cookie
   is present.
   --------------------------------------------------------------------------- */
.gutter.tree {
  width: 280px;
  padding: 4px 0;
  font-size: 11px;
}
.gutter.tree .gutter-label {
  display: block;
  padding: 4px 10px 6px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.06em;
  color: var(--fg-muted, #7a8392); text-transform: uppercase;
  border-bottom: 1px solid var(--bg-divider);
}
.tn .tn-row {
  display: grid;
  grid-template-columns: 14px 30px 1fr max-content;
  gap: 4px;
  align-items: center;
  padding: 2px 6px;
  text-decoration: none;
  color: var(--fg, #000);
  border-left: 3px solid transparent;
}
.tn .tn-row:hover { background: var(--bg-menu-hover, #DBE9F4); }
.tn .tn-glyph { color: var(--fg-faint, #B0B0B0); font-family: var(--font-mono); }
.tn .tn-num { font-weight: 700; color: var(--fg-sub, #404040); }
.tn .tn-name {
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--fg, #000);
}
.tn .tn-count { color: var(--link, #0000FF); font-weight: 600; font-size: 10px; }
.tn.dim .tn-row, .tn.dim .tn-name, .tn.dim .tn-count { color: var(--fg-faint, #B0B0B0); }
.tn.dim { opacity: 0.65; }
.tn.tn-mg.open > .tn-row { background: #F2F4F7; }
.tn.tn-sg > .tn-row { padding-left: 24px; }
.tn.tn-sg .tn-name  { font-size: 11px; }
.tn.tn-sg.open > .tn-row { background: #FAFBFC; }
.tn.tn-sec > .tn-row { padding-left: 42px; font-size: 10px; }
.tn.tn-sec .tn-num  { font-weight: 400; }
.tn.tn-sec.active > .tn-row {
  background: var(--selection-bg, #DBE9F4);
  border-left-color: #FFD700;
  font-weight: 600;
}
.tn.tn-mg[data-area="powertrain"] > .tn-row { border-left-color: var(--area-powertrain); }
.tn.tn-mg[data-area="drivetrain"] > .tn-row { border-left-color: var(--area-drivetrain); }
.tn.tn-mg[data-area="electrical"] > .tn-row { border-left-color: var(--area-electrical); }
.tn.tn-mg[data-area="cab"]        > .tn-row { border-left-color: var(--area-cab);        }
.tn.tn-mg[data-area="climate"]    > .tn-row { border-left-color: var(--area-climate);    }
.tn.tn-mg[data-area="frame"]      > .tn-row { border-left-color: var(--area-frame);      }
.tn.tn-mg[data-area="other"]      > .tn-row { border-left-color: var(--area-other);      }
.tn.tree-overflow > .tn-row { font-style: italic; }
.tn.tree-overflow .tn-name { color: var(--fg-muted); }
.titlebar .spacer { flex: 1; }
.titlebar .winbtns { display: flex; gap: 0; height: 100%; }
.titlebar .winbtns .wb {
  width: 36px; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 11px; color: #1A1A1A;
  cursor: default;
}

.menubar {
  height: 22px;
  background: var(--bg-app);
  border-bottom: 1px solid var(--bg-divider);
  display: flex; align-items: stretch;
  padding: 0 4px;
  font-size: 12px;
  position: relative;
  z-index: 200;
}
.menubar .mb-item {
  position: relative;
  display: inline-flex;
  align-items: stretch;
}
.menubar .mb-item > a {
  display: inline-flex; align-items: center;
  padding: 0 8px;
  text-decoration: none; color: var(--fg);
  border: 1px solid transparent;
  cursor: default;
}
.menubar .mb-item > a:hover {
  background: var(--bg-menu-hover);
  border-color: #7DA2C9;
  text-decoration: none;
}
.menubar .mb-item.active > a {
  background: var(--bg-menu-hover);
  border-color: #7DA2C9;
}
.menubar .underline { text-decoration: underline; text-underline-offset: 1px; }

/* Dropdown panel — positioned below the menu item */
.mb-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 200px;
  background: var(--bg-app);
  border: 1px solid var(--bg-border);
  box-shadow: 2px 2px 6px rgba(0,0,0,0.18);
  list-style: none;
  margin: 0;
  padding: 2px 0;
  z-index: 201;
}
.mb-dropdown.wide { min-width: 300px; }
.mb-dropdown li {
  padding: 0;
}
.mb-dropdown li.sep {
  height: 1px;
  margin: 4px 8px;
  background: var(--bg-divider);
}
.mb-dropdown li > a,
.mb-dropdown li > span {
  display: block;
  padding: 4px 18px 4px 22px;
  text-decoration: none;
  color: var(--fg);
  font-size: 12px;
  white-space: nowrap;
  cursor: default;
}
.mb-dropdown li.muted > span {
  color: var(--fg-muted);
  font-style: italic;
}
.mb-dropdown li > a:hover {
  background: var(--selection);
  color: #fff;
  text-decoration: none;
}

.toolbar {
  height: 36px;
  background: var(--bg-app);
  border-bottom: 1px solid var(--bg-divider);
  display: flex; align-items: center;
  padding: 2px 4px;
  gap: 1px;
  position: sticky; top: 0; z-index: var(--z-topbar);
}
.toolbar .tb-btn {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  transition: all 0.05s;
  text-decoration: none;
}
.toolbar .tb-btn:hover {
  background: var(--bg-menu-hover);
  border-color: #7DA2C9;
  text-decoration: none;
}
.toolbar .tb-btn.active {
  background: #BCD3E8;
  border-color: #6B92BB;
}
.toolbar .tb-btn img {
  width: 24px; height: 24px;
  image-rendering: pixelated;
}
.toolbar .tb-sep {
  width: 1px; height: 24px;
  background: var(--bg-divider);
  margin: 0 4px;
}

.omnisearch {
  flex: 1; max-width: 420px; margin-left: auto;
  display: flex; align-items: center; gap: 4px;
  background: #fff;
  border: 1px solid var(--bg-border);
  padding: 3px 6px;
  font-size: 12px; color: var(--fg);
  position: relative;
}
.omnisearch:focus-within {
  border-color: #569DE5;
  box-shadow: var(--shadow-focus-red);
  box-shadow: 0 0 0 1px #569DE5;
}
.omnisearch .ic { font-size: 12px; color: var(--fg-muted); flex-shrink: 0; }
.omnisearch input {
  flex: 1;
  border: 0; outline: none; background: transparent;
  font-family: inherit; font-size: inherit; color: var(--fg);
  width: 100%;
}
.omnisearch .kbd {
  font-size: 10px; color: var(--fg-muted);
  background: var(--bg-app);
  padding: 0 4px; border: 1px solid var(--bg-divider);
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.usertile {
  width: 22px; height: 22px;
  background: var(--scania-red);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700;
  flex-shrink: 0;
  cursor: pointer;
  margin-left: 6px;
}

/* Search dropdown (HTMX panel) */
.search-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--bg-card);
  border: 1px solid var(--bg-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop);
  z-index: var(--z-drop);
  overflow: hidden; display: none;
  max-height: 420px; overflow-y: auto;
}
.search-dropdown:not(:empty) { display: block; }

/* Body — gutter + pane ------------------------------------------------- */
.app-body {
  flex: 1;
  display: flex;
  min-height: 0;
}
.app-body.no-gutter {
  /* Home page — skip gutter, give pane full width with its own padding */
}

/* Gutter — Multi-style thin maingroup rail. Numbers only, blue link colour
   when not active, blue selection-bar on active. ~28px wide. */
.gutter {
  width: 28px;
  background: var(--bg-app);
  border-right: 1px solid var(--bg-divider);
  padding: 0;
  flex-shrink: 0;
  display: flex; flex-direction: column;
  font-size: 11px; font-family: var(--font-sans);
  overflow-y: auto;
}
.gutter .gn {
  color: var(--link);
  font-weight: 400;
  padding: 1px 0;
  text-align: center;
  cursor: pointer;
  text-decoration: none;
  display: block;
  border: 1px solid transparent;
}
.gutter .gn:hover { background: var(--bg-menu-hover); text-decoration: none; border-color: #7DA2C9; }
.gutter .gn.active {
  background: var(--selection-bg);
  color: var(--fg);
  font-weight: 700;
  border-color: #7DA2C9;
}
.gutter-label {
  display: none; /* Multi has no header label — just the column of numbers */
}

/* Wide rail variant — used by non-parts modes that show titled link rows
   instead of a thin numeric column. ~200px, padded, with a visible label. */
.gutter.wide {
  width: 200px;
  padding: 8px 0;
  font-size: 12px;
}
.gutter.wide .gutter-label {
  display: block;
  padding: 4px 12px 8px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.06em;
  color: var(--muted, #7a8392); text-transform: uppercase;
  border-bottom: 1px solid var(--bg-divider);
  margin-bottom: 4px;
}
.gutter.wide .gn-row {
  display: flex; flex-direction: column;
  padding: 6px 12px; gap: 1px;
  border-left: 3px solid transparent;
  text-decoration: none; color: var(--link);
}
.gutter.wide .gn-row:hover { background: var(--bg-menu-hover); }
.gutter.wide .gn-row.active {
  background: var(--selection-bg);
  border-left-color: #7DA2C9;
  color: var(--fg);
}
.gutter.wide .gn-row.muted { color: var(--muted, #7a8392); cursor: default; }
.gutter.wide .gn-row.muted:hover { background: transparent; }
.gutter.wide .gn-title { font-weight: 600; }
.gutter.wide .gn-sub { font-size: 10px; color: var(--muted, #7a8392); }

/* ---------------------------------------------------------------------------
   Maingroup heatmap (chassis parts overview).
   44 tiles in an auto-fit grid. Colour bucket scales with applicable row count.
   --------------------------------------------------------------------------- */
.mg-heatmap {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}
.mg-tile {
  position: relative;
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--bg-border, #ABABAB);
  background: var(--bg-card, #FFFFFF);
  text-decoration: none; color: var(--fg, #000000);
  cursor: pointer;
  transition: transform 80ms ease-out, box-shadow 80ms ease-out;
  min-height: 78px;
}
.mg-tile:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  text-decoration: none;
  z-index: 2;
}
.mg-tile.mg-empty { cursor: default; opacity: 0.55; }
.mg-tile.mg-empty:hover { transform: none; box-shadow: none; }

.mg-tile-num {
  font-size: 18px; font-weight: 700; letter-spacing: 0.04em;
  line-height: 1;
}
.mg-tile-name {
  font-size: 11px; line-height: 1.25;
  color: var(--fg-sub, #404040);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.mg-tile-count {
  position: absolute; top: 8px; right: 10px;
  font-size: 14px; font-weight: 700;
}
.mg-tile-total {
  position: absolute; bottom: 6px; right: 10px;
  font-size: 10px; color: var(--fg-faint, #B0B0B0);
}

/* Heat buckets — graded blue, Multi-faithful palette */
.mg-tile.b0 { background: #F4F4F4; border-color: #DADADA; }
.mg-tile.b1 { background: #EFF5FB; border-color: #C9D9E9; }
.mg-tile.b2 { background: #DBE7F3; border-color: #A6BDD7; }
.mg-tile.b3 { background: #B6CFE8; border-color: #7FA3C9; }
.mg-tile.b4 { background: #7DA2C9; border-color: #4F7AAA; color: #FFFFFF; }
.mg-tile.b4 .mg-tile-name { color: #F0F4F8; }
.mg-tile.b4 .mg-tile-total { color: #D0DEEB; }

.mg-legend {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; padding: 8px 0;
  border-top: 1px solid var(--bg-divider, #C0C0C0);
}
.mg-legend > * + * { margin-left: 0; }
.legend-swatch {
  display: inline-block; width: 14px; height: 14px;
  border: 1px solid var(--bg-border, #ABABAB);
  margin-left: 8px;
}
.legend-swatch.b0 { background: #F4F4F4; }
.legend-swatch.b1 { background: #EFF5FB; }
.legend-swatch.b2 { background: #DBE7F3; }
.legend-swatch.b3 { background: #B6CFE8; }
.legend-swatch.b4 { background: #7DA2C9; }

/* Coarse-area stripe colours — keyed by data-area on tiles, ribbon cells,
   and mg-cards. Painted as a 4px left border so the area cue doesn't fight
   the heat colour. */
:root {
  --area-powertrain: #D2691E;
  --area-drivetrain: #1F6FB4;
  --area-electrical: #C9A227;
  --area-cab:        #6B7280;
  --area-climate:    #2DA0A8;
  --area-frame:      #6B6B6B;
  --area-other:      #8E44AD;
}
.mg-tile[data-area="powertrain"] { border-left: 4px solid var(--area-powertrain); }
.mg-tile[data-area="drivetrain"] { border-left: 4px solid var(--area-drivetrain); }
.mg-tile[data-area="electrical"] { border-left: 4px solid var(--area-electrical); }
.mg-tile[data-area="cab"]        { border-left: 4px solid var(--area-cab);        }
.mg-tile[data-area="climate"]    { border-left: 4px solid var(--area-climate);    }
.mg-tile[data-area="frame"]      { border-left: 4px solid var(--area-frame);      }
.mg-tile[data-area="other"]      { border-left: 4px solid var(--area-other);      }
.mg-card[data-area="powertrain"] { border-left: 4px solid var(--area-powertrain); }
.mg-card[data-area="drivetrain"] { border-left: 4px solid var(--area-drivetrain); }
.mg-card[data-area="electrical"] { border-left: 4px solid var(--area-electrical); }
.mg-card[data-area="cab"]        { border-left: 4px solid var(--area-cab);        }
.mg-card[data-area="climate"]    { border-left: 4px solid var(--area-climate);    }
.mg-card[data-area="frame"]      { border-left: 4px solid var(--area-frame);      }
.mg-card[data-area="other"]      { border-left: 4px solid var(--area-other);      }

/* ---------------------------------------------------------------------------
   Heatmap ribbon — sticky at the top of every catalog page when a chassis
   context is in scope. 44 cells, compact (~36×36), each click jumps to that
   maingroup with the chassis param preserved.
   --------------------------------------------------------------------------- */
.ribbon {
  display: grid;
  grid-template-columns: minmax(160px, max-content) 1fr max-content;
  gap: 8px;
  align-items: center;
  padding: 6px 12px;
  border-bottom: 1px solid var(--bg-divider, #C0C0C0);
  background: var(--bg-chrome, #ECECEC);
}
.ribbon-label {
  font-size: 11px; color: var(--fg-sub, #404040);
  white-space: nowrap;
}
.ribbon-label .mono { font-weight: 700; }
.ribbon-cells {
  display: flex; flex-wrap: wrap; gap: 2px;
  min-width: 0;
}
.ribbon-cell {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 36px; height: 36px;
  padding: 2px 4px;
  border: 1px solid var(--bg-border, #ABABAB);
  background: var(--bg-card, #FFFFFF);
  text-decoration: none; color: var(--fg, #000000);
  line-height: 1.05;
}
.ribbon-cell:hover {
  outline: 1px solid #4F7AAA; outline-offset: -1px;
  text-decoration: none;
}
.ribbon-cell.active {
  outline: 2px solid #FFD700; outline-offset: -2px;
  z-index: 2;
}
.ribbon-cell.mg-empty { opacity: 0.45; cursor: default; }
.ribbon-cell.mg-empty:hover { outline: none; }
.ribbon-cell .rc-num { font-size: 11px; font-weight: 700; }
.ribbon-cell .rc-count { font-size: 9px; color: var(--fg-sub, #404040); }
.ribbon-cell.b0 { background: #F4F4F4; }
.ribbon-cell.b1 { background: #EFF5FB; }
.ribbon-cell.b2 { background: #DBE7F3; }
.ribbon-cell.b3 { background: #B6CFE8; }
.ribbon-cell.b4 { background: #7DA2C9; color: #FFFFFF; }
.ribbon-cell.b4 .rc-count { color: #D0DEEB; }
.ribbon-cell[data-area="powertrain"] { border-left: 3px solid var(--area-powertrain); }
.ribbon-cell[data-area="drivetrain"] { border-left: 3px solid var(--area-drivetrain); }
.ribbon-cell[data-area="electrical"] { border-left: 3px solid var(--area-electrical); }
.ribbon-cell[data-area="cab"]        { border-left: 3px solid var(--area-cab);        }
.ribbon-cell[data-area="climate"]    { border-left: 3px solid var(--area-climate);    }
.ribbon-cell[data-area="frame"]      { border-left: 3px solid var(--area-frame);      }
.ribbon-cell[data-area="other"]      { border-left: 3px solid var(--area-other);      }
.ribbon-overview {
  font-size: 11px; color: var(--link, #0000FF);
  white-space: nowrap; padding: 4px 8px;
  border: 1px solid var(--bg-border, #ABABAB); background: var(--bg-card, #FFFFFF);
  text-decoration: none;
}
.ribbon-overview:hover { background: var(--bg-menu-hover, #DBE9F4); }

/* Content pane — flat, no card elevation, no rounded corners */
.pane {
  flex: 1;
  background: var(--bg-card);
  margin: 0;
  border-left: 1px solid var(--bg-divider);
  overflow: hidden;
  display: flex; flex-direction: column;
  min-width: 0;
}
.app-body.no-gutter .pane {
  margin-left: 0;
  border-left: 0;
}

/* Breadcrumb bar — Multi shows section path + heading in a flat grey strip */
.crumb {
  padding: 6px 12px;
  font-size: 12px; font-weight: 700;
  color: var(--fg-heading);
  display: flex; align-items: center; gap: 8px;
  border-bottom: 1px solid var(--bg-divider);
  background: var(--bg-app);
  flex-shrink: 0;
}
.crumb .path {
  color: var(--fg-muted);
  font-weight: 500; font-family: var(--font-mono);
  font-size: 11px;
  background: var(--bg-pill);
  padding: 2px 8px; border-radius: var(--r-sm);
}
.crumb .path a {
  color: var(--link);
  text-decoration: none;
}
.crumb .path a:hover { text-decoration: underline; }
.crumb .title { color: var(--fg-heading); }
.crumb .volume { color: var(--fg-muted); font-weight: 500; font-size: 11px; margin-left: 4px; }
.crumb .meta {
  color: var(--fg-muted); font-weight: 500;
  margin-left: auto;
  font-size: 11px;
  display: flex; align-items: center; gap: 6px;
}
.crumb .meta .chassis-cno {
  font-family: var(--font-mono);
  font-weight: 700; color: var(--link);
}
.crumb .meta .chassis-dot { color: var(--scania-red); }

/* Tabs — Multi style with the signature ORANGE underline on active */
.tabs {
  display: flex; gap: 0;
  padding: 0 6px;
  border-bottom: 1px solid var(--bg-divider);
  background: var(--bg-app);
  font-size: 12px;
  flex-shrink: 0;
  overflow-x: auto;
}
.tabs .tab {
  padding: 6px 14px 5px;
  color: var(--fg);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
}
.tabs .tab:hover { color: var(--fg); text-decoration: none; background: var(--bg-menu-hover); }
.tabs .tab.active {
  color: var(--fg);
  border-bottom-color: var(--multi-orange);
  font-weight: 600;
}
.tabs .tab.disabled {
  color: var(--fg-faint);
  cursor: not-allowed;
  pointer-events: none;
}

/* Content region */
.content {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  min-height: 0;
}

/* =====================================================================
   SHARED COMPONENTS — used across pages
   ===================================================================== */

/* Page section header (small uppercase label) */
.section-hd {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.7px;
  color: var(--fg-muted); font-weight: 700;
  margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}
.section-hd .cnt {
  background: var(--bg-pill); color: var(--fg-sub);
  padding: 1px 8px; border-radius: 10px;
  font-size: 10px; font-weight: 700;
}

/* Pills */
.pill {
  background: var(--bg-pill); color: var(--fg-sub);
  padding: 1px 7px; border-radius: var(--r-xs);
  font-size: 10px; font-weight: 500;
  font-family: var(--font-sans);
}
.pill.mono { font-family: var(--font-mono); }
.pill.active { background: var(--scania-red); color: #fff; font-weight: 600; }
.pill.success { background: var(--status-available-bg); color: var(--status-available); font-weight: 600; }
.pill.warn { background: var(--status-warning-bg); color: #8A5A00; font-weight: 600; }
.pill.danger { background: var(--status-danger-bg); color: var(--status-danger); font-weight: 600; }

/* Code / mono inline */
code, .mono {
  font-family: var(--font-mono);
  background: var(--bg-pill);
  padding: 1px 5px; border-radius: var(--r-xs);
  font-size: 11px; color: var(--scania-blue-mid);
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: var(--r);
  border: 1px solid var(--bg-border);
  background: var(--bg-card);
  color: var(--fg-sub);
  font-family: inherit; font-size: 12px; font-weight: 600;
  cursor: pointer;
  transition: all 0.12s;
}
.btn:hover { border-color: var(--scania-red); color: var(--scania-red); }
.btn-primary {
  background: linear-gradient(135deg, var(--scania-red), var(--scania-red-dark));
  color: #fff; border-color: var(--scania-red);
  box-shadow: 0 3px 10px rgba(227,6,19,0.2);
}
.btn-primary:hover { background: #ff1a2d; color: #fff; border-color: #ff1a2d; }

/* Inputs */
input[type="text"],
input[type="search"],
input[type="number"],
input[type="email"] {
  font-family: inherit;
  font-size: 13px;
  color: var(--fg);
  padding: 6px 10px;
  border: 1px solid var(--bg-border);
  border-radius: var(--r);
  background: var(--bg-card);
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}
input:focus {
  border-color: var(--scania-red);
  box-shadow: var(--shadow-focus-red);
}

/* =====================================================================
   HOME / DASHBOARD — empty state
   ===================================================================== */

.home {
  flex: 1;
  padding: 0;
  display: flex; flex-direction: column;
}

.home-hero {
  padding: 64px 32px 40px;
  text-align: center;
  background: radial-gradient(ellipse at top, #fff 0%, #FAFBFC 55%, #F0F3F7 100%);
}
.home-hero h1 {
  margin: 0 0 6px;
  font-size: 28px; font-weight: 800;
  color: var(--fg-heading);
  letter-spacing: -0.3px;
}
.home-hero-tag {
  margin: 0 auto 26px;
  color: var(--fg-sub); font-size: 13px;
}
.chassis-search {
  max-width: 540px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--bg-border);
  border-radius: var(--r-lg);
  padding: 8px 8px 8px 18px;
  box-shadow: 0 10px 28px rgba(4,30,66,0.07);
  transition: border-color 0.12s, box-shadow 0.12s;
}
.chassis-search:focus-within {
  border-color: var(--scania-red);
  box-shadow: 0 10px 28px rgba(227,6,19,0.10);
}
.chassis-search .csl {
  color: var(--fg-muted); font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.7px; font-weight: 700;
  flex-shrink: 0;
}
.chassis-search input {
  flex: 1;
  border: 0; outline: none; background: transparent;
  font-size: 17px; font-weight: 600;
  color: var(--fg-heading);
  font-family: var(--font-mono);
  padding: 6px 0;
  box-shadow: none;
}
.chassis-search input:focus { box-shadow: none; }
.chassis-search button { padding: 8px 20px; font-size: 13px; }
.home-alt {
  margin: 14px 0 0; color: var(--fg-muted); font-size: 11px;
}
.home-alt a { color: var(--link); font-weight: 500; }

.home-grid {
  padding: 22px 26px 32px;
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.home-tile {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
}
.home-tile h3 {
  margin: 0 0 14px;
  font-size: 13px; font-weight: 700; color: var(--fg-heading);
  display: flex; align-items: center; gap: 8px;
}
.home-tile h3 .ic { font-size: 14px; color: var(--scania-red); }
.home-tile h3 .cnt {
  margin-left: auto;
  background: var(--bg-pill); color: var(--fg-sub);
  padding: 2px 7px; border-radius: var(--r-xs);
  font-size: 10px; font-weight: 600;
}

/* Recent chassis list */
.recents { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.recents li a {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: var(--r-sm);
  color: var(--fg); text-decoration: none;
  transition: background 0.12s;
}
.recents li a:hover { background: #FAFBFC; text-decoration: none; }
.recents-cno { color: var(--link); font-weight: 700; font-size: 12px; min-width: 80px; }
.recents-mod { color: var(--fg-sub); font-size: 12px; flex: 1; }

/* Maingroup grid — 11-col square pills */
.mg-grid {
  display: grid; grid-template-columns: repeat(11, 1fr);
  gap: 4px;
}
.mg-cell {
  aspect-ratio: 1;
  background: var(--bg-pill);
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  color: var(--scania-blue-mid);
  font-family: var(--font-mono);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.12s;
}
.mg-cell:hover {
  background: var(--scania-red); color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(227,6,19,0.2);
  text-decoration: none;
}

/* =====================================================================
   CATALOG NAV — index / maingroup / subgroup
   ===================================================================== */

/* Shared inner body (inside .content) — gives pages breathing room */
.pane-body { padding: 0; }

/* Catalog index — flat maingroup list */
.mg-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mg-card {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--bg-hairline);
  border-radius: var(--r-md);
  background: var(--bg-card);
  text-decoration: none; color: var(--fg);
  transition: all 0.12s;
}
.mg-card:hover {
  border-color: var(--scania-red);
  box-shadow: 0 2px 6px rgba(227,6,19,0.08), 0 6px 18px rgba(227,6,19,0.06);
  transform: translateY(-1px);
  text-decoration: none;
}
.mg-num {
  font-family: var(--font-mono); font-weight: 800; font-size: 18px;
  color: var(--fg-heading);
  min-width: 52px; padding: 8px 0; text-align: center;
  background: linear-gradient(135deg, #F8FAFC 0%, #EEF2F7 100%);
  border-radius: var(--r);
}
.mg-body { flex: 1; }
.mg-title { font-size: 13px; color: var(--fg-heading); font-weight: 600; }

/* Maingroup page hero */
.mg-hero {
  background: linear-gradient(135deg, var(--scania-blue-deep) 0%, var(--scania-blue-mid) 100%);
  color: #fff;
  padding: 20px 24px;
  display: flex; align-items: center; gap: 18px;
  border-radius: var(--r-lg);
  margin-bottom: 20px;
}
.mg-hero-num {
  font-family: var(--font-mono); font-weight: 800; font-size: 38px;
  line-height: 1;
  background: linear-gradient(135deg, var(--scania-red), var(--scania-red-dark));
  padding: 8px 18px; border-radius: var(--r-md);
  box-shadow: 0 4px 16px rgba(227,6,19,0.35);
}
.mg-hero-body h1 {
  margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -0.2px;
}
.mg-hero-sub {
  font-size: 12px; opacity: 0.7; margin-top: 3px;
}

/* Subgroup cards */
.sg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sg-card {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--bg-hairline);
  border-radius: var(--r-md);
  text-decoration: none; color: var(--fg);
  transition: all 0.15s;
}
.sg-card:hover {
  border-color: var(--scania-red);
  box-shadow: 0 2px 6px rgba(227,6,19,0.08), 0 6px 18px rgba(227,6,19,0.06);
  transform: translateY(-1px);
  text-decoration: none;
}
.sg-num {
  font-family: var(--font-mono); font-weight: 800; font-size: 18px;
  color: var(--fg-heading);
  min-width: 56px; padding: 6px 0; text-align: center;
  background: linear-gradient(135deg, #F8FAFC 0%, #EEF2F7 100%);
  border-radius: var(--r);
  line-height: 1.2;
}
.sg-body { flex: 1; min-width: 0; padding-top: 4px; }
.sg-title { font-size: 13px; color: var(--fg-heading); font-weight: 600; }

/* Section list (flat rows) */
.sec-list { display: flex; flex-direction: column; }
.sec-row {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--bg-hairline);
  text-decoration: none; color: var(--fg);
  transition: background 0.12s;
}
.sec-row:hover { background: #FAFBFC; text-decoration: none; }
.sec-code {
  color: var(--link); font-weight: 700; font-size: 12px;
  min-width: 110px;
}
.sec-heading { flex: 1; font-size: 13px; color: var(--fg); }

/* =====================================================================
   SECTION RENDER — exploded view + parts grid
   ===================================================================== */

.section-split {
  display: flex;
  flex: 1;
  min-height: 0;
  /* section.html renders this directly inside .content — override its padding */
  margin: -20px;
}
.section-split.no-pic .grid-pane { width: 100%; }

.draw {
  width: 42%;
  border-right: 1px solid var(--bg-hairline);
  background: linear-gradient(135deg, #FAFBFC 0%, #F5F7FA 100%);
  display: flex; flex-direction: column;
  flex-shrink: 0;
}
.draw-toolbar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--bg-hairline);
  font-size: 10px; color: var(--fg-muted);
  background: rgba(255,255,255,0.6);
}
.draw-zoom {
  font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.6px;
  background: var(--bg-pill); color: var(--fg-sub);
  padding: 2px 7px; border-radius: var(--r-xs);
}
.draw-path { font-size: 10px; color: var(--fg-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.draw-canvas {
  flex: 1;
  padding: 20px;
  display: flex; align-items: center; justify-content: center;
  overflow: auto;
  position: relative;
  background-image:
    linear-gradient(0deg, transparent 24%, rgba(0,0,0,0.015) 25%, rgba(0,0,0,0.015) 26%, transparent 27%, transparent 74%, rgba(0,0,0,0.015) 75%, rgba(0,0,0,0.015) 76%, transparent 77%, transparent),
    linear-gradient(90deg, transparent 24%, rgba(0,0,0,0.015) 25%, rgba(0,0,0,0.015) 26%, transparent 27%, transparent 74%, rgba(0,0,0,0.015) 75%, rgba(0,0,0,0.015) 76%, transparent 77%, transparent);
  background-size: 40px 40px;
}
.draw-canvas > div { width: 100%; display: flex; align-items: center; justify-content: center; }
.draw-canvas svg { max-width: 100%; max-height: 80vh; filter: drop-shadow(0 4px 12px rgba(0,0,0,0.08)); }
.draw-canvas img { max-width: 100%; max-height: 80vh; filter: drop-shadow(0 4px 12px rgba(0,0,0,0.08)); }

.grid-pane {
  flex: 1;
  display: flex; flex-direction: column;
  overflow: auto;
  min-width: 0;
}

/* Filter bar (amber) */
.filter-bar {
  padding: 8px 14px;
  background: var(--status-warning-bg);
  border-bottom: 1px solid #F0E5C3;
  font-size: 11px; color: #8A5A00;
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
}
.filter-bar .pill.warn {
  background: var(--multi-orange); color: #fff;
}
.filter-toggle {
  margin-left: auto;
  color: var(--link); text-decoration: none; font-weight: 600;
  cursor: pointer;
}
.filter-toggle:hover { text-decoration: underline; }

/* Parts grid (new — replaces .part-rows for section pages) */
table.part-grid { width: 100%; border-collapse: collapse; font-size: 11px; }
table.part-grid thead {
  position: sticky; top: 0; background: #FAFBFC; z-index: 1;
}
table.part-grid th, table.part-grid td {
  padding: 6px 10px;
  text-align: left;
  border-bottom: 1px solid var(--bg-hairline);
  line-height: 1.4;
}
table.part-grid th {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--fg-muted); font-weight: 700;
}
table.part-grid tr { transition: background 0.1s; }
table.part-grid tr:hover { background: #FAFBFC; }
table.part-grid tr.na-row { color: var(--fg-muted); }
table.part-grid tr.na-row td { background: #FAFBFC; opacity: 0.6; }
table.part-grid td a { color: var(--link); font-weight: 600; text-decoration: none; }
table.part-grid td a:hover { text-decoration: underline; }

.col-pos { width: 44px; color: var(--fg-heading); font-weight: 700; }
.col-pno { width: 110px; }
.col-qty { width: 40px; color: var(--fg-sub); }
.col-cb  { width: 70px; }

.callout-chip {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  background: var(--scania-blue-deep); color: #fff;
  border-radius: 50%;
  font-family: var(--font-mono); font-weight: 700; font-size: 10px;
}
table.part-grid tr:hover .callout-chip { background: var(--scania-red); }

/* =====================================================================
   PART DETAIL
   ===================================================================== */

.part-detail { display: flex; flex-direction: column; gap: 18px; }

/* Deep-blue hero with part number as monument */
.part-hero {
  background: linear-gradient(135deg, var(--scania-blue-deep) 0%, var(--scania-blue-mid) 70%, #1a3d6e 100%);
  color: #fff;
  padding: 24px 28px;
  border-radius: var(--r-lg);
  display: flex; align-items: flex-start; gap: 24px;
  position: relative;
  overflow: hidden;
}
.part-hero::after {
  content: "";
  position: absolute; top: -60px; right: -40px;
  width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(227,6,19,0.25) 0%, transparent 60%);
  pointer-events: none;
}
.part-hero-main { flex: 1; position: relative; z-index: 1; }
.part-pno-big {
  font-family: var(--font-mono); font-weight: 800;
  font-size: 40px; letter-spacing: 1px; line-height: 1;
  margin-bottom: 8px;
}
.part-pname { font-size: 20px; font-weight: 700; margin-bottom: 4px; letter-spacing: -0.2px; }
.part-psub { font-size: 12px; opacity: 0.82; margin-top: 3px; }
.part-psub a { text-decoration: underline; }

.part-hero-side { position: relative; z-index: 1; text-align: right; }
.part-status {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: var(--r);
  font-size: 11px; font-weight: 600; letter-spacing: 0.4px;
}
.part-status.ok { background: rgba(46,125,50,0.25); color: #a5e8a8; border: 1px solid rgba(46,125,50,0.5); }
.part-status.warn { background: rgba(245,124,0,0.25); color: #ffd199; border: 1px solid rgba(245,124,0,0.5); font-family: var(--font-mono); }
.part-status.warn a { color: #fff; }
.part-status.danger { background: rgba(198,40,40,0.25); color: #ffb3b3; border: 1px solid rgba(198,40,40,0.5); }

/* Cards (shared with other detail pages) */
.card {
  background: var(--bg-card);
  border: 1px solid var(--bg-hairline);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-card-sm);
}
.card h3 {
  margin: 0 0 14px;
  font-size: 13px; font-weight: 700; color: var(--fg-heading);
  display: flex; align-items: center; gap: 8px;
}
.card h3 .cnt {
  margin-left: auto;
  background: var(--bg-pill); color: var(--fg-sub);
  padding: 2px 7px; border-radius: var(--r-xs);
  font-size: 10px; font-weight: 600;
}

/* Supersession chain */
.chain-box {
  padding: 14px 16px;
  background: linear-gradient(135deg, #FAFBFC, #F5F7FA);
  border-radius: var(--r-md);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.chain-node {
  padding: 6px 12px; border-radius: var(--r-sm);
  font-size: 12px; font-weight: 700;
  text-decoration: none;
}
.chain-node.prev {
  background: #fff; color: var(--fg-muted);
  border: 1px dashed var(--fg-faint);
  text-decoration: line-through;
}
.chain-node.prev:hover { color: var(--fg-sub); text-decoration: line-through underline; }
.chain-node.cur {
  background: var(--scania-red); color: #fff;
  box-shadow: 0 3px 10px rgba(227,6,19,0.3);
  transform: scale(1.08);
}
.chain-node.next {
  background: var(--status-warning-bg); color: #8A5A00;
  border: 1px solid var(--multi-orange);
}
.chain-node.next:hover { background: var(--multi-orange); color: #fff; text-decoration: none; }
.chain-arr { color: var(--fg-muted); font-weight: 700; font-size: 14px; }
.chain-msg { font-size: 11px; color: var(--fg-sub); margin: 10px 0 0; }
.chain-msg a { color: var(--link); font-weight: 600; text-decoration: none; }
.chain-msg a:hover { text-decoration: underline; }

/* Two-column layout below the chain */
.part-columns { display: grid; grid-template-columns: 1fr 340px; gap: 18px; }
.part-col-main, .part-col-side { display: flex; flex-direction: column; gap: 18px; }

/* Where-used list */
.where-used { display: flex; flex-direction: column; gap: 2px; }
.wu-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--r-sm);
  text-decoration: none; color: var(--fg);
  transition: background 0.12s;
}
.wu-row:hover { background: #FAFBFC; text-decoration: none; }
.wu-sec { color: var(--link); font-weight: 700; font-size: 12px; min-width: 100px; }
.wu-heading { flex: 1; font-size: 12px; color: var(--fg); }

/* Illustrated location mini-preview */
.loc-note { font-size: 11px; color: var(--fg-sub); margin: 0 0 10px; }
.loc-note a { color: var(--link); text-decoration: none; font-weight: 600; }
.loc-preview {
  background: linear-gradient(135deg, #FAFBFC 0%, #F5F7FA 100%);
  border-radius: var(--r-md);
  padding: 16px;
  min-height: 160px;
  display: flex; align-items: center; justify-content: center;
}
.loc-preview .svg-wrap { width: 100%; text-align: center; }
.loc-preview svg, .loc-preview img { max-height: 220px; }

/* Properties list */
.props { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; font-size: 12px; }
.prop-k { color: var(--fg-muted); font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; font-weight: 700; padding-top: 2px; }
.prop-v { color: var(--fg); word-break: break-word; }

/* =====================================================================
   SEARCH — suggest dropdown + results page
   ===================================================================== */

/* Suggest dropdown items (served into #search-dropdown) */
.suggest-group { padding: 2px 0; border-bottom: 1px solid var(--bg-hairline); }
.suggest-group:last-child { border-bottom: 0; }
.suggest-group-hd {
  padding: 6px 14px 4px; font-size: 9px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--fg-muted);
}
.sg-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px;
  text-decoration: none; color: var(--fg);
  transition: background 0.1s;
}
.sg-item:hover { background: #FAFBFC; text-decoration: none; }
.sg-ico {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: var(--r-sm);
  font-size: 11px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.sg-ico.parts { background: linear-gradient(135deg, var(--scania-red), var(--scania-red-dark)); }
.sg-ico.sections { background: linear-gradient(135deg, var(--scania-blue-deep), var(--scania-blue-mid)); }
.sg-ico.chassis { background: linear-gradient(135deg, var(--multi-orange), #C57400); }
.sg-ico.documents { background: linear-gradient(135deg, #5B6BFF, #2E3B9A); }
.sg-text { display: flex; flex-direction: column; min-width: 0; gap: 1px; }
.sg-label {
  font-size: 12px; font-weight: 700; color: var(--link);
  font-family: var(--font-mono);
}
.sg-sub { font-size: 11px; color: var(--fg-sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest-foot {
  display: block;
  padding: 8px 14px; font-size: 11px; color: var(--link);
  background: #FAFBFC; border-top: 1px solid var(--bg-hairline);
  text-decoration: none; font-weight: 600;
}
.suggest-foot:hover { text-decoration: underline; }
.suggest-empty { padding: 14px; color: var(--fg-muted); font-size: 12px; text-align: center; }

/* Search results page */
.search-hero {
  padding: 20px 24px 14px;
  background: linear-gradient(180deg, #fff 0%, #FAFBFC 100%);
  border-bottom: 1px solid var(--bg-hairline);
  margin: -20px -20px 0;
}
.search-input-big {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-card);
  border: 2px solid var(--bg-border);
  border-radius: var(--r-xl);
  padding: 10px 14px;
  box-shadow: var(--shadow-card-sm);
  transition: border-color 0.12s, box-shadow 0.12s;
}
.search-input-big:focus-within {
  border-color: var(--scania-red);
  box-shadow: 0 8px 24px rgba(227,6,19,0.1);
}
.search-input-big .ic { color: var(--fg-muted); font-size: 16px; }
.search-input-big input {
  flex: 1; border: 0; outline: none; background: transparent;
  font-size: 15px; font-weight: 500; color: var(--fg-heading);
  box-shadow: none;
}
.search-input-big input:focus { box-shadow: none; }

.search-stats {
  display: flex; align-items: center; gap: 10px;
  margin-top: 12px; font-size: 11px; color: var(--fg-muted);
}
.search-stats .q-count { color: var(--fg-heading); font-weight: 700; }
.search-stats .q-term { color: var(--fg-heading); font-weight: 600; }
.engine-pill {
  padding: 1px 8px; border-radius: var(--r-xs);
  font-size: 10px; font-weight: 600; font-family: var(--font-mono);
}
.engine-pill.ok { background: var(--status-available-bg); color: var(--status-available); }
.engine-pill.warn { background: var(--status-warning-bg); color: #8A5A00; }

/* Results layout */
.search-layout {
  display: grid; grid-template-columns: 240px 1fr; gap: 18px;
  margin: 18px 0 0;
}

/* Facet sidebar */
.facet-sidebar { display: flex; flex-direction: column; gap: 4px; }
.facet-group { padding: 14px 0; border-bottom: 1px solid var(--bg-hairline); }
.facet-group:first-of-type { padding-top: 4px; }
.facet-group:last-of-type { border-bottom: 0; }
.facet-group h4 {
  margin: 0 0 8px; font-size: 10px; text-transform: uppercase; letter-spacing: 0.7px;
  color: var(--fg-muted); font-weight: 700;
}
.facet-type {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px; border-radius: var(--r-sm);
  text-decoration: none; color: var(--fg);
  font-size: 12px;
  transition: background 0.1s;
}
.facet-type:hover { background: var(--bg-pill); text-decoration: none; }
.facet-type.checked { background: #FFF4E6; font-weight: 600; color: var(--fg-heading); }
.facet-type-lbl { flex: 1; }
.facet-opt {
  display: flex; align-items: center; gap: 8px;
  padding: 3px 0; font-size: 12px; color: var(--fg);
  cursor: pointer;
}
.facet-opt input { accent-color: var(--scania-red); margin: 0; }
.facet-opt-lbl { flex: 1; }
.facet-opt-cnt { font-size: 10px; color: var(--fg-muted); font-family: var(--font-mono); }
.facet-opt.checked { color: var(--fg-heading); font-weight: 600; }
.facet-opt.checked .facet-opt-cnt { color: var(--scania-red); }

/* Result items */
.search-results { display: flex; flex-direction: column; gap: 2px; }
.result-item {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 12px 12px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  text-decoration: none; color: var(--fg);
  transition: all 0.12s;
}
.result-item:hover {
  background: var(--bg-card);
  border-color: var(--bg-hairline);
  box-shadow: var(--shadow-card-sm);
  text-decoration: none;
}
.result-badge {
  width: 40px; height: 40px; border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.result-badge.parts { background: linear-gradient(135deg, var(--scania-red), var(--scania-red-dark)); }
.result-badge.sections { background: linear-gradient(135deg, var(--scania-blue-deep), var(--scania-blue-mid)); }
.result-badge.chassis { background: linear-gradient(135deg, var(--multi-orange), #C57400); }
.result-badge.documents { background: linear-gradient(135deg, #5B6BFF, #2E3B9A); }
.result-badge.dtc-badge { background: linear-gradient(135deg, #C62828, #7a0000); font-size:18px; }
.ecu-fam-chip { cursor: pointer; padding: 4px 12px; }
.ecu-fam-chip:hover { background: var(--scania-red); color: #fff; }
.result-body { flex: 1; min-width: 0; }
.result-title {
  font-size: 13px; font-weight: 600; color: var(--fg-heading);
  margin-bottom: 4px;
  display: flex; align-items: center; gap: 8px;
}
.result-title .mono { color: var(--link); font-weight: 700; font-size: 12px; }
.result-dash { color: var(--fg-faint); }
.result-sub-inline { color: var(--fg-sub); font-weight: 500; font-size: 12px; }
.result-meta {
  font-size: 11px; color: var(--fg-muted);
  display: flex; gap: 8px; flex-wrap: wrap;
}

/* Pager */
.pager {
  padding: 16px 0 4px; display: flex; justify-content: center; gap: 4px;
  font-family: var(--font-mono); font-size: 11px;
}
.pager .pg {
  padding: 5px 10px; border-radius: var(--r-sm);
  color: var(--link); text-decoration: none;
  border: 1px solid transparent;
}
.pager .pg.active {
  background: var(--scania-red); color: #fff;
  font-weight: 700;
}
.pager .pg.arr { color: var(--fg-sub); }
.pager .pg:hover:not(.active) { background: #FAFBFC; }

.empty-state {
  padding: 40px 20px; text-align: center;
  border: 1px dashed var(--bg-border); border-radius: var(--r-md);
  background: #FAFBFC;
}
.empty-state h3 { margin: 0 0 4px; font-size: 14px; color: var(--fg-heading); }

/* =====================================================================
   CHASSIS DETAIL — info panels + CTA row
   ===================================================================== */

.chassis-detail { display: flex; flex-direction: column; gap: 18px; }

.info-panels {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}
.panel {
  background: var(--bg-card);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-card-sm);
  border-top: 3px solid transparent;
  min-width: 0;
}
.panel-a { border-top-color: var(--scania-red); }
.panel-b { border-top-color: var(--scania-blue-deep); }
.panel-c { border-top-color: var(--multi-orange); }
.panel h4 {
  margin: 0 0 10px;
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.7px;
  color: var(--fg-muted); font-weight: 700;
}
.panel-sub-inline {
  font-weight: 500; color: var(--fg-muted);
  text-transform: none; letter-spacing: 0;
}
.panel-main {
  font-size: 22px; font-family: var(--font-mono); font-weight: 700;
  color: var(--fg-heading); margin-bottom: 3px;
  word-break: break-all;
}
.panel-sub {
  font-size: 11px; color: var(--fg-sub); line-height: 1.4;
  margin-bottom: 10px;
}
.panel-kvs { margin: 8px 0 0; padding: 0; }
.panel-kvs .kv {
  display: flex; align-items: baseline; gap: 8px;
  font-size: 11px; color: var(--fg);
  padding: 2px 0;
}
.panel-kvs dt {
  color: var(--fg-muted); font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.5px;
  min-width: 52px; margin: 0;
}
.panel-kvs dd { margin: 0; word-break: break-all; }

/* Adaptation chips */
.adapt-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip {
  font-size: 10px; font-family: var(--font-mono);
  background: var(--bg-pill); color: var(--scania-blue-mid);
  padding: 2px 8px; border-radius: 10px; font-weight: 600;
}

/* CTA row */
.cta-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.cta {
  background: var(--bg-card);
  border-radius: var(--r-md);
  padding: 12px 14px;
  box-shadow: var(--shadow-card-sm);
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--fg);
  transition: all 0.12s;
}
.cta:hover {
  box-shadow: var(--shadow-card);
  text-decoration: none;
  transform: translateY(-1px);
}
.cta.disabled {
  opacity: 0.5; cursor: not-allowed; pointer-events: none;
}
.cta .ic { font-size: 18px; color: var(--scania-red); flex-shrink: 0; }
.cta .t { font-weight: 700; color: var(--fg-heading); font-size: 13px; }
.cta .d { font-size: 10px; color: var(--fg-muted); }

/* =====================================================================
   MULTI-STYLE HOME — three group boxes + hyperlinked maingroup list
   ===================================================================== */

.multi-home {
  padding: 14px 18px;
  background: var(--bg-app);
  min-height: 100%;
  font-size: 12px;
}
.multi-home .multi-hr {
  border: 0;
  border-top: 1px solid var(--bg-divider);
  margin: 18px 0 10px;
}
.multi-home .multi-h2 {
  font-size: 13px; font-weight: 700;
  color: var(--fg);
  margin: 0 0 8px;
}

.mh-grid {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px;
}

/* Group box (real <fieldset> with <legend> — that's how Multi renders these) */
.gbox {
  border: 1px solid var(--bg-border);
  background: #fff;
  padding: 8px 12px 12px;
  margin: 0;
}
.gbox > legend {
  padding: 0 4px;
  font-weight: 600;
  font-size: 12px;
  color: var(--fg);
}

.gbox-form { display: flex; flex-direction: column; gap: 6px; }
.gbox-form label {
  display: grid; grid-template-columns: 130px 1fr; align-items: center; gap: 8px;
  font-size: 12px;
}
.gbox-form label > span { color: var(--fg); }
.gbox-form input[type="text"],
.gbox-form select {
  padding: 2px 4px;
  border: 1px solid var(--bg-border);
  background: #fff;
  font-family: inherit; font-size: 12px;
  border-radius: 0;
}
.gbox-form input:disabled,
.gbox-form select:disabled {
  background: var(--bg-app);
  color: var(--fg-muted);
}
.gbox-actions { margin-top: 6px; display: flex; gap: 6px; justify-content: flex-end; }

.multi-btn {
  background: linear-gradient(180deg, #F8F8F8 0%, #DDDDDD 100%);
  border: 1px solid var(--bg-border);
  padding: 3px 14px;
  font-family: inherit; font-size: 12px;
  cursor: pointer;
}
.multi-btn:hover {
  background: linear-gradient(180deg, #DDE7F1 0%, #B8D0E8 100%);
  border-color: #6B92BB;
}
.multi-btn:active {
  background: linear-gradient(180deg, #BAD3E9 0%, #94B8DC 100%);
}

.gbox-info { font-size: 12px; color: var(--fg); }
.gbox-info p { margin: 0 0 6px; }
.gbox-info .mono { color: var(--link); font-weight: 700; }
.gbox-info .mono:visited { color: var(--link); }

.gbox-altsearch {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--bg-divider);
  font-size: 11px;
  color: var(--fg-sub);
}
.gbox-altsearch a {
  color: var(--link);
  text-decoration: underline;
  margin: 0 2px;
}

/* Two-column row: Main groups + Recent vehicles */
.multi-home-bottom {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
}
.mhb-col h2 { margin-bottom: 6px; }

/* Maingroup hyperlink list under the group boxes */
.mg-hyperlinks {
  list-style: none; padding: 0; margin: 0;
  columns: 3; column-gap: 18px;
}
.mg-hyperlinks li {
  font-size: 12px; line-height: 1.7;
  break-inside: avoid;
}
.mg-hyperlinks a {
  color: var(--link); text-decoration: underline;
  font-family: var(--font-mono); font-weight: 700;
  margin-right: 4px;
}
.mg-hyperlinks a:visited { color: var(--link); }

/* Recent vehicles list (localStorage-driven) */
.recent-hyperlinks {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column;
}
.recent-hyperlinks li {
  font-size: 12px; line-height: 1.7;
}
.recent-hyperlinks a {
  color: var(--link); text-decoration: underline;
}
.recent-hyperlinks a:visited { color: var(--link); }

/* =====================================================================
   LEGACY RULES — preserved where still referenced
   ===================================================================== */

/* Parts grid (section.html) — will be replaced in Phase 4 but keep working for now */
table.part-rows { width: 100%; border-collapse: collapse; }
table.part-rows th, table.part-rows td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--bg-hairline);
  text-align: left; font-size: 12px;
}
table.part-rows th {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--fg-muted); font-weight: 700;
  background: #FAFBFC;
}
table.part-rows tr.na-row { color: var(--fg-muted); }
table.part-rows tr.na-row td { background: #f5f5f5; }
table.part-rows td a { font-family: var(--font-mono); font-weight: 600; color: var(--link); }

.retired-notice {
  background: var(--status-warning-bg);
  border: 1px solid #F0E5C3;
  padding: 10px 14px;
  border-radius: var(--r);
  color: #8A5A00;
  font-size: 12px;
}

.section-picture { margin: 12px 0; max-width: 900px; }
.section-picture .svg-wrap svg { max-width: 100%; height: auto; display: block; }
.section-picture img { max-width: 100%; height: auto; display: block; }
.section-picture.part-preview { max-width: 600px; }
.section-picture .callout-active {
  fill: var(--scania-red) !important;
  stroke: var(--scania-red) !important;
  font-weight: bold;
}

/* Old muted style (used in dashboard and elsewhere) */
.muted { color: var(--fg-muted); }
.small { font-size: 0.85em; }

/* Legacy dashboard-tiles — will be replaced in Phase 2 */
.dashboard-tiles {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px; margin-top: 24px;
}
.tile {
  display: block; padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--bg-hairline);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-card-sm);
  text-decoration: none; color: inherit;
  transition: box-shadow 0.12s;
}
.tile:hover { box-shadow: var(--shadow-card); text-decoration: none; }
.tile h3 { margin: 0 0 8px; font-size: 14px; color: var(--fg-heading); }
.tile.tile-form input { width: 100%; margin-bottom: 8px; padding: 6px; }

/* Dev note: legacy .container class is retained for any view we haven't
   migrated to .app-body yet. Safe to remove once all pages use the
   new shell. */

/* Phase 1b — chassis-pin bar */
.chassis-pin-bar {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .35rem .75rem;
  background: #f4f4f4;
  border-bottom: 1px solid #ddd;
  font-size: .9rem;
}
.chassis-pin-bar .cp-label { color: #555; }
.chassis-pin-bar .cp-chassis { font-weight: 600; text-decoration: none; }
.chassis-pin-bar .cp-summary { color: #333; }
.chassis-pin-bar .cp-unpin {
  margin-left: auto;
  font-size: .85rem;
  color: #b00;
  text-decoration: underline;
}
.chassis-pin-bar .cp-pin-form { display: flex; gap: .25rem; align-items: center; }
.chassis-pin-bar .cp-pin-form input[type="text"] {
  width: 12rem;
  padding: .15rem .4rem;
  border: 1px solid #bbb;
}
.chassis-pin-bar .cp-suggest:empty { display: none; }
.container { padding: 20px; max-width: 1400px; margin: 0 auto; }

/* Workshop manuals viewer (Phase 1b-2 / Bundle C) */
.sws-block {
  background: #f4f4f4;
  padding: .5rem;
  font-family: monospace;
  white-space: pre-wrap;
  font-size: .9em;
}
.manuals-doc-card {
  border: 1px solid var(--bg-border, #ddd);
  padding: .75rem;
  margin: .5rem 0;
}
.applicability-yes {
  background: #d4edda;
  color: #155724;
  padding: .5rem;
  border-left: 3px solid #28a745;
}
.applicability-no {
  background: #f0f0f0;
  color: #666;
  padding: .5rem;
  border-left: 3px solid #999;
}
