:root {
  /* Colors */
  --primary: #0f172a; /* Deeper Professional Blue */
  --primary-accent: #2563eb;
  --sidebar-bg: #f1f5f9; /* Soft neutral as requested */
  --header-bg: #ffffff;
  --accent: #3b82f6;
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --success: #10b981;
  --warning: #f59e0b;
  
  /* Spacing & Radii */
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
  --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

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

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background-color: var(--bg);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Layout & Navigation */
.dashboard-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.global-top-bar {
  height: 64px;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  padding: 0 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 32px;
  height: 32px;
  background: var(--primary);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.brand-name {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.02em;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link {
  padding: 8px 16px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
}

.nav-link:hover {
  color: var(--primary);
  background: rgba(0,0,0,0.03);
}

.nav-link.active {
  color: var(--primary-accent);
  background: #eff6ff;
  font-weight: 600;
}

.user-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-info {
  text-align: right;
}

.user-name {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary);
}

.user-role {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Secondary Header (Company Info) */
.secondary-header {
  background: #fdfdfd;
  border-bottom: 1px solid var(--border);
  padding: 12px 40px;
}

.company-badges {
  display: flex;
  align-items: center;
  gap: 24px;
  max-width: 1400px;
  margin: 0 auto;
}

.company-main-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  padding-right: 24px;
  border-right: 1px solid var(--border);
}

.info-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
}

.info-badge label {
  color: var(--text-muted);
  font-weight: 500;
}

.info-badge span {
  color: var(--primary);
  font-weight: 600;
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 4px;
}

.main-content {
  flex-grow: 1;
  padding: 0;
}

.header-info {
  display: flex;
  align-items: center;
  gap: 40px;
}

.info-group {
  display: flex;
  flex-direction: column;
}

.info-group .label {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  font-weight: 600;
}

.info-group .value {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary);
}

.content-body {
  padding: 32px 40px 60px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

.header-title h1 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--primary);
}

.header-title p {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  background: white;
  padding: 6px 16px 6px 6px;
  border-radius: 50px;
  border: 1px solid var(--border);
}

/* Components */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  padding: 24px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

/* Company Snapshot */
.snapshot-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.snapshot-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: white;
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.snapshot-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
}

.snapshot-info label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.snapshot-info span {
  font-weight: 600;
  color: var(--text-main);
}

/* KPI Cards */
.insights-hero {
  background: linear-gradient(135deg, var(--primary) 0%, #1e3a8a 100%);
  border-radius: var(--radius-lg);
  padding: 40px;
  color: white;
  margin-bottom: 40px;
  box-shadow: 0 20px 40px -10px rgba(15, 23, 42, 0.2);
}

.insights-hero h2 {
  font-size: 1.5rem;
  margin-bottom: 32px;
  opacity: 0.9;
  font-weight: 600;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}

.kpi-card-hero {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 24px;
  transition: all 0.3s ease;
}

.kpi-card-hero:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-5px);
}

.kpi-hero-label {
  font-size: 0.875rem;
  opacity: 0.7;
  margin-bottom: 8px;
  display: block;
}

.kpi-hero-value {
  font-size: 2.25rem;
  font-weight: 800;
  display: block;
}

.kpi-hero-sub {
  font-size: 0.875rem;
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.kpi-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.kpi-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
}

.kpi-value {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.kpi-label {
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
}

.kpi-trend {
  font-size: 0.75rem;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.trend-up { color: var(--success); }
.trend-down { color: #ef4444; }

/* Table Section */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  padding: 16px;
  background: #f1f5f9;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tr:hover td {
  background: #f8fafc;
}

.hs-code-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.value-cell {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
}

.progress-track {
  width: 100px;
  height: 6px;
  background: #e2e8f0;
  border-radius: 10px;
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
  margin-right: 8px;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
}

/* Lower Analytics Section */
.lower-analytics {
  display: grid;
  grid-template-columns: 1fr 1fr 340px;
  gap: 24px;
  margin-top: 24px;
}

.analytics-card {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.analytics-card .card-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 24px;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ranked-list {
  list-style: none;
}

.ranked-item {
  display: flex;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.ranked-item:last-child {
  border-bottom: none;
}

.rank-number {
  width: 32px;
  font-weight: 800;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.rank-info {
  flex-grow: 1;
}

.rank-name {
  font-weight: 600;
  font-size: 0.95rem;
  display: block;
}

.rank-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.rank-value {
  text-align: right;
}

.rank-amount {
  font-weight: 700;
  color: var(--primary);
  display: block;
}

.supporting-panel {
  background: var(--primary);
  color: white;
  border: none;
}

.supporting-panel .card-title {
  color: white;
}

.insight-alert {
  background: rgba(255,255,255,0.1);
  padding: 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}

.insight-alert .alert-title {
  font-weight: 700;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.insight-alert .alert-desc {
  font-size: 0.8rem;
  opacity: 0.8;
}

.chart-placeholder {
  width: 100%;
  height: 240px;
  background: #fdfdfd;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: flex-end;
  padding: 20px;
  gap: 15px;
  justify-content: center;
}

.bar {
  flex: 1;
  max-width: 40px;
  background: linear-gradient(to top, var(--primary), var(--accent));
  border-radius: 4px 4px 0 0;
}

.donut-placeholder {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  border: 25px solid var(--primary);
  border-right-color: var(--accent);
  border-bottom-color: #cbd5e1;
  margin: 0 auto;
  position: relative;
}

.donut-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

/* Helpers */
.btn {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  border: none;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: #172554; }

.btn-outline { background: white; border: 1px solid var(--border); color: var(--text-main); }
.btn-outline:hover { background: #f8fafc; }

.badge {
  padding: 4px 10px;
  border-radius: 50px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-blue { background: #dbeafe; color: #1e40af; }

.placeholder-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 0.8rem;
}

.placeholder-icon {
  width: 24px;
  height: 24px;
  stroke: currentColor;
}

/* Responsive fixes */
@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .analytics-grid { grid-template-columns: 1fr; }
}
