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

:root {
  --bg-canvas: #f3f5f8;
  --bg-surface: #ffffff;
  --bg-subtle: #f8fafc;
  --bg-muted: #eef2f6;

  --border-light: #e2e8f0;
  --border-Crisp: #cbd5e1;
  --border-heavy: #0f172a;

  --text-main: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;

  --brand-navy: #0f2942;
  --brand-accent: #0284c7;
  --brand-accent-hover: #0369a1;

  --pass-bg: #ecfdf5;
  --pass-border: #a7f3d0;
  --pass-text: #065f46;

  --warn-bg: #fffbeb;
  --warn-border: #fde68a;
  --warn-text: #92400e;

  --fail-bg: #fef2f2;
  --fail-border: #fecaca;
  --fail-text: #991b1b;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

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

body {
  background-color: var(--bg-canvas);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

/* Top Masthead */
.topbar {
  background: var(--brand-navy);
  color: #ffffff;
  padding: 0 32px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid #0284c7;
}

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

.brand-mark {
  width: 32px;
  height: 32px;
  background: #0284c7;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.05em;
  color: #ffffff;
}

.brand-divider {
  width: 1px;
  height: 24px;
  background: rgba(255, 255, 255, 0.2);
}

.brand-title {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.brand-subtitle {
  color: #94a3b8;
  font-size: 11.5px;
  font-weight: 400;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.compliance-indicator {
  font-size: 11.5px;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 16px;
  border-right: 1px solid rgba(255, 255, 255, 0.15);
}

.indicator-dot {
  width: 7px;
  height: 7px;
  background: #10b981;
  display: inline-block;
}

/* Buttons */
.btn-primary {
  background: var(--brand-accent);
  color: #ffffff;
  border: 1px solid var(--brand-accent);
  padding: 8px 16px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  border-radius: 2px;
  transition: background 0.15s;
}

.btn-primary:hover {
  background: var(--brand-accent-hover);
}

.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-Crisp);
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 2px;
  transition: all 0.15s;
}

.btn-secondary:hover {
  border-color: var(--brand-navy);
  background: var(--bg-subtle);
}

.btn-outline-light {
  background: transparent;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.35);
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border-radius: 2px;
}

.btn-outline-light:hover {
  border-color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
}

/* Primary Navigation Bar */
.nav-bar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-Crisp);
  padding: 0 32px;
  display: flex;
  gap: 32px;
}

.tab-btn {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  border-bottom: 3px solid transparent;
  padding: 14px 4px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: color 0.15s, border-color 0.15s;
}

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

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

/* Main Container */
.container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 28px 32px 48px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* Section Header */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--border-heavy);
}

.section-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.section-header p {
  color: var(--text-secondary);
  font-size: 13px;
  margin-top: 4px;
}

/* Filter Bar */
.filter-bar {
  display: grid;
  grid-template-columns: 2.2fr 1fr 1fr 1fr;
  background: var(--bg-surface);
  border: 1px solid var(--border-Crisp);
  margin-bottom: 24px;
}

.filter-cell {
  padding: 12px 16px;
  border-right: 1px solid var(--border-light);
}

.filter-cell:last-child {
  border-right: none;
}

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

.input-control, select {
  width: 100%;
  background: var(--bg-subtle);
  border: 1px solid var(--border-Crisp);
  color: var(--text-main);
  padding: 8px 10px;
  border-radius: 2px;
  font-size: 13px;
  font-family: var(--font-sans);
}

.input-control:focus, select:focus {
  outline: none;
  border-color: var(--brand-accent);
  background: var(--bg-surface);
}

/* Cross-Reference Architectural Sheet */
.xref-sheet {
  background: var(--bg-surface);
  border: 1px solid var(--border-Crisp);
  margin-bottom: 20px;
  display: grid;
  grid-template-columns: 320px 1fr;
}

.xref-baseline {
  background: var(--bg-subtle);
  border-right: 1px solid var(--border-Crisp);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.baseline-tag {
  display: inline-block;
  background: var(--fail-bg);
  color: var(--fail-text);
  border: 1px solid var(--fail-border);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  margin-bottom: 10px;
}

.baseline-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.35;
  margin-bottom: 4px;
}

.baseline-pn {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 16px;
}

.spec-list {
  border-top: 1px solid var(--border-light);
  padding-top: 12px;
}

.spec-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  font-size: 12px;
  border-bottom: 1px solid var(--border-light);
}

.spec-row span:first-child {
  color: var(--text-muted);
}

.spec-row span:last-child {
  font-weight: 600;
  color: var(--text-main);
}

.restriction-note {
  margin-top: 14px;
  font-size: 11.5px;
  color: var(--fail-text);
  line-height: 1.4;
}

.xref-replacements {
  padding: 0;
}

.rep-item {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-light);
}

.rep-item:last-child {
  border-bottom: none;
}

.rep-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}

.badge-compliant {
  display: inline-block;
  background: var(--pass-bg);
  color: var(--pass-text);
  border: 1px solid var(--pass-border);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
}

.badge-partner {
  display: inline-block;
  background: #f0f9ff;
  color: #0369a1;
  border: 1px solid #bae6fd;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  margin-left: 6px;
}

.rep-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 6px;
}

.rep-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.fit-box {
  text-align: right;
}

.fit-score {
  font-size: 18px;
  font-weight: 700;
  color: var(--pass-text);
}

.fit-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Crisp 4-Cell Spec Matrix inside Replacement */
.rep-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border: 1px solid var(--border-light);
  background: var(--bg-subtle);
  margin-bottom: 12px;
}

.rep-metric-cell {
  padding: 8px 12px;
  border-right: 1px solid var(--border-light);
}

.rep-metric-cell:last-child {
  border-right: none;
}

.rep-metric-cell .m-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.rep-metric-cell .m-val {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  margin-top: 2px;
}

.rep-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 10px;
}

.eng-callout {
  font-size: 12.5px;
  color: var(--text-secondary);
  border-left: 2px solid var(--brand-navy);
  padding-left: 12px;
  flex: 1;
}

/* Architecture Builder */
.arch-layout {
  display: grid;
  grid-template-columns: 390px 1fr;
  gap: 24px;
  align-items: start;
}

.sheet-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-Crisp);
}

.sheet-header {
  background: var(--bg-subtle);
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-Crisp);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sheet-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--brand-navy);
}

.sheet-body {
  padding: 18px;
}

.form-row {
  margin-bottom: 14px;
}

.form-row:last-child {
  margin-bottom: 0;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* KPI Strip (Sharp Divided Block) */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--bg-surface);
  border: 1px solid var(--border-Crisp);
  border-top: 3px solid var(--brand-navy);
  margin-bottom: 20px;
}

.kpi-cell {
  padding: 16px 20px;
  border-right: 1px solid var(--border-light);
}

.kpi-cell:last-child {
  border-right: none;
}

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

.kpi-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 4px;
  letter-spacing: -0.02em;
}

.kpi-sub {
  font-size: 11.5px;
  color: var(--text-secondary);
  margin-top: 3px;
}

/* Bus Utilization Bars */
.bus-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--border-light);
}

.bus-cell {
  padding: 14px 18px;
  border-right: 1px solid var(--border-light);
}

.bus-cell:last-child {
  border-right: none;
}

.bus-top {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 8px;
}

.bus-track {
  height: 6px;
  background: var(--bg-muted);
  overflow: hidden;
}

.bus-fill {
  height: 100%;
  background: var(--brand-navy);
  transition: width 0.2s;
}

.bus-fill.warn {
  background: #d97706;
}

/* Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.data-table th {
  text-align: left;
  padding: 10px 16px;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-Crisp);
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
  color: var(--text-main);
}

.data-table tr:hover td {
  background: #fafbfc;
}

/* Status Badges */
.status-badge {
  display: inline-block;
  padding: 3px 8px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px solid transparent;
}

.status-badge.ok {
  background: var(--pass-bg);
  color: var(--pass-text);
  border-color: var(--pass-border);
}

.status-badge.warn {
  background: var(--warn-bg);
  color: var(--warn-text);
  border-color: var(--warn-border);
}

.status-badge.fail {
  background: var(--fail-bg);
  color: var(--fail-text);
  border-color: var(--fail-border);
}

/* Alerts */
.alert-list {
  margin-bottom: 16px;
}

.alert-banner {
  padding: 11px 16px;
  margin-bottom: 8px;
  font-size: 12.5px;
  font-weight: 500;
  border-left: 4px solid;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-light);
  border-right: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
}

.alert-banner.error {
  border-left-color: #dc2626;
  background: var(--fail-bg);
  color: var(--fail-text);
}

.alert-banner.warn {
  border-left-color: #d97706;
  background: var(--warn-bg);
  color: var(--warn-text);
}

.alert-banner.pass {
  border-left-color: #059669;
  background: var(--pass-bg);
  color: var(--pass-text);
}

textarea.bom-input {
  width: 100%;
  height: 170px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-Crisp);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 12.5px;
  padding: 12px;
  border-radius: 2px;
  resize: vertical;
  line-height: 1.6;
}

textarea.bom-input:focus {
  outline: none;
  border-color: var(--brand-accent);
  background: var(--bg-surface);
}

/* Modal */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  z-index: 200;
  align-items: center;
  justify-content: center;
}

.modal-backdrop.open {
  display: flex;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-Crisp);
  border-top: 4px solid var(--brand-navy);
  max-width: 680px;
  width: 92%;
  padding: 28px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15);
}
