@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
  --color-black: #0F0F0F;
  --color-gold-nude: #D8BFA8;
  --color-rose: #E7B6C1;
  --color-rose-soft: rgba(231, 182, 193, 0.38);
  --color-bg: #F6F1EC;
  --color-grey: #8E8A86;
  --color-border: #E6E0DA;

  --bg: var(--color-bg);
  --surface: #fbf7f3;
  --surface-strong: #ffffff;
  --ink: var(--color-black);
  --muted: var(--color-grey);
  --accent: var(--color-black);
  --accent-soft: var(--color-rose-soft);
  --accent-ghost: rgba(15, 15, 15, 0.08);
  --line: var(--color-border);
  --shadow: 0 18px 40px rgba(15, 15, 15, 0.12);
  --radius: 18px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Space Grotesk', 'Segoe UI', sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 15%, rgba(231, 182, 193, 0.35), transparent 48%),
    radial-gradient(circle at 85% 8%, rgba(216, 191, 168, 0.22), transparent 50%),
    radial-gradient(circle at 50% 90%, rgba(231, 182, 193, 0.22), transparent 52%),
    linear-gradient(120deg, var(--color-bg) 0%, #f0e9e2 100%);
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(rgba(15, 15, 15, 0.04) 1px, transparent 1px);
  background-size: 14px 14px;
  opacity: 0.35;
  pointer-events: none;
}

.app {
  max-width: 1300px;
  margin: 28px auto 60px;
  padding: 0 22px;
  position: relative;
  z-index: 1;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.brand {
  font-size: 30px;
  letter-spacing: 6px;
  font-weight: 700;
}

.subtitle {
  color: var(--muted);
  font-weight: 500;
  margin-top: 6px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-pill {
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--color-rose-soft);
  color: var(--color-black);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 18px;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 18px;
  box-shadow: var(--shadow);
}

.panel-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 12px;
}

.folders {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.folder-btn {
  border: none;
  padding: 12px;
  border-radius: 14px;
  background: var(--color-rose-soft);
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.folder-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(31, 26, 22, 0.1);
}

.folder-btn.active {
  background: var(--accent);
  color: white;
}

.filter-grid {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px 12px;
  align-items: center;
}

.filter-grid label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
  text-align: left;
  justify-self: start;
}

.filter-grid input,
.filter-grid select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: white;
  font-family: inherit;
  font-weight: 500;
  color: var(--ink);
}

.filter-grid input:focus,
.filter-grid select:focus {
  outline: 2px solid rgba(231, 182, 193, 0.55);
  border-color: rgba(231, 182, 193, 0.75);
}

.filter-grid select:disabled,
.filter-grid input:disabled {
  background: #f3ede7;
  color: var(--muted);
  cursor: not-allowed;
  border-color: rgba(15, 15, 15, 0.08);
  box-shadow: none;
}


.filter-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
}

.btn {
  border: none;
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  font-family: inherit;
}

.btn.primary {
  background: var(--accent);
  color: white;
}

.btn.ghost {
  background: var(--accent-ghost);
  color: var(--ink);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(31, 26, 22, 0.1);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.index-status {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.files-panel {
  min-height: 240px;
}

.file-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 4px;
}

.file-list.empty {
  color: var(--muted);
  font-style: italic;
}

.file-item {
  border-radius: 14px;
  padding: 10px 12px;
  background: white;
  border: 1px solid transparent;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: border 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  animation: fadeUp 0.35s ease;
}

.file-item:hover {
  border-color: rgba(231, 182, 193, 0.7);
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(31, 26, 22, 0.08);
}

.file-item.active {
  border-color: var(--accent);
  background: rgba(231, 182, 193, 0.25);
}

.file-name {
  font-weight: 700;
  color: var(--ink);
  font-size: 14px;
}

.file-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge.auto {
  background: rgba(231, 182, 193, 0.45);
  color: var(--color-black);
}

.badge.review {
  background: rgba(142, 138, 134, 0.25);
  color: var(--color-black);
}

.badge.block {
  background: rgba(15, 15, 15, 0.15);
  color: var(--color-black);
}

.badge.route-tracking {
  background: rgba(231, 182, 193, 0.25);
  color: var(--color-black);
}

.badge.route-sav {
  background: rgba(15, 15, 15, 0.08);
  color: var(--color-black);
}

.badge.route-autres {
  background: rgba(142, 138, 134, 0.2);
  color: var(--color-black);
}

.badge.neutral {
  background: rgba(15, 15, 15, 0.08);
  color: var(--muted);
}

.viewer {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.placeholder {
  background: var(--surface);
  border: 1px dashed rgba(15, 15, 15, 0.2);
  color: var(--muted);
  border-radius: var(--radius);
  padding: 26px;
  text-align: center;
  font-weight: 600;
}

.record {
  background: var(--surface-strong);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: fadeUp 0.35s ease;
}

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

.record-title {
  font-size: 20px;
  font-weight: 700;
}

.record-subtitle {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.record-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.info-card {
  background: rgba(15, 15, 15, 0.04);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
}

.info-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 6px;
}

.info-value {
  font-size: 14px;
  font-weight: 600;
  word-break: break-word;
}

.category-list {
  display: grid;
  gap: 8px;
}

.category-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(231, 182, 193, 0.18);
  border: 1px solid rgba(231, 182, 193, 0.35);
}

.category-item strong {
  font-size: 13px;
}

.category-score {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-black);
}

.text-block {
  background: #171513;
  color: #f6f1ec;
  border-radius: 14px;
  padding: 14px;
  font-family: 'IBM Plex Mono', monospace;
  white-space: pre-wrap;
  line-height: 1.45;
  font-size: 12.5px;
}

.details-block summary {
  font-weight: 600;
  cursor: pointer;
}

.details-block pre {
  margin-top: 10px;
  background: #111;
  color: #f4f2ee;
  padding: 12px;
  border-radius: 12px;
  font-family: 'IBM Plex Mono', monospace;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12px;
}

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

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }

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

  .filter-grid label {
    text-align: left;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .stats {
    width: 100%;
  }
}
