/* ═══════════════════════════════════════════════════════════════
   Finance Messenger — Mobile-first responsive CSS
   ═══════════════════════════════════════════════════════════════ */

:root {
  --bg:          #0f172a;
  --surface:     #1e293b;
  --card:        #253347;
  --border:      #334155;
  --accent:      #38bdf8;
  --accent-dark: #0284c7;
  --green:       #22c55e;
  --red:         #ef4444;
  --orange:      #f97316;
  --yellow:      #eab308;
  --text:        #f1f5f9;
  --text-muted:  #94a3b8;
  --text-dim:    #64748b;
  --bubble-out:  #0ea5e9;
  --bubble-in:   #1e293b;
  --shadow:      0 4px 24px rgba(0,0,0,.4);
  --radius:      12px;
  --radius-sm:   8px;
  --radius-msg:  18px;
  --transition:  .2s ease;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
button { cursor: pointer; border: none; background: none; color: inherit; font: inherit; }
input, textarea, select {
  font: inherit;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56,189,248,.15);
}
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ── Helpers ── */
.spin { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:translateY(0); } }
@keyframes slideUp { from { transform:translateY(100%); } to { transform:translateY(0); } }
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:.4; } }

/* ════════════════════════════════════════════════════════
   LOGIN
   ════════════════════════════════════════════════════════ */
.login-page {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 60% 30%, #1e3a5f 0%, #0f172a 70%);
  padding: 16px;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 36px 28px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
  animation: fadeIn .4s ease;
}
.login-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}
.login-logo svg { width: 64px; height: 64px; }
.login-card h1 {
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}
.login-subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 28px;
}
.field-group { margin-bottom: 16px; }
.field-group label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}
.field-group input {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  border-radius: var(--radius-sm);
}
.pass-wrapper { position: relative; }
.pass-wrapper input { padding-right: 44px; width: 100%; }
.toggle-pass {
  position: absolute; right: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  padding: 4px;
}
.toggle-pass svg { width: 18px; height: 18px; display: block; }
.alert-error {
  background: rgba(239,68,68,.15);
  border: 1px solid rgba(239,68,68,.4);
  color: #fca5a5;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 14px;
}
.btn-primary {
  background: var(--accent);
  color: #0f172a;
  font-weight: 700;
  font-size: 15px;
  padding: 13px 24px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background var(--transition);
}
.btn-primary:hover { background: #7dd3fc; }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }
.btn-full { width: 100%; }
.login-footer {
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
  margin-top: 20px;
}

/* ════════════════════════════════════════════════════════
   APP LAYOUT
   Mobile: sidebar hidden, main full; Desktop: side-by-side
   ════════════════════════════════════════════════════════ */
.app-container {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}
/* MOBILE: main + bottom nav */
.main-area {
  flex: 1;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}
.bottom-nav {
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 4px;
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 500;
  position: relative;
  transition: color var(--transition);
}
.nav-btn svg { width: 22px; height: 22px; }
.nav-btn.active { color: var(--accent); }
.nav-badge {
  position: absolute;
  top: 8px; right: calc(50% - 18px);
  background: var(--red);
  color: white;
  font-size: 9px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* SIDEBAR (mobile: overlay panel) */
.sidebar {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform .3s ease;
}
.sidebar.open { transform: translateX(0); }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
}
.sidebar-actions { display: flex; gap: 6px; }
.icon-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition);
}
.icon-btn:hover, .icon-btn:active { background: var(--card); color: var(--text); }
.icon-btn svg { width: 20px; height: 20px; }
.avatar-sm {
  width: 30px; height: 30px;
  background: var(--accent);
  color: #0f172a;
  font-weight: 700;
  font-size: 12px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

/* Dashboard banner */
.dashboard-banner {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.db-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 6px;
  border-right: 1px solid var(--border);
}
.db-stat:last-child { border-right: none; }
.db-val { font-size: 14px; font-weight: 700; color: var(--accent); }
.db-stat.danger .db-val { color: var(--red); }
.db-lbl { font-size: 10px; color: var(--text-dim); margin-top: 2px; }

/* Groups list */
.groups-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.group-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background var(--transition);
  position: relative;
}
.group-item:hover { background: var(--card); }
.group-item.active { background: rgba(56,189,248,.1); }
.group-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.group-info { flex: 1; min-width: 0; }
.group-name {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.group-desc {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.group-badge {
  background: var(--red);
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  padding: 0 5px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* Skeleton loading */
.skeleton-item {
  height: 60px;
  margin: 6px 12px;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--card) 25%, var(--border) 50%, var(--card) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding: 8px;
  flex-shrink: 0;
}
.sidebar-footer-btn {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background var(--transition), color var(--transition);
}
.sidebar-footer-btn:hover { background: var(--card); color: var(--red); }
.sidebar-footer-btn svg { width: 16px; height: 16px; }

/* ════════════════════════════════════════════════════════
   EMPTY STATE
   ════════════════════════════════════════════════════════ */
.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 40px 20px;
  color: var(--text-muted);
  text-align: center;
}
.empty-state h2 { font-size: 18px; color: var(--text); font-weight: 600; }
.empty-state p { font-size: 14px; }

/* ════════════════════════════════════════════════════════
   CHAT VIEW
   ════════════════════════════════════════════════════════ */
.chat-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
}
.chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  min-height: 56px;
}
.back-btn { color: var(--accent); }
.chat-header-info { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; }
.chat-header-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.chat-title { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-subtitle { font-size: 12px; color: var(--text-muted); }

/* Messages */
.messages-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px;
  display: flex;
  flex-direction: column;
}
.messages-inner { display: flex; flex-direction: column; gap: 4px; min-height: 0; }
.load-more-wrapper { text-align: center; padding: 8px 0; }
.btn-load-more {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 6px 16px;
  border-radius: 16px;
  font-size: 12px;
}

/* Message bubble */
.msg-wrapper {
  display: flex;
  flex-direction: column;
  max-width: 80%;
  animation: fadeIn .2s ease;
}
.msg-wrapper.outgoing { align-self: flex-end; align-items: flex-end; }
.msg-wrapper.incoming { align-self: flex-start; align-items: flex-start; }
.msg-wrapper + .msg-wrapper.same-user { margin-top: 1px; }
.msg-wrapper + .msg-wrapper:not(.same-user) { margin-top: 10px; }

.msg-sender { font-size: 11px; color: var(--text-muted); margin-bottom: 3px; padding-left: 4px; }
.msg-bubble {
  padding: 10px 14px;
  border-radius: var(--radius-msg);
  position: relative;
  word-break: break-word;
  font-size: 14px;
  line-height: 1.5;
}
.msg-wrapper.outgoing .msg-bubble {
  background: var(--bubble-out);
  color: white;
  border-bottom-right-radius: 4px;
}
.msg-wrapper.incoming .msg-bubble {
  background: var(--card);
  color: var(--text);
  border-bottom-left-radius: 4px;
  border: 1px solid var(--border);
}
.msg-time {
  font-size: 10px;
  color: rgba(255,255,255,.6);
  margin-top: 3px;
  padding: 0 4px;
}
.msg-wrapper.incoming .msg-time { color: var(--text-dim); }

/* Metadata card (suivi règlement) */
.metadata-card {
  background: rgba(0,0,0,.2);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 10px;
  padding: 8px 12px;
  margin-bottom: 6px;
  font-size: 12px;
}
.msg-wrapper.incoming .metadata-card {
  background: rgba(56,189,248,.08);
  border-color: rgba(56,189,248,.25);
}
.meta-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 0;
  color: rgba(255,255,255,.85);
}
.msg-wrapper.incoming .meta-row { color: var(--text-muted); }
.meta-label { font-weight: 600; }
.meta-retard { color: var(--orange); }
.meta-retard-badge {
  display: inline-block;
  background: rgba(249,115,22,.2);
  color: var(--orange);
  border: 1px solid rgba(249,115,22,.3);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 600;
}

/* Attachments */
.attachments-list { margin-top: 6px; display: flex; flex-direction: column; gap: 4px; }
.attachment-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0,0,0,.2);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
}
.attachment-item img {
  max-width: 180px;
  max-height: 160px;
  border-radius: 6px;
  display: block;
}

/* Date separator */
.date-sep {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-dim);
  font-size: 11px;
  margin: 12px 0;
}
.date-sep::before, .date-sep::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ════════════════════════════════════════════════════════
   CLIENT SUIVI PANEL
   ════════════════════════════════════════════════════════ */
.client-suivi-panel {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 12px 14px;
  flex-shrink: 0;
  animation: slideUp .2s ease;
}
.suivi-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}
.suivi-header svg { flex-shrink: 0; }
.suivi-header span { flex: 1; }
.suivi-close {
  width: 24px; height: 24px;
  font-size: 18px;
  line-height: 1;
  color: var(--text-dim);
  display: flex; align-items: center; justify-content: center;
}
.suivi-search { position: relative; margin-bottom: 10px; }
.search-client-wrapper { position: relative; }
.search-client-wrapper input {
  width: 100%;
  padding: 9px 12px 9px 36px;
  font-size: 14px;
}
.search-icon-sm {
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--text-dim);
  pointer-events: none;
}
.client-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  max-height: 200px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: var(--shadow);
}
.client-dd-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.client-dd-item:last-child { border-bottom: none; }
.client-dd-item:hover, .client-dd-item:focus { background: var(--card); }
.client-dd-name { font-size: 14px; font-weight: 500; }
.client-dd-code { font-size: 11px; color: var(--text-dim); }
.client-dd-due { font-size: 11px; color: var(--orange); margin-top: 1px; }
.client-selected {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  background: rgba(56,189,248,.1);
  border: 1px solid rgba(56,189,248,.3);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
}
.balance-badge {
  background: rgba(239,68,68,.15);
  color: var(--red);
  border: 1px solid rgba(239,68,68,.3);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11px;
}
.balance-badge.ok { background: rgba(34,197,94,.1); color: var(--green); border-color: rgba(34,197,94,.3); }
.clear-btn {
  margin-left: auto;
  width: 20px; height: 20px;
  font-size: 16px;
  color: var(--text-dim);
  display: flex; align-items: center; justify-content: center;
}
.suivi-label { font-size: 12px; color: var(--text-muted); display: block; margin-bottom: 6px; }
.invoice-select {
  width: 100%;
  padding: 9px 12px;
  font-size: 13px;
  margin-bottom: 6px;
}
.invoice-details {
  padding: 8px 12px;
  background: rgba(249,115,22,.06);
  border: 1px solid rgba(249,115,22,.2);
  border-radius: var(--radius-sm);
  font-size: 12px;
}
.invoice-details .inv-row {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
  color: var(--text-muted);
}
.invoice-details .inv-row strong { color: var(--text); }
.invoices-section { margin-bottom: 4px; }

/* ════════════════════════════════════════════════════════
   INPUT AREA
   ════════════════════════════════════════════════════════ */
.input-area {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 8px 12px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom, 0));
  flex-shrink: 0;
}
.suivi-toggle-bar {
  padding: 0 0 6px;
  display: flex;
  justify-content: flex-start;
}
.btn-suivi-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--accent);
  background: rgba(56,189,248,.1);
  border: 1px solid rgba(56,189,248,.25);
  border-radius: 16px;
  padding: 5px 12px;
  transition: background var(--transition);
}
.btn-suivi-toggle:hover { background: rgba(56,189,248,.2); }
.input-row { display: flex; align-items: flex-end; gap: 8px; }
.attach-btn { color: var(--text-dim); flex-shrink: 0; }
.text-input-wrapper {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  transition: border-color var(--transition);
}
.text-input-wrapper:focus-within { border-color: var(--accent); }
#msg-input {
  width: 100%;
  background: none;
  border: none;
  padding: 10px 14px;
  font-size: 14px;
  resize: none;
  max-height: 120px;
  line-height: 1.4;
}
#msg-input:focus { box-shadow: none; }
.file-preview {
  padding: 8px 12px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.file-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 11px;
  color: var(--text-muted);
  max-width: 140px;
}
.file-chip-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-chip-remove { cursor: pointer; color: var(--text-dim); margin-left: 2px; }
.send-btn {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--accent);
  color: #0f172a;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background var(--transition), transform var(--transition);
}
.send-btn:hover { background: #7dd3fc; transform: scale(1.05); }
.send-btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.send-btn svg { width: 18px; height: 18px; }

/* Metadata fields */
.meta-fields { padding-bottom: 6px; }
.meta-field-row {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.meta-field-row label {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 3px;
}
.meta-field-row input, .meta-field-row select {
  padding: 7px 10px;
  font-size: 13px;
  flex: 1;
  min-width: 120px;
}

/* ════════════════════════════════════════════════════════
   SEARCH VIEW
   ════════════════════════════════════════════════════════ */
.search-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}
.search-view-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.search-view-header input {
  flex: 1;
  padding: 9px 14px;
  font-size: 15px;
  border-radius: 20px;
}
.search-filters {
  display: flex;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  overflow-x: auto;
}
.search-filters select, .search-filters input {
  flex-shrink: 0;
  padding: 6px 10px;
  font-size: 13px;
  border-radius: var(--radius-sm);
}
.search-results { flex: 1; overflow-y: auto; padding: 8px; }
.search-placeholder { text-align: center; color: var(--text-dim); padding: 40px 20px; font-size: 14px; }
.search-result-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background var(--transition);
}
.search-result-item:hover { background: var(--surface); }
.sr-group-badge {
  display: inline-block;
  background: rgba(56,189,248,.15);
  color: var(--accent);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 6px;
}
.sr-message { font-size: 13px; color: var(--text); margin-bottom: 6px; line-height: 1.4; }
.sr-meta { font-size: 11px; color: var(--text-dim); display: flex; gap: 12px; }

/* ════════════════════════════════════════════════════════
   PROFILE VIEW
   ════════════════════════════════════════════════════════ */
.profile-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
}
.profile-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.profile-header h2 { font-size: 18px; font-weight: 700; }
.profile-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 20px 24px;
  gap: 8px;
  border-bottom: 1px solid var(--border);
}
.profile-avatar {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: var(--accent);
  color: #0f172a;
  font-size: 28px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 8px;
}
.profile-name { font-size: 20px; font-weight: 700; }
.profile-login { font-size: 14px; color: var(--text-muted); }
.badge-admin {
  background: rgba(56,189,248,.15);
  color: var(--accent);
  border: 1px solid rgba(56,189,248,.3);
  border-radius: 20px;
  padding: 3px 12px;
  font-size: 12px;
  font-weight: 600;
  margin-top: 4px;
}
.profile-section { padding: 20px 16px; border-bottom: 1px solid var(--border); }
.profile-section h3 { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 12px; }
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
}
.info-row:last-child { border-bottom: none; }
.info-row span:last-child { color: var(--text-muted); }
.btn-danger {
  background: rgba(239,68,68,.15);
  color: var(--red);
  border: 1px solid rgba(239,68,68,.3);
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  transition: background var(--transition);
}
.btn-danger:hover { background: rgba(239,68,68,.25); }

/* ════════════════════════════════════════════════════════
   CONTEXT MENU
   ════════════════════════════════════════════════════════ */
.context-menu {
  position: fixed;
  z-index: 500;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  overflow: hidden;
  min-width: 140px;
  animation: fadeIn .15s ease;
}
.context-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 16px;
  font-size: 13px;
  color: var(--red);
  transition: background var(--transition);
}
.context-menu button:hover { background: var(--card); }

/* ════════════════════════════════════════════════════════
   TOAST
   ════════════════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  bottom: 80px; left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow);
  animation: fadeIn .3s ease;
  white-space: nowrap;
  pointer-events: auto;
}
.toast.success { border-color: rgba(34,197,94,.4); color: var(--green); }
.toast.error   { border-color: rgba(239,68,68,.4);  color: var(--red); }

/* ════════════════════════════════════════════════════════
   DESKTOP (≥ 768px) — sidebar visible côte à côte
   ════════════════════════════════════════════════════════ */
@media (min-width: 768px) {
  .app-container {
    flex-direction: row;
  }
  .sidebar {
    position: relative;
    transform: none;
    width: 300px;
    min-width: 260px;
    max-width: 340px;
    border-right: 1px solid var(--border);
    flex-shrink: 0;
    z-index: auto;
  }
  .main-area { flex: 1; overflow: hidden; }
  .bottom-nav { display: none; }
  .back-btn { display: none; }
  .toast-container { bottom: 24px; }
  .msg-wrapper { max-width: 65%; }
}

@media (min-width: 1200px) {
  .sidebar { width: 340px; }
  .msg-wrapper { max-width: 55%; }
}

/* ════════════════════════════════════════════════════════
   UTILITIES
   ════════════════════════════════════════════════════════ */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.font-bold { font-weight: 700; }
.mt-2 { margin-top: 8px; }

/* ════════════════════════════════════════════════════════
   MODAL — Création client
   ════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%; max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
  overflow: hidden;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
}
.modal-header h3 { margin: 0; font-size: 16px; color: var(--text-primary); }
.modal-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 22px; line-height: 1;
  padding: 0 4px; border-radius: 6px;
}
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 16px 20px; }
.modal-body .field-group { margin-bottom: 12px; }
.modal-body .field-group label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.modal-body .field-group input {
  width: 100%; padding: 9px 12px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text-primary); font-size: 14px;
  box-sizing: border-box;
}
.modal-body .field-group input:focus { outline: none; border-color: var(--accent); }
.modal-actions {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border);
}
.btn-secondary {
  padding: 9px 18px; border-radius: 10px; font-size: 14px; font-weight: 500;
  background: var(--surface-2, var(--surface)); border: 1px solid var(--border);
  color: var(--text-secondary); cursor: pointer;
}
.btn-secondary:hover { background: var(--bg); }
/* (+) btn next to client search */
.btn-add-client {
  flex-shrink: 0; width: 34px; height: 34px;
  border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 20px; font-weight: 300; line-height: 1;
  transition: background .15s;
}
.btn-add-client:hover { background: var(--accent); color: #fff; }

/* ════════════════════════════════════════════════════════
   PWA Install Banner
   ════════════════════════════════════════════════════════ */
.pwa-install-banner {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 8888;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  box-shadow: 0 -4px 20px rgba(0,0,0,.3);
  animation: slide-up .3s ease;
}
@keyframes slide-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
.pwa-install-icon { flex-shrink: 0; border-radius: 8px; overflow: hidden; }
.pwa-install-text { flex: 1; min-width: 0; }
.pwa-install-text strong { display: block; font-size: 13px; color: var(--text-primary); }
.pwa-install-text span   { font-size: 11px; color: var(--text-muted); }
@media (max-width: 480px) {
  .pwa-install-banner { padding: 10px 12px; gap: 10px; }
}
