/* ===================================================================
   PERSONAL TASK BOARD & CRM - PREMIUM DESIGN SYSTEM
   Modern, Glassmorphic, Highly Personalizable, Responsive UI
   =================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700;800&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;600&display=swap');

:root {
  /* Default Theme: Obsidian */
  --bg-base: #090b10;
  --bg-surface: #0f131c;
  --bg-card: rgba(22, 27, 40, 0.7);
  --bg-card-hover: rgba(30, 37, 55, 0.85);
  --bg-header: rgba(12, 16, 26, 0.85);
  --bg-modal: #131722;
  --bg-input: rgba(18, 22, 33, 0.8);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(99, 102, 241, 0.5);
  --border-subtle: rgba(255, 255, 255, 0.04);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #0f172a;

  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-light: rgba(99, 102, 241, 0.15);
  --accent-glow: rgba(99, 102, 241, 0.4);

  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.15);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.15);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.15);
  --info: #06b6d4;
  --info-bg: rgba(6, 182, 212, 0.15);
  --purple: #8b5cf6;
  --purple-bg: rgba(139, 92, 246, 0.15);

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 25px var(--accent-glow);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --font-main: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-display: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --card-padding: 16px;
  --card-gap: 12px;
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Themes */
body.theme-midnight {
  --bg-base: #060919;
  --bg-surface: #0a0f26;
  --bg-card: rgba(16, 24, 54, 0.65);
  --bg-card-hover: rgba(23, 34, 74, 0.85);
  --bg-header: rgba(10, 15, 38, 0.9);
  --bg-modal: #0d1433;
  --bg-input: rgba(18, 26, 60, 0.7);
  --border-color: rgba(99, 102, 241, 0.15);
  --accent: #38bdf8;
  --accent-hover: #0284c7;
  --accent-light: rgba(56, 189, 248, 0.15);
  --accent-glow: rgba(56, 189, 248, 0.35);
}

body.theme-cyberpunk {
  --bg-base: #0d0914;
  --bg-surface: #170d24;
  --bg-card: rgba(32, 16, 52, 0.7);
  --bg-card-hover: rgba(46, 22, 74, 0.85);
  --bg-header: rgba(19, 10, 31, 0.92);
  --bg-modal: #1d0f30;
  --bg-input: rgba(38, 18, 62, 0.8);
  --border-color: rgba(244, 63, 94, 0.2);
  --accent: #f43f5e;
  --accent-hover: #e11d48;
  --accent-light: rgba(244, 63, 94, 0.15);
  --accent-glow: rgba(244, 63, 94, 0.45);
}

body.theme-emerald {
  --bg-base: #06110d;
  --bg-surface: #0b1c15;
  --bg-card: rgba(14, 38, 28, 0.65);
  --bg-card-hover: rgba(20, 52, 38, 0.85);
  --bg-header: rgba(9, 24, 18, 0.9);
  --bg-modal: #0f271d;
  --bg-input: rgba(16, 42, 31, 0.8);
  --border-color: rgba(16, 185, 129, 0.18);
  --accent: #10b981;
  --accent-hover: #059669;
  --accent-light: rgba(16, 185, 129, 0.15);
  --accent-glow: rgba(16, 185, 129, 0.35);
}

body.theme-sunset {
  --bg-base: #140b12;
  --bg-surface: #20101c;
  --bg-card: rgba(45, 19, 39, 0.65);
  --bg-card-hover: rgba(62, 25, 54, 0.85);
  --bg-header: rgba(26, 11, 22, 0.92);
  --bg-modal: #261121;
  --bg-input: rgba(50, 20, 43, 0.8);
  --border-color: rgba(249, 115, 22, 0.2);
  --accent: #f97316;
  --accent-hover: #ea580c;
  --accent-light: rgba(249, 115, 22, 0.15);
  --accent-glow: rgba(249, 115, 22, 0.4);
}

body.theme-light {
  --bg-base: #f1f5f9;
  --bg-surface: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.95);
  --bg-card-hover: #ffffff;
  --bg-header: rgba(255, 255, 255, 0.95);
  --bg-modal: #ffffff;
  --bg-input: #f8fafc;
  --border-color: rgba(0, 0, 0, 0.08);
  --border-focus: rgba(99, 102, 241, 0.6);
  --border-subtle: rgba(0, 0, 0, 0.04);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --text-inverse: #f8fafc;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-light: rgba(79, 70, 229, 0.1);
  --accent-glow: rgba(79, 70, 229, 0.2);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.12);
}

body.bg-style-mesh {
  background-color: var(--bg-base);
  background-image: 
    radial-gradient(at 15% 15%, var(--accent-glow) 0px, transparent 40%),
    radial-gradient(at 85% 85%, rgba(139, 92, 246, 0.2) 0px, transparent 45%),
    radial-gradient(at 50% 50%, rgba(6, 182, 212, 0.15) 0px, transparent 50%);
  background-attachment: fixed;
}
body.bg-style-grid {
  background-color: var(--bg-base);
  background-image: 
    linear-gradient(to right, rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 32px 32px;
}
body.bg-style-dots {
  background-color: var(--bg-base);
  background-image: radial-gradient(rgba(255, 255, 255, 0.08) 1.5px, transparent 1.5px);
  background-size: 24px 24px;
}
body.bg-style-minimal { background-color: var(--bg-base); }

body.density-compact { --card-padding: 10px; --card-gap: 8px; }
body.density-spacious { --card-padding: 20px; --card-gap: 16px; }

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

html, body {
  height: 100%;
  font-family: var(--font-main);
  color: var(--text-primary);
  background-color: var(--bg-base);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

a { color: var(--accent); text-decoration: none; transition: color var(--transition-fast); }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; border: none; background: transparent; color: inherit; outline: none; }
input, textarea, select {
  font-family: inherit; font-size: inherit; color: var(--text-primary); background: var(--bg-input);
  border: 1px solid var(--border-color); border-radius: var(--radius-sm); padding: 8px 12px; outline: none;
  transition: all var(--transition-fast);
}
input:focus, textarea:focus, select:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--accent-light); }

#app-container { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

/* Header */
.app-header {
  height: 64px;
  background: var(--bg-header);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 40;
  flex-shrink: 0;
}
.header-brand { display: flex; align-items: center; gap: 12px; }
.brand-logo {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 800; color: white; box-shadow: var(--shadow-glow);
}
.brand-title { font-family: var(--font-display); font-size: 18px; font-weight: 700; letter-spacing: -0.5px; display: flex; align-items: center; gap: 8px; }
.brand-badge { font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: var(--radius-full); background: var(--accent-light); color: var(--accent); text-transform: uppercase; }

.nav-views {
  display: flex; background: rgba(0, 0, 0, 0.25); padding: 3px; border-radius: var(--radius-md); border: 1px solid var(--border-color); gap: 2px;
}
.nav-tab {
  padding: 6px 12px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 600; color: var(--text-secondary);
  display: flex; align-items: center; gap: 6px; transition: all var(--transition-fast);
}
.nav-tab:hover { color: var(--text-primary); background: rgba(255, 255, 255, 0.05); }
.nav-tab.active { background: var(--accent); color: white; box-shadow: 0 2px 8px var(--accent-glow); }

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

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 16px;
  font-size: 13px; font-weight: 600; border-radius: var(--radius-sm); transition: all var(--transition-fast);
}
.btn-primary { background: var(--accent); color: white; box-shadow: 0 4px 12px var(--accent-glow); }
.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-secondary { background: rgba(255, 255, 255, 0.06); color: var(--text-primary); border: 1px solid var(--border-color); }
.btn-secondary:hover { background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.2); }
.btn-success { background: var(--success); color: white; box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4); }
.btn-success:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-ghost { color: var(--text-secondary); padding: 8px; }
.btn-ghost:hover { color: var(--text-primary); background: rgba(255, 255, 255, 0.06); }
.btn-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.3); }
.btn-danger:hover { background: var(--danger); color: white; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn-icon { width: 34px; height: 34px; padding: 0; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; }

/* User Badge */
.user-menu-btn {
  display: flex; align-items: center; gap: 9px; padding: 4px 10px 4px 4px; border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border-color); transition: all var(--transition-fast);
}
.user-menu-btn:hover { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.2); }
.user-avatar { width: 28px; height: 28px; border-radius: var(--radius-full); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; color: white; }
.user-info-text { text-align: left; line-height: 1.2; }
.user-name-label { font-size: 12px; font-weight: 600; max-width: 110px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role-badge { font-size: 9px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); }

/* Toolbar */
.toolbar {
  background: var(--bg-surface); border-bottom: 1px solid var(--border-color); padding: 10px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; z-index: 30;
}
.filter-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.search-box { position: relative; width: 220px; }
.search-box input { width: 100%; padding-left: 32px; font-size: 13px; border-radius: var(--radius-full); }
.search-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 13px; pointer-events: none; }
.filter-pills { display: flex; gap: 3px; background: rgba(0, 0, 0, 0.2); padding: 2px; border-radius: var(--radius-full); border: 1px solid var(--border-color); }
.filter-pill { padding: 4px 10px; border-radius: var(--radius-full); font-size: 11px; font-weight: 600; color: var(--text-secondary); transition: all var(--transition-fast); }
.filter-pill:hover { color: var(--text-primary); }
.filter-pill.active { background: var(--accent); color: white; }

.quick-stats-bar { display: flex; align-items: center; gap: 14px; font-size: 12px; color: var(--text-secondary); }
.stat-item { display: flex; align-items: center; gap: 5px; }
.stat-val { font-weight: 700; color: var(--text-primary); }

/* Main Content */
.main-content { flex: 1; overflow: hidden; position: relative; }
.view-panel { display: none; height: 100%; width: 100%; }
.view-panel.active { display: flex; flex-direction: column; }

/* Kanban Columns */
.kanban-board-container {
  flex: 1; overflow-x: auto; overflow-y: hidden; padding: 20px 24px; display: flex; gap: 20px; align-items: flex-start;
}
.kanban-column {
  width: 320px; min-width: 320px; max-width: 320px; max-height: calc(100vh - 170px);
  background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: var(--radius-md);
  display: flex; flex-direction: column; box-shadow: var(--shadow-sm); transition: border-color var(--transition-fast);
}
.kanban-column.drag-over { border-color: var(--accent); box-shadow: var(--shadow-glow); }
.column-header { padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border-color); user-select: none; }
.column-title-wrap { display: flex; align-items: center; gap: 10px; }
.column-indicator { width: 10px; height: 10px; border-radius: var(--radius-full); }
.column-title { font-family: var(--font-display); font-size: 15px; font-weight: 700; }
.column-count { font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: var(--radius-full); background: rgba(255, 255, 255, 0.08); color: var(--text-secondary); }
.task-list { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: var(--card-gap); min-height: 80px; }
.task-list.drag-over { background: rgba(99, 102, 241, 0.05); border-radius: var(--radius-sm); }
.add-task-quick-btn {
  margin: 0 12px 12px; padding: 8px; border-radius: var(--radius-sm); border: 1px dashed var(--border-color);
  color: var(--text-secondary); font-size: 13px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 6px;
}
.add-task-quick-btn:hover { background: rgba(255, 255, 255, 0.04); color: var(--text-primary); border-color: var(--accent); }
.add-column-box {
  width: 280px; min-width: 280px; padding: 16px; border-radius: var(--radius-md); border: 2px dashed var(--border-color);
  display: flex; flex-direction: column; gap: 12px; align-items: center; justify-content: center; color: var(--text-secondary); background: rgba(0, 0, 0, 0.1);
}
.add-column-box:hover { border-color: var(--accent); background: rgba(99, 102, 241, 0.03); }

/* Task Cards */
.task-card {
  background: var(--bg-card); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border-color); border-radius: var(--radius-sm); padding: var(--card-padding);
  box-shadow: var(--shadow-sm); cursor: grab; user-select: none; transition: all var(--transition-fast); position: relative; overflow: hidden;
}
.task-card:hover { background: var(--bg-card-hover); border-color: rgba(255, 255, 255, 0.18); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.task-card:active { cursor: grabbing; }
.task-card.dragging { opacity: 0.4; transform: scale(0.97); }
.card-cover {
  width: calc(100% + var(--card-padding) * 2); margin: calc(-1 * var(--card-padding)) calc(-1 * var(--card-padding)) 10px calc(-1 * var(--card-padding));
  height: 120px; position: relative; overflow: hidden; background-size: cover; background-position: center;
}
.card-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.tag-pill { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 4px; background: rgba(255, 255, 255, 0.08); color: var(--text-secondary); }
.card-title { font-size: 14px; font-weight: 600; color: var(--text-primary); line-height: 1.4; margin-bottom: 6px; word-break: break-word; }
.card-description-preview {
  font-size: 12px; color: var(--text-secondary); line-height: 1.4; margin-bottom: 10px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-checklist-bar { margin-bottom: 10px; }
.checklist-text { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); margin-bottom: 4px; font-weight: 600; }
.progress-track { height: 4px; background: rgba(255, 255, 255, 0.08); border-radius: var(--radius-full); overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); border-radius: var(--radius-full); transition: width var(--transition-normal); }
.card-footer { display: flex; align-items: center; justify-content: space-between; padding-top: 8px; border-top: 1px solid var(--border-subtle); margin-top: 6px; }
.card-meta-left { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text-muted); flex-wrap: wrap; }
.priority-badge { font-size: 10px; font-weight: 700; text-transform: uppercase; padding: 2px 6px; border-radius: 4px; display: inline-flex; align-items: center; }
.priority-urgent { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.4); }
.priority-high { background: var(--warning-bg); color: var(--warning); }
.priority-medium { background: var(--info-bg); color: var(--info); }
.priority-low { background: rgba(255, 255, 255, 0.06); color: var(--text-muted); }
.due-badge { font-size: 11px; display: inline-flex; align-items: center; gap: 4px; padding: 2px 6px; border-radius: 4px; font-weight: 600; }
.due-badge.overdue { background: var(--danger-bg); color: var(--danger); }
.due-badge.today { background: var(--warning-bg); color: var(--warning); }
.due-badge.upcoming { color: var(--text-muted); }
.card-assignee { width: 24px; height: 24px; border-radius: var(--radius-full); display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; color: white; }
.card-team-badge { font-size: 10px; font-weight: 600; padding: 2px 6px; border-radius: 4px; background: rgba(99, 102, 241, 0.15); color: var(--accent); display: inline-flex; align-items: center; gap: 4px; }

/* CRM View */
.crm-view-container { flex: 1; overflow-y: auto; padding: 24px; }
.crm-stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
.crm-stat-card { background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 18px; display: flex; flex-direction: column; gap: 6px; }
.crm-stat-title { font-size: 12px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; }
.crm-stat-number { font-family: var(--font-display); font-size: 26px; font-weight: 800; color: var(--text-primary); }
.crm-stat-sub { font-size: 11px; color: var(--success); }
.crm-pipeline-stages { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.crm-stage-column { background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 14px; display: flex; flex-direction: column; gap: 12px; min-height: 400px; }
.crm-stage-header { display: flex; align-items: center; justify-content: space-between; padding-bottom: 10px; border-bottom: 1px solid var(--border-color); }
.crm-stage-title { font-weight: 700; font-size: 14px; }
.contact-card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-sm); padding: 14px; cursor: pointer; transition: all var(--transition-fast); }
.contact-card:hover { background: var(--bg-card-hover); border-color: rgba(255, 255, 255, 0.2); transform: translateY(-2px); }
.contact-name { font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.contact-company { font-size: 12px; color: var(--text-secondary); margin-bottom: 8px; }
.contact-value { font-family: var(--font-mono); font-size: 14px; font-weight: 700; color: var(--success); margin-bottom: 8px; }
.contact-footer { display: flex; align-items: center; justify-content: space-between; padding-top: 8px; border-top: 1px solid var(--border-subtle); font-size: 11px; color: var(--text-muted); }

/* Teams Workspace */
.teams-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; }
.team-card {
  background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: var(--radius-md);
  padding: 20px; display: flex; flex-direction: column; gap: 14px; transition: all var(--transition-fast);
}
.team-card:hover { border-color: rgba(255, 255, 255, 0.2); transform: translateY(-2px); }
.team-header-row { display: flex; align-items: center; justify-content: space-between; }
.team-title-wrap { display: flex; align-items: center; gap: 10px; }
.team-color-dot { width: 14px; height: 14px; border-radius: var(--radius-full); }
.team-name-text { font-family: var(--font-display); font-size: 16px; font-weight: 700; }
.team-members-list { display: flex; flex-wrap: wrap; gap: 8px; }
.team-member-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--border-color); font-size: 12px;
}
.team-member-chip .chip-avatar { width: 18px; height: 18px; border-radius: 50%; font-size: 10px; display: flex; align-items: center; justify-content: center; font-weight: 700; color: white; }

/* Real-Time Team Chat */
.chat-container { display: flex; height: 100%; border-top: 1px solid var(--border-color); }
.chat-sidebar { width: 240px; background: var(--bg-surface); border-right: 1px solid var(--border-color); display: flex; flex-direction: column; padding: 16px; gap: 14px; }
.chat-channel-item {
  padding: 8px 12px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; color: var(--text-secondary);
  display: flex; align-items: center; gap: 8px; cursor: pointer; transition: all var(--transition-fast);
}
.chat-channel-item:hover { color: var(--text-primary); background: rgba(255, 255, 255, 0.05); }
.chat-channel-item.active { background: var(--accent-light); color: var(--accent); }
.chat-main { flex: 1; display: flex; flex-direction: column; background: var(--bg-base); }
.chat-messages-scroll { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.chat-msg-row { display: flex; gap: 12px; max-width: 85%; }
.chat-msg-row.ai-msg { border-left: 3px solid var(--success); padding-left: 10px; }
.chat-msg-avatar { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; color: white; flex-shrink: 0; }
.chat-msg-content { display: flex; flex-direction: column; gap: 4px; }
.chat-msg-meta { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text-muted); }
.chat-msg-bubble { background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 10px 14px; font-size: 13px; line-height: 1.4; color: var(--text-primary); word-break: break-word; }
.chat-input-bar { padding: 16px 20px; border-top: 1px solid var(--border-color); display: flex; gap: 10px; background: var(--bg-surface); }

/* WebRTC Voice & Video Call Floating Overlay / Room */
.call-floating-dock {
  position: fixed; bottom: 20px; right: 20px; width: 440px; max-width: 90vw; background: var(--bg-modal);
  border: 1px solid var(--accent); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg), var(--shadow-glow);
  z-index: 99; display: none; flex-direction: column; overflow: hidden; animation: scaleUp 0.25s ease-out;
}
.call-floating-dock.active { display: flex; }
.call-dock-header { padding: 12px 16px; background: rgba(0, 0, 0, 0.4); border-bottom: 1px solid var(--border-color); display: flex; align-items: center; justify-content: space-between; }
.call-video-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; padding: 12px; max-height: 280px; overflow-y: auto; background: #000; }
.video-tile {
  position: relative; background: #111; border-radius: var(--radius-sm); overflow: hidden; aspect-ratio: 16/9;
  display: flex; align-items: center; justify-content: center; border: 1px solid rgba(255, 255, 255, 0.1);
}
.video-tile video { width: 100%; height: 100%; object-fit: cover; }
.video-tile .tile-label { position: absolute; bottom: 6px; left: 8px; font-size: 11px; background: rgba(0, 0, 0, 0.65); padding: 2px 6px; border-radius: 4px; color: white; }
.call-dock-controls { padding: 12px 16px; background: var(--bg-surface); display: flex; align-items: center; justify-content: center; gap: 12px; }

/* AI TRAFFER Hub & Terminal */
.ai-hub-container { flex: 1; overflow-y: auto; padding: 24px; max-width: 1200px; margin: 0 auto; width: 100%; }
.ai-terminal-box {
  background: #080a0f; border: 1px solid rgba(16, 185, 129, 0.3); border-radius: var(--radius-md);
  padding: 16px; font-family: var(--font-mono); font-size: 12px; color: #10b981; max-height: 380px; overflow-y: auto;
  box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.8); line-height: 1.5; white-space: pre-wrap; word-break: break-word;
}
.ai-action-card {
  background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: var(--radius-md);
  padding: 18px; display: flex; flex-direction: column; gap: 10px; cursor: pointer; transition: all var(--transition-fast);
}
.ai-action-card:hover { border-color: var(--success); box-shadow: 0 0 15px rgba(16, 185, 129, 0.25); transform: translateY(-2px); }

/* Modals */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.75); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: none; align-items: center; justify-content: center; z-index: 100; padding: 20px; animation: fadeIn 0.2s ease-out;
}
.modal-backdrop.open { display: flex; }
.modal-content {
  background: var(--bg-modal); border: 1px solid var(--border-color); border-radius: var(--radius-lg);
  width: 100%; max-width: 680px; max-height: 90vh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); overflow: hidden;
}
.modal-content.modal-lg { max-width: 860px; }
.modal-header { padding: 18px 24px; border-bottom: 1px solid var(--border-color); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-family: var(--font-display); font-size: 18px; font-weight: 700; }
.modal-body { padding: 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border-color); display: flex; align-items: center; justify-content: flex-end; gap: 12px; background: rgba(0, 0, 0, 0.2); }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }

/* Image Dropzone */
.upload-dropzone {
  border: 2px dashed var(--border-color); border-radius: var(--radius-md); padding: 20px; text-align: center;
  cursor: pointer; background: rgba(0, 0, 0, 0.15); transition: all var(--transition-fast);
}
.upload-dropzone:hover, .upload-dropzone.drag-over { border-color: var(--accent); background: var(--accent-light); }
.attachments-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin-top: 8px; }
.attachment-item {
  position: relative; height: 85px; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--border-color);
  background-size: cover; background-position: center;
}
.attachment-item .attachment-actions {
  position: absolute; inset: 0; background: rgba(0, 0, 0, 0.65); opacity: 0; display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: opacity var(--transition-fast);
}
.attachment-item:hover .attachment-actions { opacity: 1; }

.subtasks-list, .links-list { display: flex; flex-direction: column; gap: 8px; }
.subtask-row, .link-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-sm);
}
.subtask-row.completed span { text-decoration: line-through; color: var(--text-muted); }
.comments-stream { display: flex; flex-direction: column; gap: 10px; max-height: 220px; overflow-y: auto; padding-right: 4px; }
.comment-bubble { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 10px 14px; }
.comment-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; font-size: 11px; }

.swatch-group { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.theme-card-option { flex: 1; min-width: 130px; padding: 12px; border-radius: var(--radius-sm); border: 2px solid var(--border-color); cursor: pointer; display: flex; flex-direction: column; gap: 4px; }
.theme-card-option.selected { border-color: var(--accent); box-shadow: 0 0 15px var(--accent-glow); }
.color-swatch-circle { width: 28px; height: 28px; border-radius: var(--radius-full); cursor: pointer; border: 2px solid transparent; }
.color-swatch-circle.selected { border-color: white; box-shadow: 0 0 10px currentColor; }

#toast-container { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 10px; z-index: 200; }
.toast { padding: 12px 18px; border-radius: var(--radius-sm); background: var(--bg-modal); border: 1px solid var(--border-color); color: var(--text-primary); font-size: 13px; font-weight: 600; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 10px; animation: slideInRight 0.25s ease-out; }
.toast.success { border-color: var(--success); }
.toast.danger { border-color: var(--danger); }
.toast.info { border-color: var(--accent); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleUp { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: translateX(0); } }

@media (max-width: 900px) {
  .app-header { padding: 0 16px; }
  .toolbar { padding: 10px 16px; }
  .nav-views { display: none; }
}
