:root {
  --accent: #172554;
  --accent-text: #ffffff;
  --bg: #f7f7f5;
  --surface: #ffffff;
  --text: #1e293b;
  --text-muted: #6b6b66;
  --border: #e3e2dc;
  --success: #1a7a4c;
  --error: #b3401f;
  --radius: 8px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --accent: #7fa8e8;
    --accent-text: #0b1220;
    --bg: #14140f;
    --surface: #1c1c16;
    --text: #eceae2;
    --text-muted: #a3a297;
    --border: #33332b;
  }
}
* { box-sizing: border-box; }
html { scroll-padding-top: env(safe-area-inset-top, 0px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  line-height: 1.5;
  position: relative;
}
/* Logo en filigrane, fixe, discret, derrière tout le contenu */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("/assets/logo.png");
  background-repeat: no-repeat;
  background-position: center 40vh;
  background-size: min(70vw, 640px) auto;
  opacity: 0.05;
  pointer-events: none;
  z-index: 0;
}
@media (prefers-color-scheme: dark) {
  body::before { opacity: 0.08; }
}
header#site-header, main, footer#site-footer {
  position: relative;
  z-index: 1;
}
.tagline {
  text-align: center;
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--accent);
  text-transform: uppercase;
  margin: 0 0 6px;
}
a { color: inherit; text-decoration: none; }

/* Header */
header#site-header {
  position: sticky;
  top: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  gap: 16px;
  flex-wrap: wrap;
}
.logo { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.logo span { color: var(--accent); }
nav.tools-nav { display: flex; gap: 20px; flex-wrap: wrap; }
nav.tools-nav a { font-size: 13.5px; color: var(--text-muted); white-space: nowrap; }
nav.tools-nav a:hover { color: var(--text); }
.auth-links { display: flex; align-items: center; gap: 14px; font-size: 14px; }

/* Buttons */
.btn-primary {
  background: var(--accent);
  color: var(--accent-text);
  padding: 10px 18px;
  border: none;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  display: inline-block;
}
.btn-primary.btn-small { padding: 7px 14px; font-size: 13px; }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 9px 16px;
  border-radius: var(--radius);
  font-size: 13.5px;
  cursor: pointer;
}

/* Layout */
main { max-width: 1100px; margin: 0 auto; padding: 0 20px 60px; }

.hero { text-align: center; padding: 56px 12px 28px; }
.hero h1 { font-size: 34px; font-weight: 600; margin: 0 0 12px; letter-spacing: -0.02em; }
.hero p { color: var(--text-muted); font-size: 16px; max-width: 560px; margin: 0 auto; }

/* Tools grid */
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; padding: 24px 0 60px; }
@media (max-width: 760px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .grid { grid-template-columns: 1fr; } nav.tools-nav { display: none; } }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 150px;
}
.card h3 { margin: 0; font-size: 16px; font-weight: 600; }
.card p { margin: 0; font-size: 13.5px; color: var(--text-muted); flex-grow: 1; }
.card .use-link { font-size: 13.5px; font-weight: 500; color: var(--accent); }

/* Tool page */
.tool-hero { text-align: left; padding: 36px 0 20px; }
.tool-hero h1 { font-size: 26px; margin: 0 0 8px; }
.tool-hero p { color: var(--text-muted); font-size: 14.5px; margin: 0; max-width: 620px; }

.tool-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 640px;
}

.dropzone {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  padding: 36px 20px;
  text-align: center;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-muted);
}
.dropzone.dragover { border-color: var(--accent); color: var(--text); }
.dropzone strong { color: var(--text); }

.file-list { margin: 16px 0; display: flex; flex-direction: column; gap: 8px; }
.file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13.5px;
}
.file-row .name { flex-grow: 1; margin-right: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row .size { color: var(--text-muted); margin-right: 12px; white-space: nowrap; }
.file-row .remove { color: var(--error); background: none; border: none; cursor: pointer; font-size: 13px; padding: 0; }

.field { margin: 18px 0; }
.field label { display: block; font-size: 13.5px; font-weight: 500; margin-bottom: 6px; }
.field input[type="text"], .field input[type="number"] {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
}
.field .hint { font-size: 12.5px; color: var(--text-muted); margin-top: 5px; }

.actions { margin-top: 20px; display: flex; gap: 10px; align-items: center; }

.status { margin-top: 14px; font-size: 13.5px; min-height: 18px; }
.status-error { color: var(--error); }
.status-success { color: var(--success); }

/* Miniatures réorganisables (Organiser PDF) */
.thumb-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 18px 0;
}
.thumb-item {
  width: 110px;
  cursor: grab;
  user-select: none;
}
.thumb-item canvas {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  display: block;
  background: #fff;
}
.thumb-item.dragging { opacity: 0.4; }
.thumb-item .thumb-num {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Footer */
footer#site-footer { border-top: 1px solid var(--border); padding: 26px 20px 40px; margin-top: 40px; }
.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  gap: 28px;
  flex-wrap: wrap;
  font-size: 13.5px;
  color: var(--text-muted);
}
.footer-inner a:hover { color: var(--text); }
