/* ===== VARIABLES ===== */
:root {
  --primary: #7C3AED;
  --primary-light: #8B5CF6;
  --primary-dark: #6D28D9;
  --primary-bg: #EDE9FE;
  --secondary: #1E293B;
  --bg: #F8FAFC;
  --bg-card: #FFFFFF;
  --bg-sidebar: #1E1B4B;
  --bg-sidebar-hover: #312E81;
  --bg-sidebar-active: #4338CA;
  --text: #1E293B;
  --text-secondary: #64748B;
  --text-light: #94A3B8;
  --text-sidebar: #C7D2FE;
  --border: #E2E8F0;
  --border-light: #F1F5F9;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #3B82F6;
  --urgent: #EF4444;
  --high: #F97316;
  --normal: #3B82F6;
  --low: #94A3B8;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1), 0 4px 6px rgba(0,0,0,0.05);
  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 12px;
  --sidebar-width: 260px;
  --sidebar-collapsed: 64px;
  --topbar-height: 56px;
  --transition: all 0.2s ease;
}

/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body { font-family: 'Inter', -apple-system, sans-serif; background: var(--bg); color: var(--text); line-height: 1.5; overflow: hidden; height: 100vh; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; font-size: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

/* ===== LOGIN ===== */
.login-screen {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: linear-gradient(135deg, #1E1B4B 0%, #4338CA 50%, #7C3AED 100%);
  padding: 20px;
}
.login-container {
  background: white; border-radius: 16px; padding: 48px; width: 100%; max-width: 420px;
  box-shadow: 0 25px 50px rgba(0,0,0,0.25);
}
.login-brand { text-align: center; margin-bottom: 32px; }
.login-logo {
  width: 64px; height: 64px; border-radius: 16px; background: var(--primary);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 28px; color: white; margin-bottom: 16px;
}
.login-brand h1 { font-size: 28px; font-weight: 700; color: var(--secondary); }
.login-brand p { color: var(--text-secondary); margin-top: 4px; }
.login-form .form-group { margin-bottom: 20px; }
.login-form label { display: block; font-weight: 500; margin-bottom: 6px; color: var(--text); }
.input-icon { position: relative; }
.input-icon i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-light); }
.input-icon input {
  width: 100%; padding: 12px 14px 12px 42px; border: 2px solid var(--border);
  border-radius: var(--radius); font-size: 14px; transition: var(--transition);
  background: var(--bg);
}
.input-icon input:focus { outline: none; border-color: var(--primary); background: white; box-shadow: 0 0 0 3px var(--primary-bg); }
.login-error { margin-top: 16px; padding: 12px; background: #FEF2F2; color: var(--danger); border-radius: var(--radius-sm); font-size: 13px; text-align: center; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 20px;
  border-radius: var(--radius); font-weight: 500; font-size: 13px;
  transition: var(--transition); border: none; cursor: pointer; white-space: nowrap;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); box-shadow: var(--shadow-md); }
.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border-light); }
.btn-danger { background: #FEF2F2; color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: white; }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }
.btn-icon { width: 36px; height: 36px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; color: var(--text-secondary); transition: var(--transition); }
.btn-icon:hover { background: var(--bg); color: var(--text); }
.btn-icon-sm { width: 28px; height: 28px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; color: var(--text-light); font-size: 12px; transition: var(--transition); cursor: pointer; }
.btn-icon-sm:hover { background: var(--primary-bg); color: var(--primary); }

/* ===== LAYOUT ===== */
.app { display: flex; height: 100vh; overflow: hidden; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-width); background: var(--bg-sidebar); color: var(--text-sidebar);
  display: flex; flex-direction: column; transition: var(--transition); flex-shrink: 0;
  z-index: 100; position: relative;
}
.sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar.collapsed .brand-text,
.sidebar.collapsed .user-info,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .nav-section-header span,
.sidebar.collapsed .nav-section-header .btn-icon-sm,
.sidebar.collapsed .space-name,
.sidebar.collapsed .project-item span,
.sidebar.collapsed .workspace-name { display: none; }

.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px; border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; }
.brand-icon {
  width: 36px; height: 36px; border-radius: 10px; background: var(--primary);
  display: flex; align-items: center; justify-content: center; color: white; font-size: 16px;
}
.brand-text { font-size: 18px; font-weight: 700; color: white; }
.sidebar-toggle { color: var(--text-sidebar); padding: 6px; border-radius: 6px; transition: var(--transition); }
.sidebar-toggle:hover { background: var(--bg-sidebar-hover); color: white; }

.sidebar-user {
  display: flex; align-items: center; gap: 10px; padding: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 600; font-size: 14px; flex-shrink: 0;
}
.user-info { display: flex; flex-direction: column; overflow: hidden; }
.user-name { font-size: 13px; font-weight: 600; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--text-sidebar); text-transform: capitalize; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 0; }
.nav-section { padding: 4px 8px; }
.nav-section-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 8px 4px; font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.5px; color: rgba(255,255,255,0.4);
}
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  border-radius: var(--radius-sm); color: var(--text-sidebar); transition: var(--transition);
  font-size: 13px; margin-bottom: 2px;
}
.nav-item:hover { background: var(--bg-sidebar-hover); color: white; }
.nav-item.active { background: var(--bg-sidebar-active); color: white; }
.nav-item i { width: 18px; text-align: center; font-size: 14px; }

.sidebar-footer { padding: 8px; border-top: 1px solid rgba(255,255,255,0.1); }

/* Workspace tree */
.workspace-item { margin-bottom: 2px; }
.workspace-header {
  display: flex; align-items: center; gap: 8px; padding: 6px 12px;
  border-radius: var(--radius-sm); cursor: pointer; transition: var(--transition);
  font-size: 13px; color: var(--text-sidebar);
}
.workspace-header:hover { background: var(--bg-sidebar-hover); color: white; }
.workspace-header.active { color: white; }
.workspace-header i.toggle { font-size: 10px; width: 14px; transition: transform 0.2s; }
.workspace-header i.toggle.open { transform: rotate(90deg); }
.workspace-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.workspace-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.space-list { padding-left: 18px; overflow: hidden; }
.space-item { margin-bottom: 1px; }
.space-header {
  display: flex; align-items: center; gap: 6px; padding: 5px 10px;
  border-radius: var(--radius-sm); cursor: pointer; transition: var(--transition);
  font-size: 12px; color: var(--text-sidebar);
}
.space-header:hover { background: var(--bg-sidebar-hover); color: white; }
.space-header i { font-size: 11px; }
.space-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.project-list { padding-left: 14px; }
.project-item {
  display: flex; align-items: center; gap: 6px; padding: 4px 10px;
  border-radius: var(--radius-sm); cursor: pointer; transition: var(--transition);
  font-size: 12px; color: var(--text-sidebar);
}
.project-item:hover { background: var(--bg-sidebar-hover); color: white; }
.project-item.active { background: var(--bg-sidebar-active); color: white; }
.project-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }

.btn-add-inline {
  display: flex; align-items: center; gap: 6px; padding: 4px 10px;
  font-size: 11px; color: rgba(255,255,255,0.3); cursor: pointer;
  transition: var(--transition); border-radius: var(--radius-sm);
}
.btn-add-inline:hover { color: white; background: var(--bg-sidebar-hover); }

/* ===== MAIN CONTENT ===== */
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

/* Topbar */
.topbar {
  height: var(--topbar-height); display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; background: var(--bg-card); border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.breadcrumb { font-size: 14px; color: var(--text-secondary); display: flex; align-items: center; gap: 8px; }
.breadcrumb span { color: var(--text); font-weight: 600; }
.breadcrumb .separator { color: var(--text-light); }
.search-box { position: relative; }
.search-box i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-light); font-size: 13px; }
.search-box input {
  padding: 8px 14px 8px 36px; border: 1px solid var(--border); border-radius: 20px;
  width: 240px; font-size: 13px; background: var(--bg); transition: var(--transition);
}
.search-box input:focus { outline: none; border-color: var(--primary); width: 300px; background: white; }
.sidebar-mobile-toggle { display: none; }

/* ===== PAGE CONTENT ===== */
.page-content { flex: 1; overflow-y: auto; padding: 24px; }
.page { display: none; }
.page.active { display: block; }
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.page-header h2 { font-size: 20px; font-weight: 700; }
.page-header-left { display: flex; align-items: center; gap: 12px; }
.page-header-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.badge {
  display: inline-flex; padding: 2px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 500; background: var(--bg); color: var(--text-secondary);
}

/* ===== DASHBOARD ===== */
.dashboard-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px; margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card); border-radius: var(--radius-lg); padding: 20px;
  display: flex; align-items: center; gap: 16px; box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light); transition: var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-icon {
  width: 48px; height: 48px; border-radius: 12px; display: flex;
  align-items: center; justify-content: center; font-size: 20px;
}
.stat-projects .stat-icon { background: #EDE9FE; color: var(--primary); }
.stat-tasks .stat-icon { background: #DBEAFE; color: var(--info); }
.stat-completed .stat-icon { background: #D1FAE5; color: var(--success); }
.stat-overdue .stat-icon { background: #FEE2E2; color: var(--danger); }
.stat-value { font-size: 28px; font-weight: 700; display: block; line-height: 1; }
.stat-label { font-size: 13px; color: var(--text-secondary); }

.dashboard-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 24px; }

.card {
  background: var(--bg-card); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light); overflow: hidden;
}
.card-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border-light);
  display: flex; align-items: center; justify-content: space-between;
}
.card-header h3 { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-header h3 i { color: var(--text-light); }
.card-body { padding: 16px 20px; max-height: 320px; overflow-y: auto; }

/* Dashboard items */
.dash-task-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
}
.dash-task-item:last-child { border-bottom: none; }
.dash-task-priority { width: 4px; height: 32px; border-radius: 2px; flex-shrink: 0; }
.dash-task-info { flex: 1; min-width: 0; }
.dash-task-title { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-task-project { font-size: 11px; color: var(--text-light); }
.dash-task-due { font-size: 11px; padding: 2px 8px; border-radius: 4px; white-space: nowrap; }
.dash-task-due.overdue { background: #FEE2E2; color: var(--danger); }
.dash-task-due.soon { background: #FEF3C7; color: var(--warning); }
.dash-task-due.normal { background: var(--bg); color: var(--text-secondary); }

.activity-item {
  display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border-light);
}
.activity-item:last-child { border-bottom: none; }
.activity-avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--primary-bg); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; flex-shrink: 0; }
.activity-content { flex: 1; font-size: 12px; color: var(--text-secondary); }
.activity-content strong { color: var(--text); }
.activity-time { font-size: 11px; color: var(--text-light); white-space: nowrap; }

.priority-bar-container { margin-bottom: 12px; }
.priority-bar-label { display: flex; justify-content: space-between; margin-bottom: 4px; font-size: 12px; }
.priority-bar-label span:first-child { font-weight: 500; text-transform: capitalize; }
.priority-bar-label span:last-child { color: var(--text-secondary); }
.priority-bar { height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.priority-bar-fill { height: 100%; border-radius: 4px; transition: width 0.5s ease; }

.empty-state {
  text-align: center; padding: 40px 20px; color: var(--text-light);
}
.empty-state i { font-size: 40px; margin-bottom: 12px; }
.empty-state p { font-size: 13px; }

/* ===== CONTEXT MENU ===== */
.ctx-menu-trigger {
  opacity: 0; width: 22px; height: 22px; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.4); font-size: 11px; transition: var(--transition);
  flex-shrink: 0; margin-left: auto;
}
.workspace-header:hover .ctx-menu-trigger,
.space-header:hover .ctx-menu-trigger,
.project-item:hover .ctx-menu-trigger { opacity: 1; }
.ctx-menu-trigger:hover { background: rgba(255,255,255,0.15); color: white; }

.ctx-menu {
  position: fixed; z-index: 9000; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); min-width: 160px;
  padding: 4px; animation: fadeIn 0.15s;
}
.ctx-menu-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 12px;
  font-size: 13px; color: var(--text); border-radius: var(--radius-sm);
  cursor: pointer; transition: var(--transition); width: 100%;
}
.ctx-menu-item:hover { background: var(--bg); }
.ctx-menu-item i { width: 16px; text-align: center; font-size: 12px; color: var(--text-secondary); }
.ctx-menu-item.danger { color: var(--danger); }
.ctx-menu-item.danger i { color: var(--danger); }
.ctx-menu-item.danger:hover { background: #FEF2F2; }
.ctx-menu-separator { height: 1px; background: var(--border-light); margin: 4px 0; }

/* ===== BOARD (KANBAN) ===== */
.board-container {
  display: flex; gap: 16px; overflow-x: auto; padding-bottom: 16px;
  min-height: calc(100vh - var(--topbar-height) - 120px);
}
.board-column {
  min-width: 300px; max-width: 300px; background: var(--bg);
  border-radius: var(--radius-lg); display: flex; flex-direction: column;
  max-height: calc(100vh - var(--topbar-height) - 130px);
}
.column-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 3px solid var(--border);
}
.column-header-left { display: flex; align-items: center; gap: 8px; }
.column-dot { width: 10px; height: 10px; border-radius: 50%; }
.column-name { font-size: 13px; font-weight: 600; }
.column-count { font-size: 11px; color: var(--text-light); background: white; padding: 1px 8px; border-radius: 10px; }
.column-body { flex: 1; padding: 8px; overflow-y: auto; }

.task-card {
  background: white; border-radius: var(--radius); padding: 14px;
  margin-bottom: 8px; box-shadow: var(--shadow-sm); border: 1px solid var(--border-light);
  cursor: pointer; transition: var(--transition); border-left: 3px solid transparent;
}
.task-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.task-card.priority-urgent { border-left-color: var(--urgent); }
.task-card.priority-high { border-left-color: var(--high); }
.task-card.priority-normal { border-left-color: var(--normal); }
.task-card.priority-low { border-left-color: var(--low); }
.task-card-title { font-size: 13px; font-weight: 500; margin-bottom: 8px; line-height: 1.4; }
.task-card-meta { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px; }
.task-card-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.task-tag { font-size: 10px; padding: 2px 6px; border-radius: 4px; font-weight: 500; }
.task-card-footer { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.task-card-footer .meta-item { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-light); }
.task-card-footer .meta-item i { font-size: 10px; }
.task-card-assignee { width: 24px; height: 24px; border-radius: 50%; background: var(--primary-bg); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 600; margin-left: auto; }
.task-card-due { font-size: 11px; padding: 2px 6px; border-radius: 4px; }
.task-card-due.overdue { background: #FEE2E2; color: var(--danger); }

.column-add-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px; margin: 4px 8px 8px; border-radius: var(--radius-sm);
  color: var(--text-light); font-size: 12px; transition: var(--transition);
  border: 1px dashed var(--border); cursor: pointer;
}
.column-add-btn:hover { background: white; color: var(--primary); border-color: var(--primary); }

/* Drag and Drop */
.task-card.dragging { opacity: 0.5; transform: rotate(3deg); }
.column-body.drag-over { background: var(--primary-bg); border-radius: var(--radius); }

/* ===== LIST VIEW ===== */
.list-container { background: var(--bg-card); border-radius: var(--radius-lg); border: 1px solid var(--border-light); overflow: hidden; }
.list-header {
  display: grid; grid-template-columns: 40px 1fr 120px 100px 120px 100px;
  padding: 10px 16px; background: var(--bg); font-size: 11px; font-weight: 600;
  color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}
.list-row {
  display: grid; grid-template-columns: 40px 1fr 120px 100px 120px 100px;
  padding: 12px 16px; border-bottom: 1px solid var(--border-light);
  align-items: center; cursor: pointer; transition: var(--transition);
}
.list-row:hover { background: var(--bg); }
.list-row .priority-dot { width: 8px; height: 8px; border-radius: 50%; }
.list-row .task-title { font-size: 13px; font-weight: 500; }
.list-row .task-assignee-cell { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.list-row .status-badge { padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 500; }

/* View Toggle */
.view-toggle { display: flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.btn-view { padding: 6px 12px; font-size: 13px; color: var(--text-secondary); transition: var(--transition); }
.btn-view.active { background: var(--primary); color: white; }
.btn-view:hover:not(.active) { background: var(--bg); }

.filter-select {
  padding: 6px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 12px; color: var(--text-secondary); background: white; cursor: pointer;
}
.filter-select:focus { outline: none; border-color: var(--primary); }

/* ===== TASK MODAL ===== */
.modal { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 1000; }
.modal.open { display: flex; align-items: flex-start; justify-content: center; padding: 40px 20px; }
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); animation: fadeIn 0.2s; }
.modal-container {
  position: relative; background: var(--bg-card); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); animation: slideUp 0.3s; max-height: calc(100vh - 80px);
  display: flex; flex-direction: column; width: 100%;
}
.modal-sm { max-width: 480px; }
.modal-lg { max-width: 900px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px; border-bottom: 1px solid var(--border-light);
}
.modal-header-left { display: flex; align-items: center; gap: 12px; flex: 1; }
.task-id-label { font-size: 12px; color: var(--text-light); font-weight: 500; white-space: nowrap; }
.modal-title-input {
  flex: 1; border: none; font-size: 16px; font-weight: 600; padding: 4px 0;
  background: transparent;
}
.modal-title-input:focus { outline: none; border-bottom: 2px solid var(--primary); }
.modal-body { overflow-y: auto; flex: 1; }

.task-detail-main { display: flex; min-height: 400px; }
.task-detail-content { flex: 1; padding: 24px; border-right: 1px solid var(--border-light); overflow-y: auto; }
.task-detail-sidebar { width: 280px; padding: 20px; flex-shrink: 0; overflow-y: auto; }

.task-section { margin-top: 24px; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.section-header h4 { font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px; color: var(--text-secondary); }
.section-header h4 i { font-size: 12px; }

.textarea-auto {
  width: 100%; min-height: 80px; border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 10px; font-size: 13px; resize: vertical; transition: var(--transition); background: var(--bg);
}
.textarea-auto:focus { outline: none; border-color: var(--primary); background: white; }

/* Detail sidebar fields */
.detail-field { margin-bottom: 16px; }
.detail-field label { display: block; font-size: 11px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.3px; margin-bottom: 6px; }
.detail-select, .detail-input {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 13px; background: white; transition: var(--transition);
}
.detail-select:focus, .detail-input:focus { outline: none; border-color: var(--primary); }
.detail-actions { margin-top: 24px; display: flex; flex-direction: column; gap: 8px; }

/* Subtasks */
.subtask-list .subtask-item {
  display: flex; align-items: center; gap: 8px; padding: 8px;
  border-radius: var(--radius-sm); transition: var(--transition); cursor: pointer;
}
.subtask-item:hover { background: var(--bg); }
.subtask-item .subtask-check { width: 16px; height: 16px; border: 2px solid var(--border); border-radius: 50%; cursor: pointer; transition: var(--transition); flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.subtask-item .subtask-check.done { background: var(--success); border-color: var(--success); color: white; font-size: 9px; }
.subtask-item .subtask-title { flex: 1; font-size: 13px; }
.subtask-item .subtask-title.done { text-decoration: line-through; color: var(--text-light); }
.subtask-priority { font-size: 10px; padding: 1px 6px; border-radius: 4px; font-weight: 500; }

/* Checklists */
.checklist-block { margin-bottom: 16px; }
.checklist-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.checklist-title { font-size: 13px; font-weight: 600; }
.checklist-progress { font-size: 11px; color: var(--text-light); }
.checklist-progress-bar { height: 4px; background: var(--bg); border-radius: 2px; margin-bottom: 8px; overflow: hidden; }
.checklist-progress-fill { height: 100%; background: var(--success); border-radius: 2px; transition: width 0.3s; }
.checklist-item {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px;
  border-radius: var(--radius-sm); transition: var(--transition);
}
.checklist-item:hover { background: var(--bg); }
.checklist-item input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.checklist-item span { flex: 1; font-size: 13px; }
.checklist-item span.done { text-decoration: line-through; color: var(--text-light); }
.checklist-add-input {
  display: flex; gap: 8px; margin-top: 8px;
}
.checklist-add-input input {
  flex: 1; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 12px;
}
.checklist-add-input input:focus { outline: none; border-color: var(--primary); }

/* Comments */
.comment-form { display: flex; gap: 8px; margin-bottom: 16px; align-items: flex-end; }
.comment-form textarea {
  flex: 1; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13px; resize: none; min-height: 40px;
}
.comment-form textarea:focus { outline: none; border-color: var(--primary); }
.comment-item { display: flex; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border-light); }
.comment-item:last-child { border-bottom: none; }
.comment-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary-bg); color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; flex-shrink: 0; }
.comment-body { flex: 1; }
.comment-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.comment-author { font-size: 13px; font-weight: 600; }
.comment-date { font-size: 11px; color: var(--text-light); }
.comment-text { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.comment-actions { margin-top: 4px; }
.comment-actions button { font-size: 11px; color: var(--text-light); margin-right: 8px; }
.comment-actions button:hover { color: var(--primary); }

/* Attachments */
.attachment-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.attachment-item {
  display: flex; align-items: center; gap: 8px; padding: 10px;
  background: var(--bg); border-radius: var(--radius-sm); transition: var(--transition);
}
.attachment-item:hover { background: var(--border-light); }
.attachment-icon { width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.attachment-icon.img { background: #DBEAFE; color: var(--info); }
.attachment-icon.doc { background: #EDE9FE; color: var(--primary); }
.attachment-icon.file { background: var(--bg); color: var(--text-light); }
.attachment-info { flex: 1; min-width: 0; }
.attachment-name { font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attachment-size { font-size: 11px; color: var(--text-light); }
.attachment-actions button { font-size: 12px; color: var(--text-light); }
.attachment-actions button:hover { color: var(--danger); }

/* Tags */
.tags-container { display: flex; flex-wrap: wrap; gap: 4px; }
.tag-badge { padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 500; cursor: pointer; }

/* ===== MEMBERS PAGE ===== */
.members-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.member-card {
  background: var(--bg-card); border-radius: var(--radius-lg); padding: 20px;
  border: 1px solid var(--border-light); box-shadow: var(--shadow-sm);
  display: flex; align-items: center; gap: 16px; transition: var(--transition);
}
.member-card:hover { box-shadow: var(--shadow-md); }
.member-avatar {
  width: 48px; height: 48px; border-radius: 50%; background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 600; font-size: 18px; flex-shrink: 0;
}
.member-info { flex: 1; min-width: 0; }
.member-name { font-size: 14px; font-weight: 600; }
.member-email { font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member-role {
  display: inline-block; padding: 2px 10px; border-radius: 12px;
  font-size: 11px; font-weight: 500; margin-top: 4px; text-transform: capitalize;
}
.member-role.admin { background: #EDE9FE; color: var(--primary); }
.member-role.manager { background: #DBEAFE; color: var(--info); }
.member-role.member { background: var(--bg); color: var(--text-secondary); }

/* ===== MY TASKS ===== */
.task-list-view .task-group { margin-bottom: 24px; }
.task-group-header { font-size: 14px; font-weight: 600; margin-bottom: 10px; padding-bottom: 6px; border-bottom: 2px solid var(--border); display: flex; align-items: center; gap: 8px; }
.task-group-header i { color: var(--text-light); }

/* ===== TOAST ===== */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 12px 20px; border-radius: var(--radius); color: white; font-size: 13px;
  font-weight: 500; box-shadow: var(--shadow-lg); animation: slideIn 0.3s;
  display: flex; align-items: center; gap: 8px; min-width: 250px;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--info); }
.toast.warning { background: var(--warning); }

/* ===== FORM STYLES (generic modal forms) ===== */
.modal-form .form-group { margin-bottom: 16px; }
.modal-form label { display: block; font-size: 12px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.modal-form input, .modal-form select, .modal-form textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13px; transition: var(--transition);
}
.modal-form input:focus, .modal-form select:focus, .modal-form textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-bg);
}
.modal-form .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.modal-form .form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }

/* Color picker */
.color-options { display: flex; gap: 6px; flex-wrap: wrap; }
.color-option {
  width: 28px; height: 28px; border-radius: 50%; cursor: pointer; border: 3px solid transparent;
  transition: var(--transition);
}
.color-option:hover, .color-option.active { border-color: var(--text); transform: scale(1.1); }

/* ===== ANIMATIONS ===== */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(100px); } to { opacity: 1; transform: translateX(0); } }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar { position: fixed; left: -260px; height: 100vh; z-index: 200; }
  .sidebar.open { left: 0; }
  .sidebar-mobile-toggle { display: flex; }
  .search-box input { width: 160px; }
  .search-box input:focus { width: 200px; }
  .dashboard-row { grid-template-columns: 1fr; }
  .task-detail-main { flex-direction: column; }
  .task-detail-sidebar { width: 100%; border-right: none; border-top: 1px solid var(--border-light); }
  .board-column { min-width: 260px; max-width: 260px; }
  .modal-container { margin: 10px; }
  .topbar { padding: 0 12px; }
  .page-content { padding: 16px; }
  .list-header, .list-row { grid-template-columns: 30px 1fr 100px 80px; }
  .list-header > :nth-child(5), .list-header > :nth-child(6),
  .list-row > :nth-child(5), .list-row > :nth-child(6) { display: none; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .page-header-right { width: 100%; }
  .btn-new-task-global span { display: none; }
}

@media (max-width: 480px) {
  .dashboard-grid { grid-template-columns: 1fr 1fr; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 22px; }
}

/* Loading spinner */
.spinner {
  width: 20px; height: 20px; border: 2px solid var(--border);
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-page {
  display: flex; align-items: center; justify-content: center;
  height: 200px; color: var(--text-light);
}
