/* ============================================================
   WishMind — Design System
   Monochrome · Electric Blue Accent · Inter Font
   ============================================================ */

/* ============================================================
   CSS Variables
   ============================================================ */
:root {
  /* Backgrounds */
  --bg-base:       #030303;
  --bg-elevated:   rgba(10, 10, 10, 0.65);
  --bg-card:       rgba(18, 18, 18, 0.55);
  --bg-card-hover: rgba(28, 28, 28, 0.7);
  --bg-input:      rgba(15, 15, 15, 0.85);
  --bg-hover:      rgba(255, 255, 255, 0.05);
  --bg-active:     rgba(255, 255, 255, 0.08);

  /* Borders */
  --border:        rgba(255, 255, 255, 0.08);
  --border-hover:  rgba(255, 255, 255, 0.16);
  --border-focus:  #6366f1;

  /* Text */
  --text-primary:  #ffffff;
  --text-secondary:#ccd0db;
  --text-muted:    #8b93a5;
  --text-dim:      #525866;

  /* Accent - Indigo & Violet Modern Gradient */
  --accent:        #6366f1;
  --accent-hover:  #4f46e5;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --accent-dim:    rgba(99, 102, 241, 0.12);
  --accent-border: rgba(99, 102, 241, 0.25);
  --accent-glow:   0 0 28px rgba(99, 102, 241, 0.25);

  /* Status */
  --positive:      #10b981;
  --positive-bg:   rgba(16, 185, 129, 0.08);
  --positive-border:rgba(16, 185, 129, 0.2);
  --warning:       #f59e0b;
  --warning-bg:    rgba(245, 158, 11, 0.08);
  --warning-border:rgba(245, 158, 11, 0.2);
  --danger:        #f43f5e;
  --danger-bg:     rgba(244, 63, 94, 0.08);
  --danger-border: rgba(244, 63, 94, 0.2);

  /* Layout */
  --sidebar-w: 236px;
  --header-h:  64px;

  /* Typography */
  --font:      'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;

  /* Radius */
  --r-sm:  6px;
  --r:     10px;
  --r-md:  12px;
  --r-lg:  16px;
  --r-xl:  20px;
  --r-full:9999px;

  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.5);
  --shadow:    0 8px 20px rgba(0,0,0,0.4);
  --shadow-lg: 0 16px 40px rgba(0,0,0,0.5);
  --shadow-xl: 0 32px 80px rgba(0,0,0,0.6);

  /* Transitions */
  --t:     0.2s cubic-bezier(0.16, 1, 0.3, 1);
  --t-slow:0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ============================================================
   Light Mode Theme Overrides
   ============================================================ */
body.light-mode {
  /* Backgrounds */
  --bg-base:       #f1f5f9;
  --bg-elevated:   #ffffff;
  --bg-card:       #ffffff;
  --bg-card-hover: #f8fafc;
  --bg-input:      #ffffff;
  --bg-hover:      rgba(0, 0, 0, 0.04);
  --bg-active:     rgba(99, 102, 241, 0.08);

  /* Borders */
  --border:        rgba(0, 0, 0, 0.1);
  --border-hover:  rgba(0, 0, 0, 0.18);

  /* Text */
  --text-primary:  #0f172a;
  --text-secondary:#334155;
  --text-muted:    #64748b;
  --text-dim:      #94a3b8;

  /* Accent overrides for light bg */
  --accent-dim:    rgba(99, 102, 241, 0.1);
  --accent-border: rgba(99, 102, 241, 0.25);
  --accent-glow:   0 8px 24px rgba(99, 102, 241, 0.15);

  /* Status on light */
  --positive-bg:   rgba(16, 185, 129, 0.1);
  --warning-bg:    rgba(245, 158, 11, 0.1);
  --danger-bg:     rgba(244, 63, 94, 0.1);

  /* Softer shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow:    0 4px 16px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 24px 64px rgba(0, 0, 0, 0.1);

  background: var(--bg-base);
  color: var(--text-primary);
}

body.light-mode::before {
  background: radial-gradient(circle, rgba(99, 102, 241, 0.04) 0%, transparent 70%);
}
body.light-mode::after {
  background: radial-gradient(circle, rgba(139, 92, 246, 0.03) 0%, transparent 70%);
}

/* Light mode specific surface overrides */
body.light-mode .sidebar {
  background: #ffffff;
  border-right-color: rgba(0, 0, 0, 0.08);
}
body.light-mode .sidebar-logo {
  border-bottom-color: rgba(0, 0, 0, 0.08);
}
body.light-mode .sidebar-bottom {
  border-top-color: rgba(0, 0, 0, 0.08);
}
body.light-mode .sidebar-notif-btn {
  border-color: rgba(0, 0, 0, 0.1);
  color: #64748b;
}
body.light-mode .sidebar-notif-btn:hover {
  border-color: rgba(0, 0, 0, 0.18);
  color: #0f172a;
  background: rgba(0, 0, 0, 0.04);
}
body.light-mode .nav-item {
  color: #64748b;
}
body.light-mode .nav-item:hover {
  background: rgba(0, 0, 0, 0.04);
  color: #0f172a;
}
body.light-mode .nav-item.active {
  background: rgba(99, 102, 241, 0.08);
  color: #6366f1;
}
body.light-mode .sidebar-user-name { color: #0f172a; }
body.light-mode .sidebar-user-role { color: #64748b; }
body.light-mode .sidebar-logout    { color: #94a3b8; }

body.light-mode .card,
body.light-mode .widget,
body.light-mode .stat-card,
body.light-mode .project-mini-card,
body.light-mode .settings-card {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.08);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
body.light-mode .card:hover,
body.light-mode .stat-card:hover,
body.light-mode .project-mini-card:hover {
  border-color: rgba(0, 0, 0, 0.15);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
body.light-mode .modal-box {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.1);
}
body.light-mode .modal-close {
  background: #f1f5f9;
  border-color: rgba(0, 0, 0, 0.08);
  color: #64748b;
}
body.light-mode .form-input,
body.light-mode .form-select,
body.light-mode .form-textarea,
body.light-mode .copilot-input {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.12);
  color: #0f172a;
}
body.light-mode .form-input::placeholder,
body.light-mode .form-textarea::placeholder,
body.light-mode .copilot-input::placeholder { color: #94a3b8; }
body.light-mode .form-select option {
  background: #ffffff;
  color: #0f172a;
}
body.light-mode .widget-header,
body.light-mode .ai-section,
body.light-mode .copilot-section,
body.light-mode .copilot-header,
body.light-mode .copilot-input-wrap,
body.light-mode .ai-panel-header {
  border-color: rgba(0, 0, 0, 0.07);
}
body.light-mode .copilot-section { background: #f8fafc; }
body.light-mode .copilot-ai {
  background: #f1f5f9;
  border-color: rgba(0,0,0,0.07);
  color: #334155;
}
body.light-mode .project-card {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.08);
}
body.light-mode .project-card:hover {
  border-color: rgba(99, 102, 241, 0.25);
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}
body.light-mode .comment-item {
  background: #f8fafc;
  border-color: rgba(0,0,0,0.06);
}
body.light-mode .comment-feed-wrap { border-color: rgba(0,0,0,0.07); }
body.light-mode .type-tab {
  border-color: rgba(0,0,0,0.1);
  color: #64748b;
}
body.light-mode .type-tab:hover { color: #334155; }
body.light-mode .tag {
  background: #f1f5f9;
  border-color: rgba(0,0,0,0.08);
  color: #64748b;
}
body.light-mode .btn-ghost {
  border-color: rgba(0,0,0,0.12);
  color: #334155;
}
body.light-mode .btn-ghost:hover {
  background: rgba(0,0,0,0.04);
  color: #0f172a;
}
body.light-mode .notif-dropdown {
  background: #ffffff;
  border-color: rgba(0,0,0,0.1);
}
body.light-mode .notif-item { border-bottom-color: rgba(0,0,0,0.06); }
body.light-mode .notif-item:hover { background: #f8fafc; }
body.light-mode .toast {
  background: #ffffff;
  border-color: rgba(0,0,0,0.1);
  color: #0f172a;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}
body.light-mode .auth-body { background: #f1f5f9; }
body.light-mode .auth-card { background: #ffffff; }

/* Theme Toggle Icon Visibility */
body.light-mode .sun-icon  { display: none !important; }
body.light-mode .moon-icon { display: inline !important; }
body:not(.light-mode) .sun-icon  { display: inline !important; }
body:not(.light-mode) .moon-icon { display: none !important; }



/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--font);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Abstract Ambient Glow Effects */
body::before {
  content: '';
  position: fixed;
  top: -15%;
  left: -15%;
  width: 60%;
  height: 60%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.07) 0%, transparent 70%);
  pointer-events: none;
  z-index: -1;
}

body::after {
  content: '';
  position: fixed;
  bottom: -15%;
  right: -15%;
  width: 60%;
  height: 60%;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.05) 0%, transparent 70%);
  pointer-events: none;
  z-index: -1;
}

a { color: var(--accent); text-decoration: none; transition: color var(--t), transform var(--t); }
a:hover { color: var(--accent-hover); }

img { max-width: 100%; display: block; }

h1,h2,h3,h4,h5 { font-weight: 700; letter-spacing: -0.03em; line-height: 1.25; }

ul, ol { list-style: none; }

button { font-family: var(--font); cursor: pointer; border: none; outline: none; background: none; }

input, textarea, select { font-family: var(--font); }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: var(--r-full); }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.15); }

::selection { background: var(--accent-dim); color: var(--text-primary); }

/* ============================================================
   Typography
   ============================================================ */
.page-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--text-primary);
}
.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 3px;
}
.section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.text-muted   { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-danger  { color: var(--danger); }
.text-positive{ color: var(--positive); }
.text-sm      { font-size: 12px; }
.text-xs      { font-size: 11px; }
.font-mono    { font-family: var(--font-mono); font-size: 13px; }

/* ============================================================
   Auth Layout
   ============================================================ */
.auth-body {
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
}

.auth-page {
  position: relative;
  z-index: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-glow {
  position: fixed;
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 400px;
  background: radial-gradient(ellipse, rgba(59,130,246,0.12) 0%, transparent 70%);
  pointer-events: none;
}

.auth-card {
  background: #0a0a0a;
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 44px 48px;
  width: 100%;
  max-width: 420px;
  animation: fadeInUp .4s ease;
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 36px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.04em;
}
.auth-logo-icon {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: var(--r);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--accent-glow);
}
.auth-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.04em;
  margin-bottom: 4px;
}
.auth-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 28px;
}
.auth-form { display: flex; flex-direction: column; gap: 0; }
.auth-footer {
  margin-top: 28px;
  text-align: center;
  font-size: 12px;
  color: var(--text-dim);
}

/* ============================================================
   App Shell Layout
   ============================================================ */
.app-body {
  background: var(--bg-base);
}
.app-shell {
  display: flex;
  min-height: 100vh;
}
.main-content {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-w);
  padding: 32px 36px 48px;
  max-width: 100%;
}

/* ============================================================
   Sidebar
   ============================================================ */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow: hidden;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--text-primary);
  flex-shrink: 0;
}
.sidebar-logo-mark {
  width: 30px;
  height: 30px;
  background: var(--accent);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
  box-shadow: var(--accent-glow);
}
.sidebar-logo-name { font-weight: 700; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-section {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.nav-divider {
  height: 1px;
  background: var(--border);
  margin: 10px 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--t);
  position: relative;
}
.nav-item:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}
.nav-item.active {
  color: var(--text-primary);
  background: var(--bg-active);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}
.nav-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  flex-shrink: 0;
}

.sidebar-bottom {
  padding: 12px 10px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-notif-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 8px 10px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--text-muted);
  font-size: 12px;
  transition: all var(--t);
  position: relative;
  cursor: pointer;
}
.sidebar-notif-btn:hover { border-color: var(--border-hover); color: var(--text-primary); }

.notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: var(--r-full);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--r);
  transition: background var(--t);
}
.sidebar-user:hover { background: var(--bg-hover); }
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role { font-size: 11px; color: var(--text-muted); }
.sidebar-logout {
  color: var(--text-dim);
  display: flex;
  align-items: center;
  transition: color var(--t);
}
.sidebar-logout:hover { color: var(--danger); }

/* ============================================================
   Page Header
   ============================================================ */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.page-header-actions { display: flex; gap: 8px; align-items: center; }

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--text-primary); }
.breadcrumb-sep { color: var(--text-dim); }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--r);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
  transition: all var(--t);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color:#fff; }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-hover); }

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: var(--danger-border);
}
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-full { width: 100%; justify-content: center; }
.btn-sm   { padding: 6px 11px; font-size: 12px; }
.btn-xs   { padding: 4px 8px; font-size: 11px; }
.btn-lg   { padding: 11px 20px; font-size: 15px; }

.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  font-family: var(--font);
  transition: color var(--t);
}
.btn-link:hover { color: var(--accent-hover); }

/* ============================================================
   Forms
   ============================================================ */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.form-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}
.form-hint { font-size: 11px; color: var(--text-muted); }
.form-hint a { font-size: 11px; }

.form-input, .form-select, .form-textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--text-primary);
  font-size: 13px;
  padding: 9px 12px;
  transition: border-color var(--t), box-shadow var(--t);
  width: 100%;
}
.form-input::placeholder { color: var(--text-dim); }
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2'%3E%3Cpolyline points='6,9 12,15 18,9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
  cursor: pointer;
}
.form-select option { background: #111; }
.form-textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
.form-textarea.comment-textarea { min-height: 72px; border-radius: var(--r-lg); }

.input-with-action { position: relative; display: flex; align-items: center; }
.input-with-action .form-input { padding-right: 40px; }
.input-action-btn {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  transition: color var(--t);
  display: flex;
  align-items: center;
}
.input-action-btn:hover { color: var(--text-primary); }

/* ============================================================
   Badges & Pills
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.01em;
}
.badge-xs { font-size: 10px; padding: 2px 6px; }
.badge-lg { font-size: 12px; padding: 4px 10px; }

.badge-positive { background: var(--positive-bg); color: var(--positive); border: 1px solid var(--positive-border); }
.badge-warning  { background: var(--warning-bg);  color: var(--warning);  border: 1px solid var(--warning-border); }
.badge-danger   { background: var(--danger-bg);   color: var(--danger);   border: 1px solid var(--danger-border); }
.badge-accent   { background: var(--accent-dim);  color: var(--accent);   border: 1px solid var(--accent-border); }
.badge-muted    { background: rgba(100,100,100,.1); color: var(--text-muted); border: 1px solid rgba(100,100,100,.2); }
.badge-client   { background: rgba(168,85,247,.1); color: #A855F7; border: 1px solid rgba(168,85,247,.25); }

/* ============================================================
   Cards
   ============================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
}
.card:hover { border-color: var(--border-hover); }

/* ============================================================
   Avatars
   ============================================================ */
.avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 700;
  letter-spacing: -0.02em;
  flex-shrink: 0;
  font-size: 11px;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,.3);
}
.avatar-xxs  { width: 18px; height: 18px; font-size: 9px; }
.avatar-xs   { width: 22px; height: 22px; font-size: 9px; }
.avatar-sm   { width: 28px; height: 28px; font-size: 11px; }
.avatar-md   { width: 34px; height: 34px; font-size: 12px; }
.avatar-lg   { width: 42px; height: 42px; font-size: 15px; }

.avatar-stack { display: flex; align-items: center; }
.avatar-stack .avatar { border: 2px solid var(--bg-base); margin-left: -5px; }
.avatar-stack .avatar:first-child { margin-left: 0; }
.avatar-stack-lg .avatar { border: 2px solid var(--bg-card); margin-left: -7px; }
.avatar-stack-lg .avatar:first-child { margin-left: 0; }

/* ============================================================
   Tags
   ============================================================ */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}
.tag-list { display: flex; flex-wrap: wrap; gap: 5px; }

/* ============================================================
   Meta chips
   ============================================================ */
.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
}
.meta-sep { color: var(--text-dim); margin: 0 4px; }
.meta-item { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-muted); }

/* ============================================================
   Stats Grid (Dashboard)
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: border-color var(--t), transform var(--t);
}
.stat-card:hover { border-color: var(--border-hover); transform: translateY(-1px); }
.stat-icon {
  width: 38px;
  height: 38px;
  border-radius: var(--r);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-icon-blue   { background: var(--accent-dim);    color: var(--accent); }
.stat-icon-purple { background: rgba(139,92,246,.12); color: #8B5CF6; }
.stat-icon-green  { background: var(--positive-bg);   color: var(--positive); }
.stat-icon-red    { background: var(--danger-bg);     color: var(--danger); }
.stat-value { font-size: 26px; font-weight: 800; letter-spacing: -0.04em; line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 3px; }

/* ============================================================
   Dashboard Grid
   ============================================================ */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 24px;
  align-items: start;
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

/* Mini project grid */
.project-mini-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.project-mini-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  transition: all var(--t);
  color: inherit;
}
.project-mini-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow);
  color: inherit;
}
.project-mini-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.project-mini-name { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.project-mini-client { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.project-mini-meta { display: flex; gap: 12px; align-items: center; }

/* Widgets */
.widget {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: 14px;
}
.widget:last-child { margin-bottom: 0; }
.widget-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.widget-title {
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Health list */
.health-list { padding: 12px 16px; display: flex; flex-direction: column; gap: 12px; }
.health-item {}
.health-item-info { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; }
.health-item-name { font-size: 13px; color: var(--text-secondary); }
.health-item-name:hover { color: var(--text-primary); }
.health-item-score { font-size: 12px; font-weight: 700; }

/* Health bars */
.health-bar-wrap {
  height: 3px;
  background: var(--bg-hover);
  border-radius: var(--r-full);
  overflow: hidden;
  margin-top: 2px;
}
.health-bar {
  height: 100%;
  border-radius: var(--r-full);
  transition: width 1s ease;
}

/* Health badge */
.health-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
}
.health-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Activity feed */
.activity-feed { padding: 4px 0; display: flex; flex-direction: column; }
.activity-item {
  display: flex;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  transition: background var(--t);
}
.activity-item:last-child { border-bottom: none; }
.activity-item:hover { background: var(--bg-hover); }
.activity-body { flex: 1; min-width: 0; }
.activity-text { font-size: 12.5px; color: var(--text-secondary); line-height: 1.4; }
.activity-text strong { color: var(--text-primary); font-weight: 600; }
.activity-text a { color: var(--text-primary); font-weight: 500; }
.activity-text a:hover { color: var(--accent); }
.activity-time { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.empty-state-sm { padding: 20px 16px; text-align: center; font-size: 13px; color: var(--text-muted); }

/* ============================================================
   Projects Grid
   ============================================================ */
.filter-bar { margin-bottom: 24px; }
.filter-form { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.search-wrap { position: relative; display: flex; align-items: center; }
.search-icon { position: absolute; left: 10px; color: var(--text-muted); pointer-events: none; }
.search-input { padding-left: 32px; width: 220px; }

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.project-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  transition: all var(--t);
  color: inherit;
  position: relative;
  overflow: hidden;
}
.project-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  color: inherit;
}

.project-card-header { display: flex; flex-direction: column; gap: 6px; }
.project-card-title-wrap { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.project-card-name { font-size: 15px; font-weight: 600; color: var(--text-primary); line-height: 1.3; }
.project-card-client { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-muted); }

.project-card-stats { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.project-stat { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-muted); }

.project-card-footer { display: flex; align-items: center; justify-content: space-between; }

/* ============================================================
   Sub-project List
   ============================================================ */
.sub-projects-list { display: flex; flex-direction: column; gap: 8px; }

.sub-project-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 18px;
  transition: all var(--t);
  color: inherit;
}
.sub-project-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
  color: inherit;
}

.sub-card-left { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; }
.sub-card-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.sub-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.sub-status-not_started  { background: var(--text-dim); }
.sub-status-in_progress  { background: var(--accent); box-shadow: 0 0 8px var(--accent-dim); }
.sub-status-review       { background: var(--warning); }
.sub-status-completed    { background: var(--positive); }
.sub-status-blocked      { background: var(--danger); }

.sub-card-info { flex: 1; min-width: 0; }
.sub-card-title { font-size: 14px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub-card-meta { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); margin-top: 3px; flex-wrap: wrap; }
.sub-card-arrow { color: var(--text-dim); transition: transform var(--t); }
.sub-project-card:hover .sub-card-arrow { transform: translateX(2px); color: var(--text-muted); }

.ai-health-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  background: var(--bg-hover);
  border-radius: var(--r-full);
  border: 1px solid var(--border);
}
.ai-dot-sm { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }

/* ============================================================
   Project Header (show page)
   ============================================================ */
.project-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.project-header-left { flex: 1; min-width: 0; }
.project-header-top { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.project-client-line { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); }
.project-header-right { display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.project-header-actions { display: flex; gap: 8px; }
.project-description {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 18px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 8px;
}

/* ============================================================
   Sub-project Split View
   ============================================================ */
.subproject-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.subproject-header-left { flex: 1; }
.subproject-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.subproject-header-right { display: flex; gap: 8px; flex-shrink: 0; }

.split-view {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
  align-items: start;
}
.split-left  { display: flex; flex-direction: column; gap: 16px; }
.split-right {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  overflow: hidden;
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}

.split-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.panel-title { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }

/* Comment Feed */
.comment-feed {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 180px;
}
.comment-item {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--r-lg);
  transition: background var(--t);
  border: 1px solid transparent;
}
.comment-item:hover { background: var(--bg-card); border-color: var(--border); }
.comment-client {
  background: rgba(168,85,247,0.04);
  border-color: rgba(168,85,247,0.15);
}
.comment-client:hover { border-color: rgba(168,85,247,0.25); }

.comment-avatar { flex-shrink: 0; padding-top: 2px; }
.comment-body { flex: 1; min-width: 0; }
.comment-header {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 5px;
  flex-wrap: wrap;
}
.comment-author { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.comment-time   { font-size: 11px; color: var(--text-muted); margin-left: auto; }
.comment-content { font-size: 13.5px; color: var(--text-secondary); line-height: 1.6; white-space: pre-wrap; word-break: break-word; }

.comment-type-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--r-full);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.type-accent  { background: var(--accent-dim); color: var(--accent); }
.type-client  { background: rgba(168,85,247,.12); color: #A855F7; }
.type-danger  { background: var(--danger-bg); color: var(--danger); }
.type-positive{ background: var(--positive-bg); color: var(--positive); }
.type-muted   { background: var(--bg-hover); color: var(--text-muted); }

.comment-client-badge {
  font-size: 10px;
  background: rgba(168,85,247,.12);
  color: #A855F7;
  padding: 1px 6px;
  border-radius: var(--r-full);
  font-weight: 600;
}

.comment-delete-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 2px;
  transition: color var(--t);
  display: flex;
  align-items: center;
}
.comment-delete-btn:hover { color: var(--danger); }

/* Comment type legend */
.comment-type-legend { display: flex; gap: 10px; }
.legend-item { font-size: 11px; color: var(--text-muted); }
.legend-update::before { content: '●'; color: var(--accent); margin-right: 4px; }
.legend-client_feedback::before { content: '●'; color: #A855F7; margin-right: 4px; }
.legend-blocker::before { content: '●'; color: var(--danger); margin-right: 4px; }

/* Comment form */
.comment-form-wrap {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 14px;
}
.comment-form-body { flex: 1; }
.comment-type-tabs { display: flex; gap: 4px; margin-bottom: 10px; flex-wrap: wrap; }
.type-tab {
  padding: 4px 10px;
  border-radius: var(--r-full);
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t);
}
.type-tab:hover { border-color: var(--border-hover); color: var(--text-secondary); }
.type-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.comment-form-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.client-toggle { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); cursor: pointer; }
.client-toggle input { accent-color: #A855F7; cursor: pointer; }

/* ============================================================
   AI Panel
   ============================================================ */
.ai-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  gap: 10px;
}
.ai-panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.01em;
}

/* AI dots */
.ai-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  box-shadow: 0 0 8px var(--accent);
}
.ai-dot-pulse {
  animation: pulse-glow 2s ease-in-out infinite;
}
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 4px var(--accent); opacity: 1; }
  50%       { box-shadow: 0 0 14px var(--accent); opacity: .7; }
}

/* AI sections */
.ai-section { padding: 14px 18px; border-bottom: 1px solid var(--border); }
.ai-section:last-child { border-bottom: none; }
.ai-section-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}
.ai-label-danger  { color: var(--danger); }
.ai-label-positive{ color: var(--positive); }
.ai-label-warning { color: var(--warning); }

.ai-summary { font-size: 13px; color: var(--text-secondary); line-height: 1.6; }

.sentiment-row { display: flex; flex-direction: column; gap: 10px; }
.sentiment-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: var(--r-full);
  border: 1px solid currentColor;
  font-size: 12px;
  font-weight: 700;
  width: fit-content;
}

.score-meters { display: flex; flex-direction: column; gap: 8px; }
.score-meter { display: flex; align-items: center; gap: 8px; }
.score-meter-label { font-size: 11px; color: var(--text-muted); width: 60px; flex-shrink: 0; }
.score-bar-wrap { flex: 1; height: 4px; background: var(--bg-hover); border-radius: var(--r-full); overflow: hidden; }
.score-bar { height: 100%; border-radius: var(--r-full); transition: width 1s ease; }
.score-meter-value { font-size: 11px; font-weight: 700; width: 30px; text-align: right; flex-shrink: 0; }

.ai-list { display: flex; flex-direction: column; gap: 5px; }
.ai-list li {
  font-size: 12.5px;
  color: var(--text-secondary);
  padding: 6px 10px;
  border-radius: var(--r);
  line-height: 1.4;
  position: relative;
  padding-left: 20px;
}
.ai-list li::before { content: ''; position: absolute; left: 8px; top: 11px; width: 5px; height: 5px; border-radius: 50%; }
.ai-list-danger  li { background: var(--danger-bg); }
.ai-list-danger  li::before { background: var(--danger); }
.ai-list-positive li { background: var(--positive-bg); }
.ai-list-positive li::before { background: var(--positive); }

/* Action items */
.action-items { display: flex; flex-direction: column; gap: 6px; }
.action-item { display: flex; gap: 10px; align-items: flex-start; }
.action-item-check {
  width: 18px;
  height: 18px;
  border: 1px solid var(--border-hover);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--text-dim);
}
.action-item-body { flex: 1; }
.action-item-task { font-size: 13px; color: var(--text-secondary); line-height: 1.4; }
.action-item-meta { display: flex; gap: 8px; margin-top: 3px; font-size: 11px; color: var(--text-muted); align-items: center; flex-wrap: wrap; }

.ai-gap-text { font-size: 12.5px; color: var(--text-secondary); line-height: 1.5; background: var(--warning-bg); padding: 8px 10px; border-radius: var(--r); border: 1px solid var(--warning-border); }

.ai-generated-at { padding: 10px 18px; font-size: 11px; color: var(--text-dim); }

/* AI placeholder */
.ai-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 32px 24px;
  gap: 12px;
}
.ai-placeholder-icon { color: var(--text-dim); }
.ai-placeholder-text { font-size: 13px; color: var(--text-muted); line-height: 1.6; }

/* AI Loading skeleton */
.ai-loading { padding: 20px 18px; display: flex; flex-direction: column; gap: 10px; }
.ai-skeleton {
  height: 12px;
  background: linear-gradient(90deg, var(--bg-hover) 25%, var(--bg-active) 50%, var(--bg-hover) 75%);
  background-size: 200% 100%;
  border-radius: var(--r-full);
  animation: skeleton 1.5s infinite;
  width: 100%;
}
@keyframes skeleton {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================================================
   AI Copilot
   ============================================================ */
.copilot-section {
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
}
.copilot-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.copilot-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}
.copilot-messages {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
}
.copilot-msg {
  font-size: 13px;
  line-height: 1.5;
  padding: 9px 12px;
  border-radius: var(--r-lg);
  max-width: 95%;
  white-space: pre-wrap;
  word-break: break-word;
}
.copilot-ai {
  background: var(--bg-hover);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  align-self: flex-start;
}
.copilot-user {
  background: var(--accent-dim);
  color: var(--text-primary);
  border: 1px solid var(--accent-border);
  align-self: flex-end;
}
.copilot-thinking {
  display: flex;
  gap: 3px;
  align-items: center;
  padding: 10px 12px;
}
.copilot-thinking span {
  width: 5px;
  height: 5px;
  background: var(--text-muted);
  border-radius: 50%;
  animation: thinking-bounce 1.2s infinite;
}
.copilot-thinking span:nth-child(2) { animation-delay: 0.2s; }
.copilot-thinking span:nth-child(3) { animation-delay: 0.4s; }
@keyframes thinking-bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40%           { transform: translateY(-5px); }
}

.copilot-input-wrap {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
}
.copilot-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  color: var(--text-primary);
  font-size: 13px;
  padding: 8px 14px;
  transition: border-color var(--t);
  font-family: var(--font);
}
.copilot-input:focus { outline: none; border-color: var(--border-focus); }
.copilot-input::placeholder { color: var(--text-dim); }
.copilot-send {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--t);
}
.copilot-send:hover { background: var(--accent-hover); }

.copilot-quick-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 8px 14px 14px;
}
.quick-prompt {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  color: var(--text-muted);
  font-size: 11px;
  padding: 4px 10px;
  cursor: pointer;
  transition: all var(--t);
  font-family: var(--font);
}
.quick-prompt:hover { border-color: var(--accent); color: var(--accent); }

/* ============================================================
   Modals
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn .15s ease;
}
.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border-hover);
  border-radius: var(--r-xl);
  padding: 28px 32px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  animation: scaleIn .2s ease;
  box-shadow: var(--shadow-xl);
}
.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 12px;
  transition: all var(--t);
}
.modal-close:hover { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-border); }
.modal-title { font-size: 18px; font-weight: 700; margin-bottom: 20px; letter-spacing: -0.03em; }
.modal-form { display: flex; flex-direction: column; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border); }

/* ============================================================
   Toast Notifications
   ============================================================ */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-hover);
  border-radius: var(--r-lg);
  padding: 12px 16px;
  font-size: 13px;
  min-width: 280px;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
  pointer-events: all;
  animation: slideInRight .25s ease;
  border-left: 3px solid var(--border-hover);
}
.toast-success { border-left-color: var(--positive); }
.toast-error   { border-left-color: var(--danger);   }
.toast-warning { border-left-color: var(--warning);  }
.toast-info    { border-left-color: var(--accent);   }
.toast-icon { width: 16px; height: 16px; flex-shrink: 0; }
.toast-msg  { flex: 1; color: var(--text-secondary); }
.toast-exit { animation: slideOutRight .25s ease forwards; }

/* ============================================================
   Notification Dropdown
   ============================================================ */
.notif-dropdown {
  position: fixed;
  bottom: 80px;
  left: 10px;
  width: 320px;
  background: var(--bg-card);
  border: 1px solid var(--border-hover);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xl);
  z-index: 500;
  overflow: hidden;
  animation: scaleIn .15s ease;
}
.notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
}
.notif-list { max-height: 320px; overflow-y: auto; }
.notif-empty { padding: 20px; text-align: center; font-size: 13px; color: var(--text-muted); }
.notif-item {
  display: flex;
  gap: 10px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--t);
}
.notif-item:hover { background: var(--bg-hover); }
.notif-item.unread { background: var(--accent-dim); }
.notif-item:last-child { border-bottom: none; }
.notif-time { font-size: 11px; color: var(--text-dim); margin-top: 2px; }

/* ============================================================
   Team Table
   ============================================================ */
.team-table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  overflow: hidden;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
}
.data-table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-secondary);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr.row-inactive td { opacity: .5; }
.data-table tbody tr { transition: background var(--t); }
.data-table tbody tr:hover { background: var(--bg-hover); }
.user-cell { display: flex; align-items: center; gap: 10px; }
.user-cell-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.user-cell-email { font-size: 11px; color: var(--text-muted); }

/* ============================================================
   Settings
   ============================================================ */
.settings-layout { display: flex; flex-direction: column; gap: 16px; max-width: 680px; }
.settings-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 24px;
}
.settings-card-header {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 24px;
}
.settings-card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--r-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.settings-icon-blue   { background: var(--accent-dim); color: var(--accent); }
.settings-icon-purple { background: rgba(139,92,246,.12); color: #8B5CF6; }
.settings-card-title  { font-size: 15px; font-weight: 600; }
.settings-card-desc   { font-size: 13px; color: var(--text-muted); margin-top: 3px; line-height: 1.5; }
.settings-actions { display: flex; gap: 10px; align-items: center; margin-top: 6px; }
.test-result {
  font-size: 13px;
  padding: 4px 10px;
  border-radius: var(--r-full);
}
.test-result.success { color: var(--positive); background: var(--positive-bg); }
.test-result.error   { color: var(--danger);   background: var(--danger-bg); }

.settings-info-card { padding: 16px 24px; }
.settings-info-row  { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.settings-info-row:last-child { border-bottom: none; }
.settings-info-label { color: var(--text-muted); }
.settings-info-value { color: var(--text-primary); font-weight: 500; }

/* ============================================================
   Alerts
   ============================================================ */
.alert {
  border-radius: var(--r-lg);
  font-size: 13px;
  padding: 11px 15px;
  margin-bottom: 18px;
  border: 1px solid transparent;
}
.alert-success { background: var(--positive-bg); border-color: var(--positive-border); color: var(--positive); }
.alert-error   { background: var(--danger-bg);   border-color: var(--danger-border);   color: var(--danger); }
.alert-warning { background: var(--warning-bg);  border-color: var(--warning-border);  color: var(--warning); }
.alert-info    { background: var(--accent-dim);  border-color: var(--accent-border);   color: var(--accent); }

/* ============================================================
   Empty States
   ============================================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 56px 32px;
  gap: 12px;
}
.empty-icon { color: var(--text-dim); }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--text-secondary); }
.empty-state p  { font-size: 13px; color: var(--text-muted); max-width: 300px; }

/* ============================================================
   Utility
   ============================================================ */
.hidden   { display: none !important; }
.flex     { display: flex; }
.flex-col { flex-direction: column; }
.gap-8    { gap: 8px; }
.gap-12   { gap: 12px; }
.mt-16    { margin-top: 16px; }
.fw-600   { font-weight: 600; }
.text-center { text-align: center; }

/* ============================================================
   Animations
   ============================================================ */
@keyframes fadeIn       { from { opacity: 0; }                         to { opacity: 1; } }
@keyframes fadeInUp     { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes scaleIn      { from { opacity: 0; transform: scale(.95); }  to { opacity: 1; transform: scale(1); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes slideOutRight{ from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(20px); } }

.fade-in { animation: fadeIn .3s ease; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1200px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-side { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
}
@media (max-width: 1024px) {
  .split-view { grid-template-columns: 1fr; }
  .split-right { position: static; max-height: none; }
  .stats-grid { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }
  .main-content { margin-left: 0; padding: 20px 16px; }
  .sidebar { display: none; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .project-mini-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 32px 24px; }
}

/* ============================================================
   AI Run Monitor Page
   ============================================================ */
.aim-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-radius: var(--r-lg);
  font-size: 13px;
  margin-bottom: 20px;
  line-height: 1.5;
}
.aim-alert a { font-size: 13px; font-weight: 600; text-decoration: underline; }
.aim-alert-danger {
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  color: var(--danger);
}

.aim-config-bar {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px 24px;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 8px 0;
}
.aim-config-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 24px;
}
.aim-config-item:first-child { padding-left: 0; }
.aim-config-sep {
  width: 1px;
  height: 36px;
  background: var(--border);
  flex-shrink: 0;
}
.aim-config-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}
.aim-config-value {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}
.aim-ready-count { color: var(--positive); }

/* Group container */
.aim-group {
  margin-bottom: 24px;
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  overflow: hidden;
  background: var(--bg-card);
}
.aim-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-hover);
}
.aim-group-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 7px;
  flex: 1;
  transition: color var(--t);
}
.aim-group-name:hover { color: var(--accent); }
.aim-group-count {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: auto;
}

/* Table */
.aim-table-wrap { overflow-x: auto; }
.aim-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.aim-table thead tr { border-bottom: 1px solid var(--border); }
.aim-table th {
  padding: 10px 16px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.aim-table td {
  padding: 13px 16px;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
}
.aim-table tbody tr:last-child td { border-bottom: none; }
.aim-table tbody tr { transition: background var(--t); }
.aim-table tbody tr:hover { background: var(--bg-hover); }

/* Row status colour strips */
.aim-row-ready       { border-left: 3px solid var(--positive); }
.aim-row-cooling     { border-left: 3px solid var(--warning); }
.aim-row-waiting     { border-left: 3px solid var(--accent); }
.aim-row-insufficient{ border-left: 3px solid var(--text-dim); }
.aim-row-no_key      { border-left: 3px solid var(--danger); }

/* Campaign cell */
.aim-campaign-cell { white-space: nowrap; }
.aim-campaign-link {
  font-weight: 600;
  color: var(--text-primary);
  transition: color var(--t);
}
.aim-campaign-link:hover { color: var(--accent); }

/* Last run cell */
.aim-time-cell { display: flex; flex-direction: column; gap: 3px; }
.aim-time-main { font-size: 13px; color: var(--text-primary); font-weight: 500; }
.aim-sentiment { font-size: 11px; font-weight: 600; }
.aim-health    { font-size: 11px; color: var(--text-muted); }
.aim-never     { font-size: 12px; color: var(--text-dim); font-style: italic; }

/* New comments cell */
.aim-comments-cell { display: flex; flex-direction: column; gap: 4px; }
.aim-count-row { display: flex; align-items: baseline; gap: 6px; }
.aim-new-count {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-secondary);
  line-height: 1;
  letter-spacing: -0.03em;
}
.aim-new-ready { color: var(--positive); }
.aim-total-count { font-size: 11px; color: var(--text-muted); }

/* Progress bars */
.aim-progress-wrap {
  height: 3px;
  background: var(--bg-hover);
  border-radius: var(--r-full);
  overflow: hidden;
  margin-top: 3px;
}
.aim-progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: var(--r-full);
  transition: width 0.6s ease;
}
.aim-progress-ready { background: var(--positive); }
.aim-progress-cd    { background: var(--warning); }

/* Cooldown cell */
.aim-cd-cell      { display: flex; flex-direction: column; gap: 4px; }
.aim-cd-done      { font-size: 12px; color: var(--positive); font-weight: 600; }
.aim-cd-remaining { font-size: 12px; color: var(--warning); font-weight: 600; }
.aim-cd-na        { font-size: 12px; color: var(--text-dim); }

/* Next run cell */
.aim-next-cell    { display: flex; flex-direction: column; gap: 3px; }
.aim-next-now     { font-size: 13px; font-weight: 700; color: var(--positive); }
.aim-next-time    { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.aim-next-abs     { font-size: 11px; color: var(--text-muted); }
.aim-next-unknown { color: var(--text-dim); font-size: 13px; }

/* Light mode overrides */
body.light-mode .aim-config-bar,
body.light-mode .aim-group        { background: #ffffff; border-color: rgba(0,0,0,0.08); }
body.light-mode .aim-group-header { background: #f8fafc; border-bottom-color: rgba(0,0,0,0.07); }
body.light-mode .aim-table th     { color: #64748b; }
body.light-mode .aim-table td     { border-bottom-color: rgba(0,0,0,0.06); }
body.light-mode .aim-table tbody tr:hover { background: #f8fafc; }
body.light-mode .aim-progress-wrap{ background: rgba(0,0,0,0.07); }
body.light-mode .aim-config-sep   { background: rgba(0,0,0,0.08); }


