/* SafetyEngageNet Dashboard — "flight deck at dusk"
   Chrome (nav/header/page plane) carries the brand identity: deep ink-navy
   with one signal-amber accent, drawn from the safety-card life-vest yellow
   in the supplied material. Chart surfaces/series/status colors reuse the
   dataviz skill's validated reference palette verbatim (references/palette.md)
   so categorical/CVD guarantees hold without re-validating a new instance. */

:root {
  color-scheme: dark;

  /* Brand chrome (not chart-critical). */
  --chrome-plane: #0a0e17;
  --chrome-panel: #111726;
  --chrome-panel-raised: #161d30;
  --chrome-border: rgba(255, 255, 255, 0.08);
  --accent: #f2a900;
  --accent-ink: #1a1300;
  --accent-soft: rgba(242, 169, 0, 0.16);

  /* Chart chrome & ink — dataviz reference palette, dark mode. */
  --chart-surface: #1a1a19;
  --text-primary: #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted: #898781;
  --gridline: #2c2c2a;
  --baseline: #383835;

  /* Categorical series — fixed order, never cycled. */
  --series-1: #3987e5; /* blue */
  --series-2: #d95926; /* orange */
  --series-3: #199e70; /* aqua */
  --series-4: #c98500; /* yellow */
  --series-5: #d55181; /* magenta */
  --series-6: #008300; /* green */
  --series-7: #9085e9; /* violet */
  --series-8: #e66767; /* red */

  /* Status (fixed, never themed). */
  --status-good: #0ca30c;
  --status-warning: #fab219;
  --status-serious: #ec835a;
  --status-critical: #d03b3b;

  --radius: 10px;
  --nav-width: 232px;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--chrome-plane);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

a { color: inherit; }

h1, h2, h3 {
  font-weight: 600;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
}

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

/* ---------------------------------------------------------------- nav */

.side-nav {
  width: var(--nav-width);
  flex: none;
  background: var(--chrome-panel);
  border-right: 1px solid var(--chrome-border);
  display: flex;
  flex-direction: column;
  padding: 20px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 20px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  flex: none;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-title { font-weight: 700; font-size: 15px; }
.brand-sub { font-size: 11.5px; color: var(--text-muted); }

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: background-color 120ms ease, color 120ms ease;
}

.nav-link svg { flex: none; width: 18px; height: 18px; }

.nav-link:hover {
  background: var(--chrome-panel-raised);
  color: var(--text-primary);
}

.nav-link.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.nav-section-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 16px 12px 6px;
}

/* ------------------------------------------------------------- header */

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  border-bottom: 1px solid var(--chrome-border);
  background: var(--chrome-plane);
  position: sticky;
  top: 0;
  z-index: 5;
}

.top-bar h1 { font-size: 18px; }
.top-bar .page-kicker { color: var(--text-muted); font-size: 12.5px; }

.live-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-muted);
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--status-good);
  box-shadow: 0 0 0 0 rgba(12, 163, 12, 0.5);
  animation: pulse 2.4s infinite;
}

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(12, 163, 12, 0.45); }
  70%  { box-shadow: 0 0 0 6px rgba(12, 163, 12, 0); }
  100% { box-shadow: 0 0 0 0 rgba(12, 163, 12, 0); }
}

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

.bell-button {
  position: relative;
  background: var(--chrome-panel);
  border: 1px solid var(--chrome-border);
  color: var(--text-secondary);
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.bell-button:hover { color: var(--text-primary); border-color: var(--accent); }

.bell-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}

.notif-panel {
  position: absolute;
  top: 56px;
  right: 28px;
  width: 360px;
  max-height: 70vh;
  overflow-y: auto;
  background: var(--chrome-panel);
  border: 1px solid var(--chrome-border);
  border-radius: var(--radius);
  box-shadow: 0 16px 40px rgba(0,0,0,0.45);
  z-index: 20;
}

.notif-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--chrome-border);
  font-size: 13px;
  font-weight: 600;
}

.notif-item {
  padding: 10px 16px;
  border-bottom: 1px solid var(--chrome-border);
  font-size: 12.5px;
}

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

.notif-top { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }

.op-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 1px 6px;
  border-radius: 5px;
}

.op-create { background: rgba(12,163,12,0.18); color: var(--status-good); }
.op-update { background: rgba(57,135,229,0.18); color: var(--series-1); }
.op-delete { background: rgba(208,59,59,0.18); color: var(--status-critical); }

.notif-type { font-weight: 600; color: var(--text-primary); }
.notif-time { margin-left: auto; color: var(--text-muted); font-size: 11px; }
.notif-props { color: var(--text-secondary); margin-top: 3px; }
.notif-empty { padding: 24px 16px; text-align: center; color: var(--text-muted); font-size: 12.5px; }

.toast-stack {
  position: fixed;
  bottom: 22px;
  right: 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 40;
}

.toast {
  background: var(--chrome-panel-raised);
  border: 1px solid var(--chrome-border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 12.5px;
  min-width: 240px;
  max-width: 320px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.4);
  animation: toast-in 180ms ease-out;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* -------------------------------------------------------------- main */

.main-content {
  flex: 1;
  min-width: 0;
  padding: 24px 28px 48px;
}

.page-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 18px;
  margin-top: 18px;
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.card {
  background: var(--chrome-panel);
  border: 1px solid var(--chrome-border);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.card-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.card-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.stat-tile .stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.stat-tile .stat-value {
  font-size: 30px;
  font-weight: 700;
  font-variant-numeric: proportional-nums;
  color: var(--text-primary);
}

.chart-empty, .chart-loading {
  color: var(--text-muted);
  font-size: 12.5px;
  padding: 28px 4px;
  text-align: center;
}

.overview-hero {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 4px;
}

.overview-hero .hero-figure {
  font-size: 48px;
  font-weight: 700;
}

.legend-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-top: 10px;
  font-size: 11.5px;
  color: var(--text-secondary);
}

.legend-swatch {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  margin-right: 5px;
}

@media (max-width: 860px) {
  .side-nav { display: none; }
  .main-content { padding: 18px; }
}
