/* GothenburgCandy dashboard — design tokens
   A dark, cool-neutral Scandinavian base with one accent: a "lösgodis"
   raspberry pink, reserved for what is live or active, never decoration.
   Fonts are system stacks on purpose — the container only reaches the
   Dataceen API/subscription endpoints, no font CDN. */
:root {
  --bg: #14151a;
  --surface: #1c1e26;
  --surface-raised: #21232d;
  --border: #2c2f3a;
  --border-soft: #24262f;
  --text: #f1efea;
  --text-muted: #9497a6;
  --text-faint: #6a6d7c;
  --accent: #e8456f;
  --accent-soft: rgba(232, 69, 111, 0.16);
  --accent-strong: #ff6a8f;

  --series-1: #e8456f;
  --series-2: #d9a24b;
  --series-3: #3fa8a0;
  --series-4: #8b7fd1;
  --series-5: #5e88c4;

  --update: #d9a24b;
  --delete: #6a6d7c;

  --radius: 6px;
  --radius-sm: 4px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;

  --font-display: Georgia, "Iowan Old Style", "Palatino Linotype", "Times New Roman", serif;
  --font-ui: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; margin: 0; }

a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; }

button {
  font-family: var(--font-ui);
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--accent-strong);
  outline-offset: 2px;
}

/* ---------- shell layout ---------- */

.shell {
  display: grid;
  grid-template-columns: 232px 1fr;
  min-height: 100vh;
}

.shell-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--border-soft);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 5;
}

.content {
  padding: var(--space-6);
  flex: 1;
}

.page-header {
  margin-bottom: var(--space-5);
}

.page-header h1 {
  font-size: 30px;
  letter-spacing: -0.01em;
}

.page-header p {
  margin: var(--space-2) 0 0;
  color: var(--text-muted);
  max-width: 60ch;
}

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

.nav {
  border-right: 1px solid var(--border-soft);
  background: var(--surface);
  padding: var(--space-5) 0;
  display: flex;
  flex-direction: column;
}

.nav-brand {
  font-family: var(--font-display);
  font-size: 19px;
  padding: 0 var(--space-5) var(--space-5);
  color: var(--text);
  line-height: 1.25;
}

.nav-brand small {
  display: block;
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 2px;
}

.nav-links {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px var(--space-5);
  color: var(--text-muted);
  border-left: 3px solid transparent;
  font-size: 14px;
}

.nav-link:hover {
  color: var(--text);
  text-decoration: none;
  background: var(--surface-raised);
}

.nav-link.active {
  color: var(--text);
  border-left-color: var(--accent);
  background: var(--surface-raised);
}

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

/* ---------- live indicator + bell ---------- */

.live {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-muted);
  font-size: 13px;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--series-3);
  flex: none;
}

.live-dot.pulsing {
  animation: pulse 1.1s ease-out 1;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(63, 168, 160, 0.55); }
  100% { box-shadow: 0 0 0 8px rgba(63, 168, 160, 0); }
}

.bell {
  position: relative;
  background: none;
  border: none;
  color: var(--text-muted);
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  display: flex;
}

.bell:hover { color: var(--text); background: var(--surface-raised); }
.bell svg { width: 19px; height: 19px; }

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

.bell-panel {
  position: absolute;
  top: calc(100% + var(--space-3));
  right: 0;
  width: 340px;
  max-height: 420px;
  overflow-y: auto;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-2);
  z-index: 20;
}

.bell-wrap { position: relative; }

/* ---------- notification rows (shared by bell panel + feed card) ---------- */

.notif {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3);
  border-bottom: 1px solid var(--border-soft);
}

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

.notif-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  flex: none;
}

.notif-dot.op-create { background: var(--accent); }
.notif-dot.op-update { background: var(--update); }
.notif-dot.op-delete { background: var(--delete); }

.notif-body { min-width: 0; }
.notif-title { font-size: 13.5px; }
.notif-title b { font-weight: 600; }
.notif-time { font-size: 12px; color: var(--text-faint); margin-top: 1px; }
.notif-props {
  margin: var(--space-2) 0 0;
  padding: 0;
  list-style: none;
  font-size: 12.5px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.notif-props li { overflow-wrap: anywhere; }

.notif-empty {
  padding: var(--space-4);
  color: var(--text-faint);
  font-size: 13px;
  text-align: center;
}

/* ---------- toasts ---------- */

.toast-host {
  position: fixed;
  bottom: var(--space-5);
  right: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  z-index: 50;
  width: 320px;
}

.toast {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
  box-shadow: none;
  animation: toast-in 0.18s ease-out;
}

.toast.op-update { border-left-color: var(--update); }
.toast.op-delete { border-left-color: var(--delete); }

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

/* ---------- grid / cards ---------- */

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.stat-tile {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: var(--space-4) var(--space-5);
}

.stat-tile .value {
  font-family: var(--font-display);
  font-size: 36px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.stat-tile .label {
  margin-top: var(--space-2);
  color: var(--text-muted);
  font-size: 13.5px;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: var(--space-4);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: var(--space-5);
  min-width: 0;
}

.panel h2 {
  font-size: 16px;
  font-weight: 600;
  font-family: var(--font-ui);
}

.panel .panel-sub {
  color: var(--text-faint);
  font-size: 12.5px;
  margin-top: 2px;
}

.panel-body { margin-top: var(--space-4); }

/* ---------- bar chart ---------- */

.bars { display: flex; flex-direction: column; gap: var(--space-3); }

.bar-row { display: grid; grid-template-columns: 120px 1fr 52px; align-items: center; gap: var(--space-3); }

.bar-label {
  font-size: 13px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  height: 10px;
  background: var(--border-soft);
  border-radius: 5px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.4s ease;
}

.bar-value {
  font-size: 13px;
  color: var(--text-muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.chart-empty, .chart-loading {
  color: var(--text-faint);
  font-size: 13.5px;
  padding: var(--space-5) 0;
  text-align: center;
}

/* ---------- error boundary (kept from template) ---------- */

.blazor-error-boundary {
  background: #b32121;
  padding: 1rem 1rem 1rem 1.2rem;
  color: white;
  border-radius: var(--radius);
}
.blazor-error-boundary::after { content: "An error has occurred."; }

#blazor-error-ui {
  background: var(--surface-raised);
  border-top: 1px solid var(--border);
  color: var(--text);
  bottom: 0;
  box-shadow: none;
  display: none;
  left: 0;
  padding: 0.8rem 1.2rem;
  position: fixed;
  width: 100%;
  z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

/* ---------- responsive ---------- */

@media (max-width: 860px) {
  .shell { grid-template-columns: 72px 1fr; }
  .nav-brand, .nav-link span.label { display: none; }
  .nav-link { justify-content: center; padding: 12px; }
  .content { padding: var(--space-4); }
  .bar-row { grid-template-columns: 72px 1fr 44px; }
}
