/* DigiMeet Awards Platform - Design System */

:root {
  /* Brand */
  --primary: #7c3aed;
  --primary-dark: #6d28d9;
  --primary-light: #a78bfa;
  --primary-50: #faf5ff;
  --primary-100: #f3e8ff;
  --primary-200: #e9d5ff;
  --primary-300: #d8b4fe;

  /* Surfaces */
  --bg: #ffffff;
  --bg-soft: #fafafa;
  --surface: #ffffff;
  --surface-hover: #f9fafb;
  --border: #e5e7eb;
  --border-soft: #f1f5f9;

  /* Text */
  --text: #0f172a;
  --text-body: #334155;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  /* Status */
  --success: #10b981;
  --success-bg: #d1fae5;
  --success-text: #065f46;
  --warning: #f59e0b;
  --warning-bg: #fef3c7;
  --warning-text: #92400e;
  --danger: #ef4444;
  --danger-bg: #fee2e2;
  --danger-text: #991b1b;
  --info: #3b82f6;
  --info-bg: #dbeafe;
  --info-text: #1e40af;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.04);
  --shadow: 0 1px 3px 0 rgb(15 23 42 / 0.06), 0 1px 2px -1px rgb(15 23 42 / 0.04);
  --shadow-md: 0 4px 12px -2px rgb(15 23 42 / 0.08), 0 2px 4px -2px rgb(15 23 42 / 0.04);
  --shadow-lg: 0 20px 40px -10px rgb(15 23 42 / 0.12), 0 8px 16px -6px rgb(15 23 42 / 0.06);
  --shadow-purple: 0 10px 30px -8px rgb(124 58 237 / 0.35);
  --shadow-purple-sm: 0 4px 12px -2px rgb(124 58 237 / 0.25);

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* Radius */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Layout */
  --sidebar-width: 248px;
  --header-height: 64px;
}

* { box-sizing: border-box; }
*:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }

html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'PingFang TC', 'Noto Sans SC', 'Noto Sans TC', 'Microsoft YaHei', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

/* Decorative background blobs */
.bg-gradient {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: #fff;
  overflow: hidden;
  pointer-events: none;
}
.bg-gradient::before,
.bg-gradient::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.45;
}
.bg-gradient::before {
  width: 520px; height: 520px;
  background: #e9d5ff;
  top: -180px; right: -120px;
}
.bg-gradient::after {
  width: 420px; height: 420px;
  background: #c7d2fe;
  bottom: -140px; left: -100px;
}

/* ============ LAYOUT ============ */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  background: #fff;
  border-right: 1px solid var(--border);
  padding: var(--space-5) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-2);
}
.brand-mark {
  width: 32px; height: 32px;
  border-radius: 10px;
  object-fit: contain;
  display: block;
}
.brand-text {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.nav-label {
  padding: 0 var(--space-3);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-light);
  margin-bottom: var(--space-2);
}
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px var(--space-3);
  border-radius: 8px;
  color: var(--text-body);
  font-weight: 500;
  font-size: 14px;
  transition: all 150ms ease-out;
  cursor: pointer;
}
.nav-item:hover { background: var(--primary-50); color: var(--primary-dark); }
.nav-item.active {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  box-shadow: var(--shadow-purple-sm);
}
.nav-item.active:hover { color: #fff; }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer {
  margin-top: auto;
  padding: var(--space-3);
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-soft);
  border-radius: 10px;
  border: 1px solid var(--border-soft);
}
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 13px;
}
.user-name { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.2; }
.user-role { font-size: 11px; color: var(--text-muted); line-height: 1.3; }
.icon-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 32px; height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  cursor: pointer;
  margin-left: auto;
  transition: all 150ms ease-out;
}
.icon-btn:hover { background: #fff; color: var(--danger); }

/* Main */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Header */
.header {
  height: var(--header-height);
  background: rgba(255,255,255,0.7);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 var(--space-8);
  gap: var(--space-4);
  position: sticky;
  top: 0;
  z-index: 10;
}
.page-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  margin: 0;
  margin-right: 4px;
}
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 13px;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb svg { width: 14px; height: 14px; color: var(--text-light); }
.breadcrumb .current { color: var(--text); font-weight: 500; }

.header-search {
  margin-left: auto;
  position: relative;
  width: 280px;
}
.header-search input {
  width: 100%;
  height: 38px;
  padding: 0 var(--space-4) 0 38px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 10px;
  font-size: 13px;
  color: var(--text);
  transition: all 150ms ease-out;
}
.header-search input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgb(124 58 237 / 0.12); outline: none; }
.header-search svg {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--text-light);
}
.header-actions { display: flex; align-items: center; gap: var(--space-2); }
.header-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  display: grid;
  place-items: center;
  color: var(--text-body);
  cursor: pointer;
  transition: all 150ms ease-out;
  position: relative;
}
.header-icon:hover { border-color: var(--primary-light); color: var(--primary); }
.header-icon svg { width: 18px; height: 18px; }
.header-icon .dot {
  position: absolute;
  top: 8px; right: 8px;
  width: 8px; height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid #fff;
}

/* Content */
.content {
  padding: var(--space-8);
  flex: 1;
  max-width: 1400px;
  width: 100%;
}
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-8);
  gap: var(--space-4);
}
.page-header h1 {
  font-size: 26px;
  font-weight: 700;
  margin: 0 0 4px 0;
  letter-spacing: -0.02em;
  color: var(--text);
}
.page-header p { color: var(--text-muted); margin: 0; font-size: 14px; }

/* ============ CARDS ============ */
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  transition: all 200ms ease-out;
}
.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 var(--space-1) 0;
  letter-spacing: -0.01em;
}
.card-subtitle { font-size: 13px; color: var(--text-muted); margin: 0 0 var(--space-5) 0; }

/* Stat cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-5);
  margin-bottom: var(--space-6);
}
.stat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  position: relative;
  overflow: hidden;
  transition: all 200ms ease-out;
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  margin-bottom: var(--space-4);
}
.stat-icon svg { width: 20px; height: 20px; }
.stat-icon.purple { background: var(--primary-100); color: var(--primary-dark); }
.stat-icon.green { background: var(--success-bg); color: var(--success-text); }
.stat-icon.amber { background: var(--warning-bg); color: var(--warning-text); }
.stat-icon.red { background: var(--danger-bg); color: var(--danger-text); }
.stat-icon.blue { background: var(--info-bg); color: var(--info-text); }

.stat-label {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 6px 0;
  font-weight: 500;
}
.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1;
  margin: 0;
}
.stat-delta {
  margin-top: var(--space-3);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
}
.stat-delta.up { color: var(--success); }
.stat-delta.down { color: var(--danger); }
.stat-delta svg { width: 12px; height: 12px; }

/* Grid layouts */
.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: var(--space-5); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-5); }
@media (max-width: 1100px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  height: 40px;
  padding: 0 var(--space-5);
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 180ms ease-out;
  border: 1px solid transparent;
  white-space: nowrap;
  user-select: none;
  letter-spacing: -0.01em;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  box-shadow: var(--shadow-purple-sm);
}
.btn-primary:hover {
  box-shadow: var(--shadow-purple);
  transform: translateY(-1px);
  color: #fff;
}
.btn-primary:active { transform: translateY(0); }
.btn-secondary {
  background: #fff;
  border-color: var(--border);
  color: var(--text);
}
.btn-secondary:hover { border-color: var(--primary-light); color: var(--primary); background: var(--primary-50); }
.btn-ghost {
  background: transparent;
  color: var(--text-body);
}
.btn-ghost:hover { background: var(--bg-soft); color: var(--text); }
.btn-sm { height: 32px; padding: 0 var(--space-4); font-size: 13px; }
.btn-lg { height: 48px; padding: 0 var(--space-6); font-size: 15px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============ FORMS ============ */
.field { margin-bottom: var(--space-4); }
.label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}
.input {
  width: 100%;
  height: 44px;
  padding: 0 var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  font-size: 14px;
  color: var(--text);
  font-family: inherit;
  transition: all 150ms ease-out;
}
.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgb(124 58 237 / 0.12);
  outline: none;
}
.input::placeholder { color: var(--text-light); }
.helper { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

/* ============ BADGES ============ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}
.badge svg { width: 12px; height: 12px; }
.badge-success { background: var(--success-bg); color: var(--success-text); }
.badge-warning { background: var(--warning-bg); color: var(--warning-text); }
.badge-danger { background: var(--danger-bg); color: var(--danger-text); }
.badge-info { background: var(--info-bg); color: var(--info-text); }
.badge-neutral { background: #f1f5f9; color: #475569; }
.badge-purple { background: var(--primary-100); color: var(--primary-dark); }
.badge-gold { background: #fef3c7; color: #92400e; }
.badge-muted { background: #f1f5f9; color: #94a3b8; }

/* ============ CUSTOM DROPDOWN ============ */
.custom-select {
  position: relative;
  display: inline-block;
  min-width: 140px;
}
.custom-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 14px;
  height: 44px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: border-color 150ms, box-shadow 150ms;
  font-family: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: none;
}
.custom-select-trigger:hover { border-color: var(--primary); }
.custom-select.open .custom-select-trigger {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgb(124 58 237 / 0.12);
}
.custom-select-trigger svg {
  width: 14px; height: 14px; flex-shrink: 0;
  color: var(--text-muted);
  transition: transform 150ms;
}
.custom-select.open .custom-select-trigger svg { transform: rotate(180deg); }
.custom-select-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 100%;
  width: max-content;
  max-width: 420px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  max-height: 280px;
  overflow-y: auto;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 150ms, transform 150ms;
}
.custom-select.open .custom-select-menu {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.custom-select-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: background 100ms;
  white-space: nowrap;
}
.custom-select-option:not(:last-child) { border-bottom: 1px solid var(--border-soft); }
.custom-select-option:hover { background: var(--bg-soft); }
.custom-select-option.active {
  background: var(--primary-50, #f5f3ff);
  color: var(--primary);
  font-weight: 600;
}
.custom-select-option .cs-check {
  width: 16px; height: 16px; margin-left: auto; flex-shrink: 0;
  opacity: 0; color: var(--primary);
}
.custom-select-option.active .cs-check { opacity: 1; }
.custom-select-option .cs-sub {
  font-size: 12px; color: var(--text-muted); font-weight: 400;
  margin-left: 4px;
}

/* ============ TABLE ============ */
.table-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.table-toolbar {
  padding: var(--space-4) var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.table-toolbar .header-search { margin-left: 0; width: 280px; }
.table-toolbar .filter-group { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-body);
  cursor: pointer;
  transition: all 150ms ease-out;
}
.chip:hover { border-color: var(--primary-light); color: var(--primary); }
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.chip.active:hover { color: #fff; }
.table-actions { margin-left: auto; display: flex; gap: var(--space-2); }

table {
  width: 100%;
  border-collapse: collapse;
}
thead th {
  text-align: left;
  padding: 12px var(--space-5);
  background: var(--bg-soft);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 14px var(--space-5);
  border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
  color: var(--text-body);
  vertical-align: middle;
}
tbody tr { transition: background 120ms ease-out; cursor: pointer; }
tbody tr:hover { background: var(--bg-soft); }
tbody tr:last-child td { border-bottom: none; }

.company-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}
.company-logo {
  width: 34px; height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary-100) 0%, var(--primary-200) 100%);
  color: var(--primary-dark);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.company-name { font-weight: 600; color: var(--text); }
.company-meta { font-size: 12px; color: var(--text-muted); }

/* Score pill */
.score-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.score-bar {
  width: 52px; height: 6px;
  background: var(--border-soft);
  border-radius: var(--radius-full);
  overflow: hidden;
}
.score-fill {
  height: 100%;
  border-radius: inherit;
  transition: width 500ms cubic-bezier(0.22,1,0.36,1);
}
.score-fill.high { background: var(--success); }
.score-fill.mid { background: var(--warning); }
.score-fill.low { background: var(--danger); }

/* ============ LOGIN ============ */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: var(--space-8) var(--space-4);
  position: relative;
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-10);
  box-shadow: var(--shadow-lg);
  position: relative;
  z-index: 1;
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: var(--space-8);
}
.login-brand .brand-mark { width: 40px; height: 40px; border-radius: 12px; }
.login-brand .brand-text { font-size: 19px; }
.login-card h1 {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 var(--space-2) 0;
}
.login-card h1 .accent { color: var(--primary); }
.login-card .lead {
  color: var(--text-muted);
  margin: 0 0 var(--space-8) 0;
  font-size: 14px;
}
.login-footer {
  margin-top: var(--space-6);
  text-align: center;
  font-size: 12px;
  color: var(--text-light);
}
.demo-hint {
  margin-top: var(--space-4);
  padding: 10px 12px;
  background: var(--primary-50);
  border: 1px dashed var(--primary-300);
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--primary-dark);
  text-align: center;
}

/* ============ DETAIL PAGE ============ */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: var(--space-6);
}
@media (max-width: 1100px) {
  .detail-grid { grid-template-columns: 1fr; }
}
.section {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-bottom: var(--space-5);
}
.section-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 var(--space-4) 0;
  color: var(--text);
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title svg { width: 16px; height: 16px; color: var(--primary); }

.kv-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4) var(--space-6);
}
.kv { display: flex; flex-direction: column; gap: 2px; }
.kv .k { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.kv .v { font-size: 14px; color: var(--text); font-weight: 500; }
.kv .v a { font-weight: 500; }

.narrative {
  color: var(--text-body);
  font-size: 14px;
  line-height: 1.65;
}

.file-list { display: flex; flex-direction: column; gap: var(--space-2); }
.file-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all 150ms ease-out;
  cursor: pointer;
}
.file-item:hover { border-color: var(--primary-light); background: var(--primary-50); }
.file-icon {
  width: 38px; height: 38px;
  border-radius: 8px;
  background: var(--primary-100);
  color: var(--primary-dark);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.file-icon svg { width: 18px; height: 18px; }
.file-name { font-size: 13px; font-weight: 500; color: var(--text); }
.file-meta { font-size: 12px; color: var(--text-muted); }

/* Side panel */
.aside-section {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-4);
}
.aside-section h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 var(--space-3) 0;
}

/* ============ COMPANY / FACT CHECK ============ */
.hero-company {
  background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
  border: 1px solid var(--primary-200);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  margin-bottom: var(--space-6);
  position: relative;
  overflow: hidden;
}
.hero-company::before {
  content: '';
  position: absolute;
  top: -80px; right: -80px;
  width: 240px; height: 240px;
  background: radial-gradient(circle, rgba(167,139,250,0.35) 0%, transparent 70%);
  border-radius: 50%;
}
.hero-content { position: relative; z-index: 1; display: flex; align-items: flex-start; gap: var(--space-5); }
.hero-logo {
  width: 72px; height: 72px;
  border-radius: 18px;
  background: #fff;
  color: var(--primary-dark);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 26px;
  box-shadow: var(--shadow-md);
  flex-shrink: 0;
}
.hero-info { flex: 1; }
.hero-info h1 {
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 4px 0;
  letter-spacing: -0.02em;
}
.hero-info .tagline { color: var(--text-muted); margin: 0 0 var(--space-3) 0; }
.hero-meta { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-3); }
.hero-meta-item { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-body); }
.hero-meta-item svg { width: 14px; height: 14px; color: var(--primary); }
.hero-action { margin-left: auto; flex-shrink: 0; }

/* Fact Check CTA */
.fact-check-cta {
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  text-align: center;
  color: #fff;
  margin-bottom: var(--space-6);
  position: relative;
  overflow: hidden;
}
.fact-check-cta::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at top, rgba(167,139,250,0.35) 0%, transparent 60%);
}
.fact-check-cta > * { position: relative; z-index: 1; }
.fact-check-cta .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: rgba(167,139,250,0.18);
  color: #e9d5ff;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: var(--space-4);
  border: 1px solid rgba(167,139,250,0.35);
}
.fact-check-cta .eyebrow svg { width: 14px; height: 14px; }
.fact-check-cta h2 {
  font-size: 26px;
  font-weight: 700;
  margin: 0 0 var(--space-3) 0;
  letter-spacing: -0.02em;
}
.fact-check-cta p {
  color: #c4b5fd;
  max-width: 540px;
  margin: 0 auto var(--space-6) auto;
  font-size: 15px;
}
.btn-fact-check {
  height: 52px;
  padding: 0 var(--space-6);
  font-size: 15px;
  background: #fff;
  color: var(--primary-dark);
  border: none;
  border-radius: var(--radius-full);
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: all 180ms ease-out;
  box-shadow: 0 10px 40px -8px rgba(167,139,250,0.6);
}
.btn-fact-check:hover { transform: translateY(-2px); box-shadow: 0 14px 50px -8px rgba(167,139,250,0.8); }
.btn-fact-check svg { width: 18px; height: 18px; }

/* Fact check animation */
.verification-loader {
  padding: var(--space-8);
  text-align: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  margin-bottom: var(--space-6);
}
.loader-ring {
  width: 64px; height: 64px;
  margin: 0 auto var(--space-5) auto;
  border: 3px solid var(--primary-100);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 900ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loader-title { font-size: 17px; font-weight: 600; margin: 0 0 var(--space-2) 0; }
.loader-steps { display: flex; flex-direction: column; gap: 10px; max-width: 360px; margin: var(--space-5) auto 0 auto; text-align: left; }
.loader-step {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--text-muted);
  opacity: 0.4;
  transition: opacity 300ms;
}
.loader-step.active { opacity: 1; color: var(--text); }
.loader-step.done { opacity: 1; color: var(--success); }
.loader-step .dot-icon {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
  display: grid;
  place-items: center;
}
.loader-step.active .dot-icon {
  border-color: var(--primary);
  background: var(--primary);
  animation: pulse 1s ease-in-out infinite;
}
.loader-step.done .dot-icon {
  border-color: var(--success);
  background: var(--success);
  color: #fff;
}
.loader-step.done .dot-icon svg { width: 10px; height: 10px; stroke-width: 3; }
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* Trust gauge */
.trust-gauge-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  text-align: center;
}
.gauge-wrap {
  position: relative;
  width: 180px; height: 100px;
  margin: 0 auto;
}
.gauge-value {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  text-align: center;
}
.gauge-value .score {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1;
}
.gauge-value .max { font-size: 14px; color: var(--text-muted); }
.gauge-label { margin-top: var(--space-4); font-size: 14px; font-weight: 600; }
.gauge-label.high { color: var(--success); }
.gauge-label.mid { color: var(--warning); }
.gauge-label.low { color: var(--danger); }

/* Flags grid */
.flags-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}
@media (max-width: 900px) { .flags-grid { grid-template-columns: 1fr; } }
.flag-card {
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  border: 1px solid;
}
.flag-card.green { background: #f0fdf4; border-color: #bbf7d0; }
.flag-card.red { background: #fef2f2; border-color: #fecaca; }
.flag-card.grey { background: #f8fafc; border-color: #e2e8f0; }
.flag-header { display: flex; align-items: center; gap: 10px; margin-bottom: var(--space-3); }
.flag-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
}
.flag-card.green .flag-icon { background: #dcfce7; color: #15803d; }
.flag-card.red .flag-icon { background: #fee2e2; color: #b91c1c; }
.flag-card.grey .flag-icon { background: #e2e8f0; color: #475569; }
.flag-icon svg { width: 16px; height: 16px; }
.flag-title { font-size: 14px; font-weight: 600; }
.flag-count { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.flag-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.flag-list li {
  font-size: 13px;
  color: var(--text-body);
  padding-left: 14px;
  position: relative;
  line-height: 1.4;
}
.flag-list li::before {
  content: '';
  position: absolute;
  left: 0; top: 8px;
  width: 5px; height: 5px;
  border-radius: 50%;
}
.flag-card.green .flag-list li::before { background: var(--success); }
.flag-card.red .flag-list li::before { background: var(--danger); }
.flag-card.grey .flag-list li::before { background: var(--text-light); }

/* Verification matrix */
.matrix-table th, .matrix-table td { vertical-align: top; }
.claim-cell { display: flex; flex-direction: column; gap: 2px; }
.claim-cell .label-sm { font-size: 11px; color: var(--text-light); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.claim-cell .val { font-weight: 600; color: var(--text); font-size: 13px; }
.source-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--primary);
  font-weight: 500;
}
.source-link svg { width: 12px; height: 12px; }
.verdict-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.verdict-badge svg { width: 12px; height: 12px; }
.verdict-verified { background: var(--success-bg); color: var(--success-text); }
.verdict-contradicted { background: var(--danger-bg); color: var(--danger-text); }
.verdict-partial { background: var(--warning-bg); color: var(--warning-text); }
.verdict-unverifiable { background: #f1f5f9; color: #475569; }

/* AI narrative */
.ai-narrative {
  background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
  border: 1px solid var(--primary-200);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-5);
}
.ai-narrative-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: var(--space-3);
}
.ai-narrative-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  display: grid;
  place-items: center;
}
.ai-narrative-icon svg { width: 16px; height: 16px; }
.ai-narrative-title { font-size: 13px; font-weight: 600; color: var(--primary-dark); }
.ai-narrative-text { font-size: 14px; line-height: 1.6; color: var(--text); margin: 0; }

/* Reveal animation */
.reveal { opacity: 0; transform: translateY(12px); transition: opacity 500ms ease-out, transform 500ms ease-out; }
.reveal.in { opacity: 1; transform: translateY(0); }

/* Utilities */
.row { display: flex; align-items: center; gap: var(--space-3); }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-0 { margin-bottom: 0 !important; }
.mb-4 { margin-bottom: var(--space-4); }
.text-muted { color: var(--text-muted); }
.text-small { font-size: 12px; }

/* Chart canvas */
.chart-wrap { position: relative; height: 280px; }
.chart-wrap-sm { position: relative; height: 200px; }

/* Activity feed */
.activity { list-style: none; margin: 0; padding: 0; }
.activity li {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border-soft);
}
.activity li:last-child { border-bottom: none; }
.activity-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.activity-icon svg { width: 14px; height: 14px; }
.activity-body { flex: 1; min-width: 0; }
.activity-text { font-size: 13px; color: var(--text); line-height: 1.45; margin: 0; }
.activity-text strong { font-weight: 600; }
.activity-time { font-size: 11px; color: var(--text-light); margin-top: 2px; }

/* ============ EVENT DROPDOWN ============ */
.event-select {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 12px 0 16px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-body);
  cursor: pointer;
  transition: all 150ms ease-out;
  user-select: none;
  font-family: inherit;
  white-space: nowrap;
}
.event-select:hover { border-color: var(--primary-light); color: var(--primary-dark); }
.event-select .caret {
  width: 14px; height: 14px;
  opacity: 0.7;
  transition: transform 180ms ease-out;
}
.event-select.open { border-color: var(--primary-light); color: var(--primary-dark); box-shadow: 0 0 0 3px rgb(124 58 237 / 0.08); }
.event-select.open .caret { transform: rotate(180deg); }
.event-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 240px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 4px;
  display: none;
  z-index: 50;
  overflow: hidden;
}
.event-select.open .event-menu { display: block; }
.event-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-body);
  cursor: pointer;
  transition: background 120ms ease-out;
}
.event-menu-item:hover { background: var(--primary-50); color: var(--primary-dark); }
.event-menu-item.active { background: var(--primary-100); color: var(--primary-dark); font-weight: 600; }
.event-menu-item .em-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.event-menu-item .em-name { flex: 1; min-width: 0; }
.event-menu-item .em-sub { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.event-menu-item.active .em-sub { color: var(--primary); opacity: 0.85; }
.event-menu-item .em-check {
  width: 14px; height: 14px;
  color: var(--primary);
  opacity: 0;
}
.event-menu-item.active .em-check { opacity: 1; }
.event-menu-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ============ ACTION MENU (3-dot) ============ */
.action-wrap {
  position: relative;
  display: inline-block;
}
.action-btn {
  width: 30px;
  height: 30px;
  border: none;
  background: transparent;
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 120ms ease-out;
  font-family: inherit;
}
.action-btn:hover { background: var(--bg-soft); color: var(--text); }
.action-wrap.open .action-btn { background: var(--primary-100); color: var(--primary-dark); }
.action-btn svg { width: 16px; height: 16px; }

.action-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  min-width: 180px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  padding: 4px;
  display: none;
  z-index: 40;
}
.action-wrap.open .action-menu { display: block; }
.action-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-body);
  cursor: pointer;
  white-space: nowrap;
  transition: background 120ms ease-out;
  font-weight: 500;
}
.action-item:hover { background: var(--bg-soft); color: var(--text); }
.action-item.danger { color: var(--danger); }
.action-item.danger:hover { background: var(--danger-bg); color: var(--danger-text); }
.action-item.success { color: var(--success-text); }
.action-item.success:hover { background: var(--success-bg); }
.action-item svg { width: 14px; height: 14px; opacity: 0.8; flex-shrink: 0; }
.action-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* Inactive row styling */
tr.row-inactive td { opacity: 0.55; }
tr.row-inactive:hover td { opacity: 0.7; }
tr.row-inactive .judge-avatar { filter: grayscale(0.5); }

/* ============ STATUS DROPDOWN ============ */
.status-drop {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  user-select: none;
  padding: 2px 6px 2px 0;
  border-radius: var(--radius-full);
  transition: background 120ms ease-out;
}
.status-drop:hover { background: var(--bg-soft); }
.status-drop .caret {
  width: 14px;
  height: 14px;
  opacity: 0.55;
  color: var(--text-muted);
  transition: transform 180ms ease-out, opacity 120ms;
  flex-shrink: 0;
}
.status-drop:hover .caret { opacity: 1; }
.status-drop.open .caret { transform: rotate(180deg); opacity: 1; }
.status-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 200px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 4px;
  display: none;
  z-index: 40;
}
.status-drop.open .status-menu { display: block; }
.status-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: background 120ms ease-out;
}
.status-menu-item:hover { background: var(--primary-50); }
.status-menu-item.active { background: var(--primary-100); }
.status-menu-item .sm-check {
  width: 14px;
  height: 14px;
  color: var(--primary);
  margin-left: auto;
  opacity: 0;
  flex-shrink: 0;
}
.status-menu-item.active .sm-check { opacity: 1; }

/* ============ MODAL ============ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  display: grid;
  place-items: center;
  padding: var(--space-5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease-out;
}
.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}
.modal-card {
  background: #fff;
  border-radius: var(--radius-xl);
  box-shadow: 0 30px 80px -20px rgba(15,23,42,0.45);
  max-width: 520px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(16px) scale(0.98);
  transition: transform 250ms cubic-bezier(0.22,1,0.36,1);
}
.modal-backdrop.open .modal-card {
  transform: translateY(0) scale(1);
}
.modal-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-6) var(--space-6) 0;
}
.modal-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary-100) 0%, var(--primary-200) 100%);
  color: var(--primary-dark);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.modal-icon svg { width: 20px; height: 20px; }
.modal-title-wrap { flex: 1; min-width: 0; }
.modal-title { font-size: 17px; font-weight: 700; margin: 0; letter-spacing: -0.01em; color: var(--text); }
.modal-subtitle { font-size: 13px; color: var(--text-muted); margin: 4px 0 0 0; line-height: 1.45; }
.modal-close {
  flex-shrink: 0;
  width: 32px; height: 32px;
  border: none;
  background: transparent;
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 150ms;
}
.modal-close:hover { background: var(--bg-soft); color: var(--text); }
.modal-close svg { width: 18px; height: 18px; }
.modal-body { padding: var(--space-5) var(--space-6); }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: var(--space-4) var(--space-6) var(--space-6);
  border-top: 1px solid var(--border-soft);
  margin-top: 4px;
  background: var(--bg-soft);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}
.modal-body .field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.modal-body textarea.input {
  padding: 10px 14px;
  height: auto;
  min-height: 80px;
  resize: vertical;
  font-family: inherit;
  line-height: 1.45;
}
.modal-body select.input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text);
  font-family: inherit;
}
.modal-body select.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgb(124 58 237 / 0.12);
  outline: none;
}

/* Demo alert */
.demo-alert-msg {
  font-size: 15px;
  font-weight: 500;
  color: var(--success);
  line-height: 1.6;
}
.btn-danger {
  background: var(--danger);
  color: #fff;
  border: none;
  padding: 8px 24px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 150ms;
}
.btn-danger:hover {
  opacity: 0.9;
}

.modal-toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  background: var(--text);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 300;
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0;
  transition: all 250ms ease-out;
  pointer-events: none;
}
.modal-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.modal-toast svg {
  width: 16px; height: 16px;
  color: var(--success);
}

/* ============ HELP CARDS ============ */
.help-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px dashed var(--border);
}
.help-card {
  background: var(--bg-soft);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}
.help-icon {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center; flex-shrink: 0;
}
.help-icon svg { width: 18px; height: 18px; }
.help-icon.purple { background: var(--primary-100); color: var(--primary-dark); }
.help-icon.green { background: var(--success-bg); color: var(--success-text); }
.help-icon.amber { background: var(--warning-bg); color: var(--warning-text); }
.help-icon.blue { background: var(--info-bg); color: var(--info-text); }
.help-body h4 {
  font-size: 13px; font-weight: 700; margin: 0 0 4px;
  color: var(--text);
}
.help-body p {
  font-size: 12px; line-height: 1.55; color: var(--text-muted);
  margin: 0;
}

/* ============ TOGGLE SWITCH ============ */
.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch-track {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #cbd5e1;
  transition: 200ms;
  border-radius: 22px;
}
.switch-track::before {
  position: absolute;
  content: '';
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background: #fff;
  transition: 200ms;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(15,23,42,0.25);
}
.switch input:checked + .switch-track { background: var(--primary); }
.switch input:checked + .switch-track::before { transform: translateX(18px); }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 3px rgb(124 58 237 / 0.25); }

/* ============ MOBILE MENU (hamburger) ============ */
.mobile-menu-btn {
  display: none;
  width: 38px; height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-body);
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
}
.mobile-menu-btn svg { width: 20px; height: 20px; }
.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 50;
  animation: fadeIn 180ms ease-out;
}
.mobile-overlay.open { display: block; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ============ TABLET ============ */
@media (max-width: 1100px) {
  .content { padding: var(--space-6); }
  .header { padding: 0 var(--space-5); }
}

/* ============ MOBILE (<=900px) ============ */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }

  /* Sidebar becomes off-canvas drawer */
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    height: 100vh;
    width: 260px;
    z-index: 60;
    transform: translateX(-100%);
    transition: transform 240ms cubic-bezier(0.22,1,0.36,1);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }

  /* Show hamburger, hide desktop search + chrome that crowds top bar */
  .mobile-menu-btn { display: grid; }
  .header-search { display: none; }
  .header .breadcrumb { display: none; }
  .header .event-select { margin-left: auto; max-width: 160px; overflow: hidden; }
  .header .event-select .em-name,
  .header .event-select span:not(.caret) { text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }
  .header-actions .header-icon[aria-label="Help"] { display: none; }

  .content { padding: var(--space-5); }
  .header { padding: 0 var(--space-4); gap: var(--space-3); }

  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: var(--space-3); }

  /* Page header stacks */
  .page-header { flex-direction: column; align-items: stretch; gap: var(--space-3); margin-bottom: var(--space-5); }
  .page-header h1 { font-size: 22px; }
  .page-header .row { flex-wrap: wrap; }
  .page-header .row .btn { flex: 1; min-width: 0; }

  /* Tables become card stack on mobile */
  .table-card { overflow: visible; }
  .table-card table,
  .table-card thead,
  .table-card tbody,
  .table-card tr,
  .table-card th,
  .table-card td,
  .matrix-table,
  .matrix-table thead,
  .matrix-table tbody,
  .matrix-table tr,
  .matrix-table th,
  .matrix-table td { display: block; width: auto; }
  .table-card thead, .matrix-table thead { display: none; }
  .table-card tbody tr, .matrix-table tbody tr {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    border-top: none !important;
  }
  .table-card tbody tr:last-child, .matrix-table tbody tr:last-child { border-bottom: none; }
  .table-card tbody tr:hover, .matrix-table tbody tr:hover { background: transparent; }
  .table-card tbody td, .matrix-table tbody td {
    padding: 4px 0;
    border: none !important;
    min-height: 0;
  }
  /* First cell = card title */
  .table-card tbody td:first-child,
  .matrix-table tbody td:first-child { padding-bottom: 8px; }
  /* Subsequent cells = label/value rows */
  .table-card tbody td[data-label],
  .matrix-table tbody td[data-label] {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 6px 0;
  }
  .table-card tbody td[data-label]::before,
  .matrix-table tbody td[data-label]::before {
    content: attr(data-label);
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    flex-shrink: 0;
  }
  /* Hide empty / label-less cells (e.g. chevron column) */
  .table-card tbody td:not(:first-child):not([data-label]),
  .matrix-table tbody td:not(:first-child):not([data-label]) { display: none; }

  /* Fact-check report: header stacks, buttons wrap, matrix wrapper resets negative margins */
  #report > .row.between { flex-direction: column; align-items: stretch; gap: 12px; }
  #report > .row.between > .row { flex-wrap: wrap; gap: 8px; }
  #report > .row.between > .row .btn { flex: 1; min-width: 0; }
  #report .section > div[style*="-24px"] { margin: 0 !important; }
  #report .section .row.between { flex-direction: column; align-items: flex-start; gap: 8px; }

  /* Toolbar stacks */
  .table-toolbar { padding: var(--space-3) var(--space-4); gap: var(--space-2); }
  .table-toolbar .header-search { display: block; width: 100%; }
  .table-actions { margin-left: 0; }

  /* Form grid collapses */
  .form-grid { grid-template-columns: 1fr; gap: 6px 0; }
  .form-grid .fv { margin-bottom: 16px; }
  .form-grid select,
  .form-grid input[type="text"],
  .form-grid input[type="email"],
  .form-grid input[type="url"],
  .form-grid input[type="date"] { max-width: 100%; }

  .save-bar { flex-wrap: wrap; }
  .save-bar .btn { flex: 1; }

  /* Company hero stacks */
  .hero-company { padding: var(--space-5); }
  .hero-content { flex-direction: column; align-items: flex-start; gap: var(--space-3); }
  .hero-info h1 { font-size: 22px; }
  .hero-meta { flex-wrap: wrap; gap: 10px !important; }

  /* Settings tabs already scroll */
  .settings-layout { grid-template-columns: 1fr !important; }

  /* Modals */
  .modal { max-width: calc(100vw - 32px); }
}

/* ============ SMALL PHONE (<=560px) ============ */
@media (max-width: 560px) {
  .content { padding: var(--space-4); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: var(--space-2); }
  .stat-value { font-size: 22px; }
  .stat-card { padding: var(--space-4); }
  .page-header h1 { font-size: 20px; }

  .brand-text { font-size: 15px; }
  .header-actions { gap: 4px; }
  .header-icon { width: 34px; height: 34px; }

  /* Reduce card padding */
  .card, .section { padding: var(--space-4); }

  /* Hero */
  .hero-company { padding: var(--space-4); border-radius: var(--radius-lg); }
  .hero-logo { width: 56px; height: 56px; font-size: 20px; }

  /* Button full width on own line */
  .page-header .row .btn { width: 100%; }

  /* Login */
  .login-card { padding: var(--space-6); }
  .login-card h1 { font-size: 22px; }
}

/* ============ PRINT ============ */
@media print {
  @page { size: A4; margin: 14mm; }

  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }

  body { background: #fff !important; font-size: 11pt; }
  .bg-gradient { display: none !important; }

  /* Hide chrome */
  .sidebar,
  .header,
  .header-actions,
  .header-search,
  .page-header .row:last-child,
  .table-toolbar,
  .icon-btn,
  .btn,
  .fact-check-cta,
  .verification-loader,
  .sidebar-footer { display: none !important; }

  /* Full-width content */
  .app { display: block !important; }
  .main { display: block !important; }
  .content { padding: 0 !important; max-width: 100% !important; }

  /* Tighten spacing for print */
  .page-header { margin-bottom: 16px !important; page-break-after: avoid; }
  .page-header h1 { font-size: 20pt; }
  .page-header p { font-size: 10pt; color: #475569; }

  /* Cards print as clean blocks */
  .card, .section, .stat-card, .aside-section, .table-card, .hero-company, .ai-narrative, .flag-card, .trust-gauge-card {
    box-shadow: none !important;
    border: 1px solid #cbd5e1 !important;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .stats-grid { grid-template-columns: repeat(4, 1fr); gap: 8px !important; }
  .grid-2, .grid-3 { gap: 12px !important; }
  .detail-grid { grid-template-columns: 1fr !important; }

  /* Table readable in print */
  table { break-inside: auto; }
  tr { break-inside: avoid; page-break-inside: avoid; }
  thead { display: table-header-group; }

  a { color: #0f172a !important; text-decoration: none !important; }
  .source-link { color: #4c1d95 !important; }

  /* Hide interactive chevrons in table */
  tbody td:last-child { display: none; }

  /* Background gradients off */
  .hero-company, .ai-narrative { background: #faf5ff !important; }

  /* Show a small print footer */
  .print-only { display: block !important; }

  /* Keep charts from printing huge */
  .chart-wrap, .chart-wrap-sm { height: 220px !important; }
}

.print-only { display: none; }

/* ---------- Language picker ---------- */
/* Shrink-wrap to the trigger; otherwise .lang-menu { right:0 } aligns to the full-width
   container and the menu detaches from the button (e.g. login card). */
.lang-picker {
  position: relative;
  width: fit-content;
  max-width: 100%;
  margin-left: auto;
  box-sizing: border-box;
}
/* Center the picker in the login card (header keeps flex + margin-left:auto on the child) */
.login-card .lang-picker {
  margin-left: auto;
  margin-right: auto;
}
.lang-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-body);
  font-family: inherit;
  transition: all 150ms ease-out;
  white-space: nowrap;
}
.lang-trigger:hover { border-color: var(--primary-light); color: var(--primary); }
.lang-trigger svg { width: 16px; height: 16px; flex-shrink: 0; }
.lang-trigger .caret { width: 14px; height: 14px; color: var(--text-light); }
.lang-label { min-width: 0; }
.lang-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  bottom: auto;
  right: 0;
  left: auto;
  min-width: 160px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg, 0 20px 60px rgba(0,0,0,0.12));
  z-index: 200;
  padding: 6px;
  animation: fadeIn 120ms ease-out;
}
/* Sidebar footer / bottom of viewport — open upward so the menu is not clipped */
.lang-picker--drop-up .lang-menu {
  top: auto;
  bottom: calc(100% + 6px);
  left: 0;
  right: auto;
}
.lang-picker.open .lang-menu { display: block; }
.lang-option {
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-body);
  border-radius: 8px;
  cursor: pointer;
  transition: background 80ms;
}
.lang-option:hover { background: var(--bg-soft); color: var(--primary); }
.lang-option.active { background: var(--primary-50); color: var(--primary-dark); font-weight: 600; }

/* ---------- CJK text ---------- */
[lang="zh-TW"], [lang="zh-CN"] {
  word-break: break-all;
  overflow-wrap: break-word;
}
