/* ──────────────────────────────────────────────
   Fish ERP BI · Premium Dark Theme
   ────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  /* ── Surface ── */
  --bg-primary: #0a0e27;
  --bg-secondary: #111638;
  --bg-tertiary: #181e4a;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-hover: rgba(255, 255, 255, 0.07);
  --glass: rgba(255, 255, 255, 0.06);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-strong: rgba(255, 255, 255, 0.1);

  /* ── Text ── */
  --text-primary: #e8ecf4;
  --text-secondary: #8b95b0;
  --text-muted: #5c6682;

  /* ── Accent ── */
  --accent: #00d4aa;
  --accent-glow: rgba(0, 212, 170, 0.25);
  --accent-bg: rgba(0, 212, 170, 0.08);
  --accent-2: #7c5dfa;
  --accent-2-glow: rgba(124, 93, 250, 0.25);
  --accent-3: #3b82f6;

  /* ── Status ── */
  --danger: #ff6b6b;
  --danger-bg: rgba(255, 107, 107, 0.1);
  --warn: #fbbf24;
  --warn-bg: rgba(251, 191, 36, 0.1);
  --success: #00d4aa;
  --success-bg: rgba(0, 212, 170, 0.1);

  /* ── Effects ── */
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.4);
  --blur: blur(20px);

  /* ── Radius ── */
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 999px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  background-image:
    radial-gradient(ellipse 80% 50% at 10% 0%, rgba(124, 93, 250, 0.15), transparent),
    radial-gradient(ellipse 60% 40% at 90% 10%, rgba(0, 212, 170, 0.1), transparent),
    radial-gradient(ellipse 100% 80% at 50% 100%, rgba(59, 130, 246, 0.06), transparent);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Shell ── */

.shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 16px 48px;
}

/* ── Hero ── */

.hero {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 20px;
  padding: 28px;
  background: var(--glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  animation: fadeInUp 0.6s ease-out;
}

.hero::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent-3));
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.eyebrow {
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

h1 {
  margin: 0 0 8px;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.hero p,
.hero-meta {
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hero-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.hero-stat {
  padding: 14px 16px;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  background: var(--surface);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.hero-stat:hover {
  background: var(--surface-hover);
  border-color: rgba(255, 255, 255, 0.12);
}

.hero-stat-label {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.hero-stat-value {
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  color: var(--text-primary);
}

.hero-panel {
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 18px;
  background: var(--surface);
}

.hero-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 14px;
}

.hero-panel-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hero-panel-head strong {
  color: var(--text-primary);
  font-size: 14px;
}

/* ── Toolbar ── */

.toolbar,
.tabs,
.content-grid,
.headline-grid {
  display: grid;
  gap: 12px;
}

.toolbar {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 20px 0;
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 12px 0;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: fadeInUp 0.6s ease-out 0.15s both;
}

.toolbar label,
.card,
.empty,
.error {
  border: 1px solid var(--glass-border);
  background: var(--glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
}

.toolbar label {
  padding: 14px;
  transition: border-color 0.2s ease;
}

.toolbar label:hover {
  border-color: rgba(255, 255, 255, 0.14);
}

.toolbar span {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

select,
button {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  padding: 11px 14px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  transition: all 0.2s ease;
  appearance: none;
  -webkit-appearance: none;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%238b95b0' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

select option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

select:hover,
select:focus {
  border-color: var(--accent);
  background-color: rgba(0, 212, 170, 0.05);
  box-shadow: 0 0 0 3px var(--accent-glow);
  outline: none;
}

button {
  align-self: end;
  background: linear-gradient(135deg, var(--accent), #00b894);
  color: var(--bg-primary);
  border: none;
  cursor: pointer;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 16px var(--accent-glow);
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px var(--accent-glow);
}

button:active,
.tab:active {
  transform: translateY(1px);
}

/* ── Tabs ── */

.tabs {
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  margin-bottom: 20px;
  position: sticky;
  top: 102px;
  z-index: 9;
  padding-bottom: 8px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  animation: fadeInUp 0.6s ease-out 0.25s both;
}

.tab {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 16px;
  cursor: pointer;
  transition: all 0.25s ease;
}

.tab:hover {
  color: var(--text-primary);
  background: var(--surface-hover);
  border-color: rgba(255, 255, 255, 0.14);
}

.tab.active {
  background: linear-gradient(135deg, var(--accent), #00b894);
  color: var(--bg-primary);
  border-color: transparent;
  font-weight: 700;
  box-shadow: 0 4px 20px var(--accent-glow);
}

/* ── Content Grid ── */

.content-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.headline-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
  animation: fadeInUp 0.5s ease-out 0.3s both;
}

/* ── Cards ── */

.card {
  padding: 20px;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  animation: fadeInUp 0.5s ease-out both;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(255, 255, 255, 0.12);
}

.card h3 {
  margin: 0 0 14px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

/* ── KPI Cards ── */

.kpi-card {
  position: relative;
  overflow: hidden;
  background: var(--glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border);
  transition: all 0.3s ease;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  opacity: 0;
  transition: opacity 0.3s ease;
}

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

.kpi-card::after {
  content: '';
  position: absolute;
  inset: auto -30px -30px auto;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-glow), transparent 70%);
  opacity: 0.4;
}

.kpi-label {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.kpi-value {
  font-size: 30px;
  font-weight: 800;
  margin: 8px 0 6px;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.kpi-delta {
  font-size: 12px;
  font-weight: 500;
  color: var(--success);
}

.kpi-delta.warn {
  color: var(--warn);
}

.kpi-delta.danger {
  color: var(--danger);
}

/* ── Metrics ── */

.metric {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 0.15s ease;
}

.metric:hover {
  background: rgba(255, 255, 255, 0.02);
  padding-left: 6px;
  padding-right: 6px;
  margin-left: -6px;
  margin-right: -6px;
  border-radius: 8px;
}

.metric:last-child {
  border-bottom: 0;
}

.metric-label {
  color: var(--text-secondary);
  font-size: 14px;
}

.metric-value {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 14px;
}

/* ── Lists ── */

.list {
  margin: 0;
  padding-left: 0;
  list-style: none;
}

.list li {
  margin: 0;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 14px;
  color: var(--text-secondary);
  transition: background 0.15s ease, color 0.15s ease;
  border-left: 3px solid transparent;
}

.list li:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-primary);
  border-left-color: var(--accent);
}

.list li + li {
  margin-top: 2px;
}

/* ── Section Title ── */

.section-title {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ── Charts ── */

.chart {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent);
}

.mini-chart {
  margin-top: 12px;
}

/* ── Legend ── */

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 12px 0 0;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-swatch {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-pill);
  box-shadow: 0 0 6px currentColor;
}

/* ── Badges ── */

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--glass-border);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.badge:hover {
  background: var(--surface-hover);
  border-color: rgba(255, 255, 255, 0.14);
}

.risk-high,
.risk-medium,
.risk-low {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.risk-high {
  background: var(--danger);
  box-shadow: 0 0 8px var(--danger);
}

.risk-medium {
  background: var(--warn);
  box-shadow: 0 0 8px var(--warn);
}

.risk-low {
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}

/* ── Empty / Error ── */

.empty,
.error {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

.chart-empty {
  min-height: 240px;
  display: grid;
  place-items: center;
}

.error {
  color: var(--danger);
  background: var(--danger-bg);
  border-color: rgba(255, 107, 107, 0.15);
}

/* ── Skeleton Loading ── */

.skeleton-card {
  overflow: hidden;
}

.skeleton {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04),
    rgba(255, 255, 255, 0.08),
    rgba(255, 255, 255, 0.04)
  );
  background-size: 200% 100%;
  animation: shimmer 1.8s ease-in-out infinite;
}

.skeleton-line {
  height: 14px;
  margin-bottom: 12px;
}

.skeleton-line.short {
  width: 34%;
}

.skeleton-line.medium {
  width: 58%;
}

.skeleton-line.large {
  width: 72%;
  height: 28px;
}

.skeleton-block {
  height: 140px;
  margin-bottom: 12px;
}

/* ── Animations ── */

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow); }
  50% { box-shadow: 0 0 20px 4px var(--accent-glow); }
}

/* ── Scrollbar ── */

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ── Responsive ── */

@media (max-width: 720px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .toolbar {
    grid-template-columns: 1fr;
    position: static;
    margin: 16px 0 12px;
    padding: 0;
    gap: 10px;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .toolbar label {
    padding: 12px;
  }

  .headline-grid {
    grid-template-columns: 1fr 1fr;
  }

  .tabs {
    position: static;
    margin-bottom: 14px;
    padding-bottom: 0;
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    gap: 8px;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  h1 {
    font-size: 28px;
  }

  .hero-stat-value {
    font-size: 22px;
  }

  .kpi-value {
    font-size: 24px;
  }

  .shell {
    padding: 12px 12px 32px;
  }
}

@media (max-width: 480px) {
  .headline-grid {
    grid-template-columns: 1fr;
  }

  .hero-summary {
    grid-template-columns: 1fr;
  }

  .tab {
    font-size: 12px;
    padding: 8px 12px;
  }
}
