/* ═══════════════════════════════════════════════════════════════════════
   DESIGN TOKENS — inspirés de BatiPilote Pro + ProspectAI
   ═══════════════════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Surfaces */
  --bg: #F1F5F9;
  --surface: #FFFFFF;
  --surface-2: #F1F5F9;
  --surface-3: #E8EEF4;

  /* Couleur primaire : bleu ProspectAI */
  --primary: #2563EB;
  --primary-l: #EFF6FF;
  --primary-m: #DBEAFE;
  --primary-d: #1D4ED8;
  --primary-xl: #F8FAFF;

  /* Accents */
  --green: #10B981; --green-l: #ECFDF5; --green-d: #047857;
  --red: #EF4444;   --red-l: #FEF2F2;   --red-d: #B91C1C;
  --amber: #F59E0B; --amber-l: #FFFBEB; --amber-d: #92400E;
  --purple: #7C3AED;--purple-l: #EDE9FE;--purple-d: #5B21B6;
  --cyan: #0891B2;  --cyan-l: #CFFAFE;
  --pink: #DB2777;  --pink-l: #FCE7F3;

  /* Texte */
  --t1: #0F172A;
  --t2: #475569;
  --t3: #94A3B8;
  --t4: #CBD5E1;

  /* Bordures */
  --border: #E2E8F0;
  --border-m: #CBD5E1;
  --border-d: #94A3B8;

  /* Ombres */
  --sh-xs: 0 1px 2px rgba(15,23,42,.04);
  --sh-sm: 0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
  --sh:    0 4px 16px rgba(15,23,42,.07), 0 1px 4px rgba(15,23,42,.04);
  --sh-lg: 0 10px 30px rgba(15,23,42,.08), 0 4px 8px rgba(15,23,42,.04);
  --sh-xl: 0 24px 48px rgba(15,23,42,.12);

  /* Radius */
  --r: 12px;
  --rs: 9px;
  --rx: 7px;

  /* Layout */
  --sidebar-w: 248px;
  --topbar-h: 60px;
}

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--t1);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: 'JetBrains Mono', monospace; }
.num  { font-variant-numeric: tabular-nums; }

/* ═══════════════════════════════════════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════════════════════════════════════ */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 16px 12px;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 30;
}

.sidebar::-webkit-scrollbar { width: 0; }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}

.brand-logo {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--primary-d));
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(37,99,235,.35);
  flex-shrink: 0;
}

.brand-name { font-size: 15px; font-weight: 800; color: var(--t1); letter-spacing: -.3px; }
.brand-name span { color: var(--primary); }
.brand-sub { font-size: 10.5px; color: var(--t3); font-weight: 600; letter-spacing: .4px; text-transform: uppercase; margin-top: 1px; }

.nav-section { margin-top: 14px; }
.nav-label {
  font-size: 10px; font-weight: 700; color: var(--t3);
  text-transform: uppercase; letter-spacing: .8px;
  padding: 0 10px; margin-bottom: 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--rx);
  font-size: 13px; font-weight: 600;
  color: var(--t2);
  cursor: pointer;
  transition: all .12s;
  margin-bottom: 1px;
  user-select: none;
}
.nav-item:hover { background: var(--surface-2); color: var(--t1); }
.nav-item.active { background: var(--primary-l); color: var(--primary-d); }
.nav-item svg { color: var(--t3); flex-shrink: 0; }
.nav-item.active svg { color: var(--primary); }

.nav-badge {
  margin-left: auto;
  background: var(--surface-2); color: var(--t3);
  font-size: 10px; font-weight: 700;
  padding: 1px 7px; border-radius: 99px;
}
.nav-item.active .nav-badge { background: white; color: var(--primary); }

.nav-project {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px;
  border-radius: var(--rx);
  font-size: 12.5px; font-weight: 500;
  color: var(--t2);
  cursor: pointer;
  transition: all .12s;
}
.nav-project:hover { background: var(--surface-2); color: var(--t1); }
.nav-project.active { background: var(--primary-l); color: var(--primary-d); font-weight: 600; }
.nav-project-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

.nav-item-new {
  color: var(--t3);
  font-size: 12.5px;
  font-weight: 500;
  margin-top: 4px;
}
.nav-item-new:hover { color: var(--primary); background: var(--primary-l); }

.sidebar-footer { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }

.user-card {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: var(--rx);
  cursor: pointer; transition: all .12s;
}
.user-card:hover { background: var(--surface-2); }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-d));
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 12px;
  flex-shrink: 0;
}
.user-name { font-size: 12.5px; font-weight: 700; color: var(--t1); }
.user-role { font-size: 11px; color: var(--t3); }

/* ═══════════════════════════════════════════════════════════════════════
   MAIN
   ═══════════════════════════════════════════════════════════════════════ */
.main { grid-column: 2; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 16px;
  position: sticky; top: 0; z-index: 20;
}

.search-bar { flex: 1; max-width: 520px; position: relative; }
.search-bar input {
  width: 100%;
  padding: 8px 12px 8px 38px;
  border: 1px solid var(--border);
  border-radius: var(--rs);
  font-size: 13px; font-family: inherit;
  background: var(--surface-2);
  outline: none; transition: all .15s;
  color: var(--t1);
}
.search-bar input:focus {
  background: white;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-l);
}
.search-bar svg {
  position: absolute; left: 12px; top: 50%;
  transform: translateY(-50%); color: var(--t3);
}

.topbar-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.content {
  padding: 24px 28px 60px;
  max-width: 1500px;
  width: 100%;
  margin: 0 auto;
}

.page-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 22px; gap: 16px; flex-wrap: wrap;
}
.page-title { font-size: 23px; font-weight: 800; color: var(--t1); letter-spacing: -.5px; }
.page-sub { font-size: 13px; color: var(--t3); margin-top: 3px; }
.page-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ═══════════════════════════════════════════════════════════════════════
   BOUTONS
   ═══════════════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 16px;
  border-radius: var(--rs);
  font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all .15s;
  border: none; font-family: inherit;
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-d));
  color: white;
  box-shadow: 0 3px 10px rgba(37,99,235,.22);
}
.btn-primary:hover {
  box-shadow: 0 5px 18px rgba(37,99,235,.38);
  transform: translateY(-1px);
}
.btn-ghost {
  background: var(--surface);
  color: var(--t2);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border-m); color: var(--t1); }
.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { background: var(--red-d); }
.btn-sm { padding: 5px 11px; font-size: 12px; }

/* ═══════════════════════════════════════════════════════════════════════
   KPI CARDS
   ═══════════════════════════════════════════════════════════════════════ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px 20px;
  box-shadow: var(--sh-sm);
  transition: all .2s;
  position: relative;
  overflow: hidden;
}
.kpi-card:hover {
  box-shadow: var(--sh);
  transform: translateY(-2px);
  border-color: var(--border-m);
}
.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--r) var(--r) 0 0;
}
.kpi-card.blue::before   { background: linear-gradient(90deg, #2563EB, #60A5FA); }
.kpi-card.green::before  { background: linear-gradient(90deg, #10B981, #34D399); }
.kpi-card.amber::before  { background: linear-gradient(90deg, #F59E0B, #FCD34D); }
.kpi-card.red::before    { background: linear-gradient(90deg, #EF4444, #F87171); }
.kpi-card.purple::before { background: linear-gradient(90deg, #7C3AED, #A78BFA); }

.kpi-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
  gap: 10px;
}
.kpi-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--t2);
  line-height: 1.3;
}
.kpi-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.kpi-icon.blue   { background: var(--primary-l); color: var(--primary); }
.kpi-icon.green  { background: var(--green-l); color: var(--green); }
.kpi-icon.amber  { background: var(--amber-l); color: var(--amber); }
.kpi-icon.red    { background: var(--red-l); color: var(--red); }
.kpi-icon.purple { background: var(--purple-l); color: var(--purple); }

.kpi-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--t1);
  letter-spacing: -1px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.kpi-sub {
  font-size: 11.5px;
  color: var(--t3);
  margin-top: 6px;
}

/* ═══════════════════════════════════════════════════════════════════════
   CARD GENERIC
   ═══════════════════════════════════════════════════════════════════════ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 20px;
  box-shadow: var(--sh-sm);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 10px;
}
.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--t1);
  letter-spacing: -.2px;
}

/* Progress bar */
.progress {
  height: 8px;
  background: var(--surface-2);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 4px;
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-d));
  border-radius: 99px;
  transition: width .4s ease;
}

/* Row of mini-stats inside a card */
.mini-stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.mini-stat { display: flex; flex-direction: column; gap: 3px; }
.mini-stat-value { font-size: 20px; font-weight: 800; color: var(--t1); letter-spacing: -.5px; }
.mini-stat-label { font-size: 11px; color: var(--t3); text-transform: uppercase; letter-spacing: .4px; font-weight: 600; }

/* ═══════════════════════════════════════════════════════════════════════
   GRID 2 cols (dashboard)
   ═══════════════════════════════════════════════════════════════════════ */
.grid-2 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 16px; }
@media (max-width: 960px) { .grid-2 { grid-template-columns: 1fr; } }

/* ═══════════════════════════════════════════════════════════════════════
   TABLE (liste des tâches)
   ═══════════════════════════════════════════════════════════════════════ */
.card-table {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--sh-sm);
  overflow: hidden;
}
.card-table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
}
.tbl-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  font-size: 11px;
  font-weight: 700;
  color: var(--t3);
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 11px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  white-space: nowrap;
}
.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--t1);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr { cursor: pointer; transition: background .12s; }
.data-table tbody tr:hover td { background: rgba(37,99,235,.03); }

.task-title-cell { display: flex; align-items: center; gap: 10px; }
.task-title-cell strong { font-weight: 600; color: var(--t1); }
.task-title-cell-sub { font-size: 11.5px; color: var(--t3); margin-top: 2px; }

/* ═══════════════════════════════════════════════════════════════════════
   BADGES (statut, priorité)
   ═══════════════════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 99px;
  white-space: nowrap;
}
.badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* Statuts */
.badge-todo        { background: #F1F5F9; color: #64748B; }
.badge-in_progress { background: var(--primary-l); color: var(--primary-d); }
.badge-review      { background: var(--amber-l); color: var(--amber-d); }
.badge-done        { background: var(--green-l); color: var(--green-d); }

/* Priorités */
.badge-low    { background: #F1F5F9; color: #64748B; }
.badge-medium { background: var(--primary-l); color: var(--primary-d); }
.badge-high   { background: var(--amber-l); color: var(--amber-d); }
.badge-urgent { background: var(--red-l); color: var(--red-d); }

/* Priority pill (sans dot) */
.priority-pill {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11.5px; font-weight: 700;
  padding: 3px 8px; border-radius: 6px;
}

/* Avatar inline */
.avatar-inline {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: white; font-size: 10.5px; font-weight: 700;
  flex-shrink: 0;
  border: 2px solid white;
  box-shadow: var(--sh-xs);
}
.avatar-unassigned {
  background: var(--surface-3);
  color: var(--t3);
  border: 1px dashed var(--border-m);
  box-shadow: none;
}

/* ═══════════════════════════════════════════════════════════════════════
   KANBAN
   ═══════════════════════════════════════════════════════════════════════ */
.kanban {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
@media (max-width: 1100px) { .kanban { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .kanban { grid-template-columns: 1fr; } }

.kanban-col {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 12px;
  min-height: 300px;
  transition: background .15s, border-color .15s;
}
.kanban-col.drag-over { background: var(--primary-l); border-color: var(--primary-m); }

.kanban-col-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 6px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}
.kanban-col-title { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700; color: var(--t1); }
.kanban-col-count { font-size: 11px; font-weight: 700; color: var(--t3); background: white; padding: 1px 8px; border-radius: 99px; border: 1px solid var(--border); }
.kanban-col-dot { width: 8px; height: 8px; border-radius: 50%; }
.kanban-col-dot.todo        { background: #94A3B8; }
.kanban-col-dot.in_progress { background: var(--primary); }
.kanban-col-dot.review      { background: var(--amber); }
.kanban-col-dot.done        { background: var(--green); }

.kanban-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--rs);
  padding: 12px;
  margin-bottom: 8px;
  cursor: grab;
  box-shadow: var(--sh-xs);
  transition: all .15s;
}
.kanban-card:hover { box-shadow: var(--sh-sm); border-color: var(--border-m); transform: translateY(-1px); }
.kanban-card:active { cursor: grabbing; }
.kanban-card.dragging { opacity: .45; }
.kanban-card-title { font-size: 13px; font-weight: 600; color: var(--t1); line-height: 1.3; margin-bottom: 8px; word-break: break-word; }
.kanban-card-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 11px; color: var(--t3); }
.kanban-card-tags { display: flex; gap: 4px; align-items: center; }

/* ═══════════════════════════════════════════════════════════════════════
   DOCUMENTS GRID
   ═══════════════════════════════════════════════════════════════════════ */
.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.doc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px;
  box-shadow: var(--sh-sm);
  display: flex; flex-direction: column; gap: 10px;
  transition: all .15s;
}
.doc-card:hover { box-shadow: var(--sh); transform: translateY(-1px); border-color: var(--border-m); }
.doc-icon {
  width: 40px; height: 40px;
  border-radius: 8px;
  background: var(--primary-l);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.doc-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--t1);
  line-height: 1.3;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.doc-meta { font-size: 11.5px; color: var(--t3); }
.doc-actions { display: flex; gap: 6px; margin-top: auto; }

/* ═══════════════════════════════════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.5);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center; justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-overlay.open { display: flex; }

.modal {
  background: white;
  border-radius: 14px;
  max-width: 640px;
  width: 100%;
  max-height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: var(--sh-xl);
  overflow: hidden;
  animation: modalIn .2s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.modal.large { max-width: 820px; }

.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.modal-header h3 { font-size: 16px; font-weight: 700; color: var(--t1); letter-spacing: -.2px; }
.modal-close {
  background: none; border: none;
  font-size: 22px; cursor: pointer;
  color: var(--t3); padding: 0 4px;
  line-height: 1;
  transition: color .12s;
}
.modal-close:hover { color: var(--t1); }
.modal-body { padding: 22px; overflow-y: auto; flex: 1; }

/* Form */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--t2);
  margin-bottom: 6px;
}
.form-group input[type="text"],
.form-group input[type="date"],
.form-group input[type="file"],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--rs);
  font-size: 13px;
  font-family: inherit;
  background: white;
  color: var(--t1);
  outline: none;
  transition: all .15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-l);
}
.form-group textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 540px) { .form-row { grid-template-columns: 1fr; } }

.form-footer {
  display: flex; justify-content: flex-end; gap: 10px;
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ═══════════════════════════════════════════════════════════════════════
   TASK DETAIL (dans modal large)
   ═══════════════════════════════════════════════════════════════════════ */
.task-detail-grid {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 20px;
}
@media (max-width: 700px) { .task-detail-grid { grid-template-columns: 1fr; } }

.task-meta {
  background: var(--surface-2);
  border-radius: var(--rs);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.task-meta-item .label { font-size: 10.5px; font-weight: 700; color: var(--t3); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 5px; }
.task-meta-item .value { font-size: 13px; color: var(--t1); font-weight: 500; }

.task-desc {
  font-size: 13.5px;
  color: var(--t2);
  line-height: 1.6;
  white-space: pre-wrap;
  margin-bottom: 18px;
}

.task-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--t1);
  text-transform: uppercase;
  letter-spacing: .4px;
  margin: 16px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.comment {
  display: flex; gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.comment:last-child { border-bottom: none; }
.comment-body { flex: 1; min-width: 0; }
.comment-header { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 3px; }
.comment-author { font-size: 12.5px; font-weight: 700; color: var(--t1); }
.comment-date { font-size: 11px; color: var(--t3); }
.comment-text { font-size: 13px; color: var(--t2); line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.comment-delete { background: none; border: none; color: var(--t3); cursor: pointer; font-size: 11px; padding: 2px 6px; }
.comment-delete:hover { color: var(--red); }

.comment-form { display: flex; gap: 8px; margin-top: 10px; }
.comment-form textarea {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--rs);
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  min-height: 38px;
  outline: none;
}
.comment-form textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-l); }

.doc-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.doc-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  background: var(--surface-2);
  border-radius: var(--rs);
  font-size: 12.5px;
  transition: background .12s;
}
.doc-row:hover { background: var(--surface-3); }
.doc-row-icon { color: var(--primary); flex-shrink: 0; }
.doc-row-name { flex: 1; min-width: 0; color: var(--t1); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-row-size { font-size: 11px; color: var(--t3); }
.doc-row-delete { background: none; border: none; color: var(--t3); cursor: pointer; padding: 2px; display:flex;align-items:center; }
.doc-row-delete:hover { color: var(--red); }

/* Empty state */
.empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--t3);
}
.empty-icon {
  width: 48px; height: 48px;
  margin: 0 auto 12px;
  background: var(--surface-2);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--t3);
}
.empty-title { font-size: 14px; font-weight: 600; color: var(--t2); margin-bottom: 4px; }
.empty-sub { font-size: 12.5px; color: var(--t3); }

/* Activity feed */
.activity-list { display: flex; flex-direction: column; gap: 10px; }
.activity-item {
  display: flex; gap: 10px;
  padding: 10px;
  border-radius: var(--rs);
  background: var(--surface-2);
}
.activity-icon {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--primary-l);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.activity-body { flex: 1; min-width: 0; }
.activity-label { font-size: 12.5px; color: var(--t1); font-weight: 500; line-height: 1.4; }
.activity-time { font-size: 11px; color: var(--t3); margin-top: 2px; }

/* Upcoming */
.upcoming-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.upcoming-item:last-child { border-bottom: none; }
.upcoming-item:hover .upcoming-title { color: var(--primary); }
.upcoming-date {
  width: 42px; height: 42px;
  border-radius: 8px;
  background: var(--surface-2);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.upcoming-date-d { font-size: 15px; font-weight: 800; color: var(--t1); line-height: 1; }
.upcoming-date-m { font-size: 9.5px; font-weight: 700; color: var(--t3); text-transform: uppercase; letter-spacing: .3px; margin-top: 2px; }
.upcoming-body { flex: 1; min-width: 0; }
.upcoming-title { font-size: 13px; font-weight: 600; color: var(--t1); margin-bottom: 2px; transition: color .12s; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upcoming-meta { font-size: 11.5px; color: var(--t3); }

/* Filters row */
.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.filter-select {
  padding: 7px 28px 7px 12px;
  border: 1px solid var(--border);
  border-radius: var(--rs);
  font-size: 12.5px;
  font-family: inherit;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") no-repeat right 10px center;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  color: var(--t2);
  font-weight: 600;
  outline: none;
}
.filter-select:hover { border-color: var(--border-m); }
.filter-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-l); }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--t1);
  color: white;
  padding: 12px 18px;
  border-radius: var(--rs);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--sh-lg);
  z-index: 2000;
  opacity: 0;
  transform: translateY(10px);
  transition: all .2s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: var(--green-d); }
.toast.error { background: var(--red-d); }

/* Priority bars (for dashboard priority breakdown) */
.priority-bars { display: flex; flex-direction: column; gap: 10px; }
.priority-bar-item { display: flex; align-items: center; gap: 10px; }
.priority-bar-label { font-size: 12px; font-weight: 600; width: 70px; color: var(--t2); }
.priority-bar-track { flex: 1; height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.priority-bar-fill { height: 100%; border-radius: 99px; transition: width .4s ease; }
.priority-bar-fill.urgent { background: var(--red); }
.priority-bar-fill.high   { background: var(--amber); }
.priority-bar-fill.medium { background: var(--primary); }
.priority-bar-fill.low    { background: var(--t3); }
.priority-bar-count { font-size: 12px; font-weight: 700; color: var(--t1); width: 24px; text-align: right; font-variant-numeric: tabular-nums; }

/* Responsive sidebar collapse */
@media (max-width: 768px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: translateX(0); box-shadow: var(--sh-xl); }
  .main { grid-column: 1; }
  .content { padding: 16px; }
  .topbar { padding: 0 16px; }
}

/* Tag chip */
.tag-chip {
  display: inline-block;
  font-size: 10.5px; font-weight: 600;
  padding: 2px 7px;
  border-radius: 99px;
  background: var(--surface-3);
  color: var(--t2);
}
