/* ===== Pirard Stats — design system (d'après vinspirard.be) ===== */
:root {
  --primary: #132942;
  --primary-80: #1d3a5e;
  --secondary: #4366B8;
  --secondary-soft: #e8eef9;
  --surface: #ffffff;
  --bg: #f6f8fb;
  --muted: #353434;
  --ink: rgba(0, 0, 0, 0.65);
  --line: #e4e9f0;
  --r-sm: 3px;
  --r-md: 25px;
  --r-lg: 50px;
  --font-head: "Outfit", "Span", "Century Gothic", sans-serif;
  --font-body: "Poppins", "Century Gothic", "CenturyGothicPro", sans-serif;
  --shadow-card: 0 1px 2px rgba(19, 41, 66, .04), 0 8px 32px rgba(19, 41, 66, .06);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font-body);
  font-size: 14px; line-height: 1.5;
  background: var(--bg); color: var(--muted);
}
h1, h2, h3 { font-family: var(--font-head); font-weight: 300; color: var(--primary); }
button { font-family: inherit; cursor: pointer; }
a { color: var(--secondary); text-decoration: none; }

.field select {
  width: 100%; padding: 13px 16px; border: 1px solid var(--line); border-radius: 14px;
  font: inherit; background: #fbfcfe; color: var(--muted);
}
.field select:focus { outline: none; border-color: var(--secondary); box-shadow: 0 0 0 4px rgba(67,102,184,.12); }
.user-form .btn-primary { margin-top: 6px; }
.pill-role-viewer { background: #eef1f5; color: #4a5568; }
.user-actions { text-align: right; white-space: nowrap; }
.btn-sm { padding: 6px 14px; font-size: 12px; margin-left: 6px; }
.btn-danger:hover { border-color: #b33939; color: #b33939; }
.clickable-table tbody tr { cursor: pointer; transition: background .15s ease; }
.clickable-table tbody tr:hover { background: #f3f6fb; }
.clickable-table strong { color: var(--primary); font-weight: 500; }
.detail-head { align-items: flex-start; }
.detail-head h1 { margin-top: 8px; margin-bottom: 4px; max-width: 900px; }
.back-link { border: 0; background: transparent; color: var(--secondary); padding: 0; font-size: 13px; }
.back-link:hover { text-decoration: underline; }
.detail-kpis { margin-bottom: 18px; }
.k-date { font-size: clamp(17px, 2vw, 25px) !important; }
.meta-grid { display: grid; grid-template-columns: minmax(110px, .6fr) 1.4fr; border-top: 1px solid var(--line); }
.meta-label, .meta-value { padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.meta-label { color: var(--ink); }
.meta-value { color: var(--primary); font-weight: 500; overflow-wrap: anywhere; }
.compact-tbl { font-size: 12px; }
.compact-tbl td { padding: 8px 6px; }
.compact-tbl small { display: block; color: var(--ink); font-size: 10px; margin-top: 2px; }
.empty-state { color: var(--ink); padding: 12px 0; font-size: 13px; }
.error-card { color: #a33; }
.list-head { display: flex; align-items: baseline; gap: 12px; padding: 2px 2px 12px; flex-wrap: wrap; }
.list-head h3 { font-size: 17px; }
.list-head .hint { font-size: 12px; }
.link-client { background: none; border: 0; padding: 0; font: inherit; font-weight: 600; color: var(--secondary); cursor: pointer; text-align: left; }
/* ===== Dashboard toolbar ===== */
.dash-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.seg-group { display: inline-flex; background: #eef1f5; border-radius: 12px; padding: 3px; gap: 2px; }
.seg-btn { border: 0; background: transparent; padding: 7px 14px; border-radius: 9px; font: inherit; font-size: 12.5px; color: var(--ink); cursor: pointer; transition: all .15s ease; }
.seg-btn:hover { color: var(--primary); }
.seg-btn.on { background: #fff; color: var(--primary); font-weight: 600; box-shadow: 0 1px 4px rgba(19,41,66,.10); }
.dash-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.dash-filters select { padding: 8px 12px; border: 1px solid var(--line); border-radius: 11px; font: inherit; font-size: 12.5px; background: #fbfcfe; color: var(--primary); max-width: 220px; cursor: pointer; }
.dash-filters select:focus { outline: none; border-color: var(--secondary); }

/* ===== Filtres multi-choix (dashboard) ===== */
.ms-wrap { position: relative; }
.ms-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  font: inherit; font-size: 12.5px; color: var(--ink); cursor: pointer;
  transition: border-color .15s;
}
.ms-btn:hover, .ms-btn.active { border-color: var(--secondary); }
.ms-btn.active { background: #e8eefb; color: var(--secondary); font-weight: 600; }
.ms-caret { font-size: 10px; color: var(--muted); margin-left: 2px; }
.ms-panel {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 60;
  width: 250px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 12px 32px rgba(19, 41, 66, .16); padding: 10px;
}
.ms-search {
  width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px;
  font: inherit; font-size: 12.5px; margin-bottom: 8px;
}
.ms-search:focus { outline: none; border-color: var(--secondary); }
.ms-list { max-height: 240px; overflow-y: auto; display: flex; flex-direction: column; gap: 1px; }
.ms-opt {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px;
  font-size: 12.5px; cursor: pointer; color: var(--ink);
}
.ms-opt:hover { background: #f1f4f9; }
.ms-opt input { accent-color: var(--secondary); width: 15px; height: 15px; flex: 0 0 auto; }
.ms-opt input:checked + span { font-weight: 600; color: var(--secondary); }
.ms-actions { display: flex; justify-content: space-between; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.ms-clear {
  border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 12px;
  cursor: pointer; padding: 4px 6px; border-radius: 6px;
}
.ms-clear:hover { color: var(--primary); background: #f1f4f9; }
.ms-apply {
  border: 0; background: var(--secondary); color: #fff; font: inherit; font-size: 12px;
  font-weight: 600; cursor: pointer; padding: 6px 16px; border-radius: 8px;
}
.ms-apply:hover { filter: brightness(.95); }
.dash-custom-period { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); }
.dash-custom-period input[type="date"] {
  padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px;
  font: inherit; font-size: 12.5px; background: var(--surface); color: var(--primary);
}
.dash-custom-period input[type="date"]:focus { outline: none; border-color: var(--secondary); }
.dash-custom-period.active input[type="date"] { border-color: var(--secondary); background: #f4f6fb; }

/* ===== Modal (détail facture) ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(12, 24, 44, .48);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; padding: 24px; backdrop-filter: blur(2px);
}
.modal-box {
  background: var(--surface); border-radius: 16px; width: 100%; max-width: 680px;
  max-height: 85vh; overflow: auto; box-shadow: 0 24px 60px rgba(19, 41, 66, .28);
  padding: 20px 22px; animation: modal-in .16s ease;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.modal-head h3 { margin: 0 0 4px; }
.modal-close {
  border: 0; background: #eef1f5; color: var(--ink); width: 32px; height: 32px;
  border-radius: 50%; font-size: 14px; cursor: pointer; flex: 0 0 auto;
}
.modal-close:hover { background: #dde3ec; color: var(--primary); }
.modal-box .btn-primary { width: auto; }

/* ===== Sélecteur de période (bouton + modale) ===== */
.period-btn {
  display: inline-flex; align-items: center; gap: 9px; padding: 9px 16px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  font: inherit; font-size: 13px; color: var(--primary); cursor: pointer; box-shadow: var(--shadow);
  transition: border-color .2s;
}
.period-btn:hover { border-color: var(--secondary); }
.period-btn svg { width: 16px; height: 16px; color: var(--secondary); flex: 0 0 auto; }
.period-btn .p-dates { color: var(--muted); font-size: 12px; }

.dp-box { max-width: 800px; }
.dp-layout { display: flex; gap: 20px; }
.dp-presets { width: 190px; flex: 0 0 190px; display: flex; flex-direction: column; gap: 2px; border-right: 1px solid var(--line); padding-right: 16px; }
.dp-preset {
  text-align: left; padding: 8px 12px; border-radius: 10px; border: 0; background: transparent;
  font: inherit; font-size: 13px; color: var(--ink); cursor: pointer; transition: background .15s;
}
.dp-preset:hover { background: #f1f4f9; }
.dp-preset.on { background: #e8eefb; color: var(--secondary); font-weight: 600; }
.dp-xdays {
  display: flex; align-items: center; gap: 7px; padding: 7px 12px; font-size: 13px;
  color: var(--ink); border-radius: 10px;
}
.dp-xdays.on { background: #e8eefb; color: var(--secondary); font-weight: 600; }
.dp-xdays input {
  width: 62px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px;
  font: inherit; font-size: 12.5px; text-align: center;
}
.dp-xdays input:focus { outline: none; border-color: var(--secondary); }
.dp-main { flex: 1; min-width: 0; }
.dp-dates { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; font-size: 12.5px; color: var(--muted); }
.dp-dates input {
  padding: 7px 10px; border: 1px solid var(--line); border-radius: 10px;
  font: inherit; font-size: 12.5px; color: var(--primary); background: var(--surface);
}
.dp-dates input:focus { outline: none; border-color: var(--secondary); }
.dp-nav { margin-left: auto; display: flex; gap: 4px; }
.dp-nav button {
  border: 0; background: transparent; font-size: 17px; line-height: 1; cursor: pointer;
  color: var(--muted); padding: 4px 10px; border-radius: 8px;
}
.dp-nav button:hover { background: #f1f4f9; color: var(--primary); }
.dp-cals { display: flex; gap: 18px; }
.dp-month { flex: 1; min-width: 0; }
.dp-month-label {
  text-align: center; font-size: 12.5px; font-weight: 600; color: var(--primary);
  text-transform: capitalize; margin-bottom: 6px;
}
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; }
.dp-wd { text-align: center; font-size: 10.5px; color: var(--muted); padding: 4px 0; }
.dp-day { text-align: center; padding: 6px 0; font-size: 12px; border-radius: 8px; cursor: pointer; color: var(--ink); }
.dp-day:hover:not(.disabled):not(.empty):not(.sel) { background: #e8eefb; }
.dp-day.empty { cursor: default; }
.dp-day.disabled { color: #c6cfdd; cursor: default; }
.dp-day.in-range { background: #e8eefb; border-radius: 0; }
.dp-day.sel { background: var(--secondary); color: #fff; font-weight: 600; }
.dp-foot {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line);
}
.dp-compare { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink); cursor: pointer; }
.dp-compare input { accent-color: var(--secondary); width: 16px; height: 16px; }
.dp-actions { display: flex; gap: 8px; }
.dp-actions .btn-primary { padding: 9px 18px; }
@media (max-width: 720px) {
  .dp-layout, .dp-cals { flex-direction: column; }
  .dp-presets { width: auto; flex: none; border-right: 0; border-bottom: 1px solid var(--line); padding: 0 0 12px; }
}
.barrow.clickable { cursor: pointer; border-radius: 8px; }
.barrow.clickable:hover .bar-label { color: var(--secondary); }
.barrow.clickable:hover .rank { background: var(--secondary); }

.site-link { display: inline-block; padding: 7px 16px; border: 1px solid var(--line); border-radius: 99px; font-size: 12.5px; color: var(--secondary); text-decoration: none; background: #fbfcfe; transition: all .15s ease; }
.site-link:hover { border-color: var(--secondary); background: #f3f6fb; }
.link-client:hover { text-decoration: underline; }
.cell-vins { font-size: 11px; color: var(--ink); max-width: 260px; }

/* ===== Login ===== */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(1200px 600px at 85% -10%, #dce7f7 0%, transparent 55%),
    radial-gradient(900px 500px at -10% 110%, #e9eef8 0%, transparent 50%),
    var(--bg);
}
.login-card {
  width: min(420px, 100%); background: var(--surface);
  border-radius: var(--r-md); padding: 48px 40px; box-shadow: var(--shadow-card);
  border: 1px solid var(--line);
}
.login-card .brand { display: flex; align-items: center; gap: 14px; margin-bottom: 32px; }
.login-card h1 { font-size: 28px; margin-bottom: 6px; }
.login-card p.sub { color: var(--ink); font-size: 13px; margin-bottom: 28px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12px; color: var(--ink); margin-bottom: 6px; letter-spacing: .04em; }
.field input {
  width: 100%; padding: 13px 16px; border: 1px solid var(--line); border-radius: 14px;
  font: inherit; background: #fbfcfe; transition: border-color .2s, box-shadow .2s;
}
.field input:focus { outline: none; border-color: var(--secondary); box-shadow: 0 0 0 4px rgba(67,102,184,.12); }
.btn-primary {
  width: 100%; padding: 14px; border: 0; border-radius: var(--r-md);
  background: var(--primary); color: #fff; font-size: 14px; letter-spacing: .03em;
  transition: transform .15s, background .2s;
}
.btn-primary:hover { background: var(--primary-80); transform: translateY(-1px); }
.login-error { color: #b33939; font-size: 13px; margin-top: 14px; min-height: 18px; }

/* ===== Shell ===== */
.app { display: none; min-height: 100vh; }
.app.on { display: grid; grid-template-columns: 240px 1fr; }
.sidebar {
  background: var(--primary); color: #c9d6ea; padding: 28px 18px;
  display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 0 10px 26px; color: #fff; }
.sidebar .brand b { font-family: var(--font-head); font-weight: 400; font-size: 17px; letter-spacing: .02em; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px;
  color: #aebfd9; background: transparent; border: 0; font-size: 13.5px; text-align: left;
  transition: background .2s, color .2s;
}
.nav-item svg { width: 18px; height: 18px; opacity: .85; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: var(--secondary); color: #fff; }
.sidebar .foot { margin-top: auto; font-size: 11.5px; color: #7e93b3; padding: 0 10px; }
/* Lien manuel PDF (bas de la barre latérale) — pas un .nav-item : pas de vue */
.nav-doc {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; margin: 10px 8px 0;
  border-radius: 14px; color: #aebfd9; background: transparent; border: 0;
  font-size: 13.5px; text-align: left; text-decoration: none;
  transition: background .2s, color .2s;
}
.nav-doc svg { width: 18px; height: 18px; opacity: .85; }
.nav-doc:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-doc .v { font-size: 10.5px; color: #7e93b3; }
.main { padding: 40px 48px 80px; max-width: 1280px; width: 100%; margin: 0 auto; min-width: 0; }
.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.page-head h1 { font-size: 34px; }
.page-head .hint { color: var(--ink); font-size: 12.5px; }

/* ===== Cards & KPIs ===== */
.grid-kpi { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-bottom: 26px; }
.kpi {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 22px 24px; box-shadow: var(--shadow-card); position: relative; overflow: hidden;
}
.kpi::after {
  content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px;
  border-radius: 50%; background: var(--secondary-soft); z-index: 0;
}
.kpi .k-label { font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink); position: relative; z-index: 1; }
.kpi .k-value { font-family: var(--font-head); font-size: clamp(20px, 2.2vw, 30px); font-weight: 300; color: var(--primary); margin-top: 8px; position: relative; z-index: 1; white-space: nowrap; }
.kpi .k-sub { font-size: 12px; color: var(--ink); margin-top: 4px; position: relative; z-index: 1; }
.trend { display: inline-block; margin-left: 6px; padding: 2px 9px; border-radius: 99px; font-size: 10.5px; font-weight: 500; letter-spacing: 0; text-transform: none; }
.trend.up { background: #e2f3ea; color: #1f7a4d; }
.trend.down { background: #fbe7e7; color: #a33; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; margin-bottom: 18px; }
.grid-2b { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; margin-bottom: 18px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 24px; box-shadow: var(--shadow-card); overflow-x: auto; min-width: 0;
}
.card h3 { font-size: 17px; margin-bottom: 16px; font-weight: 400; }
.card .chart-box { position: relative; height: 260px; }
.card .chart-box.tall { height: 320px; }
.homonym-card { border-left: 4px solid #c98a2b; margin-bottom: 18px; }

/* ===== Bar list (top vins) ===== */
.barlist { display: flex; flex-direction: column; gap: 10px; }
.barrow { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(60px, 1fr) 50px; align-items: center; gap: 10px; }
.bar-label { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-label .rank { color: var(--secondary); font-weight: 500; margin-right: 4px; }
.bar-track { height: 10px; background: var(--secondary-soft); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--primary); border-radius: 99px; animation: grow 1s ease both; transform-origin: left; }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.bar-val { text-align: right; font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--primary); }

/* ===== Tables ===== */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-weight: 400; font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--ink); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 10px; border-bottom: 1px solid #f0f3f8; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .rank { width: 28px; color: var(--secondary); font-weight: 500; }
.pill { display: inline-block; padding: 3px 12px; border-radius: var(--r-lg); font-size: 11.5px; background: var(--secondary-soft); color: var(--primary); }
.pill.rouge { background: #f7e3e3; color: #7c2d2d; }
.pill.blanc { background: #f4efd9; color: #6f5d14; }
.pill.rose { background: #fbe4ec; color: #8e2f57; }
.pill.bulles { background: #e2f0ec; color: #1f5c4c; }

/* ===== Assistant ===== */
.chat { display: flex; flex-direction: column; height: calc(100vh - 170px); min-height: 480px; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 8px 4px 20px; display: flex; flex-direction: column; gap: 16px; }
.msg { max-width: 82%; animation: rise .35s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.msg.user { align-self: flex-end; }
.msg.user .bubble { background: var(--primary); color: #fff; border-radius: 22px 22px 4px 22px; padding: 12px 18px; }
.msg.bot { align-self: flex-start; }
.msg.bot .bubble {
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px 22px 22px 4px;
  padding: 14px 18px; box-shadow: var(--shadow-card);
}
.msg.bot .answer-text { color: var(--primary); font-size: 14.5px; line-height: 1.55; }
.msg .entities { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.msg .result-chart { margin-top: 14px; position: relative; height: 220px; width: min(560px, 68vw); }
.msg .result-table { margin-top: 12px; overflow-x: auto; }
.typing { display: inline-flex; gap: 5px; padding: 6px 2px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--secondary); opacity: .35; animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip {
  border: 1px solid var(--line); background: #fbfcfe; color: var(--primary);
  padding: 8px 16px; border-radius: var(--r-lg); font-size: 12.5px; transition: all .18s;
}
.chip:hover { background: var(--secondary); border-color: var(--secondary); color: #fff; }
.chat-input { display: flex; gap: 10px; padding-top: 14px; border-top: 1px solid var(--line); }
.chat-input input {
  flex: 1; padding: 15px 20px; border-radius: var(--r-lg); border: 1px solid var(--line);
  font: inherit; background: var(--surface);
}
.chat-input input:focus { outline: none; border-color: var(--secondary); box-shadow: 0 0 0 4px rgba(67,102,184,.12); }
.chat-input button {
  border: 0; border-radius: 50%; width: 52px; height: 52px; background: var(--primary); color: #fff;
  display: grid; place-items: center; transition: background .2s, transform .15s;
}
.chat-input button:hover { background: var(--secondary); transform: scale(1.05); }
.suggest-head { font-size: 12px; color: var(--ink); letter-spacing: .06em; text-transform: uppercase; margin: 6px 0 10px; }

/* ===== Recherche (Vins/Clients) ===== */
.search-bar { position: relative; margin-bottom: 20px; max-width: 560px; }
.search-bar input {
  width: 100%; padding: 14px 20px 14px 46px; border-radius: var(--r-lg); border: 1px solid var(--line);
  font: inherit; background: var(--surface); box-shadow: var(--shadow-card);
}
.search-bar input:focus { outline: none; border-color: var(--secondary); }
.search-bar svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--ink); }

/* ===== Recherche avancée ===== */
.adv-card { margin-bottom: 18px; }
.adv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px 16px; }
.adv-field { position: relative; margin-bottom: 0; }
.adv-field label { display: block; font-size: 11.5px; color: var(--ink); margin-bottom: 5px; letter-spacing: .04em; }
.adv-field input, .adv-field select {
  width: 100%; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px;
  font: inherit; font-size: 13px; background: #fbfcfe; color: var(--muted);
}
.adv-field input:focus, .adv-field select:focus { outline: none; border-color: var(--secondary); box-shadow: 0 0 0 4px rgba(67,102,184,.12); }
.adv-drop {
  display: none; position: absolute; top: 100%; left: 0; right: 0; z-index: 30;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-card); margin-top: 4px; max-height: 264px; overflow-y: auto;
}
.adv-drop.on { display: block; }
.adv-drop-item {
  display: flex; flex-direction: column; gap: 1px; width: 100%; text-align: left;
  border: 0; background: transparent; padding: 8px 12px; font: inherit; font-size: 12.5px; cursor: pointer;
}
.adv-drop-item:hover { background: #f3f6fb; }
.adv-drop-item strong { color: var(--primary); font-weight: 500; }
.adv-drop-item span { color: var(--ink); font-size: 11px; }
.adv-drop-empty { padding: 10px 12px; font-size: 12px; color: var(--ink); }
.adv-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.adv-actions-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.adv-check { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink); cursor: pointer; }
.adv-search-btn { width: auto; padding: 12px 28px; }
.adv-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.adv-toolbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.adv-toolbar-right select {
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 11px; font: inherit;
  font-size: 12.5px; background: #fbfcfe; color: var(--primary); max-width: 220px; cursor: pointer;
}
.adv-toolbar-right select:focus { outline: none; border-color: var(--secondary); }
.adv-csv { display: inline-block; text-decoration: none; }
.adv-summary { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.adv-pager { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 16px; }
.adv-pager button:disabled, .btn-ghost:disabled { opacity: .45; cursor: default; pointer-events: none; }

/* ===== Suggestions ===== */
.feat-form-card { margin-bottom: 18px; }
.feat-form-card textarea {
  width: 100%; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px;
  font: inherit; font-size: 13px; background: #fbfcfe; color: var(--muted); resize: vertical;
}
.feat-form-card textarea:focus { outline: none; border-color: var(--secondary); box-shadow: 0 0 0 4px rgba(67,102,184,.12); }
.feat-form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 12px; }
.feat-form-actions .btn-primary { width: auto; padding: 11px 22px; }
.feat-item { padding: 14px 4px; border-bottom: 1px solid var(--line); }
.feat-item:last-child { border-bottom: 0; }
.feat-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.feat-titre { font-size: 14px; color: var(--primary); }
.feat-details { margin: 6px 0 0; font-size: 12.5px; color: var(--muted); white-space: pre-wrap; }
.feat-meta { margin-top: 6px; font-size: 11.5px; color: var(--ink); }
.feat-done {
  margin-top: 8px; padding: 8px 12px; border-radius: 10px; font-size: 12.5px;
  background: #e9f7ee; color: #1c7c3c; border: 1px solid #bfe6cc;
}
.feat-refused { background: #fdeeee; color: #a33; border-color: #f2c9c9; }
.feat-admin { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.feat-btns { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.feat-note-row { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.feat-btns[hidden], .feat-note-row[hidden] { display: none; }
.feat-note-label { font-size: 12.5px; color: var(--ink); }
.feat-note-row input {
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 11px;
  font: inherit; font-size: 12.5px; background: #fbfcfe; color: var(--muted);
  flex: 1 1 240px; min-width: 200px;
}
.feat-note-row input:focus { outline: none; border-color: var(--secondary); }
.feat-note-row .btn-primary, .feat-note-row .btn-ghost { flex: 0 0 auto !important; width: auto !important; padding: 8px 16px !important; }
.feat-note-row .btn-ghost { margin-left: 0; }
.st-ouverte { background: #eaf1fd; color: #2c5cad; }
.st-en_cours { background: #fdf3e2; color: #9a6b13; }
.st-faite { background: #e9f7ee; color: #1c7c3c; }
.st-refusee { background: #f1f1f4; color: #777; }

/* ===== Sync badge ===== */
.sync-badge { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink); }
.sync-badge .dot { width: 9px; height: 9px; border-radius: 50%; background: #35b26f; box-shadow: 0 0 0 4px rgba(53,178,111,.15); }
.btn-ghost {
  border: 1px solid var(--line); background: var(--surface); color: var(--primary);
  padding: 10px 22px; border-radius: var(--r-lg); font-size: 13px; transition: all .18s;
}
.btn-ghost:hover { border-color: var(--secondary); color: var(--secondary); }

/* ===== Mobile ===== */
.bottom-nav { display: none; }
@media (max-width: 900px) {
  .app.on { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding: 24px 18px 110px; }
  .grid-kpi { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-2b { grid-template-columns: 1fr; }
  .msg { max-width: 94%; }
  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
    background: var(--primary); padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
    justify-content: space-around; border-radius: 24px 24px 0 0;
  }
  .bottom-nav .nav-item { flex-direction: column; gap: 4px; font-size: 10.5px; padding: 8px 12px; }
}
.loading { display: grid; place-items: center; min-height: 50vh; color: var(--ink); }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--secondary); animation: spin 1s linear infinite; margin: 0 auto 14px; }
@keyframes spin { to { transform: rotate(360deg); } }
