/* CCS — Back-office */

body.admin { background: #F1EEF5; overflow-x: hidden; }

.app { display: grid; grid-template-columns: 260px 1fr; min-height: 100dvh; }
@media (max-width: 1024px) { .app { grid-template-columns: 1fr; } }

/* ---------- Sidebar ---------- */
.sidebar {
  background: var(--night-950); color: rgba(255,255,255,0.78);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100dvh;
}
@media (max-width: 1024px) {
  .sidebar {
    position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 120;
    transform: translateX(-100%); transition: transform var(--dur-med) var(--ease-out);
  }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lift); }
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px; border-bottom: 1px solid var(--line-dark); color: var(--white); text-decoration: none; }
.sidebar-brand .brand-flower { width: 42px; height: auto; flex: none; }
.sidebar-brand div { line-height: 1.3; }
.sidebar-brand b { display: block; font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; }
.sidebar-brand span { font-size: 10px; letter-spacing: 0.3em; text-transform: uppercase; color: var(--gold-400); }

.sidebar nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.nav-section { font-size: 10.5px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: rgba(255,255,255,0.38); padding: 18px 12px 8px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 11px 12px; margin: 2px 0; border: none; background: none; border-radius: var(--radius-md);
  color: rgba(255,255,255,0.78); font-size: 14px; font-weight: 500; text-align: left; text-decoration: none;
  transition: background var(--dur-fast), color var(--dur-fast); position: relative;
}
.nav-item svg { width: 19px; height: 19px; flex: none; opacity: 0.85; }
.nav-item:hover { background: rgba(255,255,255,0.07); color: var(--white); }
.nav-item.active { background: rgba(210,182,126,0.16); color: var(--gold-300); }
.nav-item.active::before { content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; background: var(--gold-400); border-radius: 0 3px 3px 0; }
.nav-item .count {
  margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: var(--radius-full);
  background: var(--gold-500); color: var(--night-950); font-size: 11.5px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.sidebar-foot { padding: 16px 20px; border-top: 1px solid var(--line-dark); font-size: 13px; }
.sidebar-foot a { color: rgba(255,255,255,0.65); text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.sidebar-foot a:hover { color: var(--gold-300); }
.sidebar-foot svg { width: 15px; height: 15px; }

.scrim { position: fixed; inset: 0; background: rgba(10,6,32,0.55); z-index: 110; opacity: 0; visibility: hidden; transition: opacity var(--dur-med); }
.scrim.show { opacity: 1; visibility: visible; }

/* ---------- Topbar ---------- */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 16px; padding: 14px 28px;
  background: rgba(252,251,248,0.9); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50;
}
@media (max-width: 1024px) { .topbar { padding: 12px 16px; } }
.menu-btn { display: none; width: 44px; height: 44px; border: 1px solid var(--line); background: var(--white); border-radius: var(--radius-md); place-items: center; }
.menu-btn svg { width: 20px; height: 20px; }
@media (max-width: 1024px) { .menu-btn { display: grid; } }
.topbar h1 { font-family: var(--font-serif); font-size: 21px; font-weight: 600; margin: 0; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .date { font-size: 13px; color: var(--ink-400); white-space: nowrap; }
@media (max-width: 640px) { .topbar .date { display: none; } }
.avatar {
  width: 40px; height: 40px; border-radius: var(--radius-full); background: var(--night-900); color: var(--gold-300);
  display: grid; place-items: center; font-size: 13px; font-weight: 600; flex: none;
}

.content { padding: 28px; max-width: 1240px; width: 100%; margin: 0 auto; }
@media (max-width: 1024px) { .content { padding: 16px; } }

/* ---------- KPI ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
@media (max-width: 1100px) { .kpi-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .kpi-grid { grid-template-columns: 1fr; } }
.kpi { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px 22px; }
.kpi .k-label { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-400); display: flex; align-items: center; gap: 8px; }
.kpi .k-label svg { width: 16px; height: 16px; color: var(--gold-600); }
.kpi .k-value { font-family: var(--font-serif); font-size: 32px; font-weight: 600; margin: 8px 0 2px; font-variant-numeric: tabular-nums; }
.kpi .k-sub { font-size: 12.5px; color: var(--ink-400); }
.kpi .k-sub .up { color: var(--ok-700); font-weight: 600; }

/* ---------- Panels & layout ---------- */
.panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg); margin-bottom: 24px; overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-head h2 { font-family: var(--font-serif); font-size: 18px; font-weight: 600; margin: 0; }
.panel-head .hint { font-size: 12.5px; color: var(--ink-400); }
.panel-body { padding: 22px; }
.panel-body.flush { padding: 0; }
.two-col { display: grid; grid-template-columns: 1.6fr 1fr; gap: 24px; align-items: start; }
@media (max-width: 1100px) { .two-col { grid-template-columns: 1fr; } }

/* ---------- Badges & statuts ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: var(--radius-full);
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { background: var(--ok-100); color: var(--ok-700); }
.badge.warn { background: var(--warn-100); color: var(--warn-700); }
.badge.info { background: var(--info-100); color: var(--info-700); }
.badge.done { background: var(--done-100); color: var(--done-700); }
.badge.err { background: var(--err-100); color: var(--err-700); }
.badge.progress { background: var(--progress-100); color: var(--progress-700); }
.badge.gold { background: var(--gold-100); color: var(--gold-600); }
.badge.gold::before { display: none; }

/* ---------- Boutons ---------- */
.btn-a {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 18px; border-radius: var(--radius-md); border: 1px solid transparent;
  font-size: 13.5px; font-weight: 600; text-decoration: none;
  transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast);
}
.btn-a svg { width: 16px; height: 16px; }
.btn-a.primary { background: var(--night-900); color: var(--white); }
.btn-a.primary:hover { background: var(--night-700); }
.btn-a.gold { background: var(--gold-500); color: var(--night-950); }
.btn-a.gold:hover { background: var(--gold-400); }
.btn-a.outline { background: var(--white); border-color: var(--line); color: var(--ink-900); }
.btn-a.outline:hover { border-color: var(--ink-400); }
.btn-a.danger { background: var(--white); border-color: #EBC8C5; color: var(--err-700); }
.btn-a.danger:hover { background: var(--err-100); }
.btn-a.sm { min-height: 34px; padding: 0 12px; font-size: 12.5px; }
.btn-a:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------- Filtres & champs ---------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.input, .select {
  min-height: 42px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-md);
  background: var(--white); color: var(--ink-900); font-size: 14px;
}
.input:focus, .select:focus { outline: none; border-color: var(--gold-500); box-shadow: 0 0 0 3px rgba(176,138,71,0.16); }
.search-wrap { position: relative; }
.search-wrap svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--ink-400); pointer-events: none; }
.search-wrap .input { padding-left: 36px; min-width: 220px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 760px; }
table.data th {
  text-align: left; padding: 12px 16px; font-size: 11.5px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-400); border-bottom: 1px solid var(--line); background: var(--sand-50);
  white-space: nowrap;
}
table.data td { padding: 14px 16px; border-bottom: 1px solid #EDE8F1; vertical-align: middle; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr.clickable { cursor: pointer; transition: background var(--dur-fast); }
table.data tbody tr.clickable:hover { background: var(--sand-50); }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
table.data .muted { color: var(--ink-400); font-size: 13px; }
.cell-main { font-weight: 600; }
.cell-sub { font-size: 12.5px; color: var(--ink-400); }

.person { display: flex; align-items: center; gap: 12px; min-width: 0; }
.person .avatar { width: 36px; height: 36px; font-size: 12px; background: var(--sand-200); color: var(--night-800); }
.person.gold .avatar { background: var(--gold-100); color: var(--gold-600); }

.empty { padding: 48px 24px; text-align: center; color: var(--ink-400); }
.empty svg { width: 40px; height: 40px; margin: 0 auto 12px; opacity: 0.5; }
.empty b { display: block; color: var(--ink-600); font-size: 15px; margin-bottom: 4px; }

/* ---------- Graphique ---------- */
.chart-wrap { padding: 10px 22px 22px; }
.chart-bars { width: 100%; height: auto; display: block; }
.chart-bars .bar { fill: var(--night-800); transition: fill var(--dur-fast); }
.chart-bars .bar.current { fill: var(--gold-500); }
.chart-bars .bar:hover { fill: var(--violet-600); }
.chart-bars text { font-family: var(--font-sans); }
.legend-row { display: flex; gap: 18px; padding: 0 22px 18px; font-size: 12.5px; color: var(--ink-600); flex-wrap: wrap; }
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

.progress-row { margin-bottom: 16px; }
.progress-row .p-head { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.progress-row .p-head b { font-variant-numeric: tabular-nums; }
.progress { height: 8px; background: var(--sand-200); border-radius: var(--radius-full); overflow: hidden; }
.progress span { display: block; height: 100%; border-radius: var(--radius-full); }

/* ---------- Listes dashboard ---------- */
.row-list { list-style: none; margin: 0; padding: 0; }
.row-list li { display: flex; align-items: center; gap: 14px; padding: 13px 22px; border-bottom: 1px solid #EDE8F1; }
.row-list li:last-child { border-bottom: none; }
.row-list .grow { flex: 1; min-width: 0; }
.row-list .grow b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-list .grow span { font-size: 12.5px; color: var(--ink-400); }
.row-list .end { text-align: right; font-size: 13px; white-space: nowrap; }

/* ---------- Calendrier ---------- */
.cal-head { display: flex; align-items: center; gap: 14px; }
.cal-head h2 { min-width: 190px; text-align: center; text-transform: capitalize; }
.cal-nav { width: 38px; height: 38px; border: 1px solid var(--line); background: var(--white); border-radius: var(--radius-md); display: grid; place-items: center; }
.cal-nav:hover { border-color: var(--ink-400); }
.cal-nav svg { width: 16px; height: 16px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.cal-dow { padding: 10px 8px; font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-400); text-align: center; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--sand-50); }
.cal-cell { min-height: 96px; padding: 8px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 12px; }
.cal-cell.out { background: #FAF8F3; color: var(--ink-400); }
.cal-cell .d { font-weight: 600; font-size: 12.5px; margin-bottom: 6px; display: inline-grid; place-items: center; min-width: 24px; height: 24px; border-radius: var(--radius-full); }
.cal-cell.today .d { background: var(--gold-500); color: var(--night-950); }
.cal-evt {
  display: block; width: 100%; text-align: left; border: none; margin-bottom: 4px; padding: 3px 8px;
  border-radius: 3px; font-size: 11.5px; font-weight: 500; line-height: 1.35;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.cal-evt.in { background: var(--ok-100); color: var(--ok-700); border-left: 3px solid var(--ok-700); }
.cal-evt.out-evt { background: var(--info-100); color: var(--info-700); border-left: 3px solid var(--info-700); }
@media (max-width: 860px) { .cal-cell { min-height: 64px; } .cal-evt { font-size: 10px; padding: 2px 5px; } }

/* ---------- Grilles cartes (propriétés / clients) ---------- */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.prop-card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; transition: box-shadow var(--dur-med); }
.prop-card:hover { box-shadow: var(--shadow-soft); }
.prop-card figure { margin: 0; aspect-ratio: 16 / 9; background: var(--sand-200); position: relative; }
.prop-card img { width: 100%; height: 100%; object-fit: cover; }
.prop-card .badge { position: absolute; top: 12px; left: 12px; box-shadow: 0 2px 8px rgba(10,6,32,0.18); }
.prop-body { padding: 16px 18px 18px; }
.prop-body h3 { font-family: var(--font-serif); font-size: 18px; margin: 0 0 2px; }
.prop-body .loc { font-size: 12.5px; color: var(--ink-400); margin-bottom: 12px; }
.prop-meta { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--ink-600); border-top: 1px solid var(--line); padding-top: 12px; }
.prop-meta b { font-variant-numeric: tabular-nums; color: var(--ink-900); }

/* ---------- Drawer & modal ---------- */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(480px, 100vw); z-index: 140;
  background: var(--white); box-shadow: var(--shadow-lift);
  transform: translateX(105%); transition: transform var(--dur-med) var(--ease-out);
  display: flex; flex-direction: column;
}
.drawer.open { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 24px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-family: var(--font-serif); font-size: 19px; margin: 0; }
.icon-btn { width: 40px; height: 40px; border: 1px solid var(--line); background: var(--white); border-radius: var(--radius-md); display: grid; place-items: center; }
.icon-btn:hover { border-color: var(--ink-400); }
.icon-btn svg { width: 17px; height: 17px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 24px; }
.drawer-foot { padding: 16px 24px; border-top: 1px solid var(--line); display: flex; gap: 10px; flex-wrap: wrap; }

.kv { display: grid; grid-template-columns: 130px 1fr; gap: 10px 16px; font-size: 14px; margin-bottom: 20px; }
.kv dt { color: var(--ink-400); font-size: 13px; }
.kv dd { margin: 0; font-weight: 500; }
.drawer h3.sub { font-size: 12px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-400); margin: 22px 0 10px; }
.chip-list { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: var(--sand-100); border: 1px solid var(--line); border-radius: var(--radius-full); padding: 5px 13px; font-size: 12.5px; }
.note-box { background: var(--gold-100); border-left: 3px solid var(--gold-500); padding: 12px 14px; font-size: 13.5px; border-radius: 0 var(--radius-md) var(--radius-md) 0; }

.modal-scrim { position: fixed; inset: 0; background: rgba(10,6,32,0.55); z-index: 150; display: none; align-items: center; justify-content: center; padding: 16px; }
.modal-scrim.show { display: flex; }
.modal { background: var(--white); border-radius: var(--radius-lg); width: min(640px, 100%); max-height: 90dvh; overflow-y: auto; box-shadow: var(--shadow-lift); }
.modal .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 22px 24px; }
.modal .form-grid .full { grid-column: 1 / -1; }
@media (max-width: 560px) { .modal .form-grid { grid-template-columns: 1fr; } }
.modal label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.modal .input, .modal .select, .modal textarea.input { width: 100%; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--line); }

/* ---------- Toggle ---------- */
.toggle { position: relative; width: 44px; height: 24px; border: none; border-radius: var(--radius-full); background: var(--sand-200); transition: background var(--dur-fast); flex: none; }
.toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--white); box-shadow: 0 1px 3px rgba(0,0,0,0.25); transition: transform var(--dur-fast) var(--ease-out); }
.toggle[aria-checked="true"] { background: var(--ok-700); }
.toggle[aria-checked="true"]::after { transform: translateX(20px); }

/* ---------- Divers ---------- */
.view { display: none; }
.view.active { display: block; animation: viewIn var(--dur-med) var(--ease-out); }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .view.active { animation: none; } }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.pill-tabs { display: inline-flex; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-full); padding: 4px; gap: 2px; }
.pill-tabs button { border: none; background: none; padding: 7px 16px; border-radius: var(--radius-full); font-size: 13px; font-weight: 500; color: var(--ink-600); }
.pill-tabs button.active { background: var(--night-900); color: var(--white); }

/* ---------- Demandes ---------- */
.req-item { margin-bottom: 16px; }
.req-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px 0; flex-wrap: wrap; }
.req-tags { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.req-body { padding: 12px 22px 18px; }
.req-msg { margin: 0 0 10px; font-size: 14.5px; max-width: 75ch; }
.req-meta { margin: 0; font-size: 12.5px; color: var(--ink-400); }
.req-meta b { color: var(--ink-600); font-variant-numeric: tabular-nums; }
.req-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }

.cal-grid { min-width: 720px; }
