/* ==========================================================================
   SchemCAD — 4-Niche Hardware Expansion Bar & Interactive Repair Workbench
   File: frontend/expansion_niches.css
   Covers:
     1. 32px Sleek Hardware Niches Quick-Bar (#nicheQuickBar.niche-quick-bar)
        under <header class="topbar"> — zero clipping on Desktop & Mobile
     2. Interactive 4-Niche Workbench Modal (#nicheWorkbenchModal, z-index: 9500
        so #saasModal at z-index: 12000 always floats cleanly on top)
     3. CAD Cards for Boards/PDFs/Dumps, Monospace Bench Pinouts & Fault Decoder
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. 32px Hardware Niches Quick-Bar (#nicheQuickBar.niche-quick-bar)
   -------------------------------------------------------------------------- */
#nicheQuickBar.niche-quick-bar {
  height: 32px;
  min-height: 32px;
  max-height: 32px;
  width: 100%;
  background: linear-gradient(180deg, #0f1728 0%, #0d1422 100%);
  border-bottom: 1px solid #1f2d44;
  box-shadow: inset 0 1px 0 rgba(148, 163, 184, 0.06);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  flex-shrink: 0;
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  user-select: none;
  position: relative;
  z-index: 38;
}

#nicheQuickBar.niche-quick-bar::-webkit-scrollbar {
  display: none;
}

.nqb-kicker {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono, "JetBrains Mono", Consolas, monospace);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #8fa3bf;
  padding-right: 4px;
  border-right: 1px solid #22314a;
  margin-right: 2px;
  flex-shrink: 0;
}

.nqb-kicker-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #38bdf8;
  box-shadow: 0 0 7px rgba(56, 189, 248, 0.75);
  flex-shrink: 0;
}

.nqb-pills {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.nqb-pill {
  height: 24px;
  padding: 0 9px;
  border-radius: 5px;
  border: 1px solid rgba(56, 189, 248, 0.34);
  background: linear-gradient(180deg, rgba(22, 33, 52, 0.95) 0%, rgba(15, 23, 38, 0.95) 100%);
  color: #e2e8f0;
  font-family: var(--sans, "Inter", "Segoe UI", system-ui, sans-serif);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
  box-shadow: 0 0 10px rgba(15, 23, 42, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  transition: transform 0.1s ease, border-color 0.14s ease, background 0.14s ease, box-shadow 0.14s ease, color 0.14s ease;
  -webkit-tap-highlight-color: transparent;
}

/* Subtle glowing per-niche accent borders */
.nqb-pill[data-niche="auto_ecu"] {
  border-color: rgba(56, 189, 248, 0.42);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.09), inset 0 1px 0 rgba(186, 230, 253, 0.08);
}
.nqb-pill[data-niche="auto_ecu"]:hover,
.nqb-pill[data-niche="auto_ecu"].is-active {
  border-color: #38bdf8;
  background: linear-gradient(180deg, rgba(14, 116, 144, 0.36) 0%, rgba(15, 23, 42, 0.95) 100%);
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.24), inset 0 1px 0 rgba(186, 230, 253, 0.18);
  color: #f0f9ff;
}

.nqb-pill[data-niche="console"] {
  border-color: rgba(168, 85, 247, 0.44);
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.09), inset 0 1px 0 rgba(233, 213, 255, 0.08);
}
.nqb-pill[data-niche="console"]:hover,
.nqb-pill[data-niche="console"].is-active {
  border-color: #c084fc;
  background: linear-gradient(180deg, rgba(126, 34, 206, 0.34) 0%, rgba(15, 23, 42, 0.95) 100%);
  box-shadow: 0 0 14px rgba(168, 85, 247, 0.25), inset 0 1px 0 rgba(233, 213, 255, 0.18);
  color: #faf5ff;
}

.nqb-pill[data-niche="drone_starlink"] {
  border-color: rgba(52, 211, 153, 0.42);
  box-shadow: 0 0 10px rgba(52, 211, 153, 0.09), inset 0 1px 0 rgba(167, 243, 208, 0.08);
}
.nqb-pill[data-niche="drone_starlink"]:hover,
.nqb-pill[data-niche="drone_starlink"].is-active {
  border-color: #34d399;
  background: linear-gradient(180deg, rgba(5, 150, 105, 0.34) 0%, rgba(15, 23, 42, 0.95) 100%);
  box-shadow: 0 0 14px rgba(52, 211, 153, 0.24), inset 0 1px 0 rgba(167, 243, 208, 0.18);
  color: #ecfdf5;
}

.nqb-pill[data-niche="asic"] {
  border-color: rgba(245, 158, 11, 0.46);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.1), inset 0 1px 0 rgba(253, 230, 138, 0.09);
}
.nqb-pill[data-niche="asic"]:hover,
.nqb-pill[data-niche="asic"].is-active {
  border-color: #fbbf24;
  background: linear-gradient(180deg, rgba(180, 83, 9, 0.36) 0%, rgba(15, 23, 42, 0.95) 100%);
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.26), inset 0 1px 0 rgba(253, 230, 138, 0.2);
  color: #fffbeb;
}

.nqb-pill:active {
  transform: scale(0.98);
}

.nqb-pill-label {
  letter-spacing: -0.01em;
}

.nqb-pill-count {
  font-family: var(--mono, "JetBrains Mono", Consolas, monospace);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.82);
  border: 1px solid rgba(148, 163, 184, 0.28);
  color: #cbd5e1;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.nqb-pill[data-niche="auto_ecu"] .nqb-pill-count {
  color: #7dd3fc;
  border-color: rgba(56, 189, 248, 0.35);
}
.nqb-pill[data-niche="console"] .nqb-pill-count {
  color: #d8b4fe;
  border-color: rgba(192, 132, 252, 0.35);
}
.nqb-pill[data-niche="drone_starlink"] .nqb-pill-count {
  color: #6ee7b7;
  border-color: rgba(52, 211, 153, 0.35);
}
.nqb-pill[data-niche="asic"] .nqb-pill-count {
  color: #fde68a;
  border-color: rgba(251, 191, 36, 0.38);
}

.nqb-pill-count.hidden {
  display: none !important;
}

.nqb-spacer {
  flex: 1 1 auto;
  min-width: 4px;
}

.nqb-decoder-shortcut {
  height: 22px;
  padding: 0 8px;
  border-radius: 4px;
  border: 1px solid rgba(220, 160, 58, 0.36);
  background: rgba(220, 160, 58, 0.1);
  color: #fde68a;
  font-family: var(--mono, "JetBrains Mono", monospace);
  font-size: 10.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.14s ease, border-color 0.14s ease;
}

.nqb-decoder-shortcut:hover {
  background: rgba(220, 160, 58, 0.2);
  border-color: #f5b84b;
  color: #fffbeb;
}

@media (max-width: 1120px) {
  .nqb-kicker,
  .nqb-decoder-shortcut {
    display: none !important;
  }
}

/* Mobile <= 860px: preserve full bottom bar visibility & smooth horizontal swipe */
@media (max-width: 860px) {
  #nicheQuickBar.niche-quick-bar {
    height: 32px !important;
    min-height: 32px !important;
    max-height: 32px !important;
    padding: 0 6px !important;
    gap: 5px !important;
  }

  #nicheQuickBar ~ .workspace {
    height: calc(100vh - 46px - 32px - 56px) !important;
    height: calc(100dvh - 46px - 32px - 56px - env(safe-area-inset-bottom, 0px)) !important;
  }

  .nqb-pill {
    height: 24px !important;
    padding: 0 8px !important;
    font-size: 11px !important;
  }
}

/* --------------------------------------------------------------------------
   2. Interactive 4-Niche Workbench Modal (#nicheWorkbenchModal, z-index: 9500)
   -------------------------------------------------------------------------- */
#nicheWorkbenchModal.nwb-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9500;
  background: rgba(6, 10, 17, 0.82);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  animation: nwbFadeIn 0.14s ease-out;
}

#nicheWorkbenchModal.nwb-modal-overlay.hidden {
  display: none !important;
}

@keyframes nwbFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes nwbDialogIn {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.992);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.nwb-dialog {
  width: min(1160px, 100%);
  height: min(860px, calc(100vh - 28px));
  height: min(860px, calc(100dvh - 28px));
  background: #0e1420;
  border: 1px solid #28364e;
  border-radius: 10px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.78), 0 0 0 1px rgba(56, 189, 248, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: #e8edf5;
  animation: nwbDialogIn 0.16s ease-out;
}

/* Top Header: Niche Switcher Tabs + SEO Reference Link + Close */
.nwb-header {
  background: linear-gradient(180deg, #141d2e 0%, #0f1624 100%);
  border-bottom: 1px solid #243248;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-shrink: 0;
}

.nwb-niche-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  min-width: 0;
  flex: 1 1 auto;
}

.nwb-niche-tabs::-webkit-scrollbar {
  display: none;
}

.nwb-niche-tab {
  height: 32px;
  padding: 0 11px;
  border-radius: 6px;
  border: 1px solid #27354c;
  background: #131c2b;
  color: #9fb0c7;
  font-family: var(--sans, "Inter", system-ui, sans-serif);
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.14s ease;
}

.nwb-niche-tab:hover {
  background: #1a263a;
  border-color: #3a4f70;
  color: #f1f5f9;
}

.nwb-niche-tab.active[data-niche="auto_ecu"] {
  background: linear-gradient(180deg, rgba(14, 116, 144, 0.38) 0%, rgba(15, 23, 42, 0.95) 100%);
  border-color: #38bdf8;
  color: #f0f9ff;
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.2);
}

.nwb-niche-tab.active[data-niche="console"] {
  background: linear-gradient(180deg, rgba(126, 34, 206, 0.36) 0%, rgba(15, 23, 42, 0.95) 100%);
  border-color: #c084fc;
  color: #faf5ff;
  box-shadow: 0 0 14px rgba(168, 85, 247, 0.22);
}

.nwb-niche-tab.active[data-niche="drone_starlink"] {
  background: linear-gradient(180deg, rgba(5, 150, 105, 0.36) 0%, rgba(15, 23, 42, 0.95) 100%);
  border-color: #34d399;
  color: #ecfdf5;
  box-shadow: 0 0 14px rgba(52, 211, 153, 0.22);
}

.nwb-niche-tab.active[data-niche="asic"] {
  background: linear-gradient(180deg, rgba(180, 83, 9, 0.38) 0%, rgba(15, 23, 42, 0.95) 100%);
  border-color: #fbbf24;
  color: #fffbeb;
  box-shadow: 0 0 14px rgba(245, 158, 11, 0.24);
}

.nwb-tab-badge {
  font-family: var(--mono, "JetBrains Mono", monospace);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 999px;
  background: rgba(10, 15, 26, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.26);
  color: #cbd5e1;
}

.nwb-header-right {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}

.nwb-seo-link {
  height: 30px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid rgba(220, 160, 58, 0.45);
  background: rgba(220, 160, 58, 0.12);
  color: #fde68a;
  font-family: var(--sans, "Inter", system-ui, sans-serif);
  font-size: 11.5px;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.nwb-seo-link .nwb-seo-lbl-short {
  display: none;
}

.nwb-seo-link:hover {
  background: rgba(220, 160, 58, 0.22);
  border-color: #f5b84b;
  color: #fffbeb;
}

.nwb-close-btn {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 1px solid #2b3a52;
  background: #162032;
  color: #cbd5e1;
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.nwb-close-btn:hover {
  background: rgba(223, 84, 84, 0.22);
  border-color: #df5454;
  color: #ffffff;
}

/* Sub-Tabs Strip (Boards/Schematics/Dumps | Bench Pinouts | Fault Decoder) */
.nwb-subtabs-bar {
  background: #101827;
  border-bottom: 1px solid #212e43;
  padding: 7px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.nwb-subtabs {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  max-width: 100%;
}

.nwb-subtabs::-webkit-scrollbar {
  display: none;
}

.nwb-subtab {
  height: 30px;
  padding: 0 11px;
  border-radius: 6px;
  border: 1px solid #243349;
  background: #151f30;
  color: #94a3b8;
  font-family: var(--sans, "Inter", system-ui, sans-serif);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.12s ease;
}

.nwb-subtab:hover {
  color: #e2e8f0;
  border-color: #384e6e;
  background: #1a273c;
}

.nwb-subtab.active {
  background: linear-gradient(180deg, rgba(220, 160, 58, 0.24) 0%, rgba(220, 160, 58, 0.1) 100%);
  border-color: rgba(245, 184, 75, 0.72);
  color: #fef3c7;
  box-shadow: inset 0 1px 0 rgba(255, 243, 199, 0.15);
}

.nwb-subtab-cnt {
  font-family: var(--mono, "JetBrains Mono", monospace);
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(9, 13, 22, 0.65);
  color: #fde68a;
}

.nwb-niche-desc {
  font-size: 11.5px;
  color: #8496b0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Search & Filter Controls Bar */
.nwb-controls {
  background: #0d131f;
  border-bottom: 1px solid #1e2b3e;
  padding: 9px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
}

.nwb-search-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nwb-search-wrap {
  flex: 1 1 auto;
  min-width: 0;
  height: 34px;
  background: #131c2c;
  border: 1px solid #2b3b54;
  border-radius: 7px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}

.nwb-search-wrap:focus-within {
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.15);
}

.nwb-search-ico {
  color: #7c90ad;
  font-size: 13px;
  flex-shrink: 0;
}

.nwb-search-input {
  flex: 1 1 auto;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: #f1f5f9;
  font-family: var(--sans, "Inter", system-ui, sans-serif);
  font-size: 13px;
}

.nwb-search-input::placeholder {
  color: #64748b;
}

.nwb-search-clear {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 16px;
  line-height: 1;
  padding: 2px 4px;
  cursor: pointer;
  border-radius: 4px;
}

.nwb-search-clear:hover {
  color: #ffffff;
  background: rgba(148, 163, 184, 0.14);
}

.nwb-action-btn {
  height: 34px;
  padding: 0 13px;
  border-radius: 7px;
  border: 1px solid rgba(56, 189, 248, 0.52);
  background: linear-gradient(180deg, rgba(14, 116, 144, 0.42) 0%, rgba(14, 116, 144, 0.2) 100%);
  color: #e0f2fe;
  font-family: var(--sans, "Inter", system-ui, sans-serif);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
  transition: all 0.12s ease;
}

.nwb-action-btn:hover {
  border-color: #38bdf8;
  background: linear-gradient(180deg, rgba(14, 116, 144, 0.58) 0%, rgba(14, 116, 144, 0.3) 100%);
  color: #ffffff;
}

/* Filter & Quick Example Chips */
.nwb-chips-row {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 1px;
}

.nwb-chips-row::-webkit-scrollbar {
  display: none;
}

.nwb-chips-label {
  font-family: var(--mono, "JetBrains Mono", monospace);
  font-size: 10.5px;
  color: #7c90ad;
  white-space: nowrap;
  flex-shrink: 0;
}

.nwb-chip {
  height: 25px;
  padding: 0 9px;
  border-radius: 5px;
  border: 1px solid #283850;
  background: #141e2f;
  color: #cbd5e1;
  font-family: var(--mono, "JetBrains Mono", Consolas, monospace);
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.12s ease;
}

.nwb-chip:hover {
  background: #1c2a42;
  border-color: #48638c;
  color: #ffffff;
}

.nwb-chip.active {
  background: rgba(56, 189, 248, 0.18);
  border-color: #38bdf8;
  color: #e0f2fe;
}

/* Scrollable Results Body */
.nwb-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
  background: #0b101a;
}

.nwb-status-box {
  padding: 34px 18px;
  text-align: center;
  color: #8fa3bf;
  background: #101826;
  border: 1px dashed #26364f;
  border-radius: 8px;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.nwb-spinner {
  width: 22px;
  height: 22px;
  border: 2.5px solid rgba(56, 189, 248, 0.22);
  border-top-color: #38bdf8;
  border-radius: 50%;
  animation: nwbSpin 0.7s linear infinite;
}

@keyframes nwbSpin {
  to { transform: rotate(360deg); }
}

/* --------------------------------------------------------------------------
   3A. Auto / Heavy Truck / ECU Interactive Folder Explorer
   -------------------------------------------------------------------------- */
.nwb-auto-catbar {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #1e2c42;
}

.nwb-auto-catpill {
  height: 30px;
  padding: 0 11px;
  border-radius: 7px;
  border: 1px solid #283a54;
  background: #131d2e;
  color: #cbd5e1;
  font-family: var(--sans, "Inter", system-ui, sans-serif);
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  transition: all 0.14s ease;
}

.nwb-auto-catpill:hover {
  border-color: #38bdf8;
  background: #18263c;
  color: #ffffff;
}

.nwb-auto-catpill.active {
  background: linear-gradient(180deg, rgba(14, 116, 144, 0.42) 0%, rgba(15, 23, 42, 0.96) 100%);
  border-color: #38bdf8;
  color: #f0f9ff;
  box-shadow: 0 0 14px rgba(56, 189, 248, 0.22);
}

.nwb-auto-cnt {
  font-family: var(--mono, "JetBrains Mono", monospace);
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(9, 13, 22, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.28);
  color: #7dd3fc;
}

.nwb-auto-section {
  margin-bottom: 18px;
}

.nwb-auto-sec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 9px;
  padding: 0 2px;
}

.nwb-auto-sec-title {
  font-size: 13.5px;
  font-weight: 800;
  color: #f1f5f9;
  letter-spacing: 0.01em;
}

.nwb-auto-sec-meta {
  font-family: var(--mono, "JetBrains Mono", monospace);
  font-size: 11px;
  color: #8496b0;
}

.nwb-folders-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
  gap: 9px;
}

.nwb-folder-card {
  background: linear-gradient(180deg, #141e30 0%, #101725 100%);
  border: 1px solid #263750;
  border-radius: 8px;
  padding: 11px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  text-align: left;
  cursor: pointer;
  transition: transform 0.1s ease, border-color 0.14s ease, background 0.14s ease, box-shadow 0.14s ease;
}

.nwb-folder-card.is-truck {
  border-color: rgba(56, 189, 248, 0.34);
}

.nwb-folder-card.is-ecu {
  border-color: rgba(52, 211, 153, 0.36);
}

.nwb-folder-card:hover {
  border-color: #38bdf8;
  background: linear-gradient(180deg, #192740 0%, #131d2f 100%);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.42);
  transform: translateY(-1px);
}

.nwb-folder-card.is-ecu:hover {
  border-color: #34d399;
}

.nwb-folder-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.nwb-folder-ico {
  font-size: 16px;
  line-height: 1;
}

.nwb-folder-cnt {
  font-family: var(--mono, "JetBrains Mono", monospace);
  font-size: 10.5px;
  font-weight: 700;
  color: #93c5fd;
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid rgba(96, 165, 250, 0.32);
  padding: 2px 7px;
  border-radius: 999px;
}

.nwb-folder-card.is-ecu .nwb-folder-cnt {
  color: #6ee7b7;
  border-color: rgba(52, 211, 153, 0.36);
}

.nwb-folder-title {
  font-size: 13px;
  font-weight: 800;
  color: #f8fafc;
  line-height: 1.3;
  margin-top: 2px;
}

.nwb-folder-sub {
  font-size: 11px;
  color: #8fa3bf;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.nwb-auto-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
  padding: 8px 10px;
  background: #111a29;
  border: 1px solid #24354e;
  border-radius: 7px;
}

.nwb-auto-back-btn {
  height: 26px;
  padding: 0 10px;
  border-radius: 5px;
  border: 1px solid rgba(56, 189, 248, 0.45);
  background: rgba(14, 116, 144, 0.25);
  color: #e0f2fe;
  font-family: var(--sans, "Inter", system-ui, sans-serif);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.12s ease;
}

.nwb-auto-back-btn:hover {
  background: rgba(14, 116, 144, 0.45);
  border-color: #38bdf8;
  color: #ffffff;
}

.nwb-auto-bc-sep {
  color: #526580;
  font-size: 12px;
}

.nwb-auto-bc-cat {
  font-size: 12px;
  color: #94a3b8;
}

.nwb-auto-bc-brand {
  font-size: 13px;
  color: #f8fafc;
}

.nwb-auto-subfolders {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.nwb-auto-subpill {
  height: 27px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid #273852;
  background: #131d2e;
  color: #cbd5e1;
  font-family: var(--sans, "Inter", system-ui, sans-serif);
  font-size: 11.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.12s ease;
}

.nwb-auto-subpill:hover {
  border-color: #60a5fa;
  background: #19273e;
  color: #ffffff;
}

.nwb-auto-subpill.active {
  background: rgba(59, 130, 246, 0.22);
  border-color: #60a5fa;
  color: #eff6ff;
}

/* --------------------------------------------------------------------------
   3. Sub-Tab 1: Files Grid (Boards, PDF Schematics, EEPROM/BIOS Dumps)
   -------------------------------------------------------------------------- */
.nwb-files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(305px, 1fr));
  gap: 10px;
}

.nwb-file-card {
  background: linear-gradient(180deg, #131c2c 0%, #101724 100%);
  border: 1px solid #24334a;
  border-radius: 8px;
  padding: 11px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 9px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.14s ease, transform 0.1s ease, box-shadow 0.14s ease, background 0.14s ease;
}

.nwb-file-card:hover {
  border-color: #3b82f6;
  background: linear-gradient(180deg, #172338 0%, #121b2b 100%);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.42);
  transform: translateY(-1px);
}

.nwb-file-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.nwb-kind-badge {
  font-family: var(--mono, "JetBrains Mono", monospace);
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.nwb-kind-badge.is-cad {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(52, 211, 153, 0.45);
  color: #6ee7b7;
}

.nwb-kind-badge.is-pdf {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(96, 165, 250, 0.45);
  color: #93c5fd;
}

.nwb-kind-badge.is-bin {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(251, 191, 36, 0.45);
  color: #fde68a;
}

.nwb-file-meta-pill {
  font-family: var(--mono, "JetBrains Mono", monospace);
  font-size: 10px;
  color: #8496b0;
  background: rgba(9, 13, 22, 0.6);
  border: 1px solid #223047;
  padding: 1px 6px;
  border-radius: 4px;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nwb-file-title {
  font-size: 13px;
  font-weight: 700;
  color: #f1f5f9;
  line-height: 1.35;
  word-break: break-word;
}

.nwb-file-sub {
  font-size: 11.5px;
  color: #8fa3bf;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.nwb-file-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(38, 53, 77, 0.7);
}

.nwb-file-ext {
  font-family: var(--mono, "JetBrains Mono", monospace);
  font-size: 10.5px;
  color: #7c90ad;
}

.nwb-file-open-btn {
  height: 26px;
  padding: 0 10px;
  border-radius: 5px;
  border: 1px solid #33496b;
  background: #19263b;
  color: #e2e8f0;
  font-family: var(--sans, "Inter", system-ui, sans-serif);
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.12s ease;
}

.nwb-file-card:hover .nwb-file-open-btn {
  background: rgba(59, 130, 246, 0.24);
  border-color: #60a5fa;
  color: #ffffff;
}

.nwb-file-open-btn.is-done {
  background: rgba(16, 185, 129, 0.24) !important;
  border-color: #34d399 !important;
  color: #d1fae5 !important;
}

/* --------------------------------------------------------------------------
   4. Sub-Tab 2 & 3: Bench Pinouts & Fault Decoder Engineering Cards
   -------------------------------------------------------------------------- */
.nwb-records-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(460px, 1fr));
  gap: 12px;
}

.nwb-rec-card {
  background: linear-gradient(180deg, #131c2b 0%, #0f1623 100%);
  border: 1px solid #25354d;
  border-radius: 9px;
  padding: 13px 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.32);
}

.nwb-rec-card.is-locked {
  border-color: rgba(220, 160, 58, 0.42);
}

.nwb-rec-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.nwb-rec-title {
  font-size: 14px;
  font-weight: 800;
  color: #f8fafc;
  line-height: 1.3;
}

.nwb-chip-badge {
  font-family: var(--mono, "JetBrains Mono", Consolas, monospace);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 5px;
  background: rgba(56, 189, 248, 0.13);
  border: 1px solid rgba(56, 189, 248, 0.4);
  color: #7dd3fc;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nwb-code-badge {
  font-family: var(--mono, "JetBrains Mono", Consolas, monospace);
  font-size: 13px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 5px;
  background: rgba(239, 68, 68, 0.16);
  border: 1px solid rgba(248, 113, 113, 0.5);
  color: #fca5a5;
  letter-spacing: 0.02em;
}

.nwb-rec-row {
  font-size: 12px;
  line-height: 1.45;
  color: #cbd5e1;
}

.nwb-rec-label {
  font-family: var(--mono, "JetBrains Mono", monospace);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #8fa3bf;
  margin-right: 6px;
}

.nwb-culprit-box {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: 6px;
  background: rgba(245, 158, 11, 0.13);
  border: 1px solid rgba(251, 191, 36, 0.38);
  color: #fde68a;
  font-family: var(--mono, "JetBrains Mono", monospace);
  font-size: 11.5px;
  font-weight: 700;
  align-self: flex-start;
  max-width: 100%;
  word-break: break-word;
}

/* Monospace Copyable Pinout / Rails Block */
.nwb-pinout-wrap {
  background: #090d16;
  border: 1px solid #223149;
  border-radius: 7px;
  overflow: hidden;
}

.nwb-pinout-bar {
  background: #101827;
  border-bottom: 1px solid #1e2c42;
  padding: 4px 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.nwb-pinout-bar-lbl {
  font-family: var(--mono, "JetBrains Mono", monospace);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #7dd3fc;
}

.nwb-copy-btn {
  height: 21px;
  padding: 0 7px;
  border-radius: 4px;
  border: 1px solid #2c3e5a;
  background: #162235;
  color: #cbd5e1;
  font-family: var(--mono, "JetBrains Mono", monospace);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.12s ease;
}

.nwb-copy-btn:hover {
  border-color: #38bdf8;
  color: #ffffff;
  background: #1d2e47;
}

.nwb-copy-btn.is-copied {
  border-color: #34d399;
  color: #6ee7b7;
  background: rgba(16, 185, 129, 0.16);
}

.nwb-pinout-pre {
  margin: 0;
  padding: 9px 10px;
  font-family: var(--mono, "JetBrains Mono", "Cascadia Code", Consolas, monospace);
  font-size: 11.5px;
  line-height: 1.5;
  color: #e2e8f0;
  white-space: pre-wrap;
  word-break: break-word;
  user-select: text;
}

.nwb-fix-box {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(52, 211, 153, 0.28);
  border-radius: 7px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.45;
  color: #d1fae5;
}

.nwb-fix-box strong {
  color: #6ee7b7;
}

/* Golden PRO Unlock CTA Button */
.nwb-pro-unlock-btn {
  margin-top: 2px;
  width: 100%;
  min-height: 36px;
  padding: 7px 12px;
  border-radius: 7px;
  border: 1px solid rgba(245, 184, 75, 0.78);
  background: linear-gradient(180deg, rgba(220, 160, 58, 0.34) 0%, rgba(180, 112, 24, 0.24) 100%);
  box-shadow: 0 0 16px rgba(220, 160, 58, 0.18), inset 0 1px 0 rgba(255, 243, 199, 0.25);
  color: #fef3c7;
  font-family: var(--sans, "Inter", system-ui, sans-serif);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.01em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  text-align: center;
  transition: transform 0.1s ease, background 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}

.nwb-pro-unlock-btn:hover {
  border-color: #fbbf24;
  background: linear-gradient(180deg, rgba(234, 179, 8, 0.44) 0%, rgba(180, 112, 24, 0.34) 100%);
  box-shadow: 0 0 22px rgba(245, 184, 75, 0.32), inset 0 1px 0 rgba(255, 248, 220, 0.35);
  color: #ffffff;
}

.nwb-pro-unlock-btn:active {
  transform: scale(0.99);
}

/* Modal Footer */
.nwb-footer {
  background: #0f1624;
  border-top: 1px solid #223047;
  padding: 7px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 11px;
  color: #7c90ad;
  flex-shrink: 0;
}

.nwb-footer-notice {
  color: #93c5fd;
  font-weight: 600;
}

.nwb-footer-notice.is-err {
  color: #fca5a5;
}

.nwb-footer-notice.is-ok {
  color: #6ee7b7;
}

/* Responsive Mobile Modal Adjustments */
@media (max-width: 860px) {
  #nicheWorkbenchModal.nwb-modal-overlay {
    padding: 0;
    align-items: flex-end;
  }

  .nwb-dialog {
    width: 100vw;
    height: calc(100vh - 8px);
    height: calc(100dvh - 8px);
    border-radius: 12px 12px 0 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
  }

  .nwb-header {
    padding: 8px 10px;
  }

  .nwb-seo-link span.nwb-seo-lbl-full {
    display: none;
  }

  .nwb-seo-link span.nwb-seo-lbl-short {
    display: inline;
  }

  .nwb-niche-desc {
    display: none;
  }

  .nwb-search-input {
    font-size: 16px !important; /* Prevent iOS auto-zoom */
  }

  .nwb-records-grid,
  .nwb-files-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .nwb-footer {
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  }
}
