/* ── Auth Screen ──────────────────────────────────────── */
.auth-screen {
  position: fixed; inset: 0; z-index: 10000;
  background: #06090f;
  display: flex; align-items: center; justify-content: center;
}
.auth-box {
  background: #0f1419; border: 1px solid #1e2738;
  border-radius: 12px; padding: 32px; width: 340px;
  text-align: center; box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.auth-box input:focus {
  outline: none; border-color: #58a6ff;
}
.auth-box button:hover {
  background: #2ea043;
}

/* ── Design Tokens ─────────────────────────────────────── */

:root {
  /* ── Backgrounds (4-tier depth system) ── */
  --bg-depth-0: #06090f;      /* Body / deepest background */
  --bg-depth-1: #0f1419;      /* Panels */
  --bg-depth-2: #161d28;      /* Nested cards (tasks, inbox items) */
  --bg-depth-3: #1c2535;      /* Floating elements (dropdowns, tooltips) */

  --bg-primary: var(--bg-depth-0);
  --bg-secondary: #0b1018;
  --bg-panel: var(--bg-depth-1);
  --bg-panel-hover: #141b23;
  --bg-input: #0b1018;
  --bg-surface: var(--bg-depth-2);
  --bg-elevated: var(--bg-depth-3);
  --bg-glass: rgba(13, 18, 24, 0.80);

  /* ── Borders ── */
  --border: #1e2738;
  --border-light: #141c28;
  --border-focus: #60a5fa30;
  --border-glow: #60a5fa15;

  /* ── Text (WCAG AA compliant) ── */
  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  /* ── Accent Colors (softened for dark bg) ── */
  --accent: #60a5fa;
  --accent-hover: #93c5fd;
  --accent-dim: #60a5fa12;
  --accent-soft: #60a5fa25;
  --accent-green: #4ade80;
  --accent-green-dim: #4ade8015;
  --accent-yellow: #fbbf24;
  --accent-yellow-dim: #fbbf2415;
  --accent-red: #f87171;
  --accent-red-dim: #f8717115;
  --accent-purple: #a78bfa;
  --accent-purple-dim: #a78bfa15;
  --accent-cyan: #22d3ee;
  --accent-orange: #fb923c;
  --accent-pink: #f472b6;

  /* ── Semantic State Colors ── */
  --state-active: var(--accent);
  --state-active-dim: rgba(96, 165, 250, 0.08);
  --state-active-border: rgba(96, 165, 250, 0.25);
  --state-success: var(--accent-green);
  --state-success-dim: rgba(74, 222, 128, 0.08);
  --state-success-border: rgba(74, 222, 128, 0.25);
  --state-warning: var(--accent-yellow);
  --state-warning-dim: rgba(251, 191, 36, 0.08);
  --state-warning-border: rgba(251, 191, 36, 0.25);
  --state-error: var(--accent-red);
  --state-error-dim: rgba(248, 113, 113, 0.08);
  --state-error-border: rgba(248, 113, 113, 0.25);
  --state-neutral: var(--text-muted);
  --state-neutral-dim: rgba(100, 116, 139, 0.08);

  /* ── Calendar colors ── */
  --cal-client: #7986cb;
  --cal-editing: #33b679;
  --cal-sport: #a78bfa;
  --cal-production: #e4c441;
  --cal-personal: #f4511e;
  --cal-health: #616161;
  --cal-kameha: #4285f4;
  --cal-default: #64748b;

  /* ── Typography ── */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'JetBrains Mono', 'Cascadia Code', monospace;
  --text-xs: 0.6875rem;
  --text-sm: 0.8125rem;
  --text-base: 0.875rem;
  --text-md: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.5rem;

  /* ── Spacing & Radius ── */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 4px;

  /* ── Shadows ── */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.6);
  --shadow-glow: 0 0 30px rgba(96,165,250,0.05);

  /* ── Transitions ── */
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-fast: all 0.12s ease;
  --ease-out: cubic-bezier(0.0, 0.0, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0.0, 0.2, 1);
}

/* ── Reset & Base ─────────────────────────────────────── */

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

html {
  scrollbar-color: var(--border) transparent;
}

body {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: var(--text-base);
  font-optical-sizing: auto;
  font-feature-settings: 'ss01' on;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-variant-numeric: tabular-nums;
}

/* Subtle mesh gradient background */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at 15% 10%, rgba(96,165,250,0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 85% 5%, rgba(167,139,250,0.03) 0%, transparent 45%),
    radial-gradient(ellipse at 10% 90%, rgba(74,222,128,0.02) 0%, transparent 40%),
    radial-gradient(ellipse at 80% 85%, rgba(251,191,36,0.015) 0%, transparent 40%);
  background-attachment: fixed;
  pointer-events: none;
  z-index: 0;
}

/* ── Header ───────────────────────────────────────────── */

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  background: var(--bg-glass);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent) 0%, #3d8bfd 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 15px;
  color: #fff;
  letter-spacing: 0;
  box-shadow: 0 2px 10px rgba(88,166,255,0.25);
}

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

header h1 {
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 4px;
  color: var(--text-primary);
  line-height: 1.1;
}

.header-subtitle {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0.5px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
}

.header-divider {
  width: 1px;
  height: 18px;
  background: var(--border);
}

#datetime {
  font-size: 11px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  letter-spacing: 0.3px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-green);
}

.status-dot.online {
  box-shadow: 0 0 6px var(--accent-green), 0 0 12px rgba(63, 185, 80, 0.15);
  animation: pulse-green 3s ease-in-out infinite;
}

.status-label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 6px var(--accent-green), 0 0 12px rgba(63, 185, 80, 0.15); }
  50% { box-shadow: 0 0 10px var(--accent-green), 0 0 20px rgba(63, 185, 80, 0.25); }
}

/* Health dots */
.health-dots {
  display: flex;
  align-items: center;
  gap: 4px;
}
.health-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  transition: background 0.3s;
}
.health-dot.health-ok { background: var(--accent-green); }
.health-dot.health-warn { background: var(--accent-yellow); }
.health-dot.health-error { background: var(--accent-red); animation: pulse-red 1.5s ease-in-out infinite; }

@keyframes pulse-red {
  0%, 100% { box-shadow: 0 0 4px var(--accent-red); }
  50% { box-shadow: 0 0 8px var(--accent-red); }
}

/* Freshness stamps */
.freshness-stamp {
  font-size: 9px;
  color: var(--text-muted);
  font-weight: 500;
  opacity: 0.7;
  transition: color 0.3s, opacity 0.3s;
}
.freshness-stamp:hover { opacity: 1; }
.freshness-stamp.freshness-stale { color: var(--accent-yellow); opacity: 1; }
.freshness-stamp.freshness-old { color: var(--accent-red); opacity: 1; }

/* ── Stats Bar ────────────────────────────────────────── */

.stats-bar {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1px;
  margin: 14px 24px 0;
  background: var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 12px 12px;
  background: var(--bg-depth-1);
  transition: var(--transition);
  gap: 4px;
  position: relative;
}

.stat-item:hover {
  background: var(--bg-depth-2);
}

.stat-clickable {
  cursor: pointer;
}

.stat-clickable:active {
  transform: scale(0.97);
}

.stat-icon {
  color: var(--accent);
  opacity: 0.6;
  margin-bottom: 2px;
}

.stat-icon-yellow { color: var(--accent-yellow); }
.stat-icon-green { color: var(--accent-green); }
.stat-icon-purple { color: var(--accent-purple); }
.stat-icon-red { color: var(--accent-red); }

.stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--text-primary);
  font-family: var(--font-mono);
  line-height: 1.1;
  text-shadow: 0 0 20px rgba(96,165,250,0.15);
}

.stat-value.stat-pulse {
  color: var(--accent-red);
  animation: stat-pulse-anim 2s ease-in-out infinite;
}

@keyframes stat-pulse-anim {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.stat-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  font-weight: 500;
  max-width: 120px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-spark {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 32px;
  opacity: 0.5;
  pointer-events: none;
}

.stat-spark .apexcharts-canvas {
  background: transparent !important;
}

.fin-apex-chart {
  margin: 8px -4px 0;
}

/* ── Intelligence Feed ────────────────────────────────── */

.intel-feed {
  margin: 10px 24px 0;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

.intel-feed-inner {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.intel-feed-inner::-webkit-scrollbar {
  height: 3px;
}

.intel-feed-inner::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

.feed-card {
  flex: 0 0 auto;
  width: clamp(200px, 16vw, 260px);
  background: var(--bg-depth-2);
  border: none;
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  transition: var(--transition);
  scroll-snap-align: start;
  animation: fade-in 0.3s ease-out;
  box-shadow: 0 0 0 1px var(--border-light), var(--shadow-sm);
}

.feed-card:hover {
  box-shadow: 0 0 0 1px var(--border-focus), var(--shadow-md);
  transform: translateY(-1px);
}

.feed-card-border {
  width: 3px;
  flex-shrink: 0;
  mask-image: linear-gradient(180deg, #000 60%, transparent);
  -webkit-mask-image: linear-gradient(180deg, #000 60%, transparent);
}

.feed-card-body {
  padding: 10px 12px;
  min-width: 0;
  flex: 1;
}

.feed-card-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}

.feed-card-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  opacity: 0.8;
}

.feed-card-category {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.feed-card-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.feed-card-detail {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── App Shell Layout ─────────────────────────────────── */

.app-shell {
  display: flex;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

/* ── Sidebar ─────────────────────────────────────────── */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 60px;
  background: var(--bg-depth-1);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  z-index: 200;
  gap: 0;
}

.sidebar-logo {
  margin-bottom: 16px;
}

.sidebar-logo .sidebar-mark {
  width: 34px;
  height: 34px;
  font-size: 16px;
  border-radius: 10px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.sidebar-item {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

.sidebar-item:hover {
  background: var(--bg-depth-2);
  color: var(--text-secondary);
}

.sidebar-item.active {
  background: var(--accent-dim);
  color: var(--accent);
}

.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

/* Sidebar tooltip on hover */
.sidebar-item::after {
  content: attr(title);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-depth-3);
  color: var(--text-primary);
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
  box-shadow: var(--shadow-md);
  z-index: 300;
}

.sidebar-item:hover::after {
  opacity: 1;
}

.sidebar-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-red);
  border: 2px solid var(--bg-depth-1);
}

.sidebar-separator {
  width: 24px;
  height: 1px;
  background: var(--border);
  margin: 6px 0;
}

.sidebar-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding-top: 8px;
}

.sidebar-health-dots {
  display: flex;
  gap: 4px;
}

.sidebar-version {
  font-size: 9px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  opacity: 0.5;
}

/* ── App Content ─────────────────────────────────────── */

.app-content {
  margin-left: 60px;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ── View Container ──────────────────────────────────── */

.view-container {
  flex: 1;
  overflow-y: auto;
  position: relative;
}

.view {
  display: none;
  padding: 14px 24px 24px;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.view.active {
  display: block;
}

/* ── View Layouts ────────────────────────────────────── */

/* Home view */
.home-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

.home-bottom-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

#view-home .stats-bar {
  margin: 0 0 14px;
}

#view-home .intel-feed {
  margin: 0 0 14px;
}

/* Home schedule widget */
.home-schedule-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.home-event {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
}

.home-event:hover {
  background: var(--bg-depth-2);
}

.home-event-time {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  min-width: 52px;
  flex-shrink: 0;
}

.home-event-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.home-event-title {
  font-size: 13px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.home-event-meta {
  font-size: 10px;
  color: var(--text-muted);
  margin-left: auto;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Needs attention widget */
.attention-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.attention-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: var(--transition-fast);
  cursor: pointer;
}

.attention-item:hover {
  background: var(--bg-depth-2);
}

.attention-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 12px;
}

.attention-icon.attn-overdue {
  background: var(--accent-red-dim);
  color: var(--accent-red);
}

.attention-icon.attn-email {
  background: var(--accent-yellow-dim);
  color: var(--accent-yellow);
}

.attention-icon.attn-approval {
  background: var(--accent-purple-dim);
  color: var(--accent-purple);
}

.attention-text {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.attention-time {
  font-size: 10px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.empty-state-mini {
  text-align: center;
  padding: 24px 12px;
  color: var(--text-muted);
  font-size: 12px;
}

.empty-state-mini svg {
  opacity: 0.3;
  margin-bottom: 8px;
}

/* Tasks view */
.tasks-view-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 14px;
}

/* Inbox view */
.inbox-view-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

/* Calendar view */
#view-calendar .panel {
  min-height: calc(100vh - 140px);
}

#view-calendar .panel-content {
  max-height: none !important;
  flex: 1;
}

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

.view-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
}

/* Projects view toggle */
.projects-view-toggle {
  display: flex;
  gap: 4px;
}

.projects-view-toggle .tab-btn {
  font-size: 11px;
  padding: 4px 12px;
}

/* ── Panels ───────────────────────────────────────────── */

.panel {
  background: var(--bg-depth-1);
  border: none;
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 0 1px var(--border), var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,0.03);
  transition: var(--transition);
}

.panel:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 0 1px var(--border-focus), var(--shadow-md), 0 4px 20px rgba(96,165,250,0.06), inset 0 1px 0 rgba(255,255,255,0.03);
}

/* Panel Identity — colored top borders */
#today-calendar { border-top: 3px solid var(--cal-kameha); }
#week-overview  { border-top: 3px solid var(--accent-purple); }
#priorities     { border-top: 3px solid var(--accent-red); }
#deadlines      { border-top: 3px solid var(--accent-yellow); }
#tasks          { border-top: 3px solid var(--accent-green); }
#inbox          { border-top: 3px solid var(--accent); }
#waiting-on     { border-top: 3px solid var(--accent-yellow); }
#projects       { border-top: 3px solid var(--accent-purple); }
#shoot-log      { border-top: 3px solid var(--cal-production); }
#email-intel    { border-top: 3px solid var(--accent-purple); }
#financials     { border-top: 3px solid var(--text-muted); display: none; }

/* Subtle tinted backgrounds on high-priority panels */
#priorities  { background: linear-gradient(180deg, rgba(248,81,73,0.04) 0%, var(--bg-depth-1) 60px); }
#inbox       { background: linear-gradient(180deg, rgba(88,166,255,0.04) 0%, var(--bg-depth-1) 60px); }
#email-intel { background: linear-gradient(180deg, rgba(163,113,247,0.04) 0%, var(--bg-depth-1) 60px); }

/* Panel header icons */
.panel-icon {
  vertical-align: -2px;
  margin-right: 6px;
  opacity: 0.7;
  transition: var(--transition-fast);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-light);
  background: linear-gradient(180deg, rgba(255,255,255,0.015) 0%, transparent 100%);
  min-height: 42px;
}

.panel-header h2 {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.refresh-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  padding: 4px 6px;
  border-radius: var(--radius-xs);
  transition: var(--transition-fast);
  line-height: 1;
  opacity: 0.5;
}

.refresh-btn:hover {
  color: var(--accent);
  background: var(--accent-dim);
  opacity: 1;
}

.panel-content {
  padding: 10px 16px 16px;
  overflow-y: auto;
  flex: 1;
  font-size: 13px;
  max-height: 500px;
}

.loading {
  color: var(--text-muted);
  text-align: center;
  padding: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 11px;
}

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.error-msg {
  color: var(--accent-red);
  text-align: center;
  padding: 20px;
  font-size: 12px;
  background: var(--accent-red-dim);
  border-radius: var(--radius-sm);
  margin: 8px 0;
}

.empty-state {
  text-align: center;
  padding: 32px 28px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.6;
}

/* ── Badges ───────────────────────────────────────────── */

.event-count {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  font-family: var(--font-mono);
  background: var(--accent-dim);
  color: var(--accent);
}

.model-badge {
  font-size: 9px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--accent-green-dim);
  color: var(--accent-green);
  font-family: var(--font-mono);
  letter-spacing: 0.3px;
}

.unread-badge,
.waiting-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  font-family: var(--font-mono);
  background: var(--accent-red-dim);
  color: var(--accent-red);
}

.waiting-badge {
  background: var(--accent-yellow-dim);
  color: var(--accent-yellow);
}

/* ── Calendar Events ──────────────────────────────────── */

.event-item {
  display: flex;
  align-items: stretch;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
  transition: var(--transition);
}

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

.event-item:hover {
  background: rgba(255,255,255,0.04);
  margin: 0 -16px;
  padding-left: 16px;
  padding-right: 16px;
  border-radius: var(--radius-sm);
}

.event-color-bar {
  width: 3px;
  border-radius: 2px;
  flex-shrink: 0;
}

.event-details {
  flex: 1;
  min-width: 0;
}

.event-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.event-time {
  font-size: 11px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  margin-top: 2px;
}

.event-location {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.event-type-label {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 1px 6px;
  border-radius: 3px;
  display: inline-block;
  margin-top: 4px;
}

/* ── Visual Timeline ──────────────────────────────────── */

.timeline {
  display: flex;
  gap: 0;
  position: relative;
  margin-top: 8px;
}

.timeline-hours {
  position: relative;
  width: 38px;
  flex-shrink: 0;
}

.timeline-hour {
  position: absolute;
  font-size: 9px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  transform: translateY(-50%);
  text-align: right;
  width: 34px;
  user-select: none;
}

.timeline-events {
  position: relative;
  flex: 1;
  margin-left: 4px;
}

.timeline-gridline {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border-light);
  opacity: 0.6;
}

.timeline-now {
  position: absolute;
  left: -8px;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  pointer-events: none;
}

.timeline-now-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-red);
  box-shadow: 0 0 6px var(--accent-red), 0 0 12px rgba(248,81,73,0.2);
  flex-shrink: 0;
  animation: pulse-red 2s ease-in-out infinite;
}

@keyframes pulse-red {
  0%, 100% { box-shadow: 0 0 6px var(--accent-red), 0 0 12px rgba(248,81,73,0.2); }
  50% { box-shadow: 0 0 10px var(--accent-red), 0 0 20px rgba(248,81,73,0.35); }
}

.timeline-now-line {
  flex: 1;
  height: 1.5px;
  background: var(--accent-red);
  opacity: 0.6;
}

.timeline-block {
  position: absolute;
  left: 8px;
  right: 0;
  border-left: 3px solid;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 6px 10px;
  overflow: hidden;
  transition: var(--transition);
  cursor: default;
}

.timeline-block:hover {
  filter: brightness(1.3);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.timeline-block.active {
  box-shadow: 0 0 16px rgba(88, 166, 255, 0.1);
  border-left-width: 4px;
}

.timeline-block-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.timeline-block-time {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  opacity: 0.8;
}

.timeline-block-location {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Week Overview ────────────────────────────────────── */

.day-group {
  margin-bottom: 14px;
}

.day-group:last-child {
  margin-bottom: 0;
}

.day-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-light);
}

.day-label.today {
  color: var(--accent);
  border-bottom-color: var(--accent-dim);
}

.day-label .day-event-count {
  font-size: 9px;
  font-weight: 500;
  color: var(--text-muted);
  font-family: var(--font-mono);
  background: var(--bg-elevated);
  padding: 0 5px;
  border-radius: 8px;
}

.week-event {
  font-size: 12px;
  color: var(--text-secondary);
  padding: 5px 0 5px 12px;
  border-left: 2px solid var(--border-light);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: var(--transition-fast);
}

.week-event:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.015);
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
}

/* ── Tab Bar ─────────────────────────────────────────────── */

.tab-bar {
  display: flex;
  gap: 4px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-secondary);
}

.tab-btn {
  background: none;
  border: 1px solid transparent;
  border-radius: 16px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
  padding: 3px 10px;
  cursor: pointer;
  transition: var(--transition-fast);
  font-family: var(--font-sans);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
}

.tab-btn:hover {
  color: var(--text-secondary);
  background: var(--bg-elevated);
}

.tab-btn.active {
  color: var(--accent);
  background: var(--accent-dim);
  border-color: var(--accent-soft);
  font-weight: 600;
}

.task-sort-btn {
  margin-left: auto;
  background: none;
  border: 1px solid var(--border-light);
  border-radius: 16px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 500;
  padding: 3px 8px;
  cursor: pointer;
  transition: var(--transition-fast);
  font-family: var(--font-sans);
  display: flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}
.task-sort-btn:hover {
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border-color: var(--border);
}

.tab-count {
  font-size: 9px;
  font-family: var(--font-mono);
  font-weight: 600;
}

/* ── Action Items (Tasks) ────────────────────────────────── */

.task-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  font-family: var(--font-mono);
  background: var(--accent-red-dim);
  color: var(--accent-red);
}

.task-item {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
  transition: all 0.3s ease;
  cursor: pointer;
}

.task-item:hover {
  background: rgba(255,255,255,0.04);
  margin: 0 -16px;
  padding-left: 16px;
  padding-right: 16px;
  border-radius: var(--radius-sm);
}

.task-expand {
  width: 100%;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
}

.task-item.expanded .task-expand {
  max-height: 400px;
  padding-top: 8px;
}

.task-expand-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.02);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

.task-expand-item {
  display: flex;
  gap: 10px;
  font-size: 11px;
}

.task-expand-label {
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  min-width: 70px;
  flex-shrink: 0;
  padding-top: 1px;
}

.task-expand-value {
  color: var(--text-secondary);
  flex: 1;
  line-height: 1.5;
  word-wrap: break-word;
}

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

.task-check {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  border-radius: 50%;
  transition: var(--transition-fast);
  flex-shrink: 0;
  margin-top: 1px;
}

.task-check:hover {
  color: var(--accent-green);
  background: var(--accent-green-dim);
}

.task-details {
  flex: 1;
  min-width: 0;
}

.task-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
}

.task-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 3px;
  flex-wrap: wrap;
}

.priority-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
}

.priority-high {
  background: var(--accent-red);
  box-shadow: 0 0 4px var(--accent-red);
  animation: priority-ring 2s ease-in-out infinite;
}
.priority-medium { background: var(--accent-yellow); box-shadow: 0 0 4px var(--accent-yellow); }
.priority-low { background: var(--text-muted); }

@keyframes priority-ring {
  0%, 100% { box-shadow: 0 0 4px var(--accent-red), 0 0 0 0 rgba(248,113,113,0.4); }
  50% { box-shadow: 0 0 4px var(--accent-red), 0 0 0 4px rgba(248,113,113,0); }
}

.task-project {
  font-size: 9px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 1px 6px;
  border-radius: 3px;
}

.task-due {
  font-size: 9px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ── Type Indicators & Badges ────────────────────────────── */

.type-indicator {
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 1px 6px;
  border-radius: 3px;
}

.type-waiting {
  background: var(--accent-yellow-dim);
  color: var(--accent-yellow);
}

.type-followup {
  background: var(--accent-purple-dim);
  color: var(--accent-purple);
}

.type-today {
  background: var(--accent-green-dim);
  color: var(--accent-green);
  animation: pulse-badge 2s ease-in-out infinite;
}

@keyframes pulse-badge {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.overdue-label {
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--accent-red-dim);
  color: var(--accent-red);
}

.waiting-person {
  font-size: 10px;
  color: var(--text-secondary);
  font-weight: 500;
}

.waiting-days {
  font-size: 9px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

/* Category badges */
.category-badge {
  font-size: 8px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--bg-elevated);
  color: var(--text-muted);
}

.cat-client { background: #7986cb15; color: #7986cb; }
.cat-production { background: #e4c44115; color: #e4c441; }
.cat-admin { background: #58a6ff15; color: #58a6ff; }
.cat-personal { background: #f4511e15; color: #f4511e; }

/* ── Escalation States (Waiting-On) ──────────────────────── */

.item-waiting {
  border-left: 3px solid transparent;
  padding-left: 8px;
  margin-left: -11px;
}

.escalation-warn { border-left-color: var(--accent-yellow); }
.escalation-warn .waiting-days { color: var(--accent-yellow); }

.escalation-high { border-left-color: var(--accent-red); }
.escalation-high .waiting-days { color: var(--accent-red); font-weight: 600; }

.escalation-critical {
  border-left-color: var(--accent-red);
  animation: escalation-pulse 1.5s ease-in-out infinite;
}
.escalation-critical .waiting-days { color: var(--accent-red); font-weight: 700; }

@keyframes escalation-pulse {
  0%, 100% { border-left-color: var(--accent-red); }
  50% { border-left-color: transparent; }
}

/* ── Overdue / Due-Today States ──────────────────────────── */

.item-overdue {
  border-left: 3px solid var(--accent-red);
  padding-left: 8px;
  margin-left: -11px;
}

.item-due-today {
  border-left: 3px solid var(--accent-yellow);
  padding-left: 8px;
  margin-left: -11px;
}

/* ── Today's Priorities ──────────────────────────────────── */

.priority-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
  transition: var(--transition);
}

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

.priority-item:hover {
  background: rgba(255,255,255,0.04);
  margin: 0 -16px;
  padding-left: 16px;
  padding-right: 16px;
  border-radius: var(--radius-sm);
}

.priority-item .priority-dot {
  margin-top: 5px;
}

.priority-details {
  flex: 1;
  min-width: 0;
}

.priority-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.4;
  display: block;
}

.priority-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 3px;
  flex-wrap: wrap;
}

.priority-clear {
  padding: 20px 28px;
  color: var(--accent-green);
  font-weight: 500;
}

/* ── Upcoming Deadlines ──────────────────────────────────── */

.deadline-group {
  margin-bottom: 12px;
}

.deadline-group:last-child {
  margin-bottom: 0;
}

.deadline-date {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 1px;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-light);
}

.deadline-date.deadline-urgent {
  color: var(--accent-red);
  border-bottom-color: var(--accent-red-dim);
}

.deadline-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0 5px 12px;
  border-left: 2px solid var(--border-light);
  margin-bottom: 2px;
  transition: var(--transition-fast);
}

.deadline-item:hover {
  background: rgba(255,255,255,0.015);
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
}

.deadline-title {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

#view-home #tasks .panel-content {
  max-height: 340px;
}

#view-tasks #tasks .panel-content {
  max-height: none;
}

#waiting-on .panel-content {
  max-height: 220px;
}

#shoot-log .panel-content {
  max-height: 220px;
}

/* ── Inbox Panel ─────────────────────────────────────────── */

.inbox-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
  transition: var(--transition);
  cursor: pointer;
}

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

.inbox-item:hover {
  background: rgba(255,255,255,0.04);
  margin: 0 -16px;
  padding-left: 16px;
  padding-right: 16px;
  border-radius: var(--radius-sm);
}

.inbox-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
  margin-top: 2px;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.06);
}

.inbox-details {
  flex: 1;
  min-width: 0;
}

.inbox-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.inbox-sender {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.inbox-time {
  font-size: 9px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  flex-shrink: 0;
}

.inbox-subject {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
  line-height: 1.3;
}

.inbox-snippet {
  font-size: 11px;
  color: var(--text-muted);
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
  line-height: 1.3;
}

#inbox .panel-content {
  max-height: 340px;
}

/* ── Waiting On Panel (Dedicated) ────────────────────────── */

.waiting-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
  border-left: 3px solid transparent;
  padding-left: 10px;
  margin-left: -10px;
  transition: var(--transition);
  cursor: pointer;
}

.waiting-item.expanded .task-expand {
  max-height: 400px;
  padding-top: 8px;
}

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

.waiting-item.escalation-warn {
  border-left-color: var(--accent-yellow);
}

.waiting-item.escalation-high {
  border-left-color: var(--accent-red);
}

.waiting-item.escalation-critical {
  border-left-color: var(--accent-red);
  animation: escalation-pulse 1.5s ease-in-out infinite;
}

.waiting-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.waiting-person-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.waiting-days-badge {
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font-mono);
  padding: 1px 8px;
  border-radius: 10px;
  background: var(--bg-elevated);
  color: var(--text-muted);
}

.waiting-days-badge.escalation-warn {
  background: var(--accent-yellow-dim);
  color: var(--accent-yellow);
  animation: none;
}

.waiting-days-badge.escalation-high {
  background: var(--accent-red-dim);
  color: var(--accent-red);
  animation: none;
}

.waiting-days-badge.escalation-critical {
  background: var(--accent-red-dim);
  color: var(--accent-red);
  animation: pulse-badge 1.5s ease-in-out infinite;
}

.waiting-item-title {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 4px;
  line-height: 1.4;
}

.waiting-resolve {
  background: none;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 500;
  padding: 2px 10px;
  cursor: pointer;
  margin-top: 6px;
  transition: var(--transition-fast);
  font-family: var(--font-sans);
}

.waiting-resolve:hover {
  color: var(--accent-green);
  border-color: var(--accent-green);
  background: var(--accent-green-dim);
}

/* ── Email Intelligence Panel ────────────────────────────── */

.intel-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  font-family: var(--font-mono);
  background: var(--accent-purple-dim);
  color: var(--accent-purple);
}

#email-intel .panel-content {
  max-height: 280px;
}

.intel-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
  border-left: 3px solid transparent;
  padding-left: 10px;
  margin-left: -10px;
  transition: var(--transition);
}

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

.intel-item.escalation-warn { border-left-color: var(--accent-yellow); }
.intel-item.escalation-high { border-left-color: var(--accent-red); }
.intel-item.escalation-critical {
  border-left-color: var(--accent-red);
  animation: escalation-pulse 1.5s ease-in-out infinite;
}

.intel-item-compact {
  padding: 6px 0;
  padding-left: 10px;
}

.intel-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.intel-person {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.intel-subject {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.intel-pattern {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

.intel-days-badge {
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font-mono);
  padding: 1px 8px;
  border-radius: 10px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  flex-shrink: 0;
}

.intel-days-badge.escalation-warn {
  background: var(--accent-yellow-dim);
  color: var(--accent-yellow);
  animation: none;
}

.intel-days-badge.escalation-high {
  background: var(--accent-red-dim);
  color: var(--accent-red);
  animation: none;
}

.intel-days-badge.escalation-critical {
  background: var(--accent-red-dim);
  color: var(--accent-red);
  animation: pulse-badge 1.5s ease-in-out infinite;
}

.intel-confidence {
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font-mono);
  padding: 1px 8px;
  border-radius: 10px;
  background: var(--accent-purple-dim);
  color: var(--accent-purple);
  flex-shrink: 0;
}

.intel-status {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 1px 6px;
  border-radius: 3px;
  flex-shrink: 0;
}

.intel-status-waiting {
  background: var(--accent-yellow-dim);
  color: var(--accent-yellow);
}

.intel-status-tracking {
  background: var(--bg-elevated);
  color: var(--text-muted);
}

.intel-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.intel-action-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 500;
  padding: 2px 10px;
  cursor: pointer;
  transition: var(--transition-fast);
  font-family: var(--font-sans);
}

.intel-action-btn:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
  background: var(--bg-elevated);
}

.intel-draft:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
}

.intel-dismiss:hover {
  color: var(--text-muted);
  border-color: var(--text-muted);
}

.intel-approve:hover {
  color: var(--accent-green);
  border-color: var(--accent-green);
  background: var(--accent-green-dim);
}

.intel-reject:hover {
  color: var(--accent-red);
  border-color: var(--accent-red);
  background: var(--accent-red-dim);
}

/* ── Task Search Bar ────────────────────────────────────── */

.task-search-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-bottom: 1px solid var(--border-light);
}

.task-search-icon {
  color: var(--text-muted);
  flex-shrink: 0;
}

.task-search-input {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 12px;
  font-family: var(--font-sans);
  outline: none;
  width: 100%;
  padding: 2px 0;
}

.task-search-input::placeholder {
  color: var(--text-muted);
}

/* ── Task Archive + Delete ──────────────────────────────── */

.task-archive-bar {
  padding: 6px 0 10px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 4px;
}

.task-archive-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 11px;
  font-family: var(--font-sans);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition-fast);
}

.task-archive-btn:hover {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: var(--accent);
}

.task-expand-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 8px;
  margin-top: 6px;
  border-top: 1px solid var(--border-light);
}

.task-delete-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  font-family: var(--font-sans);
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: var(--transition-fast);
}

.task-delete-btn:hover {
  color: var(--accent-red);
  background: var(--accent-red-dim);
}

/* ── Task Snooze Menu ────────────────────────────────────── */

.snooze-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 1px 3px;
  border-radius: var(--radius-xs);
  transition: var(--transition-fast);
  opacity: 0;
}

@media (max-width: 768px) {
  .snooze-btn {
    opacity: 0.6;
  }
}

.task-item:hover .snooze-btn {
  opacity: 0.6;
}

.snooze-btn:hover {
  opacity: 1 !important;
  color: var(--accent);
  background: var(--accent-dim);
}

.snooze-menu {
  position: fixed;
  z-index: 500;
  background: var(--bg-depth-3);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: fade-in 0.15s ease-out;
}

.snooze-menu button {
  background: none;
  border: none;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
  font-size: 11px;
  font-family: var(--font-sans);
  padding: 8px 16px;
  cursor: pointer;
  text-align: left;
  transition: var(--transition-fast);
  white-space: nowrap;
}

.snooze-menu button:last-child {
  border-bottom: none;
}

.snooze-menu button:hover {
  background: var(--accent-dim);
  color: var(--accent);
}

/* ── Financial KPIs Placeholder ──────────────────────────── */

.panel-placeholder {
  opacity: 0.6;
}

.panel-placeholder:hover {
  opacity: 0.8;
}

.financial-placeholder {
  padding: 8px 0;
}

.financial-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border-light);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 12px;
}

.financial-metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 8px;
  background: var(--bg-panel);
}

.financial-metric-value {
  font-size: 18px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.financial-metric-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  font-weight: 500;
}

.financial-connect {
  text-align: center;
  font-size: 10px;
  color: var(--text-muted);
  padding: 4px 0;
  font-style: italic;
}

.financial-metric-value.fin-active {
  color: var(--text-primary);
}

.financial-metric-value.fin-overdue-val {
  color: var(--accent-red);
}

.fin-trend {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  justify-content: center;
  padding: 8px 12px 4px;
}

.fin-trend-bar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  gap: 2px;
}

.fin-trend-bar {
  width: 100%;
  max-width: 24px;
  background: var(--accent-green);
  border-radius: 2px 2px 0 0;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.fin-trend-bar-wrap:hover .fin-trend-bar {
  opacity: 1;
}

.fin-trend-label {
  font-size: 8px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.fin-overdue {
  padding: 6px 12px;
  border-top: 1px solid var(--border-light);
  margin-top: 4px;
}

.fin-overdue-header {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--accent-red);
  font-weight: 600;
  margin-bottom: 4px;
}

.fin-overdue-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
  font-size: 11px;
}

.fin-overdue-name {
  flex: 1;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fin-overdue-amount {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent-red);
  font-size: 11px;
}

.fin-overdue-date {
  font-size: 9px;
  color: var(--text-muted);
  white-space: nowrap;
}

.fin-sync-time {
  text-align: right;
  font-size: 9px;
  color: var(--text-muted);
  padding: 4px 12px 2px;
}

/* ── Shoot Log ────────────────────────────────────────── */

.shoot-item {
  padding: 8px 0;
  border-bottom: 1px solid var(--border-light);
  transition: var(--transition);
  cursor: pointer;
}

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

.shoot-item:hover {
  background: rgba(255,255,255,0.015);
}

.shoot-row-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.shoot-left {
  flex: 1;
  min-width: 0;
}

.shoot-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}

.shoot-name {
  font-weight: 700;
  font-size: 13px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shoot-sub {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 2px;
}

.shoot-date {
  font-size: 9px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.shoot-progress {
  width: 50px;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.shoot-progress-bar {
  height: 100%;
  border-radius: 2px;
  transition: width 0.5s ease;
}

.bar-complete { background: var(--accent-green); }
.bar-partial { background: var(--accent-yellow); }
.bar-empty { background: transparent; }

.shoot-expand {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
}

.shoot-item.expanded .shoot-expand {
  max-height: 200px;
  padding-top: 8px;
}

.shoot-detail-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
}

.shoot-detail-item {
  display: flex;
  gap: 8px;
  font-size: 11px;
}

.shoot-detail-label {
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 9px;
  letter-spacing: 0.5px;
  min-width: 50px;
  padding-top: 1px;
}

.shoot-detail-value {
  color: var(--text-secondary);
  flex: 1;
  line-height: 1.4;
}

.shoot-detail-value em {
  color: var(--accent-yellow);
  font-style: normal;
  font-size: 10px;
}

/* ── Projects (Card-based) ────────────────────────────── */

.projects-card-area {
  padding: 10px 14px !important;
}

.nav-arrow {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
  line-height: 1;
}

.nav-arrow:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

.project-counter {
  font-size: 9px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  padding: 2px 6px;
}

.project-card {
  animation: card-in 0.25s ease-out;
}

@keyframes card-in {
  from { opacity: 0; transform: translateX(10px); }
  to { opacity: 1; transform: translateX(0); }
}

.project-card-top {
  margin-bottom: 10px;
}

.project-card-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.project-card-client {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.project-card-badges {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.stage-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 12px;
  letter-spacing: 0.3px;
}

.type-badge {
  font-size: 9px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 12px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.stage-track {
  display: flex;
  gap: 3px;
  margin-bottom: 12px;
  padding: 8px 0;
}

.stage-dot {
  width: 100%;
  height: 5px;
  border-radius: 3px;
  background: var(--border);
  transition: var(--transition);
}

.stage-dot.stage-completed {
  background: var(--accent);
  opacity: 0.4;
}

.stage-dot.stage-active {
  transform: scaleY(1.8) scaleX(1.1);
  box-shadow: 0 0 8px currentColor;
}

.project-card-fields {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.project-field {
  display: flex;
  gap: 8px;
  font-size: 11px;
  line-height: 1.4;
}

.project-field-label {
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 9px;
  letter-spacing: 0.5px;
  min-width: 40px;
  padding-top: 1px;
  flex-shrink: 0;
}

.project-field-value {
  color: var(--text-secondary);
  flex: 1;
}

.project-card-footer {
  margin-top: 12px;
  padding-top: 8px;
  border-top: 1px solid var(--border-light);
  font-size: 9px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.project-expand-hint {
  font-size: 9px;
  color: var(--text-muted);
  opacity: 0.5;
  font-family: var(--font-sans);
  transition: opacity 0.15s ease;
}

.project-card-footer:hover .project-expand-hint {
  opacity: 1;
}

.project-card.expanded .project-expand-hint {
  display: none;
}

.project-expand {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, padding 0.3s ease;
}

.project-card.expanded .project-expand {
  max-height: 400px;
  padding-top: 10px;
}

/* ── Stalled Project Badge ──────────────────────────────── */

.stalled-badge {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 12px;
  background: var(--accent-red-dim);
  color: var(--accent-red);
  animation: pulse-badge 2s ease-in-out infinite;
}

/* ── Invoice Badges & QB Source Tags ───────────────────── */

.invoice-badge {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 2px 8px;
  border-radius: 12px;
  background: rgba(99, 102, 241, 0.15);
  color: rgb(129, 140, 248);
}

.invoice-badge.invoice-overdue {
  background: var(--accent-red-dim);
  color: var(--accent-red);
  animation: pulse-badge 2s ease-in-out infinite;
}

.source-qb {
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.15);
  color: rgb(52, 211, 153);
  margin-right: 4px;
}

/* ── Pipeline View ────────────────────────────────────── */

.view-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 3px 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition-fast);
}

.view-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

.view-toggle.active {
  border-color: var(--accent-purple);
  color: var(--accent-purple);
  background: var(--accent-purple-dim);
}

.pipeline-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.pipeline-stalled-count {
  color: var(--accent-red);
  font-weight: 600;
}

.pipeline-stage {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.pipeline-stage-label {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  width: 60px;
  flex-shrink: 0;
  text-align: right;
}

.pipeline-stage-bar-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pipeline-stage-bar {
  height: 20px;
  border-radius: 4px;
  background: var(--accent-purple-dim);
  border: 1px solid rgba(163, 113, 247, 0.15);
  display: flex;
  align-items: center;
  padding: 0 6px;
  transition: width 0.5s ease;
}

.pipeline-dots {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.pipeline-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-purple);
  opacity: 0.7;
  transition: var(--transition-fast);
}

.pipeline-dot:hover {
  opacity: 1;
  transform: scale(1.3);
}

.pipeline-dot.stalled {
  background: var(--accent-red);
  opacity: 1;
  animation: pulse-red 2s ease-in-out infinite;
}

.pipeline-stage-count {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  flex-shrink: 0;
}

/* ── Completed Task Styles ────────────────────────────── */

.task-completed {
  opacity: 0.6;
}

.task-completed:hover {
  opacity: 0.85;
}

.task-title-done {
  text-decoration: line-through;
  color: var(--text-muted) !important;
}

.task-check-done svg circle {
  stroke: var(--accent-green, #4ade80);
}

.task-check-done svg path {
  stroke: var(--accent-green, #4ade80);
}

.task-check-done:hover svg circle {
  stroke: var(--accent-yellow, #facc15);
}

.task-check-done:hover svg path {
  stroke: var(--accent-yellow, #facc15);
}

/* ── Task Completion Animation ─────────────────────────── */

.task-item.completing,
.waiting-item.completing {
  opacity: 0;
  transform: translateX(20px);
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  margin-top: 0;
  margin-bottom: 0;
  overflow: hidden;
  transition: opacity 0.25s ease, transform 0.25s ease, max-height 0.3s 0.15s ease, padding 0.3s 0.15s ease;
}

/* ── Chat History Panel ───────────────────────────────── */

.chat-history-btn {
  border-style: dashed !important;
  opacity: 0.7;
}

.chat-history-btn:hover {
  opacity: 1;
}

.chat-history-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.chat-history-overlay.visible {
  opacity: 1;
  pointer-events: all;
}

.chat-history-panel {
  background: var(--surface-1, #1a1a1e);
  border: 1px solid var(--border, #333);
  border-radius: 14px;
  width: 90%;
  max-width: 640px;
  height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  animation: historyIn 0.25s ease;
}

@keyframes historyIn {
  from { opacity: 0; transform: scale(0.96) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.chat-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border, #333);
}

.chat-history-header h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary, #e5e5e5);
}

.chat-history-close {
  background: none;
  border: none;
  color: var(--text-muted, #999);
  font-size: 20px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.15s ease;
}

.chat-history-close:hover {
  color: var(--text-primary, #e5e5e5);
}

.chat-history-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-history-msg {
  max-width: 85%;
}

.chat-history-user {
  align-self: flex-end;
}

.chat-history-assistant {
  align-self: flex-start;
}

.chat-history-msg-role {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted, #999);
  margin-bottom: 3px;
}

.chat-history-user .chat-history-msg-role {
  text-align: right;
}

.chat-history-msg-content {
  font-size: 13px;
  line-height: 1.5;
  padding: 10px 14px;
  border-radius: 12px;
}

.chat-history-user .chat-history-msg-content {
  background: var(--accent-blue-dim, rgba(91, 156, 245, 0.1));
  color: var(--text-primary, #e5e5e5);
  border-bottom-right-radius: 4px;
}

.chat-history-assistant .chat-history-msg-content {
  background: var(--surface-2, #2a2a2e);
  color: var(--text-primary, #e5e5e5);
  border-bottom-left-radius: 4px;
}

.chat-history-assistant .chat-history-msg-content p {
  margin: 0 0 8px;
}

.chat-history-assistant .chat-history-msg-content p:last-child {
  margin-bottom: 0;
}

.chat-history-load-more {
  display: block;
  margin: 0 auto;
  padding: 8px 20px;
  background: none;
  border: 1px solid var(--border, #333);
  border-radius: 8px;
  color: var(--text-muted, #999);
  font-size: 12px;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all 0.15s ease;
}

.chat-history-load-more:hover {
  color: var(--text-primary, #e5e5e5);
  border-color: var(--text-muted, #999);
}

@media (max-width: 768px) {
  .chat-history-panel {
    width: 100%;
    height: 100%;
    max-width: none;
    border-radius: 0;
  }
}

/* ── Notification Center ─────────────────────────────── */

.notif-bell {
  position: relative;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  transition: color 0.2s;
}

.notif-bell:hover {
  color: var(--text-primary);
}

.notif-badge {
  position: absolute;
  top: -2px;
  right: -4px;
  background: var(--accent-red);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  min-width: 14px;
  height: 14px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  font-family: var(--font-mono);
}

.notif-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  width: 320px;
  max-height: 400px;
  background: var(--bg-depth-3);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
  z-index: 9000;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.2s, transform 0.2s;
  overflow: hidden;
}

.notif-dropdown.visible {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

.notif-header {
  padding: 10px 14px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.notif-clear-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 10px;
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  transition: background 0.15s;
}
.notif-clear-btn:hover {
  background: rgba(96,165,250,0.1);
}

.notif-list {
  max-height: 340px;
  overflow-y: auto;
}

.notif-empty {
  padding: 20px 14px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

.notif-item {
  display: flex;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-light);
  border-left: 3px solid transparent;
  transition: background 0.15s;
}

.notif-item:hover {
  background: rgba(255, 255, 255, 0.03);
}

.notif-item[data-type="overdue"] { border-left-color: var(--accent-red); }
.notif-item[data-type="stale"] { border-left-color: var(--accent-yellow); }
.notif-item[data-type="email"] { border-left-color: var(--accent-purple); }
.notif-item[data-type="shoot"] { border-left-color: var(--accent-green); }
.notif-item[data-type="task"] { border-left-color: var(--accent); }

.notif-icon {
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--text-muted);
}
.notif-item[data-type="overdue"] .notif-icon { color: var(--accent-red); }
.notif-item[data-type="stale"] .notif-icon { color: var(--accent-yellow); }
.notif-item[data-type="email"] .notif-icon { color: var(--accent-purple); }
.notif-item[data-type="shoot"] .notif-icon { color: var(--accent-green); }

.notif-text {
  flex: 1;
  min-width: 0;
}

.notif-title {
  font-size: 12px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notif-detail {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notif-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.notif-act-btn {
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  border: none;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  color: #fff;
}
.notif-act-btn:hover { opacity: 0.85; }

.notif-act-complete { background: var(--accent-green); color: #000; }
.notif-act-snooze { background: rgba(255,255,255,0.08); color: var(--text-secondary); }
.notif-act-draft { background: var(--accent); }
.notif-act-dismiss { background: rgba(255,255,255,0.08); color: var(--text-muted); }
.notif-act-approve { background: var(--accent-green); color: #000; }
.notif-act-reject { background: rgba(255,255,255,0.08); color: var(--text-muted); }

/* ── Analytics Overlay ────────────────────────────────── */

.analytics-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.analytics-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.analytics-panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-light);
  border-radius: 14px;
  width: 94%;
  max-width: 1100px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

.analytics-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
}

.analytics-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.analytics-view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.analytics-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-depth-0);
  border-radius: 8px;
  padding: 3px;
}

.analytics-tab {
  padding: 5px 14px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.15s;
}
.analytics-tab:hover { color: var(--text-secondary); }
.analytics-tab.active {
  background: var(--bg-depth-2);
  color: var(--text-primary);
}

.analytics-chart-wrap {
  width: 100%;
  min-height: 260px;
  margin: 8px 0;
}

.analytics-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 0 4px;
}

.analytics-content {
  padding: 20px;
  overflow-y: auto;
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.analytics-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
}

.analytics-value {
  font-size: 28px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

.analytics-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  margin-top: 4px;
}

.analytics-delta {
  font-size: 11px;
  margin-top: 6px;
  color: var(--text-muted);
}

.delta-up { color: var(--accent-green); }
.delta-down { color: var(--accent-red); }
.delta-flat { color: var(--text-muted); }

.analytics-section {
  margin-bottom: 20px;
}

.analytics-section h4 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  margin: 0 0 10px 0;
  font-weight: 600;
}

.analytics-chart-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.analytics-chart-row .analytics-section {
  margin-bottom: 0;
}

.analytics-mini-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 8px;
}

.analytics-mini-grid .analytics-card {
  padding: 10px 8px;
}

.analytics-mini-grid .analytics-value {
  font-size: 18px;
}

.analytics-mini-grid .analytics-label {
  font-size: 9px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.analytics-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.analytics-bar-label {
  font-size: 11px;
  color: var(--text-secondary);
  min-width: 100px;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.analytics-bar-track {
  flex: 1;
  height: 20px;
  background: var(--bg-depth-0);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.analytics-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
  min-width: 2px;
}

.analytics-bar-count {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  min-width: 30px;
}

.sparkline {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  justify-content: center;
  padding: 4px 0;
}

.spark-bar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  gap: 4px;
}

.spark-bar {
  width: 100%;
  max-width: 40px;
  background: var(--accent);
  border-radius: 3px 3px 0 0;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.spark-bar-wrap:hover .spark-bar {
  opacity: 1;
}

.spark-bar-created {
  background: var(--accent-purple);
}

.spark-label {
  font-size: 9px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

@media (max-width: 900px) {
  .analytics-panel {
    width: 100%;
    height: 100%;
    max-width: none;
    border-radius: 0;
  }
  .analytics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .analytics-chart-row {
    grid-template-columns: 1fr;
  }
}

/* ── Undo Toast ───────────────────────────────────────── */

.undo-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-2, #2a2a2e);
  border: 1px solid var(--border, #333);
  border-radius: 10px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 9999;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  animation: toastIn 0.25s ease;
  font-family: var(--font-sans);
}

.undo-toast-text {
  font-size: 12px;
  color: var(--text-muted, #999);
  white-space: nowrap;
}

.undo-toast-btn {
  background: none;
  border: 1px solid var(--accent-blue, #5b9cf5);
  color: var(--accent-blue, #5b9cf5);
  border-radius: 6px;
  padding: 4px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.undo-toast-btn:hover {
  background: var(--accent-blue, #5b9cf5);
  color: #fff;
}

.undo-toast-exit {
  opacity: 0;
  transform: translateX(-50%) translateY(10px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@media (max-width: 768px) {
  .undo-toast {
    bottom: 80px; /* Above mobile nav bar */
    left: 16px;
    right: 16px;
    transform: none;
  }
  .undo-toast-exit {
    transform: translateY(10px);
  }
  @keyframes toastIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
  }
}

/* ── Email Reader Panel ──────────────────────────────────── */

.email-reader-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.email-reader-overlay.active {
  display: flex;
  justify-content: flex-end;
}

.email-reader-panel {
  width: 55%;
  max-width: 720px;
  height: 100%;
  background: var(--bg-depth-1);
  border-left: 1px solid var(--border);
  border-radius: 16px 0 0 16px;
  display: flex;
  flex-direction: column;
  animation: emailSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.5);
}

@keyframes emailSlideIn {
  from { transform: translateX(100%) scale(0.98); opacity: 0; }
  to { transform: translateX(0) scale(1); opacity: 1; }
}

.email-reader-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border, #333);
  flex-shrink: 0;
}

.email-reader-close {
  background: none;
  border: none;
  color: var(--text-muted, #999);
  font-size: 24px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.15s ease;
}

.email-reader-close:hover {
  color: var(--text-primary, #e5e5e5);
}

.email-reader-gmail {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted, #999);
  text-decoration: none;
  padding: 5px 12px;
  border: 1px solid var(--border, #333);
  border-radius: 6px;
  transition: all 0.15s ease;
}

.email-reader-gmail:hover {
  color: var(--text-primary, #e5e5e5);
  border-color: var(--text-muted, #999);
}

.email-reader-meta {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border, #333);
  flex-shrink: 0;
}

.email-reader-subject {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary, #e5e5e5);
  margin-bottom: 10px;
  line-height: 1.3;
}

.email-reader-from {
  font-size: 13px;
  color: var(--text-primary, #e5e5e5);
  margin-bottom: 2px;
}

.email-reader-address {
  color: var(--text-muted, #999);
  font-size: 12px;
  margin-left: 6px;
}

.email-reader-date {
  font-size: 11px;
  color: var(--text-muted, #999);
  margin-bottom: 6px;
}

.email-reader-to {
  font-size: 11px;
  color: var(--text-muted, #999);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.email-reader-label {
  color: var(--text-muted, #999);
  font-weight: 600;
}

.email-reader-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  min-height: 0;
}

.email-reader-iframe {
  width: 100%;
  height: 100%;
  border: none;
  background: #0d1117;
}

.email-reader-plain {
  margin: 0;
  padding: 20px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-primary, #e5e5e5);
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: var(--font-sans);
}

@media (max-width: 768px) {
  .email-reader-panel {
    width: 100%;
    max-width: none;
  }
}

/* ── Data Freshness Indicator ──────────────────────────── */

#last-refresh {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  opacity: 0.8;
  transition: opacity 0.2s ease;
  letter-spacing: 0.3px;
}

/* ── Chat FAB + Slide-out ────────────────────────────── */

.chat-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, #3d8bfd 100%);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  box-shadow: 0 4px 20px rgba(88,166,255,0.35), 0 2px 8px rgba(0,0,0,0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.chat-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(88,166,255,0.45), 0 4px 12px rgba(0,0,0,0.3);
}

.chat-fab:active {
  transform: scale(0.95);
}

.chat-fab .fab-close {
  display: none;
}

.chat-fab.chat-open .fab-icon {
  display: none;
}

.chat-fab.chat-open .fab-close {
  display: block;
}

.chat-fab-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-primary);
}

.chat-slideout {
  position: fixed;
  top: 0;
  right: -420px;
  bottom: 0;
  width: 400px;
  background: var(--bg-depth-1);
  border-left: 1px solid var(--border);
  z-index: 600;
  display: flex;
  flex-direction: column;
  transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: -8px 0 32px rgba(0,0,0,0.4);
}

.chat-slideout.open {
  right: 0;
}

.chat-slideout-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.chat-slideout-avatar {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent) 0%, #3d8bfd 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 13px;
  color: #fff;
  flex-shrink: 0;
}

.chat-slideout-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
}

.chat-slideout-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}

.chat-slideout-actions button {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: var(--transition-fast);
  display: flex;
  align-items: center;
}

.chat-slideout-actions button:hover {
  background: var(--bg-depth-2);
  color: var(--text-primary);
}

.chat-slideout-quick {
  display: flex;
  gap: 6px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
  overflow-x: auto;
}

.chat-slideout-quick .quick-action {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 500;
  padding: 3px 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-fast);
  font-family: var(--font-sans);
}

.chat-slideout-quick .quick-action:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

.chat-slideout-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-slideout-form {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
  background: var(--bg-surface);
}

.chat-slideout-form input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font-sans);
  outline: none;
  transition: var(--transition);
  min-width: 0;
}

.chat-slideout-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.chat-slideout-form input::placeholder {
  color: var(--text-muted);
}

.chat-slideout-form button[type="submit"] {
  background: linear-gradient(135deg, var(--accent) 0%, #3d8bfd 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  flex-shrink: 0;
}

.chat-slideout-form button[type="submit"]:hover {
  filter: brightness(1.15);
  box-shadow: 0 2px 12px rgba(88,166,255,0.3);
}

.chat-slideout-form button[type="submit"]:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Backdrop when chat slideout is open */
.chat-slideout-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 550;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.chat-slideout-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

/* ── Chat Messages ───────────────────────────────────────── */

.chat-msg {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.6;
  max-width: 88%;
  word-wrap: break-word;
  animation: msg-in 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes msg-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.chat-msg.user {
  background: linear-gradient(135deg, var(--accent) 0%, #3d8bfd 100%);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 8px rgba(88,166,255,0.2);
}

.chat-msg.assistant {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

/* Markdown in chat */
.chat-msg.assistant h1,
.chat-msg.assistant h2,
.chat-msg.assistant h3 {
  color: var(--accent);
  margin: 8px 0 4px;
  font-size: 14px;
}

.chat-msg.assistant h2 { font-size: 13px; }
.chat-msg.assistant h3 { font-size: 12px; }

.chat-msg.assistant ul,
.chat-msg.assistant ol {
  margin: 4px 0;
  padding-left: 20px;
}

.chat-msg.assistant li {
  margin: 2px 0;
}

.chat-msg.assistant code {
  background: var(--bg-primary);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 12px;
}

.chat-msg.assistant pre {
  background: var(--bg-primary);
  padding: 10px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 6px 0;
  border: 1px solid var(--border-light);
}

.chat-msg.assistant pre code {
  padding: 0;
  background: none;
}

.chat-msg.assistant strong {
  color: var(--text-primary);
  font-weight: 600;
}

.chat-msg.assistant p {
  margin: 4px 0;
}

.chat-msg.assistant p:first-child {
  margin-top: 0;
}

.chat-msg.assistant p:last-child {
  margin-bottom: 0;
}

/* Markdown tables */
.md-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  margin: 8px 0;
}
.md-table th {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.md-table td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-secondary);
}
.md-table tr:last-child td { border-bottom: none; }
.md-table tr:hover td { background: rgba(255,255,255,0.02); }

/* Follow-up chips */
.follow-up-chips {
  display: flex;
  gap: 6px;
  padding: 4px 0 2px;
  flex-wrap: wrap;
}
.follow-up-chip {
  font-size: 11px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--accent);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.follow-up-chip:hover {
  background: rgba(96,165,250,0.1);
  border-color: var(--accent);
}

.chat-msg.thinking {
  color: var(--text-muted);
  font-style: italic;
  border: 1px dashed var(--border);
  background: transparent;
  font-size: 12px;
}

.thinking-dots {
  display: inline-flex;
  gap: 3px;
  margin-left: 6px;
  vertical-align: middle;
}

.thinking-dots span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: dot-bounce 1.4s ease-in-out infinite;
}

.thinking-dots span:nth-child(2) { animation-delay: 0.16s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.32s; }

@keyframes dot-bounce {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1.1); }
}

/* ── Scrollbar ────────────────────────────────────────── */

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

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

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ── Transitions ──────────────────────────────────────── */

.panel-content > div {
  animation: fade-in 0.3s ease-out;
}

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

/* ── Skeleton Loading ────────────────────────────────── */

.skeleton {
  background: linear-gradient(90deg,
    var(--bg-secondary) 25%,
    var(--bg-elevated) 50%,
    var(--bg-secondary) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-xs);
}

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

.skeleton-line {
  height: 12px;
  margin-bottom: 8px;
  border-radius: var(--radius-xs);
}

.skeleton-line.short { width: 60%; }
.skeleton-line.medium { width: 80%; }
.skeleton-line.full { width: 100%; }

.skeleton-card {
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  margin-bottom: 8px;
}

/* Contextual skeleton templates */
.skeleton-inbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}

.skeleton-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
}

.skeleton-text-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.skeleton-task-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}

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

.skeleton-badge {
  width: 48px;
  height: 18px;
  border-radius: 10px;
  flex-shrink: 0;
}

/* Empty state illustrations */
.empty-state-icon {
  width: 40px;
  height: 40px;
  margin: 0 auto 10px;
  opacity: 0.25;
  color: var(--text-muted);
}

.empty-state-icon svg {
  width: 100%;
  height: 100%;
}

/* Error state retry */
.error-msg {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.error-retry {
  background: none;
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 500;
  font-family: var(--font-sans);
  padding: 4px 14px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.error-retry:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

/* ── Panel Depth (position context for overlays) ──── */

.panel {
  position: relative;
}

.surface-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.surface-card:hover {
  background: var(--bg-elevated);
  transform: translateY(-1px);
  border-color: var(--border-focus);
}

.overlay-panel {
  background: var(--bg-glass);
  backdrop-filter: blur(24px) saturate(1.3);
  -webkit-backdrop-filter: blur(24px) saturate(1.3);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  box-shadow:
    0 24px 48px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.03),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* ── Staggered List Animations ──────────────────────── */

.stagger-item {
  opacity: 0;
  transform: translateY(8px);
  animation: fadeInUp 0.25s var(--ease-out) forwards;
}

.stagger-item:nth-child(1) { animation-delay: 0ms; }
.stagger-item:nth-child(2) { animation-delay: 50ms; }
.stagger-item:nth-child(3) { animation-delay: 100ms; }
.stagger-item:nth-child(4) { animation-delay: 150ms; }
.stagger-item:nth-child(5) { animation-delay: 200ms; }
.stagger-item:nth-child(6) { animation-delay: 250ms; }
.stagger-item:nth-child(7) { animation-delay: 300ms; }
.stagger-item:nth-child(8) { animation-delay: 350ms; }

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

/* ── Inline Task Form ───────────────────────────────── */

.inline-task-form {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-depth-2);
  animation: fadeInUp 0.15s ease-out;
}

.inline-task-input {
  width: 100%;
  background: var(--bg-depth-0);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  padding: 8px 10px;
  outline: none;
  margin-bottom: 8px;
}

.inline-task-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

.inline-task-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.inline-task-select {
  background: var(--bg-depth-0);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 11px;
  padding: 4px 8px;
  outline: none;
}

.inline-task-date {
  background: var(--bg-depth-0);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 4px 8px;
  outline: none;
}

.inline-task-priorities {
  display: flex;
  gap: 4px;
}

.inline-pri-btn {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: var(--transition-fast);
  opacity: 0.4;
}

.inline-pri-btn.active {
  opacity: 1;
  border-color: #fff;
  transform: scale(1.2);
}

.inline-task-submit {
  background: var(--accent);
  border: none;
  border-radius: var(--radius-xs);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-sans);
  padding: 5px 14px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.inline-task-submit:hover {
  background: var(--accent-hover);
}

.inline-task-cancel {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  color: var(--text-muted);
  font-size: 11px;
  font-family: var(--font-sans);
  padding: 4px 12px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.inline-task-cancel:hover {
  border-color: var(--text-secondary);
  color: var(--text-secondary);
}

/* ── Focus Mode / Today View ────────────────────────── */

.focus-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--bg-depth-0);
  z-index: 3000;
  overflow-y: auto;
}

.focus-overlay.active {
  display: block;
  animation: fade-in 0.2s ease-out;
}

.focus-panel {
  max-width: 680px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

.focus-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.focus-header h3 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--text-primary);
}

.focus-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.15s;
}
.focus-close:hover {
  background: var(--bg-depth-2);
  color: var(--text-primary);
}

.focus-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Focus blocks */
.focus-block {
  background: var(--bg-depth-1);
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow: 0 0 0 1px var(--border), var(--shadow-sm);
}

.focus-block-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.focus-block-header svg {
  opacity: 0.6;
}

/* Right Now block — current/next event */
.focus-now {
  border-left: 3px solid var(--accent);
}

.focus-now-event {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.focus-now-meta {
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  gap: 12px;
  align-items: center;
}

.focus-now-countdown {
  font-weight: 700;
  color: var(--accent);
}

/* Focus task cards */
.focus-task {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.focus-task:last-child { border-bottom: none; }

.focus-task-rank {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  flex-shrink: 0;
}
.focus-task-rank.rank-1 { background: rgba(96,165,250,0.15); color: var(--accent); }
.focus-task-rank.rank-2 { background: rgba(96,165,250,0.10); color: var(--accent); opacity: 0.8; }
.focus-task-rank.rank-3 { background: rgba(96,165,250,0.06); color: var(--accent); opacity: 0.6; }

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

.focus-task-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.focus-task-meta {
  font-size: 11px;
  color: var(--text-muted);
}

.focus-task-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.focus-task-btn {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
}
.focus-task-btn:hover {
  background: var(--bg-depth-2);
  color: var(--text-primary);
}
.focus-task-btn.complete {
  border-color: var(--accent-green);
  color: var(--accent-green);
}
.focus-task-btn.complete:hover {
  background: rgba(63,185,80,0.1);
}

/* Focus email items */
.focus-email {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  cursor: pointer;
  transition: background 0.15s;
  border-radius: 6px;
  padding-left: 6px;
  margin: 0 -6px;
}
.focus-email:hover { background: var(--bg-depth-2); }
.focus-email:last-child { border-bottom: none; }

.focus-email-from {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  width: 120px;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.focus-email-subject {
  font-size: 12px;
  color: var(--text-secondary);
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.focus-email-action {
  font-size: 11px;
  color: var(--accent);
  white-space: nowrap;
  padding: 3px 8px;
  border: 1px solid rgba(96,165,250,0.3);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.focus-email-action:hover {
  background: rgba(96,165,250,0.1);
}

/* Focus blocked items */
.focus-blocked {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.focus-blocked:last-child { border-bottom: none; }

.focus-blocked-days {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-red);
  min-width: 40px;
}

.focus-blocked-title {
  font-size: 13px;
  color: var(--text-primary);
  flex: 1;
}

.focus-blocked-who {
  font-size: 11px;
  color: var(--text-muted);
}

.focus-empty {
  text-align: center;
  padding: 12px;
  font-size: 12px;
  color: var(--text-muted);
  opacity: 0.7;
}

/* ── Project Detail Slide-Out ──────────────────────── */

.project-detail-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2500;
}
.project-detail-overlay.active { display: flex; }

.project-detail-backdrop {
  flex: 1;
  background: rgba(0,0,0,0.4);
}

.project-detail-panel {
  width: min(480px, 85vw);
  height: 100%;
  background: var(--bg-depth-1);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  animation: slideInRight 0.25s ease-out;
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.project-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-depth-1);
  z-index: 1;
}

.project-detail-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-detail-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  transition: all 0.15s;
}
.project-detail-close:hover {
  background: var(--bg-depth-2);
  color: var(--text-primary);
}

.project-detail-content {
  padding: 16px 20px;
}

.pd-section {
  margin-bottom: 20px;
}

.pd-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.pd-stage-track {
  display: flex;
  gap: 3px;
  margin-bottom: 12px;
}

.pd-stage-dot {
  flex: 1;
  height: 5px;
  border-radius: 3px;
  background: rgba(255,255,255,0.06);
}
.pd-stage-dot.completed { background: var(--accent); opacity: 0.6; }
.pd-stage-dot.current { background: var(--accent); transform: scaleY(1.4); }

.pd-info-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.pd-info-label { color: var(--text-muted); }
.pd-info-value { color: var(--text-primary); font-weight: 500; }

.pd-task-item {
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 12px;
}
.pd-task-item:last-child { border-bottom: none; }

.pd-task-title {
  color: var(--text-primary);
  font-weight: 500;
}

.pd-task-meta {
  color: var(--text-muted);
  font-size: 10px;
  margin-top: 2px;
}

.pd-email-item {
  padding: 6px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-size: 12px;
}
.pd-email-item:last-child { border-bottom: none; }

.pd-email-subject {
  color: var(--text-primary);
  font-weight: 500;
}

.pd-email-meta {
  color: var(--text-muted);
  font-size: 10px;
  margin-top: 2px;
}

.pd-notes {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  white-space: pre-wrap;
  background: var(--bg-depth-0);
  padding: 10px 12px;
  border-radius: 8px;
  max-height: 200px;
  overflow-y: auto;
}

/* ── Client Health Panel ───────────────────────────── */

.client-health-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.client-health-card:last-child { border-bottom: none; }

.client-health-ring {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  flex-shrink: 0;
  position: relative;
}

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

.client-health-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.client-health-meta {
  font-size: 10px;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
  margin-top: 2px;
}

.client-health-action {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 10px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.client-health-action:hover {
  background: var(--bg-depth-2);
  color: var(--text-primary);
}

/* ── Command Palette ────────────────────────────────── */

.cmd-palette-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  align-items: flex-start;
  justify-content: center;
  padding-top: 18vh;
}

.cmd-palette-overlay.active {
  display: flex;
  animation: fade-in 0.15s ease-out;
}

.cmd-palette {
  width: min(600px, 90vw);
  max-height: min(480px, 60vh);
  background: var(--bg-depth-3);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius);
  box-shadow: 0 16px 64px rgba(0, 0, 0, 0.6), 0 0 0 1px var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: fadeInUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.cmd-palette-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.cmd-search-icon {
  color: var(--text-muted);
  flex-shrink: 0;
}

#cmd-palette-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 500;
}

#cmd-palette-input::placeholder {
  color: var(--text-muted);
}

.cmd-shortcut {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  background: var(--bg-depth-1);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  flex-shrink: 0;
}

.cmd-palette-results {
  overflow-y: auto;
  max-height: calc(60vh - 60px);
  padding: 6px;
}

.cmd-category {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  padding: 8px 10px 4px;
}

.cmd-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.1s;
}

.cmd-item:hover, .cmd-item.active {
  background: var(--accent-dim);
}

.cmd-item.active {
  background: var(--accent-soft);
}

.cmd-item-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: var(--bg-depth-1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-secondary);
}

.cmd-item-text {
  flex: 1;
  min-width: 0;
}

.cmd-item-title {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
}

.cmd-item-desc {
  font-size: 11px;
  color: var(--text-muted);
}

.cmd-item-shortcut {
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .skeleton { animation: none; background: var(--bg-secondary); }
}

/* ── Center Chat Panel ────────────────────────────────── */

.chat-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.chat-panel .panel-header {
  flex-shrink: 0;
}

.chat-panel .panel-header .panel-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.chat-panel .panel-actions .quick-action {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 500;
  padding: 3px 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition-fast);
  font-family: var(--font-sans);
}

.chat-panel .panel-actions .quick-action:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

.chat-panel-content {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 0 !important;
}

.chat-messages-area {
  height: 100%;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-panel-form {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--border-light);
  flex-shrink: 0;
  background: var(--bg-surface);
}

.chat-panel-form #chat-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font-sans);
  outline: none;
  transition: var(--transition);
  min-width: 0;
}

.chat-panel-form #chat-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.chat-panel-form #chat-input::placeholder {
  color: var(--text-muted);
}

.chat-panel-form #chat-submit {
  background: linear-gradient(135deg, var(--accent) 0%, #3d8bfd 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  flex-shrink: 0;
}

.chat-panel-form #chat-submit:hover {
  filter: brightness(1.15);
  box-shadow: 0 2px 12px rgba(88,166,255,0.3);
}

.chat-panel-form #chat-submit:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* Image upload attach button */
#chat-attach-btn, #mobile-chat-attach-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  color: var(--text-muted);
  transition: color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
#chat-attach-btn:hover, #mobile-chat-attach-btn:hover {
  color: var(--accent);
}

/* Image preview strip above chat form */
.chat-image-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-top: 1px solid var(--border-light);
  background: var(--bg-surface);
}
.chat-image-preview img {
  max-height: 48px;
  max-width: 80px;
  border-radius: 6px;
  object-fit: cover;
}
.chat-image-preview span {
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 120px;
}
.chat-image-preview button {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  flex-shrink: 0;
  transition: color 0.2s, border-color 0.2s;
}
.chat-image-preview button:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
}

/* Image thumbnail in chat message bubble */
.chat-msg .chat-image {
  max-width: 200px;
  max-height: 150px;
  border-radius: 8px;
  margin-bottom: 6px;
  display: block;
}

/* (Status bar removed — health dots moved to sidebar) */

/* ── Event Popover ─────────────────────────────────── */

.event-popover {
  position: fixed;
  width: 280px;
  background: var(--bg-depth-3);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  backdrop-filter: blur(12px);
  z-index: 9500;
  animation: fadeInUp 0.15s ease;
  overflow: hidden;
}

.ep-header {
  padding: 12px 14px 10px;
  border-left: 3px solid var(--accent);
}

.ep-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.ep-type {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ep-body {
  padding: 8px 14px;
  border-top: 1px solid var(--border-light);
}

.ep-row {
  display: flex;
  gap: 8px;
  padding: 4px 0;
  font-size: 11px;
}

.ep-label {
  color: var(--text-muted);
  min-width: 60px;
  flex-shrink: 0;
}

.ep-value {
  color: var(--text-secondary);
}

.ep-location {
  color: var(--accent);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ep-location:hover { text-decoration: underline; }

.ep-attendee-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ep-attendee {
  font-size: 11px;
  color: var(--text-secondary);
}

.ep-desc {
  font-size: 11px;
  color: var(--text-muted);
  padding: 6px 0;
  border-top: 1px solid var(--border-light);
  margin-top: 4px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.ep-actions {
  display: flex;
  gap: 6px;
  padding: 8px 14px 10px;
  border-top: 1px solid var(--border-light);
}

.ep-action-btn {
  flex: 1;
  font-size: 11px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: var(--radius-xs);
  border: none;
  cursor: pointer;
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary);
  transition: background 0.15s;
}
.ep-action-btn:hover { background: rgba(255,255,255,0.1); }
.ep-action-cancel:hover { background: rgba(248,113,113,0.15); color: var(--accent-red); }

/* ── Day Summary ──────────────────────────────────── */

.day-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-light);
  flex-wrap: wrap;
}

.day-summary-sep {
  opacity: 0.3;
}

.day-summary-next {
  color: var(--accent);
  font-weight: 500;
}

/* ── FullCalendar Dark Theme ────────────────────────── */

.fc-panel-content {
  padding: 0 !important;
  max-height: none !important;
  overflow: visible;
}

#fullcalendar-panel {
  border-top: 3px solid var(--cal-kameha);
  flex: 1;
}

#fullcalendar {
  padding: 8px 12px 12px;
}

.fc {
  --fc-border-color: var(--border-light);
  --fc-page-bg-color: transparent;
  --fc-neutral-bg-color: var(--bg-surface);
  --fc-today-bg-color: rgba(96, 165, 250, 0.06);
  --fc-now-indicator-color: var(--accent-red);
  --fc-event-border-color: transparent;
  --fc-small-font-size: 10px;
  font-family: var(--font-sans);
}

.fc .fc-toolbar {
  margin-bottom: 8px !important;
  gap: 6px;
}

.fc .fc-toolbar-title {
  font-size: var(--text-md) !important;
  font-weight: 700;
  color: var(--text-primary);
}

.fc .fc-button {
  background: var(--bg-surface) !important;
  border: 1px solid var(--border) !important;
  color: var(--text-secondary) !important;
  font-size: 10px !important;
  font-weight: 500 !important;
  padding: 4px 10px !important;
  border-radius: 6px !important;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-family: var(--font-sans) !important;
  box-shadow: none !important;
  transition: var(--transition-fast);
}

.fc .fc-button:hover {
  background: var(--bg-elevated) !important;
  border-color: var(--accent) !important;
  color: var(--accent) !important;
}

.fc .fc-button-active {
  background: var(--accent-dim) !important;
  border-color: var(--accent-soft) !important;
  color: var(--accent) !important;
}

.fc .fc-button-primary:not(:disabled).fc-button-active {
  background: var(--accent-dim) !important;
  border-color: var(--accent-soft) !important;
  color: var(--accent) !important;
}

.fc .fc-col-header-cell {
  padding: 6px 0 !important;
  background: var(--bg-surface);
}

.fc .fc-col-header-cell-cushion {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  padding: 4px 8px;
}

.fc .fc-daygrid-day-number {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 4px 8px;
}

.fc .fc-daygrid-day.fc-day-today .fc-daygrid-day-number {
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 4px 4px 0 auto;
}

.fc .fc-timegrid-slot-label-cushion {
  font-size: 9px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.fc .fc-timegrid-now-indicator-line {
  border-color: var(--accent-red);
  border-width: 2px 0 0 0;
}

.fc .fc-timegrid-now-indicator-arrow {
  border-color: var(--accent-red);
  border-width: 5px 0 5px 6px;
}

.fc .fc-event {
  border-radius: 4px !important;
  border: none !important;
  border-left: 3px solid !important;
  font-size: 11px;
  padding: 2px 6px;
  cursor: default;
  transition: filter 0.15s ease;
}

.fc .fc-event:hover {
  filter: brightness(1.2);
}

.fc .fc-event .fc-event-title {
  font-weight: 600;
  font-size: 11px;
}

.fc .fc-event .fc-event-time {
  font-size: 9px;
  font-family: var(--font-mono);
  opacity: 0.8;
}

.fc .fc-daygrid-event {
  margin: 1px 4px !important;
}

.fc .fc-timegrid-event {
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.fc .fc-scrollgrid {
  border: none !important;
}

.fc .fc-scrollgrid td,
.fc .fc-scrollgrid th {
  border-color: var(--border-light) !important;
}

.fc .fc-timegrid-slot {
  height: 40px;
}

.fc .fc-list-event-title a,
.fc .fc-list-event-time {
  color: var(--text-primary) !important;
}

.fc .fc-list-day-cushion {
  background: var(--bg-surface) !important;
}

.fc .fc-list-event:hover td {
  background: var(--bg-elevated) !important;
}

/* ── Kanban Board ──────────────────────────────────── */

.kanban-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 10000;
  display: flex;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.kanban-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.kanban-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-primary);
  animation: kanbanIn 0.3s var(--ease-out);
}

@keyframes kanbanIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

.kanban-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  flex-shrink: 0;
}

.kanban-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  white-space: nowrap;
}

.kanban-tabs {
  display: flex;
  gap: 4px;
  flex: 1;
}

.kanban-tab {
  background: none;
  border: 1px solid transparent;
  border-radius: 16px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  padding: 4px 14px;
  cursor: pointer;
  transition: var(--transition-fast);
  font-family: var(--font-sans);
  white-space: nowrap;
}

.kanban-tab:hover {
  color: var(--text-secondary);
  background: var(--bg-elevated);
}

.kanban-tab.active {
  color: var(--accent);
  background: var(--accent-dim);
  border-color: var(--accent-soft);
  font-weight: 600;
}

.kanban-close {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 8px;
  line-height: 1;
  transition: var(--transition-fast);
  margin-left: auto;
}

.kanban-close:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
  background: var(--bg-elevated);
}

.kanban-board {
  display: flex;
  gap: 12px;
  padding: 16px 24px;
  overflow-x: auto;
  flex: 1;
  align-items: flex-start;
  -webkit-overflow-scrolling: touch;
}

.kanban-board::-webkit-scrollbar {
  height: 6px;
}

.kanban-board::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

.kanban-column {
  flex: 0 0 220px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 140px);
  transition: border-color 0.15s ease;
}

.kanban-column.drag-over {
  border-color: var(--accent);
  background: linear-gradient(180deg, rgba(96,165,250,0.06) 0%, var(--bg-secondary) 80px);
}

.kanban-column-header {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.kanban-column-name {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
}

.kanban-column-count {
  font-size: 9px;
  font-weight: 600;
  font-family: var(--font-mono);
  background: var(--bg-elevated);
  color: var(--text-muted);
  padding: 1px 6px;
  border-radius: 8px;
}

.kanban-column-cards {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 60px;
}

.kanban-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 10px 10px 8px;
  cursor: grab;
  transition: transform 0.1s ease, box-shadow 0.1s ease, opacity 0.15s ease;
  user-select: none;
}

.kanban-card:hover {
  border-color: var(--border-focus);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.kanban-card:active {
  cursor: grabbing;
}

.kanban-card.dragging {
  opacity: 0.4;
  transform: rotate(2deg);
}

.kanban-card-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 4px;
}

.kanban-card-client {
  font-size: 10px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.kanban-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.kanban-card-badge {
  font-size: 8px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: 1px 6px;
  border-radius: 3px;
}

.kanban-card-stalled {
  background: var(--accent-red-dim);
  color: var(--accent-red);
  animation: pulse-badge 2s ease-in-out infinite;
}

.kanban-card-days {
  font-size: 9px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.kanban-card-shoot {
  font-size: 9px;
  color: var(--accent-yellow);
  font-family: var(--font-mono);
}

.kanban-card-team {
  display: flex;
  gap: 3px;
}

.kanban-card-avatar {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 8px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
}

/* Card type colors */
.kanban-card[data-type="white-label"] { border-left-color: var(--accent-yellow); }
.kanban-card[data-type="retainer"] { border-left-color: var(--accent-green); }
.kanban-card[data-type="project-based"] { border-left-color: var(--accent-purple); }
.kanban-card[data-type="internal"] { border-left-color: var(--accent); }

/* Kanban drop placeholder */
.kanban-placeholder {
  height: 4px;
  background: var(--accent);
  border-radius: 2px;
  margin: 2px 0;
  opacity: 0.6;
}

/* ── Kanban Side Panel ────────────────────────────── */

.kanban-side-panel {
  width: 0;
  background: var(--bg-panel);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.25s var(--ease-out);
  flex-shrink: 0;
}

.kanban-side-panel.active {
  width: 380px;
}

.kanban-side-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

.kanban-side-header h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kanban-side-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.15s ease;
  flex-shrink: 0;
}

.kanban-side-close:hover {
  color: var(--text-primary);
}

.kanban-side-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

.kanban-side-section {
  margin-bottom: 20px;
}

.kanban-side-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.kanban-side-value {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.kanban-side-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.kanban-side-stage-track {
  display: flex;
  gap: 3px;
  margin-bottom: 16px;
  padding: 8px 0;
}

.kanban-side-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}

.kanban-side-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 500;
  padding: 6px 14px;
  cursor: pointer;
  transition: var(--transition-fast);
  font-family: var(--font-sans);
}

.kanban-side-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

.kanban-side-btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.kanban-side-btn.primary:hover {
  filter: brightness(1.1);
}

.kanban-side-notes {
  max-height: 200px;
  overflow-y: auto;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

/* ── Stat Detail Overlay ─────────────────────────────── */

.stat-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 10000;
  display: flex;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.stat-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.stat-overlay-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-primary);
  animation: kanbanIn 0.3s var(--ease-out);
}

.stat-overlay-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.stat-overlay-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  white-space: nowrap;
}

.stat-overlay-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
  align-items: center;
}

.stat-chip-group {
  display: flex;
  gap: 4px;
  align-items: center;
}

.stat-chip-divider {
  color: var(--border);
  margin: 0 4px;
  user-select: none;
}

.stat-chip {
  background: none;
  border: 1px solid var(--border);
  border-radius: 16px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  padding: 4px 14px;
  cursor: pointer;
  transition: var(--transition-fast);
  font-family: var(--font-sans);
  white-space: nowrap;
}

.stat-chip:hover {
  color: var(--text-secondary);
  background: var(--bg-elevated);
}

.stat-chip.active {
  color: var(--accent);
  background: var(--accent-dim);
  border-color: var(--accent-soft);
  font-weight: 600;
}

.stat-chip[data-chip="client"].active { color: #7986cb; background: rgba(121,134,203,0.08); border-color: rgba(121,134,203,0.2); }
.stat-chip[data-chip="production"].active { color: #e4c441; background: rgba(228,196,65,0.08); border-color: rgba(228,196,65,0.2); }
.stat-chip[data-chip="admin"].active { color: #58a6ff; background: rgba(88,166,255,0.08); border-color: rgba(88,166,255,0.2); }
.stat-chip[data-chip="personal"].active { color: #f4511e; background: rgba(244,81,30,0.08); border-color: rgba(244,81,30,0.2); }
.stat-chip[data-chip="high"].active { color: var(--accent-red); background: var(--accent-red-dim); border-color: rgba(248,113,113,0.3); }
.stat-chip[data-chip="medium"].active { color: var(--accent-yellow); background: var(--accent-yellow-dim); border-color: rgba(251,191,36,0.3); }
.stat-chip[data-chip="low"].active { color: var(--accent-green); background: var(--accent-green-dim); border-color: rgba(74,222,128,0.3); }

.stat-overlay-close {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 8px;
  line-height: 1;
  transition: var(--transition-fast);
  margin-left: auto;
  flex-shrink: 0;
}

.stat-overlay-close:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
  background: var(--bg-elevated);
}

.stat-overlay-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
}

.stat-detail-summary {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: var(--bg-depth-1);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
}

.stat-detail-count {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.stat-detail-count span {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 4px;
}

/* ── Responsive ──────────────────────────────────────── */

@media (max-width: 1200px) {
  .view {
    padding: 12px 16px 24px;
  }
  .home-grid,
  .home-bottom-row {
    grid-template-columns: 1fr;
  }
  .tasks-view-layout {
    grid-template-columns: 1fr;
  }
  .inbox-view-layout {
    grid-template-columns: 1fr;
  }
  .chat-slideout {
    width: 340px;
    right: -360px;
  }
  .chat-slideout.open {
    right: 0;
  }
}

/* ── Mobile Navigation ────────────────────────────────── */

.mobile-nav {
  display: none; /* Hidden on desktop */
}

.mobile-chat-view {
  display: none; /* Hidden on desktop */
}

@media (max-width: 768px) {
  /* ── Mobile Layout ─────────────────────────────────── */

  /* Hide sidebar, show mobile nav */
  .sidebar {
    display: none;
  }

  .app-content {
    margin-left: 0;
  }

  /* Hide chat FAB on mobile — use bottom tab instead */
  .chat-fab {
    display: none;
  }

  /* Chat slideout: full-screen on mobile */
  .chat-slideout {
    width: 100%;
    right: -100%;
  }

  .chat-slideout.open {
    right: 0;
  }

  .chat-slideout-backdrop {
    display: none;
  }

  /* Views: tighter padding */
  .view {
    padding: 8px 12px 100px; /* extra bottom for mobile nav */
  }

  /* Stats bar: 2x3 grid */
  .stats-bar {
    grid-template-columns: repeat(3, 1fr);
  }

  #view-home .stats-bar {
    margin: 0 0 10px;
  }

  .stat-value { font-size: 20px; }
  .stat-item { padding: 10px 8px 8px; }

  /* Stat overlay compact */
  .stat-overlay-header { padding: 12px 16px; }
  .stat-overlay-content { padding: 12px 16px; }
  .stat-overlay-chips { order: 3; width: 100%; }

  /* Intelligence feed: smaller cards */
  #view-home .intel-feed { margin: 0 0 10px; }
  .feed-card { width: 180px; }
  .feed-card-title { font-size: 11px; }

  /* Header compact */
  header { padding: 10px 14px; }
  .header-subtitle { display: none; }
  #datetime { font-size: 10px; }
  #last-refresh { display: none; }
  .header-divider { display: none; }

  /* View layouts: single column on mobile */
  .home-grid,
  .home-bottom-row,
  .tasks-view-layout,
  .inbox-view-layout {
    grid-template-columns: 1fr;
  }

  /* Panels: remove max-height constraints */
  .panel-content {
    max-height: none !important;
  }

  /* Larger touch targets */
  .refresh-btn {
    padding: 8px 10px;
    font-size: 18px;
  }

  .tab-btn {
    padding: 6px 14px;
    font-size: 11px;
  }

  .task-check {
    padding: 6px;
  }

  /* ── Production Log Mobile ────────────────────────────── */

  #production-log-panel .panel-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  #production-log-panel .panel-actions {
    flex-wrap: wrap;
    gap: 6px;
    width: 100%;
  }

  #production-log-panel .panel-actions .btn-primary,
  #production-log-panel .panel-actions .btn-sm {
    font-size: 11px;
    padding: 6px 10px;
  }

  #pl-table {
    font-size: 11px;
    min-width: 900px; /* ensures horizontal scroll, not squished columns */
  }

  #pl-table th,
  #pl-table td {
    padding: 6px 6px;
    white-space: nowrap;
  }

  #pl-form-container > div {
    grid-template-columns: 1fr !important;
  }

  #pl-filters {
    gap: 6px !important;
  }

  #pl-filters select,
  #pl-filters input {
    font-size: 13px !important;
    padding: 8px 10px !important;
    min-width: 0 !important;
    flex: 1 1 45% !important;
  }

  /* ── Mobile Bottom Navigation (6 tabs) ─────────────── */

  .mobile-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 300;
    background: var(--bg-glass);
    border-top: 1px solid var(--border);
    backdrop-filter: blur(24px) saturate(1.3);
    -webkit-backdrop-filter: blur(24px) saturate(1.3);
    padding: 6px 0;
    padding-bottom: max(6px, env(safe-area-inset-bottom));
  }

  .mobile-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 9px;
    font-weight: 500;
    font-family: var(--font-sans);
    padding: 6px 4px;
    cursor: pointer;
    transition: var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-tab.active {
    color: var(--accent);
  }

  .mobile-tab svg {
    opacity: 0.6;
  }

  .mobile-tab.active svg {
    opacity: 1;
  }

  /* ── Mobile Chat View ──────────────────────────────── */

  .mobile-chat-view {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 250;
    background: var(--bg-primary);
    flex-direction: column;
  }

  .mobile-chat-view.active {
    display: flex;
  }

  .mobile-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 70px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .mobile-chat-input-area {
    display: flex;
    gap: 8px;
    padding: 10px 14px;
    padding-bottom: max(10px, calc(env(safe-area-inset-bottom) + 56px));
    background: var(--bg-glass);
    border-top: 1px solid var(--border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
  }

  .mobile-chat-input-area #mobile-chat-input {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 16px; /* Prevents iOS zoom */
    font-family: var(--font-sans);
    outline: none;
    transition: var(--transition);
    min-width: 0;
  }

  .mobile-chat-input-area #mobile-chat-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
  }

  .mobile-chat-input-area #mobile-chat-input::placeholder {
    color: var(--text-muted);
  }

  .mobile-chat-input-area #mobile-chat-submit {
    background: linear-gradient(135deg, var(--accent) 0%, #3d8bfd 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 10px 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-chat-messages .chat-msg {
    max-width: 90%;
  }

  /* ── Scrollbar: thicker for touch ──────────────────── */
  ::-webkit-scrollbar { width: 3px; }
}

/* ── Network Graph View ─────────────────────────────────── */

.network-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  gap: 12px;
  flex-wrap: wrap;
}

.network-toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.network-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.network-count {
  font-size: var(--text-xs);
  color: var(--text-muted);
  background: var(--bg-depth-2);
  padding: 2px 8px;
  border-radius: 10px;
}

.network-search-input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  color: var(--text-primary);
  font-size: var(--text-sm);
  width: 180px;
  font-family: var(--font-sans);
}
.network-search-input:focus {
  outline: none;
  border-color: var(--accent);
}

.network-filters {
  display: flex;
  gap: 4px;
}

.network-filter-btn {
  background: var(--bg-depth-2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 4px 12px;
  color: var(--text-secondary);
  font-size: var(--text-xs);
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font-sans);
}
.network-filter-btn:hover {
  background: var(--bg-depth-3);
  color: var(--text-primary);
}
.network-filter-btn.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

.network-filter-dropdown {
  position: relative;
  display: inline-block;
}
.network-filter-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 100;
  background: var(--bg-depth-1);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
  min-width: 140px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.network-filter-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 6px 12px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: var(--text-xs);
  font-family: var(--font-sans);
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.1s;
}
.network-filter-menu button:hover {
  background: var(--bg-depth-2);
  color: var(--text-primary);
}

.network-canvas-wrap {
  position: relative;
  background: var(--bg-depth-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  height: 55vh;
  min-height: 300px;
}

#network-svg {
  width: 100%;
  height: 100%;
  display: block;
}

#network-3d {
  width: 100%;
  height: 100%;
}
#network-3d canvas {
  border-radius: 12px;
}

.network-legend {
  position: absolute;
  bottom: 12px;
  left: 12px;
  display: flex;
  gap: 12px;
  background: var(--bg-glass);
  backdrop-filter: blur(8px);
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.legend-partner { background: var(--accent); }
.legend-client { background: #93c5fd; }
.legend-team { background: var(--accent-yellow); }
.legend-personal { background: var(--accent-green); }
.legend-family { background: var(--accent-pink); }
.legend-self { background: var(--accent-yellow); }

.legend-line {
  width: 16px;
  height: 3px;
  border-radius: 2px;
  display: inline-block;
}

.legend-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.network-rel-legend {
  position: absolute;
  bottom: 12px;
  right: 12px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--bg-glass);
  backdrop-filter: blur(8px);
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  max-width: 50%;
}

.network-rel-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 0 0 8px;
  align-items: center;
}

.rel-filter-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-right: 4px;
}

.rel-filter-chip {
  background: var(--bg-depth-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 3px 10px;
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}
.rel-filter-chip.active {
  background: color-mix(in srgb, var(--chip-color, var(--accent)) 15%, transparent);
  border-color: var(--chip-color, var(--accent));
  color: var(--chip-color, var(--accent));
}
.rel-filter-chip:hover {
  border-color: var(--chip-color, var(--accent));
}
.rel-filter-chip.rel-filter-clear {
  color: var(--text-muted);
  font-style: italic;
}

.cd-connection-rel-badge {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid;
  font-weight: 500;
  margin-top: 2px;
}

.network-dim-btn {
  background: var(--bg-depth-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  color: var(--accent);
  font-size: var(--text-xs);
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-mono);
  transition: all 0.15s;
}
.network-dim-btn:hover {
  background: var(--bg-depth-3);
}

/* D3 Graph Nodes & Links */
.network-node {
  cursor: pointer;
  transition: opacity 0.3s;
}
.network-node:hover circle {
  filter: brightness(1.3);
}

.network-link {
  stroke-opacity: 0.5;
  transition: stroke-opacity 0.3s;
}

.network-label {
  font-family: var(--font-sans);
  font-size: 10px;
  fill: var(--text-secondary);
  text-anchor: middle;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}
.network-label.visible {
  opacity: 1;
}

.node-incomplete circle {
  stroke-dasharray: 3 2;
}

/* Node pulse animation for gaps mode */
@keyframes nodePulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.5); }
}
.network-node.pulsing circle {
  animation: nodePulse 2s ease-in-out infinite;
}

/* Tooltip */
.network-tooltip {
  position: absolute;
  background: var(--bg-depth-3);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  pointer-events: none;
  z-index: 100;
  min-width: 160px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.network-tooltip .tt-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}
.network-tooltip .tt-meta {
  font-size: var(--text-xs);
  color: var(--text-muted);
  line-height: 1.5;
}
.network-tooltip .tt-bar {
  margin-top: 6px;
  height: 3px;
  background: var(--bg-depth-2);
  border-radius: 2px;
  overflow: hidden;
}
.network-tooltip .tt-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s;
}

/* ── Contact List Table ────────────────────────────────── */

.network-list-section {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--bg-depth-1);
  overflow: hidden;
}

.network-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px 10px;
  border-bottom: 1px solid var(--border);
}
.network-list-header h3 {
  margin: 0;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
}
.network-list-count {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.network-list-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-xs);
}
.network-list-table thead {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg-depth-2);
}
.network-list-table th {
  text-align: left;
  padding: 8px 12px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  user-select: none;
}
.network-list-table th.sortable {
  cursor: pointer;
}
.network-list-table th.sortable:hover {
  color: var(--accent);
}
.network-list-table th .sort-arrow {
  margin-left: 4px;
  opacity: 0.4;
  font-size: 10px;
}
.network-list-table th.sort-asc .sort-arrow,
.network-list-table th.sort-desc .sort-arrow {
  opacity: 1;
  color: var(--accent);
}

.network-list-table td {
  padding: 10px 12px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.network-list-table tbody tr {
  cursor: pointer;
  transition: background 0.15s;
}
.network-list-table tbody tr:hover {
  background: var(--bg-depth-2);
}
.network-list-table tbody tr:nth-child(even) {
  background: var(--bg-depth-1);
}
.network-list-table tbody tr:nth-child(even):hover {
  background: var(--bg-depth-2);
}

.nl-name {
  font-weight: 600;
  color: var(--text-primary);
}
.nl-cat-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.nl-empty {
  color: var(--text-muted);
  opacity: 0.4;
}
.nl-health {
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
}
.nl-pct {
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
}
.nl-edit-input {
  width: 100%;
  background: var(--bg-depth-3);
  border: 1px solid var(--accent);
  border-radius: 4px;
  color: var(--text-primary);
  padding: 4px 8px;
  font-size: var(--text-xs);
  font-family: var(--font-sans);
  outline: none;
}
.nl-saving {
  color: var(--text-muted);
  font-style: italic;
  font-size: 11px;
}
.network-list-table td.nl-saved {
  animation: nl-flash 1.5s ease;
}
@keyframes nl-flash {
  0% { background: rgba(74,222,128,0.15); }
  100% { background: transparent; }
}
.network-list-table td[data-field] {
  cursor: text;
}

.network-list-section .nl-scroll-wrap {
  max-height: 45vh;
  overflow-y: auto;
}

/* ── Contact Detail Slide-Out ───────────────────────────── */

.contact-detail-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2600;
}
.contact-detail-overlay.active { display: flex; }

.contact-detail-backdrop {
  flex: 1;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.contact-detail-panel {
  width: min(480px, 90vw);
  height: 100%;
  background: var(--bg-depth-1);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  animation: slideInRight 0.25s ease-out;
  display: flex;
  flex-direction: column;
}

.contact-detail-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 10px 16px 0;
}
.contact-detail-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
  padding: 2px 8px;
  border-radius: 6px;
  transition: all 0.15s;
}
.contact-detail-close:hover {
  background: var(--bg-depth-2);
  color: var(--text-primary);
}

/* ── Hero Section ── */
.cd-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 20px 16px;
}
.cd-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: 0.5px;
}
.cd-hero-info {
  flex: 1;
  min-width: 0;
}
.cd-hero-info h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cd-hero-role {
  margin: 2px 0 6px;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cd-hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* Health ring */
.cd-health-ring {
  flex-shrink: 0;
  text-align: center;
}
.cd-health-label {
  display: block;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Quick Actions ── */
.cd-quick-actions {
  display: flex;
  justify-content: center;
  gap: 2px;
  padding: 0 20px 12px;
  border-bottom: 1px solid var(--border);
}
.cd-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  border: none;
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 10px;
  font-family: var(--font-sans);
  border-radius: 8px;
  transition: all 0.15s;
  text-decoration: none;
}
.cd-action:hover {
  background: var(--bg-depth-2);
  color: var(--accent);
}
.cd-action-danger:hover {
  color: var(--accent-red);
  background: rgba(248, 113, 113, 0.08);
}

/* ── Tabs ── */
.cd-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
}
.cd-tab {
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all 0.15s;
}
.cd-tab:hover {
  color: var(--text-primary);
}
.cd-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.contact-detail-content {
  padding: 16px 20px;
  flex: 1;
  overflow-y: auto;
}

/* ── Contact Info Card ── */
.cd-info-card {
  background: var(--bg-depth-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px 0;
  margin-bottom: 20px;
}

/* Contact detail sections */
.cd-section {
  margin-bottom: 20px;
}
.cd-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.cd-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.cd-badge {
  font-size: var(--text-xs);
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--bg-depth-2);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  text-transform: capitalize;
}
.cd-badge.cat-business { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); }
.cd-badge.cat-personal { background: var(--accent-green-dim); color: var(--accent-green); border-color: var(--accent-green); }
.cd-badge.cat-self { background: var(--accent-yellow-dim); color: var(--accent-yellow); border-color: var(--accent-yellow); }

.cd-field {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  border-bottom: 1px solid var(--bg-depth-3);
}
.cd-info-card .cd-field:last-child {
  border-bottom: none;
}
.cd-field-label {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.cd-field-label svg {
  opacity: 0.5;
}
.cd-field-value {
  font-size: 12px;
  color: var(--text-primary);
  text-align: right;
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cd-field-value a {
  color: var(--accent);
  text-decoration: none;
}
.cd-field-value a:hover {
  text-decoration: underline;
}

/* ── Connection Cards ── */
.cd-connections {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cd-connection-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  background: var(--bg-depth-2);
  border: 1px solid transparent;
}
.cd-connection-card:hover {
  border-color: var(--border);
  transform: translateX(2px);
}
.cd-connection-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.cd-connection-info {
  flex: 1;
  min-width: 0;
}
.cd-connection-name {
  display: block;
  color: var(--text-primary);
  font-weight: 500;
  font-size: 13px;
}
.cd-connection-type {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: capitalize;
}
.cd-connection-strength {
  width: 40px;
  height: 4px;
  background: var(--bg-depth-3);
  border-radius: 2px;
  overflow: hidden;
  flex-shrink: 0;
}
.cd-strength-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* ── Source pills ── */
.cd-source-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.cd-source-pill {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--bg-depth-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

/* ── Empty States ── */
.cd-empty-state {
  text-align: center;
  padding: 40px 20px;
}
.cd-empty-state p {
  margin: 12px 0 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}
.cd-empty-state span {
  font-size: 12px;
  color: var(--text-muted);
}

/* ── Timeline ── */
.cd-timeline {
  display: flex;
  flex-direction: column;
}
.cd-timeline-item {
  display: flex;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--bg-depth-2);
  transition: background 0.15s;
}
.cd-timeline-item:last-child {
  border-bottom: none;
}
.cd-timeline-item:hover {
  background: var(--bg-depth-2);
  margin: 0 -20px;
  padding-left: 20px;
  padding-right: 20px;
  border-radius: 6px;
}
.cd-timeline-dot {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-depth-2);
  border-radius: 50%;
  margin-top: 2px;
}
.cd-timeline-content {
  flex: 1;
  min-width: 0;
}
.cd-timeline-subject {
  font-size: 13px;
  color: var(--text-primary);
  font-weight: 500;
  line-height: 1.3;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cd-timeline-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}
.cd-timeline-badge {
  text-transform: capitalize;
  font-weight: 500;
}
.cd-timeline-dir {
  color: var(--text-muted);
}
.cd-timeline-date {
  color: var(--text-muted);
  margin-left: auto;
  white-space: nowrap;
}

/* ── Edit mode actions ── */
.cd-edit-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}
.cd-edit-actions .cd-save-btn {
  flex: 1;
}

.cd-notes {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.6;
  white-space: pre-wrap;
  max-height: 200px;
  overflow-y: auto;
  background: var(--bg-depth-2);
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
}

/* Edit mode inputs */
.cd-edit-input {
  width: 100%;
  padding: 6px 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  margin-bottom: 6px;
  box-sizing: border-box;
}
.cd-edit-input:focus {
  outline: none;
  border-color: var(--accent);
}
.cd-edit-textarea {
  width: 100%;
  padding: 8px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  min-height: 80px;
  resize: vertical;
  box-sizing: border-box;
}
.cd-edit-textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.cd-save-btn {
  background: #238636;
  border: none;
  border-radius: 6px;
  padding: 8px 20px;
  color: #fff;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  margin-top: 12px;
  font-family: var(--font-sans);
}
.cd-save-btn:hover {
  background: #2ea043;
}

/* Gap detection */
.cd-gaps {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cd-gap-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  color: #f87171;
  padding: 4px 0;
}
.cd-gap-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(248,113,113,0.15);
  color: #f87171;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}
.cd-badge.cat-family { background: rgba(244,114,182,0.15); color: #f472b6; border-color: #f472b6; }

/* Enrich button */
.cd-enrich-section {
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.cd-enrich-btn {
  width: 100%;
  padding: 10px 16px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: opacity 0.15s, transform 0.1s;
}
.cd-enrich-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}
.cd-enrich-btn:active {
  transform: translateY(0);
}
.cd-enrich-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.cd-enriched-note {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-bottom: 6px;
}
.cd-enriched-note.cd-enriched-warn {
  color: var(--accent-yellow);
}

/* Enrichment progress steps */
.cd-enrich-progress {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 0;
}
.cd-enrich-step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  transition: opacity 0.2s;
}
.cd-step-pending {
  opacity: 0.35;
}
.cd-step-indicator {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
  background: var(--bg-depth-2);
  color: var(--text-muted);
}
.cd-step-spinning {
  background: transparent;
  border: 2px solid #6366f1;
  border-top-color: transparent;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.cd-step-success { background: #238636; color: #fff; }
.cd-step-error { background: #da3633; color: #fff; }
.cd-step-skip { background: var(--bg-depth-2); color: var(--text-muted); }
.cd-step-empty { background: var(--bg-depth-2); color: var(--text-muted); }
.cd-enrich-summary {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.cd-enrich-error {
  font-size: var(--text-sm);
  color: #f87171;
  margin-bottom: 8px;
}

/* Enrichment source provenance */
.cd-source-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  font-size: var(--text-xs);
}
.cd-source-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  flex-shrink: 0;
}
.cd-source-fields {
  color: var(--text-muted);
  word-break: break-word;
}

/* ── Shared Components ─────────────────────────────────── */

/* ── Confirmation Modal ── */
.confirm-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: modalFadeIn 0.15s ease;
}
.confirm-modal {
  background: var(--bg-depth-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 420px;
  width: 90vw;
  box-shadow: var(--shadow-lg), 0 0 0 1px var(--border);
  animation: modalScaleIn 0.2s var(--ease-out);
}
.confirm-modal h3 {
  margin: 0 0 8px;
  font-size: var(--text-lg);
  color: var(--text-primary);
}
.confirm-modal p {
  margin: 0 0 20px;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.5;
}
.confirm-modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes modalScaleIn {
  from { opacity: 0; transform: scale(0.95) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ── Shared Buttons ── */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: var(--transition);
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: var(--text-sm);
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: var(--transition);
}
.btn-secondary:hover { background: var(--bg-depth-2); color: var(--text-primary); border-color: var(--text-muted); }
.btn-secondary:active { transform: scale(0.98); }

.btn-danger {
  background: var(--state-error-dim);
  color: var(--accent-red);
  border: 1px solid var(--state-error-border);
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: var(--transition);
}
.btn-danger:hover { background: var(--accent-red); color: #fff; }
.btn-danger:active { transform: scale(0.98); }

.btn-sm { padding: 5px 12px; font-size: var(--text-xs); }
.btn-icon {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 8px;
  font-size: var(--text-sm);
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-icon:hover { color: var(--text-primary); border-color: var(--text-muted); background: var(--bg-depth-2); }

/* ── Toast Upgrade ── */
.kai-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-depth-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 10001;
  box-shadow: var(--shadow-lg);
  animation: toastSlideUp 0.25s var(--ease-out);
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  color: var(--text-primary);
  max-width: 480px;
}
.kai-toast::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: 3px 0 0 3px;
}
.kai-toast.toast-success::before { background: var(--state-success); }
.kai-toast.toast-error::before { background: var(--state-error); }
.kai-toast.toast-warning::before { background: var(--state-warning); }
.kai-toast.toast-info::before { background: var(--state-active); }
.kai-toast .toast-icon {
  flex-shrink: 0;
  font-size: 16px;
}
.kai-toast .toast-message { flex: 1; }
.kai-toast .toast-action {
  background: none;
  border: 1px solid var(--border);
  color: var(--accent);
  border-radius: var(--radius-xs);
  padding: 3px 10px;
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: var(--transition-fast);
  white-space: nowrap;
}
.kai-toast .toast-action:hover { background: var(--accent-dim); border-color: var(--accent); }
.kai-toast .toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  padding: 0 2px;
  transition: var(--transition-fast);
}
.kai-toast .toast-close:hover { color: var(--text-primary); }
.kai-toast-exit {
  opacity: 0;
  transform: translateX(-50%) translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
@keyframes toastSlideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(16px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Skeleton Loaders ── */
@keyframes skeletonPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.7; }
}
.skeleton {
  background: var(--bg-depth-2);
  border-radius: var(--radius-xs);
  animation: skeletonPulse 1.5s ease-in-out infinite;
}
.skeleton-line {
  height: 12px;
  background: var(--bg-depth-2);
  border-radius: var(--radius-xs);
  animation: skeletonPulse 1.5s ease-in-out infinite;
  margin-bottom: 8px;
}
.skeleton-line.w-75 { width: 75%; }
.skeleton-line.w-50 { width: 50%; }
.skeleton-line.w-25 { width: 25%; }
.skeleton-line.h-lg { height: 20px; }
.skeleton-card {
  background: var(--bg-depth-2);
  border-radius: var(--radius-sm);
  animation: skeletonPulse 1.5s ease-in-out infinite;
  padding: 16px;
  min-height: 60px;
  margin-bottom: 8px;
}
.skeleton-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-depth-2);
  animation: skeletonPulse 1.5s ease-in-out infinite;
}

/* ── Focus Ring (Global) ── */
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.12), inset 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* ── Micro-Interactions ── */
button { transition: var(--transition); }
button:active:not(:disabled) { transform: scale(0.97); }

/* ── Add Contact Modal ── */
.add-contact-overlay {
  position: fixed;
  inset: 0;
  z-index: 9500;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: modalFadeIn 0.15s ease;
}
.add-contact-panel {
  background: var(--bg-depth-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 560px;
  width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalScaleIn 0.2s var(--ease-out);
}
.add-contact-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-depth-1);
  z-index: 1;
}
.add-contact-header h3 {
  margin: 0;
  font-size: var(--text-lg);
  color: var(--text-primary);
}
.add-contact-body {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.add-contact-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.add-contact-field label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.add-contact-field input,
.add-contact-field select,
.add-contact-field textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 8px 12px;
  color: var(--text-primary);
  font-size: var(--text-sm);
  font-family: var(--font-sans);
}
.add-contact-field textarea {
  min-height: 60px;
  resize: vertical;
}
.add-contact-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.add-contact-categories {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.add-contact-categories label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  cursor: pointer;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}
.add-contact-categories input[type="checkbox"] {
  accent-color: var(--accent);
}
.add-contact-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border);
}

/* ── Floating Action Bar (Bulk Operations) ── */
.float-action-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-depth-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 9000;
  animation: toastSlideUp 0.2s var(--ease-out);
}
.float-action-bar .fab-count {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  white-space: nowrap;
}
.float-action-bar .fab-count strong {
  color: var(--accent);
}
.float-action-bar .fab-divider {
  width: 1px;
  height: 24px;
  background: var(--border);
}
.float-action-bar .fab-actions {
  display: flex;
  gap: 6px;
}

@media (max-width: 768px) {
  .kai-toast {
    bottom: 80px;
    left: 16px;
    right: 16px;
    transform: none;
    max-width: none;
  }
  .kai-toast-exit { transform: translateY(10px); }
  @keyframes toastSlideUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
  }
  .float-action-bar {
    bottom: 80px;
    left: 16px;
    right: 16px;
    transform: none;
    flex-wrap: wrap;
    justify-content: center;
  }
  .confirm-modal { margin: 16px; }
  .add-contact-row { grid-template-columns: 1fr; }
}

/* ── Import Triage Overlay ────────────────────────────── */

.import-triage-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: var(--bg-base);
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.2s ease;
}

.import-triage-header {
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg-depth-1);
}

.it-progress-bar {
  height: 3px;
  background: var(--bg-depth-2);
  overflow: hidden;
}

.it-progress-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.3s ease;
  border-radius: 0 2px 2px 0;
}

.it-header-row {
  display: flex;
  align-items: center;
  padding: 12px 24px;
  gap: 12px;
}

.it-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.it-counter {
  font-size: 13px;
  color: var(--text-secondary);
  flex: 1;
}

.it-close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 24px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.15s;
}
.it-close-btn:hover { color: var(--text-primary); }

.import-triage-body {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.it-stage {
  width: 100%;
  max-width: 600px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Upload */
.it-upload-area {
  text-align: center;
  padding: 48px 32px;
  border: 2px dashed var(--border);
  border-radius: 16px;
  width: 100%;
  transition: border-color 0.2s;
}
.it-upload-area:hover { border-color: var(--accent); }

.it-upload-icon {
  color: var(--text-dim);
  margin-bottom: 16px;
}

.it-upload-btn {
  display: inline-block;
  padding: 10px 24px;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  transition: brightness 0.15s;
}
.it-upload-btn:hover { filter: brightness(1.1); }

/* Summary */
.it-stat-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}

.it-stat-card {
  background: var(--bg-depth-1);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  text-align: center;
  min-width: 100px;
  flex: 1;
  transition: transform 0.15s, border-color 0.15s;
}
.it-stat-card:hover { transform: translateY(-1px); }

.it-stat-num {
  display: block;
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.it-stat-label {
  display: block;
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.it-summary-actions {
  display: flex;
  gap: 12px;
  margin-top: 28px;
  justify-content: center;
}

/* Triage Card */
.it-bulk-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
  width: 100%;
  justify-content: center;
}

.it-bulk-group {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-depth-1);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
}

.it-bulk-label {
  color: var(--text-secondary);
  margin-right: 4px;
}

.it-bulk-keep, .it-bulk-skip {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background 0.15s;
}
.it-bulk-keep { color: var(--accent-green); }
.it-bulk-keep:hover { background: rgba(74, 222, 128, 0.15); }
.it-bulk-skip { color: var(--accent-red); }
.it-bulk-skip:hover { background: rgba(248, 113, 113, 0.15); }

.it-card-container {
  width: 100%;
  min-height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.it-card {
  width: 100%;
  background: var(--bg-depth-1);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.it-card-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.it-card-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-purple, #a78bfa));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  flex-shrink: 0;
}

.it-card-title {
  flex: 1;
}
.it-card-title h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.it-card-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 4px;
}

.it-card-richness {
  display: flex;
  gap: 3px;
  align-items: center;
}

.it-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bg-depth-2);
  border: 1px solid var(--border);
}
.it-dot-filled {
  background: var(--accent-green);
  border-color: var(--accent-green);
}

.it-card-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.it-card-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  color: var(--text-secondary);
}

.it-card-icon {
  flex-shrink: 0;
  color: var(--text-dim);
  margin-top: 1px;
}

.it-card-photo-badge {
  margin-top: 12px;
  text-align: right;
  font-size: 11px;
  color: var(--text-dim);
  font-style: italic;
}

/* Keep / Skip buttons */
.it-card-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  align-items: center;
  margin-top: 24px;
  width: 100%;
}

.it-btn-skip, .it-btn-keep {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 36px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.15s, background 0.15s;
}
.it-btn-skip:active, .it-btn-keep:active { transform: scale(0.96); }

.it-btn-skip {
  background: rgba(248, 113, 113, 0.12);
  color: var(--accent-red);
  border: 1px solid rgba(248, 113, 113, 0.3);
}
.it-btn-skip:hover {
  background: rgba(248, 113, 113, 0.2);
  box-shadow: 0 4px 12px rgba(248, 113, 113, 0.15);
}

.it-btn-keep {
  background: rgba(74, 222, 128, 0.12);
  color: var(--accent-green);
  border: 1px solid rgba(74, 222, 128, 0.3);
}
.it-btn-keep:hover {
  background: rgba(74, 222, 128, 0.2);
  box-shadow: 0 4px 12px rgba(74, 222, 128, 0.15);
}

.it-btn-undo {
  background: var(--bg-depth-1);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.it-btn-undo:hover:not(:disabled) { background: var(--bg-depth-2); color: var(--text-primary); }
.it-btn-undo:disabled { opacity: 0.3; cursor: not-allowed; }

.it-key-hint {
  display: inline-block;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 400;
  margin-left: 4px;
}

/* Backfill */
.it-backfill-row {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.it-backfill-check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
}
.it-backfill-check input { accent-color: var(--accent); }

/* Confirm */
.it-confirm-stats {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.it-confirm-breakdown {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.it-confirm-cat {
  background: var(--bg-depth-1);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  color: var(--text-secondary);
}

/* Done */
.it-done-icon { margin-bottom: 16px; }

/* ── API Costs View ───────────────────────────────────── */

.costs-view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.costs-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.costs-select {
  background: var(--bg-depth-2);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
  cursor: pointer;
}

.costs-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.costs-charts-row {
  margin-bottom: 20px;
}

.costs-chart-panel .panel-content {
  padding: 16px;
}

.costs-breakdown-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

@media (max-width: 900px) {
  .costs-summary { grid-template-columns: repeat(2, 1fr); }
  .costs-breakdown-row { grid-template-columns: 1fr; }
}

/* Mobile */
@media (max-width: 640px) {
  .it-card { padding: 20px; }
  .it-card-title h3 { font-size: 16px; }
  .it-btn-skip, .it-btn-keep { padding: 12px 24px; font-size: 14px; }
  .it-bulk-bar { flex-direction: column; }
  .it-stat-card { min-width: 80px; padding: 12px; }
  .it-stat-num { font-size: 22px; }
  .import-triage-body { padding: 16px; }
}
