/* ===========================================================================
   JC Flow - Complete Stylesheet
   JC Marketing Brand: #C91820 (Red) | #FFFFFF (White) | Inter + Poppins
   =========================================================================== */

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

/* ---- CSS Variables ---- */
:root {
  --primary: #C91820;
  --primary-dark: #8B0000;
  --primary-light: rgba(201, 24, 32, 0.08);
  --primary-gradient: linear-gradient(135deg, #C91820 0%, #8B0000 100%);
  --bg-white: #FFFFFF;
  --bg-light: #F5F7FA;
  --bg-card: #FFFFFF;
  --text-dark: #111827;
  --text-body: #374151;
  --text-muted: #6B7280;
  --text-light: #9CA3AF;
  --border: #E5E7EB;
  --border-strong: #D1D5DB;
  --success: #10B981;
  --success-light: rgba(16, 185, 129, 0.1);
  --warning: #F59E0B;
  --warning-light: rgba(245, 158, 11, 0.1);
  --danger: #EF4444;
  --danger-light: rgba(239, 68, 68, 0.1);
  --info: #3B82F6;
  --info-light: rgba(59, 130, 246, 0.1);
  --sidebar-width: 260px;
  --topbar-h: 64px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Poppins', sans-serif;
  --shadow-xs: 0 1px 2px rgba(0,0,0,.05);
  --shadow-sm: 0 2px 4px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.10), 0 2px 4px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 25px rgba(0,0,0,.12), 0 4px 8px rgba(0,0,0,.06);
  --shadow-xl: 0 20px 40px rgba(0,0,0,.14), 0 8px 16px rgba(0,0,0,.08);
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --r-full: 9999px;
  --transition: all 0.2s cubic-bezier(.4,0,.2,1);
  --transition-slow: all 0.35s cubic-bezier(.4,0,.2,1);
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font); font-size: 14px; color: var(--text-body); background: var(--bg-light); line-height: 1.6; -webkit-font-smoothing: antialiased; }
h1,h2,h3,h4,h5,h6 { font-family: var(--font-heading); color: var(--text-dark); line-height: 1.3; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; }
button { font-family: var(--font); cursor: pointer; }
input, select, textarea { font-family: var(--font); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; font-size: 13px; font-weight: 600; border-radius: var(--r-md);
  border: 1.5px solid transparent; cursor: pointer; transition: var(--transition);
  white-space: nowrap; letter-spacing: 0.01em;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary-gradient); color: #fff; border-color: var(--primary); box-shadow: 0 2px 8px rgba(201,24,32,.3); }
.btn-primary:hover:not(:disabled) { box-shadow: 0 4px 16px rgba(201,24,32,.45); transform: translateY(-1px); }
.btn-secondary { background: #fff; color: var(--text-body); border-color: var(--border-strong); }
.btn-secondary:hover:not(:disabled) { background: var(--bg-light); border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: #dc2626; box-shadow: 0 4px 12px rgba(239,68,68,.35); }
.btn-ghost { background: transparent; color: var(--text-muted); border-color: transparent; }
.btn-ghost:hover { background: var(--bg-light); color: var(--text-dark); }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-xs { padding: 4px 10px; font-size: 11px; border-radius: var(--r-sm); }
.btn-block { width: 100%; }
.btn-icon-send { padding: 9px 14px; border-radius: var(--r-full); }

.icon-btn {
  background: transparent; border: none; width: 38px; height: 38px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: var(--text-muted); position: relative; transition: var(--transition);
}
.icon-btn:hover { background: var(--bg-light); color: var(--text-dark); }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; color: var(--text-dark); margin-bottom: 6px; }
.form-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; display: block; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
@media(max-width:600px) { .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; } }

input[type="text"], input[type="email"], input[type="password"],
input[type="date"], input[type="number"], input[type="tel"],
select, textarea {
  width: 100%; padding: 9px 12px; background: #fff; border: 1.5px solid var(--border);
  border-radius: var(--r-md); font-size: 13px; color: var(--text-body); outline: none; transition: var(--transition);
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px rgba(201,24,32,.12);
}
input::placeholder, textarea::placeholder { color: var(--text-light); }
textarea { resize: vertical; min-height: 80px; }
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 12 12'%3E%3Cpath fill='%236B7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }

.radio-group { display: flex; gap: 16px; padding: 4px 0; }
.radio-label { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13px; font-weight: 500; }
.radio-label input { width: auto; accent-color: var(--primary); }
.toggle-label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; font-weight: 500; }
.toggle-label input { width: auto; accent-color: var(--primary); }
.search-input { padding: 8px 14px; border: 1.5px solid var(--border); border-radius: var(--r-full); font-size: 13px; outline: none; }
.search-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-body {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: #fff; position: relative; overflow: hidden;
}
.login-body::before {
  content: ''; position: absolute; top: -80px; right: -80px;
  width: 400px; height: 400px; border-radius: 50%;
  background: linear-gradient(135deg, rgba(201,24,32,.08) 0%, rgba(139,0,0,.06) 100%);
}
.login-body::after {
  content: ''; position: absolute; bottom: -60px; left: -60px;
  width: 300px; height: 300px; border-radius: 50%;
  background: linear-gradient(135deg, rgba(201,24,32,.05) 0%, rgba(139,0,0,.04) 100%);
}
.login-container { width: 100%; max-width: 420px; padding: 24px; animation: pageIn .5s ease-out; z-index: 1; }
.login-card { background: #fff; border-radius: var(--r-xl); box-shadow: var(--shadow-xl); padding: 48px 40px; border: 1px solid var(--border); }
.login-logo { text-align: center; margin-bottom: 32px; }
.logo-circle { width: 64px; height: 64px; border-radius: 50%; background: var(--primary-gradient); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 22px; font-family: var(--font-heading); margin: 0 auto 12px; box-shadow: 0 8px 24px rgba(201,24,32,.35); }
.logo-brand { font-family: var(--font-heading); font-size: 26px; font-weight: 800; color: var(--text-dark); }
.logo-brand span { color: var(--primary); }
.login-subtitle { color: var(--text-muted); font-size: 13px; margin-top: 4px; }
.form-options { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; font-size: 13px; }
.forgot-link { color: var(--primary); font-weight: 500; }
.alert { padding: 12px 16px; border-radius: var(--r-md); font-size: 13px; margin-bottom: 16px; }
.alert-danger { background: var(--danger-light); color: #b91c1c; border: 1px solid #fca5a5; }
.alert-info { background: var(--info-light); color: #1d4ed8; border: 1px solid #93c5fd; }
.login-footer { text-align: center; margin-top: 24px; font-size: 12px; color: var(--text-muted); }

/* ============================================================
   APP LAYOUT
   ============================================================ */
#app-wrapper { display: flex; height: 100vh; overflow: hidden; background: var(--bg-light); }

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-width); background: #fff; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; flex-shrink: 0; transition: var(--transition-slow); z-index: 40; overflow: hidden;
}
.sidebar-header { height: var(--topbar-h); display: flex; align-items: center; padding: 0 20px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.logo { display: inline-flex; align-items: center; gap: 10px; }
.logo-circle-sm { width: 36px; height: 36px; border-radius: 50%; background: var(--primary-gradient); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; font-family: var(--font-heading); box-shadow: 0 4px 12px rgba(201,24,32,.3); flex-shrink: 0; }
.logo-text { font-family: var(--font-heading); font-size: 18px; font-weight: 800; color: var(--text-dark); }
.logo-text span { color: var(--primary); }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 16px 12px; scrollbar-width: thin; }
.nav-section-title { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-light); font-weight: 700; padding: 16px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--r-md);
  color: var(--text-muted); font-size: 13px; font-weight: 500; margin-bottom: 2px; transition: var(--transition);
}
.nav-item:hover { background: var(--bg-light); color: var(--text-dark); }
.nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.nav-item.active .nav-board-dot { opacity: 1; }
.nav-item i { font-size: 18px; flex-shrink: 0; }
.nav-board-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; opacity: .7; }
.sidebar-footer { padding: 12px; border-top: 1px solid var(--border); flex-shrink: 0; }
.user-profile-sm { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-md); cursor: pointer; transition: var(--transition); }
.user-profile-sm:hover { background: var(--bg-light); }
.user-info { flex: 1; overflow: hidden; }
.user-name { font-size: 13px; font-weight: 600; color: var(--text-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--text-muted); }

/* ---- Main Content ---- */
#main-content { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.topbar {
  height: var(--topbar-h); background: #fff; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 24px; flex-shrink: 0; z-index: 30;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 12px; }
#page-title { font-size: 18px; font-weight: 700; font-family: var(--font-heading); color: var(--text-dark); }
#mobile-menu-btn { display: none; }
.status-selector select { border: 1.5px solid var(--border); border-radius: var(--r-full); padding: 6px 28px 6px 12px; font-size: 12px; cursor: pointer; background-size: 10px; }
#app-container { flex: 1; overflow-y: auto; padding: 24px; }

/* ---- Avatar ---- */
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--primary-gradient); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.avatar-sm { width: 30px; height: 30px; font-size: 11px; }
.avatar-xs { width: 24px; height: 24px; font-size: 10px; }
.avatar-lg { width: 48px; height: 48px; font-size: 18px; }

/* ---- Badge ---- */
.badge { position: absolute; top: 0; right: 0; background: var(--primary); color: #fff; font-size: 9px; font-weight: 800; min-width: 16px; height: 16px; border-radius: var(--r-full); border: 2px solid #fff; display: flex; align-items: center; justify-content: center; padding: 0 3px; transform: translate(30%,-30%); }
.badge-count { background: var(--primary-light); color: var(--primary); font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: var(--r-full); }

/* ============================================================
   CARDS & SECTIONS
   ============================================================ */
.card { background: #fff; border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); font-weight: 600; font-size: 14px; }
.card-body { padding: 20px; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; }
.section-header h2 { font-size: 16px; font-weight: 700; }

/* ============================================================
   DASHBOARD
   ============================================================ */
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 20px; display: flex; align-items: center; gap: 16px;
  transition: var(--transition); box-shadow: var(--shadow-xs);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-icon { width: 48px; height: 48px; border-radius: var(--r-lg); display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
.stat-info h3 { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.stat-value { font-size: 28px; font-weight: 800; font-family: var(--font-heading); color: var(--text-dark); line-height: 1.2; }

.board-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px,1fr)); gap: 16px; }
.board-card {
  background: #fff; border: 1.5px solid var(--border); border-radius: var(--r-lg);
  padding: 20px; cursor: pointer; transition: var(--transition); display: flex; align-items: center; gap: 16px;
}
.board-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.board-card-icon { width: 48px; height: 48px; border-radius: var(--r-lg); display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
.board-card h3 { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.board-card p { font-size: 12px; color: var(--text-muted); }
.board-meta { margin-top: 6px; }

.task-row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: #fff; border: 1px solid var(--border); border-radius: var(--r-md); margin-bottom: 8px; cursor: pointer; transition: var(--transition); }
.task-row:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); }
.task-row-info { flex: 1; overflow: hidden; }
.task-row-title { font-size: 13px; font-weight: 600; display: block; }
.task-row-meta { font-size: 11px; color: var(--text-muted); display: block; margin-top: 2px; }
.priority-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.priority-dot.urgent { background: var(--primary); }
.priority-dot.normal { background: var(--info); }

/* ============================================================
   KANBAN BOARD
   ============================================================ */
.kanban-actions { display: flex; gap: 10px; margin-bottom: 16px; }
.kanban-board { display: flex; gap: 16px; overflow-x: auto; height: calc(100vh - var(--topbar-h) - 120px); padding-bottom: 16px; scrollbar-width: thin; }
.kanban-board::-webkit-scrollbar { height: 6px; }
.kanban-board::-webkit-scrollbar-track { background: transparent; }
.kanban-board::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
.kanban-column { background: #F3F4F6; border-radius: var(--r-lg); min-width: 300px; max-width: 300px; display: flex; flex-direction: column; max-height: 100%; border: 1.5px solid transparent; transition: var(--transition); }
.kanban-column.drag-over { background: rgba(201,24,32,.04); border-color: var(--primary); }
.kanban-column-header { padding: 14px 14px 10px; display: flex; justify-content: space-between; align-items: center; }
.col-title-wrap { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--text-dark); }
.col-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.col-count { background: #fff; border: 1px solid var(--border); border-radius: var(--r-full); font-size: 11px; font-weight: 700; padding: 1px 8px; color: var(--text-muted); }
.kanban-tasks { flex: 1; overflow-y: auto; padding: 4px 10px 10px; min-height: 80px; display: flex; flex-direction: column; gap: 8px; scrollbar-width: thin; }
.task-card {
  background: #fff; border-radius: var(--r-md); padding: 12px; cursor: grab;
  border-left: 4px solid var(--info); box-shadow: var(--shadow-xs); border-top: 1px solid var(--border); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border);
  transition: var(--transition); user-select: none;
}
.task-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.task-card.dragging { opacity: .5; transform: scale(.98); cursor: grabbing; }
.task-card.priority-urgent { border-left-color: var(--primary); }
.task-urgent-indicator { font-size: 10px; font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px; }
.task-title { font-size: 13px; font-weight: 600; color: var(--text-dark); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 6px; line-height: 1.4; }
.task-desc { font-size: 11px; color: var(--text-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 8px; line-height: 1.4; }
.task-footer { display: flex; align-items: center; justify-content: space-between; }
.task-meta-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.task-due { font-size: 11px; font-weight: 500; }
.task-comments-count { font-size: 11px; color: var(--text-muted); }
.task-avatar { box-shadow: 0 0 0 2px #fff; }
.add-task-btn {
  background: none; border: 1.5px dashed var(--border-strong); border-radius: var(--r-md); padding: 8px;
  width: 100%; color: var(--text-muted); font-size: 12px; font-weight: 600; cursor: pointer; transition: var(--transition); margin-top: auto;
}
.add-task-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

/* ============================================================
   INBOX & DATA TABLE
   ============================================================ */
.inbox-filters { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.inbox-table-wrap { background: #fff; border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { padding: 12px 16px; text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); background: var(--bg-light); border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr.clickable-row { cursor: pointer; transition: var(--transition); }
.data-table tr.clickable-row:hover td { background: var(--bg-light); }
.data-table tr.row-inactive td { opacity: .55; }
.empty-state { text-align: center; color: var(--text-muted); padding: 24px; font-size: 13px; }
.flex-avatar { display: flex; align-items: center; gap: 8px; }

/* ---- Badges for priority, status, role ---- */
.priority-badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: var(--r-full); font-size: 11px; font-weight: 700; }
.priority-badge.urgent { background: var(--primary-light); color: var(--primary); }
.priority-badge.normal { background: var(--info-light); color: var(--info); }
.status-badge { display: inline-block; padding: 3px 10px; background: var(--bg-light); color: var(--text-body); border-radius: var(--r-full); font-size: 11px; font-weight: 600; border: 1px solid var(--border); }
.role-badge { display: inline-block; padding: 3px 10px; border-radius: var(--r-full); font-size: 11px; font-weight: 700; }
.role-badge.super_admin { background: var(--primary-light); color: var(--primary); }
.role-badge.admin { background: var(--info-light); color: var(--info); }
.role-badge.colaborador { background: var(--bg-light); color: var(--text-muted); }
.board-chip { background: var(--bg-light); border: 1px solid var(--border); color: var(--text-muted); padding: 2px 8px; border-radius: var(--r-full); font-size: 11px; font-weight: 600; }

/* ---- Status dots ---- */
.status-dot { width: 9px; height: 9px; border-radius: 50%; border: 2px solid #fff; position: absolute; bottom: 0; right: 0; }
.status-dot.online { background: var(--success); }
.status-dot.away { background: var(--warning); }
.status-dot.busy { background: var(--danger); }
.status-dot.offline { background: var(--text-light); }
.avatar-status-wrap { position: relative; display: inline-block; }
.status-dot-inline { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; }
.status-dot-inline.online { background: var(--success); }
.status-dot-inline.away { background: var(--warning); }
.status-dot-inline.busy { background: var(--danger); }
.status-dot-inline.offline { background: var(--text-light); }

/* ---- My Tasks view ---- */
.task-list-cards { display: grid; grid-template-columns: repeat(auto-fill,minmax(300px,1fr)); gap: 16px; }
.task-card-full {
  background: #fff; border: 1.5px solid var(--border); border-radius: var(--r-lg); padding: 16px;
  cursor: pointer; transition: var(--transition); border-left: 5px solid var(--info);
}
.task-card-full.urgent { border-left-color: var(--primary); }
.task-card-full:hover { box-shadow: var(--shadow-md); border-color: var(--primary); }
.task-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.task-card-full h3 { font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.task-card-full p { font-size: 12px; color: var(--text-muted); margin-bottom: 12px; line-height: 1.5; }
.task-card-footer { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 6px; }
.empty-state-large { text-align: center; color: var(--text-muted); padding: 60px 24px; font-size: 18px; }

/* ============================================================
   CHAT PANEL
   ============================================================ */
.chat-panel {
  position: fixed; top: 0; right: -400px; width: 380px; height: 100vh;
  background: #fff; box-shadow: var(--shadow-xl); transition: right .3s cubic-bezier(.4,0,.2,1);
  z-index: 50; display: flex; flex-direction: column; border-left: 1px solid var(--border);
}
.chat-panel.open { right: 0; }
.chat-header { padding: 0 16px; height: var(--topbar-h); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.chat-conv-header { display: flex; align-items: center; gap: 10px; }
.chat-conv-name { font-size: 14px; font-weight: 700; line-height: 1.3; }
.chat-conv-status { font-size: 11px; color: var(--text-muted); }
.unread-count { font-size: 11px; font-weight: 700; color: var(--primary); }
#chat-view-container { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }
.chat-list-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); cursor: pointer; transition: var(--transition); }
.chat-list-item:hover { background: var(--bg-light); }
.chat-list-info { flex: 1; overflow: hidden; }
.chat-list-top { display: flex; justify-content: space-between; margin-bottom: 3px; }
.chat-user-name { font-size: 13px; font-weight: 700; color: var(--text-dark); }
.chat-time { font-size: 10px; color: var(--text-muted); }
.chat-last-msg { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.chat-msg-wrap { display: flex; }
.sent-wrap { justify-content: flex-end; }
.received-wrap { justify-content: flex-start; }
.chat-bubble { max-width: 75%; padding: 10px 14px; border-radius: 18px; font-size: 13px; line-height: 1.5; word-wrap: break-word; }
.chat-bubble.sent { background: var(--primary-gradient); color: #fff; border-bottom-right-radius: 4px; box-shadow: 0 2px 8px rgba(201,24,32,.25); }
.chat-bubble.received { background: var(--bg-light); color: var(--text-body); border-bottom-left-radius: 4px; }
.bubble-time { font-size: 10px; margin-top: 4px; opacity: .7; text-align: right; }
.chat-no-messages { text-align: center; color: var(--text-muted); padding: 40px 20px; font-size: 13px; }
.chat-input-bar { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; gap: 8px; align-items: center; flex-shrink: 0; background: #fff; }
.chat-input-bar input { flex: 1; border-radius: var(--r-full); padding: 9px 16px; }

/* ============================================================
   MODALS
   ============================================================ */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); backdrop-filter: blur(4px);
  z-index: 100; display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; transition: var(--transition);
}
.modal-backdrop.show { opacity: 1; visibility: visible; }
.modal-content {
  background: #fff; border-radius: var(--r-xl); width: 90%; max-width: 560px; max-height: 90vh;
  overflow-y: auto; box-shadow: var(--shadow-xl); transform: scale(.96) translateY(8px); transition: var(--transition);
}
.modal-backdrop.show .modal-content { transform: scale(1) translateY(0); }
.modal-content.modal-lg { max-width: 740px; }
.modal-header { padding: 18px 24px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; background: #fff; z-index: 2; }
.modal-header h2 { font-size: 16px; font-weight: 700; }
.modal-body { padding: 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; position: sticky; bottom: 0; background: #fff; z-index: 2; }

/* ---- Task Modal extras ---- */
.comments-section { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.comments-section h3 { font-size: 14px; font-weight: 700; margin-bottom: 12px; }
.comments-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }
.comment { display: flex; gap: 10px; }
.comment-author { font-size: 12px; font-weight: 700; color: var(--text-dark); }
.comment-text { font-size: 13px; color: var(--text-body); line-height: 1.5; }
.comment-time { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.comment-input-wrap { display: flex; gap: 8px; margin-top: 12px; }
.comment-input-wrap input { flex: 1; }

/* ============================================================
   TOASTS
   ============================================================ */
#toast-container { position: fixed; top: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  background: #fff; border-radius: var(--r-lg); padding: 14px 18px; box-shadow: var(--shadow-xl);
  border-left: 4px solid var(--primary); display: flex; align-items: center; gap: 12px;
  transform: translateX(120%); transition: transform .35s cubic-bezier(.34,1.56,.64,1); pointer-events: all;
  min-width: 280px; max-width: 360px;
}
.toast.show { transform: translateX(0); }
.toast-icon { font-size: 18px; flex-shrink: 0; }
.toast-msg { font-size: 13px; font-weight: 500; color: var(--text-dark); line-height: 1.4; }

/* ============================================================
   NOTIFICATIONS PANEL
   ============================================================ */
.notif-item { display: flex; align-items: flex-start; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--border); transition: var(--transition); }
.notif-item:hover { background: var(--bg-light); }
.notif-item.unread { background: rgba(201,24,32,.03); }
.notif-icon { font-size: 20px; flex-shrink: 0; margin-top: 2px; }
.notif-title { font-size: 13px; font-weight: 700; color: var(--text-dark); margin-bottom: 2px; }
.notif-message { font-size: 12px; color: var(--text-muted); line-height: 1.4; }
.notif-time { font-size: 11px; color: var(--text-light); margin-top: 4px; }

/* ============================================================
   PROFILE
   ============================================================ */
.profile-card { text-align: center; padding: 32px; margin-bottom: 24px; }
.profile-avatar-lg { width: 80px; height: 80px; border-radius: 50%; background: var(--primary-gradient); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 800; font-family: var(--font-heading); margin: 0 auto 16px; box-shadow: 0 8px 24px rgba(201,24,32,.3); }
.profile-card h2 { font-size: 22px; margin-bottom: 6px; }

/* ============================================================
   ADMIN PANELS
   ============================================================ */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(400px, 1fr)); gap: 20px; }
.settings-actions { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.boards-admin-list { display: flex; flex-direction: column; gap: 12px; }
.board-admin-card .board-admin-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding: 16px 20px; }
.board-admin-actions { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; }
.column-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.drag-handle { cursor: grab; color: var(--text-light); font-size: 16px; }
.column-name-input { flex: 1; padding: 6px 10px; font-size: 13px; }
.column-color-select { width: 90px; padding: 6px 8px; font-size: 12px; }
.color-picker { display: flex; gap: 10px; flex-wrap: wrap; padding: 8px 0; }
.color-option { position: relative; cursor: pointer; }
.color-option input { position: absolute; opacity: 0; }
.color-dot { display: block; width: 28px; height: 28px; border-radius: 50%; border: 3px solid transparent; transition: var(--transition); }
.color-option input:checked + .color-dot { border-color: var(--text-dark); transform: scale(1.15); }
.color-dot.color-blue { background: #3B82F6; }
.color-dot.color-purple { background: #8B5CF6; }
.color-dot.color-orange { background: #F97316; }
.color-dot.color-green { background: #10B981; }
.color-dot.color-red { background: #C91820; }
.color-dot.color-gray { background: #9CA3AF; }

/* ============================================================
   SKELETON LOADING
   ============================================================ */
.skeleton-wrap { padding: 8px; }
.skeleton-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.skeleton { background: linear-gradient(90deg, #f0f0f0 25%, #e8e8e8 50%, #f0f0f0 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: var(--r-lg); }
.skeleton-card { height: 100px; }
.skeleton-block { height: 20px; margin-bottom: 12px; border-radius: var(--r-md); }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ============================================================
   ANIMATIONS & TRANSITIONS
   ============================================================ */
.page-fade-in { animation: pageIn .25s ease-out; }
@keyframes pageIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ============================================================
   UTILITIES
   ============================================================ */
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-success { color: var(--success) !important; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.d-none { display: none !important; }
code { background: #f0f0f0; padding: 2px 6px; border-radius: 4px; font-size: 12px; font-family: monospace; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  #mobile-menu-btn { display: flex; }
  .sidebar { position: fixed; top: 0; left: 0; height: 100%; transform: translateX(-100%); box-shadow: var(--shadow-xl); }
  .sidebar.open { transform: translateX(0); }
  #main-content { margin-left: 0 !important; }
  .dashboard-grid { grid-template-columns: 1fr 1fr; }
  .board-grid { grid-template-columns: 1fr; }
  .kanban-board { height: auto; flex-wrap: nowrap; }
  .kanban-column { min-width: 280px; max-width: 280px; }
  .modal-content { width: 96%; max-height: 95vh; }
  .chat-panel { width: 100%; right: -100%; }
  .settings-grid { grid-template-columns: 1fr; }
  .topbar { padding: 0 14px; }
  #app-container { padding: 16px; }
  .inbox-filters { flex-direction: column; align-items: stretch; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  #page-title { font-size: 15px; }
}

@media (max-width: 480px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .login-card { padding: 32px 24px; }
  .task-list-cards { grid-template-columns: 1fr; }
  .modal-footer { flex-direction: column; }
  .modal-footer .btn { width: 100%; }
}
