/* ====== Ars Longa — Brand layer (non intrusif) ====== */

/* --- Topbar --- */
.topbar{
  background:#010a2c;           /* fond bleu nuit */
  color:#fef5d3;                 /* texte sable */
}
.topbar a, .topbar .nav a, .topbar .menu a{
  color:#fef5d3;
  text-decoration:none;
}
.topbar a:hover{ opacity:.9; }
.topbar .btn, .topbar button{
  background:transparent;
  border:1px solid rgba(254,245,211,.3);
  color:#fef5d3;
  border-radius:10px;
  padding:6px 10px;
}
.topbar .btn:hover{ background:rgba(254,245,211,.08); }

/* --- Boutons standards (y compris “Nouvelle tâche”, “Afficher”, “Éditer”) --- */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  border-radius:10px; padding:8px 12px; cursor:pointer;
  border:1px solid #e5e7eb; background:#fff; color:#111;
  text-decoration:none; line-height:1.2; font-size:14px;
}
.btn:focus{outline:2px solid rgba(59,130,246,.35); outline-offset:1px;}
a.btn, a.btn:link, a.btn:visited{ text-decoration:none; }
.btn-primary{background:#3b82f6; border-color:#3b82f6; color:#fff;}
.btn-primary:hover{background:#2563eb; border-color:#2563eb;}
.btn-outline{background:#fff; border-color:#cbd5e1; color:#0f172a;}
.btn-outline:hover{background:#f8fafc;}
.btn-danger{background:#ef4444; border-color:#ef4444; color:#fff;}
.btn-danger:hover{background:#dc2626;}
.btn-sm{padding:6px 10px; font-size:13px;}
.btn-lg{padding:10px 14px; font-size:15px;}

/* --- Tableaux --- */
.table{width:100%; border-collapse:collapse; font-size:14px;}
.table thead tr{background:#f8fafc;}
.table th,.table td{padding:8px 10px; border-bottom:1px solid #e5e7eb; text-align:left;}
.table tbody tr:hover{background:#f5f7ff;}
.table th:last-child,.table td:last-child{text-align:right;}
.table .badge{display:inline-block; padding:3px 8px; border-radius:999px; background:#eef2ff; color:#3730a3; font-size:12px;}

/* Conteneur de tableau */
.table-card{border:1px solid #e5e7eb; border-radius:12px; background:#fff; overflow:hidden;}

/* --- Fallback tables (si la vue n’ajoute pas .table) --- */
.card table, .table-card table, .content table { width:100%; border-collapse:collapse; font-size:14px; }
.card table thead tr, .table-card table thead tr, .content table thead tr { background:#f8fafc; }
.card table th, .card table td, .table-card table th, .table-card table td, .content table th, .content table td {
  padding:8px 10px; border-bottom:1px solid #e5e7eb; text-align:left;
}
.card table tbody tr:hover, .table-card table tbody tr:hover, .content table tbody tr:hover { background:#f5f7ff; }
.card table th:last-child, .card table td:last-child, .table-card table th:last-child, .table-card table td:last-child,
.content table th:last-child, .content table td:last-child { text-align:right; }

/* Actions en colonnes : <a> rendus comme des boutons outline sm */
.table .actions, .card table .actions, .content table .actions {
  display:flex; gap:8px; justify-content:flex-end;
}
.table .actions a, .card table .actions a, .content table .actions a{
  text-decoration:none;
  display:inline-flex; align-items:center; justify-content:center; gap:6px;
  padding:6px 10px; border-radius:10px; border:1px solid #cbd5e1; background:#fff; color:#0f172a;
  font-size:13px; line-height:1.2;
}
.table .actions a:hover, .card table .actions a:hover, .content table .actions a:hover{ background:#f8fafc; }

/* --- Formulaires (pages d’ajout / consultation) --- */
.form-card{background:#fff; border:1px solid #e5e7eb; border-radius:12px; padding:16px;}
.form-grid{display:grid; gap:12px;}
.form-grid.cols-2{grid-template-columns:1fr 1fr;}
@media (max-width: 991.98px){ .form-grid.cols-2{grid-template-columns:1fr;} }
.form-row{display:flex; flex-direction:column; gap:6px;}
.form-row label{font-weight:600; color:#334155;}
.form-row input[type="text"], .form-row input[type="email"], .form-row input[type="date"],
.form-row input[type="number"], .form-row input[type="password"], .form-row select, .form-row textarea{
  border:1px solid #cbd5e1; border-radius:10px; padding:8px 10px; background:#fff; color:#0f172a;
}
.form-row textarea{min-height:110px;}
.help{color:#64748b; font-size:13px;}

/* Groupe d’actions (une seule définition, utilisée partout) */
.form-actions, .btn-row, .settings-actions{
  display:flex; flex-wrap:wrap; align-items:center; gap:10px; margin-top:12px;
}
.form-actions .btn + .btn, .btn-row .btn + .btn, .settings-actions .btn + .btn{ margin-left:0; } /* gap gère l’écart */

/* --- Alerts --- */
.alert{border-radius:10px; padding:10px 12px;}
.alert-success{background:#f0fdf4; color:#166534; border:1px solid #bbf7d0;}
.alert-danger{background:#fef2f2; color:#b91c1c; border:1px solid #fecaca;}

/* --- Menu vertical (Discussions / Settings-like) --- */
.menu.nav-vertical a{
  display:block; padding:8px 10px; border-radius:8px; text-decoration:none; color:inherit;
}
.menu.nav-vertical a:hover{ background:#f5f5f5; }

/* Masquer l’ancien reset sous le formulaire (on l’a déplacé) */
.filters-reset-outside{ display:none; }

/* ================================
   Demandes > Filtres (clean & unique)
   ================================ */
.filters-inline{
  display:flex; flex-wrap:wrap; gap:10px; align-items:flex-end;
}
/* Tous les enfants directs (même si .col-*) : largeur homogène, responsive */
.filters-inline > *,
.filters-inline > [class^="col-"],
.filters-inline > [class*=" col-"]{
  flex: 1 1 260px;   /* base */
  min-width:220px;   /* pas trop petit */
  max-width:320px;   /* pas trop grand */
}
/* Les contrôles s’étirent à 100% dans leur bloc */
.filters-inline input[type="text"],
.filters-inline input[type="date"],
.filters-inline input[type="number"],
.filters-inline select,
.filters-inline .form-control,
.filters-inline .input-group{ width:100%; }
/* Évite d’anciens “verrous” de largeur */
.filters-inline select[name="funder_id"],
.filters-inline select[name="funders[]"],
.filters-inline .filter-wide{ min-width:unset; max-width:unset; }
/* 2e ligne : actions à droite */
.filters-actions{
  flex:1 1 100%;
  display:flex; gap:10px; justify-content:flex-end;
  margin-top:6px;
}

/* ================================
   Espacement robuste des actions (incl. Settings)
   ================================ */
.proj-main a.btn, .proj-main button.btn{
  display:inline-flex; align-items:center; justify-content:center; white-space:nowrap;
}
.proj-main a.btn, .proj-main form.d-inline, .proj-main form.d-inline-block{
  margin-right:10px; margin-bottom:8px;
}
.proj-main .d-flex, .proj-main .btn-row, .proj-main .form-actions{
  gap:10px; flex-wrap:wrap;
}

/* === Demandes > Filtres (grid 4 colonnes + hauteurs uniformes) === */
.filters-inline{
  display:grid;
  grid-template-columns: repeat(4, minmax(200px,1fr));
  gap:12px 10px;
  align-items:end;
}
.filters-inline > *{ min-width:0; } /* permet aux blocs de rétrécir harmonieusement */
.filters-actions{
  grid-column: 1 / -1;               /* actions sur toute la ligne */
  display:flex; gap:10px; justify-content:flex-end; margin-top:0;
}
/* Hauteurs homogènes champs / boutons */
.filters-inline .form-select,
.filters-inline .form-control{ height:38px; }
.filters-inline .btn{ height:38px; line-height:36px; }

/* Responsif : passe à 3 / 2 / 1 colonnes si la place manque */
@media (max-width: 1200px){ .filters-inline{ grid-template-columns: repeat(3, minmax(200px,1fr)); } }
@media (max-width: 900px) { .filters-inline{ grid-template-columns: repeat(2, minmax(200px,1fr)); } }
@media (max-width: 600px) { .filters-inline{ grid-template-columns: 1fr; } }


/* === Demandes > Filtres : actions alignées à droite + même hauteur === */
.filters-actions{
  grid-column: 1 / -1;
  display:flex;
  justify-content:flex-end;   /* aligne à droite */
  align-items:center;
  gap:10px;
  margin-top:0;
}
.filters-actions .btn{
  display:inline-flex;
  align-items:center;         /* centre vertical */
  justify-content:center;
  height:38px;                /* même hauteur que les selects */
  line-height:36px;           /* compense le border:1px */
  padding:0 12px;             /* garde la même hauteur totale */
  box-sizing:border-box;      /* sécurité sur le calcul hauteur */
}

/* Demandes (bloc filtres façon "On tour") : hauteur cohérente + alignement parfait */
.card .form-select, .card .form-control{ height:38px; }
.card .btn{ height:38px; padding:0 12px; line-height:36px; }


/* ==== Modèle commun : sections de filtres (4 colonnes) ==== */
.filters-section{
  padding:16px; border:1px solid var(--border, #e5e7eb); border-radius:12px; background:#fff;
}
.filters-grid{
  display:grid; grid-template-columns:repeat(4,1fr); gap:12px;
}
@media (max-width: 1100px){
  .filters-grid{ grid-template-columns:repeat(2,1fr); }
}
@media (max-width: 640px){
  .filters-grid{ grid-template-columns:1fr; }
}
.filters-section .muted{
  color:#6b7280; font-size:12px; line-height:1; padding:2px 0 0;
}
.filters-section select,
.filters-section input[type="text"],
.filters-section input[type="search"],
.filters-section input[type="date"]{
  width:100%; height:40px; padding:8px 10px;
  border:1px solid #e5e7eb; border-radius:8px; background:#fff; font-size:14px;
}
.filters-actions{
  display:flex; gap:8px; justify-content:flex-end; align-items:stretch; margin-top:12px;
}
.filters-actions .btn{ height:40px; }

/* ==== Uniformisation exacte des filtres (modèle On tour) ==== */
.filters-section{
  padding: 0;               /* pas de carte visuelle, comme On tour */
  background: transparent;
  border: 0;
}
.filters-grid{
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;                /* On tour: espacement compact */
  align-items: end;         /* aligne champs uniformément */
}
@media (max-width:1100px){ .filters-grid{ grid-template-columns:repeat(2,1fr); } }
@media (max-width:640px) { .filters-grid{ grid-template-columns:1fr; } }

.filters-section .muted{
  color: #6b7280;
  font-size: 12px;
  line-height: 1;
  margin-bottom: -2px;      /* labels visuellement proches du champ */
}

.filters-section select,
.filters-section input[type="text"],
.filters-section input[type="search"],
.filters-section input[type="date"]{
  width: 100%;
  height: 40px;             /* hauteur uniforme avec les boutons */
  padding: 8px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  font-size: 14px;
}

.filters-actions{
  display: flex;
  gap: 8px;
  justify-content: flex-end;  /* boutons à droite, comme On tour */
  align-items: stretch;
  margin-top: 8px;
}
.filters-actions .btn{
  height: 40px;               /* même hauteur que les champs */
  line-height: 40px;          /* aligne verticalement le texte */
  padding: 0 14px;            /* compacité On tour */
}
