/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #0a0a0f; --bg-card: #12121a; --bg-card-hover: #1a1a25;
  --bg-input: #1a1a25; --bg-surface: #16161f;
  --border: #2a2a3a; --border-focus: #6366f1;
  --text: #e4e4e7; --text-muted: #71717a; --text-dim: #52525b;
  --primary: #6366f1; --primary-hover: #818cf8; --primary-bg: rgba(99,102,241,0.12);
  --success: #10b981; --success-bg: rgba(16,185,129,0.12);
  --warning: #f59e0b; --warning-bg: rgba(245,158,11,0.12);
  --danger: #ef4444; --danger-bg: rgba(239,68,68,0.12);
  --info: #3b82f6; --info-bg: rgba(59,130,246,0.12);
  --pink: #ec4899; --pink-bg: rgba(236,72,153,0.12);
  --radius: 10px; --radius-lg: 16px;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
html { font-size: 15px; }
body { font-family: var(--font); background: var(--bg); color: var(--text); min-height: 100vh; line-height: 1.6; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
button { font-family: inherit; cursor: pointer; border: none; outline: none; }
input, select, textarea { font-family: inherit; outline: none; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }

/* === SCROLLBAR === */
::-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-dim); }

/* === LAYOUT === */
.app-layout { display: flex; min-height: 100vh; }
.sidebar { width: 260px; background: var(--bg-card); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 100; transition: transform var(--transition); }
.main-content { flex: 1; margin-left: 260px; min-height: 100vh; }
.top-bar { height: 60px; background: var(--bg-card); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 28px; position: sticky; top: 0; z-index: 50; backdrop-filter: blur(12px); }
.page-content { padding: 28px; max-width: 1400px; }

/* === SIDEBAR === */
.sidebar-header { padding: 20px; border-bottom: 1px solid var(--border); }
.sidebar-logo { display: flex; align-items: center; gap: 10px; }
.sidebar-logo .logo-icon { width: 36px; height: 36px; border-radius: var(--radius); background: linear-gradient(135deg, var(--primary), #a855f7); display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 800; color: white; }
.sidebar-logo .logo-text { font-size: 1.1rem; font-weight: 700; letter-spacing: -0.02em; }
.sidebar-logo .logo-sub { font-size: 0.7rem; color: var(--text-muted); font-weight: 500; letter-spacing: 0.05em; text-transform: uppercase; }
.sidebar-nav { flex: 1; padding: 12px; overflow-y: auto; }
.nav-section { margin-bottom: 20px; }
.nav-section-title { font-size: 0.65rem; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.1em; padding: 0 12px; margin-bottom: 6px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: var(--text-muted); font-size: 0.88rem; font-weight: 500; transition: all var(--transition); cursor: pointer; }
.nav-item:hover { background: var(--bg-card-hover); color: var(--text); }
.nav-item.active { background: var(--primary-bg); color: var(--primary); }
.nav-item .nav-icon { width: 20px; text-align: center; font-size: 1rem; }
.nav-item .nav-badge { margin-left: auto; background: var(--primary-bg); color: var(--primary); font-size: 0.7rem; padding: 2px 7px; border-radius: 10px; font-weight: 600; }
.sidebar-footer { padding: 16px; border-top: 1px solid var(--border); }
.user-card { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 8px; }
.user-card:hover { background: var(--bg-card-hover); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; font-weight: 600; font-size: 0.8rem; flex-shrink: 0; }
.avatar-sm { width: 28px; height: 28px; font-size: 0.7rem; }
.user-card .user-info { flex: 1; min-width: 0; }
.user-card .user-name { font-size: 0.85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-card .user-role { font-size: 0.7rem; color: var(--text-muted); text-transform: capitalize; }

/* === TOP BAR === */
.top-bar-left { display: flex; align-items: center; gap: 16px; }
.top-bar h1 { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.02em; }
.top-bar-right { display: flex; align-items: center; gap: 12px; }
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 0.82rem; color: var(--text-muted); }
.breadcrumb span { color: var(--text-dim); }

/* === BUTTONS === */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 16px; border-radius: 8px; font-size: 0.85rem; font-weight: 600; transition: all var(--transition); white-space: nowrap; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(99,102,241,0.3); }
.btn-secondary { background: var(--bg-input); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--text-dim); background: var(--bg-card-hover); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); background: var(--bg-card-hover); }
.btn-sm { padding: 5px 10px; font-size: 0.78rem; }
.btn-icon { width: 34px; height: 34px; padding: 0; display: flex; align-items: center; justify-content: center; border-radius: 8px; background: var(--bg-input); border: 1px solid var(--border); color: var(--text-muted); }
.btn-icon:hover { color: var(--text); border-color: var(--text-dim); }

/* === INPUTS === */
.input, .select, .textarea { width: 100%; padding: 9px 13px; background: var(--bg-input); border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 0.88rem; transition: border-color var(--transition); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); }
.input::placeholder { color: var(--text-dim); }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2371717a' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; cursor: pointer; }
.textarea { min-height: 80px; resize: vertical; }
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text-muted); margin-bottom: 5px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* === CARDS === */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; transition: all var(--transition); }
.card:hover { border-color: var(--text-dim); }
.card-header { padding: 18px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-header h2 { font-size: 0.95rem; font-weight: 700; }
.card-header h3 { font-size: 0.88rem; font-weight: 600; }
.card-body { padding: 20px; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--border); }

/* === BADGES === */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 6px; font-size: 0.72rem; font-weight: 600; white-space: nowrap; }
.badge-a { background: var(--danger-bg); color: var(--danger); }
.badge-aa { background: var(--warning-bg); color: var(--warning); }
.badge-aaa { background: var(--success-bg); color: var(--success); }
.badge-todo { background: var(--bg-input); color: var(--text-muted); }
.badge-in_progress { background: var(--info-bg); color: var(--info); }
.badge-review { background: var(--pink-bg); color: var(--pink); }
.badge-done { background: var(--success-bg); color: var(--success); }
.badge-blocked { background: var(--danger-bg); color: var(--danger); }
.badge-critical { background: var(--danger-bg); color: var(--danger); }
.badge-high { background: var(--warning-bg); color: var(--warning); }
.badge-medium { background: var(--info-bg); color: var(--info); }
.badge-low { background: var(--bg-input); color: var(--text-muted); }
.badge-developer { background: var(--info-bg); color: var(--info); }
.badge-designer { background: var(--pink-bg); color: var(--pink); }
.badge-pm { background: var(--success-bg); color: var(--success); }
.badge-chef_projet { background: var(--primary-bg); color: var(--primary); }

/* === STATS GRID === */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; }
.stat-card .stat-label { font-size: 0.75rem; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 6px; }
.stat-card .stat-value { font-size: 2rem; font-weight: 800; letter-spacing: -0.03em; }
.stat-card .stat-sub { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; }
.stat-card.primary .stat-value { color: var(--primary); }
.stat-card.success .stat-value { color: var(--success); }
.stat-card.warning .stat-value { color: var(--warning); }
.stat-card.danger .stat-value { color: var(--danger); }

/* === PROGRESS BAR === */
.progress-bar { width: 100%; height: 8px; background: var(--bg-input); border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 4px; transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1); }
.progress-fill.primary { background: linear-gradient(90deg, var(--primary), #a855f7); }
.progress-fill.success { background: var(--success); }
.progress-fill.warning { background: var(--warning); }

/* === TABLE === */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 10px 16px; text-align: left; font-size: 0.72rem; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; border-bottom: 1px solid var(--border); background: var(--bg-surface); }
td { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 0.85rem; vertical-align: middle; }
tr:hover td { background: var(--bg-card-hover); }
tr:last-child td { border-bottom: none; }

/* === KANBAN === */
.kanban-board { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; min-height: 400px; }
.kanban-column { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-lg); display: flex; flex-direction: column; min-height: 300px; }
.kanban-column-header { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.kanban-column-header h3 { font-size: 0.82rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.kanban-column-header .count { background: var(--bg-input); color: var(--text-muted); padding: 2px 7px; border-radius: 6px; font-size: 0.7rem; font-weight: 600; }
.kanban-cards { flex: 1; padding: 10px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.kanban-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; cursor: pointer; transition: all var(--transition); }
.kanban-card:hover { border-color: var(--primary); transform: translateY(-1px); box-shadow: var(--shadow); }
.kanban-card .card-title { font-size: 0.82rem; font-weight: 600; margin-bottom: 8px; line-height: 1.4; }
.kanban-card .card-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.kanban-card .card-criterion { font-size: 0.7rem; color: var(--primary); font-weight: 600; }

/* === MODAL === */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; opacity: 0; pointer-events: none; transition: opacity var(--transition); }
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); width: 100%; max-width: 600px; max-height: 85vh; overflow-y: auto; transform: translateY(20px) scale(0.97); transition: transform var(--transition); }
.modal-overlay.open .modal { transform: translateY(0) scale(1); }
.modal-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-header h2 { font-size: 1.05rem; 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; }
.modal-lg { max-width: 800px; }

/* === CHAT === */
.chat-container { display: flex; flex-direction: column; height: calc(100vh - 148px); }
.chat-messages { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.chat-message { display: flex; gap: 12px; max-width: 80%; }
.chat-message.user { align-self: flex-end; flex-direction: row-reverse; }
.chat-message .msg-bubble { padding: 14px 18px; border-radius: 16px; font-size: 0.88rem; line-height: 1.6; }
.chat-message.user .msg-bubble { background: var(--primary); color: white; border-bottom-right-radius: 4px; }
.chat-message.bot .msg-bubble { background: var(--bg-surface); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.chat-message .msg-bubble h3, .chat-message .msg-bubble strong { color: inherit; }
.chat-message.bot .msg-bubble strong { color: var(--primary-hover); }
.chat-message.bot .msg-bubble h3 { font-size: 0.9rem; margin: 10px 0 6px; color: var(--text); }
.chat-input-area { padding: 16px 20px; border-top: 1px solid var(--border); background: var(--bg-card); display: flex; gap: 10px; align-items: flex-end; }
.chat-input-area .input { flex: 1; min-height: 42px; max-height: 120px; resize: none; }
.chat-suggestions { display: flex; gap: 8px; flex-wrap: wrap; padding: 12px 20px; }
.chat-suggestions button { padding: 6px 14px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 20px; font-size: 0.78rem; color: var(--text-muted); transition: all var(--transition); }
.chat-suggestions button:hover { border-color: var(--primary); color: var(--primary); }

/* === CRITERION DETAIL === */
.criterion-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.criterion-detail .full-width { grid-column: 1 / -1; }
.technique-list { list-style: none; padding: 0; }
.technique-list li { padding: 8px 12px; border-left: 3px solid var(--primary); margin-bottom: 6px; background: var(--primary-bg); border-radius: 0 6px 6px 0; font-size: 0.84rem; line-height: 1.5; }
.technique-list.design li { border-color: var(--pink); background: var(--pink-bg); }
.technique-list.pm li { border-color: var(--success); background: var(--success-bg); }
.failure-list li { border-color: var(--danger); background: var(--danger-bg); }

/* === MEMBER PROGRESS === */
.member-progress-card { display: flex; align-items: center; gap: 16px; padding: 16px; border-bottom: 1px solid var(--border); }
.member-progress-card:last-child { border-bottom: none; }
.member-progress-info { flex: 1; }
.member-progress-stats { display: flex; gap: 12px; align-items: center; }
.member-progress-stats .stat { text-align: center; }
.member-progress-stats .stat .num { font-size: 1.1rem; font-weight: 700; }
.member-progress-stats .stat .lbl { font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; }

/* === LOGIN === */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 20px; }
.login-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 40px; width: 100%; max-width: 420px; }
.login-card .login-logo { text-align: center; margin-bottom: 32px; }
.login-card .login-logo .logo-icon { width: 56px; height: 56px; border-radius: 16px; background: linear-gradient(135deg, var(--primary), #a855f7); display: inline-flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 800; color: white; margin-bottom: 12px; }
.login-card h1 { font-size: 1.4rem; font-weight: 800; margin-bottom: 4px; letter-spacing: -0.03em; }
.login-card .subtitle { color: var(--text-muted); font-size: 0.88rem; }
.login-card .demo-accounts { margin-top: 24px; padding: 16px; background: var(--bg-surface); border-radius: var(--radius); border: 1px solid var(--border); }
.login-card .demo-accounts h3 { font-size: 0.78rem; font-weight: 600; color: var(--text-muted); margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.05em; }
.demo-account-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 12px; background: transparent; border: 1px solid var(--border); border-radius: 8px; color: var(--text); font-size: 0.82rem; margin-bottom: 6px; transition: all var(--transition); }
.demo-account-btn:hover { background: var(--bg-card-hover); border-color: var(--primary); }
.demo-account-btn:last-child { margin-bottom: 0; }
.demo-account-btn .role-tag { margin-left: auto; font-size: 0.7rem; padding: 2px 8px; border-radius: 4px; font-weight: 600; }

/* === TABS === */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.tab { padding: 10px 18px; font-size: 0.85rem; font-weight: 600; color: var(--text-muted); border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; transition: all var(--transition); background: none; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-color: var(--primary); }

/* === FILTERS === */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 20px; }
.filters .select { width: auto; min-width: 140px; }
.filters .input { width: auto; min-width: 220px; }
.filter-chip { display: inline-flex; align-items: center; gap: 5px; padding: 5px 12px; border-radius: 20px; font-size: 0.78rem; font-weight: 500; background: var(--bg-input); border: 1px solid var(--border); color: var(--text-muted); cursor: pointer; transition: all var(--transition); }
.filter-chip:hover, .filter-chip.active { border-color: var(--primary); color: var(--primary); background: var(--primary-bg); }

/* === EMPTY STATE === */
.empty-state { text-align: center; padding: 60px 20px; }
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 16px; opacity: 0.3; }
.empty-state h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 6px; }
.empty-state p { color: var(--text-muted); font-size: 0.88rem; }

/* === TIMELINE === */
.timeline { padding: 0; list-style: none; }
.timeline-item { display: flex; gap: 12px; padding: 10px 0; position: relative; }
.timeline-item::before { content: ''; position: absolute; left: 14px; top: 36px; bottom: -10px; width: 1px; background: var(--border); }
.timeline-item:last-child::before { display: none; }
.timeline-dot { width: 28px; height: 28px; border-radius: 50%; background: var(--bg-input); border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 0.7rem; flex-shrink: 0; }
.timeline-content { flex: 1; }
.timeline-content .time { font-size: 0.72rem; color: var(--text-dim); }
.timeline-content .action { font-size: 0.84rem; }

/* === RESPONSIVE === */
@media (max-width: 1200px) {
  .kanban-board { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .kanban-board { grid-template-columns: 1fr 1fr; }
  .criterion-detail { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
}

/* === ANIMATIONS === */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn 0.3s ease-out; }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.slide-up { animation: slideUp 0.4s ease-out; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.pulse { animation: pulse 1.5s infinite; }

/* === TOAST === */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 12px 18px; border-radius: var(--radius); font-size: 0.85rem; font-weight: 500; box-shadow: var(--shadow); animation: slideUp 0.3s ease-out; max-width: 360px; }
.toast-success { background: var(--success); color: white; }
.toast-error { background: var(--danger); color: white; }
.toast-info { background: var(--info); color: white; }
