/* Source unique des couleurs : thème global be·ar (inclus dans ce module). */
@import url("theme.css");

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg-alt);
  color: var(--ink);
}

a {
  color: var(--green);
}

.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 24px;
}

/* ---------- Navigation ---------- */
.navbar {
  background: var(--page-bg);
  color: var(--on-page);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.navbar .brand {
  font-weight: 700;
  color: var(--on-page);
  text-decoration: none;
  font-size: 1.1rem;
}

.navbar nav {
  display: flex;
  gap: 20px;
  align-items: center;
}

.navbar nav a {
  color: var(--on-page-soft);
  text-decoration: none;
  font-size: 0.95rem;
}

.navbar nav a:hover,
.navbar nav a.active {
  color: var(--accent);
}

.navbar .user-badge {
  color: var(--on-page-soft);
  font-size: 0.85rem;
  border: 1px solid var(--page-border);
  border-radius: var(--radius);
  padding: 4px 10px;
  background: none;
  font-family: inherit;
  cursor: pointer;
}

.navbar .user-badge:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- Flash messages ---------- */
.flashes {
  max-width: var(--max-w);
  margin: 16px auto 0;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.flash {
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 0.9rem;
}

.flash.success {
  background: var(--green-soft);
  color: var(--green-dark);
}

.flash.error {
  background: var(--danger-soft);
  color: var(--danger);
}

/* ---------- Boutons / formulaires ---------- */
.btn {
  display: inline-block;
  border: none;
  border-radius: var(--radius);
  padding: 8px 16px;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  background: var(--green);
  color: var(--white);
}

.btn:hover {
  background: var(--green-dark);
}

.btn.btn-accent {
  background: var(--accent);
}

.btn.btn-accent:hover {
  background: var(--accent-dark);
}

.btn.btn-danger {
  background: var(--danger);
}

.btn.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--border);
}

.btn.btn-sm {
  padding: 4px 10px;
  font-size: 0.8rem;
}

input,
select,
textarea {
  font-family: inherit;
  font-size: 0.9rem;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--ink);
}

textarea {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
}

label {
  font-size: 0.8rem;
  color: var(--ink-soft);
  display: block;
  margin-bottom: 4px;
}

.field {
  margin-bottom: 12px;
}

.inline-form {
  display: flex;
  gap: 8px;
  align-items: end;
  flex-wrap: wrap;
}

.inline-form > .field {
  /* Sans ça, la marge basse de .field décale les boutons vers le bas :
     align-items:end aligne sur la boîte englobante (marge incluse). */
  margin-bottom: 0;
}

.quick-time-picks {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}

/* ---------- Ecran login ---------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--page-bg);
}

.login-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 32px;
  width: 320px;
  box-shadow: 0 20px 40px rgba(var(--ink-rgb), 0.25);
}

.login-card h1 {
  margin-top: 0;
  font-size: 1.2rem;
  color: var(--ink);
}

.login-card .btn {
  width: 100%;
  margin-top: 8px;
}

/* ---------- Accueil : clients / projets ---------- */
.search-bar {
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.search-bar input {
  width: 100%;
  max-width: 420px;
}

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

.exports-dropdown select {
  padding: 6px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-size: 0.85rem;
  background: var(--white);
  color: var(--ink);
}

.exports-dropdown .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.client-block {
  margin-bottom: 28px;
}

.client-block h2 {
  font-size: 1.05rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.client-block-toggle {
  cursor: pointer;
  user-select: none;
}

.client-block-title {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-align: left;
}

.client-toggle-icon {
  display: inline-block;
  width: 14px;
  transition: transform 0.15s ease;
}

.client-block.collapsed .client-toggle-icon {
  transform: rotate(-90deg);
}

.client-block.collapsed .project-grid {
  display: none;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 12px;
}

.project-card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  overflow: hidden;
}

.project-card:hover {
  border-color: var(--accent);
}

.project-card .statut-icon {
  display: inline-block;
}

.project-card h3 {
  margin: 0 0 4px 0;
  font-size: 1rem;
  line-height: 1.25;
  min-height: calc(1.25em * 3);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: break-word;
  word-break: break-word;
}

.project-card-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.project-card-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: auto;
}

.project-card-footer .bubble {
  justify-content: center;
  width: 100%;
}

.admin-panel {
  background: var(--white);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 24px;
}

.admin-panel h3 {
  margin-top: 0;
  font-size: 0.95rem;
  color: var(--ink-soft);
}


/* ---------- Kanban ---------- */
.kanban-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.kanban-header {
  align-items: flex-start;
}

.kanban-header h1 {
  margin: 0;
}

.project-parent-hint {
  margin: 4px 0 0 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.project-actions-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, auto));
  grid-template-areas:
    "statut fiche cloture"
    "stats registre supprimer";
  gap: 8px;
}

.project-actions-grid > div {
  display: flex;
}

.project-actions-grid form,
.project-actions-grid .statut-form select,
.project-actions-grid .btn {
  width: 100%;
}

.area-statut { grid-area: statut; }
.area-stats { grid-area: stats; }
.area-fiche { grid-area: fiche; }
.area-registre { grid-area: registre; }
.area-cloture { grid-area: cloture; }
.area-supprimer { grid-area: supprimer; }

.statut-form select {
  padding: 6px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-size: 0.9rem;
  background: var(--white);
  color: var(--ink);
}

.statut-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.badge-archived {
  display: inline-block;
  align-self: flex-start;
  vertical-align: middle;
  margin-left: 10px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--danger);
  background: var(--danger-soft);
  border-radius: 999px;
  padding: 3px 10px;
}

.project-meta-row {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.project-meta-row .inline-form {
  margin: 0;
}

.bubble {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

.bubble-client {
  background: var(--green-soft);
  color: var(--green-dark);
}

.bubble-responsable {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.bubble-fiche {
  background: var(--bg-alt);
  color: var(--ink);
  text-decoration: none;
  border: 1px solid var(--border);
}

.bubble-fiche:hover {
  filter: brightness(0.96);
}

.bubble a[href^="mailto:"] {
  color: inherit;
  text-decoration: none;
}

.project-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.project-layout .admin-panel {
  flex: 1;
  min-width: 0;
  margin-bottom: 0;
}

@media (max-width: 900px) {
  .project-layout {
    flex-direction: column;
  }
  .deadline-calendar {
    width: 100% !important;
  }
}

.kanban-board {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  /* align-items par defaut (stretch) : toutes les colonnes s'etirent a la
     hauteur de la plus grande, meme vides - la zone de depot reste aussi
     large que la colonne la plus remplie, ce qui facilite le glisser-deposer. */
}

.kanban-column {
  background: var(--bg-alt);
  border-radius: var(--radius);
  padding: 12px;
  min-height: 200px;
  height: 100%;
}

.kanban-column h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ink-soft);
  margin: 0 0 12px;
}

.kanban-column.drag-over {
  outline: 2px dashed var(--accent);
}

.task-card {
  background: var(--white);
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 12px;
  margin-bottom: 10px;
  cursor: pointer;
  width: 240px;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  position: relative;
  box-sizing: border-box;
}

.task-card:hover {
  border-color: var(--accent);
}

.task-card-priority {
  background: #ffc087;
}

.task-card .tile-urgence {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 0.9rem;
}

.task-card .title {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 6px;
  padding-right: 20px;
  overflow-wrap: break-word;
  word-break: break-word;
}

.task-card .task-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.task-card .task-footer-bottom {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 6px;
}

.task-card .task-footer-bottom .ratio {
  justify-self: start;
}

.task-card .task-footer-bottom .bubble-assignee {
  justify-self: end;
}

.task-card .task-icons {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-size: 0.68rem;
  color: var(--ink-soft);
  white-space: nowrap;
  text-align: right;
}

.task-card .ratio {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.75rem;
  background: var(--green-soft);
  color: var(--green-dark);
  border-radius: 999px;
  padding: 2px 8px;
}

.task-card .ratio.ratio-over {
  background: var(--danger-soft);
  color: var(--danger);
}

.bubble-assignee {
  background: #dbeafe;
  color: #1e40af;
  font-size: 0.75rem;
  padding: 2px 10px;
}

.task-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

/* ---------- Modale ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(var(--ink-rgb), 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  background: var(--white);
  border-radius: var(--radius);
  width: 560px;
  max-width: 92vw;
  max-height: 86vh;
  overflow-y: auto;
  padding: 24px;
  position: relative;
}

.modal-close {
  float: right;
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--ink-soft);
}

.modal-header-actions {
  position: absolute;
  top: 16px;
  right: 20px;
  display: flex;
  gap: 4px;
}

.icon-btn {
  background: none;
  border: none;
  font-size: 1.05rem;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--ink-soft);
}

.icon-btn:hover {
  background: var(--bg-alt);
}

.icon-btn-active {
  color: var(--accent-dark);
}

.icon-btn-danger:hover {
  background: #FDECEA;
  color: #C62828;
}

.notes-thread {
  border-top: 1px solid var(--border);
  margin-top: 16px;
  padding-top: 12px;
}

.note {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

.note .note-meta {
  color: var(--ink-soft);
  font-size: 0.75rem;
  margin-bottom: 2px;
}

/* ---------- Tableaux (stats / admin) ---------- */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border-radius: var(--radius);
  overflow: hidden;
}

th,
td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}

th {
  background: var(--bg-alt);
  color: var(--ink-soft);
  font-weight: 600;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-tile {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 18px;
}

.charge-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 4px;
}

.charge-vert { background: #2E7D32; }
.charge-orange { background: #E68A00; }
.charge-rouge { background: #C62828; }

/* ---------- Calendrier "Mes tâches" (Semaine/Mois, une ligne par jour) ---------- */
.calendar-month {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.calendar-day {
  background: var(--bg-alt);
  border-radius: var(--radius);
  padding: 10px;
  min-width: 0;
}

.calendar-month .calendar-day {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.calendar-day.is-today {
  outline: 2px solid var(--accent);
}

.calendar-day-header {
  margin-bottom: 8px;
  min-width: 110px;
}

.calendar-month .calendar-day-header {
  margin-bottom: 0;
  padding-top: 4px;
}

.calendar-day-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.calendar-day-charges {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
}

.charge-chip {
  font-size: 0.72rem;
  color: var(--ink-soft);
  white-space: nowrap;
}

.calendar-day-tasks {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 32px;
}

.calendar-month .calendar-day-tasks {
  flex-direction: row;
  flex-wrap: wrap;
  flex: 1;
}

.calendar-dropzone.drag-over {
  outline: 2px dashed var(--accent);
  border-radius: var(--radius);
}

.task-chip {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 0.8rem;
  cursor: grab;
}

.task-chip-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
  font-size: 0.7rem;
  color: var(--ink-soft);
}

.task-chip-empty {
  margin: 0;
  font-size: 0.75rem;
}

.daily-section-title {
  font-size: 1rem;
  color: var(--ink);
  margin: 18px 0 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.daily-section-title:first-of-type {
  margin-top: 0;
}

.stat-tile .value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--green);
}

.stat-tile .label {
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.75rem;
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.bubble-client-tag {
  display: inline-block;
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 0.72rem;
  font-weight: 600;
  background: #E3F2FD;
  color: #1565C0;
  margin-right: 5px;
  white-space: nowrap;
}

/* ---------- Statut du jour (page Tâches du jour) ---------- */
.badge-statut-jour-ras {
  background: #E3F2FD;
  color: #1565C0;
}

.badge-statut-jour-en-cours {
  background: #FFF8E1;
  color: #B8860B;
}

.badge-statut-jour-fait {
  background: #E8F5E9;
  color: #2E7D32;
}

.badge-statut-jour-retard {
  background: #FDECEA;
  color: #C62828;
}

.badge-statut-jour-ras.active,
.badge-statut-jour-en-cours.active,
.badge-statut-jour-fait.active,
.badge-statut-jour-retard.active {
  outline: 2px solid currentColor;
  font-weight: 600;
}

/* ---------- Grille de droits / liste utilisateurs ---------- */
.user-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.user-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 16px;
}

.user-row-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.user-row-meta {
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.user-row-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* ---------- Onglets (admin) ---------- */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.timesheet-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.timesheet-week-label {
  font-weight: 600;
  font-size: 0.95rem;
}

.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 16px;
  font-size: 0.92rem;
  cursor: pointer;
  color: var(--ink-soft);
  text-decoration: none;
  display: inline-block;
}

.tab-btn.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.perm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-top: 8px;
}

.perm-group h4 {
  margin: 0 0 6px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ink-soft);
}

.perm-group label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--ink);
  margin-bottom: 4px;
}

.perm-group input[type="checkbox"] {
  width: auto;
  padding: 0;
}

/* ---------- Calendrier des echeances (vue projet) ---------- */

.deadline-calendar {
  width: 300px;
  flex-shrink: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  position: sticky;
  top: 14px;
}

.cal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.cal-label {
  font-weight: 600;
  font-size: 0.9rem;
  text-transform: capitalize;
}

.cal-view-toggle {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.cal-view-btn {
  flex: 1;
  border: 1px solid var(--border);
  background: var(--bg-alt);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.78rem;
  cursor: pointer;
  color: var(--ink-soft);
}

.cal-view-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 4px;
}

.cal-weekdays span {
  text-align: center;
  font-size: 0.7rem;
  color: var(--ink-soft);
  text-transform: uppercase;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 0.8rem;
  cursor: default;
  color: var(--ink-soft);
  position: relative;
}

.cal-day.cal-current-month {
  color: var(--ink);
}

.cal-day.cal-today {
  outline: 2px solid var(--accent);
}

.cal-day.cal-has-echeance {
  cursor: pointer;
  background: var(--bg-alt);
  font-weight: 600;
}

.cal-day.cal-has-echeance:hover {
  background: var(--accent-soft, var(--bg-alt));
}

.cal-day.cal-selected {
  background: var(--accent);
  color: #fff;
}

.cal-day-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 2px;
}

.cal-day.cal-selected .cal-day-dot {
  background: #fff;
}

.cal-day-tasks {
  margin-top: 12px;
}

.cal-day-tasks-empty {
  font-size: 0.8rem;
  color: var(--ink-soft);
}

.cal-day-task-link {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 0.82rem;
  margin-bottom: 6px;
  cursor: pointer;
  color: var(--ink);
}

.cal-day-task-link:hover {
  border-color: var(--accent);
}

/* ---------- Commentaires (page Statistiques) ---------- */

.comment-list {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
}

.comment-item {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-bottom: 10px;
}

.comment-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--ink-soft);
  margin-bottom: 4px;
}

.comment-item p {
  margin: 0;
  white-space: pre-wrap;
}
