/* ============================================================
   Task Manager — app.css
   Design: clean industrial grid, blue-slate palette
   ============================================================ */

:root {
  --blue:       #1D4ED8;
  --blue-light: #3B82F6;
  --blue-pale:  #EFF6FF;
  --slate-50:   #F8FAFC;
  --slate-100:  #F1F5F9;
  --slate-200:  #E2E8F0;
  --slate-400:  #94A3B8;
  --slate-600:  #475569;
  --slate-800:  #1E293B;
  --red:        #DC2626;
  --red-pale:   #FEF2F2;
  --amber:      #D97706;
  --amber-pale: #FFFBEB;
  --green:      #16A34A;
  --green-pale: #F0FDF4;
  --purple:     #7C3AED;

  --radius:   6px;
  --shadow-s: 0 1px 3px rgba(0,0,0,.10);
  --shadow-m: 0 4px 12px rgba(0,0,0,.12);
  --font:     'Inter', system-ui, sans-serif;
  --mono:     'JetBrains Mono', 'Fira Mono', monospace;
}

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

html { font-size: 14px; }
body { font-family: var(--font); color: var(--slate-800); background: var(--slate-50); }

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Navbar ─────────────────────────────────────────────── */
.navbar {
  display: flex; align-items: center; gap: 24px;
  background: var(--slate-800);
  padding: 0 24px; height: 52px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow-s);
}
.nav-brand {
  display: flex; align-items: center; gap: 8px;
  color: #fff; font-weight: 700; font-size: 1rem;
  text-decoration: none; white-space: nowrap;
}
.nav-links { display: flex; gap: 4px; flex: 1; }
.nav-links a {
  color: #CBD5E1; padding: 6px 12px; border-radius: var(--radius);
  font-size: .875rem; font-weight: 500; transition: color .15s, background .15s;
}
.nav-links a:hover, .nav-links a.active {
  color: #fff; background: rgba(255,255,255,.14); text-decoration: none;
}
.nav-link-badge { position: relative; display: inline-flex; align-items: center; }
.nav-badge {
  position: absolute; top: -2px; right: 2px;
  background: var(--red); color: #fff;
  font-size: .65rem; font-weight: 700; line-height: 1;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 99px; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 2px var(--slate-800);
}
.nav-user {
  display: flex; align-items: center; gap: 10px;
  color: #CBD5E1; font-size: .8rem; white-space: nowrap;
}
.nav-user > span:first-child { color: #fff; font-weight: 600; }

/* Role badge specifically on the dark navbar — distinct from the light-mode
   .role-badge used elsewhere (e.g. the Users table), which stays unchanged. */
.nav-user .role-badge {
  background: rgba(255,255,255,.16); color: #fff;
  border: 1px solid rgba(255,255,255,.25);
}

/* Ghost buttons on the dark navbar (Profile, Sign out) — the default
   .btn-ghost is tuned for light backgrounds and was unreadable here. */
.nav-user .btn-ghost {
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.3);
  color: #fff;
}
.nav-user .btn-ghost:hover {
  background: rgba(255,255,255,.18); border-color: rgba(255,255,255,.5);
}

/* Hamburger toggle — hidden on desktop, the links/user block render inline */
.nav-burger {
  display: none; flex-direction: column; justify-content: center; gap: 4px;
  width: 32px; height: 32px; background: none; border: none; cursor: pointer;
  padding: 0; flex-shrink: 0;
}
.nav-burger span { display: block; width: 100%; height: 2px; background: #fff; border-radius: 1px; }
.nav-collapsible { display: flex; align-items: center; gap: 24px; flex: 1; min-width: 0; }

/* Persistent "My tasks" button — desktop: hidden (it's already in nav-links).
   Mobile: shown, centered between the logo and the hamburger. */
.nav-mytasks-persistent { display: none; }

/* ══════════════════════════════════════════════════════════
   MOBILE — collapse nav-links + nav-user behind a hamburger,
   stacked as a dropdown panel under the bar when opened.
   "My tasks" stays directly accessible, centered in the bar.
   ══════════════════════════════════════════════════════════ */
@media (max-width: 860px) {
  .navbar { flex-wrap: nowrap; padding: 0 14px; height: auto; min-height: 52px; }
  .nav-burger { display: flex; order: 3; flex-shrink: 0; }

  /* The full "TASKMAKER.CA" wordmark has no room next to the My tasks
     button and hamburger on a narrow screen — keep just the logo icon. */
  .nav-brand { flex-shrink: 0; }
  .nav-brand > :not(img) { display: none; }

  .nav-mytasks-persistent {
    display: inline-flex; align-items: center; justify-content: center;
    order: 2; margin: 0 auto; flex: 0 1 auto; min-width: 0; max-width: 100%;
    position: static; padding: 6px 14px;
    background: var(--green); border-radius: var(--radius);
    color: #fff; font-weight: 600; white-space: nowrap; line-height: 1;
    overflow: hidden; text-overflow: ellipsis;
  }
  .nav-mytasks-persistent.active { background: #15803D; color: #fff; }
  .nav-mytasks-persistent .nav-badge { position: static; margin-left: 6px; box-shadow: none; flex-shrink: 0; }

  /* The duplicate "My tasks" entry inside the dropdown is redundant once
     the persistent button is showing — hide it there to avoid two links
     to the same page in two different places. */
  .nav-mytasks-inline { display: none; }

  .nav-collapsible {
    display: none;
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--slate-800);
    order: 4;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 0 14px 10px;
    box-shadow: var(--shadow-m);
    z-index: 99;
  }
  .navbar.nav-open .nav-collapsible { display: flex; }

  .nav-links {
    flex-direction: column; align-items: stretch; gap: 2px;
    padding-top: 8px; border-top: 1px solid rgba(255,255,255,.12); margin-top: 4px;
  }
  .nav-links a { padding: 10px 8px; }
  .nav-links .nav-link-badge { width: 100%; box-sizing: border-box; justify-content: space-between; display: flex; }
  .nav-badge { position: static; margin-left: auto; box-shadow: none; }

  .nav-user {
    flex-wrap: wrap; gap: 8px;
    padding-top: 10px; border-top: 1px solid rgba(255,255,255,.12); margin-top: 6px;
  }
  .nav-user > span:first-child { width: 100%; }
}

/* ── Page layout ─────────────────────────────────────────── */
.page-main { max-width: 1200px; margin: 0 auto; padding: 28px 20px; }
.page-header {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 16px;
  margin-bottom: 24px; flex-wrap: wrap;
}
.page-header h1 {
  font-size: 1.5rem; font-weight: 700; color: var(--slate-800);
  display: flex; align-items: center; gap: 10px;
}
.back-link { font-size: .8rem; color: var(--slate-400); display: block; margin-bottom: 4px; }
.project-dot { width: 14px; height: 14px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn-primary {
  background: var(--blue); color: #fff;
  border: none; border-radius: var(--radius);
  padding: 8px 16px; cursor: pointer; font-size: .875rem; font-weight: 600;
  transition: background .15s;
}
.btn-primary:hover { background: var(--blue-light); }
.btn-primary.full  { width: 100%; padding: 10px; font-size: 1rem; }

/* Generic loading state for any button via attachLoadingState()/startButtonLoading() */
button.btn-loading { cursor: default; opacity: .85; position: relative; }
button.btn-loading .btn-label { opacity: .55; }
.btn-spinner {
  display: inline-block; width: 14px; height: 14px; margin-left: 8px;
  border: 2px solid rgba(255,255,255,.4); border-top-color: #fff;
  border-radius: 50%; vertical-align: middle;
  animation: btn-spin .65s linear infinite;
}
/* On light/ghost buttons the spinner needs a dark color instead of white */
.btn-ghost .btn-spinner, .btn-danger.btn-loading .btn-spinner {
  border-color: rgba(0,0,0,.15); border-top-color: var(--slate-600);
}
@keyframes btn-spin { to { transform: rotate(360deg); } }
.btn-ghost {
  background: transparent; border: 1px solid var(--slate-200);
  border-radius: var(--radius); padding: 6px 14px;
  cursor: pointer; font-size: .875rem; color: var(--slate-600);
  transition: border-color .15s, background .15s;
}
.btn-ghost:hover { background: var(--slate-100); border-color: var(--slate-400); }
.btn-ghost.sm  { padding: 4px 10px; font-size: .78rem; }
.btn-icon {
  background: none; border: none; cursor: pointer; font-size: 1rem;
  color: var(--slate-400); padding: 4px 8px; line-height: 1;
}
.btn-icon:hover { color: var(--slate-800); }

/* Dedicated close button — red square with an X, used for the task detail panel */
.btn-close-square {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; flex-shrink: 0;
  background: var(--red); color: #fff; border: none; border-radius: 6px;
  font-size: .95rem; font-weight: 700; line-height: 1; cursor: pointer;
  transition: background .15s;
}
.btn-close-square:hover { background: #B91C1C; }
.btn-danger {
  background: var(--red); color: #fff; border: none;
  border-radius: var(--radius); padding: 5px 12px;
  cursor: pointer; font-size: .8rem;
}

/* ── Project grid ───────────────────────────────────────── */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.project-card {
  display: flex; border-radius: var(--radius); overflow: hidden;
  background: #fff; box-shadow: var(--shadow-s);
  border: 1px solid var(--slate-200); text-decoration: none; color: inherit;
  transition: box-shadow .15s, transform .1s;
}
.project-card:hover { box-shadow: var(--shadow-m); transform: translateY(-1px); }
.project-card-accent { width: 5px; flex-shrink: 0; }
.project-card-body { padding: 14px 16px; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.project-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.project-name { font-weight: 600; font-size: .95rem; }
.project-desc { font-size: .8rem; color: var(--slate-600); line-height: 1.4; }
.project-meta { display: flex; justify-content: space-between; font-size: .75rem; color: var(--slate-400); margin-top: 4px; }
.owner { font-style: italic; }
.progress-bar-wrap { background: var(--slate-100); border-radius: 99px; height: 4px; margin-top: 4px; width: 100%; overflow: hidden; }
.progress-bar-fill { background: var(--green); border-radius: 99px; height: 4px; transition: width .3s; display: block; }

/* ── Status / priority pills ───────────────────────────── */
.status-pill {
  font-size: .7rem; font-weight: 600; padding: 2px 8px;
  border-radius: 99px; white-space: nowrap; text-transform: capitalize;
}
.status-active     { background: var(--green-pale); color: var(--green); }
.status-on_hold    { background: var(--amber-pale); color: var(--amber); }
.status-completed  { background: var(--blue-pale);  color: var(--blue); }
.status-archived   { background: var(--slate-100);  color: var(--slate-400); }
.status-a_etude    { background: var(--slate-100);  color: var(--slate-600); }
.status-soumis     { background: var(--amber-pale); color: var(--amber); }
.status-approuve   { background: #F3E8FF;           color: var(--purple); }
.status-en_cours    { background: var(--blue-pale);  color: var(--blue); }
.status-complete   { background: var(--green-pale); color: var(--green); }
.status-archive    { background: var(--slate-100);  color: var(--slate-400); }
.status-todo       { background: var(--slate-100);  color: var(--slate-600); }
.status-in_progress{ background: var(--blue-pale);  color: var(--blue); }
.status-review     { background: var(--amber-pale); color: var(--amber); }
.status-done       { background: var(--green-pale); color: var(--green); }
.status-cancelled  { background: var(--red-pale);   color: var(--red);  }

.priority-pill {
  font-size: .7rem; font-weight: 700; padding: 2px 8px;
  border-radius: 99px; text-transform: uppercase;
}
.priority-critical { background: #FEE2E2; color: #B91C1C; }
.priority-high     { background: var(--red-pale);   color: var(--red); }
.priority-medium   { background: var(--amber-pale); color: var(--amber); }
.priority-low      { background: var(--green-pale); color: var(--green); }

.badge-overdue {
  display: inline-block; background: var(--red); color: #fff;
  font-size: .72rem; font-weight: 700; border-radius: 99px; padding: 2px 10px;
}

.role-badge {
  display: inline-block; background: var(--slate-100); color: var(--slate-600);
  font-size: .7rem; font-weight: 600; border-radius: 4px; padding: 1px 7px;
  text-transform: capitalize;
}

/* ── Filter bar ─────────────────────────────────────────── */
.filter-bar {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 14px;
}
.filter-bar select, .filter-bar input {
  border: 1px solid var(--slate-200); border-radius: var(--radius);
  padding: 6px 10px; font-size: .85rem; background: #fff; color: var(--slate-800);
  outline: none;
}
.filter-bar select:focus, .filter-bar input:focus { border-color: var(--blue-light); }
.filter-bar input { min-width: 200px; }

/* ── Task grid ──────────────────────────────────────────── */
.grid-wrap { overflow-x: auto; border-radius: var(--radius); box-shadow: var(--shadow-s); }
.task-grid {
  width: 100%; border-collapse: collapse;
  background: #fff; font-size: .85rem;
}
.task-grid thead tr { background: var(--slate-800); color: #fff; }
.task-grid th {
  padding: 10px 12px; text-align: left; font-weight: 600;
  font-size: .78rem; text-transform: uppercase; letter-spacing: .04em;
  white-space: nowrap; user-select: none;
}
.task-grid th[data-sort] { cursor: pointer; }
.task-grid th[data-sort]:hover { background: var(--slate-600); }
.task-grid td { padding: 0; border-bottom: 1px solid var(--slate-100); vertical-align: middle; }
.task-grid tr:last-child td { border-bottom: none; }
.task-grid tr:hover td { background: var(--slate-50); }
.task-grid tr.overdue td { background: #fff7f7; }
.task-grid tr.done-row td { opacity: .55; }

/* Inline cell editors */
.cell-inner {
  display: flex; align-items: center; padding: 8px 12px;
  min-height: 38px; gap: 6px; cursor: pointer;
}
.cell-inner:hover { background: var(--blue-pale); border-radius: 3px; }
.task-title-text:hover { text-decoration: underline; color: var(--blue); }
.cell-inner.editing { padding: 4px 8px; }
.cell-inner select, .cell-inner input[type=text], .cell-inner input[type=date] {
  border: 1px solid var(--blue-light); border-radius: 4px;
  padding: 4px 8px; font-size: .85rem; background: #fff;
  outline: none; width: 100%;
}
.col-drag   { width: 28px; }
.col-title  { min-width: 260px; }
.col-status { width: 130px; }
.col-priority { width: 110px; }
.col-assign { width: 140px; }
.col-due    { width: 120px; }
.col-planned { width: 120px; }
.col-hours  { width: 80px; text-align: right; }
.col-actions { width: 80px; }
.drag-handle { color: var(--slate-400); cursor: grab; padding: 8px 4px; font-size: 1rem; }

.overdue-icon { color: var(--red); font-size: .8rem; }

/* ── New item indicators (since last login) ─────────────── */
.new-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--blue); flex-shrink: 0;
  box-shadow: 0 0 0 2px var(--blue-pale);
}
.new-badge {
  background: var(--blue); color: #fff;
  font-size: .62rem; font-weight: 700; letter-spacing: .03em;
  border-radius: 4px; padding: 1px 6px; flex-shrink: 0;
  text-transform: uppercase;
}
.task-grid tr.is-new-row td { background: var(--blue-pale); }
.task-grid tr.is-new-row:hover td { background: #DBEAFE; }
.project-card-wrap.is-new .project-card { box-shadow: 0 0 0 2px var(--blue-light), var(--shadow-s); }
.project-list-row.is-new { background: var(--blue-pale); }
.project-list-row.is-new:hover { background: #DBEAFE; }
.comment-badge {
  background: var(--slate-100); color: var(--slate-600);
  font-size: .7rem; border-radius: 99px; padding: 1px 6px;
  cursor: pointer;
}
.comment-badge:hover { background: var(--blue-pale); color: var(--blue); }
.subtask-badge {
  background: var(--green-pale); color: var(--green);
  font-size: .7rem; font-weight: 600; border-radius: 99px; padding: 1px 7px;
  cursor: pointer;
}
.subtask-badge:hover { background: #DCFCE7; }
.loading-row { text-align: center; padding: 24px; color: var(--slate-400); }

/* ── Side panel ─────────────────────────────────────────── */
.panel-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 200;
}
.side-panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(480px, 100vw);
  background: #fff; box-shadow: -4px 0 20px rgba(0,0,0,.15);
  z-index: 201; display: flex; flex-direction: column; overflow: hidden;
}
.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--slate-200);
  background: var(--slate-50);
}
.panel-header h2 { font-size: 1rem; font-weight: 700; }
.panel-body { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 16px; }

.task-detail-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.detail-field label { font-size: .72rem; font-weight: 600; color: var(--slate-400); text-transform: uppercase; display: block; margin-bottom: 3px; }
.detail-field select, .detail-field input {
  width: 100%; height: 34px; box-sizing: border-box;
  border: 1px solid var(--slate-200); border-radius: var(--radius);
  padding: 0 8px; font-size: .85rem; font-family: inherit;
  -webkit-appearance: none; appearance: none;
}
.detail-field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%2394a3b8' d='M4 6l4 4 4-4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 8px center;
  padding-right: 28px;
}
.detail-field input[type="date"] {
  line-height: 34px; padding-top: 0; padding-bottom: 0;
}
.detail-field input[type="date"]::-webkit-datetime-edit { line-height: 34px; padding: 0; }
.detail-field input[type="date"]::-webkit-inner-spin-button { display: none; }
.detail-field input[type="date"]::-webkit-calendar-picker-indicator { margin-left: 4px; }

.comment-list { display: flex; flex-direction: column; gap: 10px; }
.comment-item {
  background: var(--slate-50); border-radius: var(--radius);
  padding: 10px 12px; border: 1px solid var(--slate-100);
}
.comment-meta { font-size: .72rem; color: var(--slate-400); margin-bottom: 4px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.comment-body { font-size: .85rem; line-height: 1.5; white-space: pre-wrap; }
.comment-actions { display: flex; gap: 6px; margin-left: auto; }
.comment-actions .btn-icon { opacity: .5; transition: opacity .12s; }
.comment-actions .btn-icon:hover { opacity: 1; }
.comment-edit-textarea {
  width: 100%; box-sizing: border-box; border: 1px solid var(--blue-light);
  border-radius: var(--radius); padding: 6px 8px; font-size: .85rem;
  font-family: inherit; line-height: 1.5; resize: vertical; min-height: 60px;
}
.comment-form { display: flex; flex-direction: column; gap: 8px; }
.comment-form textarea {
  width: 100%; border: 1px solid var(--slate-200); border-radius: var(--radius);
  padding: 8px 10px; font-size: .85rem; resize: vertical; min-height: 72px;
}
.comment-form textarea:focus { outline: none; border-color: var(--blue-light); }

/* ── Subtask checklist ──────────────────────────────────── */
.subtask-progress-wrap { margin-bottom: 8px; }
.subtask-progress-bar { background: var(--slate-100); border-radius: 99px; height: 5px; overflow: hidden; }
.subtask-progress-fill { background: var(--green); height: 100%; border-radius: 99px; transition: width .25s; }

.subtask-list { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.subtask-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 4px; border-radius: 5px; transition: background .12s;
}
.subtask-item:hover { background: var(--slate-50); }
.subtask-item input[type="checkbox"] {
  width: 16px; height: 16px; flex-shrink: 0; cursor: pointer; accent-color: var(--blue);
}
.subtask-title {
  flex: 1; font-size: .85rem; color: var(--slate-800); cursor: pointer;
  word-break: break-word;
}
.subtask-title.is-done { text-decoration: line-through; color: var(--slate-400); }
.subtask-delete {
  opacity: 0; transition: opacity .12s; font-size: .8rem; flex-shrink: 0;
}
.subtask-item:hover .subtask-delete { opacity: 1; }
.subtask-edit-input {
  flex: 1; border: 1px solid var(--blue-light); border-radius: 4px;
  padding: 3px 6px; font-size: .85rem; font-family: inherit;
}

.subtask-add-row { display: flex; gap: 6px; margin-top: 4px; }
.subtask-add-row input[type="text"] {
  flex: 1; border: 1px solid var(--slate-200); border-radius: var(--radius);
  padding: 6px 10px; font-size: .85rem; outline: none;
}
.subtask-add-row input[type="text"]:focus { border-color: var(--blue-light); }

/* ── Time entries (heures travaillées) ───────────────────── */
.time-entry-list { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.time-entry-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 4px; border-radius: 5px; transition: background .12s;
  font-size: .82rem;
}
.time-entry-row:hover { background: var(--slate-50); }
.time-entry-date { color: var(--slate-400); font-size: .78rem; min-width: 78px; cursor: pointer; }
.time-entry-hours {
  font-weight: 700; color: var(--blue); background: var(--blue-pale);
  border-radius: 4px; padding: 1px 8px; font-size: .78rem; min-width: 42px; text-align: center;
  cursor: pointer;
}
.time-entry-note { flex: 1; color: var(--slate-600); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.time-entry-author {
  font-size: .72rem; color: var(--slate-400); flex-shrink: 0;
  max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.time-entry-edit-input {
  border: 1px solid var(--blue-light); border-radius: 4px; padding: 1px 4px;
  font-size: .78rem; font-family: inherit; width: 100%; box-sizing: border-box;
}
.time-entry-delete { opacity: 0; transition: opacity .12s; font-size: .8rem; flex-shrink: 0; }
.time-entry-row:hover .time-entry-delete { opacity: 1; }
.time-entry-delete-spacer { width: 18px; flex-shrink: 0; }

.time-entry-add-row { display: flex; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.time-entry-add-row input[type="date"] {
  border: 1px solid var(--slate-200); border-radius: var(--radius);
  padding: 6px 8px; font-size: .82rem; outline: none; width: 130px;
}
.time-entry-add-row input[type="number"] {
  border: 1px solid var(--slate-200); border-radius: var(--radius);
  padding: 6px 8px; font-size: .82rem; outline: none; width: 64px;
}
.time-entry-add-row input[type="text"] {
  flex: 1; min-width: 100px; border: 1px solid var(--slate-200); border-radius: var(--radius);
  padding: 6px 10px; font-size: .82rem; outline: none;
}
.time-entry-add-row input:focus { border-color: var(--blue-light); }

/* ── Modals ─────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center; z-index: 300;
}
.modal-box {
  background: #fff; border-radius: var(--radius); padding: 28px;
  width: min(460px, 95vw); box-shadow: var(--shadow-m);
  display: flex; flex-direction: column; gap: 16px;
}
.modal-box h2 { font-size: 1.1rem; font-weight: 700; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.avail-msg { font-size: .76rem; margin-top: -10px; min-height: 14px; }
.avail-msg.ok    { color: var(--green); }
.avail-msg.taken { color: var(--red); font-weight: 600; }

/* ── Forms ──────────────────────────────────────────────── */
label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; font-weight: 500; color: var(--slate-600); }
.pw-rule { color: var(--slate-400); transition: color .15s; }
.pw-rule.met { color: var(--green); }
label input, label select, label textarea {
  border: 1px solid var(--slate-200); border-radius: var(--radius);
  padding: 8px 10px; font-size: .9rem; color: var(--slate-800);
  background: #fff; outline: none; font-family: inherit;
}
label input:focus, label select:focus, label textarea:focus { border-color: var(--blue-light); }

/* Color picker swatches must show the actual selected color — the generic
   white background above was overriding it, making the swatch always look
   blank/white regardless of what was picked. */
label input[type="color"] {
  background: none; padding: 3px; height: 38px; cursor: pointer;
}

/* ── Auth ───────────────────────────────────────────────── */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--slate-100); }
.auth-card { background: #fff; border-radius: 10px; padding: 36px; width: min(380px,95vw); box-shadow: var(--shadow-m); display: flex; flex-direction: column; gap: 18px; }
.auth-logo { display: flex; align-items: center; gap: 10px; font-size: 1.1rem; font-weight: 700; color: var(--slate-800); }
.auth-card h1 { font-size: 1.3rem; font-weight: 700; }
.auth-card form { display: flex; flex-direction: column; gap: 14px; }

/* ── Alerts ─────────────────────────────────────────────── */
.alert-error   { background: var(--red-pale);   color: var(--red);   border: 1px solid #FCA5A5; border-radius: var(--radius); padding: 10px 14px; font-size: .85rem; }
.alert-success { background: var(--green-pale); color: var(--green); border: 1px solid #86EFAC; border-radius: var(--radius); padding: 10px 14px; font-size: .85rem; }

/* ── Empty state ─────────────────────────────────────────── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--slate-400); font-size: .95rem; }

/* ── New task inline row ─────────────────────────────────── */
.new-task-row td { background: var(--blue-pale); }
.new-task-row input, .new-task-row select {
  border: 1px solid var(--blue-light); border-radius: 4px;
  padding: 5px 8px; font-size: .85rem; background: #fff; width: 100%;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 700px) {
  .col-assign, .col-due { display: none; }
  .side-panel { width: 100vw; }
}