/* ============================================================
   PROJECT MANHATTAN — mri.css
   Manhattan IUU Risk Index
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&family=DM+Sans:wght@300;400;500;600;700&family=DM+Mono:wght@400;500&display=swap');

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

:root {
  --primary: #1a6fdb;
  --bg: #f0f2f7;
  --white: #ffffff;
  --text: #1a1a2e;
  --muted: #6b7280;
  --border: #e8eaf0;
  --transparent: #22c55e;
  --low: #3b82f6;
  --medium: #f59e0b;
  --critical: #e63946;
}

body {
  font-family: 'Poppins', 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── CONSISTENT NUMBER FONT ── */
.gauge-score,
.gauge-max,
.score-num,
.score-max,
.stage-mini-score,
.stage-score-badge,
.mri-score-number,
.mri-score-max,
.kde-cov-num,
.last-assess-score,
.product-row-score,
.org-list-score,
.stage-modal-score-label,
.score-live-number,
.score-live-max,
.stage-score-chip-value,
.mri-project-score-big .score-num,
.mri-project-score-big .score-max {
  font-family: 'DM Mono', monospace !important;
}

/* ══ TOPBAR ══════════════════════════════════════════════════ */
.topbar {
  display: flex;
  align-items: center;
  padding: 14px 28px;
  gap: 20px;
  background: var(--bg);
  flex-shrink: 0;
}

.topbar-brand {
  display: flex;
  align-items: center;
  background: var(--white);
  border-radius: 999px;
  padding: 8px 16px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.07);
  text-decoration: none;
  line-height: 1.1;
  flex-shrink: 0;
}

.topbar-brand-project {
  display: block;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #9aa0b4;
}

.topbar-brand-name {
  display: block;
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
}

.topbar-nav { flex: 1; display: flex; justify-content: center; }

.nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--white);
  border-radius: 999px;
  padding: 5px 7px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.07);
}

.nav-pill-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  position: relative;
}

.nav-pill-item:hover { background: var(--bg); color: var(--text); }
.nav-pill-item.active { background: var(--bg); color: var(--text); font-weight: 600; }

.nav-pill-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.10);
  min-width: 160px;
  padding: 6px;
  z-index: 500;
}

.nav-pill-item:hover .nav-pill-dropdown { display: block; }

.nav-pill-item::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  height: 12px;
  background: transparent;
}

.nav-pill-dropdown a {
  display: block;
  padding: 8px 12px;
  font-size: 13px;
  color: #4a4e69;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 500;
}

.nav-pill-dropdown a:hover { background: var(--bg); color: var(--primary); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--white);
  border-radius: 999px;
  padding: 5px 8px 5px 5px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.07);
  flex-shrink: 0;
}

.topbar-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--white);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.topbar-email { font-size: 12px; font-weight: 500; color: #4a4e69; }

.topbar-settings {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
}

.topbar-profile-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.10);
  min-width: 176px;
  overflow: hidden;
  z-index: 999;
}

.topbar-profile-dropdown.open { display: block; }

.topbar-profile-name {
  padding: 11px 15px 7px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

.topbar-profile-dropdown a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 15px;
  font-size: 13px;
  color: #4a4e69;
  text-decoration: none;
  font-weight: 500;
}

.topbar-profile-dropdown a:hover { background: var(--bg); color: var(--primary); }

.topbar-profile-dropdown button {
  width: 100%;
  padding: 9px 15px;
  background: none;
  border: none;
  border-top: 1px solid var(--border);
  text-align: left;
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  color: var(--critical);
  cursor: pointer;
}

.topbar-profile-dropdown button:hover { background: #fff0f1; }

/* ══ LOADING ════════════════════════════════════════════════ */
.mri-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: calc(100vh - 80px);
  gap: 16px;
  color: var(--muted);
  font-size: 14px;
}

.mri-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* ══ WRAPPER ════════════════════════════════════════════════ */
.mri-wrapper {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 28px 60px;
}

/* ══ HERO ═══════════════════════════════════════════════════ */
.mri-hero {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 24px;
  padding: 40px 0 32px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
}

.mri-hero-left { flex: 1; }

.mri-badge {
  display: inline-block;
  padding: 3px 10px;
  background: #fef3c7;
  color: #d97706;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 2px;
  border-radius: 999px;
  margin-bottom: 12px;
}

.mri-title {
  font-size: 48px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -2px;
  line-height: 1.05;
  margin-bottom: 8px;
}

.mri-subtitle {
  font-size: 14px;
  color: var(--muted);
  font-weight: 400;
  letter-spacing: 0.5px;
}

.mri-hero-right {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-shrink: 0;
}

/* ══ OVERALL SCORE CARD ══════════════════════════════════════ */
.mri-score-card {
  background: var(--white);
  border-radius: 20px;
  padding: 28px 36px;
  text-align: center;
  box-shadow: 0 4px 24px rgba(0,0,0,0.07);
  min-width: 200px;
}

.mri-score-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 8px;
}

.mri-score-number {
  font-family: 'DM Mono', monospace;
  font-size: 42px;
  font-weight: 500;
  color: var(--text);
  line-height: 1;
  margin-bottom: 4px;
}

.mri-score-max {
  font-family: 'DM Mono', monospace;
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 12px;
}

.mri-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.mri-status-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.mri-status-pill.transparent { background: #dcfce7; color: #16a34a; }
.mri-status-pill.transparent .dot { background: #16a34a; }
.mri-status-pill.low { background: #dbeafe; color: #1d4ed8; }
.mri-status-pill.low .dot { background: #1d4ed8; }
.mri-status-pill.medium { background: #fef3c7; color: #d97706; }
.mri-status-pill.medium .dot { background: #d97706; }
.mri-status-pill.critical { background: #fee2e2; color: #dc2626; }
.mri-status-pill.critical .dot { background: #dc2626; }

/* ══ ADMIN BAR ══════════════════════════════════════════════ */
.mri-admin-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #eef4fd;
  border: 1px solid #c7dcf8;
  border-radius: 12px;
  padding: 14px 20px;
  margin-bottom: 24px;
  font-size: 13px;
  color: var(--primary);
  font-weight: 500;
}

.btn-conduct {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 20px;
  background: var(--primary);
  color: var(--white);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s;
  white-space: nowrap;
}

.btn-conduct:hover { background: #1560c0; }

/* ══ EMPTY ══════════════════════════════════════════════════ */
.mri-empty {
  text-align: center;
  padding: 60px 24px;
  background: var(--white);
  border-radius: 16px;
  margin-bottom: 32px;
}

.mri-empty-icon { font-size: 48px; margin-bottom: 16px; }
.mri-empty h2 { font-size: 20px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.mri-empty p { font-size: 14px; color: var(--muted); max-width: 420px; margin: 0 auto; line-height: 1.7; }

/* ══ TABLE ══════════════════════════════════════════════════ */
.mri-table-wrap {
  background: var(--white);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  margin-bottom: 32px;
}

.mri-table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.mri-table-header h2 { font-size: 15px; font-weight: 700; color: var(--text); }

.mri-table-count {
  font-size: 12px;
  color: var(--muted);
  background: var(--bg);
  padding: 3px 10px;
  border-radius: 999px;
}

.mri-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
  cursor: pointer;
  gap: 12px;
}

.mri-row:last-child { border-bottom: none; }
.mri-row:hover { background: var(--bg); }

.mri-row-head {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
  padding: 10px 24px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.mri-row-head span {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.mri-product-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.mri-product-brand {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.mri-score-cell {
  font-family: 'DM Mono', monospace;
  font-size: 16px;
  font-weight: 500;
  color: var(--text);
}

.mri-score-cell span {
  font-size: 11px;
  color: var(--muted);
}

.mri-date-cell {
  font-size: 12px;
  color: var(--muted);
}

.mri-assessor-cell {
  font-size: 12px;
  color: var(--muted);
}

/* ══ INFO SECTION ═══════════════════════════════════════════ */
.mri-info-section {
  margin-top: 12px;
}

.mri-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.mri-info-card {
  background: var(--white);
  border-radius: 14px;
  padding: 24px;
  border: 1px solid var(--border);
}

.mri-info-icon { font-size: 28px; margin-bottom: 12px; }
.mri-info-card h3 { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.mri-info-card p { font-size: 13px; color: var(--muted); line-height: 1.7; }

/* ══ THRESHOLDS ═════════════════════════════════════════════ */
.mri-thresholds {
  background: var(--white);
  border-radius: 14px;
  padding: 24px;
  border: 1px solid var(--border);
}

.mri-thresholds h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
}

.mri-threshold-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.threshold-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 10px;
}

.threshold-item.transparent { background: #dcfce7; }
.threshold-item.low { background: #dbeafe; }
.threshold-item.medium { background: #fef3c7; }
.threshold-item.critical { background: #fee2e2; }

.threshold-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.threshold-item.transparent .threshold-dot { background: #16a34a; }
.threshold-item.low .threshold-dot { background: #1d4ed8; }
.threshold-item.medium .threshold-dot { background: #d97706; }
.threshold-item.critical .threshold-dot { background: #dc2626; }

.threshold-item div { display: flex; flex-direction: column; gap: 2px; }
.threshold-item strong { font-size: 13px; font-weight: 700; color: var(--text); }
.threshold-item span { font-family: 'DM Mono', monospace; font-size: 11px; color: var(--muted); }

/* ══ UTILITIES ══════════════════════════════════════════════ */
.hidden { display: none !important; }