/* ============================================================
   LexCongo — Design System
   Dark navy + gold — Professional legal platform
   ============================================================ */

/* ── Design Tokens ──────────────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg-900: #060B14;
  --bg-800: #0A1220;
  --bg-700: #0F1929;
  --bg-600: #132038;
  --bg-500: #1A2B4A;
  --bg-400: #233460;

  /* Gold — primary accent */
  --gold:        #C9A227;
  --gold-light:  #E4BA3A;
  --gold-bright: #F5D060;
  --gold-dim:    rgba(201, 162, 39, 0.55);
  --gold-glow:   rgba(201, 162, 39, 0.10);
  --gold-border: rgba(201, 162, 39, 0.18);
  --gold-border-hover: rgba(201, 162, 39, 0.40);

  /* Text */
  --text-100: #F0F5FF;
  --text-200: #CBD8F5;
  --text-400: #7A90C4;
  --text-600: #3E506E;

  /* Borders */
  --border:       rgba(255, 255, 255, 0.07);
  --border-hover: rgba(255, 255, 255, 0.14);

  /* Semantic */
  --red:    #C53030;
  --green:  #2E7D5A;
  --blue:   #1D5FA6;
  --teal:   #1B7A7A;
  --orange: #B85C1A;

  /* Spacing */
  --sp1: 4px;  --sp2: 8px;  --sp3: 12px; --sp4: 16px;
  --sp5: 20px; --sp6: 24px; --sp8: 32px; --sp10: 40px;
  --sp12: 48px; --sp16: 64px; --sp20: 80px;

  /* Radius */
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 20px;
  --r-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 2px 8px  rgba(0,0,0,0.35);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.45);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.55);
  --shadow-gold: 0 4px 24px rgba(201,162,39,0.18);

  /* Transitions */
  --transition: 200ms ease;
  --transition-slow: 350ms ease;

  /* Layout */
  --nav-h: 64px;
  --sidebar-w: 240px;
  --container: 1140px;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  background: var(--bg-800);
  color: var(--text-200);
  font-family: 'Inter', system-ui, sans-serif;
  font-weight: 400;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-900); }
::-webkit-scrollbar-thumb { background: var(--bg-500); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-dim); }

/* Selection */
::selection { background: var(--gold); color: var(--bg-900); }

/* Focus */
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

/* ── Typography ─────────────────────────────────────────────── */
.serif { font-family: 'Playfair Display', Georgia, serif; }

h1, h2, h3, h4, h5, h6 {
  color: var(--text-100);
  line-height: 1.25;
  font-weight: 600;
}

/* ── Container & Layout ─────────────────────────────────────── */
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--sp6);
}

/* ── Navbar ─────────────────────────────────────────────────── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  background: rgba(10, 18, 32, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp6);
}

.logo {
  display: flex;
  align-items: center;
  gap: var(--sp2);
  flex-shrink: 0;
}

.logo-wordmark {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
  color: var(--text-100);
}

.logo-wordmark span {
  color: var(--gold);
}

.logo-badge {
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  background: var(--gold-glow);
  border: 1px solid var(--gold-border);
  padding: 1px 6px;
  border-radius: var(--r-full);
  margin-top: 2px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--sp1);
}

.nav-links a {
  padding: var(--sp2) var(--sp4);
  border-radius: var(--r-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-400);
  transition: color var(--transition), background var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-100);
  background: var(--bg-600);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--sp3);
}

.nav-user {
  display: flex;
  align-items: center;
  gap: var(--sp2);
  padding: var(--sp2) var(--sp3);
  border-radius: var(--r-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-400);
  transition: color var(--transition);
}
.nav-user:hover { color: var(--text-100); }

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp2);
  padding: var(--sp2) var(--sp5);
  border-radius: var(--r-md);
  font-size: 0.875rem;
  font-weight: 600;
  border: 1px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-gold {
  background: var(--gold);
  color: var(--bg-900);
  border-color: var(--gold);
}
.btn-gold:hover {
  background: var(--gold-light);
  border-color: var(--gold-light);
  transform: translateY(-1px);
  box-shadow: var(--shadow-gold);
}

.btn-outline {
  background: transparent;
  color: var(--gold);
  border-color: var(--gold-border);
}
.btn-outline:hover {
  background: var(--gold-glow);
  border-color: var(--gold-border-hover);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-400);
  border-color: var(--border);
}
.btn-ghost:hover {
  background: var(--bg-600);
  color: var(--text-100);
}

.btn-sm { padding: var(--sp1) var(--sp3); font-size: 0.8125rem; }
.btn-lg { padding: var(--sp3) var(--sp8); font-size: 1rem; }

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--bg-600);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp6);
  transition: border-color var(--transition), transform var(--transition);
}

.card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.card-gold {
  border-color: var(--gold-border);
}
.card-gold:hover {
  border-color: var(--gold-border-hover);
  box-shadow: var(--shadow-gold);
}

/* ── Form Inputs ────────────────────────────────────────────── */
.input {
  width: 100%;
  padding: var(--sp3) var(--sp4);
  background: var(--bg-700);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-100);
  font-size: 0.9375rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.input::placeholder { color: var(--text-600); }
.input:focus {
  outline: none;
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

.input-group {
  display: flex;
  align-items: center;
  background: var(--bg-700);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.input-group:focus-within {
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 3px var(--gold-glow);
}
.input-group .input {
  border: none;
  border-radius: 0;
  background: transparent;
  flex: 1;
  padding: var(--sp3) var(--sp5);
  font-size: 1rem;
}
.input-group .input:focus { box-shadow: none; }

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-400);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: var(--sp2);
}

.form-group { margin-bottom: var(--sp5); }

/* ── Badges / Tags ──────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--r-full);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge-gold   { background: rgba(201,162,39,0.15); color: var(--gold-light); border: 1px solid var(--gold-border); }
.badge-blue   { background: rgba(29,95,166,0.18);  color: #7AB8FF; border: 1px solid rgba(29,95,166,0.3); }
.badge-teal   { background: rgba(27,122,122,0.18); color: #4DCECE; border: 1px solid rgba(27,122,122,0.3); }
.badge-green  { background: rgba(46,125,90,0.18);  color: #52D98F; border: 1px solid rgba(46,125,90,0.3); }
.badge-orange { background: rgba(184,92,26,0.18);  color: #FF9A5C; border: 1px solid rgba(184,92,26,0.3); }
.badge-red    { background: rgba(197,48,48,0.18);  color: #FF7777; border: 1px solid rgba(197,48,48,0.3); }
.badge-slate  { background: rgba(100,120,160,0.15);color: #AAB8D4; border: 1px solid rgba(100,120,160,0.25); }
.badge-gray   { background: rgba(255,255,255,0.07);color: var(--text-400); border: 1px solid var(--border); }

.cat-badge-constitution { @extend .badge-gold; }

/* ── Divider ────────────────────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--sp6) 0;
}

/* ── Alert / Flash messages ─────────────────────────────────── */
.alert {
  padding: var(--sp3) var(--sp5);
  border-radius: var(--r-md);
  font-size: 0.875rem;
  margin-bottom: var(--sp4);
  display: flex;
  align-items: flex-start;
  gap: var(--sp3);
}
.alert-error   { background: rgba(197,48,48,0.12);  border: 1px solid rgba(197,48,48,0.3);  color: #FF9999; }
.alert-warning { background: rgba(201,162,39,0.10); border: 1px solid var(--gold-border);    color: var(--gold-light); }
.alert-success { background: rgba(46,125,90,0.12);  border: 1px solid rgba(46,125,90,0.3);  color: #6FE0A8; }

/* ── Mark / Highlight ───────────────────────────────────────── */
mark {
  background: rgba(201, 162, 39, 0.22);
  color: var(--gold-bright);
  padding: 0 2px;
  border-radius: 2px;
}

/* ============================================================
   LANDING PAGE
   ============================================================ */

/* Hero */
.hero {
  min-height: calc(100vh - var(--nav-h));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--sp20) var(--sp6);
  background: var(--bg-900);
  background-image:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(201,162,39,0.07) 0%, transparent 70%),
    linear-gradient(180deg, var(--bg-900) 0%, var(--bg-800) 100%);
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg width='48' height='48' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 0h48v48H0z' fill='none'/%3E%3Ccircle cx='24' cy='24' r='0.6' fill='rgba(255,255,255,0.04)'/%3E%3C/svg%3E");
  pointer-events: none;
}

/* Real photo background */
.hero-bg-photo {
  position: absolute;
  inset: 0;
  background-image: url('/statics/img/hero-bg.jpg');
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  opacity: 0.18;
  pointer-events: none;
  /* Fade toward bottom so stats bar transition is smooth */
  mask-image: linear-gradient(to bottom, black 40%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, black 40%, transparent 100%);
}

/* Balance de Justice — background illustration */
.hero-illustration {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  overflow: hidden;
}

.hero-illustration svg {
  width: min(780px, 95vw);
  height: auto;
  color: var(--gold);
  opacity: 0.18;
  filter: blur(0.4px);
  mask-image: radial-gradient(
    ellipse 75% 85% at 50% 50%,
    black 30%,
    transparent 90%
  );
  -webkit-mask-image: radial-gradient(
    ellipse 75% 85% at 50% 50%,
    black 30%,
    transparent 90%
  );
}

.hero > *:not(.hero-illustration):not(.hero-bg-photo) {
  position: relative;
  z-index: 1;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp2);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  background: var(--gold-glow);
  border: 1px solid var(--gold-border);
  padding: var(--sp2) var(--sp4);
  border-radius: var(--r-full);
  margin-bottom: var(--sp6);
}

.hero-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: var(--text-100);
  max-width: 800px;
  margin-bottom: var(--sp5);
}

.hero-title em {
  font-style: normal;
  color: var(--gold);
}

.hero-subtitle {
  font-size: 1.1rem;
  font-weight: 300;
  color: var(--text-400);
  max-width: 540px;
  margin-bottom: var(--sp10);
  line-height: 1.7;
}

/* Hero Search */
.hero-search {
  width: 100%;
  max-width: 620px;
  margin-bottom: var(--sp8);
}

.hero-search-box {
  display: flex;
  align-items: center;
  background: var(--bg-600);
  border: 1px solid var(--gold-border);
  border-radius: var(--r-xl);
  overflow: hidden;
  box-shadow: var(--shadow-md), var(--shadow-gold);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.hero-search-box:focus-within {
  border-color: var(--gold-dim);
  box-shadow: var(--shadow-lg), 0 0 0 4px var(--gold-glow);
}

.hero-search-box .search-icon {
  padding: 0 var(--sp4);
  color: var(--gold-dim);
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.hero-search-box input[type="search"] {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-100);
  font-size: 1rem;
  padding: var(--sp4) var(--sp3);
}
.hero-search-box input::placeholder { color: var(--text-600); }
.hero-search-box input::-webkit-search-cancel-button { display: none; }

.hero-search-box button {
  margin: var(--sp2);
  padding: var(--sp2) var(--sp6);
  background: var(--gold);
  color: var(--bg-900);
  border: none;
  border-radius: var(--r-lg);
  font-size: 0.9rem;
  font-weight: 700;
  transition: background var(--transition), transform var(--transition);
  flex-shrink: 0;
}
.hero-search-box button:hover {
  background: var(--gold-light);
  transform: scale(1.02);
}

.hero-hint {
  font-size: 0.8125rem;
  color: var(--text-600);
}
.hero-hint kbd {
  display: inline-block;
  background: var(--bg-500);
  border: 1px solid var(--border-hover);
  border-radius: var(--r-sm);
  padding: 1px 6px;
  font-size: 0.75rem;
  font-family: inherit;
  color: var(--text-400);
}

/* Stats bar */
.stats-bar {
  background: var(--bg-700);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: var(--sp6) 0;
}

.stats-grid {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.stat-item {
  flex: 1;
  text-align: center;
  padding: var(--sp4) var(--sp6);
  position: relative;
}

.stat-item + .stat-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  height: 60%;
  width: 1px;
  background: var(--border);
}

.stat-number {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--gold);
  line-height: 1;
  margin-bottom: var(--sp1);
}

.stat-label {
  font-size: 0.8125rem;
  color: var(--text-400);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Categories section */
.section {
  padding: var(--sp16) 0;
}

.section-header {
  margin-bottom: var(--sp10);
}

.section-eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: var(--sp3);
}

.section-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--text-100);
  letter-spacing: -0.01em;
}

.section-desc {
  margin-top: var(--sp3);
  color: var(--text-400);
  font-size: 0.9375rem;
  max-width: 540px;
}

/* Category cards grid */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp4);
}

.cat-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp3);
  padding: var(--sp5);
  background: var(--bg-600);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}

.cat-card:hover {
  background: var(--bg-500);
  border-color: var(--gold-border);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.cat-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-md);
  background: var(--gold-glow);
  border: 1px solid var(--gold-border);
}

.cat-icon svg { color: var(--gold); }

.cat-name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-100);
}

.cat-count {
  font-size: 0.8125rem;
  color: var(--text-400);
}

/* How it works section */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp6);
  counter-reset: steps;
}

.step-card {
  padding: var(--sp6);
  background: var(--bg-700);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  position: relative;
  counter-increment: steps;
}

.step-card::before {
  content: counter(steps, decimal-leading-zero);
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--gold-border);
  line-height: 1;
  margin-bottom: var(--sp4);
  display: block;
}

.step-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-100);
  margin-bottom: var(--sp2);
}

.step-desc {
  font-size: 0.875rem;
  color: var(--text-400);
  line-height: 1.65;
}

/* ── Footer ─────────────────────────────────────────────────── */
.footer {
  background: var(--bg-900);
  border-top: 1px solid var(--border);
  padding: var(--sp10) 0 var(--sp8);
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: var(--sp10);
  margin-bottom: var(--sp8);
}

.footer-brand .logo-wordmark { font-size: 1.25rem; }

.footer-desc {
  font-size: 0.875rem;
  color: var(--text-600);
  line-height: 1.7;
  margin-top: var(--sp3);
  max-width: 280px;
}

.footer-col-title {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-400);
  margin-bottom: var(--sp4);
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: var(--sp2);
}

.footer-links a {
  font-size: 0.875rem;
  color: var(--text-600);
  transition: color var(--transition);
}
.footer-links a:hover { color: var(--gold); }

.footer-bottom {
  padding-top: var(--sp6);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8125rem;
  color: var(--text-600);
}

/* ============================================================
   SEARCH PAGE
   ============================================================ */

.page-header {
  background: var(--bg-900);
  border-bottom: 1px solid var(--border);
  padding: var(--sp8) 0 var(--sp6);
}

.page-search-box {
  display: flex;
  gap: var(--sp3);
  align-items: center;
  max-width: 680px;
}

.page-search-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  background: var(--bg-600);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: border-color var(--transition);
}
.page-search-wrap:focus-within { border-color: var(--gold-dim); }

.page-search-wrap .search-icon {
  padding: 0 var(--sp3);
  color: var(--text-600);
  flex-shrink: 0;
}

.page-search-wrap input[type="search"] {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-100);
  font-size: 0.9375rem;
  padding: var(--sp3) var(--sp2);
}
.page-search-wrap input::placeholder { color: var(--text-600); }
.page-search-wrap input::-webkit-search-cancel-button { display: none; }

.search-meta {
  font-size: 0.875rem;
  color: var(--text-400);
  margin-top: var(--sp4);
}
.search-meta strong { color: var(--text-100); }
.filter-clear {
  display: inline-flex;
  align-items: center;
  gap: var(--sp1);
  margin-left: var(--sp3);
  color: var(--gold);
  font-size: 0.8125rem;
}
.filter-clear:hover { color: var(--gold-light); }

/* ── Search layout ─────────────────────────────────────── */
.search-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: var(--sp8);
  padding: var(--sp8) 0 var(--sp12);
  align-items: start;
}

/* ── Filters sidebar ───────────────────────────────────── */
.filters-panel {
  background: var(--bg-700);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp5);
  position: sticky;
  top: calc(var(--nav-h) + var(--sp4));
}

.filters-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-600);
  margin-bottom: var(--sp3);
}

.facet-list { list-style: none; margin-bottom: var(--sp2); }

.facet-list li a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px var(--sp3);
  border-radius: var(--r-md);
  font-size: 0.8125rem;
  color: var(--text-400);
  transition: all var(--transition);
}
.facet-list li a:hover { background: var(--bg-600); color: var(--text-200); }
.facet-list li.active a {
  background: var(--gold-glow);
  color: var(--gold-light);
  border: 1px solid var(--gold-border);
}

.facet-count {
  font-size: 0.7rem;
  color: var(--text-600);
  font-weight: 500;
  flex-shrink: 0;
  margin-left: var(--sp2);
}
.facet-list li.active .facet-count { color: var(--gold-dim); }

/* ── Advanced filters ──────────────────────────────────── */
.adv-filter-sep {
  height: 1px;
  background: var(--border);
  margin: var(--sp4) 0;
}

.adv-filter-form { margin-top: 0; }
.adv-filter-group { margin-bottom: var(--sp4); }

.adv-filter-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-600);
  margin-bottom: var(--sp2);
}

.adv-filter-check {
  display: flex;
  align-items: center;
  gap: var(--sp2);
  font-size: 0.8125rem;
  cursor: pointer;
  color: var(--text-400);
}
.adv-filter-check input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--gold);
}

/* ── Year range picker ─────────────────────────────────── */
.year-picker { display: flex; flex-direction: column; gap: var(--sp2); }

.year-picker-row {
  display: flex;
  align-items: stretch;
  gap: 6px;
}

.year-picker-field {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.year-picker-lbl {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-600);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.year-picker-input {
  width: 100%;
  background: var(--bg-600);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-200);
  font-size: 0.8125rem;
  font-family: inherit;
  padding: 6px 8px;
  -moz-appearance: textfield;
  transition: border-color var(--transition);
}
.year-picker-input::-webkit-inner-spin-button,
.year-picker-input::-webkit-outer-spin-button { -webkit-appearance: none; }
.year-picker-input::placeholder { color: var(--text-600); }
.year-picker-input:focus { outline: none; border-color: var(--gold-border-hover); }

.year-presets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.year-preset-btn {
  padding: 5px 4px;
  font-size: 0.67rem;
  font-weight: 500;
  background: var(--bg-600);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-400);
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
  font-family: inherit;
  line-height: 1.3;
}
.year-preset-btn:hover {
  background: var(--bg-500);
  color: var(--text-200);
  border-color: var(--border-hover);
}
.year-preset-btn.active {
  background: var(--gold-glow);
  border-color: var(--gold-border);
  color: var(--gold-light);
  font-weight: 600;
}

/* ── Result cards ──────────────────────────────────────── */
.results-list { display: flex; flex-direction: column; gap: var(--sp3); }

.result-card {
  display: block;
  background: var(--bg-700);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp4) var(--sp5);
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
  text-decoration: none;
}
.result-card:hover {
  background: var(--bg-600);
  border-color: var(--gold-border);
  box-shadow: -3px 0 0 var(--gold), var(--shadow-sm);
}

.result-header {
  display: flex;
  align-items: center;
  gap: var(--sp2);
  margin-bottom: var(--sp2);
  flex-wrap: wrap;
}

.result-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-100);
  line-height: 1.45;
  margin-bottom: var(--sp2);
}
.result-title mark {
  background: rgba(201, 162, 39, 0.18);
  color: var(--gold-bright);
  border-radius: 2px;
  padding: 0 2px;
  font-style: normal;
}

.result-snippet {
  font-size: 0.8125rem;
  color: var(--text-400);
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  border-top: 1px solid var(--border);
  padding-top: var(--sp2);
  margin-top: var(--sp2);
}
.result-snippet mark {
  background: rgba(201, 162, 39, 0.20);
  color: var(--gold-light);
  border-radius: 2px;
  padding: 0 3px;
  font-style: normal;
  font-weight: 500;
}

.year-tag {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-400);
  background: var(--bg-500);
  padding: 2px 7px;
  border-radius: var(--r-full);
}

.size-tag {
  font-size: 0.7rem;
  color: var(--text-600);
  margin-left: auto;
}

/* ── Empty state ───────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: var(--sp16) var(--sp6);
}
.empty-state-icon {
  margin-bottom: var(--sp4);
}
.empty-state h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-200);
  margin-bottom: var(--sp2);
}
.empty-state p {
  font-size: 0.875rem;
  color: var(--text-600);
}

/* ── Pagination ────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp2);
  padding: var(--sp8) 0;
  flex-wrap: wrap;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 var(--sp3);
  border-radius: var(--r-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-400);
  background: var(--bg-600);
  border: 1px solid var(--border);
  transition: all var(--transition);
  text-decoration: none;
}
.page-btn:hover { color: var(--text-100); border-color: var(--border-hover); background: var(--bg-500); }
.page-btn.active {
  background: var(--gold);
  color: var(--bg-900);
  border-color: var(--gold);
  font-weight: 700;
}

/* ============================================================
   DOCUMENT VIEW
   ============================================================ */

.doc-page {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--sp10) var(--sp6);
}

/* ── Two-column layout: TOC sidebar + document body ── */
.doc-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 40px;
  align-items: start;
}
@media (max-width: 960px) {
  .doc-layout { grid-template-columns: 1fr; }
  .doc-toc { display: none !important; }
}

/* ── Sticky TOC sidebar ──────────────────────────── */
.doc-toc {
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  background: var(--bg-800);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 0;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.toc-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-500);
  padding: 0 16px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.toc-item a {
  display: block;
  padding: 4px 16px;
  font-size: 0.75rem;
  color: var(--text-400);
  text-decoration: none;
  line-height: 1.4;
  border-left: 2px solid transparent;
  transition: color .15s, border-color .15s, background .15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.toc-item a:hover { color: var(--text-100); background: rgba(255,255,255,0.03); }
.toc-item.toc-active > a {
  color: var(--gold);
  border-left-color: var(--gold);
  background: rgba(201,162,39,0.06);
}
.toc-h2 > a { font-weight: 600; color: var(--text-300); }
.toc-h3 > a { padding-left: 24px; }
.toc-h4 > a { padding-left: 32px; font-size: 0.7rem; }

.doc-breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--sp2);
  font-size: 0.8125rem;
  color: var(--text-600);
  margin-bottom: var(--sp6);
}
.doc-breadcrumb a { color: var(--text-400); transition: color var(--transition); }
.doc-breadcrumb a:hover { color: var(--gold); }
.doc-breadcrumb .sep { color: var(--text-600); }

.doc-header {
  margin-bottom: var(--sp8);
  padding-bottom: var(--sp6);
  border-bottom: 1px solid var(--border);
}

.doc-meta {
  display: flex;
  align-items: center;
  gap: var(--sp3);
  flex-wrap: wrap;
  margin-bottom: var(--sp4);
}

.doc-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 700;
  color: var(--text-100);
  line-height: 1.3;
  margin-bottom: var(--sp5);
}

.doc-actions {
  display: flex;
  align-items: center;
  gap: var(--sp3);
  margin-top: var(--sp5);
}

.doc-source {
  display: inline-flex;
  align-items: center;
  gap: var(--sp2);
  font-size: 0.8125rem;
  color: var(--text-400);
  background: var(--bg-600);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp2) var(--sp3);
  transition: all var(--transition);
}
.doc-source:hover { color: var(--gold); border-color: var(--gold-border); }

/* Document body — rendered Markdown */
.doc-body {
  font-size: 0.9375rem;
  line-height: 1.8;
  color: var(--text-200);
}
.doc-body h1, .doc-body h2, .doc-body h3, .doc-body h4, .doc-body h5 {
  font-family: 'Playfair Display', Georgia, serif;
  color: var(--text-100);
  line-height: 1.3;
}

/* ── LIVRE ─── h2 */
.doc-body h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 56px 0 12px;
  padding: 16px 20px;
  background: rgba(201,162,39,0.08);
  border-left: 4px solid var(--gold);
  border-radius: 0 10px 10px 0;
  color: var(--gold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ── TITRE ─── h3 */
.doc-body h3 {
  font-size: 1rem;
  font-weight: 700;
  margin: 40px 0 10px;
  padding: 10px 16px;
  border-left: 3px solid rgba(201,162,39,0.45);
  background: rgba(201,162,39,0.04);
  border-radius: 0 8px 8px 0;
  color: var(--text-100);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* ── CHAPITRE ─── h4 */
.doc-body h4 {
  font-size: 0.9375rem;
  font-weight: 600;
  margin: 32px 0 8px;
  padding: 8px 14px;
  border-left: 2px solid rgba(201,162,39,0.3);
  color: var(--text-200);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* ── SECTION ─── h5 */
.doc-body h5 {
  font-size: 0.875rem;
  font-weight: 600;
  margin: 24px 0 6px;
  color: var(--text-300);
  font-style: italic;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* ── Séparateur entre articles ─── hr */
.doc-body hr {
  border: none;
  margin: 28px 0 20px;
  position: relative;
  height: 1px;
  background: linear-gradient(90deg, rgba(201,162,39,0.4) 0%, rgba(201,162,39,0.08) 60%, transparent 100%);
}

/* ── Paragraphe d'article (détecté par JS) */
.doc-body .legal-art-header {
  font-weight: 700;
  color: var(--gold);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.doc-body p  { margin-bottom: var(--sp4); }
.doc-body ul, .doc-body ol { margin: 0 0 var(--sp4) var(--sp6); }
.doc-body li { margin-bottom: var(--sp2); }
.doc-body blockquote {
  border-left: 3px solid var(--gold-dim);
  padding: var(--sp3) var(--sp5);
  margin: var(--sp5) 0;
  background: var(--bg-600);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  color: var(--text-400);
  font-style: italic;
}
.doc-body table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: var(--sp6);
  font-size: 0.875rem;
}
.doc-body th {
  background: var(--bg-600);
  color: var(--text-400);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: var(--sp2) var(--sp4);
  border: 1px solid var(--border);
  text-align: left;
}
.doc-body td {
  padding: var(--sp2) var(--sp4);
  border: 1px solid var(--border);
  color: var(--text-200);
}
.doc-body tr:nth-child(even) td { background: rgba(255,255,255,0.02); }
.doc-body code {
  font-family: 'Courier New', monospace;
  font-size: 0.85em;
  background: var(--bg-600);
  color: var(--gold-light);
  padding: 1px 5px;
  border-radius: var(--r-sm);
}
.doc-body pre {
  background: var(--bg-900);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp5);
  overflow-x: auto;
  margin-bottom: var(--sp5);
}
.doc-body pre code { background: none; padding: 0; }
.doc-body a { color: var(--gold); text-decoration: underline; text-underline-offset: 2px; }

/* Article-level copy button */
.art-copy-btn {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--bg-700);
  color: var(--text-600);
  opacity: 0;
  transition: opacity var(--transition), color var(--transition), border-color var(--transition);
  cursor: pointer;
  flex-shrink: 0;
}
h1:hover .art-copy-btn,
h2:hover .art-copy-btn,
h3:hover .art-copy-btn,
h4:hover .art-copy-btn { opacity: 1; }
.art-copy-btn:hover { color: var(--gold); border-color: var(--gold-border); }
.art-copy-btn.art-copy-ok { color: var(--green); border-color: var(--green); opacity: 1; }

/* Print footer — hidden on screen */
.print-footer { display: none; }


/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

  .navbar, .sidebar, .doc-breadcrumb, .doc-actions, .print-footer-hide,
  .alert, footer, .btn, nav { display: none !important; }

  body {
    background: #fff !important;
    color: #111 !important;
    font-size: 11pt;
    line-height: 1.6;
  }

  .doc-page {
    max-width: 100%;
    padding: 0;
    margin: 0;
  }

  .doc-title {
    font-size: 18pt;
    color: #111 !important;
    margin-bottom: 12pt;
  }

  .doc-header { border-bottom: 1pt solid #ccc; padding-bottom: 8pt; margin-bottom: 16pt; }

  .doc-body {
    color: #111 !important;
    font-size: 10.5pt;
  }
  .doc-body h1, .doc-body h2, .doc-body h3, .doc-body h4, .doc-body h5 {
    color: #111 !important;
    page-break-after: avoid;
    margin-top: 14pt;
  }
  .doc-body p, .doc-body li { orphans: 3; widows: 3; }
  .doc-body a { color: #111 !important; text-decoration: none; }
  .doc-body blockquote { border-left: 2pt solid #999; background: none; color: #444 !important; }
  .doc-body table { font-size: 9pt; }
  .doc-body th { background: #eee !important; color: #111 !important; }
  .doc-body td { color: #111 !important; border-color: #ccc; }
  .doc-body code { background: #f5f5f5 !important; color: #111 !important; }

  .art-copy-btn { display: none !important; }

  .print-footer {
    display: block !important;
    margin-top: 24pt;
    padding-top: 8pt;
    border-top: 1pt solid #ccc;
    font-size: 8pt;
    color: #666;
  }

  .doc-meta .badge, .year-tag { border: 1pt solid #999; padding: 1pt 4pt; font-size: 8pt; }

  @page {
    margin: 2cm;
    size: A4;
  }
}

/* ============================================================
   AUTH — LOGIN PAGE
   ============================================================ */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-900);
  background-image: radial-gradient(ellipse 80% 50% at 50% 0%, rgba(201,162,39,0.05) 0%, transparent 60%);
  padding: var(--sp6);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-700);
  border: 1px solid var(--gold-border);
  border-radius: var(--r-xl);
  padding: var(--sp10) var(--sp8);
  box-shadow: var(--shadow-lg), var(--shadow-gold);
}

.auth-logo {
  text-align: center;
  margin-bottom: var(--sp8);
}

.auth-logo .logo-wordmark {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-100);
}
.auth-logo .logo-wordmark span { color: var(--gold); }

.auth-logo-sub {
  font-size: 0.8125rem;
  color: var(--text-600);
  margin-top: var(--sp1);
}

.auth-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-100);
  margin-bottom: var(--sp1);
}

.auth-subtitle {
  font-size: 0.875rem;
  color: var(--text-400);
  margin-bottom: var(--sp6);
}

.auth-divider {
  text-align: center;
  position: relative;
  margin: var(--sp6) 0;
}
.auth-divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border);
}
.auth-divider span {
  position: relative;
  background: var(--bg-700);
  padding: 0 var(--sp3);
  font-size: 0.75rem;
  color: var(--text-600);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.auth-footer {
  text-align: center;
  margin-top: var(--sp6);
  font-size: 0.8125rem;
  color: var(--text-600);
}
.auth-footer a { color: var(--gold); }

/* ============================================================
   DASHBOARD
   ============================================================ */

.app-layout {
  display: flex;
  min-height: 100vh;
  background: var(--bg-800);
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-900);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-logo {
  padding: var(--sp5) var(--sp5);
  border-bottom: 1px solid var(--border);
}

.sidebar-logo .logo-wordmark {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-100);
}
.sidebar-logo .logo-wordmark span { color: var(--gold); }

.sidebar-nav {
  flex: 1;
  padding: var(--sp4) var(--sp3);
  display: flex;
  flex-direction: column;
  gap: var(--sp1);
}

.nav-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-600);
  padding: var(--sp3) var(--sp3) var(--sp2);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--sp3);
  padding: var(--sp2) var(--sp3);
  border-radius: var(--r-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-400);
  transition: all var(--transition);
  text-decoration: none;
}
.sidebar-link:hover { background: var(--bg-600); color: var(--text-100); }
.sidebar-link.active {
  background: var(--gold-glow);
  color: var(--gold-light);
  border: 1px solid var(--gold-border);
}
.sidebar-link svg { flex-shrink: 0; opacity: 0.7; }
.sidebar-link.active svg { opacity: 1; }

.sidebar-footer {
  padding: var(--sp4) var(--sp4);
  border-top: 1px solid var(--border);
}

.user-pill {
  display: flex;
  align-items: center;
  gap: var(--sp3);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gold-glow);
  border: 1px solid var(--gold-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--gold);
  flex-shrink: 0;
}

.user-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-200);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 0.7rem;
  color: var(--text-600);
}

/* Main content area */
.main-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Top bar */
.topbar {
  height: var(--nav-h);
  background: var(--bg-800);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 var(--sp8);
  gap: var(--sp4);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-search {
  flex: 1;
  max-width: 480px;
  display: flex;
  align-items: center;
  background: var(--bg-700);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: border-color var(--transition);
}
.topbar-search:focus-within { border-color: var(--gold-dim); }
.topbar-search .search-icon {
  padding: 0 var(--sp3);
  color: var(--text-600);
  flex-shrink: 0;
}
.topbar-search input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-100);
  font-size: 0.875rem;
  padding: var(--sp3) var(--sp2);
}
.topbar-search input::placeholder { color: var(--text-600); }
.topbar-search input::-webkit-search-cancel-button { display: none; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--sp3);
  margin-left: auto;
}

.page-content {
  flex: 1;
  padding: var(--sp8);
  overflow-y: auto;
}

/* Dashboard widgets */
.widget-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp4);
  margin-bottom: var(--sp8);
}

.widget {
  background: var(--bg-700);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp5);
}

.widget-gold { border-color: var(--gold-border); background: var(--bg-700); }

.widget-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-400);
  margin-bottom: var(--sp3);
}

.widget-value {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--gold);
  line-height: 1;
  margin-bottom: var(--sp1);
}

.widget-sub {
  font-size: 0.8125rem;
  color: var(--text-600);
}

/* Table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table thead th {
  text-align: left;
  padding: var(--sp2) var(--sp4);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-400);
  background: var(--bg-600);
  border-bottom: 1px solid var(--border);
}

.data-table tbody td {
  padding: var(--sp3) var(--sp4);
  border-bottom: 1px solid var(--border);
  color: var(--text-200);
}

.data-table tbody tr:hover td { background: rgba(255,255,255,0.02); }
.data-table tbody tr:last-child td { border-bottom: none; }

.data-table a { color: var(--gold); transition: color var(--transition); }
.data-table a:hover { color: var(--gold-light); }

/* Section panels */
.panel {
  background: var(--bg-700);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  margin-bottom: var(--sp6);
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp4) var(--sp6);
  border-bottom: 1px solid var(--border);
}

.panel-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-100);
}

.panel-body { padding: var(--sp5) var(--sp6); }

/* Favorites grid */
.fav-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp4);
}

.fav-card {
  display: block;
  background: var(--bg-600);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp4);
  transition: all var(--transition);
  text-decoration: none;
}
.fav-card:hover { border-color: var(--gold-border); transform: translateY(-2px); }

.fav-card-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-100);
  line-height: 1.4;
  margin-bottom: var(--sp2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.fav-card-meta {
  font-size: 0.75rem;
  color: var(--text-600);
}

/* ============================================================
   ERROR PAGES
   ============================================================ */

.error-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--sp6);
}

.error-code {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 6rem;
  font-weight: 700;
  color: var(--gold);
  opacity: 0.3;
  line-height: 1;
}

.error-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-100);
  margin: var(--sp4) 0 var(--sp3);
}

.error-desc {
  font-size: 0.9375rem;
  color: var(--text-400);
  max-width: 400px;
  margin: 0 auto var(--sp8);
}

/* ============================================================
   UTILITIES
   ============================================================ */

.text-gold    { color: var(--gold); }
.text-muted   { color: var(--text-400); }
.text-xs      { font-size: 0.75rem; }
.text-sm      { font-size: 0.875rem; }
.text-right   { text-align: right; }
.text-center  { text-align: center; }

.mt-2 { margin-top: var(--sp2); }
.mt-4 { margin-top: var(--sp4); }
.mt-6 { margin-top: var(--sp6); }
.mt-8 { margin-top: var(--sp8); }
.mb-2 { margin-bottom: var(--sp2); }
.mb-4 { margin-bottom: var(--sp4); }
.mb-6 { margin-bottom: var(--sp6); }

.d-flex   { display: flex; }
.align-center { align-items: center; }
.gap-2    { gap: var(--sp2); }
.gap-4    { gap: var(--sp4); }
.flex-1   { flex: 1; }
.w-full   { width: 100%; }

.fade-in {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   CLASSEURS
   ============================================================ */

/* Color palette — dots + card accents */
.classeur-dot-gold   { background: var(--gold); }
.classeur-dot-blue   { background: var(--blue); }
.classeur-dot-green  { background: var(--green); }
.classeur-dot-teal   { background: var(--teal); }
.classeur-dot-red    { background: var(--red); }
.classeur-dot-orange { background: var(--orange); }
.classeur-dot-slate  { background: var(--text-600); }

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

.classeur-card {
  display: flex;
  flex-direction: column;
  gap: var(--sp2);
  background: var(--bg-700);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp5);
  text-decoration: none;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.classeur-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}
.classeur-card-gold::before   { background: var(--gold); }
.classeur-card-blue::before   { background: var(--blue); }
.classeur-card-green::before  { background: var(--green); }
.classeur-card-teal::before   { background: var(--teal); }
.classeur-card-red::before    { background: var(--red); }
.classeur-card-orange::before { background: var(--orange); }
.classeur-card-slate::before  { background: var(--text-600); }

.classeur-card:hover {
  background: var(--bg-600);
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.classeur-card-icon { color: var(--text-600); margin-bottom: var(--sp1); }
.classeur-card-name { font-size: 0.9375rem; font-weight: 600; color: var(--text-100); }
.classeur-card-meta { font-size: 0.8125rem; color: var(--text-400); }
.classeur-card-date { font-size: 0.75rem; color: var(--text-600); margin-top: auto; padding-top: var(--sp3); }

/* Color picker in create form */
.color-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform var(--transition), border-color var(--transition);
}
.color-dot:hover { transform: scale(1.2); }
.color-dot.selected { border-color: var(--text-100); transform: scale(1.25); }
.color-dot-gold   { background: var(--gold); }
.color-dot-blue   { background: var(--blue); }
.color-dot-green  { background: var(--green); }
.color-dot-teal   { background: var(--teal); }
.color-dot-red    { background: var(--red); }
.color-dot-orange { background: var(--orange); }
.color-dot-slate  { background: var(--text-600); }

/* Classeur dropdown on document view */
.classeur-dropdown { position: relative; }

.classeur-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 50;
  min-width: 220px;
  background: var(--bg-700);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.classeur-menu.open { display: block; }

.classeur-menu-item {
  display: flex;
  align-items: center;
  gap: var(--sp3);
  width: 100%;
  padding: var(--sp3) var(--sp4);
  background: none;
  border: none;
  color: var(--text-400);
  font-size: 0.875rem;
  cursor: pointer;
  text-align: left;
  transition: background var(--transition), color var(--transition);
}
.classeur-menu-item:hover { background: var(--bg-600); color: var(--text-100); }
.classeur-menu-item .classeur-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.classeur-menu-item .classeur-item-name { flex: 1; }
.classeur-menu-item .classeur-check { color: var(--green); opacity: 0; font-size: 0.8rem; }
.classeur-menu-item.in-classeur { color: var(--text-100); }
.classeur-menu-item.in-classeur .classeur-check { opacity: 1; }

/* ============================================================
   ANNOTATIONS
   ============================================================ */

.annotation-panel {
  margin-top: var(--sp10);
  padding-top: var(--sp8);
  border-top: 1px solid var(--border);
}

.annotation-header {
  display: flex;
  align-items: center;
  gap: var(--sp3);
  margin-bottom: var(--sp4);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-200);
}

.annotation-date {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--text-600);
  margin-left: auto;
}

.annotation-textarea {
  width: 100%;
  background: var(--bg-700);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text-200);
  font-size: 0.875rem;
  line-height: 1.7;
  padding: var(--sp4);
  resize: vertical;
  min-height: 120px;
  transition: border-color var(--transition);
  font-family: inherit;
}
.annotation-textarea:focus {
  outline: none;
  border-color: var(--gold-border);
}
.annotation-textarea::placeholder { color: var(--text-600); }

.annotation-actions {
  display: flex;
  align-items: center;
  gap: var(--sp3);
  margin-top: var(--sp3);
}

.annotation-status {
  font-size: 0.8125rem;
  font-weight: 500;
  margin-left: auto;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 1024px) {
  .cat-grid { grid-template-columns: repeat(3, 1fr); }
  .widget-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 960px) {
  .search-layout { grid-template-columns: 200px 1fr; gap: var(--sp5); }
}

@media (max-width: 768px) {
  .hero { min-height: auto; padding: var(--sp16) var(--sp4); }
  .hero-title { font-size: 2rem; }
  .hero-subtitle { font-size: 1rem; }
  .cat-grid { grid-template-columns: repeat(2, 1fr); }
  .steps-grid { grid-template-columns: 1fr; }
  .search-layout { grid-template-columns: 1fr; gap: var(--sp4); padding-top: var(--sp4); }
  .filters-panel { position: static; }
  .filters-panel .facet-list { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: var(--sp3); }
  .filters-panel .facet-list li a { padding: 4px var(--sp3); font-size: 0.75rem; }
  .app-layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; }
  .sidebar-nav { flex-direction: row; flex-wrap: wrap; padding: var(--sp3); }
  .fav-grid { grid-template-columns: repeat(2, 1fr); }
  .widget-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-grid { flex-wrap: wrap; }
  .stat-item { flex: 1 1 50%; }
  .footer-grid { grid-template-columns: 1fr; gap: var(--sp6); }
}

@media (max-width: 480px) {
  :root { --sp6: 20px; }
  .cat-grid { grid-template-columns: 1fr 1fr; }
  .fav-grid { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .hero-search-box button span { display: none; }
  .widget-grid { grid-template-columns: 1fr 1fr; }
}
