@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700;900&family=Crimson+Text:ital,wght@0,400;0,600;1,400&family=IM+Fell+English:ital@0;1&display=swap');

:root {
  --ink-dark: #1a1008;
  --ink-med: #3a2010;
  --gold: #b85c20;
  --gold-dark: #8a4418;
  --gold-light: #e8a050;
  --gold-bright: #d4782a;
  --border: #7a4c1a;
  --paper-top: rgba(255, 248, 224, 0.82);
  --paper-bottom: rgba(235, 215, 150, 0.92);
  --red-seal: #8b1a1a;
  --status-open: #4a7a2e;
  --status-waiting: #b85c20;
  --status-watch: #6b5a1e;
  --status-justice: #6b3fa0;
  --status-closed: #2a7a5a;
  --status-suspended: #7a4a2a;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body.page-investigations {
  min-height: 100vh;
  padding: 26px 18px 60px;
  font-family: 'Crimson Text', serif;
  color: var(--ink-dark);
  background:
    radial-gradient(ellipse at 18% 18%, #1a1008 0%, transparent 58%),
    radial-gradient(ellipse at 82% 82%, #0d0804 0%, transparent 58%),
    #120a04;
}

/* ═══════════════════════════════════════
   Toast Notifications
   ═══════════════════════════════════════ */

.toast-container {
  position: fixed;
  top: 68px;
  right: 18px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: 400px;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  font-family: 'Crimson Text', serif;
  font-size: 16px;
  line-height: 1.35;
  border-radius: 3px;
  border: 1px solid rgba(184,92,32,0.5);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(0, 0, 0, 0.2);
  animation: toastIn 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast.toast-out {
  opacity: 0;
  transform: translateX(30px);
}

.toast-success {
  background: linear-gradient(135deg, #1a2a10, #2a3a15);
  color: #b8e090;
  border-color: rgba(100, 160, 50, 0.5);
}

.toast-error {
  background: linear-gradient(135deg, #2a1010, #3a1515);
  color: #e8a0a0;
  border-color: rgba(160, 50, 50, 0.5);
}

.toast-info {
  background: linear-gradient(135deg, #1a1a08, #2a2a10);
  color: #e8d8a0;
  border-color: rgba(184,92,32,0.5);
}

.toast-icon {
  font-size: 20px;
  flex-shrink: 0;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px) scale(0.95); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

/* ═══════════════════════════════════════
   Navigation
   ═══════════════════════════════════════ */

.btn-back {
  position: fixed;
  top: 18px;
  left: 18px;
  z-index: 999;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-family: 'Cinzel', serif;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--gold-light);
  background: linear-gradient(135deg, #261408, #261404);
  border: 2px solid var(--gold);
  border-radius: 2px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
  transition: all 0.2s ease;
}

.btn-back:hover {
  background: linear-gradient(135deg, #1e1208, #261404);
  border-color: var(--gold-light);
  color: #fff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6), 0 0 10px rgba(212,120,42,0.25);
  transform: translateX(-2px);
}

.user-bar {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 999;
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-bar-inner {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-burger {
  display: none;
  font-size: 18px;
  background: rgba(10, 7, 2, 0.88);
  border: 1px solid rgba(184,92,32,0.4);
  border-radius: 2px;
  color: #b85c20;
  padding: 5px 10px;
  cursor: pointer;
}

.user-badge,
.btn-user-action {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 14px;
  font-family: 'Cinzel', serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  white-space: nowrap;
  text-decoration: none;
  background: rgba(10, 7, 2, 0.88);
  border: 1px solid rgba(184,92,32,0.55);
  color: #d8ab2f;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.28);
  transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}

.user-badge:hover,
.btn-user-action:hover {
  border-color: #e8a050;
  color: #f6d77f;
  background: rgba(20, 14, 4, 0.96);
}

.btn-admin-panel {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ═══════════════════════════════════════
   Main Frame
   ═══════════════════════════════════════ */

.frame {
  position: relative;
  max-width: 1380px;
  margin: 64px auto 0;
  padding: 8px;
  border: 3px solid #7a3810;
  border-radius: 4px;
  background: linear-gradient(160deg, #f0d870 0%, #a86018 25%, #e09838 50%, #b85c20 75%, #d4882a 100%);
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.6), inset 0 0 20px rgba(200, 160, 20, 0.3);
}

.frame-corner {
  position: absolute;
  color: #7a3810;
  font-size: 14px;
  line-height: 1;
  z-index: 5;
}

.frame-corner.tl { top: 10px; left: 12px; }
.frame-corner.tr { top: 10px; right: 12px; }
.frame-corner.bl { bottom: 10px; left: 12px; }
.frame-corner.br { bottom: 10px; right: 12px; }

.frame-inner {
  position: relative;
  overflow: hidden;
  padding: 30px 28px 24px;
  border: 2px solid #b85c20;
  background: linear-gradient(170deg, #f4e4c0 0%, #dc9a38 30%, #e8c890 60%, #d09030 100%);
}

.frame-inner::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: repeating-linear-gradient(0deg, transparent, transparent 28px, rgba(184,108,36,0.05) 28px, rgba(184,108,36,0.05) 29px);
}

.watermark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-24deg);
  font-family: 'Cinzel', serif;
  font-size: clamp(74px, 9vw, 118px);
  font-weight: 900;
  letter-spacing: 10px;
  color: rgba(184,108,36,0.07);
  pointer-events: none;
  user-select: none;
  z-index: 0;
}

.doc-header,
.summary-row,
.create-shell,
.filter-shell,
.investigation-grid {
  position: relative;
  z-index: 1;
}

/* ═══════════════════════════════════════
   Page Header
   ═══════════════════════════════════════ */

.doc-header {
  text-align: center;
  margin-bottom: 24px;
}

.kanji-line {
  font-family: 'Cinzel', serif;
  font-size: 9px;
  letter-spacing: 5px;
  text-transform: uppercase;
  color: var(--gold-dark);
  margin-bottom: 4px;
}

.page-title {
  font-family: 'Cinzel', serif;
  font-size: clamp(24px, 3.2vw, 34px);
  font-weight: 900;
  letter-spacing: 3px;
  text-transform: uppercase;
}

.sub-title {
  font-family: 'Cinzel', serif;
  font-size: 10px;
  letter-spacing: 2.6px;
  text-transform: uppercase;
  color: var(--ink-med);
  margin-top: 4px;
}

.header-divider {
  width: 60%;
  max-width: 420px;
  height: 2px;
  margin: 14px auto 0;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

/* ═══════════════════════════════════════
   Summary Cards
   ═══════════════════════════════════════ */

.summary-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.summary-card {
  padding: 18px 16px;
  text-align: center;
  background: linear-gradient(180deg, var(--paper-top), var(--paper-bottom));
  border: 2px solid rgba(152,76,24,0.65);
  border-radius: 3px;
  box-shadow: 0 10px 24px rgba(80,40,12,0.14), inset 0 0 16px rgba(255, 255, 255, 0.25);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.summary-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(80,40,12,0.2), inset 0 0 16px rgba(255, 255, 255, 0.3);
}

.summary-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.summary-icon {
  font-size: 22px;
  margin-bottom: 4px;
  opacity: 0.7;
}

.summary-label {
  font-family: 'Cinzel', serif;
  text-transform: uppercase;
  font-size: 9px;
  letter-spacing: 2.2px;
  color: var(--gold-dark);
}

.agent-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.agent-picker-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.agent-picker-row select {
  flex: 1 1 auto;
  min-width: 0;
}

.btn-agent-add {
  min-width: 108px;
  padding-inline: 14px;
}

.agent-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 38px;
}

.agent-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid rgba(152,76,24,0.34);
  background: rgba(255, 248, 224, 0.64);
  font-family: 'Cinzel', serif;
  font-size: 10px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--ink-dark);
}

.agent-chip-empty {
  color: rgba(90, 58, 16, 0.78);
  font-style: italic;
  text-transform: none;
  letter-spacing: 0.4px;
}

.agent-chip-remove {
  width: 18px;
  height: 18px;
  border: none;
  border-radius: 50%;
  background: rgba(152,76,24,0.16);
  color: var(--ink-med);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

.agent-chip-remove:hover {
  background: rgba(152,76,24,0.28);
}

.summary-value {
  font-family: 'Cinzel', serif;
  font-size: 32px;
  font-weight: 900;
  margin-top: 6px;
  color: var(--ink-dark);
}

/* ═══════════════════════════════════════
   Create & Filter Shells
   ═══════════════════════════════════════ */

.create-shell,
.filter-shell {
  margin-bottom: 22px;
  padding: 20px 22px;
  background: linear-gradient(180deg, var(--paper-top), var(--paper-bottom));
  border: 2px solid rgba(152,76,24,0.65);
  border-radius: 3px;
  box-shadow: 0 10px 24px rgba(80,40,12,0.14), inset 0 0 16px rgba(255, 255, 255, 0.25);
}

.shell-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.shell-copy {
  max-width: 760px;
}

.shell-kicker {
  margin-bottom: 6px;
  font-family: 'Cinzel', serif;
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold-dark);
}

.shell-header h2 {
  margin: 0 0 8px;
  font-family: 'Cinzel', serif;
  font-size: clamp(20px, 2.2vw, 28px);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.shell-header p {
  margin: 0;
  color: rgba(42, 26, 8, 0.8);
  font-size: 18px;
  line-height: 1.45;
}

.shell-aside {
  width: min(300px, 100%);
  padding: 14px 16px;
  border: 1px solid rgba(184, 146, 42, 0.36);
  border-radius: 3px;
  background: rgba(255, 248, 224, 0.5);
  box-shadow: inset 0 0 14px rgba(255, 255, 255, 0.16);
}

.aside-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  padding: 6px 10px;
  border: 1px solid rgba(184, 146, 42, 0.45);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.42);
  font-family: 'Cinzel', serif;
  font-size: 10px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--gold-dark);
}

.aside-text {
  color: rgba(61, 40, 12, 0.86);
  font-size: 16px;
  line-height: 1.45;
}

.results-head {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-end;
  margin: 0 4px 16px;
}

.results-title {
  margin: 0;
  font-family: 'Cinzel', serif;
  font-size: clamp(20px, 2.2vw, 28px);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.results-copy {
  max-width: 480px;
  color: rgba(61, 40, 12, 0.8);
  font-size: 16px;
  line-height: 1.45;
  text-align: right;
}

.shell-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.shell-copy {
  max-width: 760px;
}

.shell-kicker {
  margin-bottom: 6px;
  font-family: 'Cinzel', serif;
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold-dark);
}

.shell-header h2 {
  margin: 0 0 8px;
  font-family: 'Cinzel', serif;
  font-size: clamp(20px, 2.2vw, 28px);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.shell-header p {
  margin: 0;
  color: rgba(42, 26, 8, 0.8);
  font-size: 18px;
  line-height: 1.45;
}

.shell-aside {
  width: min(300px, 100%);
  padding: 14px 16px;
  border: 1px solid rgba(184, 146, 42, 0.36);
  border-radius: 3px;
  background: rgba(255, 248, 224, 0.5);
  box-shadow: inset 0 0 14px rgba(255, 255, 255, 0.16);
}

.aside-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  padding: 6px 10px;
  border: 1px solid rgba(184, 146, 42, 0.45);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.42);
  font-family: 'Cinzel', serif;
  font-size: 10px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--gold-dark);
}

.aside-text {
  color: rgba(61, 40, 12, 0.86);
  font-size: 16px;
  line-height: 1.45;
}

.results-head {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-end;
  margin: 0 4px 16px;
}

.results-title {
  margin: 0;
  font-family: 'Cinzel', serif;
  font-size: clamp(20px, 2.2vw, 28px);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.results-copy {
  max-width: 480px;
  color: rgba(61, 40, 12, 0.8);
  font-size: 16px;
  line-height: 1.45;
  text-align: right;
}

.section-headline h2,
.section-headline h3 {
  margin: 0 0 6px;
  font-family: 'Cinzel', serif;
  font-size: clamp(18px, 2.2vw, 24px);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.section-headline p {
  margin: 0 0 18px;
  color: rgba(42, 26, 8, 0.72);
  font-size: 17px;
}

.filter-grid,
.detail-top-grid,
.detail-columns {
  display: grid;
  gap: 14px;
}

.detail-columns {
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  align-items: start;
}

.filter-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-group label,
.detail-field label,
.detail-kicker {
  font-family: 'Cinzel', serif;
  text-transform: uppercase;
  font-size: 9px;
  letter-spacing: 2.2px;
  color: var(--gold-dark);
  font-weight: 700;
}

.filter-group.grow,
.filter-group.full,
.detail-field.detail-field-wide {
  grid-column: span 2;
}

.filter-input,
.filter-select,
.detail-textarea,
.entry-form select,
.link-form select {
  width: 100%;
  padding: 11px 14px;
  font-family: 'Crimson Text', serif;
  font-size: 17px;
  color: var(--ink-dark);
  background: rgba(255, 252, 240, 0.55);
  border: 1px solid rgba(184, 146, 42, 0.4);
  border-radius: 3px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.filter-input:focus,
.filter-select:focus,
.detail-textarea:focus,
.entry-form select:focus,
.link-form select:focus {
  border-color: var(--gold);
  background: rgba(255, 255, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(184,92,32,0.15), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.filter-input,
.filter-select,
.entry-form select,
.link-form select {
  min-height: 46px;
}

.detail-textarea {
  min-height: 100px;
  resize: vertical;
}

.detail-textarea-short {
  min-height: 72px;
}

.filter-actions,
.modal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-top: 16px;
}

/* ═══════════════════════════════════════
   Buttons
   ═══════════════════════════════════════ */

.btn-primary,
.btn-secondary,
.btn-danger {
  padding: 10px 16px;
  border-radius: 3px;
  font-family: 'Cinzel', serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  border: 1px solid rgba(184, 146, 42, 0.7);
  color: #e8a050;
  background: linear-gradient(135deg, #1a1008, #261408);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #3a2a12, #4d3b14);
  border-color: var(--gold-light);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3), 0 0 8px rgba(184,92,32,0.2);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.btn-secondary {
  border: 1px solid rgba(152,76,24,0.35);
  background: rgba(255, 255, 255, 0.22);
  color: var(--ink-med);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.35);
  border-color: rgba(152,76,24,0.55);
}

.btn-danger {
  border: 1px solid rgba(139, 26, 26, 0.35);
  background: rgba(139, 26, 26, 0.08);
  color: #7b1e1e;
}

.btn-danger:hover {
  background: rgba(139, 26, 26, 0.15);
  border-color: rgba(139, 26, 26, 0.55);
}

.btn-danger.small {
  padding: 7px 10px;
  font-size: 9px;
}

/* ═══════════════════════════════════════
   Investigation Grid & Cards
   ═══════════════════════════════════════ */

.investigation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
}

.state-card {
  padding: 30px;
  text-align: center;
  font-size: 18px;
  color: var(--ink-med);
  background: linear-gradient(180deg, var(--paper-top), var(--paper-bottom));
  border: 2px solid rgba(152,76,24,0.65);
  border-radius: 3px;
  box-shadow: 0 10px 24px rgba(80,40,12,0.14), inset 0 0 16px rgba(255, 255, 255, 0.25);
}

.state-card.compact {
  padding: 16px;
  font-size: 15px;
}

.investigation-card {
  display: flex;
  flex-direction: column;
  min-height: 280px;
  padding: 20px;
  cursor: pointer;
  background: linear-gradient(180deg, var(--paper-top), var(--paper-bottom));
  border: 2px solid rgba(152,76,24,0.55);
  border-radius: 3px;
  box-shadow: 0 6px 20px rgba(80,40,12,0.12), inset 0 0 16px rgba(255, 255, 255, 0.25);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
  position: relative;
  overflow: hidden;
}

.investigation-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  transition: width 0.2s ease;
}

.investigation-card:hover {
  transform: translateY(-3px);
  border-color: rgba(184, 146, 42, 0.82);
  box-shadow: 0 16px 36px rgba(80,40,12,0.22), inset 0 0 16px rgba(255, 255, 255, 0.3);
}

.investigation-card:hover::before {
  width: 5px;
}

/* Status accent bars on cards */
.investigation-card[data-status="en-cours"]::before { background: var(--status-open); }
.investigation-card[data-status="en-attente-de-preuves"]::before { background: var(--status-waiting); }
.investigation-card[data-status="en-surveillance"]::before { background: var(--status-watch); }
.investigation-card[data-status="transmise-a-la-justice"]::before { background: var(--status-justice); }
.investigation-card[data-status="bouclee"]::before { background: var(--status-closed); }
.investigation-card[data-status="suspendue"]::before { background: var(--status-suspended); }

.investigation-status {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border-radius: 999px;
  font-family: 'Cinzel', serif;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 1.8px;
  text-transform: uppercase;
}

.status-en-cours {
  background: rgba(74, 122, 46, 0.15);
  border: 1px solid rgba(74, 122, 46, 0.35);
  color: var(--status-open);
}

.status-en-attente-de-preuves {
  background: rgba(184,92,32,0.12);
  border: 1px solid rgba(184,92,32,0.35);
  color: var(--status-waiting);
}

.status-en-surveillance {
  background: rgba(107, 90, 30, 0.12);
  border: 1px solid rgba(107, 90, 30, 0.3);
  color: var(--status-watch);
}

.status-transmise-a-la-justice {
  background: rgba(107, 63, 160, 0.1);
  border: 1px solid rgba(107, 63, 160, 0.3);
  color: var(--status-justice);
}

.status-bouclee {
  background: rgba(42, 122, 90, 0.12);
  border: 1px solid rgba(42, 122, 90, 0.3);
  color: var(--status-closed);
}

.status-suspendue {
  background: rgba(122, 74, 42, 0.12);
  border: 1px solid rgba(122, 74, 42, 0.3);
  color: var(--status-suspended);
}

.investigation-topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.investigation-updated {
  font-family: 'Cinzel', serif;
  font-size: 10px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: rgba(152,76,24,0.78);
  text-align: right;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-en-cours .status-dot { background: var(--status-open); box-shadow: 0 0 6px rgba(74, 122, 46, 0.5); }
.status-en-attente-de-preuves .status-dot { background: var(--status-waiting); box-shadow: 0 0 6px rgba(184,92,32,0.5); }
.status-en-surveillance .status-dot { background: var(--status-watch); box-shadow: 0 0 6px rgba(107, 90, 30, 0.5); }
.status-transmise-a-la-justice .status-dot { background: var(--status-justice); box-shadow: 0 0 6px rgba(107, 63, 160, 0.5); }
.status-bouclee .status-dot { background: var(--status-closed); box-shadow: 0 0 6px rgba(42, 122, 90, 0.5); }
.status-suspendue .status-dot { background: var(--status-suspended); box-shadow: 0 0 6px rgba(122, 74, 42, 0.5); }

.investigation-title {
  margin: 14px 0 8px;
  font-family: 'Cinzel', serif;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0.5px;
}

.investigation-summary {
  flex: 1;
  color: rgba(42, 26, 8, 0.82);
  font-size: 16px;
  line-height: 1.45;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.investigation-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.meta-block {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid rgba(184, 146, 42, 0.26);
  border-radius: 2px;
  background: rgba(255, 249, 231, 0.55);
  color: rgba(61, 40, 12, 0.78);
}

.meta-label {
  display: block;
  margin-bottom: 6px;
  font-family: 'Cinzel', serif;
  font-size: 9px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--gold-dark);
}

.meta-block strong {
  display: block;
  font-size: 18px;
  line-height: 1.2;
}

.investigation-metrics {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.metric-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
  border: 1px solid rgba(184, 146, 42, 0.28);
  border-radius: 999px;
  background: rgba(255, 248, 224, 0.68);
  font-family: 'Cinzel', serif;
  font-size: 9px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--gold-dark);
}

.investigation-footer {
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(184,92,32,0.2);
  color: rgba(152,76,24,0.72);
  font-family: 'Cinzel', serif;
  font-size: 9px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
}

.investigation-footer .open-label,
.investigation-footer .footer-cta {
  color: var(--gold);
  font-weight: 700;
  transition: color 0.2s;
}

.investigation-card:hover .open-label,
.investigation-card:hover .footer-cta {
  color: var(--gold-light);
}

/* ═══════════════════════════════════════
   Detail Modal
   ═══════════════════════════════════════ */

.modal-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 18% 22%, rgba(212,120,42,0.12), transparent 28%),
    linear-gradient(180deg, rgba(10, 6, 2, 0.82), rgba(8, 5, 1, 0.92));
  backdrop-filter: blur(12px);
  z-index: 1200;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
}

.detail-modal {
  width: min(1260px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 0;
  position: relative;
  isolation: isolate;
  border: 3px solid rgba(152,76,24,0.72);
  border-radius: 4px;
  background:
    linear-gradient(180deg, rgba(249, 236, 183, 0.97), rgba(235, 208, 111, 0.95)),
    repeating-linear-gradient(180deg, rgba(152,76,24,0.06) 0 1px, transparent 1px 29px);
  box-shadow:
    0 0 0 3px rgba(184,92,32,0.5),
    0 28px 80px rgba(0, 0, 0, 0.5),
    inset 0 0 26px rgba(255, 255, 255, 0.24);
  animation: modalIn 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.detail-modal[data-status="en-cours"] {
  box-shadow:
    0 0 0 3px rgba(74, 122, 46, 0.28),
    0 28px 80px rgba(0, 0, 0, 0.5),
    inset 0 0 26px rgba(255, 255, 255, 0.24);
}

.detail-modal[data-status="en-attente-de-preuves"] {
  box-shadow:
    0 0 0 3px rgba(184,92,32,0.3),
    0 28px 80px rgba(0, 0, 0, 0.5),
    inset 0 0 26px rgba(255, 255, 255, 0.24);
}

.detail-modal[data-status="en-surveillance"] {
  box-shadow:
    0 0 0 3px rgba(107, 90, 30, 0.28),
    0 28px 80px rgba(0, 0, 0, 0.5),
    inset 0 0 26px rgba(255, 255, 255, 0.24);
}

.detail-modal[data-status="transmise-a-la-justice"] {
  box-shadow:
    0 0 0 3px rgba(120, 42, 42, 0.3),
    0 28px 80px rgba(0, 0, 0, 0.5),
    inset 0 0 26px rgba(255, 255, 255, 0.24);
}

.detail-modal[data-status="bouclee"] {
  box-shadow:
    0 0 0 3px rgba(74, 93, 122, 0.3),
    0 28px 80px rgba(0, 0, 0, 0.5),
    inset 0 0 26px rgba(255, 255, 255, 0.24);
}

.detail-modal[data-status="suspendue"] {
  box-shadow:
    0 0 0 3px rgba(90, 90, 90, 0.28),
    0 28px 80px rgba(0, 0, 0, 0.5),
    inset 0 0 26px rgba(255, 255, 255, 0.24);
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.detail-modal::before {
  content: '';
  position: absolute;
  inset: 12px;
  border: 1px solid rgba(184,108,36,0.35);
  pointer-events: none;
  z-index: -1;
  border-radius: 2px;
}

.detail-modal::after {
  content: 'ENQUETE';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-20deg);
  font-family: 'Cinzel', serif;
  font-size: clamp(72px, 8vw, 120px);
  font-weight: 900;
  letter-spacing: 10px;
  color: rgba(184,108,36,0.04);
  pointer-events: none;
  user-select: none;
  z-index: -1;
}

/* Modal header */
.detail-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 24px 28px 18px;
  border-bottom: 2px solid rgba(184,92,32,0.25);
  background: linear-gradient(180deg, rgba(255, 250, 230, 0.4), transparent);
}

.detail-title {
  margin: 4px 0 0;
  font-family: 'Cinzel', serif;
  font-size: clamp(26px, 3.5vw, 42px);
  line-height: 1;
  letter-spacing: 1px;
  text-transform: uppercase;
  text-wrap: balance;
}

.modal-close {
  width: 42px;
  height: 42px;
  font-size: 24px;
  border-radius: 3px;
  border: 1px solid rgba(184,92,32,0.42);
  background: linear-gradient(180deg, rgba(255, 246, 214, 0.9), rgba(233, 211, 142, 0.9));
  color: #4a2c0f;
  box-shadow: 0 4px 12px rgba(80,40,12,0.1);
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
  flex-shrink: 0;
}

.modal-close:hover {
  transform: translateY(-1px);
  border-color: rgba(184,92,32,0.76);
  background: linear-gradient(180deg, rgba(255, 250, 227, 0.98), rgba(240, 220, 156, 0.95));
}

/* Modal body */
.detail-body {
  padding: 22px 28px 24px;
  display: grid;
  gap: 18px;
  background:
    linear-gradient(180deg, rgba(255, 248, 219, 0.4), rgba(240, 214, 120, 0.08)),
    repeating-linear-gradient(180deg, rgba(152,76,24,0.035) 0 1px, transparent 1px 34px);
}

/* Top grid : statut, agent, resume */
.detail-top-grid {
  grid-template-columns: 1fr 1fr 2fr;
  margin-bottom: 14px;
}

.detail-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.detail-field select,
.detail-field textarea,
.entry-form select,
.entry-form textarea,
.link-form select,
.attachment-form input[type="text"],
.attachment-form input[type="file"] {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid rgba(184, 146, 42, 0.4);
  border-radius: 3px;
  outline: none;
  background: rgba(255, 252, 240, 0.65);
  color: var(--ink-dark);
  font-family: 'Crimson Text', serif;
  font-size: 17px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.detail-field select:focus,
.detail-field textarea:focus,
.entry-form select:focus,
.entry-form textarea:focus,
.link-form select:focus {
  border-color: var(--gold);
  background: rgba(255, 255, 255, 0.45);
  box-shadow: 0 0 0 3px rgba(184,92,32,0.12), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.attachment-form input[type="file"]::file-selector-button {
  margin-right: 12px;
  padding: 8px 12px;
  border: 1px solid rgba(184, 146, 42, 0.6);
  border-radius: 2px;
  background: linear-gradient(135deg, #1a1008, #261408);
  color: #e8a050;
  font-family: 'Cinzel', serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  cursor: pointer;
}

/* Meta bar */
.detail-meta-bar {
  display: flex;
  justify-content: flex-start;
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px 0 18px;
}

.detail-meta-bar span {
  padding: 7px 14px;
  border: 1px solid rgba(184, 146, 42, 0.22);
  border-radius: 999px;
  background: rgba(255, 248, 224, 0.5);
  font-size: 13px;
  color: rgba(61, 40, 12, 0.72);
}

.detail-meta-bar .meta-chip-status {
  border-width: 2px;
  font-weight: 700;
}

.detail-meta-bar .meta-chip-en-cours {
  background: rgba(74, 122, 46, 0.12);
  color: var(--status-open);
  border-color: rgba(74, 122, 46, 0.34);
}

.detail-meta-bar .meta-chip-en-attente-de-preuves {
  background: rgba(184,92,32,0.12);
  color: var(--status-waiting);
  border-color: rgba(184,92,32,0.34);
}

.detail-meta-bar .meta-chip-en-surveillance {
  background: rgba(107, 90, 30, 0.12);
  color: var(--status-watch);
  border-color: rgba(107, 90, 30, 0.3);
}

.detail-meta-bar .meta-chip-transmise-a-la-justice {
  background: rgba(120, 42, 42, 0.1);
  color: var(--status-justice);
  border-color: rgba(120, 42, 42, 0.28);
}

.detail-meta-bar .meta-chip-bouclee {
  background: rgba(74, 93, 122, 0.12);
  color: var(--status-closed);
  border-color: rgba(74, 93, 122, 0.28);
}

.detail-meta-bar .meta-chip-suspendue {
  background: rgba(90, 90, 90, 0.12);
  color: var(--status-suspended);
  border-color: rgba(90, 90, 90, 0.28);
}

/* ═══════════════════════════════════════
   Modal Tabs
   ═══════════════════════════════════════ */

.detail-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid rgba(184,92,32,0.25);
  margin-bottom: 20px;
}

.detail-tab {
  padding: 12px 22px;
  font-family: 'Cinzel', serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: rgba(90, 58, 16, 0.6);
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease;
  position: relative;
}

.detail-tab:hover {
  color: var(--ink-med);
}

.detail-tab.active {
  color: var(--ink-dark);
  border-bottom-color: var(--gold);
}

.detail-tab .tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  margin-left: 8px;
  font-size: 10px;
  font-family: 'Cinzel', serif;
  font-weight: 900;
  border-radius: 10px;
  background: rgba(184,92,32,0.12);
  color: var(--gold-dark);
}

.detail-tab.active .tab-count {
  background: rgba(184,92,32,0.2);
  color: var(--ink-dark);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  animation: tabFadeIn 0.25s ease;
}

@keyframes tabFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════
   Detail Sections (inside tabs)
   ═══════════════════════════════════════ */

.detail-section,
.detail-section-full {
  padding: 18px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, var(--paper-top), var(--paper-bottom));
  border: 2px solid rgba(152,76,24,0.5);
  border-radius: 3px;
  box-shadow: 0 6px 18px rgba(80,40,12,0.08), inset 0 0 16px rgba(255, 255, 255, 0.25);
}

.detail-section {
  min-height: 100%;
}

.detail-section-full {
  margin-top: 4px;
}

.detail-section::before,
.detail-section-full::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.12), transparent 44%),
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.1), transparent 32%);
  pointer-events: none;
}

/* ═══════════════════════════════════════
   Entry Form (Suivi)
   ═══════════════════════════════════════ */

.entry-form {
  display: grid;
  grid-template-columns: 180px 1fr auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 18px;
}

.entry-form textarea {
  min-height: 80px;
}

/* ═══════════════════════════════════════
   Link Form
   ═══════════════════════════════════════ */

.link-form {
  display: grid;
  grid-template-columns: 1fr 1.5fr auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 18px;
}

/* ═══════════════════════════════════════
   Attachment Form
   ═══════════════════════════════════════ */

.attachment-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 18px;
}

/* ═══════════════════════════════════════
   Timeline Entries
   ═══════════════════════════════════════ */

.timeline-entry {
  padding: 16px 18px;
  border: 1px solid rgba(184,92,32,0.2);
  border-left: 4px solid var(--gold);
  border-radius: 0 3px 3px 0;
  background: rgba(255, 249, 231, 0.75);
  box-shadow: 0 4px 14px rgba(80,40,12,0.06);
  transition: border-left-color 0.2s ease;
}

.timeline-entry:hover {
  border-left-color: var(--gold-light);
}

.timeline-entry + .timeline-entry {
  margin-top: 10px;
}

.timeline-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.timeline-kind {
  font-family: 'Cinzel', serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--gold-dark);
}

.timeline-kind-suivi { color: var(--status-open); }
.timeline-kind-temoignage { color: var(--status-justice); }
.timeline-kind-note { color: var(--status-watch); }

.timeline-meta {
  font-size: 13px;
  color: rgba(61, 40, 12, 0.6);
}

.timeline-content {
  margin-top: 10px;
  font-size: 17px;
  line-height: 1.5;
  white-space: pre-wrap;
  color: var(--ink-dark);
}

/* ═══════════════════════════════════════
   Linked Pills
   ═══════════════════════════════════════ */

.linked-pill {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid rgba(184,92,32,0.2);
  border-left: 4px solid rgba(184,92,32,0.6);
  border-radius: 0 3px 3px 0;
  background: rgba(255, 249, 231, 0.75);
  box-shadow: 0 4px 14px rgba(80,40,12,0.06);
  transition: background 0.2s ease;
}

.linked-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.linked-kind {
  font-family: 'Cinzel', serif;
  font-size: 10px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--gold-dark);
}

.linked-title {
  font-size: 18px;
  color: var(--ink-dark);
}

.linked-ref {
  font-size: 13px;
  color: rgba(61, 40, 12, 0.62);
}

.linked-pill:hover {
  background: rgba(255, 252, 240, 0.9);
}

.linked-pill + .linked-pill {
  margin-top: 10px;
}

.pill-delete {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 18px;
  border: 1px solid rgba(139, 26, 26, 0.25);
  background: rgba(139, 26, 26, 0.06);
  color: #7b1e1e;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pill-delete:hover {
  background: rgba(139, 26, 26, 0.12);
  border-color: rgba(139, 26, 26, 0.4);
}

/* ═══════════════════════════════════════
   Attachment Grid
   ═══════════════════════════════════════ */

.attachment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.attachment-card {
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(184,92,32,0.2);
  border-radius: 3px;
  background: rgba(255, 249, 231, 0.75);
  box-shadow: 0 6px 18px rgba(80,40,12,0.08);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.attachment-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(80,40,12,0.14);
}

.attachment-card img {
  width: 100%;
  height: 200px;
  object-fit: cover;
  display: block;
  border-bottom: 1px solid rgba(184,92,32,0.15);
}

.attachment-card figcaption {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
}

.attachment-card figcaption strong {
  font-family: 'Cinzel', serif;
  font-size: 11px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.attachment-card .btn-danger.small {
  align-self: flex-start;
  margin-top: 6px;
}

/* ═══════════════════════════════════════
   Modal Actions (bottom bar)
   ═══════════════════════════════════════ */

.modal-actions {
  padding: 16px 28px;
  border-top: 2px solid rgba(184,92,32,0.2);
  background: linear-gradient(180deg, transparent, rgba(255, 248, 224, 0.3));
}

/* ═══════════════════════════════════════
   Section Headlines (inside tabs)
   ═══════════════════════════════════════ */

.section-headline h3 {
  margin-bottom: 4px;
  font-size: clamp(16px, 2vw, 22px);
  line-height: 1;
}

.section-headline p {
  font-size: 15px;
  margin-bottom: 14px;
}

/* ═══════════════════════════════════════
   Responsive
   ═══════════════════════════════════════ */

@media (max-width: 1180px) {
  .summary-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .shell-header,
  .results-head {
    flex-direction: column;
    align-items: stretch;
  }

  .results-copy {
    max-width: none;
    text-align: left;
  }

  .filter-grid,
  .detail-top-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-columns {
    grid-template-columns: 1fr;
  }

  .filter-group.grow,
  .filter-group.full,
  .detail-field.detail-field-wide {
    grid-column: auto;
  }

  .entry-form,
  .link-form,
  .attachment-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  body.page-investigations {
    padding: 18px 10px 44px;
  }

  .frame {
    width: calc(100vw - 22px);
    margin: 72px auto 24px;
    padding: 10px;
  }

  .frame-inner {
    padding: 16px;
  }

  .summary-row,
  .investigation-grid,
  .attachment-grid,
  .filter-grid,
  .detail-top-grid,
  .detail-columns {
    grid-template-columns: 1fr;
  }

  .investigation-topline,
  .investigation-meta,
  .investigation-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .investigation-updated,
  .results-copy {
    text-align: left;
  }

  .detail-modal {
    width: calc(100vw - 18px);
  }

  .detail-header {
    padding: 16px 18px 14px;
    gap: 12px;
  }

  .detail-body {
    padding: 16px 18px;
  }

  .detail-title {
    font-size: clamp(22px, 8vw, 34px);
  }

  .detail-meta-bar span {
    width: 100%;
  }

  .detail-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .detail-tab {
    padding: 10px 16px;
    font-size: 10px;
    white-space: nowrap;
  }

  .entry-form,
  .link-form,
  .attachment-form {
    grid-template-columns: 1fr;
  }

  .modal-actions {
    padding: 14px 18px;
  }

  .btn-back {
    top: 10px;
    left: 6px;
    padding: 6px 10px;
    font-size: 9px;
    letter-spacing: 1px;
  }

  .btn-back-text {
    display: none;
  }

  .user-bar {
    top: 8px;
    right: 6px;
    gap: 0;
  }

  .btn-burger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .user-bar-inner {
    position: fixed;
    top: 50px;
    right: 6px;
    display: none;
    flex-direction: column;
    gap: 6px;
    min-width: 165px;
    padding: 10px 8px;
    border: 1px solid rgba(184,92,32,0.55);
    border-radius: 4px;
    background: rgba(8, 5, 1, 0.97);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
    z-index: 1000;
  }

  .user-bar-inner.open {
    display: flex;
  }

  .user-bar-inner .user-badge {
    width: 100%;
    margin-bottom: 2px;
    padding: 8px 10px;
    border-bottom: 1px solid rgba(184,92,32,0.28);
    text-align: center;
    font-size: 10px;
    letter-spacing: 0.5px;
  }

  .user-bar-inner .btn-user-action {
    width: 100%;
    justify-content: flex-start;
    padding: 8px 10px;
    font-size: 10px;
  }

.toast-container {
    top: auto;
    bottom: 18px;
    right: 10px;
    left: 10px;
    max-width: none;
  }
}
