:root {
  --crux-good: #16a34a;              /* green */
  --crux-needs-improvement: #eab308; /* yellow */
  --crux-poor: #dc2626;              /* red */
}

/* --- CrUX / RUM color styling --- */
.crux-good {
  color: var(--crux-good);
}

.crux-warn {
  color: var(--crux-needs-improvement);
}

.crux-poor {
  color: var(--crux-poor);
}

/* --- Global Layout --- */
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: 'Inter', 'Roboto', sans-serif;
  line-height: 1.4;
  background: #fafafa;
  color: #111827;
  box-sizing: border-box;
}

/* --- Site Header --- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background-color: #F53942;
  color: #fff;
  z-index: 1000;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
}

.header-logo {
  height: 3.2rem;
  width: auto;
  display: block;
}

.header-title {
  font-size: 1.6rem;
  font-weight: 600;
  color: #fff;
  margin: 0;
  line-height: 1;
}

/* --- Body --- */
body {
  margin: 0;
  padding: 0 2rem;
  padding-top: 5rem;
  background: #fafafa;
  color: #111827;
}

.is-hidden {
  display: none !important;
}

/* --- Banner --- */
.banner {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #ffeeba;
  padding: 1rem;
  margin-bottom: 1rem;
  border-radius: 6px;
  font-size: 0.95rem;
}

.banner-info {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background-color: #e8f4ff; /* light blue */
  border-left: 5px solid #1e90ff; /* blue accent */
  border-radius: 6px;
  padding: 12px 16px;
  font-family: "Segoe UI", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: #03396c; /* deep blue text */
  margin: 15px 0;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.banner-info .icon {
  width: 22px;
  height: 22px;
  margin-top: 2px;
  flex-shrink: 0;
}

.banner-info a {
  color: #0056b3;
  text-decoration: underline;
}

.banner-info a:hover {
  color: #003d80;
  text-decoration: none;
}

.banner-text {
  flex: 1;
}


/* --- Section Headings --- */
h1 { margin-top: 0; font-weight: 600; }

.section-header {
  margin-top: 2.5rem;
  margin-left: 0;
  margin-right: 0;
  margin-bottom: 0.75rem;
  font-size: 1.15rem;
  font-weight: 600;
  color: #374151;
  text-align: left;
  border-bottom: 2px solid #f3f4f6;
  padding-bottom: 0.25rem;
}

/* --- Tables --- */
table {
  border-collapse: collapse;
  width: 100%;
  margin-top: 1rem;
  font-size: 0.95rem;
  background: white;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

th, td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e5e7eb;
  text-align: center;
  line-height: 1;
  height: 40px;
  box-sizing: border-box;
  vertical-align: middle;
}

th {
  background: #1A334F;
  color: #ffffff;
  border: 1px solid #1A334F;
}

#tier1-table,
#tier2-table {
  width: 100%;
  max-width: 5200px;
  margin-left: auto;
  margin-right: auto;
  table-layout: fixed;
}

th:first-child,
td:first-child {
  text-align: left;
}

tr:nth-child(even) { background: #fcfcfd; }
tr:hover { background: #f3f4f6; }

/* --- Grouped Table Headers --- */
.group-header th {
  background: #1A334F;
  font-weight: 600;
  text-align: center;
  border-bottom: 1px solid #1A334F;
  font-size: 0.9rem;
  color: #ffffff;
}

.group-header th:first-child {
  background: #1A334F;
  border-right: 1px solid #1A334F;
  width: 25%;
}

.group-header th.group-performance {
  border-left: 2px solid #1A334F;
}

.sub-header th {
  background: #1A334F;
  font-weight: 500;
  font-size: 0.85rem;
  text-align: center;
  color: #ffffff;
  border-bottom: 1px solid #1A334F;
  padding: 0.6rem;
}

/* --- Favicons --- */
.favicon {
  width: 16px;
  height: 16px;
  margin-right: 8px;
  vertical-align: middle;
  border-radius: 3px;
}

/* --- Uptime + Status --- */
.uptime-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 32px;
}

.uptime-badge {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  font-weight: 600;
  font-size: 0.8rem;
  min-width: 64px;
  text-align: center;
  line-height: 1;
}

.uptime-pass { background: #dcfce7; color: #166534; }
.uptime-fail { background: #fee2e2; color: #991b1b; }
.uptime-neutral { background: #e5e7eb; color: #374151; }

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.status-ok { background: #22c55e; }
.status-warn { background: #facc15; }
.status-fail { background: #ef4444; }
.status-nodata { background: #d1d5db; }

/* --- Metric Pills & Trends --- */
.metric-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  height: 32px;
  line-height: 1;
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}

.metric-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 9999px;
  font-weight: 600;
  font-size: 0.85rem;
  min-width: 64px;
  height: 24px;
  text-align: center;
  box-sizing: border-box;
}

.metric-pill.good { background: #dcfce7; color: #166534; }
.metric-pill.warn { background: #fef9c3; color: #92400e; }
.metric-pill.poor { background: #fee2e2; color: #991b1b; }

/* --- Performance metric island --- */
.expand-summary > td.performance-cell {
  position: relative;
  overflow: visible;
}

.expand-summary > td.performance-cell::before {
  content: "";
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 0;
  right: 0;
  background: #f3f4f6;
  z-index: 0;
  border-radius: 0;
}

.expand-summary > td.performance-cell.performance-start::before {
  left: 0.6rem;
  border-top-left-radius: 999px;
  border-bottom-left-radius: 999px;
}

.expand-summary > td.performance-cell.performance-end::before {
  right: 0.6rem;
  border-top-right-radius: 999px;
  border-bottom-right-radius: 999px;
}

.expand-summary > td.performance-cell > * {
  position: relative;
  z-index: 1;
}

/* --- Expandable Rows --- */
.expand-summary {
  border-bottom: 1px solid #e5e7eb;
  transition: background 0.2s;
}
.expand-summary:hover {
  background: #f3f4f6;
}

/* expanded details container */
.expand-details {
  background: #fafafa;
}
.expand-details.collapsed {
  display: none;
}

/* accordion content wrapper */
.accordion-content {
  padding: 0.75rem 1rem 2px;
  border-radius: 6px;
  background: #fafafa;
  position: relative;
  overflow: visible;
  box-shadow: 0 0 0 1px #e5e7eb inset;
  animation: fadeSlideIn 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Expand arrow --- */
.arrow-cell {
  width: 70px !important;
  min-width: 70px;
  max-width: 70px;
  text-align: center;
  cursor: pointer;
  user-select: none;
  position: relative;
  padding: 0;
}

.expand-arrow {
  display: inline-block;
  font-size: 1rem;
  color: #6b7280;
  transform: rotate(90deg);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  z-index: 1;
}
.arrow-cell::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  cursor: pointer;
}
.expand-arrow:hover { color: #374151; }
.expand-arrow.rotated {
  transform: rotate(270deg);
  color: #111827;
}

/* --- Uptime History Bar --- */
.uptime-history-block {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 0.85rem 1rem;
  margin-bottom: 1.1rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.uptime-history-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.uptime-history-header h4 {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: #1f2937;
}

.uptime-history-caption {
  font-size: 0.72rem;
  color: #6b7280;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.uptime-history-rows {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.uptime-history-row {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.35rem 0;
  border-top: 1px solid #f3f4f6;
}

.uptime-history-row:first-child {
  border-top: none;
}

.uptime-history-row.primary .uptime-history-name {
  color: #111827;
  font-weight: 600;
}

.uptime-history-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 220px;
  flex: 0 0 220px;
}

.uptime-history-label-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.uptime-history-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: #1f2937;
  margin: 0;
}

.uptime-history-sublabel {
  font-size: 0.75rem;
  color: #6b7280;
  word-break: break-all;
}

.uptime-history-favicon {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  flex-shrink: 0;
}

.uptime-bar {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(30, minmax(8px, 1fr));
  gap: 2px;
  align-items: center;
  min-height: 14px;
}

.uptime-pill {
  display: block;
  width: 100%;
  height: 10px;
  border-radius: 9999px;
  background: #d1d5db;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.uptime-pill.ok { background: #22c55e; }
.uptime-pill.partial { background: #facc15; }
.uptime-pill.down { background: #ef4444; }
.uptime-pill.nodata { background: #d1d5db; }

.uptime-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.15);
}

.uptime-history-row[data-placeholder-row="true"] .uptime-pill {
  opacity: 0.55;
}

.uptime-history-row[data-placeholder-row="true"] .uptime-history-name::after {
  content: " (sample)";
  font-size: 0.7rem;
  font-weight: 400;
  color: #9ca3af;
}

@media (max-width: 960px) {
  .uptime-history-label {
    min-width: 170px;
    flex: 0 0 170px;
  }
}

@media (max-width: 720px) {
  .uptime-history-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  .uptime-history-label {
    min-width: unset;
    flex: 1 1 auto;
  }
  .uptime-bar {
    width: 100%;
  }
}

/* --- Comparison Table --- */
.compare-heading {
  font-size: 0.95rem;
  font-weight: 600;
  color: #1f2937;
  margin: 0 0 0.75rem 0;
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 0.25rem;
}
.comparison-table th,
.comparison-table td {
  padding: 0.5rem 0.75rem;
  text-align: center;
}
.comparison-table td {
  border-bottom: 1px solid #f3f4f6;
}
.comparison-table th {
  background: #f3f4f6;
  font-weight: 600;
  color: #000000;
  border: 1px solid #f3f4f6;
  border-bottom: 1px solid #f3f4f6;
}
.comparison-table tr:last-child td { border-bottom: none; }

/* --- Comparison Note --- */
.compare-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  background: #f9fafb;
  border-top: 1px solid #e5e7eb;
  border-radius: 0 0 6px 6px;
  padding: 0.5rem 0.75rem;
  font-size: 0.8rem;
  color: #9ca3af;
  line-height: 1.4;
  text-align: center;
  margin-top: 0.75rem;
  margin-bottom: 0;
  flex-wrap: wrap;
}

/* --- Info / Legend Section --- */
.legend-wrap {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
  margin: 2.5rem auto;
  padding-bottom: 2rem;
  flex-wrap: nowrap;
  max-width: 1300px;
}

.uptime-legend,
.crux-legend {
  flex: 1 1 50%;
  max-width: 50%;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.legend-title {
  font-size: 1rem;
  font-weight: 600;
  color: #1f2937;
  margin-top: 0.25rem;
  margin-bottom: 0.75rem;
}

.legend-info {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
  color: #6b7280;
  font-size: 0.9rem;
}

.legend-info-icon {
  width: 18px;
  height: 18px;
  opacity: 0.85;
}

.status-legend-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
  margin-bottom: 0.75rem;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  font-weight: 500;
  background: #f3f4f6;
  color: #374151;
}

.status-chip.ok    { background: #dcfce7; color: #166534; }
.status-chip.warn  { background: #fef9c3; color: #92400e; }
.status-chip.fail  { background: #fee2e2; color: #991b1b; }
.status-chip.nodata{ background: #e5e7eb; color: #374151; }

.uptime-history-legend {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin: 0.75rem 0 0.35rem;
}

.uptime-history-key {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: #4b5563;
}

.uptime-history-swatch {
  width: 14px;
  height: 10px;
  border-radius: 9999px;
  background: #d1d5db;
  display: inline-block;
}

.uptime-history-swatch.ok { background: #22c55e; }
.uptime-history-swatch.partial { background: #facc15; }
.uptime-history-swatch.down { background: #ef4444; }
.uptime-history-swatch.nodata {
  background: #d1d5db;
  border: 1px solid #d1d5db;
}

.legend-pill {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.legend-pill.good { background: #dcfce7; color: #166534; }
.legend-pill.warn { background: #fef9c3; color: #92400e; }
.legend-pill.poor { background: #fee2e2; color: #991b1b; }

.legend-heading {
  font-weight: 600;
  font-size: 0.85rem;
  color: #374151;
  text-align: center;
}

.legend-metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0.25rem 0;
}

.legend-note {
  font-size: 0.8rem;
  color: #6b7280;
  margin-top: 0.5rem;
  line-height: 1.3;
}

.legend-aligned {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-top: 0.5rem;
}

.legend-headings {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  font-size: 0.8rem;
  color: #4b5563;
}

.uptime-points {
  margin: 0.5rem 0 0.75rem 1.25rem;
  padding: 0;
  list-style-type: disc;
  color: #4b5563;
  font-size: 0.85rem;
}

.legend-note.small {
  font-size: 0.75rem;
  color: #9ca3af;
  margin-top: 0.5rem;
}

.page-container {
  max-width: 5200px;     /* match your table and legend widths */
  margin: 0 auto;        /* center horizontally */
  padding: 0 1rem;       /* a bit of breathing space on small screens */
}

/* --- RUMvision logo in table header --- */
.rumcrux-logo {
  width: auto;
  vertical-align: middle;
  display: inline-block;
  object-fit: contain;
}

.rumvision-logo {
  height: 1rem;
}

.crux-logo {
  height: 1.6rem;
}

/* --- Trend Arrows --- */
.metric-trend {
  font-weight: 600;
  font-size: 0.8rem;
}

.trend-icon {
  width: 0.9rem;
  height: 0.9rem;
  margin-right: 0.25rem;
  vertical-align: middle;
  object-fit: contain;
}

.trend-improved {
  color: #22c55e; /* same as uptime-pass text color */
}

.trend-degraded {
  color: #ef4444; /* same as uptime-fail text color */
}

.trend-placeholder {
  display: inline-block;
  width: 3.5rem; /* match the typical width of the arrow + percentage */
  text-align: center;
  color: #9ca3af; /* invisible dash, still occupies space */
  user-select: none;
}

.unicorn-icon {
  width: 16px;
  height: 16px;
  margin-left: 4px;
  vertical-align: middle;
  object-fit: contain;
}

/* --- Last Updated Info --- */
.last-updated-note {
  font-size: 0.85rem;
  color: #4b5563; /* slate gray */
  background: #f9fafb;
  border-left: 3px solid #d1d5db;
  padding: 0.5rem 0.75rem;
  margin: 0.5rem 0 1rem 0;
  border-radius: 4px;
  line-height: 1.4;
  max-width: 500px;
}
.last-updated-note strong {
  color: #111827;
}

.competitor-url {
  display: block;
  font-size: 0.85em;
  color: #4b5563; /* subtle gray */
  word-break: break-all;
  margin-top: 0.15rem;
}

.accordion-toggle-container {
  text-align: right;
  margin: 0.5rem 2rem 1rem 0;
}

.toggle-all-btn {
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  padding: 0.3rem 0.75rem;
  font-size: 0.85rem;
  cursor: pointer;
  line-height: 1;
  transition: background 0.2s ease-in-out;
}

.toggle-all-btn:hover {
  background: #e5e7eb;
}

.comparison-table th {
  text-align: center;
  vertical-align: middle;
}

.comparison-table th br {
  line-height: 0.8;
}

.comparison-table th .competitor-url {
  display: block;
  font-size: 0.85em;
  color: #000000;
  margin-top: 0.15rem;
}

/* --- Accordion table column sizing --- */
.comparison-table {
  width: 100%;
  table-layout: fixed; /* prevents skew and distributes evenly */
}

.comparison-table th,
.comparison-table td {
  text-align: center;
  vertical-align: middle;
}

.comparison-table th:first-child,
.comparison-table td:first-child {
  width: 12rem; /* Squad column fixed width */
}

.comparison-table th:nth-child(2),
.comparison-table td:nth-child(2) {
  width: 15rem; /* Metric column fixed width */
}

.comparison-table th:not(:first-child):not(:nth-child(2)),
.comparison-table td:not(:first-child):not(:nth-child(2)) {
  width: auto; /* remaining columns share remaining space evenly */
}

/* --- Unicorn Legend Inline Note --- */
.unicorn-note {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.35rem;
}

.unicorn-note .unicorn-icon {
  width: 14px;
  height: 14px;
  vertical-align: middle;
  object-fit: contain;
  opacity: 0.9;
}
