/* Company Pages - DSA Doctor
   Extracted EXACTLY from index.html and questions.html inline CSS.
   Additive only: linked in addition to assets/dsa-profile.css.
   Never modifies original files.
*/

:root {
  --bg: #eef5ff;
  --surface: #ffffff;
  --surface-2: #edf4ff;
  --surface-3: #e2eafc;
  --ink: #111827;
  --ink-secondary: #334155;
  --muted: #64748b;
  --line: #c9d8ee;
  --line-strong: #b1c8e8;
  --blue: #1554e8;
  --blue-hover: #0f44c4;
  --blue-light: rgba(21, 84, 232, 0.08);
  --green: #15803d;
  --amber: #b45309;
  --red: #b91c1c;
  --purple: #8b5cf6;
  --cyan: #06b6d4;
  --shadow:
    0 18px 42px rgba(21, 84, 232, 0.12),
    0 8px 22px rgba(20, 184, 166, 0.08),
    0 2px 8px rgba(245, 158, 11, 0.05);
  --glow:
    0 28px 72px rgba(21, 84, 232, 0.2),
    0 16px 38px rgba(20, 184, 166, 0.14),
    0 0 0 1px rgba(245, 158, 11, 0.12);
  --radius: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
}

body.dark-mode {
  --bg: #020617;
  --surface: #111827;
  --surface-2: #1f2937;
  --surface-3: #273549;
  --ink: #f8fafc;
  --ink-secondary: #cbd5e1;
  --muted: #94a3b8;
  --line: #334155;
  --line-strong: #475569;
  --blue: #60a5fa;
  --blue-hover: #93c5fd;
  --blue-light: rgba(96, 165, 250, 0.12);
  --green: #34d399;
  --amber: #fbbf24;
  --red: #f87171;
  --purple: #a78bfa;
  --cyan: #22d3ee;
  --shadow:
    0 22px 58px rgba(2, 6, 23, 0.58),
    0 10px 28px rgba(96, 165, 250, 0.12),
    0 2px 10px rgba(52, 211, 153, 0.08);
  --glow:
    0 26px 64px rgba(96, 165, 250, 0.22),
    0 14px 34px rgba(52, 211, 153, 0.12),
    0 0 0 1px rgba(251, 191, 36, 0.1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: linear-gradient(180deg, #eaf2ff 0%, #f8fbff 25%, #eef5ff 60%, #f4f8fe 100%);
  color: var(--ink);
  font-family:
    "Plus Jakarta Sans", Inter, ui-sans-serif, system-ui,
    -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
  transition: background 220ms ease, color 220ms ease;
  overflow-x: hidden;
}

body.dark-mode {
  background: linear-gradient(180deg, #020617 0%, #0b1329 25%, #0f172a 60%, #090d16 100%);
  color: var(--ink);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

a { color: inherit; text-decoration: none; }

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* =========================================================
   TOPBAR & NAVIGATION (exact copy from index.html)
   ========================================================= */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  box-shadow:
    0 12px 34px rgba(21, 84, 232, 0.08),
    0 4px 18px rgba(20, 184, 166, 0.05);
}

body.dark-mode .topbar {
  background: rgba(15, 23, 42, 0.82);
  border-bottom-color: rgba(148, 163, 184, 0.22);
  box-shadow:
    0 14px 36px rgba(2, 6, 23, 0.4),
    0 5px 18px rgba(96, 165, 250, 0.1);
}

.topbar-inner {
  max-width: 1520px;
  margin: 0 auto;
  padding: 10px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: nowrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
  flex: 0 1 auto;
}

.brand-mark {
  width: 182px;
  height: 52px;
  display: block;
  flex: 0 0 auto;
  position: relative;
  border-radius: 14px;
  filter: drop-shadow(0 10px 22px rgba(59, 130, 246, 0.14));
  transition: transform 0.2s ease;
}

.brand-mark:hover { transform: scale(1.02); }

.brand-mark img { width: 100%; height: 100%; display: block; object-fit: contain; }

.topbar-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  padding: 4px;
  background: rgba(241, 245, 249, 0.78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(203, 213, 225, 0.7);
  border-radius: 9999px;
  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, 0.8),
    0 2px 8px rgba(15, 23, 42, 0.04);
  transition: all 0.25s ease;
}

body.dark-mode .topbar-nav {
  background: rgba(15, 23, 42, 0.74);
  border-color: rgba(255, 255, 255, 0.09);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.05),
    0 4px 16px rgba(0, 0, 0, 0.35);
}

.nav-btn,
.must-solve-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 38px;
  padding: 0 16px;
  border-radius: 9999px;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #475569;
  background: transparent;
  border: 1px solid transparent;
  white-space: nowrap;
  position: relative;
  cursor: pointer;
  user-select: none;
  box-shadow: none;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

body.dark-mode .nav-btn,
body.dark-mode .must-solve-btn { color: #cbd5e1; }

.nav-btn .nav-btn-icon,
.must-solve-btn span {
  font-size: 16px;
  line-height: 1;
  display: inline-block;
}

.nav-btn:hover,
.must-solve-btn:hover {
  color: #0f172a;
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(203, 213, 225, 0.7);
  transform: translateY(-1.5px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}

body.dark-mode .nav-btn:hover,
body.dark-mode .must-solve-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}

.nav-btn--home.active {
  color: #ffffff !important;
  font-weight: 700;
  background: linear-gradient(135deg, #1554e8 0%, #2563eb 100%) !important;
  border-color: rgba(96, 165, 250, 0.4) !important;
  box-shadow:
    0 4px 16px rgba(37, 99, 235, 0.38),
    inset 0 1px 1px rgba(255, 255, 255, 0.4) !important;
  transform: translateY(-1px);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.theme-toggle {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: linear-gradient(135deg, #ff7a18, #ffb347);
  color: #fff;
  padding: 0;
  border-radius: 999px;
  font-size: 15px;
  cursor: pointer;
  box-shadow:
    0 6px 18px rgba(255, 122, 24, 0.28),
    inset 0 1px 1px rgba(255, 255, 255, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.theme-toggle:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow:
    0 12px 28px rgba(255, 122, 24, 0.4),
    inset 0 1px 1px rgba(255, 255, 255, 0.45);
}

.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  padding: 0;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
}

.nav-toggle i {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: all 0.2s ease;
}

.nav-backdrop {
  position: fixed;
  inset: 0;
  z-index: 89;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.nav-backdrop.show { display: block; opacity: 1; }

@media (max-width: 820px) {
  .topbar-nav {
    position: fixed;
    top: 68px;
    left: 16px;
    right: 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 16px;
    flex-direction: column;
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.2);
    display: none;
    z-index: 90;
  }
  .topbar-nav.open { display: flex; }
  .nav-toggle { display: flex; }
}

/* =========================================================
   COMPANY PAGE LAYOUT
   ========================================================= */
.company-page {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 32px;
  flex: 1;
  width: 100%;
}

.company-breadcrumb {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 8px;
}

.company-breadcrumb a {
  color: var(--blue);
  text-decoration: none;
}

.company-breadcrumb a:hover { text-decoration: underline; }

/* =========================================================
   SINGLE COMPANY DETAIL PAGE HERO & METRICS
   ========================================================= */
.company-detail-hero {
  margin: 16px 0 28px;
}

.company-detail-header-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  padding: 32px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.company-detail-header-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--blue), var(--purple), var(--cyan));
}

body.dark-mode .company-detail-header-card {
  background: rgba(17, 24, 39, 0.95);
  border-color: var(--line);
}

.company-brand-row {
  display: flex;
  align-items: flex-start;
  gap: 22px;
}

.company-brand-logo-wrap {
  width: 68px;
  height: 68px;
  border-radius: 18px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  flex: 0 0 68px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.company-brand-logo-img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  display: block;
}

.company-brand-logo-fallback {
  width: 100%;
  height: 100%;
  display: none;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.company-brand-info {
  flex: 1;
  min-width: 0;
}

.company-badge-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.hero-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(21, 84, 232, 0.08);
  color: var(--blue);
  border: 1px solid rgba(21, 84, 232, 0.2);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

body.dark-mode .hero-badge-pill {
  background: rgba(96, 165, 250, 0.12);
  color: #93c5fd;
  border-color: rgba(96, 165, 250, 0.28);
}

.company-detail-title {
  font-size: clamp(26px, 3.4vw, 40px);
  font-weight: 800;
  line-height: 1.15;
  color: var(--ink);
  margin: 0 0 10px;
  letter-spacing: -0.02em;
}

.company-detail-subtitle {
  font-size: 15.5px;
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
  max-width: 900px;
}

.company-detail-cta-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.btn-detail-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 999px;
  background: linear-gradient(135deg, #1554e8 0%, #2563eb 100%);
  color: #ffffff !important;
  font-weight: 700;
  font-size: 14px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 6px 20px rgba(21, 84, 232, 0.3);
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-detail-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(21, 84, 232, 0.4);
  text-decoration: none;
}

.btn-detail-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 999px;
  background: linear-gradient(135deg, #ff6b00 0%, #ffa62b 100%);
  color: #ffffff !important;
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 6px 20px rgba(255, 107, 0, 0.3);
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-detail-secondary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(255, 107, 0, 0.4);
  text-decoration: none;
}

.btn-detail-outline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink) !important;
  font-weight: 700;
  font-size: 14px;
  border: 1px solid var(--line-strong);
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-detail-outline:hover {
  border-color: var(--blue);
  color: var(--blue) !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(21, 84, 232, 0.12);
  text-decoration: none;
}

/* 4-Metric Grid */
.company-detail-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.detail-metric-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

body.dark-mode .detail-metric-card {
  background: rgba(17, 24, 39, 0.95);
  border-color: var(--line);
}

.detail-metric-num {
  font-size: 26px;
  font-weight: 800;
  font-family: "JetBrains Mono", monospace;
  color: var(--ink);
  line-height: 1.1;
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.detail-metric-num .pct-tag {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  font-family: inherit;
}

.detail-metric-lbl {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 6px;
}

.metric-easy .detail-metric-num { color: var(--green); }
.metric-medium .detail-metric-num { color: var(--amber); }
.metric-hard .detail-metric-num { color: var(--red); }

/* Topic & Datasets Strip */
.company-topic-strip {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 28px;
}

body.dark-mode .company-topic-strip {
  background: rgba(17, 24, 39, 0.95);
  border-color: var(--line);
}

.topic-strip-group {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.topic-strip-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}

.topic-strip-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.topic-pill {
  font-size: 12.5px;
  padding: 4px 12px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink-secondary);
  font-weight: 600;
}

.topic-pill strong { color: var(--ink); }
.topic-pill small { color: var(--muted); }

.dataset-pill {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(21, 84, 232, 0.08);
  border: 1px solid rgba(21, 84, 232, 0.2);
  color: var(--blue);
}

body.dark-mode .dataset-pill {
  background: rgba(96, 165, 250, 0.12);
  border-color: rgba(96, 165, 250, 0.25);
  color: #93c5fd;
}

/* =========================================================
   TABLE INTERACTIVE CONTROLS
   ========================================================= */
.table-control-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.table-search-box {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 6px 14px;
  flex: 1;
  max-width: 440px;
  transition: all 0.2s ease;
}

.table-search-box:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-light);
}

body.dark-mode .table-search-box {
  background: var(--surface);
  border-color: var(--line);
}

.table-search-icon {
  flex: 0 0 auto;
  color: var(--muted);
  margin-right: 10px;
}

.table-search-input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--ink);
  font-size: 14.5px;
  font-family: inherit;
  outline: none;
}

.table-search-input::placeholder {
  color: var(--muted);
  opacity: 0.85;
}

.table-search-clear {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 0 4px;
}

.table-search-clear:hover {
  color: var(--red);
}

.table-filter-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.table-diff-pill {
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink-secondary);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s ease;
}

.table-diff-pill:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.table-diff-pill.active {
  background: var(--blue);
  color: #ffffff;
  border-color: var(--blue);
  box-shadow: 0 4px 12px rgba(21, 84, 232, 0.25);
}

.table-diff-pill.pill-easy.active {
  background: var(--green);
  border-color: var(--green);
  box-shadow: 0 4px 12px rgba(21, 128, 61, 0.25);
}

.table-diff-pill.pill-medium.active {
  background: var(--amber);
  border-color: var(--amber);
  box-shadow: 0 4px 12px rgba(180, 83, 9, 0.25);
}

.table-diff-pill.pill-hard.active {
  background: var(--red);
  border-color: var(--red);
  box-shadow: 0 4px 12px rgba(185, 28, 28, 0.25);
}

.table-counter {
  font-size: 13.5px;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

.table-counter-val {
  color: var(--blue);
  font-weight: 800;
}

.table-scroll-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 18px rgba(15, 23, 42, 0.04);
  background: var(--surface);
  margin-bottom: 40px;
}

table.question-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1200px;
  background: var(--surface);
}

table.question-table th {
  background: var(--surface-2);
  color: var(--ink-secondary);
  font-size: 12.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 14px 16px;
  border-bottom: 2px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 2;
}

table.question-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 14.5px;
  vertical-align: middle;
}

table.question-table tbody tr {
  transition: background 0.15s ease;
}

table.question-table tbody tr:hover {
  background: var(--surface-2);
}

body.dark-mode table.question-table {
  background: #111827;
}

body.dark-mode table.question-table th {
  background: #1f2937;
  color: #cbd5e1;
  border-bottom-color: #334155;
}

body.dark-mode table.question-table td {
  border-bottom-color: #334155;
}

body.dark-mode table.question-table tbody tr:hover {
  background: #1e293b;
}

.table-empty-notice {
  text-align: center;
  padding: 48px 20px;
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  margin-bottom: 40px;
}

.empty-notice-icon {
  font-size: 36px;
  margin-bottom: 8px;
}

.table-empty-notice h4 {
  font-size: 18px;
  font-weight: 800;
  margin: 0 0 6px;
  color: var(--ink);
}

.table-empty-notice p {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 16px;
}

/* =========================================================
   RELATED COMPANIES CARDS GRID
   ========================================================= */
.related-companies-section {
  margin: 48px 0;
  padding: 32px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

body.dark-mode .related-companies-section {
  background: rgba(17, 24, 39, 0.95);
  border-color: var(--line);
}

.related-section-header {
  margin-bottom: 24px;
}

.related-section-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--ink);
  margin: 0 0 6px;
  letter-spacing: -0.015em;
}

.related-section-subtitle {
  font-size: 14.5px;
  color: var(--muted);
  margin: 0;
}

.related-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.related-company-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--ink);
  transition: all 0.2s ease;
}

.related-company-card:hover {
  transform: translateY(-2px);
  border-color: var(--blue);
  background: var(--surface);
  box-shadow: 0 8px 20px rgba(21, 84, 232, 0.1);
  text-decoration: none;
}

.related-card-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  flex: 0 0 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.related-card-logo img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.related-card-fallback {
  width: 100%;
  height: 100%;
  display: none;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
}

.related-card-info {
  flex: 1;
  min-width: 0;
}

.related-card-name {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.related-card-count {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.related-card-arrow {
  color: var(--blue);
  font-weight: 800;
  transition: transform 0.2s ease;
}

.related-company-card:hover .related-card-arrow {
  transform: translateX(3px);
}

@media (max-width: 768px) {
  .company-brand-row {
    flex-direction: column;
    align-items: flex-start;
  }
  .company-detail-metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .table-control-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .table-search-box {
    max-width: 100%;
  }
}


/* =========================================================
   COMPANY INDEX HUB, HERO & CARDS
   ========================================================= */
.company-hero {
  padding: 32px 0 20px;
  text-align: center;
  position: relative;
}

.company-hero .hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(21, 84, 232, 0.24);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  color: var(--blue);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  box-shadow: 0 4px 18px rgba(21, 84, 232, 0.08);
  margin-bottom: 20px;
}

body.dark-mode .company-hero .hero-badge {
  background: rgba(17, 24, 39, 0.9);
  border-color: rgba(96, 165, 250, 0.35);
  color: #93c5fd;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.pulse-dot-green {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 10px #10b981;
  display: inline-block;
}

.company-hero-title {
  font-size: clamp(32px, 4.2vw, 52px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.025em;
  margin: 0 0 16px;
  color: var(--ink);
}

.gradient-text {
  background: linear-gradient(135deg, #1554e8 0%, #7c3aed 50%, #06b6d4 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

body.dark-mode .gradient-text {
  background: linear-gradient(135deg, #60a5fa 0%, #c084fc 50%, #22d3ee 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.company-hero-subtitle {
  font-size: clamp(15px, 1.6vw, 18px);
  color: var(--muted);
  max-width: 840px;
  margin: 0 auto 32px;
  line-height: 1.6;
}

/* 4-Item Hero Metric Strip */
.company-hero-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  max-width: 1040px;
  margin: 0 auto 36px;
  padding: 20px;
  background: var(--surface);
  border: 1px solid rgba(21, 84, 232, 0.16);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

body.dark-mode .company-hero-stats {
  background: rgba(17, 24, 39, 0.92);
  border-color: rgba(96, 165, 250, 0.18);
}

.hero-stat-card {
  text-align: center;
  padding: 6px 12px;
}

.hero-stat-card:not(:last-child) {
  border-right: 1px solid var(--line);
}

body.dark-mode .hero-stat-card:not(:last-child) {
  border-right-color: var(--line-strong);
}

.stat-number {
  display: block;
  font-size: clamp(22px, 2.4vw, 32px);
  font-weight: 800;
  line-height: 1.1;
  color: var(--blue);
  margin-bottom: 4px;
  font-family: "Plus Jakarta Sans", sans-serif;
}

.stat-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* =========================================================
   SEARCH & FILTER CONTROLS
   ========================================================= */
.company-control-panel {
  max-width: 1100px;
  margin: 0 auto 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.company-search-box {
  width: 100%;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 2px solid rgba(21, 84, 232, 0.22);
  border-radius: var(--radius-lg);
  padding: 8px 16px;
  box-shadow:
    0 16px 40px rgba(21, 84, 232, 0.1),
    0 4px 14px rgba(15, 23, 42, 0.04);
  transition: all 0.22s ease;
}

.search-input-wrapper:focus-within {
  border-color: var(--blue);
  box-shadow:
    0 18px 48px rgba(21, 84, 232, 0.2),
    0 0 0 4px var(--blue-light);
}

body.dark-mode .search-input-wrapper {
  background: rgba(17, 24, 39, 0.95);
  border-color: rgba(96, 165, 250, 0.3);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
}

body.dark-mode .search-input-wrapper:focus-within {
  border-color: var(--blue);
  box-shadow:
    0 20px 52px rgba(0, 0, 0, 0.6),
    0 0 0 4px rgba(96, 165, 250, 0.2);
}

.search-svg-icon {
  flex: 0 0 auto;
  color: var(--muted);
  margin-right: 12px;
}

.company-search-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
  font-family: inherit;
  padding: 8px 0;
  outline: none;
}

.company-search-input::placeholder {
  color: var(--muted);
  opacity: 0.85;
}

.search-clear-btn {
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  margin-right: 10px;
  transition: all 0.15s ease;
}

.search-clear-btn:hover {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}

.search-key-hint {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.search-key-hint kbd {
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 2px 7px;
  font-family: inherit;
  font-size: 11.5px;
  color: var(--ink);
}

/* Category Filter Chips */
.company-filter-chips {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink-secondary);
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.filter-chip:hover {
  transform: translateY(-2px);
  border-color: var(--blue);
  color: var(--blue);
  box-shadow: 0 6px 16px rgba(21, 84, 232, 0.12);
}

.filter-chip.active {
  background: linear-gradient(135deg, #1554e8 0%, #2563eb 100%);
  color: #ffffff;
  border-color: rgba(96, 165, 250, 0.4);
  box-shadow: 0 6px 20px rgba(21, 84, 232, 0.35);
  transform: translateY(-1px);
}

body.dark-mode .filter-chip {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink-secondary);
}

body.dark-mode .filter-chip.active {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #ffffff;
}

.chip-count {
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(21, 84, 232, 0.1);
  color: var(--blue);
}

.filter-chip.active .chip-count {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

/* Horizontal A-Z Alphabet Nav */
.alphabet-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  padding: 8px 4px 10px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  justify-content: flex-start;
  max-width: 100%;
}

.alphabet-nav::-webkit-scrollbar {
  height: 4px;
}
.alphabet-nav::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 4px;
}

.alphabet-btn {
  flex: 0 0 auto;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink-secondary);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.16s ease;
}

.alphabet-btn:hover {
  background: var(--surface-2);
  border-color: var(--blue);
  color: var(--blue);
}

.alphabet-btn.active {
  background: var(--blue);
  color: #ffffff;
  border-color: var(--blue);
  box-shadow: 0 4px 12px rgba(21, 84, 232, 0.3);
}

/* Results Meta & Sort Bar */
.company-results-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 6px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  color: var(--muted);
  flex-wrap: wrap;
}

.results-count-text {
  font-weight: 600;
}

.results-number {
  color: var(--blue);
  font-weight: 800;
  font-size: 16px;
}

.results-sort-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sort-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.sort-select {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.sort-select:focus {
  border-color: var(--blue);
}

/* =========================================================
   ENHANCED COMPANY CARDS GRID
   ========================================================= */
.company-index-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
  padding: 24px 0 48px;
}

.company-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-decoration: none;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  transition: all 0.24s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
  position: relative;
  overflow: hidden;
}

.company-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--blue), var(--purple), var(--cyan));
  opacity: 0;
  transition: opacity 0.24s ease;
}

.company-card:hover {
  transform: translateY(-4px);
  border-color: var(--blue);
  box-shadow:
    0 18px 36px rgba(21, 84, 232, 0.14),
    0 4px 12px rgba(20, 184, 166, 0.06);
}

.company-card:hover::before {
  opacity: 1;
}

body.dark-mode .company-card {
  background: var(--surface);
  border-color: var(--line);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

body.dark-mode .company-card:hover {
  border-color: #60a5fa;
  box-shadow:
    0 20px 44px rgba(0, 0, 0, 0.6),
    0 4px 16px rgba(96, 165, 250, 0.15);
}

/* Card Header */
.company-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.company-logo-box {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  flex: 0 0 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.company-logo-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  display: block;
}

.company-logo-fallback {
  width: 100%;
  height: 100%;
  display: none;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.company-card-headings {
  flex: 1;
  min-width: 0;
}

.company-card-name {
  font-size: 17px;
  font-weight: 800;
  margin: 0 0 4px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.015em;
}

.company-card:hover .company-card-name {
  color: var(--blue);
}

.company-card-meta-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.company-card-count {
  font-size: 13px;
  color: var(--muted);
}

.company-card-count strong {
  color: var(--ink);
  font-weight: 700;
}

.badge-recency-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(21, 84, 232, 0.09);
  color: var(--blue);
  border: 1px solid rgba(21, 84, 232, 0.2);
}

.pulse-recency {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #1554e8;
}

body.dark-mode .badge-recency-pill {
  background: rgba(96, 165, 250, 0.14);
  color: #93c5fd;
  border-color: rgba(96, 165, 250, 0.3);
}

body.dark-mode .pulse-recency {
  background: #60a5fa;
}

/* Card Difficulty Stats */
.company-card-difficulty {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
}

.diff-stat {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
}

.diff-bullet {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: 0 0 7px;
}

.diff-bullet--easy { background: var(--green); }
.diff-bullet--medium { background: var(--amber); }
.diff-bullet--hard { background: var(--red); }

.diff-stat-num {
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
  color: var(--ink);
}

.diff-stat-lbl {
  color: var(--muted);
  font-size: 11px;
}

/* Card Tags */
.company-card-tags {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.company-mini-tag {
  font-size: 11.5px;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-weight: 600;
}

/* Card Action Footer */
.company-card-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  font-weight: 700;
  color: var(--blue);
  margin-top: 2px;
}

.company-card-action .arrow-icon {
  transition: transform 0.2s ease;
}

.company-card:hover .company-card-action .arrow-icon {
  transform: translateX(4px);
}

/* Empty Results State */
.company-empty-state {
  text-align: center;
  padding: 60px 20px;
  background: var(--surface);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-xl);
  max-width: 600px;
  margin: 32px auto;
}

.empty-state-icon {
  font-size: 44px;
  margin-bottom: 12px;
}

.empty-state-title {
  font-size: 20px;
  font-weight: 800;
  margin: 0 0 8px;
  color: var(--ink);
}

.empty-state-desc {
  font-size: 14.5px;
  color: var(--muted);
  margin: 0 0 20px;
}

.btn-reset-filters {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  border-radius: 999px;
  background: var(--blue);
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-reset-filters:hover {
  background: var(--blue-hover);
  transform: translateY(-1px);
}


/* =========================================================
   FOOTER (exact copy from index.html)
   ========================================================= */
.site-footer {
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  padding: 56px 24px 28px;
  margin-top: 60px;
  position: relative;
  overflow: hidden;
}

.site-footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  max-width: 1100px;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--blue), var(--purple), transparent);
}

.footer-inner { max-width: 1360px; margin: 0 auto; }

.footer-top-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 32px;
  flex-wrap: wrap;
  margin-bottom: 40px;
}

.footer-brand-wrap { max-width: 460px; }

.footer-logo-img {
  width: 165px;
  height: auto;
  display: block;
  margin-bottom: 14px;
}

.footer-mission-text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
  margin: 0 0 16px;
}

.footer-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}

.status-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.footer-divider {
  height: 1px;
  background: var(--line);
  margin-bottom: 36px;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px;
  margin-bottom: 40px;
}

.footer-col-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
  margin: 0 0 16px;
  letter-spacing: -0.01em;
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.footer-links li a {
  font-size: 13.5px;
  color: var(--muted);
  transition: color 0.15s ease;
}

.footer-links li a:hover { color: var(--blue); }

.footer-bottom-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.footer-copyright {
  font-size: 13px;
  color: var(--muted);
  display: grid;
  gap: 4px;
}

.footer-social-icons { display: flex; gap: 10px; }

.footer-social-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  transition: all 0.2s ease;
}

.footer-social-btn:hover {
  border-color: var(--blue);
  color: var(--blue);
  transform: translateY(-2px);
}

@media (max-width: 640px) {
  .company-meta { flex-direction: column; gap: 12px; }
  table.question-table { font-size: 13px; }
  table.question-table th, table.question-table td { padding: 10px 12px; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-top-row { flex-direction: column; align-items: stretch; }
  .company-page { padding: 0 16px; }
}

@media (max-width: 480px) {
  .footer-grid { grid-template-columns: 1fr; }
  .topbar-inner { padding: 8px 16px; }
  .brand-mark { width: 150px; height: 44px; }
}
