/* ═══════════════════════════════════════════════════════════════════
   DESIGN V3 — pro polish layer
   Visual identity refinement: texture, depth, gradient primaries,
   typographic scale, refined controls. Keeps the petrol/cream soul.
   ═══════════════════════════════════════════════════════════════════ */

/* ── Background: whisper-quiet dot grid on the cream paper ── */
body {
  background-image: radial-gradient(rgba(20, 21, 23, 0.045) 1px, transparent 1px);
  background-size: 22px 22px;
}
[data-theme="dark"] body {
  background-image: radial-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px);
}

/* ── Type scale: bigger, tighter, more editorial ── */
h1 { font-size: clamp(26px, 2.6vw, 34px); letter-spacing: -0.022em; }
h2 { letter-spacing: -0.018em; }
#viewTitle { letter-spacing: -0.022em; }

/* ── Cards: layered surface with a top sheen hairline ── */
.card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.6), transparent 42%), var(--paper);
  box-shadow: var(--e1);
  transition: box-shadow 0.18s var(--ease-out);
}
.card:hover { box-shadow: var(--e2); }
[data-theme="dark"] .card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 42%), var(--paper);
}

/* ── Primary button: oklch gradient + inner sheen + lift ── */
.btn {
  background: linear-gradient(in oklch, var(--petrol), var(--teal));
  border-color: transparent;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 1px 2px rgba(12, 38, 46, 0.24), 0 4px 12px -4px rgba(21, 75, 90, 0.5);
  transition: background 0.15s, box-shadow 0.15s var(--ease-out), transform 0.1s var(--ease-out);
}
.btn:hover {
  background: linear-gradient(in oklch, var(--teal), var(--sky));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 2px 4px rgba(12, 38, 46, 0.26), 0 8px 20px -6px rgba(21, 75, 90, 0.55);
  transform: translateY(-1px);
}
.btn:active { transform: translateY(0) scale(0.98); }
.btn.ghost, .btn.soft { box-shadow: var(--e1); }
.btn.ghost:hover, .btn.soft:hover { transform: translateY(-1px); box-shadow: var(--e2); }

/* ── Inputs: glow on focus ── */
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--sky);
  box-shadow: 0 0 0 3px color-mix(in oklch, var(--sky) 18%, transparent), var(--e1);
}

/* ── Dashboard stat cells: accent bar + confident numerals ── */
.stats-ledger { border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--e1); background: var(--paper); }
.stat-cell { position: relative; }
.stat-cell::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--petrol), var(--sky), transparent);
  opacity: 0.85;
}
.stat-cell .v {
  font-family: var(--head);
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.stat-cell .k {
  font: 600 10.5px/1.3 var(--mono);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ── Sidebar: crisper separation + brand moment ── */
.side { border-right: 1px solid var(--line); }
.brand-lockup img.mark { filter: drop-shadow(0 2px 6px rgba(21, 75, 90, 0.25)); }
.side-nav button {
  border-radius: 9px;
  transition: color 0.14s ease, background 0.14s ease;
}
.side-nav button:hover { color: var(--ink); }

/* ── Badges & pills: crisper ── */
.kind, .fil-tag {
  letter-spacing: 0.07em;
  border-radius: 5px;
}

/* ── List rows (news, docs): directional hover ── */
#annonces .doc, .notif-item { transition: background 0.13s ease, transform 0.13s var(--ease-out); }
#annonces .doc:hover { transform: translateX(2px); }

/* ── Avatars: ring instead of flat circle ── */
.avatar {
  box-shadow: 0 0 0 2px var(--paper), 0 0 0 3.5px color-mix(in oklch, var(--petrol) 35%, transparent);
}

/* ── Scrollbars: thin, themed ── */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 8px; }
*::-webkit-scrollbar-thumb:hover { background: var(--muted); }
*::-webkit-scrollbar-track { background: transparent; }

/* ── Selection ── */
::selection { background: color-mix(in oklch, var(--sky) 30%, transparent); }

/* ── Top header: sticky with a blur fade ── */
.main .top {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in oklch, var(--paper-2) 92%, transparent);
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}
@media (min-width: 941px) and (hover: hover) {
  .main .top {
    background: color-mix(in oklch, var(--paper-2) 82%, transparent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
}
body.in-chat-view .main .top { display: none !important; }

/* ── Filière pill + view title moment ── */
#filPill {
  border: 1px solid var(--line-2);
  background: var(--paper);
  box-shadow: var(--e1);
}

/* ── Dark mode: deeper layering, subtle inner sheen on cards ── */
[data-theme="dark"] body { background-color: #0b0c0e; }
[data-theme="dark"] .side { background: #101215; border-right-color: var(--line); }
[data-theme="dark"] .card {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03), 0 0 0 1px rgba(255, 255, 255, 0.04), 0 8px 24px -8px rgba(0, 0, 0, 0.5);
}
[data-theme="dark"] .stat-cell .v { color: var(--ink); }
[data-theme="dark"] .btn {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 4px 14px -4px rgba(0, 0, 0, 0.55);
}

/* ── Login: card gets elevation + the washes stay ── */
.auth-card {
  border-radius: 20px;
  box-shadow: var(--e3);
}

/* ── Empty states: quieter ── */
.empty { color: var(--muted); font-size: 13.5px; }

@media (prefers-reduced-motion: reduce) {
  .btn:hover { transform: none; }
  #annonces .doc:hover { transform: none; }
}
