/**
 * Pipes Standards Hub - Core Stylesheet
 * High-Contrast Industrial Engineering UI
 * Language: English Only (0% Arabic)
 */

/* ==========================================================================
   1. Theme Variables & Base Settings
   ========================================================================== */

:root {
  /* Default: Industrial Dark Theme */
  --bg-app: #080c12;
  --bg-sidebar: #0d131d;
  --bg-surface: #131b27;
  --bg-surface-elevated: #1a2433;
  --bg-surface-hover: #223044;
  --bg-input: #0b1018;

  --border-subtle: #1e2b3d;
  --border-strong: #2f425c;
  --border-focus: #38bdf8;

  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #8496ae;
  --text-inverse: #080c12;

  --accent-primary: #0284c7;
  --accent-cyan: #38bdf8;
  --accent-amber: #f59e0b;
  --accent-green: #10b981;
  --accent-red: #ef4444;

  --audit-bg: rgba(16, 185, 129, 0.08);
  --audit-border: #10b981;
  --audit-text: #34d399;

  --table-border: #223246;
  --table-th-bg: #141d2a;
  --table-th-border: #2c405a;
  --table-row-even: #0e1520;
  --table-row-odd: #131b27;
  --table-hover-row: rgba(56, 189, 248, 0.12);
  --table-hover-col: rgba(56, 189, 248, 0.08);
  --table-hover-cell: rgba(56, 189, 248, 0.28);
  --table-pinned-row: rgba(2, 132, 199, 0.22);
  --table-sticky-bg: #101824;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -2px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.6), 0 4px 6px -4px rgba(0, 0, 0, 0.6);

  --font-ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", "Roboto Mono", "SF Mono", Consolas, Menlo, Monaco, monospace;

  --sidebar-width: 320px;
  --header-height: 64px;
  --transition-speed: 0.18s;
}

[data-theme="light"] {
  --bg-app: #f4f6f9;
  --bg-sidebar: #ffffff;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f1f5f9;
  --bg-surface-hover: #e2e8f0;
  --bg-input: #ffffff;

  --border-subtle: #cbd5e1;
  --border-strong: #94a3b8;
  --border-focus: #0284c7;

  --text-primary: #090d16;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-inverse: #ffffff;

  --accent-primary: #0284c7;
  --accent-cyan: #0284c7;
  --accent-amber: #d97706;
  --accent-green: #059669;
  --accent-red: #dc2626;

  --audit-bg: rgba(5, 150, 105, 0.08);
  --audit-border: #059669;
  --audit-text: #065f46;

  --table-border: #cbd5e1;
  --table-th-bg: #e2e8f0;
  --table-th-border: #94a3b8;
  --table-row-even: #f8fafc;
  --table-row-odd: #ffffff;
  --table-hover-row: rgba(2, 132, 199, 0.1);
  --table-hover-col: rgba(2, 132, 199, 0.06);
  --table-hover-cell: rgba(2, 132, 199, 0.22);
  --table-pinned-row: rgba(2, 132, 199, 0.18);
  --table-sticky-bg: #edf2f7;

  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* ==========================================================================
   2. Reset & Global Box Sizing
   ========================================================================== */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  width: 100%;
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-primary);
  background-color: var(--bg-app);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

/* ==========================================================================
   3. Application Layout Shell
   ========================================================================== */

.app-wrapper {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* --- Top Header --- */
.top-header {
  height: var(--header-height);
  background-color: var(--bg-surface);
  border-bottom: 2px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
  z-index: 40;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo-icon {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-cyan));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.4);
  flex-shrink: 0;
}

.brand-titles {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-primary);
  line-height: 1.2;
}

.brand-sub {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.system-status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent-cyan);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-green);
  box-shadow: 0 0 8px var(--accent-green);
  animation: pulse-dot 2s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.btn-icon-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 6px;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-speed) ease;
}

.btn-icon-label:hover {
  background-color: var(--bg-surface-hover);
  border-color: var(--border-focus);
}

.btn-primary {
  background-color: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: #0369a1;
  border-color: #0369a1;
}

.sidebar-toggle-btn {
  display: none;
}

/* --- Layout Body --- */
.main-layout {
  display: flex;
  flex: 1;
  height: calc(100vh - var(--header-height));
  overflow: hidden;
}

/* ==========================================================================
   4. Sidebar: Standards Index & Filters
   ========================================================================== */

.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  border-right: 2px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  transition: transform var(--transition-speed) ease;
}

.sidebar-header {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-search-box {
  position: relative;
  margin-bottom: 14px;
}

.sidebar-search-box input {
  width: 100%;
  padding: 9px 12px 9px 36px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition-speed);
}

.sidebar-search-box input:focus {
  border-color: var(--border-focus);
}

.sidebar-search-box .search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.filter-group {
  margin-bottom: 10px;
}

.filter-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 6px;
  display: block;
}

.pill-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-pill {
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-speed);
  user-select: none;
}

.filter-pill:hover {
  background-color: var(--bg-surface-hover);
  color: var(--text-primary);
}

.filter-pill.active {
  background-color: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #ffffff;
}

.standards-list-container {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
}

.standards-nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.standard-item-link {
  display: flex;
  flex-direction: column;
  padding: 12px 14px;
  border-radius: 6px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  text-decoration: none;
  color: inherit;
  transition: all var(--transition-speed);
  cursor: pointer;
}

.standard-item-link:hover {
  background-color: var(--bg-surface-hover);
  border-color: var(--border-strong);
  transform: translateX(2px);
}

.standard-item-link.active {
  background-color: var(--bg-surface-elevated);
  border-color: var(--accent-cyan);
  box-shadow: inset 4px 0 0 var(--accent-cyan);
}

.standard-item-code {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-primary);
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.standard-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-strong);
  color: var(--accent-cyan);
}

.standard-item-title {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sidebar-empty-state {
  padding: 28px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
}

.sidebar-footer {
  padding: 12px 18px;
  border-top: 1px solid var(--border-subtle);
  background-color: var(--bg-sidebar);
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ==========================================================================
   5. Main Viewport & Empty State Screen
   ========================================================================== */

.content-viewport {
  flex: 1;
  overflow-y: auto;
  background-color: var(--bg-app);
  display: flex;
  flex-direction: column;
}

/* --- Empty State Dashboard --- */
.empty-state-wrapper {
  max-width: 1080px;
  margin: 32px auto;
  padding: 0 24px;
  width: 100%;
}

.readiness-hero {
  background: linear-gradient(180deg, var(--bg-surface) 0%, var(--bg-sidebar) 100%);
  border: 2px solid var(--border-strong);
  border-radius: 12px;
  padding: 40px;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.readiness-hero::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-cyan), var(--accent-amber));
}

.readiness-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.readiness-title-group h1 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.readiness-title-group p {
  font-size: 15px;
  color: var(--text-secondary);
  max-width: 680px;
}

.status-badge-lg {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  border-radius: 8px;
  background-color: var(--audit-bg);
  border: 1px solid var(--audit-border);
  color: var(--audit-text);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  flex-shrink: 0;
}

/* Grid of Diagnostic & Readiness Checks */
.architecture-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  margin-top: 28px;
}

.arch-card {
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.arch-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.arch-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.arch-badge-active {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  background-color: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
  border: 1px solid var(--accent-green);
}

.arch-card p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 12px;
}

.arch-code-snippet {
  background-color: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 8px 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-cyan);
  overflow-x: auto;
  white-space: nowrap;
}

/* Instructions Banner */
.implantation-guide-box {
  margin-top: 28px;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-strong);
  border-left: 5px solid var(--accent-primary);
  border-radius: 8px;
  padding: 24px;
}

.implantation-guide-box h3 {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.implantation-guide-box ol {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
  color: var(--text-secondary);
}

.implantation-guide-box code {
  font-family: var(--font-mono);
  background-color: var(--bg-input);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 12px;
  color: var(--accent-cyan);
  border: 1px solid var(--border-subtle);
}

/* ==========================================================================
   6. Standard Detail View & Engineering Audit
   ========================================================================== */

.standard-detail-container {
  padding: 24px 32px 48px;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

.standard-header-banner {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 24px;
}

.standard-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.standard-code-badge {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-primary);
  font-family: var(--font-mono);
  letter-spacing: -0.02em;
}

.standard-full-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 16px;
}

.standard-metadata-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.meta-chip strong {
  color: var(--text-primary);
}

/* --- Engineering Audit & Verified Values Box --- */
.audit-callout-box {
  background-color: var(--audit-bg);
  border: 1px solid var(--audit-border);
  border-left: 6px solid var(--audit-border);
  border-radius: 8px;
  padding: 20px 24px;
  margin-bottom: 24px;
}

.audit-box-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.audit-box-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-primary);
}

.audit-status-stamp {
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background-color: var(--accent-green);
  color: #ffffff;
}

.audit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px 20px;
  font-size: 13px;
}

.audit-field-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.audit-field-value {
  color: var(--text-primary);
  font-weight: 600;
}

.audit-notes {
  grid-column: 1 / -1;
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 6px;
  border-top: 1px solid rgba(16, 185, 129, 0.2);
  padding-top: 10px;
}

/* ==========================================================================
   7. Interactive Table Toolbar & Table Container
   ========================================================================== */

/* Multi-Table Tabs */
.table-tabs-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  border-bottom: 2px solid var(--border-subtle);
  margin-bottom: 16px;
  overflow-x: auto;
}

.table-tab-btn {
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 700;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition-speed);
  white-space: nowrap;
}

.table-tab-btn:hover {
  color: var(--text-primary);
}

.table-tab-btn.active {
  color: var(--accent-cyan);
  border-bottom-color: var(--accent-cyan);
}

/* Interactive Toolbar */
.table-toolbar {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px 8px 0 0;
  padding: 14px 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.toolbar-left, .toolbar-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.table-search-input {
  padding: 8px 12px 8px 34px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  width: 240px;
  transition: border-color var(--transition-speed);
}

.table-search-input:focus {
  border-color: var(--border-focus);
}

.search-input-wrapper {
  position: relative;
}

.search-input-wrapper .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--text-muted);
}

.series-pills-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-right: 4px;
}

.btn-toolbar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 6px;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-strong);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-primary);
  transition: all var(--transition-speed);
}

.btn-toolbar:hover {
  background-color: var(--bg-surface-hover);
  border-color: var(--border-focus);
}

.btn-toolbar.active {
  background-color: var(--accent-primary);
  border-color: var(--accent-primary);
  color: #ffffff;
}

/* ==========================================================================
   8. Data Table: Multi-level Headers, Sticky Elements & Crosshair
   ========================================================================== */

.table-viewport-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-top: none;
  border-radius: 0 0 8px 8px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  margin-bottom: 20px;
}

.table-scroll-container {
  overflow: auto;
  max-height: calc(100vh - 380px);
  min-height: 320px;
  position: relative;
}

/* Table Architecture */
.pipes-data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
  color: var(--text-primary);
  text-align: left;
}

/* Headers */
.pipes-data-table thead th {
  background-color: var(--table-th-bg);
  color: var(--text-primary);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.02em;
  padding: 12px 14px;
  border-bottom: 2px solid var(--table-th-border);
  border-right: 1px solid var(--table-border);
  position: sticky;
  top: 0;
  z-index: 10;
  white-space: nowrap;
  user-select: none;
}

/* Second header row top offset */
.pipes-data-table thead tr:nth-child(1) th {
  top: 0;
  z-index: 12;
}

.pipes-data-table thead tr:nth-child(2) th {
  top: 41px;
  z-index: 11;
  background-color: var(--table-th-bg);
  border-top: 1px solid var(--table-th-border);
}

.pipes-data-table thead tr:nth-child(3) th {
  top: 82px;
  z-index: 10;
  background-color: var(--table-th-bg);
  border-top: 1px solid var(--table-th-border);
}

/* Sticky First Column for row 1, 2, 3 and body */
.pipes-data-table thead tr:nth-child(1) th:first-child {
  position: sticky;
  left: 0;
  top: 0;
  z-index: 25 !important;
  background-color: var(--table-sticky-bg);
  border-right: 2px solid var(--border-strong);
}

.pipes-data-table thead tr:nth-child(2) th:first-child {
  position: sticky;
  left: 0;
  top: 41px;
  z-index: 24 !important;
  background-color: var(--table-sticky-bg);
  border-right: 2px solid var(--border-strong);
}

.pipes-data-table thead tr:nth-child(3) th:first-child {
  position: sticky;
  left: 0;
  top: 82px;
  z-index: 23 !important;
  background-color: var(--table-sticky-bg);
  border-right: 2px solid var(--border-strong);
}

.pipes-data-table tbody td:first-child {
  position: sticky;
  left: 0;
  z-index: 5;
  background-color: var(--table-sticky-bg);
  font-weight: 800;
  color: var(--accent-cyan);
  border-right: 2px solid var(--border-strong);
}

/* Cells */
.pipes-data-table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--table-border);
  border-right: 1px solid var(--table-border);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  transition: background-color 0.1s ease;
}

/* Row Striping */
.pipes-data-table tbody tr:nth-child(even) {
  background-color: var(--table-row-even);
}

.pipes-data-table tbody tr:nth-child(odd) {
  background-color: var(--table-row-odd);
}

/* --- Crosshair Highlighting Engine --- */
.crosshair-active .pipes-data-table tbody tr.crosshair-row td {
  background-color: var(--table-hover-row) !important;
}

.crosshair-active .pipes-data-table tbody td.crosshair-col {
  background-color: var(--table-hover-col) !important;
}

.crosshair-active .pipes-data-table thead th.crosshair-col {
  background-color: var(--accent-primary) !important;
  color: #ffffff !important;
}

.crosshair-active .pipes-data-table tbody tr.crosshair-row td.crosshair-col {
  background-color: var(--table-hover-cell) !important;
  font-weight: 800;
  color: #ffffff;
}

/* Pinned Row on Click */
.pipes-data-table tbody tr.pinned-row td {
  background-color: var(--table-pinned-row) !important;
  border-top: 2px solid var(--accent-primary);
  border-bottom: 2px solid var(--accent-primary);
}

/* Footnotes Section */
.footnotes-container {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 16px 20px;
  font-size: 13px;
  color: var(--text-secondary);
}

.footnotes-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.footnotes-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.footnotes-list li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.footnote-symbol {
  font-weight: 800;
  color: var(--accent-cyan);
  font-family: var(--font-mono);
}

/* ==========================================================================
   8B. Dual-View Mode & Quick Inspector Component
   ========================================================================== */

/* View Mode Switcher */
.view-mode-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
  padding: 12px 18px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

.view-mode-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.view-mode-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.view-mode-pill-group {
  display: inline-flex;
  align-items: center;
  background-color: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 3px;
  gap: 4px;
}

.view-mode-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--transition-speed);
}

.view-mode-btn:hover {
  color: var(--text-primary);
  background-color: var(--bg-surface-hover);
}

.view-mode-btn.active {
  background-color: var(--accent-primary);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}

/* Quick Inspector Card */
.quick-inspector-section {
  margin-bottom: 24px;
  transition: all var(--transition-speed);
}

.quick-inspector-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  padding: 22px 24px;
}

.inspector-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.inspector-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.inspector-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.inspector-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  background-color: rgba(56, 189, 248, 0.12);
  color: var(--accent-cyan);
  border: 1px solid rgba(56, 189, 248, 0.3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.inspector-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Controls Grid */
.inspector-controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.inspector-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.inspector-form-group label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.inspector-select-wrapper {
  position: relative;
}

.inspector-select {
  width: 100%;
  padding: 10px 36px 10px 14px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: all var(--transition-speed);
}

.inspector-select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.inspector-select-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--text-muted);
}

/* Live Spec Card */
.inspector-spec-card {
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.08) 0%, rgba(19, 27, 39, 0.8) 100%);
  border: 1px solid var(--border-strong);
  border-left: 4px solid var(--accent-cyan);
  border-radius: 8px;
  padding: 20px;
  transition: all var(--transition-speed);
}

[data-theme="light"] .inspector-spec-card {
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.06) 0%, rgba(241, 245, 249, 0.9) 100%);
}

.spec-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

[data-theme="light"] .spec-card-header {
  border-bottom-color: rgba(0, 0, 0, 0.06);
}

.spec-card-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.spec-status-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.spec-status-pill.verified {
  background-color: rgba(16, 185, 129, 0.15);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.spec-status-pill.unstandardized {
  background-color: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.spec-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
}

.spec-metric-box {
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.spec-metric-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.spec-metric-value-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.spec-metric-value {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.spec-metric-value.accent {
  color: var(--accent-cyan);
}

.spec-metric-unit {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.inspector-actions-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

[data-theme="light"] .inspector-actions-row {
  border-top-color: rgba(0, 0, 0, 0.06);
}

.btn-inspector-action {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 6px;
  background-color: var(--accent-primary);
  color: #ffffff;
  border: 1px solid var(--accent-primary);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-speed);
}

.btn-inspector-action:hover {
  background-color: #0369a1;
  border-color: #0369a1;
  box-shadow: 0 0 12px rgba(2, 132, 199, 0.4);
}

/* ==========================================================================
   9. Print / Export PDF Stylesheet
   ========================================================================== */

@media print {
  @page {
    size: A4 landscape;
    margin: 8mm 10mm;
  }

  body {
    background-color: #ffffff !important;
    color: #000000 !important;
    font-size: 11pt !important;
    font-family: Arial, Helvetica, sans-serif !important;
  }

  .app-wrapper {
    height: auto !important;
    overflow: visible !important;
  }

  .top-header,
  .sidebar,
  .view-mode-bar,
  .quick-inspector-section,
  .table-toolbar,
  .table-tabs-nav,
  .system-status-indicator,
  .btn-icon-label,
  .sidebar-toggle-btn,
  .readiness-hero,
  #emptyStateView {
    display: none !important;
  }

  #masterTableSection {
    display: block !important;
  }

  .main-layout {
    height: auto !important;
    overflow: visible !important;
    display: block !important;
  }

  .content-viewport {
    overflow: visible !important;
    background: none !important;
  }

  .standard-detail-container {
    padding: 0 !important;
    max-width: 100% !important;
  }

  /* Printable Header Banner */
  .standard-header-banner {
    border: 2px solid #000000 !important;
    background: none !important;
    padding: 10px 14px !important;
    margin-bottom: 12px !important;
    border-radius: 0 !important;
  }

  .standard-code-badge {
    color: #000000 !important;
    font-size: 18pt !important;
  }

  .standard-full-title {
    color: #111111 !important;
    font-size: 11pt !important;
  }

  /* Printable Audit Box */
  .audit-callout-box {
    border: 1px solid #000000 !important;
    background: #f9f9f9 !important;
    padding: 8px 12px !important;
    margin-bottom: 12px !important;
    border-left: 4px solid #000000 !important;
  }

  .audit-status-stamp {
    border: 1px solid #000000 !important;
    background: #ffffff !important;
    color: #000000 !important;
    font-weight: 800 !important;
  }

  /* Printable Table */
  .table-viewport-card {
    border: none !important;
    box-shadow: none !important;
    margin-bottom: 10px !important;
  }

  .table-scroll-container {
    max-height: none !important;
    overflow: visible !important;
  }

  .pipes-data-table {
    width: 100% !important;
    border: 1.5pt solid #000000 !important;
    border-collapse: collapse !important;
  }

  .pipes-data-table thead th {
    background-color: #eaeaea !important;
    color: #000000 !important;
    border: 1pt solid #000000 !important;
    position: static !important;
    font-size: 9.5pt !important;
    padding: 6px 8px !important;
  }

  .pipes-data-table tbody td {
    border: 0.5pt solid #333333 !important;
    color: #000000 !important;
    font-size: 9pt !important;
    padding: 4px 6px !important;
    position: static !important;
  }

  .pipes-data-table tbody tr {
    page-break-inside: avoid !important;
  }

  .pipes-data-table tbody td:first-child {
    background: none !important;
    color: #000000 !important;
    font-weight: bold !important;
  }

  .footnotes-container {
    border: 1pt solid #000000 !important;
    background: none !important;
    padding: 8px 12px !important;
    font-size: 8.5pt !important;
  }
}

/* ==========================================================================
   10. Responsive Breakpoints
   ========================================================================== */

@media (max-width: 992px) {
  .sidebar-toggle-btn {
    display: inline-flex;
  }

  .sidebar {
    position: fixed;
    top: var(--header-height);
    bottom: 0;
    left: 0;
    z-index: 50;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .readiness-header-row {
    flex-direction: column;
  }

  .status-badge-lg {
    align-self: flex-start;
  }
}

@media (max-width: 640px) {
  .top-header {
    padding: 0 14px;
  }

  .brand-sub {
    display: none;
  }

  .readiness-hero {
    padding: 24px 16px;
  }

  .standard-detail-container {
    padding: 16px;
  }
}
