/* ============================================================
   KruGreen — Design System
   Corporate GHG Reporting Platform
   © 2026 KruHoldings. All rights reserved.
   ============================================================ */

/* ============= RESET & TOKENS ============= */
:root {
  /* Colors */
  --bg-deep: #060d13;
  --bg-base: #0B1622;
  --bg-surface: #111d2e;
  --bg-elevated: #162336;
  --bg-hover: #1a2d44;
  --bg-glass: rgba(17, 29, 46, 0.75);

  --green-50: #ecfdf5;
  --green-100: #d1fae5;
  --green-400: #34d399;
  --green-500: #10b981;
  --green-600: #059669;
  --accent: #00D4AA;
  --accent-glow: rgba(0, 212, 170, 0.15);
  --accent-dim: rgba(0, 212, 170, 0.08);

  --blue-400: #60a5fa;
  --blue-500: #3b82f6;
  --sky-400: #38bdf8;
  --purple-400: #a78bfa;
  --amber-400: #fbbf24;
  --amber-500: #f59e0b;
  --red-400: #f87171;
  --red-500: #ef4444;
  --orange-400: #fb923c;

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;
  --text-muted: #475569;

  --border: rgba(148, 163, 184, 0.08);
  --border-hover: rgba(148, 163, 184, 0.15);
  --border-accent: rgba(0, 212, 170, 0.3);

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Spacing & Sizing */
  --sidebar-width: 260px;
  --sidebar-collapsed: 72px;
  --topbar-height: 64px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 30px rgba(0, 212, 170, 0.1);

  /* Transitions */
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-deep);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

::selection {
  background: rgba(0, 212, 170, 0.3);
  color: #fff;
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--text-muted);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-tertiary);
}

/* ============= SPLASH SCREEN ============= */
.splash-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-deep);
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.splash-screen.fade-out {
  opacity: 0;
  visibility: hidden;
}

.splash-content {
  text-align: center;
}

.splash-logo-ring {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 0 auto 24px;
}

.splash-ring {
  position: absolute;
  inset: 0;
  animation: splash-spin 2s linear infinite;
}

@keyframes splash-spin {
  to {
    transform: rotate(360deg);
  }
}

.ring-animate {
  animation: ring-draw 1.5s ease-in-out forwards;
}

@keyframes ring-draw {
  to {
    stroke-dashoffset: 0;
  }
}

.splash-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  animation: splash-pulse 1.5s ease-in-out infinite;
}

@keyframes splash-pulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.1);
  }
}

.splash-title {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.splash-green {
  background: linear-gradient(135deg, var(--accent), var(--sky-400));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.splash-sub {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 32px;
}

.splash-bar {
  width: 200px;
  height: 3px;
  background: var(--bg-surface);
  border-radius: 3px;
  margin: 0 auto 24px;
  overflow: hidden;
}

.splash-bar-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--sky-400));
  border-radius: 3px;
  animation: fill-bar 2s ease-in-out forwards;
}

@keyframes fill-bar {
  to {
    width: 100%;
  }
}

.splash-footer {
  color: var(--text-tertiary);
  font-size: 0.75rem;
}

/* ============= APP LAYOUT ============= */
.app {
  display: flex;
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

/* ============= SIDEBAR ============= */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-base);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform var(--transition);
  overflow: hidden;
  /* outer sidebar never scrolls — only inner nav does */
}

.sidebar-header {
  padding: 20px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  font-size: 28px;
  filter: drop-shadow(0 0 8px rgba(0, 212, 170, 0.3));
}

.logo-text {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: block;
  line-height: 1.2;
}

.green {
  background: linear-gradient(135deg, var(--accent), var(--sky-400));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-sub {
  font-size: 0.65rem;
  color: var(--text-tertiary);
  display: block;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.sidebar-toggle {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}

.sidebar-toggle:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.sidebar-nav {
  padding: 12px 8px;
  flex: 1;
  overflow-y: auto;
  /* nav content scrolls on short viewports */
  overflow-x: hidden;
  /* custom thin scrollbar */
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.15) transparent;
}

.sidebar-nav::-webkit-scrollbar {
  width: 4px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.15);
  border-radius: 2px;
}

.nav-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 16px 12px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition);
  position: relative;
  margin-bottom: 2px;
}

.nav-item:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.nav-item.active {
  color: var(--accent);
  background: var(--accent-dim);
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.nav-badge {
  margin-left: auto;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--accent), var(--sky-400));
  color: var(--bg-deep);
  letter-spacing: 0.05em;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  /* footer stays pinned at the bottom, never scrolled away */
}

.sidebar-standards {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 10px;
}

.std-badge {
  font-size: 0.55rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg-elevated);
  color: var(--text-tertiary);
  border: 1px solid var(--border);
  letter-spacing: 0.05em;
}

.std-badge-link {
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition);
  display: inline-block;
}

.std-badge-link:hover {
  color: var(--accent);
  border-color: var(--border-accent);
  background: var(--accent-dim);
  transform: translateY(-1px);
  box-shadow: 0 0 12px rgba(0, 212, 170, 0.15);
}

.std-badge-link:active {
  transform: translateY(0);
  box-shadow: none;
}

.sidebar-copy {
  font-size: 0.65rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ============= MAIN CONTENT ============= */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition);
}

.topbar {
  height: var(--topbar-height);
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
  overflow: visible;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px;
}

.topbar-breadcrumb {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 20px;
  position: relative;
  z-index: 55;
  pointer-events: auto;
}

.topbar-reporting-year {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-reporting-year label {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  white-space: nowrap;
}

.select-year {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 0.8rem;
  font-family: var(--font-sans);
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition);
}

.select-year:focus {
  border-color: var(--accent);
}

.topbar-company {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
}

.topbar-company:hover {
  border-color: var(--border-hover);
  background: var(--bg-hover);
}

.company-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--sky-400));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--bg-deep);
}

.company-name {
  font-size: 0.85rem;
  font-weight: 600;
}

/* ============= PAGE CONTAINER ============= */
.page-container {
  flex: 1;
  padding: 24px;
  animation: page-in 0.3s ease;
}

@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============= CARDS ============= */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all var(--transition);
}

.card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title .icon {
  font-size: 1.1rem;
}

.card-subtitle {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

/* ============= STAT CARDS ============= */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--stat-color, var(--accent)), transparent);
  opacity: 0.8;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-hover);
}

.stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1.2;
  background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-unit {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-tertiary);
  margin-left: 4px;
  font-family: var(--font-sans);
  -webkit-text-fill-color: var(--text-tertiary);
}

.stat-change {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
}

.stat-change.down {
  background: rgba(16, 185, 129, 0.1);
  color: var(--green-400);
}

.stat-change.up {
  background: rgba(239, 68, 68, 0.1);
  color: var(--red-400);
}

/* ============= SCOPE BREAKDOWN BAR ============= */
.scope-bar-container {
  margin-bottom: 24px;
}

.scope-bar {
  display: flex;
  height: 40px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

.scope-segment {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: white;
  transition: all var(--transition);
  cursor: pointer;
  position: relative;
}

.scope-segment:hover {
  filter: brightness(1.2);
}

.scope-segment.scope1 {
  background: linear-gradient(135deg, #ef4444, #f97316);
}

.scope-segment.scope2 {
  background: linear-gradient(135deg, #f59e0b, #eab308);
}

.scope-segment.scope3 {
  background: linear-gradient(135deg, #3b82f6, #6366f1);
}

.scope-legend {
  display: flex;
  gap: 20px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.scope-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
}

.scope-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.scope-dot.s1 {
  background: #ef4444;
}

.scope-dot.s2 {
  background: #f59e0b;
}

.scope-dot.s3 {
  background: #3b82f6;
}

.scope-val {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-primary);
}

/* ============= CHARTS AREA (Canvas placeholder) ============= */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.chart-canvas-wrap {
  width: 100%;
  height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* SVG donut chart */
.donut-chart {
  width: 200px;
  height: 200px;
}

/* Simple bar chart built with divs */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 200px;
  width: 100%;
  padding: 0 8px;
}

.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.bar {
  width: 100%;
  max-width: 40px;
  border-radius: 4px 4px 0 0;
  transition: all 0.6s ease;
  position: relative;
  cursor: pointer;
  min-height: 4px;
}

.bar:hover {
  filter: brightness(1.3);
}

.bar-label {
  font-size: 0.6rem;
  color: var(--text-tertiary);
  text-align: center;
  white-space: nowrap;
}

.bar-value {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-secondary);
}

/* ============= CALCULATOR ============= */
.calc-section {
  margin-bottom: 24px;
}

.calc-section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  cursor: pointer;
  transition: all var(--transition);
}

.calc-section-header:hover {
  background: var(--bg-elevated);
}

.calc-section-header.active {
  border-bottom: none;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.calc-scope-badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 700;
  color: white;
}

.calc-scope-badge.s1 {
  background: linear-gradient(135deg, #ef4444, #f97316);
}

.calc-scope-badge.s2 {
  background: linear-gradient(135deg, #f59e0b, #eab308);
}

.calc-scope-badge.s3 {
  background: linear-gradient(135deg, #3b82f6, #6366f1);
}

.calc-section-title {
  font-size: 0.95rem;
  font-weight: 700;
  flex: 1;
}

.calc-section-total {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
}

.calc-section-arrow {
  color: var(--text-tertiary);
  transition: transform var(--transition);
}

.calc-section-header.active .calc-section-arrow {
  transform: rotate(180deg);
}

.calc-section-body {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  padding: 20px;
  display: none;
}

.calc-section-body.show {
  display: block;
  animation: slide-down 0.3s ease;
}

@keyframes slide-down {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Form elements */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-label .ef-hint {
  font-weight: 400;
  color: var(--text-tertiary);
  font-size: 0.7rem;
}

.form-input,
.form-select {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  outline: none;
  transition: all var(--transition);
  width: 100%;
}

.form-input:focus,
.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.form-row .form-group {
  flex: 1;
}

.emission-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  border: 1px solid var(--border);
  transition: all var(--transition);
}

.emission-row:hover {
  border-color: var(--border-hover);
}

.emission-row .source-name {
  flex: 1;
  font-size: 0.85rem;
  font-weight: 500;
}

.emission-row .source-detail {
  font-size: 0.7rem;
  color: var(--text-tertiary);
}

.emission-row .source-result {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--green-600));
  color: var(--bg-deep);
  box-shadow: 0 2px 8px rgba(0, 212, 170, 0.2);
}

.btn-primary:hover {
  box-shadow: 0 4px 16px rgba(0, 212, 170, 0.35);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.78rem;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-sm);
}

/* ============= EMISSION FACTORS TABLE ============= */
.ef-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

.ef-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.ef-table thead th {
  background: var(--bg-elevated);
  padding: 12px 16px;
  text-align: left;
  font-weight: 700;
  color: var(--text-secondary);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 2;
}

.ef-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

.ef-table tbody tr:hover {
  background: var(--bg-elevated);
}

.ef-table td {
  padding: 10px 16px;
  color: var(--text-primary);
}

.ef-table td:nth-child(4) {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent);
}

.ef-category-header {
  background: var(--accent-dim) !important;
  font-weight: 700 !important;
}

.ef-category-header td {
  color: var(--accent) !important;
  font-size: 0.85rem;
  padding: 8px 16px;
}

/* Search box */
.search-box {
  position: relative;
  margin-bottom: 16px;
}

.search-box input {
  width: 100%;
  padding: 12px 16px 12px 44px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  outline: none;
  transition: all var(--transition);
}

.search-box input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-box .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
}

/* ============= AI ASSISTANT ============= */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--topbar-height) - 48px);
  max-height: 700px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-msg {
  display: flex;
  gap: 12px;
  max-width: 85%;
  animation: msg-in 0.3s ease;
}

@keyframes msg-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-msg.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.chat-msg.ai .chat-avatar {
  background: linear-gradient(135deg, var(--accent), var(--sky-400));
  color: var(--bg-deep);
  font-weight: 800;
}

.chat-msg.user .chat-avatar {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

.chat-bubble {
  padding: 14px 18px;
  border-radius: var(--radius-lg);
  font-size: 0.875rem;
  line-height: 1.7;
}

.chat-msg.ai .chat-bubble {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-primary);
}

.chat-msg.user .chat-bubble {
  background: linear-gradient(135deg, var(--accent), var(--green-600));
  color: var(--bg-deep);
  font-weight: 500;
}

.chat-input-area {
  display: flex;
  gap: 12px;
  padding: 16px 0 0;
  border-top: 1px solid var(--border);
}

.chat-input {
  flex: 1;
  padding: 14px 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.875rem;
  outline: none;
  resize: none;
  transition: all var(--transition);
}

.chat-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.chat-send-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--green-600));
  border: none;
  color: var(--bg-deep);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  flex-shrink: 0;
}

.chat-send-btn:hover {
  box-shadow: 0 4px 16px rgba(0, 212, 170, 0.4);
  transform: scale(1.05);
}

/* ============= MARKETPLACE ============= */
.credit-tiers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.credit-tier-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
}

.credit-tier-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
}

.credit-tier-card.standard::before {
  background: linear-gradient(90deg, #22c55e, #10b981);
}

.credit-tier-card.premium::before {
  background: linear-gradient(90deg, #f59e0b, #eab308);
}

.credit-tier-card.corsia::before {
  background: linear-gradient(90deg, #3b82f6, #6366f1);
}

.credit-tier-card.article6::before {
  background: linear-gradient(90deg, #8b5cf6, #a855f7);
}

.credit-tier-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.tier-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.tier-name {
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.tier-price {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 12px;
}

.tier-buyer {
  font-size: 0.78rem;
  color: var(--text-tertiary);
  margin-bottom: 16px;
  line-height: 1.5;
}

.tier-features {
  list-style: none;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.tier-features li {
  padding: 4px 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tier-features li::before {
  content: '✓';
  color: var(--accent);
  font-weight: 700;
  font-size: 0.7rem;
}

/* ============= MITIGATION ============= */
.mitigation-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 12px;
  transition: all var(--transition);
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.mitigation-card:hover {
  border-color: var(--border-accent);
  background: var(--bg-elevated);
}

.mitigation-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.mitigation-content {
  flex: 1;
}

.mitigation-title {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.mitigation-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 8px;
}

.mitigation-meta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.mitigation-tag {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid var(--border-accent);
}

.mitigation-tag.high {
  background: rgba(239, 68, 68, 0.1);
  color: var(--red-400);
  border-color: rgba(239, 68, 68, 0.2);
}

.mitigation-tag.medium {
  background: rgba(245, 158, 11, 0.1);
  color: var(--amber-400);
  border-color: rgba(245, 158, 11, 0.2);
}

/* ============= REPORTING ============= */
.report-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.report-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}

.report-card:hover {
  border-color: var(--border-accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.report-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  display: block;
}

.report-name {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.report-desc {
  font-size: 0.78rem;
  color: var(--text-tertiary);
  line-height: 1.5;
}

.report-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 12px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
}

.report-status.ready {
  background: rgba(16, 185, 129, 0.1);
  color: var(--green-400);
}

.report-status.progress {
  background: rgba(245, 158, 11, 0.1);
  color: var(--amber-400);
}

.report-status.pending {
  background: rgba(100, 116, 139, 0.1);
  color: var(--text-tertiary);
}

/* ============= DATA UPLOAD PORTAL ============= */
.upload-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.upload-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all var(--transition);
}

.upload-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-md);
}

.upload-dropzone {
  border: 2px dashed var(--border-hover);
  border-radius: var(--radius-md);
  padding: 20px 12px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  background: var(--bg-elevated);
}

.upload-dropzone:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.upload-dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-dim);
  transform: scale(1.02);
  box-shadow: 0 0 20px rgba(0, 212, 170, 0.15);
}

.upload-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.upload-filter-btn {
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-tertiary);
  font-size: 0.7rem;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all var(--transition);
}

.upload-filter-btn:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.upload-filter-btn.active {
  background: var(--accent-dim);
  border-color: var(--border-accent);
  color: var(--accent);
}

.upload-template-btn {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.upload-template-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.mt-24 {
  margin-top: 24px;
}

@keyframes uploadProgress {
  0% {
    width: 0%;
  }

  50% {
    width: 60%;
  }

  100% {
    width: 100%;
  }
}

/* Upload Action Buttons */
.upload-action-btn {
  padding: 6px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-accent);
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.upload-action-btn:hover {
  background: linear-gradient(135deg, var(--accent), var(--green-600));
  color: var(--bg-deep);
  box-shadow: 0 2px 10px rgba(0, 212, 170, 0.25);
  transform: translateY(-1px);
}

.upload-run-btn {
  padding: 8px 20px;
  font-size: 0.8rem;
  background: linear-gradient(135deg, var(--accent), var(--green-600));
  color: var(--bg-deep);
  border: none;
  animation: uploadRunPulse 2s ease infinite;
}

.upload-run-btn:hover {
  animation: none;
  box-shadow: 0 4px 16px rgba(0, 212, 170, 0.4);
}

.upload-apply-btn {
  background: linear-gradient(135deg, var(--accent), var(--green-600));
  color: var(--bg-deep);
  border: none;
}

.upload-action-retry {
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.08);
  color: var(--red-400);
}

.upload-action-retry:hover {
  background: rgba(239, 68, 68, 0.15);
  color: var(--red-400);
  box-shadow: 0 2px 10px rgba(239, 68, 68, 0.15);
}

.upload-result {
  padding: 12px;
  text-align: left;
  animation: msg-in 0.4s ease;
}

@keyframes uploadRunPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(0, 212, 170, 0.3);
  }
  50% {
    box-shadow: 0 0 16px 4px rgba(0, 212, 170, 0.15);
  }
}

@keyframes pulse-glow {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.3);
  }

  50% {
    box-shadow: 0 0 20px 6px rgba(239, 68, 68, 0.15);
  }
}

/* ============= RESPONSIVE ============= */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .main-content {
    margin-left: 0;
  }

  .mobile-menu-btn {
    display: block;
  }

  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }

  .chart-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .page-container {
    padding: 16px;
  }

  .topbar {
    padding: 0 16px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .topbar-reporting-year,
  .company-name {
    display: none;
  }

  .credit-tiers {
    grid-template-columns: 1fr;
  }
}

/* ============= UTILITY ============= */
.text-accent {
  color: var(--accent);
}

.text-red {
  color: var(--red-400);
}

.text-amber {
  color: var(--amber-400);
}

.text-blue {
  color: var(--blue-400);
}

.text-muted {
  color: var(--text-tertiary);
}

.text-mono {
  font-family: var(--font-mono);
}

.fw-700 {
  font-weight: 700;
}

.mt-16 {
  margin-top: 16px;
}

.mt-24 {
  margin-top: 24px;
}

.mb-8 {
  margin-bottom: 8px;
}

.mb-16 {
  margin-bottom: 16px;
}

.mb-24 {
  margin-bottom: 24px;
}

.flex {
  display: flex;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.gap-8 {
  gap: 8px;
}

.gap-16 {
  gap: 16px;
}