/* ============================================
   style.css — Fil Info
   Design : épuré, professionnel, rapide
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,400&family=DM+Mono:wght@400;500&display=swap');

/* ============================================
   RESET & BASE
   ============================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --navy:       #1A3C5E;
  --navy-dark:  #122B45;
  --navy-mid:   #234f7a;
  --navy-light: #EEF4FB;
  --navy-border:#B5D4F4;
  --rust:       #C0451E;
  --rust-dark:  #9a3515;
  --rust-pale:  #f9ece7;
  --wine:       #7B1E3E;
  --wine-pale:  #fff5f7;
  --wine-border:#e8c4c4;
  --wine-mid:   #f0c8d0;
  --white:      #ffffff;
  --bg:         #f4f5f7;
  --surface:    #ffffff;
  --border:     #e2e5ea;
  --text:       #1a1f2e;
  --text-muted: #6b7280;
  --text-light: #9ca3af;
  --green:      #059669;
  --green-pale: #d1fae5;
  --red:        #dc2626;
  --red-pale:   #fee2e2;
  --amber:      #d97706;
  --amber-pale: #fef3c7;
  --radius-sm:  6px;
  --radius:     10px;
  --radius-lg:  16px;
  --shadow-sm:  0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:     0 4px 12px rgba(0,0,0,.08);
  --font:       'DM Sans', system-ui, sans-serif;
  --font-mono:  'DM Mono', monospace;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

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

/* ============================================
   FORMULAIRES
   ============================================ */
.form-group { margin-bottom: 1.1rem; }

label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: .4rem;
}

input[type="email"],
input[type="password"],
input[type="text"],
textarea,
select {
  width: 100%;
  padding: .65rem .85rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--white);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(26,60,94,.12);
}

textarea { resize: vertical; min-height: 80px; }

/* ============================================
   BOUTONS
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: .7rem 1.25rem;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all .15s;
  text-decoration: none;
}

.btn-primary   { background: var(--navy);  color: white; width: 100%; }
.btn-primary:hover { background: var(--navy-mid); text-decoration: none; color: white; }

.btn-rust      { background: var(--rust);  color: white; }
.btn-rust:hover { background: var(--rust-dark); text-decoration: none; color: white; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
}
.btn-ghost:hover { border-color: var(--navy); color: var(--navy); text-decoration: none; }

.btn-sm      { padding: .4rem .85rem; font-size: 13px; }
.btn-danger  { background: var(--red);   color: white; }
.btn-danger:hover  { background: #b91c1c; text-decoration: none; color: white; }
.btn-success { background: var(--green); color: white; }
.btn-success:hover { background: #047857; text-decoration: none; color: white; }

/* ============================================
   ALERTES
   ============================================ */
.alert {
  padding: .7rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 1.1rem;
  font-weight: 500;
}
.alert-error   { background: var(--red-pale);   color: var(--red); }
.alert-success { background: var(--green-pale); color: var(--green); }
.alert-info    { background: #dbeafe; color: #1d4ed8; }

/* ============================================
   BADGES
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}
.badge-actif    { background: var(--green-pale); color: var(--green); }
.badge-attente  { background: var(--amber-pale); color: var(--amber); }
.badge-suspendu { background: var(--red-pale);   color: var(--red); }
.badge-admin    { background: #ede9fe; color: #6d28d9; }

/* ============================================
   PAGE DE LOGIN
   ============================================ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--navy-dark);
  background-image:
    radial-gradient(circle at 20% 80%, rgba(192,69,30,.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255,255,255,.03) 0%, transparent 50%);
  padding: 1.5rem;
}

.login-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow), 0 0 0 1px rgba(255,255,255,.05);
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 2rem;
}

.login-logo-icon {
  width: 40px; height: 40px;
  background: var(--navy);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
}
.login-logo-icon svg { width: 20px; height: 20px; fill: white; }

.login-logo-text { display: flex; flex-direction: column; }
.login-logo-text .brand { font-size: 17px; font-weight: 600; color: var(--navy); letter-spacing: -.3px; }
.login-logo-text .sub   { font-size: 12px; color: var(--text-muted); font-weight: 400; }

.login-card h1      { font-size: 20px; font-weight: 600; color: var(--text); margin-bottom: .25rem; }
.login-card .subtitle { font-size: 13px; color: var(--text-muted); margin-bottom: 1.75rem; }

.login-footer { margin-top: 1.5rem; text-align: center; font-size: 13px; color: var(--text-muted); }
.login-footer a { color: var(--navy); font-weight: 500; }

.register-card { max-width: 460px; }

/* ============================================
   TOPBAR
   ============================================ */
.topbar {
  background: var(--navy);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.25rem;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 1;
}

.topbar-icon {
  width: 30px; height: 30px;
  background: rgba(255,255,255,.12);
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.topbar-icon svg { width: 16px; height: 16px; fill: white; }

.topbar-title { color: white; font-size: 15px; font-weight: 600; letter-spacing: -.2px; }
.topbar-sub   { color: rgba(255,255,255,.55); font-size: 12px; }

.topbar-nav { display: flex; align-items: center; gap: .5rem; }

.topbar-nav a {
  color: rgba(255,255,255,.75);
  font-size: 13px;
  font-weight: 500;
  padding: .35rem .7rem;
  border-radius: var(--radius-sm);
  transition: all .15s;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 5px;
}
.topbar-nav a:hover  { background: rgba(255,255,255,.1);  color: white; }
.topbar-nav a.active { background: rgba(255,255,255,.15); color: white; }

.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: .35rem .7rem;
  border-left: 1px solid rgba(255,255,255,.1);
  margin-left: .25rem;
}

.topbar-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--rust);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; color: white; letter-spacing: .5px;
  overflow: hidden;
  flex-shrink: 0;
}

.topbar-name { color: rgba(255,255,255,.85); font-size: 13px; font-weight: 500; }

.topbar-logout {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: .5rem;
  padding: .35rem .85rem;
  background: var(--rust);
  border: none;
  border-radius: var(--radius-sm);
  color: white !important;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none !important;
  transition: all .15s;
}
.topbar-logout:hover { background: var(--rust-dark); color: white !important; text-decoration: none !important; }

/* Badge compteur nav */
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--rust);
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 20px;
  margin-left: 2px;
  vertical-align: middle;
}

/* Avatars photo */
img.msg-avatar,
img.compose-avatar,
img.topbar-avatar {
  object-fit: cover;
  object-position: center 20%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

/* ============================================
   LAYOUT PRINCIPAL
   ============================================ */
.main-wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.75rem 1.25rem 3rem;
}

/* ============================================
   ADMIN
   ============================================ */
.admin-wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.75rem 1.25rem 3rem;
}

.page-title { font-size: 20px; font-weight: 600; color: var(--text); margin-bottom: .25rem; }
.page-sub   { font-size: 13px; color: var(--text-muted); margin-bottom: 1.75rem; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: .75rem;
  margin-bottom: 1.75rem;
}

.stat-card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
}
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: .6px; margin-bottom: .4rem; }
.stat-value { font-size: 26px; font-weight: 600; color: var(--text); font-family: var(--font-mono); }

.table-card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.table-card table  { width: 100%; border-collapse: collapse; }
.table-card th {
  background: var(--bg);
  padding: .65rem 1rem;
  font-size: 12px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .6px;
  text-align: left;
  border-bottom: 1.5px solid var(--border);
}
.table-card td {
  padding: .85rem 1rem;
  font-size: 13.5px; color: var(--text);
  border-bottom: 1px solid var(--bg);
  vertical-align: middle;
}
.table-card tr:last-child td { border-bottom: none; }
.table-card tr:hover td      { background: #fafafa; }

.actions { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.actions form { display: inline-flex; }
.actions .btn { white-space: nowrap; }

/* ============================================
   COMPOSE
   ============================================ */
.compose-card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.25rem;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow-sm);
}

.compose-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: .85rem;
}

.compose-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--navy);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: white;
  flex-shrink: 0;
  overflow: hidden;
}

.compose-label      { font-size: 13px; color: var(--text-muted); }
.compose-label strong { color: var(--text); font-weight: 500; }

.compose-card textarea { border-color: var(--border); font-size: 14.5px; min-height: 90px; margin-bottom: .85rem; }

.compose-footer { display: flex; align-items: center; justify-content: space-between; }
.compose-hint   { font-size: 12px; color: var(--text-light); }

/* ============================================
   FIL HEADER
   ============================================ */
.fil-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 1rem;
}
.fil-header h2 {
  font-size: 14px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .8px;
  flex: 1;
}
.fil-count { font-size: 12px; color: var(--text-light); font-family: var(--font-mono); }

/* ============================================
   MESSAGES
   ============================================ */
.messages-list { display: flex; flex-direction: column; gap: .75rem; }

.msg-card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.25rem;
  display: flex;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s;
}
.msg-card:hover { border-color: #c5ccd8; }
.msg-card.msg-new   { border-left: 3px solid var(--rust); }
.msg-card.msg-admin { background: var(--navy-light) !important; border-color: var(--navy-border) !important; border-left: 3px solid var(--navy) !important; }
.msg-card.msg-admin.msg-new { border-left: 3px solid var(--navy) !important; }

.msg-avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: white;
  flex-shrink: 0;
  margin-top: 1px;
  overflow: hidden;
}

.msg-body { flex: 1; min-width: 0; }

.msg-meta {
  display: flex;
  align-items: baseline;
  gap: .6rem;
  margin-bottom: .35rem;
  flex-wrap: wrap;
}
.msg-name { font-size: 14px; font-weight: 600; color: var(--text); }
.msg-role { font-size: 11px; color: var(--text-muted); background: var(--bg); padding: 2px 7px; border-radius: 20px; }
.msg-time { font-size: 12px; color: var(--text-light); font-family: var(--font-mono); margin-left: auto; }

.msg-text {
  font-size: 14.5px; color: var(--text);
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.badge-new {
  font-size: 10px; font-weight: 600;
  background: var(--rust); color: white;
  padding: 2px 7px; border-radius: 20px;
  letter-spacing: .4px; text-transform: uppercase;
}

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}
.empty-state svg { width: 40px; height: 40px; opacity: .3; margin-bottom: 1rem; }
.empty-state p   { font-size: 14px; }

/* Modifier / Supprimer */
.msg-modifie {
  display: inline-block;
  font-size: 11px; color: var(--text-light);
  font-style: italic; margin-bottom: .5rem;
}

.msg-edit-ta {
  width: 100%;
  font-family: var(--font);
  font-size: 14.5px; color: var(--text);
  background: var(--bg);
  border: 1.5px solid var(--navy);
  border-radius: var(--radius-sm);
  padding: .6rem .85rem;
  resize: vertical; min-height: 70px;
  outline: none; margin-bottom: .5rem;
  box-sizing: border-box;
}

.btn-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px; font-family: var(--font); font-weight: 500;
  padding: .28rem .65rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--white); color: var(--text-muted);
  cursor: pointer; transition: all .15s; flex-shrink: 0;
}

.btn-edit:hover   { border-color: var(--navy);  color: var(--navy);  background: var(--navy-light); }
.btn-delete:hover { border-color: var(--red);   color: var(--red);   background: var(--red-pale); }
.btn-save         { background: var(--navy); color: white !important; border-color: var(--navy); }
.btn-save:hover   { background: var(--navy-dark); }
.btn-cancel:hover { border-color: var(--border); color: var(--text); }

/* ============================================
   BARRE "LU PAR"
   ============================================ */
.lu-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: .65rem;
  margin-top: .65rem;
  border-top: 1px solid var(--bg);
  flex-wrap: wrap;
}

.lu-label {
  font-size: 12px; color: var(--text-muted);
  white-space: nowrap; flex-shrink: 0;
}

.lu-avatars {
  display: flex;
  flex: 1; align-items: center;
  flex-wrap: wrap; gap: 4px;
}

.av-lu {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 600; color: white;
  border: 2px solid var(--white);
  cursor: default; position: relative; flex-shrink: 0;
  transition: transform .15s;
}
.av-lu:hover { transform: scale(1.15); z-index: 2; }
.av-lu::after {
  content: attr(title);
  position: absolute; bottom: 32px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: white;
  font-size: 11px; padding: 3px 8px; border-radius: var(--radius-sm);
  white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .15s;
}
.av-lu:hover::after { opacity: 1; }

.lu-personne { font-size: 12px; color: var(--text-light); font-style: italic; }

.btn-lu {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-family: var(--font); font-weight: 500;
  padding: .3rem .8rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--white); color: var(--text-muted);
  cursor: pointer; transition: all .15s; flex-shrink: 0;
}
.btn-lu:hover:not(:disabled) { border-color: var(--navy); color: var(--navy); background: #f0f4f8; }
.btn-lu.done { background: var(--green-pale); border-color: #86efac; color: var(--green); cursor: default; }

.lu-auteur { margin-left: auto; font-size: 12px; color: var(--text-light); font-style: italic; }

/* Épingler */
.btn-epingle       { color: var(--text-light); border-color: var(--border); }
.btn-epingle:hover { color: var(--wine); border-color: var(--wine); background: var(--wine-pale); }
.btn-epingle.active { color: var(--wine); border-color: var(--wine); background: var(--wine-pale); }

/* ============================================
   MESSAGES EPINGLÉS
   ============================================ */
.epingles-section {
  margin-bottom: 1.5rem;
  background: #fdf8f8;
  border: 1.5px solid var(--wine-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.epingles-header {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: .65rem 1.1rem;
  background: #f9eded;
  border-bottom: 1px solid var(--wine-border);
  font-size: 12px; font-weight: 600; color: var(--wine);
  text-transform: uppercase; letter-spacing: .5px;
}
.epingles-header .day-count {
  background: var(--wine-mid); color: var(--wine);
  border: 1px solid var(--wine-border); font-weight: 700;
}

.epingles-section .msg-card {
  border: none;
  border-bottom: 1px solid #f0dada;
  border-radius: 0; margin: 0;
  background: var(--wine-pale) !important;
  border-left: none !important;
  box-shadow: none;
}
.epingles-section .msg-card:last-child { border-bottom: none; }

.epingle-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 700;
  background: var(--wine); color: white;
  padding: 2px 8px; border-radius: 20px;
  letter-spacing: .3px;
}

/* ============================================
   GROUPES PAR DATE
   ============================================ */
.day-section { margin-bottom: .5rem; }

.day-header {
  display: flex; align-items: center; gap: 10px;
  padding: .6rem 0; cursor: pointer; user-select: none;
}
.day-header:hover .day-label { color: var(--text); }

.day-line { flex: 1; height: 1px; background: var(--border); }

.day-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500; color: var(--text-muted);
  white-space: nowrap; text-transform: uppercase; letter-spacing: .5px;
  transition: color .15s;
}

.day-count {
  font-size: 11px; color: var(--text-light);
  background: var(--bg); padding: 2px 7px; border-radius: 20px;
  font-weight: 400; text-transform: none; letter-spacing: 0;
}

.day-chevron { flex-shrink: 0; color: var(--text-light); transition: transform .2s ease; }
.day-chevron.open { transform: rotate(180deg); }

.day-messages {
  display: flex; flex-direction: column; gap: .75rem;
  overflow: hidden;
  transition: max-height .3s ease, opacity .2s ease;
  max-height: 9999px; opacity: 1;
}
.day-messages.collapsed { max-height: 0 !important; opacity: 0; }

/* Couleurs séparateurs */
.day-section.day-today .day-label   { color: var(--navy); }
.day-section.day-today .day-line    { background: var(--navy-border); }
.day-section.day-today .day-count   { background: var(--navy-light); color: var(--navy); }
.day-section.day-today .day-chevron { color: var(--navy); }

.day-section.day-hier .day-label   { color: var(--rust); }
.day-section.day-hier .day-line    { background: #f5c4b3; }
.day-section.day-hier .day-count   { background: var(--rust-pale); color: var(--rust); }
.day-section.day-hier .day-chevron { color: var(--rust); }

/* ============================================
   RÉPONSES AUX MESSAGES
   ============================================ */
.reply-toggle {
  display: inline-flex; align-items: center; gap: 5px;
  margin-top: .5rem;
  font-size: 12px; color: var(--navy);
  cursor: pointer;
  padding: 3px 9px; border-radius: 20px;
  border: 0.5px solid var(--navy-border);
  background: var(--navy-light);
  transition: all .15s; user-select: none;
}
.reply-toggle:hover { background: #d6eaf8; }

.reply-chev { transition: transform .2s; }

.reply-zone {
  margin-left: 48px; margin-top: .5rem;
  border-left: 2px solid var(--border);
  padding-left: 12px;
}

.reply-list { display: flex; flex-direction: column; gap: .4rem; margin-bottom: .5rem; }

.reply-card {
  background: var(--bg);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: .55rem .85rem;
  display: flex; flex-direction: row; gap: 8px;
  align-items: flex-start;
  width: 100%; box-sizing: border-box;
}

.reply-avatar-small {
  width: 26px !important; height: 26px !important;
  min-width: 26px !important; max-width: 26px !important;
  border-radius: 50% !important;
  display: flex !important; align-items: center !important; justify-content: center !important;
  font-size: 10px !important; font-weight: 600 !important; color: white !important;
  flex-shrink: 0 !important; overflow: hidden;
}

.reply-name { font-size: 12px; font-weight: 500; color: var(--text); }
.reply-time { font-size: 11px; color: var(--text-light); }
.reply-text { font-size: 13px; color: var(--text); line-height: 1.5; margin-top: 2px; }

.reply-input-row { display: flex; gap: 6px; align-items: center; margin-top: .25rem; }

.reply-input {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: .35rem .85rem;
  font-size: 13px; font-family: var(--font);
  outline: none; background: var(--white); color: var(--text);
  transition: border-color .15s;
}
.reply-input:focus { border-color: var(--navy); }

.reply-send-btn {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--navy); color: white;
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background .15s;
}
.reply-send-btn:hover { background: var(--navy-mid); }

/* ============================================
   BLOC-NOTES
   ============================================ */
.bn-card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.bn-head {
  background: #2C4A6E;
  padding: .7rem 1rem;
  display: flex; align-items: center; justify-content: space-between;
}

.bn-head-title {
  color: white; font-size: 13px; font-weight: 500;
  display: flex; align-items: center; gap: 7px;
}

.bn-add-btn {
  background: rgba(255,255,255,.15); border: none;
  border-radius: var(--radius-sm); color: white;
  font-size: 11px; padding: .25rem .6rem;
  cursor: pointer;
  display: flex; align-items: center; gap: 4px;
  font-family: var(--font); transition: background .15s;
}
.bn-add-btn:hover { background: rgba(255,255,255,.25); }

.bn-form {
  padding: .75rem 1rem;
  background: #f8fafc;
  border-bottom: 0.5px solid var(--border);
  flex-direction: column; gap: .4rem;
}

.bn-input {
  width: 100%; font-family: var(--font); font-size: 13px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  padding: .4rem .65rem; outline: none;
  box-sizing: border-box; color: var(--text); background: var(--white);
}
.bn-input:focus { border-color: #2C4A6E; }

.bn-textarea {
  width: 100%; font-family: var(--font); font-size: 12px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  padding: .4rem .65rem; outline: none;
  min-height: 70px; resize: vertical;
  box-sizing: border-box; color: var(--text); background: var(--white);
}
.bn-textarea:focus { border-color: #2C4A6E; }

.bn-save-btn {
  flex: 1; background: #2C4A6E; color: white;
  border: none; border-radius: var(--radius-sm);
  padding: .4rem; font-size: 12px; font-family: var(--font);
  cursor: pointer; font-weight: 500;
}
.bn-save-btn:hover { background: var(--navy); }

.bn-cancel-btn {
  background: var(--bg);
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  padding: .4rem .65rem; font-size: 12px; font-family: var(--font);
  cursor: pointer; color: var(--text-muted);
}

.bn-note { padding: .7rem 1rem; border-bottom: 0.5px solid var(--bg); }
.bn-note:last-child { border-bottom: none; }

.bn-note-head {
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 8px; margin-bottom: .25rem;
}
.bn-note-date { font-size: 11px; color: var(--text-light); white-space: nowrap; font-family: var(--font-mono); }

.bn-note-texte {
  font-size: 12px; color: var(--text-muted); line-height: 1.5;
  white-space: pre-wrap; word-break: break-word; margin-bottom: .35rem;
}

.bn-note-actions { display: flex; gap: 5px; }

.bn-btn-edit, .bn-btn-del {
  width: 24px; height: 24px;
  border-radius: var(--radius-sm);
  border: 0.5px solid var(--border); background: var(--bg);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all .15s; color: var(--text-muted);
}
.bn-btn-edit:hover { border-color: #2C4A6E; color: #2C4A6E; background: var(--navy-light); }
.bn-btn-del:hover  { border-color: var(--red); color: var(--red); background: var(--red-pale); }

.bn-empty { font-size: 12px; color: var(--text-light); font-style: italic; text-align: center; padding: 1rem; }

/* ============================================
   AGENDA
   ============================================ */
.agenda-card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.agenda-head {
  background: var(--wine);
  padding: .75rem 1rem;
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; flex-wrap: wrap;
}
.agenda-head-title {
  color: white; font-size: 13px; font-weight: 500;
  display: flex; align-items: center; gap: 7px;
}
.agenda-date { color: rgba(255,255,255,.6); font-size: 11px; text-transform: capitalize; }

.btn-edit-agenda {
  background: rgba(255,255,255,.15); border: none;
  border-radius: var(--radius-sm); color: white;
  font-size: 11px; padding: .25rem .6rem;
  cursor: pointer; display: flex; align-items: center; gap: 4px;
  font-family: var(--font); transition: background .15s;
}
.btn-edit-agenda:hover { background: rgba(255,255,255,.25); }

/* Agenda — cadres verticaux par jour */
.agenda-day-card {
  border-bottom: 0.5px solid var(--border);
  padding: .7rem 1rem;
  background: var(--white);
}
.agenda-day-card:last-child { border-bottom: none; }
.agenda-day-card.today { background: var(--wine-pale); border-left: 3px solid var(--wine); }

.agenda-day-head {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: .4rem;
}
.agenda-day-label { font-size: 12px; font-weight: 500; color: var(--text-muted); text-transform: capitalize; }
.agenda-day-label.today { color: var(--wine) !important; font-weight: 700 !important; }

.agenda-day-edit-btn {
  font-size: 11px; color: var(--wine);
  border: 0.5px solid var(--wine-border); background: #fdf8f8;
  border-radius: 4px; padding: 2px 8px;
  cursor: pointer; font-family: var(--font); transition: all .15s;
}
.agenda-day-edit-btn:hover { background: #f5eef0; }

.agenda-day-edit { margin-top: .4rem; }

.agenda-item { display: flex; align-items: flex-start; gap: 10px; padding: .55rem 0; border-bottom: 1px solid var(--bg); }
.agenda-item:last-child { border-bottom: none; }

.agenda-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--rust); flex-shrink: 0; margin-top: 5px; }
.agenda-text { font-size: 13px; color: var(--text); line-height: 1.5; }
.agenda-empty { font-size: 13px; color: var(--text-light); font-style: italic; text-align: center; padding: 1rem 0; }

/* ============================================
   CALENDRIER — GRILLE CORRIGÉE
   ============================================ */
.cal-card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  /* Empêche l'écrasement dans une colonne flex étroite */
  min-width: 0;
  width: 100%;
}

.cal-head-bar {
  background: var(--navy);
  padding: .6rem .85rem;
  display: flex; align-items: center; justify-content: space-between;
}
.cal-titre-txt { color: white; font-size: 13px; font-weight: 500; }

.cal-nav-btn {
  background: rgba(255,255,255,.15); border: none; color: white;
  border-radius: 4px; width: 22px; height: 22px;
  cursor: pointer; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  line-height: 1; font-family: var(--font);
}
.cal-nav-btn:hover { background: rgba(255,255,255,.3); }

/* Corps du calendrier — padding léger */
.cal-body {
  padding: .5rem .6rem .6rem;
}

/* En-têtes jours — GRILLE FORCÉE */
.cal-days-head {
  display: grid !important;
  grid-template-columns: repeat(7, 1fr) !important;
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 2px;
}
.cal-days-head span {
  font-size: 9px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  padding: 2px 0;
  text-transform: uppercase;
  letter-spacing: .3px;
}

/* Grille jours — FORCÉE, corrige le bug colonne étroite */
.cal-days-grid {
  display: grid !important;
  grid-template-columns: repeat(7, 1fr) !important;
  gap: 1px;
  width: 100%;
  box-sizing: border-box;
}

.cal-day {
  font-size: 11px;
  text-align: center;
  padding: 4px 1px;
  border-radius: 50%;
  color: var(--text);
  cursor: default;
  aspect-ratio: 1 / 1;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  min-width: 0; /* évite le débordement */
  line-height: 1;
}

.cal-other { color: var(--text-light); }

.cal-today {
  background: var(--wine);
  color: white !important;
  font-weight: 600;
}



/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 600px) {
  .login-card { padding: 2rem 1.5rem 1.5rem; }
  .topbar-sub, .topbar-name { display: none; }
  .msg-time { width: 100%; margin-left: 0; }
  .table-card th:nth-child(4),
  .table-card td:nth-child(4) { display: none; }
}

@media (max-width: 820px) {
  .agenda-col, .bn-col {
    position: static;
    order: -1;
  }
}

/* ════════════════════════════════════════════════════════
   MISE A JOUR TOPBAR — coller dans style.css
   (remplace ou complete les regles .topbar-nav existantes)
   ════════════════════════════════════════════════════════ */

/* Liens nav : icone + texte horizontal, pill arrondie */
.topbar-nav a {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: .38rem .75rem;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 500;
  color: rgba(255,255,255,.65);
  text-decoration: none;
  transition: background .15s, color .15s;
  white-space: nowrap;
  position: relative;
}

.topbar-nav a svg {
  flex-shrink: 0;
  opacity: .75;
  transition: opacity .15s;
}

/* Survol */
.topbar-nav a:hover {
  background: rgba(255,255,255,.12);
  color: white;
  text-decoration: none;
}
.topbar-nav a:hover svg { opacity: 1; }

/* Actif par defaut : blanc semi-transparent */
.topbar-nav a.active {
  background: rgba(255,255,255,.18);
  color: white;
}
.topbar-nav a.active svg { opacity: 1; }

/* Actif Fil info = OR/DORE — page principale */
.topbar-nav a.active.nav-fil {
  background: #F59E0B;
  color: #1c1917 !important;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(245,158,11,.35);
}
.topbar-nav a.active.nav-fil svg {
  stroke: #1c1917;
  opacity: 1;
}

