/* =============================================================================
   JurisGab — Design System 2.0
   Palette de base conservée : violet #7c3aed · navy #1e3a5f · mustard #d97706
   ============================================================================= */

:root {
  /* Brand */
  --violet-50: #f5f3ff;
  --violet-100: #ede9fe;
  --violet-200: #ddd6fe;
  --violet-300: #c4b5fd;
  --violet-400: #a78bfa;
  --violet-500: #8b5cf6;
  --violet-600: #7c3aed;
  --violet-700: #6d28d9;
  --violet-800: #5b21b6;
  --violet-900: #4c1d95;

  --navy-50: #f0f4f9;
  --navy-100: #d9e4f0;
  --navy-200: #b8cde3;
  --navy-300: #8aaecf;
  --navy-400: #5f8db8;
  --navy-500: #3d6fa0;
  --navy-600: #2d5585;
  --navy-700: #1e3a5f;
  --navy-800: #152a47;
  --navy-900: #0d1c30;

  --mustard-50: #fffbeb;
  --mustard-100: #fef3c7;
  --mustard-200: #fde68a;
  --mustard-300: #fcd34d;
  --mustard-400: #fbbf24;
  --mustard-500: #f59e0b;
  --mustard-600: #d97706;
  --mustard-700: #b45309;
  --mustard-800: #92400e;

  /* Surfaces */
  --canvas: #f6f5fc;
  --canvas-deep: #f1eefb;
  --surface: #ffffff;
  --surface-2: #fbfaff;
  --surface-3: #f7f5fd;
  --line: #eae6f4;
  --line-strong: #ded7ef;
  --ink: #161d2f;
  --ink-soft: #46506a;
  --muted: #6c7488;
  --muted-2: #98a0b3;

  /* Shape */
  --radius-xs: 9px;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-xl: 26px;
  --radius-pill: 999px;

  /* Elevation */
  --shadow-xs: 0 1px 2px rgba(22, 29, 47, 0.05);
  --shadow-sm: 0 1px 2px rgba(22, 29, 47, 0.04), 0 8px 20px -12px rgba(22, 29, 47, 0.16);
  --shadow-md: 0 2px 4px rgba(22, 29, 47, 0.03), 0 18px 42px -22px rgba(58, 34, 112, 0.28);
  --shadow-lg: 0 30px 80px -36px rgba(58, 34, 112, 0.38);
  --ring: 0 0 0 4px rgba(124, 58, 237, 0.14);

  /* Gradients */
  --grad-brand: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 45%, #6d28d9 100%);
  --grad-navy: linear-gradient(135deg, #24456f 0%, #1e3a5f 45%, #152a47 100%);
  --grad-mix: linear-gradient(135deg, #7c3aed 0%, #5b21b6 55%, #1e3a5f 100%);
  --grad-mustard: linear-gradient(135deg, #fbbf24 0%, #f59e0b 50%, #d97706 100%);
  --grad-soft: linear-gradient(160deg, #ffffff 0%, #fbf9ff 60%, #f5f1ff 100%);

  --font-display: 'Sora', 'DM Sans', sans-serif;
  --font-body: 'Plus Jakarta Sans', 'DM Sans', sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  color: var(--ink);
  background-color: var(--canvas);
  background-image:
    radial-gradient(900px 520px at 8% -8%, rgba(124, 58, 237, 0.08), transparent 62%),
    radial-gradient(760px 460px at 98% 2%, rgba(245, 158, 11, 0.07), transparent 60%),
    radial-gradient(900px 640px at 50% 112%, rgba(30, 58, 95, 0.06), transparent 66%);
  background-attachment: fixed;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, .font-display { font-family: var(--font-display); letter-spacing: -0.02em; }

main h1 { color: var(--ink); font-size: 1.95rem; line-height: 1.15; font-weight: 700; }
main h2 { color: var(--ink); line-height: 1.25; }
main h3 { line-height: 1.32; }

button, input, textarea, select { font-family: inherit; }
a { color: inherit; }

::selection { background: rgba(124, 58, 237, 0.2); color: #3b1c78; }

:focus-visible { outline: 2px solid var(--violet-500); outline-offset: 2px; }

/* =============================================================================
   Navbar
   ============================================================================= */
.navbar {
  height: 64px;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(18px) saturate(170%);
  -webkit-backdrop-filter: blur(18px) saturate(170%);
  border-bottom: 1px solid rgba(222, 215, 239, 0.8);
  box-shadow: 0 10px 34px -30px rgba(22, 29, 47, 0.55);
  z-index: 50;
}
.nav-inner {
  max-width: 80rem;
  margin: 0 auto;
  height: 100%;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.logo-link { display: inline-flex; align-items: center; gap: 0.6rem; text-decoration: none; }
.logo-icon {
  width: 38px; height: 38px; border-radius: 12px;
  background: var(--grad-mix);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff;
  box-shadow: 0 8px 18px -8px rgba(124, 58, 237, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  position: relative;
  overflow: hidden;
}
.logo-icon::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.28), transparent 52%);
}
.brand-word { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; letter-spacing: -0.03em; color: var(--navy-800); }
.brand-word span { color: var(--violet-600); }
.brand-badge {
  font-size: 0.6rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--violet-700); background: var(--violet-100);
  padding: 2px 6px; border-radius: 6px; transform: translateY(-6px);
}

.nav-link {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 13px; border-radius: 10px;
  font-size: 0.875rem; font-weight: 600; color: #4a5468;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
  text-decoration: none; white-space: nowrap;
}
.nav-link i { font-size: 0.78rem; opacity: 0.85; }
.nav-link:hover { background: rgba(124, 58, 237, 0.07); color: var(--violet-700); }
.nav-link.active {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.12), rgba(124, 58, 237, 0.06));
  color: var(--violet-700);
  box-shadow: inset 0 0 0 1px rgba(124, 58, 237, 0.12);
}
.nav-link.active i { opacity: 1; }

.nav-dropdown { position: relative; }
.nav-dropdown > .nav-link { cursor: pointer; }
.dropdown-menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  min-width: 13rem; padding: 0.45rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 26px 60px -24px rgba(22, 29, 47, 0.35), 0 2px 6px rgba(22, 29, 47, 0.04);
  opacity: 0; visibility: hidden; transform: translateY(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
  z-index: 100;
}
.nav-dropdown.open > .dropdown-menu,
.nav-dropdown:hover > .dropdown-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown-menu.align-left { left: 0; right: auto; }
.dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; font-size: 0.86rem; font-weight: 500; color: #454e63;
  border-radius: 9px; transition: background 0.15s, color 0.15s; text-decoration: none;
}
.dropdown-item:hover { background: var(--violet-50); color: var(--violet-700); }
.dropdown-item i { width: 16px; text-align: center; font-size: 0.85rem; }
.dropdown-divider { height: 1px; background: var(--line); margin: 6px 4px; }

.user-chip {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 5px 10px 5px 6px; border-radius: 12px;
  border: 1px solid transparent; background: transparent; cursor: pointer;
  transition: background 0.18s, border-color 0.18s;
}
.user-chip:hover { background: rgba(124, 58, 237, 0.06); border-color: rgba(124, 58, 237, 0.1); }
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--grad-mix); color: #fff;
  font-size: 0.8rem; font-weight: 700;
  box-shadow: 0 6px 14px -8px rgba(124, 58, 237, 0.9);
  flex-shrink: 0;
}
.avatar-lg { width: 44px; height: 44px; font-size: 0.95rem; }
.avatar-soft { background: var(--violet-100); color: var(--violet-700); box-shadow: none; }

.nav-toggle {
  display: none; width: 40px; height: 40px; border-radius: 11px;
  border: 1px solid var(--line); background: #fff; color: var(--navy-700);
  align-items: center; justify-content: center;
}
.mobile-nav {
  background: #fff; border-top: 1px solid var(--line);
  padding: 0.75rem 1rem 1rem;
  box-shadow: 0 22px 40px -26px rgba(22, 29, 47, 0.4);
}
.mobile-nav .nav-link { display: flex; width: 100%; padding: 11px 12px; border-radius: 10px; }
.mobile-nav .mobile-section { font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted-2); font-weight: 700; padding: 10px 12px 4px; }

/* =============================================================================
   Buttons
   ============================================================================= */
.btn-primary, .btn-secondary, .btn-mustard, .btn-danger, .btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 650; font-size: 0.9rem; line-height: 1.2;
  padding: 10px 18px; border-radius: 12px; border: 1px solid transparent;
  cursor: pointer; text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn-primary {
  background: var(--grad-brand); color: #fff;
  box-shadow: 0 10px 22px -12px rgba(124, 58, 237, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 16px 30px -14px rgba(124, 58, 237, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.2); filter: saturate(1.05); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-secondary {
  background: rgba(255, 255, 255, 0.9); color: #364158;
  border-color: var(--line-strong);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover { border-color: var(--violet-300); color: var(--violet-700); background: var(--violet-50); transform: translateY(-1px); }

.btn-mustard {
  background: var(--grad-mustard); color: #fff;
  box-shadow: 0 10px 22px -12px rgba(217, 119, 6, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.btn-mustard:hover { transform: translateY(-1px); box-shadow: 0 16px 30px -14px rgba(217, 119, 6, 0.9); }

.btn-ghost { background: transparent; color: var(--ink-soft); }
.btn-ghost:hover { background: rgba(124, 58, 237, 0.07); color: var(--violet-700); }

.btn-danger { background: #fdf0f0; color: #b42318; border-color: #f6d7d5; font-weight: 600; }
.btn-danger:hover { background: #fbe3e2; border-color: #efc1bf; }

.btn-sm { padding: 7px 13px !important; font-size: 0.8rem !important; border-radius: 10px !important; }
.btn-lg { padding: 14px 24px; font-size: 0.98rem; border-radius: 14px; }

/* =============================================================================
   Cards & surfaces
   ============================================================================= */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.22s ease, box-shadow 0.22s ease, transform 0.22s ease;
  position: relative;
}
a.card, .card-interactive { color: inherit; text-decoration: none; }
a.card:hover, .card-interactive:hover {
  border-color: #d9ccf2;
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}
.card-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-display);
  font-weight: 700; color: var(--ink); font-size: 0.98rem;
  display: flex; align-items: center; gap: 8px;
}
.card-header i { color: var(--violet-600); }
.card-body { padding: 22px; }

.surface-soft { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-md); }
.divider { height: 1px; background: var(--line); }

.icon-tile {
  width: 44px; height: 44px; border-radius: 13px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1rem; flex-shrink: 0;
  background: var(--violet-100); color: var(--violet-700);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}
.icon-tile.lg { width: 56px; height: 56px; border-radius: 17px; font-size: 1.25rem; }
.icon-tile.violet { background: linear-gradient(145deg, #f3edff, #e8defe); color: var(--violet-700); }
.icon-tile.navy { background: linear-gradient(145deg, #eef4fb, #dde9f6); color: var(--navy-700); }
.icon-tile.mustard { background: linear-gradient(145deg, #fff8e7, #fdeec6); color: var(--mustard-700); }
.icon-tile.rose { background: linear-gradient(145deg, #fff1f1, #ffe1e1); color: #b42318; }
.icon-tile.emerald { background: linear-gradient(145deg, #ecfdf3, #d6f5e3); color: #067647; }

/* =============================================================================
   Badges, chips, tags
   ============================================================================= */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: var(--radius-pill);
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.01em;
  white-space: nowrap; line-height: 1.35;
}
.badge i { font-size: 0.62rem; }
.badge-violet { background: #f1eafe; color: #6425b8; }
.badge-navy { background: #e8eef7; color: #234a73; }
.badge-mustard { background: #fff4d6; color: #92600a; }
.badge-green { background: #e6f6ed; color: #147a4c; }
.badge-red { background: #fdecec; color: #b42318; }
.badge-gray { background: #f2f3f7; color: #525b70; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: var(--radius-pill);
  background: #fff; border: 1px solid var(--line-strong);
  font-size: 0.78rem; font-weight: 600; color: var(--ink-soft);
  text-decoration: none; transition: all 0.16s ease;
}
.chip:hover { border-color: var(--violet-300); color: var(--violet-700); background: var(--violet-50); }
.chip.active { background: var(--violet-600); border-color: var(--violet-600); color: #fff; box-shadow: 0 8px 18px -10px rgba(124, 58, 237, 0.8); }
.chip i { font-size: 0.7rem; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px; border-radius: var(--radius-pill);
  background: rgba(124, 58, 237, 0.08);
  border: 1px solid rgba(124, 58, 237, 0.14);
  color: var(--violet-700);
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.01em;
}
.eyebrow-dot { width: 7px; height: 7px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.16); }

/* =============================================================================
   Forms
   ============================================================================= */
.form-label {
  display: block; font-size: 0.82rem; font-weight: 700;
  color: #38415a; margin-bottom: 7px; letter-spacing: 0.01em;
}
.form-input {
  width: 100%; padding: 11px 14px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  font-size: 0.9rem; color: var(--ink); background: #fff;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
  box-shadow: 0 1px 2px rgba(22, 29, 47, 0.03);
}
.form-input::placeholder { color: #a2a8b8; }
.form-input:hover { border-color: #cfc6e6; }
.form-input:focus {
  outline: none; border-color: var(--violet-400);
  box-shadow: var(--ring); background: #fff;
}
textarea.form-input { resize: vertical; min-height: 110px; line-height: 1.65; }
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236c7488' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.6' d='M6 8l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 16px;
  padding-right: 40px; cursor: pointer;
}
.form-hint { font-size: 0.75rem; color: var(--muted); margin-top: 6px; }

.option-tile {
  display: flex; align-items: center; gap: 9px;
  padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: #fff;
  cursor: pointer; transition: all 0.16s ease;
  font-size: 0.84rem; font-weight: 600; color: #434c62;
}
.option-tile:hover { border-color: var(--violet-300); background: #fdfcff; }
.option-tile.selected,
.option-tile:has(input:checked) {
  border-color: var(--violet-500);
  background: linear-gradient(135deg, #f7f2ff, #f0e8ff);
  color: var(--violet-800);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

/* =============================================================================
   Flash messages
   ============================================================================= */
.flash-message {
  position: fixed; top: 80px; right: 22px; z-index: 1000;
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px; border-radius: 14px;
  font-size: 0.88rem; font-weight: 600;
  box-shadow: 0 22px 48px -22px rgba(22, 29, 47, 0.4);
  animation: slideIn 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  max-width: 400px; border: 1px solid transparent;
}
.flash-success { background: #ecfdf3; color: #0d7a46; border-color: #bbf0d1; }
.flash-error { background: #fef2f2; color: #b42318; border-color: #fbd5d4; }
.flash-message button { color: inherit; opacity: 0.55; padding: 2px; }
.flash-message button:hover { opacity: 1; }
@keyframes slideIn { from { transform: translateX(110%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* =============================================================================
   Modals
   ============================================================================= */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(18, 24, 40, 0.5);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  overflow-y: auto;
}
.modal-overlay.hidden { display: none; }
.modal-box {
  background: #fff; border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 40px 100px -40px rgba(18, 24, 40, 0.6);
  padding: 26px; width: 100%;
  animation: modalIn 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  max-height: calc(100vh - 40px); overflow-y: auto;
}
@keyframes modalIn { from { transform: scale(0.96) translateY(14px); opacity: 0; } to { transform: scale(1) translateY(0); opacity: 1; } }

/* =============================================================================
   Lists & rows
   ============================================================================= */
.list-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 20px; transition: background 0.16s ease;
  text-decoration: none; color: inherit;
}
.list-row:hover { background: var(--surface-3); }
.list-row + .list-row { border-top: 1px solid #f3f0fa; }
.list-title { font-weight: 650; color: var(--ink); font-size: 0.88rem; }
.list-meta { color: var(--muted-2); font-size: 0.75rem; margin-top: 2px; }

/* =============================================================================
   Tables
   ============================================================================= */
.table-container { overflow-x: auto; border-radius: var(--radius-md); border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; background: #fff; }
th {
  background: var(--surface-3); padding: 12px 16px; text-align: left;
  font-size: 0.72rem; font-weight: 800; color: #5f5578;
  text-transform: uppercase; letter-spacing: 0.07em;
  border-bottom: 1px solid var(--line);
}
td { padding: 13px 16px; border-bottom: 1px solid #f4f1fb; font-size: 0.87rem; color: var(--ink-soft); }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #fbfaff; }

/* =============================================================================
   Stat / KPI cards
   ============================================================================= */
.stat-card {
  position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 20px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}
.stat-card::before {
  content: ''; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, var(--violet-600), var(--navy-500));
  opacity: 0.85;
}
.stat-card::after {
  content: ''; position: absolute; right: -40px; top: -50px;
  width: 140px; height: 140px; border-radius: 50%;
  background: radial-gradient(circle, rgba(124, 58, 237, 0.1), transparent 68%);
  pointer-events: none;
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: #ddd1f4; }
.stat-value { font-family: var(--font-display); font-weight: 700; font-size: 1.9rem; line-height: 1; color: var(--ink); letter-spacing: -0.04em; }
.stat-label { color: var(--muted); font-size: 0.8rem; font-weight: 600; margin-top: 8px; }

/* =============================================================================
   Landing page
   ============================================================================= */
.hero-shell { position: relative; overflow: hidden; padding-top: 64px; isolation: isolate; }
.hero-bg { position: absolute; inset: 0; pointer-events: none; z-index: -1; overflow: hidden; }
.hero-bg::after {
  content: ''; position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, rgba(30, 58, 95, 0.055) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(30, 58, 95, 0.055) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 38%, #000 12%, transparent 74%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 38%, #000 12%, transparent 74%);
}
.orb { position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.6; }
.orb-violet { width: 560px; height: 560px; top: -180px; left: -120px; background: radial-gradient(circle, rgba(196, 181, 253, 0.95), transparent 68%); }
.orb-amber { width: 460px; height: 460px; top: -30px; right: -160px; background: radial-gradient(circle, rgba(253, 211, 77, 0.6), transparent 68%); opacity: 0.5; }
.orb-navy { width: 620px; height: 620px; bottom: -320px; left: 32%; background: radial-gradient(circle, rgba(147, 180, 216, 0.55), transparent 70%); opacity: 0.45; }

.hero-title {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(2.4rem, 5.4vw, 3.9rem); line-height: 1.04;
  letter-spacing: -0.045em; color: var(--navy-800);
}
.gradient-text {
  background: linear-gradient(100deg, #7c3aed 0%, #5b21b6 45%, #1e3a5f 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
.lead { font-size: 1.05rem; line-height: 1.75; color: #566078; }

.mock-window {
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 24px;
  box-shadow: 0 50px 100px -50px rgba(48, 28, 96, 0.55), 0 0 0 1px rgba(124, 58, 237, 0.07);
  overflow: hidden;
}
.mock-titlebar {
  display: flex; align-items: center; gap: 7px;
  padding: 13px 16px;
  background: linear-gradient(135deg, #1e3a5f, #152a47);
  color: #c9d8ea;
}
.mock-dot { width: 9px; height: 9px; border-radius: 50%; }
.floating-pill {
  position: absolute; display: inline-flex; align-items: center; gap: 8px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: 14px; padding: 10px 14px;
  box-shadow: 0 20px 44px -24px rgba(48, 28, 96, 0.45);
  font-size: 0.78rem; font-weight: 700; color: var(--ink);
  backdrop-filter: blur(8px);
}

.feature-card {
  background: #fff; border-radius: var(--radius-lg); padding: 26px;
  border: 1px solid var(--line);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  position: relative; overflow: hidden;
}
.feature-card::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(340px 180px at 100% 0%, rgba(124, 58, 237, 0.07), transparent 70%);
  opacity: 0; transition: opacity 0.25s ease; pointer-events: none;
}
.feature-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-md); border-color: #d9ccf2; }
.feature-card:hover::before { opacity: 1; }

.dark-panel {
  background: var(--grad-navy);
  position: relative; overflow: hidden; color: #fff;
}
.dark-panel::before {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(600px 320px at 12% 0%, rgba(124, 58, 237, 0.4), transparent 70%),
    radial-gradient(520px 300px at 92% 100%, rgba(245, 158, 11, 0.18), transparent 70%);
  pointer-events: none;
}
.dark-panel::after {
  content: ''; position: absolute; inset: 0;
  background-image: linear-gradient(to right, rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse at 50% 50%, #000 0%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse at 50% 50%, #000 0%, transparent 78%);
  pointer-events: none;
}
.dark-card {
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg); padding: 24px;
  backdrop-filter: blur(6px);
  transition: background 0.22s ease, transform 0.22s ease, border-color 0.22s ease;
}
.dark-card:hover { background: rgba(255, 255, 255, 0.095); transform: translateY(-4px); border-color: rgba(255, 255, 255, 0.18); }

.cta-band {
  position: relative; overflow: hidden;
  background: linear-gradient(120deg, #7c3aed 0%, #6d28d9 48%, #1e3a5f 100%);
  border-radius: 28px;
  box-shadow: 0 40px 90px -44px rgba(76, 29, 149, 0.75);
}
.cta-band::before {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(500px 300px at 85% 10%, rgba(245, 158, 11, 0.35), transparent 70%),
    radial-gradient(420px 320px at 5% 100%, rgba(255, 255, 255, 0.16), transparent 70%);
  pointer-events: none;
}
.cta-band::after {
  content: ''; position: absolute; inset: 0;
  background-image: linear-gradient(to right, rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.06) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at 70% 40%, #000, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at 70% 40%, #000, transparent 75%);
  pointer-events: none;
}

/* =============================================================================
   Auth (login / register)
   ============================================================================= */
.auth-shell { min-height: 100vh; display: flex; }
.auth-aside {
  position: relative; overflow: hidden;
  background: var(--grad-mix);
  color: #fff; flex: 1 1 52%;
  display: none;
  padding: 56px;
  isolation: isolate;
}
.auth-aside::before {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(620px 420px at 85% 8%, rgba(245, 158, 11, 0.32), transparent 68%),
    radial-gradient(520px 420px at 10% 92%, rgba(139, 92, 246, 0.55), transparent 70%);
}
.auth-aside::after {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background-image: linear-gradient(to right, rgba(255, 255, 255, 0.07) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.07) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at 30% 30%, #000, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse at 30% 30%, #000, transparent 80%);
}
.auth-main { flex: 1 1 48%; display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.auth-card {
  width: 100%; max-width: 430px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 24px; padding: 34px;
  box-shadow: 0 40px 90px -46px rgba(48, 28, 96, 0.45);
}
.auth-feature { display: flex; align-items: flex-start; gap: 12px; }
.auth-feature .dot { width: 34px; height: 34px; border-radius: 10px; background: rgba(255, 255, 255, 0.13); border: 1px solid rgba(255, 255, 255, 0.18); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* =============================================================================
   Chat
   ============================================================================= */
.chat-page {
  --chat-ink: #161d2f;
  --chat-muted: #6c7488;
  --chat-line: #ebe6f6;
  --chat-canvas: #f7f6fc;
  --chat-surface: #ffffff;
  --chat-violet: #7c3aed;
  --chat-violet-soft: #f3efff;
  height: 100vh; overflow: hidden;
  background: var(--chat-canvas);
  color: var(--chat-ink);
}
/* Hauteur dynamique : évite que la barre d'URL mobile masque le bas du chat */
@supports (height: 100dvh) {
  .chat-page { height: 100dvh; }
}
.chat-shell {
  margin-top: 64px;
  height: calc(100vh - 64px);
  min-height: 0;
  display: flex;
  overflow: hidden;
  background: var(--chat-canvas);
}
@supports (height: 100dvh) {
  .chat-shell { height: calc(100dvh - 64px); }
}
.chat-page .navbar { background: rgba(255, 255, 255, 0.88); }
.sidebar {
  width: 296px; min-width: 296px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(10px);
  border-right: 1px solid var(--chat-line);
  overflow-y: auto;
  display: flex; flex-direction: column;
}
.sidebar-section-label {
  font-size: 0.67rem; font-weight: 800; letter-spacing: 0.13em;
  text-transform: uppercase; color: var(--muted-2);
  padding: 0 8px; margin-bottom: 8px;
}
.sidebar-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 11px; border-radius: 10px;
  margin: 1px 0; font-size: 0.82rem; font-weight: 550; color: #4a5468;
  cursor: pointer; transition: background 0.15s, color 0.15s;
  text-decoration: none; position: relative;
}
.sidebar-item:hover { background: var(--violet-50); color: var(--violet-700); }
.sidebar-item.active {
  background: linear-gradient(135deg, #f4eeff, #ece3ff);
  color: var(--violet-800); font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(124, 58, 237, 0.1);
}
.sidebar-item.active::before {
  content: ''; position: absolute; left: -1px; top: 8px; bottom: 8px;
  width: 3px; border-radius: 3px; background: var(--grad-brand);
}
.agent-option {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border-radius: 11px; border: 1px solid transparent;
  background: transparent; cursor: pointer; text-align: left;
  transition: all 0.16s ease; text-decoration: none;
}
.agent-option:hover { background: #fff; border-color: var(--chat-line); box-shadow: var(--shadow-xs); }
.agent-option.active {
  background: #fff; border-color: #d9caf3;
  box-shadow: 0 8px 20px -16px rgba(91, 33, 182, 0.5);
}
.agent-option .agent-name { font-size: 0.82rem; font-weight: 650; color: #3d4659; }
.agent-option.active .agent-name { color: var(--violet-800); }
.agent-glyph { width: 30px; height: 30px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; font-size: 0.72rem; flex-shrink: 0; }
.guest-agent-option { display: flex; }

/* min-height: 0 est indispensable : sans lui, en colonne, le bloc refuse de
   rétrécir et pousse la zone de saisie hors de l'écran sur mobile. */
.chat-area { min-width: 0; min-height: 0; flex: 1; display: flex; flex-direction: column; background: var(--chat-canvas); }
.chat-header {
  min-height: 74px; padding: 12px 24px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--chat-line);
  display: flex; align-items: center; gap: 14px;
  flex-shrink: 0;
  z-index: 5;
}
/* min-height: 0 est requis : par défaut un élément flex refuse de descendre
   sous la hauteur de son contenu, ce qui fait déborder la page vers le bas. */
.chat-transcript {
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 26px clamp(16px, 4vw, 48px);
}
.chat-message {
  width: 100%; max-width: 880px; margin: 0 auto 20px;
  display: flex; align-items: flex-start; gap: 12px;
  animation: msgIn 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes msgIn { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.chat-message.user { flex-direction: row-reverse; }
.chat-message.user .chat-bubble { margin-left: auto; }
.chat-bubble {
  position: relative;
  max-width: calc(100% - 48px);
  padding: 14px 18px; border-radius: 16px;
  font-size: 0.93rem; line-height: 1.7;
  overflow-wrap: anywhere;
}
.chat-bubble.user {
  background: var(--grad-brand); color: #fff;
  border: 0;
  border-radius: 16px 16px 4px 16px;
  box-shadow: 0 10px 24px -14px rgba(109, 40, 217, 0.9);
  max-width: min(88%, 640px);
  white-space: pre-wrap;
}
.chat-bubble.assistant {
  background: #fff; color: var(--chat-ink);
  border: 1px solid var(--chat-line);
  border-radius: 4px 16px 16px 16px;
  box-shadow: 0 10px 30px -24px rgba(22, 29, 47, 0.5);
}
.chat-bubble.assistant strong { color: #5b21b6; font-weight: 700; }
.chat-bubble.assistant a { color: var(--violet-700); text-decoration: underline; text-underline-offset: 2px; }
/* Markdown dans une bulle utilisateur (fond violet) */
.chat-bubble.user strong,
.chat-bubble.user em,
.chat-bubble.user a,
.chat-bubble.user code { color: #fff; }
.chat-bubble.user a { text-decoration: underline; text-underline-offset: 2px; }
.chat-bubble.user code { background: rgba(255, 255, 255, 0.16); }
.chat-bubble.user ul > li::before { background: rgba(255, 255, 255, 0.7); }
.chat-bubble.user ol > li::marker { color: #fff; }
.chat-bubble.user blockquote {
  background: rgba(255, 255, 255, 0.12);
  border-left-color: rgba(255, 255, 255, 0.55);
  color: #f3edff;
}
.chat-bubble.user p { margin: 0.35rem 0; }

.msg-copy {
  position: absolute; top: 8px; right: 8px;
  width: 28px; height: 28px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  background: #fff; border: 1px solid var(--chat-line);
  color: var(--muted-2); font-size: 0.7rem;
  opacity: 0; transition: opacity 0.15s ease, color 0.15s ease, background 0.15s ease;
  z-index: 2;
}
.chat-bubble.assistant:hover .msg-copy { opacity: 1; }
@media (hover: none) { .chat-bubble.assistant .msg-copy { opacity: 1; } }
.msg-copy:hover { color: var(--violet-700); background: var(--violet-50); }
.msg-copy.copied { color: #0d7a46; border-color: #bbf0d1; background: #ecfdf3; }

.chat-composer { flex-shrink: 0; padding: 14px clamp(16px, 4vw, 48px) 18px; background: rgba(255, 255, 255, 0.92); border-top: 1px solid var(--chat-line); backdrop-filter: blur(10px); }
.chat-composer form { max-width: 880px; margin: 0 auto; display: block; }
.chat-composer .composer-row { display: flex; gap: 10px; align-items: flex-end; flex: 1; min-width: 0; }
.chat-composer .composer-box { flex: 1; position: relative; min-width: 0; }
.chat-composer .composer-box.dragging textarea.form-input { border-color: var(--violet-400, #a78bfa); background: #faf7ff; }

/* Pièces jointes (chat) */
.composer-attachments { max-width: 880px; margin: 0 auto 8px; display: flex; flex-wrap: wrap; gap: 8px; }
.attachment-chip {
  display: inline-flex; align-items: center; gap: 9px; max-width: 260px;
  padding: 7px 8px 7px 10px; border-radius: 12px;
  background: #fff; border: 1px solid var(--line-strong, #e6e0f2);
  box-shadow: 0 4px 12px -10px rgba(22, 29, 47, 0.5);
}
.attachment-chip.error { border-color: #fbd5d4; background: #fef7f7; }
.attachment-chip-icon { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 8px; flex-shrink: 0; background: var(--violet-50, #f5f3ff); color: var(--violet-600, #7c3aed); font-size: 0.72rem; }
.attachment-chip.error .attachment-chip-icon { background: #fdecec; color: #dc2626; }
.attachment-chip-body { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.attachment-chip-name { font-size: 0.76rem; font-weight: 600; color: #2a3247; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attachment-chip-meta { font-size: 0.66rem; color: #8b93a7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attachment-chip.error .attachment-chip-meta { color: #dc2626; }
.attachment-chip-remove { flex-shrink: 0; width: 22px; height: 22px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; border: 0; background: transparent; color: #9aa1b3; font-size: 0.68rem; cursor: pointer; transition: all 0.14s ease; }
.attachment-chip-remove:hover { background: #fdecec; color: #dc2626; }

.chat-attachment-note { display: flex; flex-direction: column; gap: 3px; margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid rgba(255, 255, 255, 0.25); font-size: 0.74rem; opacity: 0.9; }
.chat-attachment-item { display: flex; align-items: center; gap: 6px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-attachment-item i { flex-shrink: 0; }

.chat-composer textarea.form-input {
  min-height: 52px !important; border-radius: 14px; padding: 14px 16px;
  border: 1px solid var(--line-strong);
  box-shadow: 0 6px 20px -18px rgba(22, 29, 47, 0.55);
  resize: none; line-height: 1.5;
}
.chat-composer .composer-actions { display: flex; gap: 8px; align-items: center; }
.composer-btn {
  width: 44px; height: 44px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-strong); background: #fff; color: var(--muted);
  transition: all 0.16s ease; cursor: pointer;
}
.composer-btn:hover { color: var(--violet-700); border-color: var(--violet-300); background: var(--violet-50); }
.composer-send {
  width: 48px; height: 48px; border-radius: 14px;
  background: var(--grad-brand); color: #fff; border: 0;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 12px 24px -12px rgba(124, 58, 237, 0.9);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}
.composer-send:hover { transform: translateY(-1px); box-shadow: 0 16px 30px -14px rgba(124, 58, 237, 0.95); }
.composer-send:disabled { opacity: 0.5; transform: none; box-shadow: none; }

.typing-dots { display: inline-flex; gap: 5px; align-items: center; }
.typing-dots span { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--violet-500); opacity: 0.6; animation: typingBounce 1.3s infinite ease-in-out; }
.typing-dots span:nth-child(2) { animation-delay: 0.16s; }
.typing-dots span:nth-child(3) { animation-delay: 0.32s; }
@keyframes typingBounce { 0%, 80%, 100% { transform: scale(0.65); opacity: 0.35; } 40% { transform: scale(1); opacity: 1; } }

.chat-empty-icon { width: 64px; height: 64px; border-radius: 20px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.4rem; }

/* =============================================================================
   Markdown / prose for AI answers
   ============================================================================= */
.prose-legal, .md {
  color: var(--ink-soft); font-size: 0.92rem; line-height: 1.75;
  overflow-wrap: anywhere;
}
.prose-legal > :first-child, .md > :first-child { margin-top: 0 !important; }
.prose-legal > :last-child, .md > :last-child { margin-bottom: 0 !important; }

.prose-legal h1, .md h1,
.prose-legal h2, .md h2,
.prose-legal h3, .md h3,
.prose-legal h4, .md h4 {
  font-family: var(--font-display); color: #182036; font-weight: 700;
  line-height: 1.3; letter-spacing: -0.02em;
}
.prose-legal h1, .md h1 { font-size: 1.35rem; margin: 1.3rem 0 0.6rem; }
.prose-legal h2, .md h2 { font-size: 1.14rem; margin: 1.15rem 0 0.5rem; }
.prose-legal h3, .md h3 { font-size: 1rem; margin: 1rem 0 0.4rem; color: #3b2a63; }
.prose-legal h4, .md h4 { font-size: 0.93rem; margin: 0.85rem 0 0.35rem; color: #4a3a72; }

.prose-legal p, .md p { margin: 0.6rem 0; }
.prose-legal ul, .md ul,
.prose-legal ol, .md ol { margin: 0.6rem 0; padding-left: 1.35rem; }
.prose-legal ul, .md ul { list-style: none; }
.prose-legal ul > li, .md ul > li { position: relative; padding-left: 0.1rem; }
.prose-legal ul > li::before, .md ul > li::before {
  content: ''; position: absolute; left: -0.95rem; top: 0.62em;
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--violet-400);
}
.prose-legal ol, .md ol { list-style: decimal; }
.prose-legal ol > li::marker, .md ol > li::marker { color: var(--violet-600); font-weight: 700; }
.prose-legal li, .md li { margin: 0.28rem 0; }
.prose-legal li > ul, .md li > ul, .prose-legal li > ol, .md li > ol { margin: 0.3rem 0; }

.prose-legal strong, .md strong { color: #4c1d95; font-weight: 700; }
.prose-legal em, .md em { font-style: italic; color: #475467; }
.prose-legal a, .md a { color: var(--violet-700); text-decoration: underline; text-underline-offset: 2px; }

.prose-legal blockquote, .md blockquote {
  margin: 0.9rem 0; padding: 10px 16px;
  border-left: 3px solid var(--violet-400);
  background: #f8f4ff; border-radius: 0 10px 10px 0;
  color: #574d70; font-style: italic;
}
.prose-legal blockquote p, .md blockquote p { margin: 0.25rem 0; }

.prose-legal code, .md code {
  background: #f2edfc; color: #5b21b6;
  padding: 1.5px 6px; border-radius: 6px;
  font-size: 0.85em; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.prose-legal pre, .md pre {
  background: #152a47; color: #e9eef7;
  padding: 15px 17px; border-radius: 12px;
  overflow-x: auto; margin: 0.9rem 0;
  font-size: 0.82rem; line-height: 1.6;
  border: 1px solid rgba(255, 255, 255, 0.06);
}
.prose-legal pre code, .md pre code { background: transparent; color: inherit; padding: 0; font-size: inherit; }

.prose-legal table, .md table {
  display: block; width: max-content; min-width: 100%; max-width: 100%;
  overflow-x: auto; border-collapse: separate; border-spacing: 0;
  margin: 1rem 0; font-size: 0.84rem;
  border: 1px solid var(--line); border-radius: 12px;
}
.prose-legal thead th, .md thead th {
  background: #f6f1fe; color: #42356b;
  font-size: 0.74rem; text-transform: none; letter-spacing: 0.01em;
  padding: 10px 13px; border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line); text-align: left;
}
.prose-legal tbody td, .md tbody td {
  padding: 9px 13px; border-bottom: 1px solid #f3f0fa;
  border-right: 1px solid #f3f0fa; color: #46506a;
}
.prose-legal thead th:last-child, .md thead th:last-child,
.prose-legal tbody td:last-child, .md tbody td:last-child { border-right: 0; }
.prose-legal tbody tr:last-child td, .md tbody tr:last-child td { border-bottom: 0; }
.prose-legal tbody tr:nth-child(even) td, .md tbody tr:nth-child(even) td { background: #fcfbff; }

.prose-legal hr, .md hr { border: 0; height: 1px; background: var(--line); margin: 1.1rem 0; }
.prose-legal img, .md img { max-width: 100%; border-radius: 10px; }
.prose-legal input[type="checkbox"], .md input[type="checkbox"] { margin-right: 6px; accent-color: var(--violet-600); }
.prose-legal del, .md del { color: var(--muted-2); }

/* =============================================================================
   Page heads & helpers
   ============================================================================= */
.page-head {
  display: flex; flex-wrap: wrap; align-items: flex-start;
  justify-content: space-between; gap: 18px; margin-bottom: 26px;
}
.page-title { font-family: var(--font-display); font-weight: 700; font-size: clamp(1.5rem, 2.4vw, 1.85rem); letter-spacing: -0.035em; color: var(--navy-800); line-height: 1.18; }
.page-sub { color: var(--muted); font-size: 0.9rem; margin-top: 6px; }

.back-btn {
  width: 40px; height: 40px; border-radius: 12px;
  background: #fff; border: 1px solid var(--line);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted); transition: all 0.16s ease; flex-shrink: 0;
  text-decoration: none;
}
.back-btn:hover { color: var(--violet-700); border-color: var(--violet-300); background: var(--violet-50); transform: translateX(-2px); }

.empty-state {
  text-align: center; padding: 60px 26px;
  border: 1px dashed var(--line-strong); border-radius: var(--radius-xl);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.75), rgba(250, 248, 255, 0.6));
}
.empty-state .empty-icon {
  width: 74px; height: 74px; border-radius: 22px;
  margin: 0 auto 20px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(145deg, #f4eeff, #e8defe);
  color: var(--violet-600); font-size: 1.6rem;
  box-shadow: inset 0 1px 0 #fff, 0 14px 30px -20px rgba(124, 58, 237, 0.7);
}
.empty-state h3 { font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; color: var(--ink); margin-bottom: 8px; }
.empty-state p { color: var(--muted); font-size: 0.88rem; max-width: 26rem; margin: 0 auto 20px; }

.section-eyebrow { display: inline-flex; align-items: center; gap: 8px; padding: 6px 13px; border-radius: 999px; background: var(--violet-50); border: 1px solid var(--violet-100); color: var(--violet-700); font-size: 0.73rem; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; }
.section-title { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.04em; font-size: clamp(1.7rem, 3.2vw, 2.35rem); color: var(--navy-800); line-height: 1.15; }

/* Tool cards */
.tool-card { display: flex; flex-direction: column; padding: 24px; }
.tool-card .tool-arrow { margin-top: auto; padding-top: 16px; display: inline-flex; align-items: center; gap: 8px; font-size: 0.8rem; font-weight: 700; color: var(--violet-700); transition: gap 0.2s ease; }
.tool-card:hover .tool-arrow { gap: 12px; }

.project-card { overflow: hidden; }
.project-card .project-accent { height: 4px; background: var(--grad-brand); }
.doc-card { transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease; }
.doc-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: #ddd1f4; }

.doc-preview {
  border-radius: 14px; overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface-2);
}

.paper {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 2px 4px rgba(22, 29, 47, 0.03), 0 30px 70px -45px rgba(22, 29, 47, 0.4);
  padding: clamp(22px, 4vw, 46px);
  position: relative;
}
.paper::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  border-radius: 18px 18px 0 0;
  background: linear-gradient(90deg, var(--violet-600), var(--navy-600), var(--mustard-500));
  opacity: 0.85;
}
.paper .prose-legal, .paper .md { font-size: 0.94rem; line-height: 1.85; }

/* Generate type tiles */
.type-tile {
  padding: 16px; border-radius: 14px;
  border: 1px solid var(--line-strong); background: #fff;
  text-align: left; cursor: pointer;
  transition: all 0.18s ease; display: flex; flex-direction: column; gap: 10px;
}
.type-tile i { font-size: 1.05rem; color: #8b8fa1; transition: color 0.18s ease; }
.type-tile span { font-size: 0.8rem; font-weight: 650; color: #4a5468; line-height: 1.35; }
.type-tile:hover { border-color: var(--violet-300); background: #fdfcff; transform: translateY(-1px); }
.type-tile:hover i { color: var(--violet-600); }
.type-tile.selected {
  border-color: var(--violet-500);
  background: linear-gradient(150deg, #f8f3ff, #efe6ff);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}
.type-tile.selected i, .type-tile.selected span { color: var(--violet-800); }

.drop-zone {
  border: 1.5px dashed #cfc3ea; border-radius: 16px;
  padding: 34px 20px; text-align: center; cursor: pointer;
  background: linear-gradient(160deg, #fcfaff, #f7f2ff);
  transition: all 0.18s ease;
}
.drop-zone:hover { border-color: var(--violet-400); background: #f8f3ff; }
.drop-zone i { color: var(--violet-400); }

/* Processing shimmer */
.shimmer { position: relative; overflow: hidden; background: #f1edfa; }
.shimmer::after {
  content: ''; position: absolute; inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.7), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }

/* =============================================================================
   Scrollbar
   ============================================================================= */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d3c9e8; border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #b09ad8; background-clip: content-box; }

/* =============================================================================
   Animations
   ============================================================================= */
.fade-in { animation: fadeIn 0.55s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
.fade-in-delay-1 { animation-delay: 0.08s; }
.fade-in-delay-2 { animation-delay: 0.16s; }
.fade-in-delay-3 { animation-delay: 0.24s; }

.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; animation: pulse 2.2s infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); opacity: 1; box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.35); } 50% { transform: scale(1.15); opacity: 0.85; box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); } }

.float-slow { animation: floatY 7s ease-in-out infinite; }
.float-slow-2 { animation: floatY 9s ease-in-out infinite reverse; }
@keyframes floatY { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* =============================================================================
   Responsive
   ============================================================================= */
@media (min-width: 1024px) {
  .auth-aside { display: flex; flex-direction: column; justify-content: space-between; }
}

@media (max-width: 1023px) {
  .nav-toggle { display: inline-flex; }
  .nav-links-desktop { display: none !important; }
}

/* Tiroir latéral du chat (mobile) */
.chat-sidebar-fab {
  display: none; position: fixed; left: 14px; bottom: 96px; z-index: 60;
  width: 46px; height: 46px; border-radius: 14px;
  background: var(--grad-brand); color: #fff; border: 0;
  align-items: center; justify-content: center;
  box-shadow: 0 14px 30px -12px rgba(124, 58, 237, 0.9);
}
.chat-sidebar-backdrop {
  display: none; position: fixed; inset: 64px 0 0 0; z-index: 50;
  background: rgba(18, 24, 40, 0.35); backdrop-filter: blur(2px);
}
.chat-sidebar-backdrop.open { display: block; }

@media (max-width: 768px) {
  .chat-page .sidebar:not(.guest-sidebar) {
    display: flex; position: fixed; top: 64px; bottom: 0; left: 0; z-index: 55;
    width: 284px; min-width: 284px;
    transform: translateX(-102%);
    transition: transform 0.26s cubic-bezier(0.22, 1, 0.36, 1);
    box-shadow: 0 30px 70px -24px rgba(22, 29, 47, 0.45);
    background: #fff;
  }
  .chat-page .sidebar:not(.guest-sidebar).open { transform: translateX(0); }
  .chat-sidebar-fab { display: inline-flex; }
  /* Sidebar invité : devient une simple barre de choix d'agent, compacte,
     qui ne prend plus la moitié de l'écran. */
  .chat-page .sidebar.guest-sidebar {
    position: static; transform: none;
    display: block; width: 100%; min-width: 0;
    height: auto; max-height: none; overflow: visible;
    background: #fff;
    border-right: 0; border-bottom: 1px solid var(--chat-line);
  }
  .guest-sidebar > div:first-child { padding: 10px 12px 8px !important; border-bottom: 0 !important; }
  /* Le titre "Chat juridique / Mode invité" est déjà redondant avec le header */
  .guest-sidebar > div:first-child > div:first-child { display: none; }
  .guest-sidebar .sidebar-section-label { margin-bottom: 6px; padding: 0 2px; }

  /* Les 4 agents tiennent dans une grille 2×2 : plus rien n'est masqué
     ni caché derrière un défilement horizontal. */
  .guest-sidebar .guest-agent-list {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    padding: 2px;
  }
  /* Neutralise space-y-1 (Tailwind) qui casserait la grille */
  .guest-sidebar .guest-agent-list > * { margin-top: 0 !important; }
  .guest-sidebar .guest-agent-option {
    display: flex; align-items: center; gap: 7px;
    width: 100%; min-width: 0;
    padding: 7px 10px 7px 8px; border-radius: 10px;
    background: #fff; border: 1px solid var(--line-strong);
    white-space: nowrap; overflow: hidden;
  }
  .guest-sidebar .guest-agent-option .agent-glyph { width: 24px; height: 24px; border-radius: 8px; font-size: 0.64rem; }
  .guest-sidebar .guest-agent-option .agent-name {
    font-size: 0.75rem; overflow: hidden; text-overflow: ellipsis;
  }
  .guest-sidebar .guest-agent-option > .fa-chevron-right { display: none; }
  .guest-sidebar .guest-agent-option.active { border-color: #c9b4ef; background: #f6f1ff; }

  .guest-sidebar-note { display: none; }
  .chat-shell.guest-chat-shell { flex-direction: column; }
  .chat-message { max-width: 100%; }
  .chat-bubble { max-width: calc(100% - 42px); padding: 12px 14px; font-size: 0.9rem; }
  .chat-header { padding: 10px 14px; min-height: 64px; }
  .chat-transcript { padding: 16px 12px; }
  .chat-composer { padding: 10px 12px 14px; }
  .attachment-chip { max-width: 100%; }
  .chat-composer .composer-row { gap: 8px; }
  .chat-composer .composer-actions { gap: 6px; }
  .chat-composer .composer-btn { width: 40px; height: 40px; }
  .chat-composer .composer-send { width: 44px; height: 44px; }
  /* Le bloc texte du header doit pouvoir se réduire, sinon il pousse les
     boutons hors de l'écran. */
  .chat-header > div.min-w-0 { flex: 1 1 auto; min-width: 0; }
  .chat-header .composer-btn { width: 38px; height: 38px; flex-shrink: 0; }
  .flash-message { left: 12px; right: 12px; max-width: none; top: 74px; }
  .modal-box { padding: 22px 18px; border-radius: 18px; }
  main h1 { font-size: 1.6rem; }
}

/* Petits téléphones : on libère de la place pour la zone de saisie */
@media (max-width: 430px) {
  #guestCounter { display: none !important; }
  .chat-header { gap: 10px; padding: 8px 12px; min-height: 58px; }
  .chat-header > .icon-tile { width: 36px !important; height: 36px !important; font-size: 0.8rem !important; }
  .chat-header .composer-btn { width: 36px; height: 36px; }
  .chat-composer .composer-btn { width: 36px; height: 36px; }
  .chat-composer .composer-send { width: 40px; height: 40px; }
  .chat-composer .composer-actions { gap: 5px; }
  .chat-transcript { padding: 14px 10px; }
  .chat-bubble { max-width: calc(100% - 36px); font-size: 0.87rem; padding: 11px 13px; }
  .chat-bubble.user { max-width: 90%; }
  .guest-sidebar .guest-agent-option { padding: 6px 10px 6px 7px; }
  .guest-sidebar .guest-agent-option .agent-name { font-size: 0.72rem; }
  /* Sur téléphone le champ ne doit jamais dépasser en largeur */
  .chat-composer .composer-box { min-width: 0; }
  .chat-composer textarea.form-input { font-size: 16px; } /* évite le zoom auto iOS */
  .composer-hint { margin-top: 8px !important; padding: 0 2px !important; }
}

/* =============================================================================
   Print (documents générés)
   ============================================================================= */
@media print {
  .navbar, footer, .no-print, .flash-message { display: none !important; }
  body { background: #fff !important; }
  .paper { box-shadow: none; border: 0; padding: 0; }
  .paper::before { display: none; }
  .prose-legal, .md { font-size: 12pt; color: #000; }
}
