* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif; color: #1a1a1a; background: #f4f5f7; }
a { color: #b3431f; text-decoration: none; }
a:hover { text-decoration: underline; }

/* Login */
body.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 1rem; background: linear-gradient(135deg, #1a2332 0%, #0d1822 100%); }
body.login-page main { width: 100%; max-width: 420px; }
.login-card { background: #fff; padding: 2.5rem 2rem; border-radius: 10px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.login-card h1 { margin: 0 0 0.25rem; font-size: 1.6rem; color: #1a2332; }
.login-card .muted { color: #6b7280; margin: 0 0 1.5rem; font-size: 0.92rem; }
.login-card form { display: flex; flex-direction: column; gap: 1rem; }
.login-card label { display: flex; flex-direction: column; gap: 0.35rem; }
.login-card label span { font-size: 0.85rem; color: #4b5563; font-weight: 600; }
.login-card input { padding: 0.7rem 0.8rem; border: 1px solid #d1d5db; border-radius: 6px; font-size: 0.95rem; }
.login-card input:focus { outline: 2px solid #b3431f; outline-offset: -1px; border-color: transparent; }

/* Main layout */
body.has-sidebar { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar { background: #1a2332; color: #e5e7eb; padding: 1.5rem 1rem; display: flex; flex-direction: column; }
.sidebar .brand { display: flex; align-items: center; gap: 0.6rem; padding: 0 0.5rem 1.5rem; border-bottom: 1px solid rgba(255,255,255,0.1); }
.sidebar .brand-mark { width: 36px; height: 36px; border-radius: 8px; background: #b3431f; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.sidebar .brand-name { font-weight: 600; color: #fff; font-size: 0.95rem; }
.sidebar ul { list-style: none; padding: 0; margin: 1rem 0; flex: 1; }
.sidebar li { margin: 0.2rem 0; }
.sidebar a { display: block; padding: 0.7rem 0.9rem; color: #cbd5e1; border-radius: 6px; font-size: 0.92rem; }
.sidebar a:hover { background: rgba(255,255,255,0.08); color: #fff; text-decoration: none; }
.sidebar a.active { background: #b3431f; color: #fff; font-weight: 600; }
.sidebar .logout button { width: 100%; padding: 0.65rem; background: transparent; border: 1px solid rgba(255,255,255,0.2); color: #cbd5e1; border-radius: 6px; cursor: pointer; font-size: 0.88rem; }
.sidebar .logout button:hover { background: rgba(255,255,255,0.08); }

main { padding: 2rem 2.5rem; overflow-x: auto; }

.page-head { margin-bottom: 1.5rem; display: flex; flex-direction: column; gap: 0.5rem; align-items: flex-start; }
.page-head h1 { margin: 0; font-size: 1.75rem; color: #1a2332; line-height: 1.2; }
.page-head .muted, .muted { color: #6b7280; margin: 0; }
.page-head > p, .page-head > .muted { margin: 0; }
.page-head > .search-bar { margin: 0.6rem 0 0; }
.page-head > .btn-primary, .page-head > .header-actions { margin-top: 0.6rem; }
.back-link { display: inline-block; font-size: 0.85rem; color: #6b7280; margin-bottom: 0.2rem; }
@media (min-width: 900px) {
  .page-head { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.8rem 1rem; }
  .page-head > h1 { flex: 0 0 100%; }
  .page-head > .back-link { flex: 0 0 100%; margin-bottom: 0.2rem; }
  .page-head > p.muted { flex: 0 0 100%; margin-bottom: 0.4rem; }
  .page-head > .search-bar, .page-head > .btn-primary, .page-head > .header-actions { margin-top: 0; }
}

.flash { padding: 0.8rem 1rem; border-radius: 6px; margin-bottom: 1rem; font-size: 0.92rem; }
.flash-error { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.flash-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.flash-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: #fff; padding: 1.25rem; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); display: flex; flex-direction: column; gap: 0.3rem; border-left: 3px solid #d1d5db; }
.stat-card.stat-warn { border-left-color: #f59e0b; }
.stat-card.stat-success { border-left-color: #10b981; }
.stat-label { font-size: 0.78rem; color: #6b7280; text-transform: uppercase; letter-spacing: 0.06em; }
.stat-value { font-size: 1.9rem; font-weight: 700; color: #1a2332; font-variant-numeric: tabular-nums; }

.card { background: #fff; padding: 1.5rem; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); margin-bottom: 1.25rem; }
.card h2 { margin: 0 0 1rem; font-size: 1.15rem; color: #1a2332; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.7rem 0.5rem; text-align: left; border-bottom: 1px solid #e5e7eb; font-size: 0.92rem; }
th { font-weight: 600; color: #4b5563; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.04em; }
tbody tr:hover { background: #fafafa; }

.status { display: inline-block; padding: 0.2rem 0.65rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.status-nouveau { background: #fef3c7; color: #92400e; }
.status-en_cours { background: #dbeafe; color: #1e40af; }
.status-traite { background: #d1fae5; color: #065f46; }
.status-archive { background: #e5e7eb; color: #4b5563; }

.filter-bar { display: flex; gap: 0.5rem; margin-top: 0.8rem; flex-wrap: wrap; }
.filter-bar a { padding: 0.35rem 0.85rem; border-radius: 999px; background: #fff; color: #4b5563; font-size: 0.85rem; border: 1px solid #e5e7eb; }
.filter-bar a.active { background: #1a2332; color: #fff; border-color: #1a2332; }
.filter-bar a:hover { text-decoration: none; border-color: #b3431f; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; margin-bottom: 1.25rem; }
@media (max-width: 800px) { .grid-2 { grid-template-columns: 1fr; } }

dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.5rem 1rem; margin: 0; }
dt { font-weight: 600; color: #4b5563; font-size: 0.88rem; }
dd { margin: 0; color: #1a2332; font-size: 0.92rem; word-break: break-word; }
.form-payload { grid-template-columns: max-content 1fr; max-height: 400px; overflow-y: auto; padding-right: 0.5rem; }

.btn-primary { padding: 0.65rem 1.15rem; background: #b3431f; color: #fff; border: none; border-radius: 6px; font-size: 0.92rem; cursor: pointer; font-weight: 600; }
.btn-primary:hover { background: #8d3517; }
.btn-link { background: none; border: none; color: #b3431f; cursor: pointer; font-size: 0.85rem; padding: 0; }
.btn-link:hover { text-decoration: underline; }

form.status-form, form.notes-form, form.slot-form { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 1rem; }
form.status-form { flex-direction: row; align-items: end; flex-wrap: wrap; }
.notes-form textarea { padding: 0.6rem; border: 1px solid #d1d5db; border-radius: 6px; font-family: inherit; font-size: 0.9rem; resize: vertical; }
.slot-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0.75rem; align-items: end; }
.slot-form label { display: flex; flex-direction: column; font-size: 0.82rem; color: #4b5563; font-weight: 600; gap: 0.25rem; }
.slot-form input, .slot-form select, .status-form select { padding: 0.55rem; border: 1px solid #d1d5db; border-radius: 6px; font-size: 0.9rem; }

.day-group { margin: 1rem 0; }
.day-group h3 { font-size: 1rem; color: #4b5563; margin: 0 0 0.5rem; text-transform: capitalize; }
.slot-list { list-style: none; padding: 0; margin: 0; }
.slot { display: flex; align-items: center; gap: 1rem; padding: 0.6rem 0.8rem; background: #fafafa; border-radius: 6px; margin-bottom: 0.3rem; border-left: 3px solid #d1d5db; }
.slot-available { border-left-color: #10b981; }
.slot-booked { border-left-color: #3b82f6; background: #eff6ff; }
.slot-blocked { border-left-color: #6b7280; background: #f3f4f6; opacity: 0.7; }
.slot-time { font-weight: 600; min-width: 140px; }
.slot-status { color: #6b7280; font-size: 0.85rem; }
.slot-note { color: #6b7280; font-style: italic; flex: 1; }
.inline { display: inline; }

/* Nav sections */
.sidebar li.nav-section { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; color: #6b7280; padding: 0.9rem 0.9rem 0.3rem; margin-top: 0.3rem; font-weight: 600; }

/* Page head actions */
.header-actions { display: flex; gap: 0.5rem; align-items: center; margin-top: 0.8rem; flex-wrap: wrap; }
.header-actions form.inline { display: inline; }
.header-actions form.inline select { padding: 0.3rem 0.5rem; border: 1px solid #d1d5db; border-radius: 4px; font-size: 0.85rem; }

/* Generic form-grid */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-grid label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; color: #4b5563; font-weight: 600; }
.form-grid label.full { grid-column: 1 / -1; }
.form-grid input, .form-grid select, .form-grid textarea { padding: 0.55rem 0.7rem; border: 1px solid #d1d5db; border-radius: 6px; font-size: 0.92rem; font-family: inherit; }
.form-grid textarea { resize: vertical; }
.form-grid small { color: #6b7280; font-weight: 400; }
.form-grid fieldset { border: 1px solid #e5e7eb; border-radius: 6px; padding: 0.8rem; }
.form-grid fieldset legend { padding: 0 0.4rem; font-size: 0.85rem; color: #4b5563; font-weight: 600; }
.form-grid .inline-check { flex-direction: row; align-items: center; gap: 0.4rem; margin-right: 1rem; font-weight: 400; }
.form-grid .form-actions { grid-column: 1 / -1; display: flex; gap: 0.8rem; align-items: center; margin-top: 0.5rem; }
.form-grid .full { grid-column: 1 / -1; }
.req { color: #b3431f; font-weight: 700; }

@media (max-width: 700px) { .form-grid { grid-template-columns: 1fr; } }

/* Items tables (devis / factures) */
.items-table { width: 100%; border-collapse: collapse; margin: 0.5rem 0 1rem; }
.items-table th { background: #f4f5f7; text-align: left; padding: 0.5rem 0.6rem; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; color: #4b5563; font-weight: 600; border-bottom: 1px solid #e5e7eb; }
.items-table td { padding: 0.3rem 0.3rem; border-bottom: 1px solid #f3f4f6; }
.items-table input { width: 100%; padding: 0.4rem 0.5rem; border: 1px solid #d1d5db; border-radius: 4px; font-size: 0.88rem; }

table th.num, table td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* API stub notice */
.api-stub-notice { background: #fef3c7; border-left: 4px solid #f59e0b; color: #92400e; }
.api-stub-notice strong { display: block; font-size: 0.92rem; margin-bottom: 0.3rem; }
.api-stub-notice p { margin: 0; font-size: 0.85rem; line-height: 1.5; }

/* Social accounts */
.account-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; margin-top: 1rem; }
.account-card { background: #fafafa; padding: 1.25rem; border-radius: 8px; border: 1px solid #e5e7eb; }
.account-card.connected { background: #ecfdf5; border-color: #a7f3d0; }
.account-card h3 { margin: 0 0 0.3rem; font-size: 1.05rem; }
.account-card .muted { margin: 0.2rem 0; font-size: 0.88rem; }
.account-card form { margin-top: 0.8rem; display: flex; flex-direction: column; gap: 0.5rem; }
.account-card label { font-size: 0.82rem; color: #4b5563; font-weight: 600; display: flex; flex-direction: column; gap: 0.2rem; }
.account-card input { padding: 0.45rem 0.6rem; border: 1px solid #d1d5db; border-radius: 4px; font-size: 0.88rem; }

/* Social posts list */
.post-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.post-item { padding: 0.8rem 1rem; background: #fafafa; border-radius: 6px; border: 1px solid #e5e7eb; }
.post-meta { display: flex; gap: 0.8rem; align-items: center; margin-bottom: 0.3rem; flex-wrap: wrap; font-size: 0.85rem; }
.post-content { margin: 0.3rem 0; white-space: pre-wrap; font-size: 0.92rem; }

/* Quote/invoice status extra */
.status-draft { background: #e5e7eb; color: #4b5563; }
.status-sent { background: #dbeafe; color: #1e40af; }
.status-accepted { background: #d1fae5; color: #065f46; }
.status-rejected { background: #fee2e2; color: #991b1b; }
.status-expired { background: #fef3c7; color: #92400e; }
.status-paid { background: #d1fae5; color: #065f46; }
.status-overdue { background: #fee2e2; color: #991b1b; }
.status-cancelled { background: #e5e7eb; color: #4b5563; }
.status-scheduled { background: #dbeafe; color: #1e40af; }
.status-published { background: #d1fae5; color: #065f46; }
.status-failed { background: #fee2e2; color: #991b1b; }
.status-active { background: #d1fae5; color: #065f46; }
.status-paused { background: #fef3c7; color: #92400e; }
.status-ended { background: #e5e7eb; color: #4b5563; }
.status-success { background: #d1fae5; color: #065f46; }

/* Pièces jointes */
.attachments-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.8rem;
}
.attachment-card {
  background: #fafafa;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.attachment-card img,
.attachment-card video {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  background: #000;
}
.attachment-file {
  padding: 2rem 0.8rem;
  text-align: center;
  color: var(--color-primary, #b3431f);
  text-decoration: none;
  font-size: 0.92rem;
  display: block;
}
.attachment-meta {
  padding: 0.5rem 0.7rem;
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.attachment-meta a { color: #1a2332; text-decoration: none; word-break: break-all; }
.attachment-meta a:hover { text-decoration: underline; }

/* Coûts internes (devis) */
.card-internal { background: #fffaf5; border-left: 3px solid #b3431f; }
.card-internal h2 { color: #b3431f; }
.margin-panel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 1.25rem;
  padding: 1rem;
  background: #fff;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
}
.margin-metric { display: flex; flex-direction: column; gap: 0.2rem; }
.margin-metric .label { font-size: 0.78rem; color: #6b7280; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.margin-metric .value { font-size: 1.4rem; font-weight: 700; color: #1a2332; font-variant-numeric: tabular-nums; }
.margin-metric.positive .value { color: #10b981; }
.margin-metric.negative .value { color: #ef4444; }
.margin-metric small { font-size: 0.85rem; color: #6b7280; font-weight: 500; }
@media (max-width: 700px) { .margin-panel { grid-template-columns: 1fr; } }

/* Onglets agenda */
.calendar-tabs { display: flex; gap: 0.3rem; margin-top: 0.8rem; flex-wrap: wrap; }
.cal-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  border-radius: 6px;
  background: #fff;
  border: 1px solid #e5e7eb;
  color: #4b5563;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}
.cal-tab:hover { border-color: var(--tab-color, #b3431f); text-decoration: none; }
.cal-tab.active { background: var(--tab-color, #b3431f); color: #fff; border-color: var(--tab-color, #b3431f); }
.cal-tab-icon { font-size: 1.05rem; }

/* Comptes externes */
.external-list { list-style: none; padding: 0; margin: 0; }
.external-item {
  display: grid;
  grid-template-columns: 1fr 1.5fr auto auto;
  gap: 1rem;
  align-items: center;
  padding: 0.55rem 0.75rem;
  background: #fafafa;
  border-radius: 6px;
  margin-bottom: 0.3rem;
  font-size: 0.9rem;
}
.external-item .provider { font-weight: 600; }

/* Quote editor (live JS form) */
.quote-editor { margin-top: 1.5rem; display: flex; flex-direction: column; gap: 1rem; }
.line-card {
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 1.25rem;
  background: #fff;
}
.line-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.8rem; }
.line-head h4 { margin: 0; font-size: 1.05rem; color: #1a2332; }
.line-main {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 0.8rem;
  margin-bottom: 1rem;
}
.line-main label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.82rem; color: #4b5563; font-weight: 600; }
.line-main label.full { grid-column: 1 / -1; }
.line-main input {
  padding: 0.5rem 0.65rem;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 0.9rem;
}
.line-costs {
  background: #fffaf5;
  border: 1px solid #fde68a;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.8rem;
}
.line-costs summary { cursor: pointer; font-weight: 600; color: #92400e; padding: 0.3rem 0; }
.line-costs summary:hover { color: #78350f; }
.cost-rows { display: flex; flex-direction: column; gap: 0.4rem; margin: 0.6rem 0; }
.cost-row {
  display: grid;
  grid-template-columns: 110px 170px 1fr 70px 100px 90px 30px;
  gap: 0.4rem;
  align-items: center;
  padding: 0.35rem;
  background: #fff;
  border-radius: 4px;
  font-size: 0.85rem;
}
.cost-row input, .cost-row select {
  padding: 0.35rem 0.45rem;
  border: 1px solid #d1d5db;
  border-radius: 3px;
  font-size: 0.82rem;
  width: 100%;
}
.cost-row .cost-total { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; color: #1a2332; }
.cost-add-actions {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px dashed #fde68a;
}
.line-pricing {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  gap: 0.8rem;
  align-items: end;
  padding: 0.8rem;
  background: #f0f9ff;
  border-radius: 6px;
  border: 1px solid #bfdbfe;
}
.line-pricing label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.82rem; color: #1e40af; font-weight: 600; }
.line-pricing input {
  padding: 0.5rem 0.65rem;
  border: 1px solid #bfdbfe;
  border-radius: 4px;
  font-size: 0.9rem;
}
.line-pricing .suggested-price {
  font-size: 0.88rem;
  color: #1e40af;
  padding-bottom: 0.5rem;
}
.line-summary {
  grid-column: 1 / -1;
  padding-top: 0.5rem;
  font-size: 0.88rem;
  border-top: 1px solid #bfdbfe;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.line-summary .positive { color: #10b981; }
.line-summary .negative { color: #ef4444; }
.add-line-btn { margin-top: 0.5rem; align-self: flex-start; }

/* Totals summary below editor */
.quote-totals {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1.25rem;
  margin-top: 1.5rem;
}
.quote-totals .totals-row {
  display: flex;
  justify-content: space-between;
  padding: 0.3rem 0;
  font-size: 0.95rem;
}
.quote-totals .totals-row.big { font-size: 1.1rem; font-weight: 700; border-top: 2px solid #1a2332; padding-top: 0.6rem; margin-top: 0.3rem; }
.quote-totals .totals-internal {
  margin-top: 0.8rem;
  padding-top: 0.8rem;
  border-top: 2px dashed #fde68a;
  background: #fffaf5;
  margin-left: -1.25rem;
  margin-right: -1.25rem;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
  padding-bottom: 1rem;
  margin-bottom: -1.25rem;
  border-radius: 0 0 8px 8px;
}
.quote-totals .totals-row.muted { color: #92400e; }
.quote-totals .totals-row.positive strong { color: #10b981; }
.quote-totals .totals-row.negative strong { color: #ef4444; }

/* Line cost detail (on quote view) */
.line-cost-detail {
  border-top: 1px solid #e5e7eb;
  padding-top: 0.8rem;
  margin-top: 0.8rem;
}
.line-cost-detail:first-of-type { border-top: none; margin-top: 0; padding-top: 0; }
.line-cost-detail h4 { margin: 0 0 0.5rem; font-size: 0.98rem; color: #1a2332; }
.line-cost-detail .positive { color: #10b981; }
.line-cost-detail .negative { color: #ef4444; }

/* Aide (section tuto) */
.help-block {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  margin-bottom: 1.25rem;
  overflow: hidden;
}
.help-toggle {
  width: 100%;
  padding: 0.7rem 1rem;
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  font-size: 0.9rem;
  color: #1e40af;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.help-toggle::before { content: '?'; display: inline-flex; width: 22px; height: 22px; background: #3b82f6; color: #fff; border-radius: 50%; align-items: center; justify-content: center; font-weight: 700; margin-right: 0.6rem; }
.help-toggle[aria-expanded="true"]::after { content: '−'; font-size: 1.3rem; line-height: 1; }
.help-toggle[aria-expanded="false"]::after { content: '+'; font-size: 1.3rem; line-height: 1; }
.help-toggle:hover { background: rgba(59, 130, 246, 0.08); }
.help-content {
  padding: 1rem 1.25rem 1.25rem;
  border-top: 1px solid #bfdbfe;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  align-items: start;
}
.help-content[hidden] { display: none; }
.help-text p { margin: 0; font-size: 0.92rem; line-height: 1.5; color: #1e3a8a; }
.help-video { position: relative; padding-top: 56.25%; background: #000; border-radius: 6px; overflow: hidden; }
.help-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.help-video-placeholder { background: #f3f4f6; border: 2px dashed #d1d5db; border-radius: 6px; padding: 2rem; text-align: center; }
@media (max-width: 700px) {
  .help-content { grid-template-columns: 1fr; }
}

/* Barre de recherche */
.search-bar {
  display: inline-flex;
  gap: 0.3rem;
  margin-right: 0.8rem;
}
.search-bar input[type="search"] {
  padding: 0.55rem 0.8rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.9rem;
  min-width: 260px;
}
.search-bar button { padding: 0.55rem 0.9rem; }
@media (max-width: 560px) {
  .search-bar { width: 100%; margin-top: 0.5rem; }
  .search-bar input[type="search"] { min-width: 0; flex: 1; }
}

/* Statuts projets */
.status-prevu { background: #e5e7eb; color: #4b5563; }
.status-en_cours { background: #dbeafe; color: #1e40af; }
.status-termine { background: #d1fae5; color: #065f46; }
.status-suspendu { background: #fee2e2; color: #991b1b; }

/* Section acompte sur fiche devis */
.deposit-info {
  background: #fff;
  border: 1px solid #fde68a;
  border-radius: 6px;
  padding: 0.9rem 1.1rem;
  margin-top: 0.8rem;
}
.deposit-info-row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.35rem 0;
}
.deposit-info-row:not(:last-child) { border-bottom: 1px dashed #fde68a; }
.deposit-info-row .label {
  color: #6b7280;
  min-width: 220px;
  font-size: 0.9rem;
}
.paid-notice {
  margin-top: 1rem;
  padding: 0.8rem 1rem;
  background: #d1fae5;
  border-radius: 6px;
  color: #065f46;
  font-size: 0.92rem;
}

/* Tabs (settings) */
.tabs { display: flex; gap: 0.3rem; border-bottom: 2px solid #e5e7eb; padding-bottom: 0; }
.tabs a { padding: 0.6rem 1rem; color: #6b7280; text-decoration: none; font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -2px; font-size: 0.92rem; }
.tabs a:hover { color: #1a2332; }
.tabs a.tab-active { color: #b3431f; border-bottom-color: #b3431f; }

/* Qualifications */
.qualif-list { list-style: none; padding: 0; margin: 0; }
.qualif-item { display: flex; justify-content: space-between; gap: 1rem; padding: 0.7rem 0.9rem; background: #fafafa; border-radius: 6px; margin-bottom: 0.3rem; align-items: center; }
.qualif-item .qualif-main { font-size: 0.92rem; }

/* Pricing editor */
.pricing-service-block {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 0.8rem 1rem;
  margin-bottom: 0.6rem;
}
.pricing-service-block summary { cursor: pointer; font-weight: 600; padding: 0.3rem 0; color: #1a2332; }
.pricing-service-block[open] { border-color: #b3431f; }
.pricing-params {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.8rem;
  margin-top: 0.8rem;
}
.pricing-param { display: flex; flex-direction: column; gap: 0.25rem; }
.pricing-label { font-size: 0.85rem; font-weight: 600; color: #4b5563; }
.pricing-input-row { display: flex; align-items: center; gap: 0.4rem; }
.pricing-input-row input {
  flex: 1;
  padding: 0.5rem 0.65rem;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}
.pricing-unit { font-size: 0.85rem; color: #6b7280; min-width: 45px; }

/* Simulateur */
.sim-result {
  margin-top: 1.5rem;
  padding: 1rem;
  background: #eff6ff;
  border-left: 3px solid #3b82f6;
  border-radius: 6px;
}
.sim-result h3 { margin-top: 0; color: #1e40af; }

/* Équipe */
.team-assignments { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.team-assignment {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.7rem 0.9rem;
  background: #fafafa;
  border-radius: 6px;
  border-left: 3px solid #b3431f;
}
.team-assignment small { color: #6b7280; }

/* Emailing */
.email-template-block {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 0.8rem 1rem;
  margin-bottom: 0.6rem;
}
.email-template-block summary { cursor: pointer; padding: 0.3rem 0; }
.email-template-block textarea {
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.88rem;
  padding: 0.7rem;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  width: 100%;
  resize: vertical;
}

.recipients-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 0.5rem;
}
.recipients-list {
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 0.5rem;
}
.recipient-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.9rem;
}
.recipient-item:hover { background: #f3f4f6; }
.recipient-item.disabled { opacity: 0.5; cursor: not-allowed; }
.recipient-item input[type="checkbox"] { margin: 0; }

@media (max-width: 800px) {
  .line-main { grid-template-columns: 1fr; }
  .line-pricing { grid-template-columns: 1fr; }
  .cost-row { grid-template-columns: 1fr 1fr; gap: 0.3rem; }
}

/* ═════════════════════════════════════════════════════════════════════════
   DASHBOARD 2.0 — KPI row + action grid
   ═════════════════════════════════════════════════════════════════════════ */

.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.kpi-card {
  background: #fff;
  padding: 1.1rem 1.25rem;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  border-top: 3px solid #d1d5db;
  position: relative;
  transition: transform 0.15s;
}
.kpi-card:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.kpi-card.kpi-primary { border-top-color: #b3431f; background: linear-gradient(180deg, #fff 0%, #fff7f3 100%); }
.kpi-card.kpi-success { border-top-color: #10b981; }
.kpi-card.kpi-alert { border-top-color: #ef4444; background: linear-gradient(180deg, #fff 0%, #fef2f2 100%); }
.kpi-label { font-size: 0.75rem; color: #6b7280; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.kpi-value { font-size: 1.9rem; font-weight: 700; color: #1a2332; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi-trend { font-size: 0.8rem; color: #6b7280; }

.dash-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
}
@media (max-width: 980px) { .dash-grid { grid-template-columns: 1fr; } }

.dash-card {
  background: #fff;
  border-radius: 10px;
  padding: 1.25rem 1.4rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-height: 520px;
  overflow: hidden;
}
.dash-card .appointment-list,
.dash-card .relance-list,
.dash-card .project-list,
.dash-card .purchase-list,
.dash-card .recent-list {
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
}
.dash-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.dash-card-head h2 { margin: 0; font-size: 1.05rem; color: #1a2332; display: flex; align-items: center; gap: 0.4rem; }
.dash-icon { font-size: 1.1em; }
.dash-link { font-size: 0.82rem; color: #b3431f; font-weight: 500; }
.dash-link:hover { text-decoration: underline; }
.dash-empty { margin: 0; padding: 1rem 0; text-align: center; color: #9ca3af; font-size: 0.9rem; }

/* Appointments */
.appointment-list, .relance-list, .project-list, .purchase-list, .recent-list {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 0.6rem;
}
.appointment-item {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  align-items: center;
  gap: 0.8rem;
  padding: 0.65rem 0.8rem;
  border-left: 3px solid var(--cal-color, #b3431f);
  background: #fafafa;
  border-radius: 6px;
}
.appointment-date {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  line-height: 1.1;
}
.appointment-day { font-size: 0.75rem; color: #6b7280; text-transform: capitalize; }
.appointment-time { font-size: 0.95rem; font-weight: 700; color: #1a2332; font-variant-numeric: tabular-nums; }
.appointment-body { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.appointment-type { font-size: 0.72rem; color: var(--cal-color); font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.appointment-title { font-weight: 600; color: #1a2332; font-size: 0.92rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appointment-client { font-size: 0.8rem; color: #6b7280; }
.appointment-when { font-size: 0.78rem; color: #6b7280; font-style: italic; white-space: nowrap; }

/* Marketing chart */
.dash-marketing { min-height: 0; }
.dash-marketing .chart-wrap {
  position: relative;
  height: 240px;
  width: 100%;
  margin-top: 0.5rem;
}
.dash-marketing canvas { display: block; }
.marketing-kpi-row {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; margin-bottom: 0.75rem;
}
.marketing-kpi-row > div { background: #f9fafb; padding: 0.6rem 0.8rem; border-radius: 6px; display: flex; flex-direction: column; gap: 0.15rem; }
.mk-label { font-size: 0.72rem; color: #6b7280; text-transform: uppercase; letter-spacing: 0.04em; }
.mk-value { font-size: 1.25rem; font-weight: 700; color: #1a2332; }

/* Relances */
.relance-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center; gap: 0.7rem;
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
}
.relance-item.relance-invoice { background: #fef2f2; border-color: #fecaca; }
.relance-tag {
  font-size: 0.68rem;
  background: #fff;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #92400e;
  border: 1px solid #fed7aa;
}
.relance-item.relance-invoice .relance-tag { color: #991b1b; border-color: #fecaca; }
.relance-body { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; font-size: 0.88rem; }
.relance-body strong { color: #1a2332; }
.relance-body .muted { font-size: 0.78rem; }
.relance-action { font-size: 0.82rem; color: #b3431f; font-weight: 500; white-space: nowrap; }

/* Projects */
.project-item {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  align-items: center; gap: 0.8rem;
  padding: 0.65rem 0.8rem;
  border-radius: 6px;
  background: #faf5ff;
  border: 1px solid #e9d5ff;
}
.project-date {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: #fff; border-radius: 6px; padding: 0.3rem;
  border: 1px solid #e9d5ff;
}
.project-day-num { font-size: 1.15rem; font-weight: 700; color: #6d28d9; line-height: 1; }
.project-day-month { font-size: 0.68rem; color: #6b7280; text-transform: uppercase; }
.project-body { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; font-size: 0.88rem; }
.project-countdown { font-size: 0.78rem; color: #6d28d9; font-weight: 600; white-space: nowrap; }

/* Purchases */
.purchase-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center; gap: 0.7rem;
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}
.purchase-body { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; font-size: 0.88rem; }
.purchase-body strong { color: #1a2332; }
.purchase-body .muted { font-size: 0.78rem; }
.purchase-date { font-size: 0.78rem; color: #065f46; font-weight: 500; white-space: nowrap; }
.purchase-action { font-size: 0.82rem; color: #b3431f; font-weight: 500; white-space: nowrap; }

/* Recent */
.recent-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center; gap: 0.7rem;
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  background: #fafafa;
}
.recent-body { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; font-size: 0.88rem; }
.recent-body strong { color: #1a2332; }
.recent-action { font-size: 0.82rem; color: #b3431f; font-weight: 500; white-space: nowrap; }

/* ═════════════════════════════════════════════════════════════════════════
   AGENDA 2.0 — Multi-view calendar
   ═════════════════════════════════════════════════════════════════════════ */

.agenda-toolbar { padding: 1rem 1.25rem; margin-bottom: 1rem; }
.agenda-toolbar-row {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.agenda-toolbar-row + .agenda-toolbar-row { margin-top: 0.9rem; padding-top: 0.9rem; border-top: 1px solid #e5e7eb; }

.agenda-view-switch { display: inline-flex; background: #f3f4f6; border-radius: 8px; padding: 3px; gap: 2px; }
.view-btn {
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  color: #4b5563;
  font-size: 0.85rem;
  font-weight: 500;
}
.view-btn:hover { background: #fff; color: #1a2332; text-decoration: none; }
.view-btn.active { background: #1a2332; color: #fff; }
.view-btn.active:hover { background: #1a2332; color: #fff; }

.agenda-nav { display: inline-flex; align-items: center; gap: 0.4rem; }
.nav-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 34px;
  padding: 0 0.7rem;
  background: #fff; border: 1px solid #e5e7eb; border-radius: 6px;
  color: #374151; font-size: 1rem; font-weight: 500;
}
.nav-btn:hover { background: #f9fafb; border-color: #b3431f; text-decoration: none; color: #b3431f; }
.nav-btn.nav-today { font-size: 0.82rem; padding: 0 0.9rem; }
.agenda-title { margin-left: 0.6rem; font-size: 1rem; color: #1a2332; font-weight: 600; text-transform: capitalize; }

.calendar-toggles { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.cal-toggle {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.3rem 0.7rem;
  background: #fff; border: 1px solid #e5e7eb; border-radius: 999px;
  cursor: pointer; font-size: 0.85rem; color: #374151;
  transition: all 0.15s;
}
.cal-toggle:has(input:checked) { background: color-mix(in srgb, var(--cal-color) 10%, #fff); border-color: var(--cal-color); color: var(--cal-color); }
.cal-toggle input { display: none; }
.cal-toggle .cal-dot {
  display: inline-block;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--cal-color); border: 2px solid var(--cal-color);
}
.cal-toggle:not(:has(input:checked)) .cal-dot { background: transparent; }
.cal-label { white-space: nowrap; }

.agenda-view-card { padding: 0; overflow: hidden; }

/* Day + Week shared */
.cal-hour-label {
  font-size: 0.72rem; color: #9ca3af; font-variant-numeric: tabular-nums;
  padding: 0.4rem 0.6rem; text-align: right; background: #fafafa;
  border-right: 1px solid #e5e7eb;
}
.calendar-day .cal-day-grid { display: grid; grid-template-columns: 1fr; }
.calendar-day .cal-day-row {
  display: grid; grid-template-columns: 70px 1fr;
  border-bottom: 1px solid #f3f4f6;
  min-height: 60px;
}
.calendar-day .cal-hour-cell { padding: 0.35rem; display: flex; flex-direction: column; gap: 0.25rem; }

/* Week view */
.calendar-week { display: flex; flex-direction: column; }
.cal-week-header {
  display: grid; grid-template-columns: 70px repeat(7, 1fr);
  position: sticky; top: 0; background: #fff; z-index: 2;
  border-bottom: 1px solid #e5e7eb;
}
.cal-week-corner { background: #fafafa; border-right: 1px solid #e5e7eb; }
.cal-week-day {
  padding: 0.5rem 0.3rem; text-align: center;
  border-left: 1px solid #f3f4f6;
  display: flex; flex-direction: column; gap: 0.1rem;
}
.cal-week-day.today { background: #fef3c7; }
.cal-week-dow { font-size: 0.72rem; color: #6b7280; text-transform: uppercase; letter-spacing: 0.04em; }
.cal-week-num { font-size: 1.1rem; font-weight: 700; color: #1a2332; }
.cal-week-body { display: flex; flex-direction: column; }
.cal-week-row {
  display: grid; grid-template-columns: 70px repeat(7, 1fr);
  min-height: 44px; border-bottom: 1px solid #f3f4f6;
}
.cal-week-cell {
  border-left: 1px solid #f3f4f6;
  padding: 2px 3px;
  display: flex; flex-direction: column; gap: 2px;
  overflow: hidden;
}

/* Month view */
.calendar-month { display: flex; flex-direction: column; }
.cal-month-header {
  display: grid; grid-template-columns: repeat(7, 1fr);
  background: #fafafa; border-bottom: 1px solid #e5e7eb;
}
.cal-month-dow {
  padding: 0.5rem 0.3rem; text-align: center;
  font-size: 0.75rem; color: #6b7280; text-transform: uppercase; letter-spacing: 0.04em;
  border-left: 1px solid #f3f4f6; font-weight: 600;
}
.cal-month-dow:first-child { border-left: none; }
.cal-month-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); grid-auto-rows: minmax(95px, auto);
}
.cal-month-cell {
  border-left: 1px solid #f3f4f6; border-bottom: 1px solid #f3f4f6;
  padding: 0.35rem;
  display: flex; flex-direction: column; gap: 0.25rem;
  min-height: 95px;
  overflow: hidden;
}
.cal-month-cell:nth-child(7n+1) { border-left: none; }
.cal-month-cell.other-month { background: #fafafa; color: #d1d5db; }
.cal-month-cell.other-month .cal-month-num { color: #d1d5db; }
.cal-month-cell.today { background: #fef3c7; }
.cal-month-cell.today .cal-month-num {
  background: #b3431f; color: #fff;
  width: 26px; height: 26px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
}
.cal-month-num { font-size: 0.82rem; font-weight: 600; color: #374151; }
.cal-month-events { display: flex; flex-direction: column; gap: 2px; min-height: 0; }
.cal-month-more { font-size: 0.7rem; color: #6b7280; padding: 0 0.2rem; }

/* Year view */
.calendar-year {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.25rem;
  padding: 1.25rem;
}
@media (max-width: 900px) { .calendar-year { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px) { .calendar-year { grid-template-columns: 1fr; } }
.year-month { display: flex; flex-direction: column; gap: 0.4rem; }
.year-month-title {
  font-size: 0.95rem; font-weight: 700; color: #1a2332; text-transform: uppercase;
  padding: 0.3rem 0.4rem; border-radius: 4px;
}
.year-month-title:hover { background: #f3f4f6; text-decoration: none; }
.year-month-header {
  display: grid; grid-template-columns: repeat(7, 1fr);
  padding: 0 0.1rem;
}
.yc-dow { font-size: 0.65rem; color: #9ca3af; text-align: center; font-weight: 600; }
.year-month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; }
.yc-cell {
  aspect-ratio: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 0.72rem; color: #374151;
  border-radius: 3px;
  padding: 2px; gap: 1px;
  position: relative;
}
.yc-cell:hover:not(.yc-empty) { background: #f3f4f6; text-decoration: none; color: #1a2332; }
.yc-cell.yc-empty { background: transparent; cursor: default; }
.yc-cell.yc-today { background: #b3431f; color: #fff; font-weight: 700; }
.yc-cell.yc-today:hover { background: #8d3517; color: #fff; }
.yc-cell.yc-has { font-weight: 600; }
.yc-dot {
  position: absolute;
  bottom: 1px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 4px; border-radius: 50%;
}

/* Event chip */
.event-chip {
  --event-color: #6b7280;
  display: flex; flex-direction: column; gap: 1px;
  padding: 3px 6px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--event-color) 12%, #fff);
  border-left: 3px solid var(--event-color);
  color: #1a2332;
  font-size: 0.78rem;
  line-height: 1.2;
  overflow: hidden;
  text-decoration: none;
  cursor: pointer;
}
.event-chip:hover { background: color-mix(in srgb, var(--event-color) 22%, #fff); text-decoration: none; }
.event-chip.event-chip-blocked { opacity: 0.5; background: repeating-linear-gradient(45deg, #f3f4f6, #f3f4f6 4px, #e5e7eb 4px, #e5e7eb 8px); border-left-color: #9ca3af; }
.event-chip .chip-time { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--event-color); font-size: 0.72rem; }
.event-chip .chip-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.event-chip .chip-client { font-size: 0.72rem; color: #6b7280; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.event-chip .chip-note { font-size: 0.72rem; color: #6b7280; }
.event-chip-mini { flex-direction: row; align-items: center; gap: 3px; padding: 2px 4px; font-size: 0.72rem; }
.event-chip-mini .chip-icon { flex-shrink: 0; font-size: 0.72rem; }
.event-chip-mini .chip-title { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.event-chip-small { flex-direction: column; gap: 0; padding: 2px 4px; font-size: 0.72rem; }
.event-chip-small .chip-time { font-size: 0.7rem; }
.event-chip-small .chip-title { font-size: 0.72rem; }
.event-chip-large { padding: 0.5rem 0.7rem; font-size: 0.88rem; }
.event-chip-large .chip-time { font-size: 0.8rem; }
.event-chip-large .chip-title { font-size: 0.92rem; white-space: normal; }

.api-stub-notice {
  margin-top: 0.8rem; padding: 0.7rem 1rem;
  background: #fef3c7; border-left: 3px solid #f59e0b;
  border-radius: 4px; font-size: 0.82rem; color: #78350f;
}

/* ═════════════════════════════════════════════════════════════════════════
   CLIENT PICKER — typeahead combobox
   ═════════════════════════════════════════════════════════════════════════ */
.client-picker { position: relative; }
.client-picker .client-search {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.92rem;
  background: #fff;
}
.client-picker .client-search:focus { outline: 2px solid #b3431f; outline-offset: -1px; border-color: transparent; }
.client-suggest {
  position: absolute;
  top: calc(100% + 2px);
  left: 0; right: 0;
  list-style: none; margin: 0; padding: 0;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  max-height: 300px;
  overflow-y: auto;
  z-index: 50;
}
.client-suggest li {
  padding: 0.55rem 0.8rem;
  display: flex; align-items: center; gap: 0.6rem;
  cursor: pointer;
  border-bottom: 1px solid #f3f4f6;
  font-size: 0.88rem;
}
.client-suggest li:last-child { border-bottom: none; }
.client-suggest li:hover { background: #fff7f3; }
.client-suggest .cp-name { font-weight: 600; color: #1a2332; }
.client-suggest .cp-meta { color: #6b7280; font-size: 0.82rem; }
.client-suggest-empty { color: #6b7280; padding: 0.8rem !important; justify-content: center; cursor: default; }
.client-suggest-empty:hover { background: transparent !important; }

.deposit-badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  background: #d1fae5;
  color: #065f46;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
}

.trajet-chip {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  background: #dbeafe;
  color: #1e40af;
  border-radius: 4px;
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
}

.trajet-banner {
  margin: 0 0 1.25rem;
  padding: 0.7rem 1rem;
  background: #eff6ff;
  border-left: 3px solid #3b82f6;
  border-radius: 6px;
  font-size: 0.92rem;
  color: #1e40af;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.trajet-banner.trajet-banner-missing {
  background: #fef3c7;
  border-left-color: #f59e0b;
  color: #92400e;
}
.trajet-banner .btn-link { color: inherit; font-weight: 600; }

/* Purchases per-project — simplified stacked layout */
.purchases-intro { background: #f9fafb; border-left: 3px solid #b3431f; }
.purchases-intro h2 { font-size: 1rem; margin: 0 0 0.6rem; }
.purchases-steps { margin: 0; padding-left: 1.2rem; font-size: 0.9rem; color: #374151; }
.purchases-steps li { margin: 0.3rem 0; }

.purchase-project-card { padding: 0; overflow: hidden; }
.ppc-head {
  padding: 1rem 1.4rem;
  background: #fafafa;
  border-bottom: 1px solid #e5e7eb;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem 1.5rem;
  align-items: center;
}
.ppc-head h2 { margin: 0; font-size: 1.1rem; grid-column: 1; }
.ppc-head h2 a { color: #1a2332; }
.ppc-head h2 a:hover { color: #b3431f; text-decoration: none; }
.ppc-meta { grid-column: 1; font-size: 0.85rem; color: #6b7280; }
.ppc-totals {
  grid-column: 2; grid-row: 1 / span 2;
  display: flex; gap: 1.5rem;
}
.ppc-total { display: flex; flex-direction: column; gap: 0.15rem; text-align: right; }
.ppc-total .muted { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; }
.ppc-total strong { font-size: 1.05rem; color: #1a2332; font-variant-numeric: tabular-nums; }
.ppc-total.ppc-warn strong { color: #ef4444; }

@media (max-width: 700px) {
  .ppc-head { grid-template-columns: 1fr; }
  .ppc-totals { grid-column: 1; grid-row: auto; }
}

.ppc-section { padding: 1rem 1.4rem; }
.ppc-section + .ppc-section { border-top: 1px solid #f3f4f6; }
.ppc-section-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; margin-bottom: 0.8rem;
}
.ppc-section-head h3 { margin: 0; font-size: 0.95rem; color: #1a2332; }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.82rem; }

.ppc-table-wrap { overflow-x: auto; }
.ppc-table-wrap table { font-size: 0.88rem; }
.invoices-table th, .invoices-table td { white-space: nowrap; }
.invoices-table td:first-child { white-space: normal; }

.ppc-upload-form {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1rem;
}
.ppc-upload-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.6rem 0.8rem;
  margin-bottom: 0.8rem;
}
.ppc-upload-form label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.82rem; color: #4b5563; font-weight: 600; }
.ppc-upload-form label.full { grid-column: 1 / -1; }
.ppc-upload-form input, .ppc-upload-form textarea { padding: 0.5rem 0.6rem; border: 1px solid #d1d5db; border-radius: 6px; font-size: 0.88rem; background: #fff; }
.ppc-upload-form textarea { resize: vertical; font-family: inherit; }
.ppc-upload-form .form-actions { margin-top: 0.6rem; }

/* Services choisis — grille photos avant/après */
.services-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 1.25rem; margin-bottom: 2rem; }
.service-card { padding: 1.25rem 1.4rem; }
.service-card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.8rem; padding-bottom: 0.6rem; border-bottom: 1px solid #f3f4f6; }
.service-card-head h3 { margin: 0; font-size: 1rem; color: #1a2332; }
.service-card-head code { font-size: 0.75rem; background: #f3f4f6; padding: 0.1rem 0.4rem; border-radius: 3px; }
.service-slug { display: inline-block; font-size: 0.7rem; background: #f3f4f6; padding: 0.1rem 0.4rem; border-radius: 3px; margin-bottom: 0.7rem; color: #6b7280; }

/* Visibility toggle */
.service-toggle {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: none; border: none; padding: 0.2rem 0;
  cursor: pointer; font-size: 0.82rem; font-weight: 600;
}
.service-toggle .toggle-track {
  position: relative;
  width: 36px; height: 20px;
  background: #d1d5db; border-radius: 999px;
  transition: background 0.15s;
}
.service-toggle .toggle-thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: #fff; border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
  transition: transform 0.15s;
}
.service-toggle.is-visible .toggle-track { background: #10b981; }
.service-toggle.is-visible .toggle-thumb { transform: translateX(16px); }
.service-toggle.is-visible .toggle-label { color: #10b981; }
.service-toggle.is-hidden .toggle-label { color: #9ca3af; }
.service-toggle:hover .toggle-track { opacity: 0.85; }

.service-card-hidden { opacity: 0.6; background: #fafafa; }
.service-card-hidden .service-photo img { filter: grayscale(0.6); }

/* Infos site form */
.infos-form h2 { font-size: 1rem; margin: 0 0 0.7rem; padding-bottom: 0.4rem; border-bottom: 1px solid #f3f4f6; }
.infos-form textarea { font-family: inherit; padding: 0.6rem; border: 1px solid #d1d5db; border-radius: 6px; resize: vertical; font-size: 0.92rem; width: 100%; }
.infos-form input[type=tel], .infos-form input[type=number], .infos-form input[type=text] { padding: 0.55rem 0.7rem; border: 1px solid #d1d5db; border-radius: 6px; font-size: 0.92rem; }

/* FAQ */
.faq-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.8rem; }
.faq-item {
  background: #fafafa;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1rem;
}
.faq-edit-form { display: flex; flex-direction: column; gap: 0.6rem; }
.faq-edit-form label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.82rem; color: #4b5563; font-weight: 600; }
.faq-edit-form input, .faq-edit-form textarea { padding: 0.55rem 0.7rem; border: 1px solid #d1d5db; border-radius: 6px; font-size: 0.92rem; font-family: inherit; background: #fff; }
.faq-edit-form textarea { resize: vertical; }
.faq-item-head { display: flex; align-items: center; gap: 1rem; }
.faq-num { font-size: 0.85rem; font-weight: 700; color: #b3431f; }
.faq-order { flex-direction: row !important; align-items: center; gap: 0.4rem !important; font-size: 0.75rem !important; }
.faq-order input { width: 60px; padding: 0.3rem 0.5rem !important; }

.faq-suggestions { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid #f3f4f6; }
.faq-suggestions h3 { font-size: 0.9rem; margin: 0 0 0.4rem; color: #1a2332; }
.faq-suggestion-list {
  list-style: none; padding: 0; margin: 0.8rem 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.6rem;
}
.faq-suggestion-card {
  display: flex; flex-direction: column; gap: 0.35rem;
  width: 100%;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
  text-align: left;
  font: inherit;
  color: #374151;
  cursor: pointer;
  transition: all 0.15s;
}
.faq-suggestion-card:hover {
  border-color: #b3431f;
  background: #fff7f3;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(179,67,31,0.08);
}
.faq-suggestion-card strong {
  color: #1a2332;
  font-size: 0.88rem;
}
.faq-suggestion-card:hover strong { color: #b3431f; }
.faq-suggestion-preview {
  font-size: 0.78rem;
  color: #6b7280;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.service-photos { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; }
.service-photo {
  display: flex; flex-direction: column; gap: 0.4rem;
  background: #fafafa;
  border-radius: 6px;
  padding: 0.6rem;
  min-height: 180px;
  position: relative;
}
.service-photo-label {
  font-size: 0.72rem; font-weight: 700;
  color: #ef4444; text-transform: uppercase; letter-spacing: 0.05em;
}
.service-photo-label-after { color: #10b981; }
.service-photo img {
  width: 100%; aspect-ratio: 4/3;
  object-fit: cover;
  border-radius: 4px;
  display: block;
}
.service-photo-upload { display: flex; flex-direction: column; gap: 0.5rem; flex: 1; }
.service-photo .drop-zone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  flex: 1; min-height: 130px;
  border: 2px dashed #d1d5db;
  border-radius: 4px;
  padding: 1rem;
  text-align: center;
  cursor: pointer;
  font-size: 0.82rem;
  color: #6b7280;
  transition: all 0.15s;
}
.service-photo .drop-zone:hover { border-color: #b3431f; background: #fff7f3; color: #b3431f; }
.service-photo .drop-zone input[type=file] { display: none; }
.service-photo .drop-zone input[type=file]:required ~ span::after { content: ''; }

/* Content tabs + Hero preview */
.content-tabs { margin-top: 0.6rem; }
.subhead { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; padding-bottom: 0.8rem; border-bottom: 1px solid #f3f4f6; }
.subhead h2 { margin: 0 0 0.15rem; font-size: 1.1rem; }
.subhead > div:first-child { flex: 1; min-width: 200px; }

.hero-preview { padding: 0; }
.hero-preview-card {
  position: relative;
  aspect-ratio: 16 / 9;
  background-color: #1a2332;
  background-size: cover;
  background-position: center;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  color: #fff;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.hero-preview-inner { text-align: center; max-width: 90%; }
.hero-preview-inner h1 {
  margin: 0 0 0.6rem;
  font-size: clamp(1rem, 2.2vw, 1.8rem);
  font-weight: 700;
  color: #fff;
  line-height: 1.15;
}
.hero-preview-inner p {
  margin: 0;
  font-size: clamp(0.78rem, 1.4vw, 0.95rem);
  line-height: 1.4;
  opacity: 0.92;
}
