/* =====================================================================
   Bibliomas — DIPLOMAS GROUP TECHNOLOGIES
   Theme technologique, responsive (telephone / tablette / PC), clair & sombre
   ===================================================================== */
:root {
  --bg: #060a13;
  --bg-2: #0a1020;
  --surface: rgba(15, 23, 42, .72);
  --surface-solid: #0f172a;
  --surface-2: rgba(30, 41, 59, .55);
  --line: rgba(148, 163, 184, .14);
  --line-strong: rgba(148, 163, 184, .28);
  --text: #e2e8f0;
  --text-strong: #ffffff;
  --muted: #8b9bb4;
  --primary: #3b82f6;
  --cyan: #22d3ee;
  --violet: #8b5cf6;
  --grad: linear-gradient(120deg, #22d3ee 0%, #3b82f6 45%, #8b5cf6 100%);
  --ok: #34d399; --warn: #fbbf24; --danger: #f87171;
  --glow: 0 0 0 1px rgba(34, 211, 238, .25), 0 10px 40px -10px rgba(59, 130, 246, .45);
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, .6);
  --radius: 16px; --radius-sm: 10px;
  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  --topbar-h: 64px; --tabbar-h: 0px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #eef2f8; --bg-2: #e6ecf5; --surface: rgba(255, 255, 255, .82); --surface-solid: #ffffff;
  --surface-2: rgba(241, 245, 249, .9); --line: rgba(15, 23, 42, .09); --line-strong: rgba(15, 23, 42, .18);
  --text: #1e293b; --text-strong: #0b1220; --muted: #5b6b85;
  --glow: 0 0 0 1px rgba(59, 130, 246, .25), 0 12px 32px -14px rgba(59, 130, 246, .45);
  --shadow: 0 10px 30px -16px rgba(15, 23, 42, .35);
  color-scheme: light;
}

@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .18s; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100vh; font-family: var(--font); font-size: 15px; line-height: 1.55; color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(1200px 600px at 85% -10%, rgba(139, 92, 246, .16), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(34, 211, 238, .12), transparent 60%),
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: auto, auto, 44px 44px, 44px 44px;
  background-attachment: fixed;
  padding-bottom: var(--tabbar-h);
  -webkit-font-smoothing: antialiased;
}
:root[data-theme="light"] body { background-image:
    radial-gradient(1200px 600px at 85% -10%, rgba(139, 92, 246, .10), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(34, 211, 238, .10), transparent 60%),
    linear-gradient(rgba(15,23,42,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(15,23,42,.04) 1px, transparent 1px); }

a { color: var(--cyan); text-decoration: none; }
:root[data-theme="light"] a { color: #2563eb; }
a:hover { text-decoration: none; opacity: .9; }
h1, h2, h3 { color: var(--text-strong); line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.4rem, 1.1rem + 1.3vw, 2rem); font-weight: 750; }
h2 { font-size: 1.15rem; font-weight: 700; }
h3 { font-size: 1rem; font-weight: 650; }
img { max-width: 100%; }
.muted { color: var(--muted); } .small { font-size: .84rem; } .mono { font-family: var(--mono); }
.hidden { display: none !important; }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.eyebrow { font-family: var(--mono); font-size: .72rem; letter-spacing: .18em; text-transform: uppercase; color: var(--cyan); }
:root[data-theme="light"] .eyebrow { color: #0891b2; }
.icon { width: 1.15em; height: 1.15em; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.18em; }
code { font-family: var(--mono); background: var(--surface-2); border: 1px solid var(--line); padding: 1px 6px;
  border-radius: 6px; font-size: .85em; }

/* ------------------------------------------------------------------ barre superieure */
.topbar {
  position: sticky; top: 0; z-index: 50; height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px; padding: 0 clamp(14px, 3vw, 28px);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: saturate(160%) blur(16px); -webkit-backdrop-filter: saturate(160%) blur(16px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; color: var(--text-strong); white-space: nowrap; }
.brand-mark { width: 36px; height: 36px; flex: none; }
.brand-name { font-weight: 800; font-size: 1.12rem; letter-spacing: .01em; line-height: 1.05; }
.brand-org { display: block; font-family: var(--mono); font-size: .58rem; letter-spacing: .16em; color: var(--muted);
  font-weight: 500; text-transform: uppercase; }
.nav { display: flex; gap: 2px; margin-left: 10px; }
.nav a { display: inline-flex; align-items: center; gap: 7px; padding: 8px 13px; border-radius: 10px; color: var(--muted);
  font-weight: 550; font-size: .92rem; transition: color .15s, background .15s; }
.nav a:hover { color: var(--text-strong); background: var(--surface-2); }
.nav a.active { color: var(--text-strong); background: var(--surface-2); box-shadow: inset 0 -2px 0 var(--cyan); }
.search { position: relative; flex: 1; max-width: 460px; margin-left: auto; }
.search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { width: 100%; padding-left: 38px; height: 40px; border-radius: 12px; }
.search kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-family: var(--mono);
  font-size: .7rem; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 5px; padding: 1px 6px; }
.top-actions { display: flex; align-items: center; gap: 6px; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); cursor: pointer; transition: border-color .15s, transform .15s; }
.icon-btn:hover { border-color: var(--cyan); }
.icon-btn:active { transform: scale(.95); }
.avatar { display: inline-flex; align-items: center; gap: 9px; padding: 4px 10px 4px 4px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.avatar-initials { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; font-weight: 700;
  font-size: .85rem; color: #fff; background: var(--grad); }
.avatar-meta { line-height: 1.15; font-size: .82rem; }
.avatar-meta small { display: block; color: var(--muted); font-family: var(--mono); font-size: .66rem; letter-spacing: .05em; }
.menu-btn { display: none; }

/* tiroir mobile */
.drawer-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(2, 6, 23, .55); backdrop-filter: blur(3px);
  opacity: 0; pointer-events: none; transition: opacity .2s; }
.drawer { position: fixed; z-index: 61; top: 0; right: 0; bottom: 0; width: min(320px, 86vw); padding: 20px;
  background: var(--surface-solid); border-left: 1px solid var(--line); transform: translateX(100%);
  transition: transform .25s var(--ease); display: flex; flex-direction: column; gap: 6px; overflow-y: auto; }
.drawer a, .drawer button.drawer-link { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px;
  color: var(--text); font-weight: 550; background: none; border: 0; font: inherit; cursor: pointer; text-align: left; width: 100%; }
.drawer a:hover, .drawer a.active { background: var(--surface-2); }
body.drawer-open .drawer { transform: none; }
body.drawer-open .drawer-backdrop { opacity: 1; pointer-events: auto; }

/* barre d'onglets (telephone) */
.tabbar { display: none; }

/* ------------------------------------------------------------------ contenu */
.container { width: 100%; max-width: 1360px; margin: 0 auto; padding: clamp(16px, 3vw, 32px) clamp(14px, 3vw, 28px) 48px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 4px 0 0; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 34px 0 14px; }
.section-head h2 { margin: 0; display: flex; align-items: center; gap: 9px; }
.section-head a { font-size: .88rem; display: inline-flex; align-items: center; gap: 4px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(14px, 2vw, 22px);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-stats { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

/* hero */
.hero { position: relative; overflow: hidden; padding: clamp(20px, 4vw, 36px); border-radius: 22px;
  background: linear-gradient(135deg, rgba(34, 211, 238, .12), rgba(59, 130, 246, .10) 40%, rgba(139, 92, 246, .16));
  border: 1px solid var(--line-strong); }
.hero::after { content: ""; position: absolute; right: -80px; top: -80px; width: 320px; height: 320px; border-radius: 50%;
  background: radial-gradient(circle, rgba(34, 211, 238, .28), transparent 65%); filter: blur(10px); pointer-events: none; }
.hero h1 { font-size: clamp(1.5rem, 1.1rem + 2vw, 2.4rem); margin-top: 6px; }
.hero-stats { display: flex; flex-wrap: wrap; gap: 10px 28px; margin-top: 18px; }
.hero-stat b { display: block; font-size: 1.6rem; font-weight: 800; color: var(--text-strong); font-variant-numeric: tabular-nums; }
.hero-stat span { font-family: var(--mono); font-size: .7rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }

/* domaines */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip-link { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; font-weight: 550;
  font-size: .88rem; color: var(--text); background: var(--surface); border: 1px solid var(--line); transition: all .15s; white-space: nowrap; }
.chip-link:hover, .chip-link.active { border-color: var(--cyan); color: var(--text-strong); box-shadow: var(--glow); }
.chip-link .count { font-family: var(--mono); font-size: .72rem; color: var(--muted); }
.chips-scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding: 4px 2px 8px; margin: 0 -2px; }
.chips-scroll::-webkit-scrollbar { display: none; }

/* ------------------------------------------------------------------ cartes livres */
.books { display: grid; gap: clamp(14px, 2vw, 22px); grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); }
.rail { display: grid; grid-auto-flow: column; grid-auto-columns: 172px; gap: 18px; overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory; padding: 4px 2px 14px; scrollbar-width: thin; }
.rail > * { scroll-snap-align: start; }
.book { display: flex; flex-direction: column; gap: 10px; color: var(--text); min-width: 0; }
.book-cover { position: relative; aspect-ratio: 2 / 3; border-radius: 12px; overflow: hidden; background: var(--surface-2);
  border: 1px solid var(--line); box-shadow: var(--shadow); transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s; }
.book-cover::before { content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(148, 163, 184, .12) 50%, transparent 70%) 0 0 / 250% 100%;
  animation: shimmer 1.4s linear infinite; }
.book-cover img { position: relative; width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity .35s; }
.book-cover img.loaded { opacity: 1; }
.book-cover::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, rgba(0,0,0,.28), transparent 7%, transparent 93%, rgba(0,0,0,.18)),
              linear-gradient(to top, rgba(2, 6, 23, .55), transparent 35%); }
.book:hover .book-cover { transform: translateY(-5px); border-color: rgba(34, 211, 238, .5); box-shadow: var(--glow); }
.book-badges { position: absolute; z-index: 2; left: 8px; right: 8px; bottom: 8px; display: flex; gap: 5px; flex-wrap: wrap; }
.book-badges .tag { backdrop-filter: blur(8px); background: rgba(2, 6, 23, .6); color: #e2e8f0; border-color: rgba(255,255,255,.15); }
.book-title { font-weight: 650; font-size: .93rem; line-height: 1.3; color: var(--text-strong);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.book-meta { font-size: .8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
@keyframes shimmer { to { background-position: -250% 0; } }

/* ------------------------------------------------------------------ badges */
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 7px; font-size: .7rem;
  font-weight: 650; font-family: var(--mono); letter-spacing: .03em; border: 1px solid var(--line-strong); color: var(--muted); white-space: nowrap; }
.lvl { color: #fff !important; border: 0 !important; }
.lvl-1 { background: linear-gradient(120deg, #059669, #10b981) !important; }
.lvl-2 { background: linear-gradient(120deg, #0284c7, #38bdf8) !important; }
.lvl-3 { background: linear-gradient(120deg, #4f46e5, #818cf8) !important; }
.lvl-4 { background: linear-gradient(120deg, #c2410c, #fb923c) !important; }
.lvl-5 { background: linear-gradient(120deg, #be185d, #f472b6) !important; }
.lvl-6 { background: linear-gradient(120deg, #b91c1c, #f59e0b) !important; }
.tag-ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 50%, transparent); }
.tag-off { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 50%, transparent); }

/* ------------------------------------------------------------------ boutons & formulaires */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px;
  border-radius: 11px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); cursor: pointer;
  font: inherit; font-weight: 600; font-size: .9rem; white-space: nowrap; transition: transform .12s, border-color .15s, box-shadow .15s, opacity .15s; }
.btn:hover { border-color: var(--cyan); color: var(--text-strong); }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--grad); border: 0; color: #fff !important; box-shadow: 0 8px 24px -10px rgba(59, 130, 246, .8); }
.btn-primary:hover { box-shadow: 0 10px 30px -8px rgba(34, 211, 238, .7); }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); background: transparent; }
.btn-danger:hover { border-color: var(--danger); color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }
.btn-sm { min-height: 32px; padding: 4px 11px; font-size: .82rem; border-radius: 9px; }
.btn-block { width: 100%; }
.btn-link { background: none; border: 0; padding: 0; color: var(--cyan); cursor: pointer; font: inherit; }

input, select, textarea {
  font: inherit; color: var(--text); background: color-mix(in srgb, var(--bg) 70%, transparent);
  border: 1px solid var(--line-strong); border-radius: 11px; padding: 9px 12px; min-height: 40px; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(34, 211, 238, .18); }
input[type=checkbox], input[type=radio] { min-height: 0; width: 17px; height: 17px; accent-color: var(--primary); }
input[type=file] { padding: 8px; }
input[type=file]::file-selector-button { font: inherit; font-weight: 600; margin-right: 12px; border: 0; border-radius: 8px;
  padding: 6px 12px; background: var(--surface-2); color: var(--text); cursor: pointer; }
textarea { width: 100%; min-height: 120px; resize: vertical; }
label { display: block; font-size: .82rem; font-weight: 600; color: var(--muted); margin: 14px 0 6px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; }
.form-row input, .form-row select, .form-full { width: 100%; }
.check { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 500; font-size: .92rem; margin: 10px 0; cursor: pointer; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0 14px; max-height: 280px; overflow: auto;
  padding: 6px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.segmented { display: inline-flex; padding: 4px; gap: 4px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); flex-wrap: wrap; }
.segmented label { margin: 0; display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 9px; cursor: pointer;
  color: var(--muted); font-size: .88rem; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label:has(input:checked) { background: var(--surface-solid); color: var(--text-strong); box-shadow: var(--shadow); }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; }
.filters .grow { flex: 1 1 220px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline { display: inline; }

/* ------------------------------------------------------------------ tableaux */
.table-wrap { overflow-x: auto; padding: 0; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-family: var(--mono); font-size: .7rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
  background: var(--surface-2); position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .12s; }
tbody tr:hover td { background: rgba(34, 211, 238, .04); }
.thumb { width: 38px; aspect-ratio: 2/3; border-radius: 5px; object-fit: cover; background: var(--surface-2); display: block; border: 1px solid var(--line); }
.cell-title { display: flex; align-items: center; gap: 12px; min-width: 220px; }

/* ------------------------------------------------------------------ messages */
.flash { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 12px; margin-bottom: 14px;
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--primary); animation: slidein .3s var(--ease); }
.flash-success { border-left-color: var(--ok); } .flash-danger { border-left-color: var(--danger); }
.flash-warning { border-left-color: var(--warn); } .flash-info { border-left-color: var(--cyan); }
@keyframes slidein { from { opacity: 0; transform: translateY(-6px); } }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: var(--radius); }

.pager { display: flex; gap: 8px; justify-content: center; align-items: center; margin-top: 28px; }

/* connexion : voir la section dediee en fin de fichier */
.lock-note { display: flex; gap: 10px; align-items: flex-start; margin-top: 22px; padding: 12px 14px; border-radius: 12px;
  font-size: .8rem; color: var(--muted); background: var(--surface-2); border: 1px solid var(--line); }


/* ------------------------------------------------------------------ lecteur */
.reader { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 22px; align-items: start; }
.reader-head { display: flex; gap: 18px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; margin-bottom: 18px; }
.reader-head h1 { margin: 6px 0 4px; }
.viewer { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line-strong);
  background: #0b0f19; box-shadow: var(--shadow); }
.viewer iframe { width: 100%; height: calc(100vh - var(--topbar-h) - 150px); min-height: 520px; border: 0; display: block; background: #fff; }
.viewer video { width: 100%; max-height: 78vh; display: block; background: #000; }
.viewer > img { display: block; margin: 0 auto; max-height: 85vh; }
.pages { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 14px; max-height: calc(100vh - var(--topbar-h) - 150px);
  min-height: 520px; overflow-y: auto; overscroll-behavior: contain; background: #1a2030; }
.pages img { width: 100%; max-width: 980px; background: #fff; border-radius: 4px; box-shadow: 0 6px 22px rgba(0, 0, 0, .45);
  aspect-ratio: var(--ratio, 0.707); }
.viewer-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; flex-wrap: wrap;
  background: var(--surface-solid); border-bottom: 1px solid var(--line); font-size: .85rem; }
/* navigation de pages */
.page-ctl { display: flex; align-items: center; gap: 6px; margin: 0; }
.page-ctl .icon-btn { width: 34px; height: 34px; border-radius: 9px; }
.page-ctl input { width: 64px; min-height: 34px; padding: 4px 6px; text-align: center; font-family: var(--mono);
  font-weight: 600; -moz-appearance: textfield; }
.page-ctl input::-webkit-outer-spin-button, .page-ctl input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.viewer-bar .icon-btn { width: 34px; height: 34px; border-radius: 9px; }
.pages:focus { outline: none; }

/* plein ecran : seul le cadre du document occupe l'ecran */
.viewer:fullscreen, .viewer.is-full { display: flex; flex-direction: column; width: 100vw; height: 100vh; height: 100dvh;
  max-height: none; border-radius: 0; border: 0; background: #0b0f19; }
.viewer.is-full { position: fixed; inset: 0; z-index: 200; }
.viewer:fullscreen .pages, .viewer.is-full .pages,
.viewer:fullscreen iframe, .viewer.is-full iframe { flex: 1 1 auto; height: auto !important; max-height: none; min-height: 0; }
.viewer:fullscreen > img, .viewer.is-full > img { flex: 1 1 auto; min-height: 0; max-height: none; width: 100%; object-fit: contain; }
.viewer:fullscreen .pages img, .viewer.is-full .pages img { max-width: min(1100px, 100%); }
.viewer:-webkit-full-screen { width: 100vw; height: 100vh; }
.viewer:fullscreen .viewer-bar, .viewer.is-full .viewer-bar { padding-top: max(8px, env(safe-area-inset-top)); }
body.no-scroll { overflow: hidden; }
.viewer-image .viewer-bar { position: relative; }

.audio-player { padding: clamp(24px, 5vw, 48px); display: grid; grid-template-columns: 200px 1fr; gap: 28px; align-items: center;
  background: radial-gradient(600px 300px at 0% 0%, rgba(34, 211, 238, .2), transparent 60%),
              radial-gradient(600px 300px at 100% 100%, rgba(139, 92, 246, .25), transparent 60%), #0b1020; color: #fff; }
.audio-player img { width: 100%; border-radius: 12px; box-shadow: 0 18px 40px -12px rgba(0,0,0,.7); aspect-ratio: 2/3; object-fit: cover; }
.audio-player audio { width: 100%; margin-top: 16px; }
.audio-player h2 { color: #fff; }
.eq { display: flex; gap: 4px; align-items: flex-end; height: 34px; margin-top: 14px; }
.eq i { width: 5px; border-radius: 3px; background: var(--grad); height: 30%; animation: eq 1s ease-in-out infinite; animation-play-state: paused; }
.eq.playing i { animation-play-state: running; }
.eq i:nth-child(2) { animation-delay: -.2s; } .eq i:nth-child(3) { animation-delay: -.5s; } .eq i:nth-child(4) { animation-delay: -.7s; }
.eq i:nth-child(5) { animation-delay: -.35s; } .eq i:nth-child(6) { animation-delay: -.85s; }
@keyframes eq { 0%, 100% { height: 20%; } 50% { height: 100%; } }
.side-cover { width: 100%; max-width: 220px; aspect-ratio: 2/3; object-fit: cover; border-radius: 12px; display: block;
  margin: 0 auto 14px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.meta { display: grid; grid-template-columns: auto 1fr; gap: 10px 14px; margin: 0; font-size: .88rem; }
.meta dt { color: var(--muted); font-family: var(--mono); font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; padding-top: 3px; }
.meta dd { margin: 0; min-width: 0; }
.related { display: flex; gap: 10px; align-items: center; padding: 8px; margin: 0 -8px; border-radius: 10px; color: var(--text); }
.related:hover { background: var(--surface-2); }
.related img { width: 38px; aspect-ratio: 2/3; object-fit: cover; border-radius: 5px; flex: none; }
.related span { font-size: .87rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* apercus documents */
.doc-html { background: #fff; color: #1f2937; padding: clamp(22px, 6vw, 60px); max-width: 880px; margin: 0 auto; border-radius: 6px;
  font-family: Georgia, "Times New Roman", serif; font-size: 1.06rem; line-height: 1.75; box-shadow: 0 8px 30px rgba(0,0,0,.25); }
.doc-html img { max-width: 100%; height: auto; } .doc-html table { border-collapse: collapse; } .doc-html td, .doc-html th { border: 1px solid #ddd; padding: 6px; }
.doc-text { white-space: pre-wrap; word-break: break-word; font-family: var(--mono); font-size: .88rem; background: var(--surface-solid);
  color: var(--text); padding: 22px; border-radius: 12px; border: 1px solid var(--line); max-width: 1000px; margin: 0 auto; }

/* admin */
.admin-nav { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 14px; margin-bottom: 22px;
  border-bottom: 1px solid var(--line); }
.admin-nav::-webkit-scrollbar { display: none; }
.admin-nav a { display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 11px; color: var(--muted);
  font-weight: 600; font-size: .88rem; white-space: nowrap; border: 1px solid transparent; }
.admin-nav a:hover { color: var(--text-strong); background: var(--surface-2); }
.admin-nav a.active { color: var(--text-strong); background: var(--surface); border-color: var(--line-strong); box-shadow: inset 0 -2px 0 var(--cyan); }
.stat-card { position: relative; overflow: hidden; }
.stat-card .icon { position: absolute; right: 16px; top: 16px; width: 26px; height: 26px; color: var(--cyan); opacity: .7; }
.stat { font-size: 1.9rem; font-weight: 800; color: var(--text-strong); font-variant-numeric: tabular-nums; line-height: 1.1; margin-top: 6px; }
.bars .row { display: grid; grid-template-columns: minmax(90px, 140px) 1fr 36px; gap: 12px; align-items: center; margin: 9px 0; font-size: .86rem; }
.bars .track { height: 8px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.bars .bar { height: 100%; border-radius: 6px; background: var(--grad); }
.log-line { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: .84rem; }
.log-line:last-child { border-bottom: 0; }
.log-line time { font-family: var(--mono); color: var(--muted); font-size: .76rem; flex: none; padding-top: 1px; }

/* pied de page */
.footer { border-top: 1px solid var(--line); padding: 22px clamp(14px, 3vw, 28px); color: var(--muted); font-size: .78rem;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; max-width: 1360px; margin: 0 auto; }
.footer .mono { letter-spacing: .08em; }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1180px) {
  .reader { grid-template-columns: 1fr; }
  .reader aside { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
  .reader aside .card { margin: 0 !important; }
  .avatar-meta { display: none; }
  .avatar { padding: 4px; }
  .topbar .search { display: none; }
  .top-actions { margin-left: auto; }
}
@media (max-width: 960px) {
  .nav, .search kbd { display: none; }
  .menu-btn { display: inline-grid; }
  .grid-2 { grid-template-columns: 1fr; }
  .hide-md { display: none !important; }
}
@media (max-width: 720px) {
  :root { --topbar-h: 58px; --tabbar-h: calc(64px + env(safe-area-inset-bottom)); }
  body { font-size: 14.5px; }
  .brand-org { display: none; }
  .brand-mark { width: 32px; height: 32px; }
  .search { display: none; }
  .top-actions { margin-left: auto; }
  .avatar { display: none; }
  .tabbar { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); position: fixed; z-index: 55; left: 0; right: 0; bottom: 0;
    height: var(--tabbar-h); padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--bg) 80%, transparent); backdrop-filter: saturate(160%) blur(18px); -webkit-backdrop-filter: saturate(160%) blur(18px);
    border-top: 1px solid var(--line); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: .68rem; font-weight: 600; color: var(--muted); }
  .tabbar a .icon { width: 22px; height: 22px; }
  .tabbar a.active { color: var(--cyan); }
  .books { grid-template-columns: repeat(auto-fill, minmax(min(140px, 42vw), 1fr)); gap: 16px 12px; }
  .rail { grid-auto-columns: 138px; gap: 12px; }
  .book-title { font-size: .86rem; }
  .audio-player { grid-template-columns: 1fr; text-align: center; }
  .audio-player img { max-width: 170px; margin: 0 auto; }
  .eq { justify-content: center; }
  .viewer iframe, .pages { min-height: 0; height: calc(100vh - var(--topbar-h) - var(--tabbar-h) - 120px); max-height: none; }
  .pages { padding: 8px; gap: 8px; }
  .hide-sm { display: none !important; }
  th, td { padding: 10px; }
  .filters > * { flex: 1 1 140px; }
  .section-head { margin-top: 26px; }
  .footer { padding-bottom: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* =====================================================================
   Page de connexion
   ===================================================================== */
.login { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(460px, 1fr); }

/* --- panneau de presentation */
.login-hero { position: relative; overflow: hidden; border-right: 1px solid var(--line);
  background:
    radial-gradient(800px 520px at 12% 18%, rgba(34, 211, 238, .16), transparent 60%),
    radial-gradient(760px 560px at 88% 92%, rgba(139, 92, 246, .22), transparent 62%); }
.login-hero::after { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, transparent 70%, color-mix(in srgb, var(--bg) 40%, transparent)); }
.login-hero-inner { position: relative; z-index: 1; height: 100%; display: flex; flex-direction: column; gap: 40px;
  padding: clamp(32px, 4.5vw, 64px) clamp(32px, 5vw, 80px); }
.login-copy { flex: 1; display: flex; flex-direction: column; justify-content: center; max-width: 560px; }
.login-copy h1 { font-size: clamp(2.2rem, 1.3rem + 2.4vw, 3.6rem); line-height: 1.06; letter-spacing: -.025em; margin: 14px 0 18px; }
.login-lead { color: var(--muted); font-size: 1.08rem; line-height: 1.65; margin: 0 0 30px; max-width: 50ch; }
.login-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.login-points li { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--line); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: border-color .2s, transform .2s var(--ease); }
.login-points li:hover { border-color: rgba(34, 211, 238, .4); transform: translateX(4px); }
.login-points b { display: block; color: var(--text-strong); font-size: .95rem; }
.login-points small { display: block; color: var(--muted); font-size: .84rem; margin-top: 1px; }
.login-point-icon { flex: none; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 11px;
  background: linear-gradient(135deg, rgba(34, 211, 238, .18), rgba(139, 92, 246, .22)); color: var(--cyan);
  border: 1px solid rgba(34, 211, 238, .25); }
.login-point-icon .icon { width: 20px; height: 20px; }
.login-meta { display: flex; flex-wrap: wrap; gap: 8px 22px; color: var(--muted); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; }
.login-meta span { display: inline-flex; align-items: center; gap: 7px; }
.login-meta .icon { color: var(--cyan); }

/* --- illustration (grands ecrans) */
.login-visual { display: none; position: absolute; z-index: 0; right: clamp(24px, 4vw, 70px); top: 50%; width: 300px; height: 380px;
  transform: translateY(-50%); pointer-events: none; }
.login-ring { position: absolute; inset: -60px; border-radius: 50%; border: 1px dashed rgba(34, 211, 238, .22);
  animation: spin 80s linear infinite; }
.login-ring::before { content: ""; position: absolute; inset: 50px; border-radius: 50%; border: 1px solid rgba(139, 92, 246, .22); }
.login-ring::after { content: ""; position: absolute; top: 30px; left: 70px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--cyan); box-shadow: 0 0 16px var(--cyan); }
.mock { position: absolute; width: 168px; aspect-ratio: 2 / 3; border-radius: 12px; padding: 18px 16px; display: flex; flex-direction: column;
  gap: 8px; color: #fff; border: 1px solid rgba(255, 255, 255, .14); box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .7);
  background-image: linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px);
  background-size: 18px 18px; animation: float 7s ease-in-out infinite; }
.mock::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; border-radius: 12px 0 0 12px; background: rgba(255, 255, 255, .5); }
.mock span { font-family: var(--mono); font-size: .62rem; letter-spacing: .2em; opacity: .85; margin-bottom: 18px; }
.mock i { display: block; height: 9px; border-radius: 4px; background: rgba(255, 255, 255, .85); }
.mock i.short { width: 60%; }
.mock em { margin-top: auto; font-style: normal; font-family: var(--mono); font-size: .62rem; letter-spacing: .12em; opacity: .7; }
.mock-1 { left: 0; top: 40px; transform: rotate(-9deg); background-color: #1e3a8a; animation-delay: -1s; }
.mock-2 { left: 70px; top: 0; z-index: 2; background-color: #7f1d1d; animation-delay: -3s; }
.mock-3 { left: 135px; top: 70px; transform: rotate(8deg); background-color: #4c1d95; animation-delay: -5s; }
@keyframes float { 50% { translate: 0 -10px; } }

/* --- panneau de connexion */
.login-panel { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
  padding: 40px clamp(24px, 4vw, 56px); background: color-mix(in srgb, var(--bg) 55%, transparent); }
.login-card { width: 100%; max-width: 420px; padding: clamp(26px, 3vw, 40px); border-radius: 22px; background: var(--surface);
  border: 1px solid var(--line-strong); box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .65), inset 0 1px 0 rgba(255, 255, 255, .04);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.login-card-head { display: flex; align-items: center; gap: 14px; }
.login-card-head .brand-mark { width: 46px; height: 46px; }
.login-card-head h2 { font-size: 1.7rem; margin: 2px 0 0; }
.login-sub { margin: 14px 0 6px; font-size: .93rem; }
.login-card label { margin-top: 18px; }
.field { position: relative; }
.field > .icon { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.field input { width: 100%; height: 50px; padding-left: 44px; border-radius: 12px; font-size: .98rem; }
.field input:focus + .field-btn, .field:focus-within > .icon { color: var(--cyan); }
.field-btn { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; display: grid;
  place-items: center; border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer; }
.field-btn:hover { color: var(--text-strong); background: var(--surface-2); }
.field input[type=password], .field input[data-pw] { padding-right: 48px; }
.login-submit { width: 100%; height: 52px; margin-top: 26px; font-size: 1rem; border-radius: 12px; }
.login-card .lock-note { margin-top: 24px; }
.login-card .flash { margin: 16px 0 0; }
.login-legal { margin: 0; color: var(--muted); font-size: .76rem; text-align: center; }

@media (min-width: 1800px) { .login-visual { display: block; } }
@media (max-width: 1024px) {
  .login { grid-template-columns: 1fr; }
  .login-hero { border-right: 0; border-bottom: 1px solid var(--line); }
  .login-hero-inner { gap: 18px; padding: 22px 20px 26px; }
  .login-copy { max-width: none; }
  .login-copy h1 { font-size: clamp(1.5rem, 1rem + 2.6vw, 2.2rem); margin: 8px 0 0; }
  .login-lead, .login-points, .login-meta { display: none; }
  .login-panel { justify-content: flex-start; padding: 28px 16px 36px; background: none; }
  .login-card { box-shadow: none; }
}
@media (max-width: 480px) {
  .login-card { padding: 22px 18px; border-radius: 18px; }
  .login-card-head .brand-mark { display: none; }
}
@media (min-width: 1025px) and (max-height: 800px) {
  .login-hero-inner { gap: 22px; padding-top: 28px; padding-bottom: 24px; }
  .login-copy h1 { font-size: clamp(2rem, 1.2rem + 2vw, 3rem); margin: 10px 0 12px; }
  .login-lead { font-size: 1rem; margin-bottom: 20px; }
  .login-points { gap: 8px; }
  .login-points li { padding: 10px 14px; }
  .login-card { padding: 26px 30px; }
  .login-card label { margin-top: 14px; }
  .login-submit { margin-top: 20px; }
}
