/* ================================================================== *
 *  Charitywall CRM — styles complementaires (modules, formulaires,
 *  tableaux, fiches, login...). Reutilise les variables de style.css.
 * ================================================================== */

/* ----- Drag-and-drop tri ----- */
.drag-handle { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; color: var(--muted); cursor: grab; border-radius: 6px; transition: color .15s, background .15s; }
.drag-handle:hover { color: var(--purple); background: var(--bg); }
.drag-handle:active { cursor: grabbing; }
td.sort-handle-col { width: 36px; padding-left: 8px; }
th.sort-handle-col { width: 36px; }
tr.is-dragging { opacity: .35; }
tr.drag-over { outline: 2px solid var(--purple); outline-offset: -2px; border-radius: 4px; }

/* ----- Utilitaires generiques ----- */
a { color: var(--purple); text-decoration: none; transition: color .15s; }
a:hover { color: var(--pink); }
.text-muted { color: var(--muted); }
.text-right { text-align: right; }
.flex { display: flex; align-items: center; gap: 12px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.gap-sm { gap: 8px; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.w-100 { width: 100%; }
.nowrap { white-space: nowrap; }

/* ----- Boutons supplementaires ----- */
.button--sm { min-height: 38px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.button--ghost { background: transparent; box-shadow: none; }
.button--danger { border: 0; color: #fff; background: linear-gradient(135deg, #ff5470, #e8225a); box-shadow: 0 10px 22px rgba(255,59,95,.22); }
.button--success { border: 0; color: #fff; background: linear-gradient(135deg, #2bbd7a, #18985b); box-shadow: 0 10px 22px rgba(33,173,105,.2); }
.button[disabled] { opacity: .55; cursor: not-allowed; }

.icon-button--sm { width: 38px; height: 38px; border-radius: 10px; }
.actions-inline { display: inline-flex; gap: 8px; }
.actions-inline .icon-button { color: var(--muted); }
.actions-inline .icon-button:hover { color: var(--pink); border-color: #ffd5e8; }
.actions-inline .icon-button.is-danger:hover { color: var(--red); border-color: #ffd2d9; }

/* ----- Badges complementaires ----- */
.badge--muted { color: var(--muted); background: #f1f2f7; }
.badge--soft { background: #f1f2f7; color: #4a5474; }
.badge--prio-basse { color: #5a6685; background: #eef0f6; }
.badge--prio-normale { color: var(--blue); background: #eaf1ff; }
.badge--prio-haute { color: var(--orange); background: #fff0e8; }
.badge--prio-urgente { color: #fff; background: var(--red); }
.badge-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }

/* ----- Page header (titre + actions) ----- */
.page-head .page-head__actions { display: flex; gap: 12px; flex-wrap: wrap; }
.back-link { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 8px; color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 650; }
.back-link [data-icon] { font-size: 11px; }
.back-link:hover { color: var(--pink); }

/* ----- Hub Parametres (tuiles) ----- */
.settings-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; margin-top: 18px; align-items: start; }
.settings-tile { display: flex; align-items: center; gap: 16px; padding: 20px 22px; text-decoration: none; color: var(--text); transition: border-color .15s, transform .15s, box-shadow .15s; }
.settings-tile:hover { border-color: var(--pink); transform: translateY(-1px); }
.settings-tile__icon { flex: 0 0 auto; width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-size: 18px; color: var(--purple); background: var(--pink-2); }
.settings-tile__body { display: flex; flex-direction: column; gap: 3px; flex: 1 1 auto; }
.settings-tile__title { font-weight: 750; font-size: 15px; }
.settings-tile__desc { color: var(--muted); font-size: 13px; font-weight: 600; }
.settings-tile__chevron { color: var(--muted); font-size: 13px; }
@media (max-width: 720px) { .settings-grid { grid-template-columns: 1fr; } }
.breadcrumb { display: flex; align-items: center; gap: 8px; margin: 18px 0 0; color: var(--muted); font-size: 13px; font-weight: 600; }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--pink); }
.breadcrumb span.sep { opacity: .5; }

/* ----- Dropdown ----- */
.dropdown { position: relative; }
.dropdown__menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 200px;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  display: none;
  z-index: 40;
}
.dropdown__menu--right { left: auto; right: 0; }
.dropdown.is-open .dropdown__menu { display: block; }
.dropdown__menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 650;
  font-size: 14px;
}
.dropdown__menu a:hover { background: var(--bg); }
.dropdown__menu a [data-icon] { width: 18px; color: var(--muted); }
.dropdown__menu .dropdown__danger { color: var(--red); }
.dropdown__menu .dropdown__danger [data-icon] { color: var(--red); }

/* ----- Messages flash ----- */
.flash-stack { display: grid; gap: 10px; margin: 20px 0 4px; }
.flash {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow-soft);
  font-weight: 650;
  transition: opacity .4s ease;
}
.flash p { margin: 0; flex: 1; }
.flash [data-icon] { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; }
.flash--success { border-color: #bdebd3; }
.flash--success [data-icon] { color: var(--green); background: #eaf8f1; }
.flash--error { border-color: #ffd2d9; }
.flash--error [data-icon] { color: var(--red); background: #ffeef1; }
.flash--info [data-icon] { color: var(--purple); background: #f2eaff; }
.flash__close { border: 0; background: transparent; font-size: 22px; line-height: 1; color: var(--muted); }
.flash.is-hiding { opacity: 0; }

/* ----- Barre d'outils / filtres ----- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.toolbar form { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; width: 100%; }
.toolbar .field { margin: 0; }
.toolbar .search-field {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
  flex: 1 1 240px;
  min-width: 200px;
}
.toolbar .search-field [data-icon] { color: var(--muted); }
.toolbar .search-field input { border: 0; outline: 0; background: transparent; width: 100%; }
.toolbar select {
  height: 44px;
  padding: 0 36px 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23697293'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") no-repeat right 10px center;
  appearance: none;
  font-weight: 650;
  color: var(--text);
  box-shadow: var(--shadow-soft);
}
.toolbar .toolbar__spacer { margin-left: auto; }

/* ----- Tableaux (liste) ----- */
.data-card { padding-bottom: 6px; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 13px 18px; text-align: left; border-bottom: 1px solid var(--line); }
.data-table th { color: #697293; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.data-table td { font-size: 13.5px; font-weight: 600; vertical-align: middle; }
.data-table tbody tr:hover { background: #fafbff; }
.data-table tbody tr[data-href] { cursor: pointer; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table .cell-strong { font-weight: 750; color: var(--text); }
.data-table .cell-sub { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; font-weight: 550; }
.data-table a.cell-link { color: var(--text); text-decoration: none; }
.data-table a.cell-link:hover { color: var(--pink); }
/* Tronque les longs noms (ex. organismes) avec « … » ; nom complet visible au survol via title. */
.cell-clamp { display: inline-block; max-width: 40ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.table-avatar {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px; border-radius: 11px;
  background: linear-gradient(135deg, var(--pink), var(--purple));
  color: #fff; font-size: 12px; font-weight: 800; flex: 0 0 auto;
}
.cell-org { display: flex; align-items: center; gap: 12px; }

/* ----- Etat vide ----- */
.empty-state { padding: 54px 20px; text-align: center; color: var(--muted); }
.empty-state > [data-icon] { width: 56px; height: 56px; margin: 0 auto 14px; display: grid; place-items: center; border-radius: 16px; background: var(--bg); color: var(--purple); }
.empty-state > [data-icon] i { font-size: 22px; }
.empty-state h3 { margin: 0 0 6px; color: var(--text); font-size: 17px; }
.empty-state p { margin: 0 0 16px; }

/* ----- Pagination ----- */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; flex-wrap: wrap; }
.pagination__info { color: var(--muted); font-size: 13px; font-weight: 600; }
.pagination__pages { display: flex; gap: 6px; flex-wrap: wrap; }
.pagination__pages a, .pagination__pages span {
  display: grid; place-items: center;
  min-width: 38px; height: 38px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 10px;
  color: var(--text); text-decoration: none; font-weight: 700; font-size: 13px;
  background: #fff;
}
.pagination__pages a:hover { border-color: #ffd5e8; color: var(--pink); }
.pagination__pages .is-active { background: var(--pink); border-color: var(--pink); color: #fff; }
.pagination__pages .is-disabled { opacity: .4; pointer-events: none; }

/* ----- Formulaires ----- */
.form-card { padding: 6px 24px 24px; }
.search-filters { padding: 20px 24px 24px; }
.search-filters .field--full { margin-bottom: 16px; }
.form-section { padding: 22px 0; border-bottom: 1px solid var(--line); }
.form-section:last-child { border-bottom: 0; }
.form-section__title { display: flex; align-items: center; gap: 10px; margin: 0 0 4px; font-size: 15px; }
.form-section__title [data-icon] { color: var(--pink); }
.form-section__hint { margin: 0 0 16px; color: var(--muted); font-size: 13px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px 20px; }
.form-grid--3 { grid-template-columns: repeat(3, 1fr); }
.field { display: flex; flex-direction: column; gap: 7px; }
.field--full { grid-column: 1 / -1; }
.field label { font-size: 13px; font-weight: 700; color: #3d4664; }
.field label .req { color: var(--pink); }
.field .hint { color: var(--muted); font-size: 12px; font-weight: 500; }
.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 46px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  outline: 0;
  transition: border-color .15s, box-shadow .15s;
}
.field textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.field input:focus,
.field select:focus,
.field textarea:focus { border-color: var(--pink); box-shadow: 0 0 0 3px rgba(var(--pink-rgb),.12); }
.field select {
  appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23697293'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.field--error input, .field--error select, .field--error textarea { border-color: var(--red); }
.field__error { color: var(--red); font-size: 12px; font-weight: 600; }

.check-row { display: flex; align-items: center; gap: 10px; min-height: 46px; }
.check-row input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; accent-color: var(--pink); }
.check-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 20px; }
.check-card {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px;
  font-weight: 650; font-size: 14px; cursor: pointer;
}
.check-card input { width: 18px; height: 18px; min-height: 0; accent-color: var(--pink); }
.check-card.is-on { border-color: var(--pink); background: var(--pink-2); }

.form-actions { display: flex; justify-content: flex-end; gap: 12px; padding-top: 22px; flex-wrap: wrap; }
.form-actions--split { justify-content: space-between; }
.form-actions__group { display: flex; gap: 12px; flex-wrap: wrap; }

/* ----- Fiche detail ----- */
.detail-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; margin-top: 18px; align-items: start; }
.detail-col { display: grid; gap: 18px; }
.detail-head {
  display: flex; align-items: flex-start; gap: 18px;
  padding: 22px 24px;
}
.detail-head .table-avatar { width: 60px; height: 60px; border-radius: 18px; font-size: 20px; }
.detail-head h2 { margin: 0 0 4px; font-size: 22px; }
.detail-head .detail-sub { color: var(--muted); font-weight: 600; }
.detail-head .detail-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.info-list { list-style: none; margin: 0; padding: 8px 24px 22px; display: grid; gap: 2px; }
.info-list li { display: grid; grid-template-columns: 150px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.info-list li:last-child { border-bottom: 0; }
.info-list .info-label { color: var(--muted); font-weight: 650; display: flex; align-items: center; gap: 8px; }
.info-list .info-label [data-icon] { color: var(--purple); width: 18px; }
.info-list .info-value { font-weight: 650; color: var(--text); word-break: break-word; }
.info-list .info-value a { color: var(--purple); text-decoration: none; }

/* ----- Timeline (notes / activite) ----- */
.timeline { padding: 6px 24px 22px; }
.timeline-item { position: relative; display: grid; grid-template-columns: 40px 1fr; gap: 14px; padding-bottom: 20px; }
.timeline-item::before { content: ''; position: absolute; left: 19px; top: 40px; bottom: 0; width: 2px; background: var(--line); }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item:last-child::before { display: none; }
.timeline-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; }
.timeline-body { padding-top: 2px; }
.timeline-body .t-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.timeline-body .t-title { font-weight: 750; font-size: 14px; }
.timeline-body .t-time { color: var(--muted); font-size: 12px; }
.timeline-body .t-author { color: var(--muted); font-size: 12px; }
.timeline-body .t-content { margin: 6px 0 0; color: #3d4664; font-size: 13.5px; line-height: 1.55; white-space: pre-wrap; }

/* ----- Mini formulaire integre (ajout note rapide) ----- */
.inline-form { padding: 16px 24px 22px; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.inline-form .inline-row { display: grid; grid-template-columns: 180px 1fr; gap: 10px; }
.inline-form select,
.inline-form input[type="text"],
.inline-form textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  outline: 0;
  transition: border-color .15s, box-shadow .15s;
  box-sizing: border-box;
}
.inline-form select {
  appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23697293'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
}
.inline-form textarea { min-height: 80px; resize: vertical; line-height: 1.55; }
/* Formulaire d'edition de note masque tant qu'on ne clique pas sur "Modifier". */
.timeline-body .note-edit[hidden] { display: none; }
.inline-form select:focus,
.inline-form input[type="text"]:focus,
.inline-form textarea:focus { border-color: var(--pink); box-shadow: 0 0 0 3px rgba(var(--pink-rgb),.12); }

/* ----- Sub-card header ----- */
.card__head .count-pill { color: var(--muted); font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--bg); }

/* ----- KPI couleur supplementaire ----- */
.kpi-card__icon.is-red { color: var(--red); background: #ffeef1; }

/* ----- Page connexion ----- */
.login-page {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(circle at 15% 20%, rgba(var(--pink-rgb),.18), transparent 35%),
    radial-gradient(circle at 85% 80%, rgba(124,60,255,.18), transparent 35%),
    linear-gradient(180deg, var(--sidebar), var(--sidebar-2));
}
.login-card {
  width: min(420px, 100%);
  background: #fff;
  border-radius: 22px;
  padding: 38px 34px;
  box-shadow: 0 30px 70px rgba(6,18,54,.45);
}
.login-brand { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 8px; }
.login-brand svg { width: 30px; height: 30px; color: var(--pink); fill: none; stroke: currentColor; stroke-width: 2.3; }
.login-brand__emoji { font-size: 28px; line-height: 1; }
.login-brand b { font-size: 22px; font-weight: 800; letter-spacing: -.6px; }
.login-brand .brand__tag { padding: 3px 7px; border-radius: 6px; background: var(--pink); color: #fff; font-size: 11px; font-weight: 800; }
.login-card h1 { text-align: center; font-size: 21px; margin: 14px 0 4px; }
.login-card .login-sub { text-align: center; color: var(--muted); margin: 0 0 24px; font-size: 14px; }
.login-card .field { margin-bottom: 16px; }
.login-card .button--primary { width: 100%; min-height: 50px; }
.login-error {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; margin-bottom: 18px;
  border-radius: 12px; background: #ffeef1; color: #c4123f;
  font-weight: 650; font-size: 14px;
}
.login-foot { text-align: center; margin-top: 20px; color: var(--muted); font-size: 12px; }

/* ----- Etiquettes solutions (opportunites) ----- */
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-list .tag { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--pink-2); color: var(--pink); font-size: 12px; font-weight: 700; }

/* ----- Responsive ----- */
@media (max-width: 1100px) {
  .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .form-grid, .form-grid--3, .check-grid, .check-card { grid-template-columns: 1fr; }
  .info-list li { grid-template-columns: 1fr; gap: 2px; }
  .toolbar select, .toolbar .search-field { width: 100%; flex: 1 1 100%; }
  .data-table { display: block; overflow-x: auto; white-space: nowrap; }
}
