/* ═══════════════════════════════════════════════════════════════════════════
   plot armor — client portal · protagonist mode
   Terminal / command center aesthetic matched to main site
   ═══════════════════════════════════════════════════════════════════════════ */

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

/* ─── CSS Variables — matched to plot armor source ────────────────────────── */

:root {
  /* Colors — Terminal Palette (from index.css) */
  --bg-root: #050505;
  --bg-primary: #0a0a0e;
  --bg-surface: #0e0e14;
  --bg-surface-hover: #131320;
  --bg-elevated: #161622;
  --bg-input: #080810;

  /* Accent — Pure Cyan (matched) */
  --cyan: #00FFFF;
  --cyan-dim: #00cccc;
  --cyan-glow: rgba(0, 255, 255, 0.15);
  --cyan-glow-strong: rgba(0, 255, 255, 0.35);
  --cyan-border: rgba(0, 255, 255, 0.12);
  --cyan-border-strong: rgba(0, 255, 255, 0.3);

  /* Accent — Matrix Green (matched) */
  --green: #00FF41;
  --green-dim: rgba(0, 255, 65, 0.5);
  --green-glow: rgba(0, 255, 65, 0.15);
  --green-border: rgba(0, 255, 65, 0.2);

  /* Client Accent — set dynamically per tenant */
  --accent: #22c55e;
  --accent-light: #4ade80;
  --accent-dark: #16a34a;
  --accent-glow: rgba(34, 197, 94, 0.12);
  --accent-glow-strong: rgba(34, 197, 94, 0.25);
  --accent-border: rgba(34, 197, 94, 0.20);

  /* Status */
  --status-done: #00FF41;
  --status-progress: #ffaa00;
  --status-todo: #00FFFF;
  --status-blocked: #ff3333;
  --status-idle: #4a4a5a;

  /* Text */
  --text-primary: #EEEEEE;
  --text-secondary: #8a8a9a;
  --text-muted: #4a4a5a;
  --text-inverse: #050505;

  /* Typography (matched) */
  --font-display: 'Archivo Black', 'Impact', sans-serif;
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;

  /* Gradient */
  --gradient-brand: linear-gradient(135deg, #00FFFF, #00FF41);
  --gradient-brand-text: linear-gradient(90deg, #00FFFF 0%, #00FF41 100%);

  /* Borders */
  --border: rgba(0, 255, 255, 0.12);
  --border-hover: rgba(0, 255, 255, 0.3);

  /* Shadows */
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.6);
  --shadow-cyan: 0 0 20px var(--cyan-glow), 0 0 60px rgba(0, 255, 255, 0.06);

  /* Layout */
  --sidebar-width: 68px;
  --header-height: 52px;
  --radius-sm: 2px;
  --radius-md: 3px;
  --radius-lg: 3px;
  --radius-xl: 4px;

  /* Transitions — Apple-grade spring easing (matched) */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --duration: 200ms;
  --transition-base: 350ms var(--ease);
}

/* ─── Reset ───────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  font-family: var(--font-primary);
  background: var(--bg-root);
  color: var(--text-primary);
  min-height: 100vh;
  overflow: hidden;
  line-height: 1.6;
}

/* CRT Scanline overlay — matched from main site */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(0deg,
    transparent, transparent 2px,
    rgba(0, 0, 0, 0.03) 2px, rgba(0, 0, 0, 0.03) 4px);
  pointer-events: none;
  z-index: 9999;
}

a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea { font-family: inherit; }

/* ─── Grid Background (matched: 40px, 0.06 opacity) ──────────────────────── */

.grid-bg {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(0, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

/* ═══════════════════════════════════════════════════════════════════════════
   LOGIN SCREEN — Premium plot armor branded
   ═══════════════════════════════════════════════════════════════════════════ */

.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  background: var(--bg-root);
}

.login-screen .grid-bg {
  background-image:
    linear-gradient(rgba(0, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
}

/* Radial glow orbs */
.login-screen::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  top: -200px; left: 50%;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(0, 255, 255, 0.12) 0%, transparent 60%);
  pointer-events: none;
  z-index: 1;
}
.login-screen::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  bottom: -100px; right: -100px;
  background: radial-gradient(circle, rgba(0, 255, 65, 0.06) 0%, transparent 60%);
  pointer-events: none;
  z-index: 1;
}

.login-card {
  background: rgba(8, 8, 13, 0.9);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--cyan-border);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg), 0 0 40px rgba(0, 212, 255, 0.06);
  position: relative;
  z-index: 10;
}

.login-logo {
  text-align: center;
  margin-bottom: 40px;
}

.login-logo-svg {
  margin-bottom: 16px;
  filter: drop-shadow(0 0 20px rgba(0, 255, 255, 0.4));
}

.login-logo h1 {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 400;
  letter-spacing: 0.01em;
  background: var(--gradient-brand-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-subtitle {
  font-family: var(--font-mono);
  font-size: 0.69rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 8px;
  letter-spacing: 0.15em;
}

/* ─── Form Elements ───────────────────────────────────────────────────────── */

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--cyan-dim);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.form-group input {
  width: 100%;
  padding: 13px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.95rem;
  transition: all var(--duration) var(--ease);
  outline: none;
}

.form-group input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px var(--cyan-glow), 0 0 16px var(--cyan-glow);
}

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

.login-error {
  color: var(--status-blocked);
  font-size: 0.85rem;
  text-align: center;
  margin-bottom: 16px;
  min-height: 20px;
}

/* ─── Buttons ─────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  transition: all var(--duration) var(--ease);
  white-space: nowrap;
}

/* Login button — cyan gradient */
.login-plotarmor .btn-primary {
  background: var(--gradient-brand);
  color: var(--text-inverse);
  box-shadow: 0 0 20px var(--cyan-glow);
  font-weight: 700;
  letter-spacing: 0.02em;
}
.login-plotarmor .btn-primary:hover {
  box-shadow: 0 0 32px var(--cyan-glow-strong), 0 0 60px rgba(0, 255, 136, 0.1);
  transform: translateY(-2px);
}
.login-plotarmor .btn-primary:active { transform: translateY(0); }

/* App buttons — green accent */
.btn-primary {
  background: var(--accent);
  color: var(--text-inverse);
  box-shadow: 0 0 16px var(--accent-glow);
}
.btn-primary:hover {
  background: var(--accent-light);
  box-shadow: 0 0 24px var(--accent-glow-strong);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

.btn-full { width: 100%; padding: 14px; font-size: 0.95rem; }

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  border-color: var(--border-hover);
  background: var(--bg-surface-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 12px;
}
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-surface-hover); }

.btn-run {
  background: var(--gradient-brand);
  color: var(--text-inverse);
  box-shadow: 0 0 24px var(--cyan-glow-strong);
  font-weight: 700;
  letter-spacing: 0.02em;
}
.btn-run:hover {
  box-shadow: 0 0 36px var(--cyan-glow-strong), 0 0 60px rgba(0, 255, 136, 0.15);
  transform: translateY(-2px);
}
.btn-run.running {
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
  box-shadow: 0 0 24px rgba(245, 158, 11, 0.3);
  animation: pulse-amber 1.5s infinite;
}

@keyframes pulse-amber {
  0%, 100% { box-shadow: 0 0 20px rgba(245, 158, 11, 0.2); }
  50% { box-shadow: 0 0 36px rgba(245, 158, 11, 0.4); }
}

.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }

/* ═══════════════════════════════════════════════════════════════════════════
   APP LAYOUT
   ═══════════════════════════════════════════════════════════════════════════ */

.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

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

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-primary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 0;
  gap: 4px;
  flex-shrink: 0;
  z-index: 2;
}

.sidebar-logo {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  filter: drop-shadow(0 0 8px rgba(0, 212, 255, 0.3));
}

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

.nav-btn {
  width: 46px;
  height: 46px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border-radius: var(--radius-md);
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  position: relative;
}

.nav-btn svg { width: 20px; height: 20px; }
.nav-btn span {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.5rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.nav-btn:hover { color: var(--text-primary); background: rgba(255,255,255,0.03); }

.nav-btn.active {
  color: var(--cyan);
  background: var(--cyan-glow);
}

.nav-btn.active::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 22px;
  background: var(--gradient-brand);
  border-radius: 0 3px 3px 0;
  box-shadow: 0 0 8px var(--cyan-glow);
}

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

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  z-index: 2;
}

.header {
  height: var(--header-height);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: rgba(8, 8, 13, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

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

.header-client-name {
  font-size: 1rem;
  font-weight: 800;
  background: var(--gradient-brand-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.01em;
}

.header-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: -0.01em;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: var(--cyan-glow);
  border: 1px solid var(--cyan-border);
  border-radius: 20px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--cyan);
  text-transform: lowercase;
  letter-spacing: 0.04em;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--cyan-glow);
  border: 1px solid var(--cyan-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--cyan);
}

/* ─── Content Area ────────────────────────────────────────────────────────── */

.content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 28px;
}

.content::-webkit-scrollbar { width: 4px; }
.content::-webkit-scrollbar-track { background: transparent; }
.content::-webkit-scrollbar-thumb { background: var(--cyan-border); border-radius: 2px; }

.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn 0.35s var(--ease); }

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

/* ─── Sidebar Footer (powered by) ─────────────────────────────────────────── */

.sidebar-footer {
  padding: 12px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.sidebar-powered {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0, 255, 255, 0.06);
  border: 1px solid rgba(0, 255, 255, 0.08);
  opacity: 0.5;
  transition: opacity 0.3s var(--ease);
}
.sidebar-powered:hover { opacity: 1; }

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

.header-tagline {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  display: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   DASHBOARD — The WOW screen
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Welcome Banner ──────────────────────────────────────────────────────── */

.welcome-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 32px;
  margin-bottom: 28px;
  background: var(--bg-surface);
  border: 1px solid var(--accent-border, var(--border));
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
}

/* Client accent gradient stripe on left */
.welcome-banner::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent, var(--cyan));
  box-shadow: 0 0 12px var(--accent-glow, var(--cyan-glow));
}

/* Subtle radial glow from left */
.welcome-banner::after {
  content: '';
  position: absolute;
  left: -40px;
  top: 50%;
  transform: translateY(-50%);
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, var(--accent-glow, var(--cyan-glow)) 0%, transparent 70%);
  pointer-events: none;
}

.welcome-left { position: relative; z-index: 1; }

.welcome-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 400;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.welcome-sub {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.06em;
}

.welcome-banner .btn-run {
  position: relative;
  z-index: 1;
}

.dashboard-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.grid-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 20px;
  transition: all 0.3s var(--ease);
  position: relative;
  overflow: hidden;
}

/* Gradient top-border glow on stat cards */
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--gradient-brand);
  opacity: 0.4;
  transition: opacity 0.3s var(--ease);
}
.stat-card:hover::before { opacity: 1; }
.stat-card:hover {
  border-color: var(--cyan-border);
  box-shadow: 0 4px 24px rgba(0, 212, 255, 0.06);
  transform: translateY(-2px);
}

.stat-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}

.stat-value {
  font-size: 2.2rem;
  font-weight: 900;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: -0.03em;
}

.stat-value.green { color: var(--green); text-shadow: 0 0 20px var(--green-glow); }
.stat-value.amber { color: var(--status-progress); text-shadow: 0 0 20px rgba(245,158,11,0.2); }
.stat-value.blue { color: var(--cyan); text-shadow: 0 0 20px var(--cyan-glow); }

.section-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--cyan-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 14px;
}

/* ─── Activity Feed ───────────────────────────────────────────────────────── */

.activity-list {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.activity-item {
  padding: 13px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  transition: all var(--duration) var(--ease);
}
.activity-item:last-child { border-bottom: none; }
.activity-item:hover { background: rgba(0, 212, 255, 0.02); }

.activity-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.activity-dot.green { background: var(--green); box-shadow: 0 0 6px var(--green-glow); }
.activity-dot.amber { background: var(--status-progress); box-shadow: 0 0 6px rgba(245,158,11,0.3); }
.activity-dot.blue { background: var(--cyan); box-shadow: 0 0 6px var(--cyan-glow); }
.activity-dot.gray { background: var(--text-muted); }

.activity-text { flex: 1; font-size: 0.85rem; color: var(--text-secondary); }
.activity-text strong { color: var(--cyan); font-weight: 600; }
.activity-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  color: var(--text-muted);
}

/* ═══════════════════════════════════════════════════════════════════════════
   TASK CARDS
   ═══════════════════════════════════════════════════════════════════════════ */

.task-filters {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
}

.filter-btn {
  padding: 6px 14px;
  border-radius: 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.filter-btn:hover { border-color: var(--border-hover); color: var(--text-secondary); }
.filter-btn.active { background: var(--cyan-glow); border-color: var(--cyan-border); color: var(--cyan); }

.task-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  cursor: pointer;
  transition: all 0.3s var(--ease);
  position: relative;
}
.task-card:hover {
  border-color: var(--cyan-border);
  box-shadow: 0 0 24px rgba(0, 212, 255, 0.06);
  transform: translateY(-1px);
}

/* Animated left border on hover */
.task-card::after {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: var(--gradient-brand);
  opacity: 0;
  border-radius: 2px 0 0 2px;
  transition: opacity 0.3s var(--ease);
}
.task-card:hover::after { opacity: 1; }

.task-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.task-id {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--cyan-dim);
}

.task-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.task-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

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

.task-assignee {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  color: var(--text-muted);
}

.task-date {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  color: var(--text-muted);
}

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

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.badge-done { background: rgba(0,255,136,0.1); color: var(--green); border: 1px solid var(--green-border); }
.badge-progress { background: rgba(245,158,11,0.1); color: var(--status-progress); border: 1px solid rgba(245,158,11,0.2); }
.badge-todo { background: var(--cyan-glow); color: var(--cyan); border: 1px solid var(--cyan-border); }
.badge-blocked { background: rgba(255,68,68,0.1); color: var(--status-blocked); border: 1px solid rgba(255,68,68,0.2); }
.badge-idle { background: rgba(85,85,112,0.15); color: var(--status-idle); border: 1px solid rgba(85,85,112,0.2); }
.badge-running { background: var(--cyan-glow); color: var(--cyan); border: 1px solid var(--cyan-border); animation: pulse-badge 1.5s infinite; }

@keyframes pulse-badge {
  0%, 100% { opacity: 1; box-shadow: 0 0 8px var(--cyan-glow); }
  50% { opacity: 0.7; box-shadow: 0 0 16px var(--cyan-glow-strong); }
}

/* ═══════════════════════════════════════════════════════════════════════════
   TASK DETAIL PANEL
   ═══════════════════════════════════════════════════════════════════════════ */

.detail-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 100;
  opacity: 0; visibility: hidden;
  transition: all 0.3s var(--ease);
}
.detail-overlay.open { opacity: 1; visibility: visible; }

.detail-panel {
  position: fixed;
  right: 0; top: 0; bottom: 0;
  width: 600px; max-width: 90vw;
  background: var(--bg-primary);
  border-left: 1px solid var(--cyan-border);
  z-index: 101;
  transform: translateX(100%);
  transition: transform 0.3s var(--ease);
  display: flex; flex-direction: column;
}
.detail-panel.open { transform: translateX(0); }

.detail-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}

.detail-body {
  flex: 1; overflow-y: auto; padding: 24px;
}

.detail-section { margin-bottom: 28px; }
.detail-section-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem; font-weight: 700;
  color: var(--cyan-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CHAT
   ═══════════════════════════════════════════════════════════════════════════ */

.chat-container {
  display: flex; flex-direction: column;
  height: calc(100vh - var(--header-height));
}

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

.message { display: flex; gap: 12px; max-width: 80%; }
.message.outgoing { align-self: flex-end; flex-direction: row-reverse; }

.message-avatar {
  width: 32px; height: 32px;
  border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem; font-weight: 700;
}

.message-avatar.agent {
  background: var(--cyan-glow);
  border: 1px solid var(--cyan-border);
  color: var(--cyan);
}

.message-avatar.human {
  background: var(--accent-glow);
  border: 1px solid var(--accent-border);
  color: var(--accent);
}

.message-bubble {
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  font-size: 0.88rem;
  line-height: 1.6;
}

.message:not(.outgoing) .message-bubble {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-top-left-radius: 4px;
}

.message.outgoing .message-bubble {
  background: var(--accent-glow);
  border: 1px solid var(--accent-border);
  border-top-right-radius: 4px;
}

.message-time {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem; color: var(--text-muted); margin-top: 4px;
}

.chat-input-bar {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  display: flex; gap: 10px; align-items: flex-end;
  background: var(--bg-primary);
  flex-shrink: 0;
}

.chat-input {
  flex: 1;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-size: 0.88rem;
  resize: none;
  min-height: 44px; max-height: 120px;
  outline: none;
  transition: border-color var(--duration) var(--ease);
}
.chat-input:focus { border-color: var(--cyan); box-shadow: 0 0 0 2px var(--cyan-glow); }
.chat-input::placeholder { color: var(--text-muted); }

/* ═══════════════════════════════════════════════════════════════════════════
   TEAM / ORG CHART
   ═══════════════════════════════════════════════════════════════════════════ */

.org-chart {
  display: flex; flex-direction: column; align-items: center;
  gap: 16px; padding: 24px 0;
}

.org-node {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 28px;
  text-align: center;
  min-width: 220px;
  transition: all 0.3s var(--ease);
  position: relative;
}
.org-node:hover {
  border-color: var(--cyan-border);
  box-shadow: 0 0 20px var(--cyan-glow);
}

.org-node.primary {
  border-color: var(--cyan-border);
  box-shadow: 0 0 24px var(--cyan-glow);
}

/* Gradient top bar on primary node */
.org-node.primary::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--gradient-brand);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.org-connector {
  width: 2px; height: 24px;
  background: linear-gradient(to bottom, var(--cyan-border), transparent);
}

.org-branch {
  display: flex; gap: 16px; position: relative;
}

.org-branch::before {
  content: '';
  position: absolute; top: -16px; left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 220px); height: 1px;
  background: var(--cyan-border);
}

.org-branch .org-node { position: relative; }
.org-branch .org-node::before {
  content: '';
  position: absolute; top: -16px; left: 50%;
  width: 1px; height: 16px;
  background: var(--cyan-border);
}

.org-name { font-weight: 700; font-size: 1rem; margin-bottom: 4px; }
.org-title { font-size: 0.78rem; color: var(--text-secondary); margin-bottom: 8px; }

/* ─── Document Viewer ─────────────────────────────────────────────────────── */

.doc-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
}
.doc-card:hover { border-color: var(--cyan-border); }

.doc-title { font-weight: 600; margin-bottom: 4px; }
.doc-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem; color: var(--text-muted);
}

.doc-body {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  font-size: 0.88rem; line-height: 1.7;
  color: var(--text-secondary);
}

.doc-body h1, .doc-body h2, .doc-body h3 { color: var(--text-primary); margin: 20px 0 10px; }
.doc-body h1 { font-size: 1.3rem; }
.doc-body h2 { font-size: 1.1rem; }
.doc-body h3 { font-size: 0.95rem; }
.doc-body ul, .doc-body ol { padding-left: 20px; margin: 10px 0; }
.doc-body li { margin-bottom: 6px; }
.doc-body code {
  background: var(--bg-elevated);
  padding: 2px 6px; border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.82em; color: var(--cyan);
}
.doc-body pre {
  background: var(--bg-elevated);
  padding: 16px; border-radius: var(--radius-md);
  overflow-x: auto; margin: 12px 0;
  border: 1px solid var(--border);
}

/* ─── Create Task Modal ───────────────────────────────────────────────────── */

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden;
  transition: all 0.3s var(--ease);
}
.modal-overlay.open { opacity: 1; visibility: visible; }

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--cyan-border);
  border-radius: var(--radius-xl);
  padding: 32px;
  width: 100%; max-width: 520px;
  box-shadow: var(--shadow-lg), 0 0 40px var(--cyan-glow);
  transform: scale(0.95);
  transition: transform 0.3s var(--ease);
}
.modal-overlay.open .modal { transform: scale(1); }

.modal-title {
  font-size: 1.15rem; font-weight: 700;
  margin-bottom: 24px;
}

.modal-actions {
  display: flex; justify-content: flex-end;
  gap: 10px; margin-top: 24px;
}

textarea.form-textarea {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.88rem;
  resize: vertical;
  min-height: 100px;
  outline: none;
  transition: border-color var(--duration) var(--ease);
}
textarea.form-textarea:focus { border-color: var(--cyan); box-shadow: 0 0 0 2px var(--cyan-glow); }

/* ─── Loading / Empty States ──────────────────────────────────────────────── */

.loading {
  display: flex; align-items: center; justify-content: center;
  padding: 48px; color: var(--text-muted); font-size: 0.88rem;
}

.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-right: 10px;
}

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

.empty-state {
  text-align: center; padding: 60px 20px; color: var(--text-muted);
}
.empty-state h3 { color: var(--text-secondary); margin-bottom: 8px; }
.empty-state p { font-size: 0.88rem; margin-bottom: 20px; }

/* ─── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .grid-stats { grid-template-columns: repeat(2, 1fr); }
  .detail-panel { width: 100%; max-width: 100%; }
  .org-branch { flex-direction: column; align-items: center; }
  .org-branch::before { display: none; }
}

/* ─── Utility ─────────────────────────────────────────────────────────────── */

.hidden { display: none !important; }
