/* ============================================================================
   AI HIVE DASHBOARD — Design Contract v3
   Palette: Infrastructure Steel (forge-brand generated from proposal #5)
   Typography: Geist + Geist Mono (Vercel pattern)
   Layout: quantifai-style sidebar + content
   Theme: Light-default with dark toggle

   Brand tokens (--brand-*) come from brand/output/ai-hive.css, loaded first.
   This file maps dashboard-specific semantic tokens (--state-claimed, --cat-architecture, etc.)
   to brand tokens. Swapping the brand kit only requires regenerating ai-hive.css —
   no edits to this file.
   ============================================================================ */

/* -- LIGHT THEME (default) -- */
:root {
  /* Surfaces */
  --base:          var(--brand-neutral-50);
  --base-raised:   var(--brand-foreground);
  --base-overlay:  var(--brand-neutral-100);
  --border:        var(--brand-neutral-200);
  --border-hover:  var(--brand-neutral-300);
  --text-primary:   var(--brand-neutral-900);
  --text-secondary: var(--brand-neutral-600);
  --text-muted:     var(--brand-neutral-500);  /* Bumped from neutral-400 (2.54:1 FAIL) to neutral-500 (4.78:1 PASS) on white */
  --shadow:       0 1px 3px color-mix(in srgb, var(--brand-neutral-900) 6%, transparent);
  --shadow-hover: 0 4px 16px color-mix(in srgb, var(--brand-neutral-900) 10%, transparent);

  /* Primary (active/claim/CTA).
     --primary is the solid fill color — used as background for buttons, active-tab tints, semantic markers.
     --primary-text is the 4.5:1-contrast darker shade used whenever primary is text color on light surfaces
     (links, active nav label, AI Hive logo). Failing pre-contrast-pass: #0ea5e9 on white = 2.77:1. */
  --primary:         var(--brand-primary);
  --primary-text:    #0369a1;  /* sky-700 — 5.87:1 on white, PASS */
  --primary-soft:    color-mix(in srgb, var(--brand-primary) 10%, transparent);
  --primary-border:  color-mix(in srgb, var(--brand-primary) 25%, transparent);

  /* Per-state text colors for tinted badges — each 4.5:1+ on white */
  --state-open-text:        #15803d;  /* green-700 */
  --state-claimed-text:     #0369a1;  /* sky-700 */
  --state-in-progress-text: #1e40af;  /* blue-800 */
  --state-review-text:      #b45309;  /* amber-700 */
  --state-merged-text:      #065f46;  /* emerald-800 */
  --state-blocked-text:     #991b1b;  /* red-800 */
  --state-locked-text:      #475569;  /* slate-600 */
  --state-dead-text:        #475569;
  --state-archived-text:    #475569;

  /* Category text colors for bordered chips — each 4.5:1+ on white */
  --cat-feature-text:      #15803d;
  --cat-architecture-text: #0369a1;
  --cat-process-text:      #b45309;
  --cat-tooling-text:      #065f46;
  --cat-integration-text:  #1e40af;
  --cat-other-text:        #475569;

  /* Sidebar — theme-adaptive (light in light mode, dark in dark mode) */
  --sidebar-bg:           var(--brand-foreground);
  --sidebar-text:         var(--brand-neutral-600);
  --sidebar-text-active:  var(--primary-text);  /* WCAG AA on light sidebar; sky-700 not sky-500 */
  --sidebar-border:       color-mix(in srgb, var(--brand-neutral-900) 8%, transparent);
  --sidebar-hover:        color-mix(in srgb, var(--brand-neutral-900) 5%, transparent);
  --sidebar-active:       color-mix(in srgb, var(--brand-primary) 12%, transparent);

  /* State semantics — each maps to a brand token + role */
  --state-open:        var(--brand-success);     /* available to claim */
  --state-claimed:     var(--brand-primary);     /* owned, not yet working */
  --state-in-progress: var(--brand-info);        /* actively being worked */
  --state-review:      var(--brand-warning);     /* attention needed */
  --state-merged:      var(--brand-accent);      /* merged — brand's success-action green */
  --state-blocked:     var(--brand-error);       /* blocked — something is wrong */
  --state-locked:      var(--brand-secondary);   /* muted — advisory lock, low attention */
  --state-dead:        var(--brand-muted-foreground);

  /* Proposal lifecycle status */
  --status-open:         var(--state-open);
  --status-discussing:   var(--state-review);
  --status-synthesized:  var(--primary);
  --status-approved:     var(--state-merged);
  --status-rejected:     var(--state-blocked);
  --status-archived:     var(--text-muted);

  /* Proposal categories */
  --cat-feature:      var(--brand-success);
  --cat-architecture: var(--brand-primary);
  --cat-process:      var(--brand-warning);
  --cat-tooling:      var(--brand-accent);
  --cat-integration:  var(--brand-info);
  --cat-other:        var(--text-muted);

  /* Kept from v2 for compat; maps to accent now */
  --accent-copper: var(--brand-accent);
}

/* -- DARK THEME -- */
[data-theme="dark"] {
  /* Surfaces — invert toward brand dark palette */
  --base:          var(--brand-background);
  --base-raised:   var(--brand-card);
  --base-overlay:  var(--brand-muted);
  --border:        var(--brand-border);
  --border-hover:  var(--brand-neutral-600);
  --text-primary:   var(--brand-foreground);
  --text-secondary: var(--brand-neutral-300);
  --text-muted:     var(--brand-neutral-400);  /* neutral-400 on dark bg = 4.6:1, PASS */

  /* On dark surfaces the original state colors (bright) are legible for text;
     override the *-text tokens to use the state color itself rather than a
     darkened variant. */
  --primary-text:           var(--brand-primary);
  --state-open-text:        var(--brand-success);
  --state-claimed-text:     var(--brand-primary);
  --state-in-progress-text: var(--brand-info);
  --state-review-text:      var(--brand-warning);
  --state-merged-text:      var(--brand-accent);
  --state-blocked-text:     var(--brand-error);
  --state-locked-text:      var(--brand-neutral-300);
  --state-dead-text:        var(--brand-neutral-400);
  --state-archived-text:    var(--brand-neutral-400);
  --cat-feature-text:       var(--brand-success);
  --cat-architecture-text:  var(--brand-primary);
  --cat-process-text:       var(--brand-warning);
  --cat-tooling-text:       var(--brand-accent);
  --cat-integration-text:   var(--brand-info);
  --cat-other-text:         var(--brand-neutral-400);
  --shadow:       0 1px 3px color-mix(in srgb, var(--brand-neutral-950) 40%, transparent);
  --shadow-hover: 0 4px 16px color-mix(in srgb, var(--brand-neutral-950) 60%, transparent);

  /* Primary — slightly softer alpha in dark for less glare */
  --primary-soft:    color-mix(in srgb, var(--brand-primary) 15%, transparent);
  --primary-border:  color-mix(in srgb, var(--brand-primary) 30%, transparent);

  /* Sidebar overrides for dark mode */
  --sidebar-bg:           var(--brand-card);
  --sidebar-text:         var(--brand-neutral-400);
  --sidebar-text-active:  var(--brand-foreground);
  --sidebar-border:       color-mix(in srgb, var(--brand-foreground) 8%, transparent);
  --sidebar-hover:        color-mix(in srgb, var(--brand-foreground) 6%, transparent);
  --sidebar-active:       color-mix(in srgb, var(--brand-primary) 22%, transparent);
}

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

body {
  font-family: var(--font-body);
  font-weight: 400;
  background: var(--base);
  color: var(--text-primary);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
}

/* ============================================================================
   ACCESSIBILITY FOUNDATIONS
   Skip link, global focus indicators, touch target minimums.
   audit-checklist #22 #28 #41 #45 + DESIGN.md N6, N9.
   ============================================================================ */

/* Skip link — visually hidden until focused (WCAG SC 2.4.1) */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 1000;
  background: var(--base-raised);
  color: var(--primary-text);
  padding: 0.75rem 1.25rem;
  border-radius: 0 0 0.5rem 0;
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 600;
  border: 2px solid var(--primary);
}
.skip-link:focus,
.skip-link:focus-visible {
  left: 0;
  outline: none;
}

/* Global focus indicators — visible for keyboard users, hidden on mouse.
   Applied to all interactive elements. Uses --primary (bright) for the ring
   regardless of theme so it's visible on both light and dark backgrounds. */
:focus { outline: none; }
a:focus-visible,
button:focus-visible,
[role="tab"]:focus-visible,
[tabindex]:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--brand-primary);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Touch target minimums — WCAG 2.5.5 recommends 44x44px.
   audit-checklist #22 + #66. */
.nav-item,
.sidebar-collapse,
.sidebar-open,
.theme-toggle,
.btn,
.empty-cta,
.error-retry,
.reaction-badge,
.proposal-link,
.activity-link {
  min-height: 44px;
  min-width: 44px;
}
/* Anchor links get touch padding instead of min-height (keeps inline layout) */
.proposal-link,
.activity-link {
  min-height: auto;
  padding: 0.75rem 0;  /* ~44px tall including text */
  display: inline-flex;
  align-items: center;
}

/* Reduced motion — WCAG 2.3.3, audit-checklist #9 + #99.
   Users with motion-sensitivity disable animations at the OS level;
   honor that preference. Keeps opacity-only transitions (for hover feedback)
   but kills movement, shimmer, and long durations. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .skeleton-bar {
    /* Kill the shimmer gradient animation but keep the bar as a neutral block */
    background: var(--base-overlay) !important;
    animation: none !important;
  }
}

/* ============================================================================
   LAYOUT — Sidebar + Content
   ============================================================================ */

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

.sidebar {
  width: 220px;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  transition: width 0.2s, transform 0.2s;
  z-index: 100;
}

.sidebar.collapsed {
  width: 0;
  overflow: hidden;
  transform: translateX(-220px);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1rem;
  border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-logo {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--sidebar-text-active);
  letter-spacing: -0.02em;
}

.project-selector {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--sidebar-border);
}

.project-selector select {
  width: 100%;
  padding: 0.45rem 0.6rem;
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--sidebar-hover);
  color: var(--sidebar-text-active);
  border: 1px solid var(--sidebar-border);
  border-radius: 6px;
  cursor: pointer;
  appearance: auto;
}

.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 0.25rem;
  border-radius: 4px;
  transition: background 0.2s;
}

.theme-toggle:hover {
  background: var(--sidebar-hover);
}

/* Show/hide sun/moon based on theme */
.theme-icon-dark { display: none; }
[data-theme="dark"] .theme-icon-light { display: none; }
[data-theme="dark"] .theme-icon-dark { display: inline; }

/* Sidebar header action group — mute toggle + theme toggle stack horizontally. */
.sidebar-header-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.header-icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  transition: background 0.2s;
  color: inherit;
}
.header-icon-btn:hover {
  background: var(--sidebar-hover);
}

/* Show on/off sound icon based on aria-pressed state of the mute toggle. */
.sound-icon-off { display: none; }
.header-icon-btn[aria-pressed="true"] .sound-icon-on { display: none; }
.header-icon-btn[aria-pressed="true"] .sound-icon-off { display: inline; }

.sidebar-nav {
  flex: 1;
  padding: 0.5rem 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.65rem 1rem;
  background: transparent;
  border: none;
  color: var(--sidebar-text);
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text-active);
}

.nav-item.active {
  background: var(--sidebar-active);
  color: var(--sidebar-text-active);
  border-right: 3px solid var(--primary);
}

/* Icon sizing — Lucide-style SVGs, currentColor-driven so they inherit
   the button's color for hover/active/theme transitions */
.icon {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}
/* .inline-icon — used by JS-generated SVGs in reaction/activity badges */
.inline-icon {
  width: 0.875rem;
  height: 0.875rem;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: -0.15em;
  margin-right: 0.25em;
}
.nav-icon {
  width: 1.125rem;
  height: 1.125rem;
  flex-shrink: 0;
  color: var(--sidebar-text);
}
.nav-item:hover .nav-icon,
.nav-item.active .nav-icon {
  color: var(--sidebar-text-active);
}
.theme-icon-light,
.theme-icon-dark {
  width: 1rem;
  height: 1rem;
  color: var(--sidebar-text);
}
.theme-toggle:hover .theme-icon-light,
.theme-toggle:hover .theme-icon-dark {
  color: var(--sidebar-text-active);
}

.sidebar-collapse {
  background: none;
  border: none;
  border-top: 1px solid var(--sidebar-border);
  color: var(--sidebar-text);
  padding: 0.75rem;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.2s;
}

.sidebar-collapse:hover {
  background: var(--sidebar-hover);
}

.sidebar-open {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
}

.content {
  flex: 1;
  min-width: 0;
  max-width: 1100px;
}

.content-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 2rem 2rem 1rem;
}

.content-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
}

.content-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Persistent coordination strip (C1) — sticks just under header, visible on every tab.
   Mono numerals for the live counts, semantic dot per indicator. */
.coord-strip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 2rem;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--base-overlay);
  font-size: 0.8rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.coord-stat {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: transparent;
  border: 0;
  padding: 0.25rem 0.4rem;
  border-radius: 6px;
  color: inherit;
  font: inherit;
  cursor: pointer;
  min-height: 32px;
}
.coord-stat:hover { background: var(--base-raised); color: var(--text-primary); }
.coord-stat:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.coord-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.coord-dot[data-tone="open"] { background: var(--state-open); }
.coord-dot[data-tone="in_progress"] { background: var(--state-in-progress); }
.coord-dot[data-tone="locked"] { background: var(--state-locked); }
.coord-num {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.coord-label { color: var(--text-muted); }
.coord-sep { color: var(--text-muted); opacity: 0.5; }

@media (max-width: 768px) {
  .coord-strip { padding: 0.5rem 1rem; font-size: 0.75rem; gap: 0.25rem; }
  .coord-label { display: none; } /* compact: dot + number only */
  .coord-stat::after {
    content: attr(aria-label);
    position: absolute;
    left: -9999px;
  }
}

.tab-content {
  display: none;
  padding: 0.5rem 2rem 3rem;
}

.tab-content.active {
  display: block;
}

/* ============================================================================
   STATE PATTERNS — Empty / Loading / Error
   Ported from the Round 1 palette previews. Component-level, not inline.
   ============================================================================ */

/* Empty state — rich pattern with icon, title, desc, optional CTA */
.empty-state {
  padding: 3rem 1.5rem;
  text-align: center;
  background: var(--base-raised);
  border: 1px dashed var(--border);
  border-radius: 0.5rem;
  max-width: 520px;
  margin: 2rem auto;
}
.empty-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 1rem;
  border-radius: 50%;
  background: color-mix(in srgb, var(--text-muted) 14%, transparent);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}
.empty-icon .inline-icon,
.empty-icon .icon {
  width: 1.25rem;
  height: 1.25rem;
  margin: 0;
}
.empty-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 0.375rem;
}
.empty-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  line-height: 1.5;
}
.empty-desc code {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  background: var(--base-overlay);
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  color: var(--text-primary);
}
.empty-cta {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: var(--primary);
  color: white;
  text-decoration: none;
  border-radius: 0.375rem;
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 500;
  transition: filter 0.15s;
  border: none;
  cursor: pointer;
}
.empty-cta:hover {
  filter: brightness(1.1);
}

/* Skeleton shimmer — loading state */
.skeleton {
  background: var(--base-raised);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.skeleton-bar {
  height: 0.875rem;
  background: linear-gradient(
    90deg,
    var(--base-overlay) 0%,
    color-mix(in srgb, var(--base-overlay) 50%, var(--border)) 50%,
    var(--base-overlay) 100%
  );
  background-size: 200% 100%;
  border-radius: 0.25rem;
  animation: shimmer 1.8s infinite ease-in-out;
}
.skeleton-bar.short { width: 40%; }
.skeleton-bar.med   { width: 60%; }
.skeleton-bar.long  { width: 85%; }
/* Dark mode: --base-overlay and --border are too close to shimmer visibly.
   Widen the range so the pulse reads on the dark card surface. */
[data-theme="dark"] .skeleton-bar {
  background: linear-gradient(
    90deg,
    var(--brand-neutral-800) 0%,
    var(--brand-neutral-600) 50%,
    var(--brand-neutral-800) 100%
  );
  background-size: 200% 100%;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Error banner — failure states */
.error-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  padding: 1rem 1.25rem;
  background: color-mix(in srgb, var(--state-blocked) 10%, var(--base-raised));
  border: 1px solid color-mix(in srgb, var(--state-blocked) 32%, var(--border));
  border-radius: 0.5rem;
  max-width: 720px;
  margin: 2rem auto;
}
.error-icon {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--state-blocked);
  color: var(--base-raised);
  display: flex;
  align-items: center;
  justify-content: center;
}
.error-icon .inline-icon,
.error-icon .icon {
  width: 0.875rem;
  height: 0.875rem;
  margin: 0;
  color: var(--base-raised);
}
.error-body { flex: 1; min-width: 0; }
.error-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--state-blocked);
  margin-bottom: 0.25rem;
}
.error-desc {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 0.625rem;
  line-height: 1.55;
}
.error-desc code {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: var(--base-overlay);
  padding: 0.0625rem 0.3125rem;
  border-radius: 0.2rem;
  color: var(--text-primary);
}
.error-retry {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-primary);
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--state-blocked) 40%, var(--border));
  padding: 0.3125rem 0.6875rem;
  border-radius: 0.25rem;
  cursor: pointer;
  transition: background 0.12s;
}
.error-retry:hover {
  background: color-mix(in srgb, var(--state-blocked) 14%, transparent);
}

/* Legacy fallback — keep minimal styling for any stray .empty / .loading
   references; new code should use .empty-state / .skeleton / .error-banner */
.loading, .empty {
  color: var(--text-muted);
  text-align: center;
  padding: 2rem;
  font-size: 0.9375rem;
}

/* ============================================================================
   TRADING CARDS
   ============================================================================ */

.gallery {
  display: flex;
  justify-content: flex-start;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding: 1rem 0;
}

.card {
  width: 280px;
  min-height: 420px;
  display: flex;
  flex-direction: column;
  background: var(--base-raised);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
}

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

.card-header {
  padding: 1.5rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.card-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--primary);
  margin: 0 auto 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: white;
}

.card-name {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
}

.card-title {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.2rem;
}

.card-stats { padding: 1rem 1.25rem; flex: 1; }

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
}

.stat-row:last-child { border-bottom: none; }

.stat-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
  /* Use the merged-text token — same green family as --brand-accent but shifted
     darker in light theme for WCAG AA on --base-raised (card bg). In dark mode
     the token falls back to --brand-accent which passes on the dark surface. */
  color: var(--state-merged-text);
}

.card-footer {
  padding: 0.85rem 1.25rem;
  background: var(--base-overlay);
  text-align: center;
}

.card-tagline {
  font-style: italic;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* ============================================================================
   PROPOSALS
   ============================================================================ */

.proposals-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.proposal-card {
  background: var(--base-raised);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.proposal-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-hover);
}

/* Graph edges: dimmed state when hovering a synthesis */
.proposal-card.dimmed {
  opacity: 0.3;
  transition: opacity 0.3s;
}

.proposal-card.highlighted {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-soft), var(--shadow-hover);
}

.proposal-header {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

/* Status badges — tinted background + WCAG-AA colored text (Linear pattern).
   Pre-contrast-pass these were solid-fill with white text (2.15-2.77:1 FAIL).
   Approach: we can't change the inline `style="background: var(--status-X)"` from CSS alone,
   so we locally redefine --status-X to a tinted color-mix. The inline style then resolves
   to tinted bg instead of solid. Text color is set via attribute selector on the inline style,
   per state, using the --state-*-text tokens that are WCAG-AA compliant on white. */
.proposal-status {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.22rem 0.55rem;
  border-radius: 4px;
  /* Locally redefine each token to a tinted variant — inline style picks this up */
  --status-open:         color-mix(in srgb, var(--brand-success) 14%, transparent);
  --status-discussing:   color-mix(in srgb, var(--brand-warning) 14%, transparent);
  --status-synthesized:  color-mix(in srgb, var(--brand-primary) 14%, transparent);
  --status-approved:     color-mix(in srgb, var(--brand-accent) 14%, transparent);
  --status-rejected:     color-mix(in srgb, var(--brand-error) 14%, transparent);
  --status-archived:     color-mix(in srgb, var(--text-muted) 14%, transparent);
  --state-open:          color-mix(in srgb, var(--brand-success) 14%, transparent);
  --state-claimed:       color-mix(in srgb, var(--brand-primary) 14%, transparent);
  --state-in-progress:   color-mix(in srgb, var(--brand-info) 14%, transparent);
  --state-review:        color-mix(in srgb, var(--brand-warning) 14%, transparent);
  --state-merged:        color-mix(in srgb, var(--brand-accent) 14%, transparent);
  --state-blocked:       color-mix(in srgb, var(--brand-error) 14%, transparent);
  --state-locked:        color-mix(in srgb, var(--brand-secondary) 18%, transparent);
  --primary:             color-mix(in srgb, var(--brand-primary) 14%, transparent);
  color: var(--text-primary);
}
/* Text color per state (matches the inline style's token reference) */
.proposal-status[style*="status-open"],         .proposal-status[style*="state-open"]         { color: var(--state-open-text); }
.proposal-status[style*="status-discussing"],   .proposal-status[style*="state-review"]       { color: var(--state-review-text); }
.proposal-status[style*="status-synthesized"],  .proposal-status[style*="state-claimed"]      { color: var(--state-claimed-text); }
.proposal-status[style*="state-in-progress"]                                                  { color: var(--state-in-progress-text); }
.proposal-status[style*="status-approved"],     .proposal-status[style*="state-merged"]       { color: var(--state-merged-text); }
.proposal-status[style*="status-rejected"],     .proposal-status[style*="state-blocked"]      { color: var(--state-blocked-text); }
.proposal-status[style*="state-locked"]                                                       { color: var(--state-locked-text); }
.proposal-status[style*="status-archived"]                                                    { color: var(--state-archived-text); }
.proposal-status[style*="--primary"]                                                          { color: var(--primary-text); }

.proposal-category {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.22rem 0.55rem;
  border-radius: 4px;
  border: 1px solid currentColor;
  background: transparent;
}
/* Category text colors are already set via inline style="color:var(--cat-X)" —
   override those to the WCAG-AA text variants via the same attribute-selector pattern. */
.proposal-category[style*="cat-feature"]      { --cat-feature:      var(--cat-feature-text);      color: var(--cat-feature-text) !important; }
.proposal-category[style*="cat-architecture"] { --cat-architecture: var(--cat-architecture-text); color: var(--cat-architecture-text) !important; }
.proposal-category[style*="cat-process"]      { --cat-process:      var(--cat-process-text);      color: var(--cat-process-text) !important; }
.proposal-category[style*="cat-tooling"]      { --cat-tooling:      var(--cat-tooling-text);      color: var(--cat-tooling-text) !important; }
.proposal-category[style*="cat-integration"]  { --cat-integration:  var(--cat-integration-text);  color: var(--cat-integration-text) !important; }
.proposal-category[style*="cat-other"]        { --cat-other:        var(--cat-other-text);        color: var(--cat-other-text) !important; }

.proposal-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.proposal-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 0.75rem;
}

.proposal-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.proposal-author strong { color: var(--accent-copper); }
.proposal-meta .proposal-time { font-family: var(--font-mono); font-size: 0.7rem; }

.reaction-badges {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.reaction-badge {
  background: var(--base-overlay);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.2rem 0.65rem;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.reactions-list {
  border-top: 1px solid var(--border);
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.reaction-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.8rem;
}

.reaction-icon { flex-shrink: 0; }
.reaction-author { color: var(--accent-copper); font-weight: 500; flex-shrink: 0; }
.reaction-content { color: var(--text-secondary); line-height: 1.4; }

.proposal-link {
  display: inline-block;
  margin-top: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--primary-text);  /* WCAG AA — was var(--primary) = 2.77:1 on white */
  text-decoration: none;
}

/* Markdown-rendered content inside .proposal-desc (audit Critical C7).
   Proposal descriptions are authored with markdown. renderMarkdown() in
   app.js emits the HTML; these rules style it. */
.proposal-desc {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.6;
  margin-bottom: 0.75rem;
  max-width: 70ch;  /* audit-checklist #21 #73 — line-length constraint */
}
.proposal-desc h3 { font-size: 0.95rem; font-weight: 600; color: var(--text-primary); margin: 0.75rem 0 0.375rem; }
.proposal-desc h4 { font-size: 0.875rem; font-weight: 600; color: var(--text-primary); margin: 0.5rem 0 0.25rem; }
.proposal-desc strong { color: var(--text-primary); font-weight: 600; }
.proposal-desc em { font-style: italic; }
.proposal-desc code {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  background: var(--base-overlay);
  padding: 0.0625rem 0.3125rem;
  border-radius: 0.2rem;
  color: var(--text-primary);
}
.proposal-desc pre {
  background: var(--base-overlay);
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  padding: 0.75rem;
  overflow-x: auto;
  margin: 0.5rem 0;
}
.proposal-desc pre code {
  background: transparent;
  padding: 0;
  font-size: 0.8125rem;
  line-height: 1.5;
  white-space: pre;
}
.proposal-desc ul, .proposal-desc ol {
  margin: 0.375rem 0 0.75rem 1.5rem;
  padding-left: 0;
}
.proposal-desc li { margin-bottom: 0.25rem; line-height: 1.5; }
.proposal-desc a {
  color: var(--primary-text);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.proposal-desc a:hover { text-decoration-thickness: 2px; }
.proposal-desc table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.5rem 0;
  font-size: 0.8125rem;
}
.proposal-desc table th,
.proposal-desc table td {
  border: 1px solid var(--border);
  padding: 0.375rem 0.625rem;
  text-align: left;
  vertical-align: top;
}
.proposal-desc table th {
  background: var(--base-overlay);
  font-weight: 600;
  color: var(--text-primary);
}

.proposal-link:hover { text-decoration: underline; }

/* ============================================================================
   TASK BOARD
   ============================================================================ */

.task-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.board-column {
  background: var(--base-overlay);
  border-radius: 10px;
  padding: 1rem;
  min-height: 120px;
}

/* Exception columns (blocked, locked) — visually separated per DESIGN.md C2.
   Happy-path sequence reads left-to-right; exceptions deserve distinct framing
   so readers don't parse them as "next states" in the workflow. */
.board-column-exception {
  background: color-mix(in srgb, var(--base-overlay) 70%, transparent);
  border: 1px dashed var(--border);
}
.board-column-divider {
  width: 1px;
  background: var(--border);
  margin: 0 0.5rem;
  align-self: stretch;
}

.board-column-header {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  color: white;
  display: inline-block;
  margin-bottom: 0.75rem;
}

.board-column-count {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-left: 0.5rem;
}

/* DESIGN.md C12 — per-column pagination affordance (V2).
   Shows under a column when total > BOARD_COLUMN_PAGE_SIZE (50). */
.board-load-more {
  display: block;
  width: 100%;
  margin-top: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.7rem;
  font-family: var(--font-mono);
  cursor: pointer;
  min-height: 32px;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.board-load-more:hover {
  border-color: var(--primary);
  color: var(--primary-text);
  background: var(--primary-soft);
}
.board-load-more:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* V4 C10 — filter chip row. Shared across Proposals, Board, Activity tabs.
   Active chip uses the primary token palette so the selection is unmistakable. */
.filter-chips {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
  padding: 0;
}
.filter-chip {
  padding: 0.35rem 0.7rem;
  min-height: 32px;
  font: inherit;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  background: var(--base-overlay);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.filter-chip:hover {
  background: var(--base-raised);
  color: var(--text-primary);
  border-color: var(--border-hover);
}
.filter-chip:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.filter-chip.active {
  background: var(--primary-soft);
  color: var(--primary-text);
  border-color: var(--primary-border);
  font-weight: 500;
}
.filter-chip.active:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.board-task {
  background: var(--base-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  box-shadow: var(--shadow);
  transition: border-color 0.2s;
}

.board-task:hover {
  border-color: var(--border-hover);
}

.board-task-title {
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.board-task-meta {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  display: flex;
  gap: 0.5rem;
}

.board-task-priority {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 500;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  background: var(--base-overlay);
  border: 1px solid var(--border);
}

/* Synthesis backlink on task cards (DESIGN.md C6 throughline).
   Click jumps to the originating synthesis on the Proposals tab. */
.board-task-synthesis {
  display: block;
  margin-top: 0.4rem;
  padding-top: 0.4rem;
  border-top: 1px dashed var(--border);
  font-size: 0.65rem;
  color: var(--text-muted);
  text-decoration: none;
  font-style: italic;
  /* clamp to a single line since synthesis titles can be long */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.board-task-synthesis:hover { color: var(--primary-text); text-decoration: underline; }
.board-task-synthesis:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 2px; }

/* Task-count affordance on synthesis cards — the reverse side of the throughline. */
.synthesis-tasks-link {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--primary-text);
  text-decoration: none;
  padding: 0.15rem 0.45rem;
  border: 1px solid var(--primary-border);
  border-radius: 4px;
  background: var(--primary-soft);
  transition: background 0.15s, color 0.15s;
}
.synthesis-tasks-link:hover { background: var(--primary); color: white; }
.synthesis-tasks-link:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Board filter bar — shown when a user clicked "→ N tasks" on a synthesis card. */
.board-filter-bar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.625rem 0.875rem;
  margin-bottom: 1rem;
  background: var(--primary-soft);
  border: 1px solid var(--primary-border);
  border-radius: 8px;
  font-size: 0.8rem;
  color: var(--text-primary);
}
.board-filter-label { color: var(--text-muted); }
.board-filter-clear {
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--primary-border);
  color: var(--primary-text);
  padding: 0.3rem 0.7rem;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  min-height: 32px;
}
.board-filter-clear:hover { background: var(--primary); color: white; border-color: var(--primary); }
.board-filter-clear:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Brief highlight animation when scrolling to a synthesis via backlink click.
   Respects prefers-reduced-motion. */
@keyframes synthesis-card-flash {
  0%   { box-shadow: 0 0 0 0 var(--primary-soft); }
  30%  { box-shadow: 0 0 0 6px var(--primary-soft); }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.synthesis-card-highlight {
  animation: synthesis-card-flash 1.8s ease-out;
  border-color: var(--primary) !important;
}
@media (prefers-reduced-motion: reduce) {
  .synthesis-card-highlight { animation: none; }
}

/* ============================================================================
   SESSIONS
   ============================================================================ */

.sessions-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.session-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--base-raised);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem;
  box-shadow: var(--shadow);
}

.session-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.session-dot.active { background: var(--state-open); box-shadow: 0 0 8px var(--state-open); }
.session-dot.idle { background: var(--state-review); }
.session-dot.dead { background: var(--state-dead); }

/* Heartbeat freshness — first-class color signal per DESIGN.md C4.
   .dot-live/.dot-idle/.dot-stale applied on top of .session-dot based on
   heartbeat age. Overrides the server-status color for strongest signal:
   a session marked 'active' but with a stale heartbeat still reads as stale. */
.session-dot.dot-live  { background: var(--brand-success); box-shadow: 0 0 8px var(--brand-success); animation: pulse-live 2s ease-in-out infinite; }
.session-dot.dot-idle  { background: var(--brand-warning); box-shadow: 0 0 4px color-mix(in srgb, var(--brand-warning) 50%, transparent); }
.session-dot.dot-stale { background: var(--brand-error);   box-shadow: none; opacity: 0.7; }

@keyframes pulse-live {
  0%, 100% { box-shadow: 0 0 8px var(--brand-success); }
  50%      { box-shadow: 0 0 14px color-mix(in srgb, var(--brand-success) 70%, transparent); }
}
@media (prefers-reduced-motion: reduce) {
  .session-dot.dot-live { animation: none !important; }
}

/* Freshness label text — matches dot color */
.session-freshness {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0 0.375rem;
  border-radius: 3px;
}
.session-freshness-live  { color: var(--state-open-text);    background: color-mix(in srgb, var(--brand-success) 14%, transparent); }
.session-freshness-idle  { color: var(--state-review-text);  background: color-mix(in srgb, var(--brand-warning) 14%, transparent); }
.session-freshness-stale { color: var(--state-blocked-text); background: color-mix(in srgb, var(--brand-error) 14%, transparent); }

.session-info { flex: 1; min-width: 0; }

.session-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
}

.session-detail {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  display: flex;
  gap: 1rem;
  margin-top: 0.2rem;
}

.session-status {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  color: white;
}

/* ============================================================================
   ACTIVITY FEED
   ============================================================================ */

.timeline { display: flex; flex-direction: column; gap: 0; }

.timeline-item {
  display: flex;
  gap: 1rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
}

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

.timeline-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--base-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.timeline-content { flex: 1; min-width: 0; }

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.2rem;
}

.timeline-type {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 500;
}

.timeline-time { font-family: var(--font-mono); font-size: 0.65rem; color: var(--text-muted); }

.timeline-body { font-size: 0.85rem; color: var(--text-secondary); line-height: 1.4; }
.timeline-body strong { color: var(--accent-copper); }
.timeline-body em { color: var(--text-secondary); }

.activity-detail {
  font-family: var(--font-mono);
  background: var(--base-overlay);
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-left: 0.25rem;
}

.activity-link {
  font-family: var(--font-mono);
  color: var(--primary-text);  /* WCAG AA */
  text-decoration: none;
  font-size: 0.7rem;
  margin-left: 0.25rem;
}

.activity-link:hover { text-decoration: underline; }

/* ============================================================================
   PARTICIPANTS
   ============================================================================ */

.participants-board { display: flex; flex-direction: column; gap: 1rem; }

.thread-card {
  background: var(--base-raised);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  box-shadow: var(--shadow);
  transition: border-color 0.2s;
}

.thread-card:hover { border-color: var(--border-hover); }

.thread-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.thread-status {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  color: white;
  display: inline-block;
  margin-bottom: 0.75rem;
}

.thread-participants { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.participant-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--base-overlay);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.3rem 0.7rem;
  font-size: 0.8rem;
}

.participant-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 0.5rem;
  font-weight: 700;
  color: white;
}

.participant-name { font-weight: 500; }
.participant-role { font-family: var(--font-mono); font-size: 0.6rem; color: var(--text-muted); }

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    transform: translateX(-220px);
  }
  .sidebar:not(.collapsed) {
    transform: translateX(0);
    box-shadow: 4px 0 20px color-mix(in srgb, var(--brand-neutral-950) 40%, transparent);
  }
  .sidebar-open { display: block; }
  .content-header { padding: 1.25rem 1rem 0.75rem; }
  .tab-content { padding: 0.5rem 1rem 2rem; }
  .task-board { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Toast notifications — Hive task 5c0d70c9
   Top-right stack, soft slide-in, auto-dismiss after 6s, click to navigate.
   ========================================================================== */

.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none; /* container ignores clicks; toasts re-enable */
  max-width: min(360px, calc(100vw - 2rem));
}

.toast {
  pointer-events: auto;
  background: var(--surface, #ffffff);
  color: var(--text-primary, #111);
  border: 1px solid var(--border, rgba(0, 0, 0, 0.1));
  border-left: 3px solid var(--primary, #0ea5e9);
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.10), 0 2px 6px rgba(0, 0, 0, 0.06);
  font-size: 0.85rem;
  line-height: 1.35;
  cursor: pointer;
  transition: transform 0.18s ease, opacity 0.18s ease;
  transform: translateX(8px);
  opacity: 0;
  animation: toast-in 0.22s ease forwards;
}

.toast:hover {
  border-left-color: var(--primary-text, #0369a1);
}

.toast .toast-type {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted, #6b7280);
  margin-bottom: 0.15rem;
}

.toast .toast-title {
  font-weight: 600;
  color: var(--text-primary);
}

.toast.toast-leaving {
  animation: toast-out 0.18s ease forwards;
}

@keyframes toast-in {
  from { transform: translateX(8px); opacity: 0; }
  to   { transform: translateX(0);   opacity: 1; }
}
@keyframes toast-out {
  from { transform: translateX(0);   opacity: 1; }
  to   { transform: translateX(12px); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .toast { animation: none; opacity: 1; transform: none; }
  .toast.toast-leaving { animation: none; opacity: 0; }
}

/* ==========================================================================
   Sidebar nav badge — Hive task f3fecde8
   Small numeric pill at the right end of a nav-item, indicating unread events
   for that tab. Hidden when count is 0; shown when > 0; "9+" cap for visual.
   ========================================================================== */

.nav-badge {
  margin-left: auto;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.375rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
  color: white;
  background: var(--primary, #0ea5e9);
  border-radius: 999px;
  box-shadow: 0 0 0 2px var(--sidebar-bg, transparent);
  transition: transform 0.15s ease;
}

/* `.nav-badge { display: inline-flex }` wins over the UA stylesheet's
   `[hidden] { display: none }` on specificity (class beats attribute), so
   the badge stayed visible even when renderNavBadge() set el.hidden=true.
   Explicit override here pulls it out of layout when count is zero. */
.nav-badge[hidden] {
  display: none;
}

/* Active tab's badge inherits the active foreground tone for legibility */
.nav-item.active .nav-badge {
  background: var(--primary-text, #0369a1);
}

/* Subtle bump when the count just incremented (JS toggles .nav-badge--bump) */
.nav-badge--bump {
  animation: nav-badge-bump 0.18s ease;
}
@keyframes nav-badge-bump {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.18); }
  100% { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .nav-badge { transition: none; }
  .nav-badge--bump { animation: none; }
}
