/* =============================================================
   L'Atelier Numéro Treize · Transferts
   Design : sobre, élégant, atelier de création
   Palette : ivoire, encre profonde, cuivre
   ============================================================= */

:root {
  /* Couleurs - modifie ces variables pour réaligner sur ta charte */
  --ivory:        #FAF8F5;
  --ivory-deep:   #F2EDE3;
  --paper:        #FFFFFF;
  --ink:          #1A1A1A;
  --ink-soft:     #3A3A3A;
  --muted:        #8C8275;
  --line:         #E8E2D8;
  --line-strong:  #D8CFBF;
  --copper:       #B8704A;
  --copper-deep:  #92563A;
  --danger:       #B43A3A;

  /* Typographie */
  --font-display: 'Space Grotesk', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-sans:    'Albert Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  /* Alias rétro-compat */
  --font-serif:   var(--font-display);

  /* Rythme */
  --radius-sm:  6px;
  --radius:     10px;
  --radius-lg:  18px;
  --radius-xl:  24px;
  --shadow:     0 1px 0 rgba(26, 26, 26, 0.04);
  --shadow-lg:  0 24px 60px -28px rgba(26, 26, 26, 0.18);
  --shadow-xl:  0 32px 80px -36px rgba(26, 26, 26, 0.22);

  --container:  1080px;
  --container-narrow: 520px;
}

/* ----------------------- Reset doux ----------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--ivory);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--ink-soft); }
button { font: inherit; }

/* ----------------------- Layout ----------------------- */
.page {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 8vh 24px 60px;
}
.page--centered { align-items: center; padding: 4vh 24px; }
.page--public   { padding: 8vh 24px; }

.app-main {
  flex: 1;
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 40px 32px 80px;
}

/* ----------------------- Header app ----------------------- */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 40px;
  background: var(--ivory);
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: blur(8px);
}
.app-nav {
  display: flex;
  align-items: center;
  gap: 28px;
  font-size: 14px;
}
.app-nav a {
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  position: relative;
  padding: 4px 0;
}
.app-nav a.active { color: var(--ink); }
.app-nav a.active::after {
  content: '';
  position: absolute; left: 0; right: 0; bottom: -2px;
  height: 1px; background: var(--ink);
}

/* ----------------------- Marque (logo) ----------------------- */
.brand-logo {
  display: inline-block;
  color: var(--ink);
  width: 150px;
  max-width: 100%;
  margin-bottom: 28px;
  line-height: 0;
}
.brand-logo svg { width: 100%; height: auto; display: block; }
.brand-logo--inline { width: 98px; margin-bottom: 0; }
.brand-logo--small  { width: 72px; }
.brand-logo--light  { color: var(--ivory); }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ----------------------- Cards ----------------------- */
.card {
  background: var(--paper);
  border: 0;
  border-radius: var(--radius-lg);
  padding: 48px 56px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}
.card--narrow { max-width: var(--container-narrow); }
.card--wide   { max-width: var(--container); }
.card__head { margin-bottom: 32px; }

/* ----------------------- Typographie ----------------------- */
.title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 32px;
  line-height: 1.18;
  letter-spacing: -0.015em;
  margin: 0 0 12px 0;
  color: var(--ink);
}
.subtitle {
  margin: 0 0 28px 0;
  font-size: 15px;
  color: var(--ink-soft);
  line-height: 1.6;
}
.muted { color: var(--muted); font-size: 13px; }
.muted.center { text-align: center; margin-top: 16px; }

/* ----------------------- Stats ----------------------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}
.stat {
  background: var(--paper);
  border-radius: var(--radius);
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-lg);
}
.stat__label {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.stat__value {
  font-family: var(--font-display);
  font-size: 32px;
  color: var(--ink);
  font-weight: 500;
}

/* ----------------------- Panel & tableau ----------------------- */
.panel {
  background: var(--paper);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.panel__head {
  padding: 24px 32px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.panel__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 22px;
  margin: 0;
}
.empty { padding: 48px 32px; text-align: center; color: var(--muted); }

.table-wrap { overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table th, .table td {
  padding: 16px 18px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.table th {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  background: var(--ivory-deep);
}
.table thead tr th:first-child { border-top-left-radius: var(--radius-sm); }
.table thead tr th:last-child  { border-top-right-radius: var(--radius-sm); }
.table th:first-child, .table td:first-child { padding-left: 32px; }
.table th:last-child, .table td:last-child   { padding-right: 32px; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tbody tr:hover { background: var(--ivory); }
.row--expired { opacity: 0.55; }
.cell-main { font-weight: 500; color: var(--ink); }
.cell-sub  { color: var(--muted); font-size: 12px; margin-top: 2px; }

.actions { white-space: nowrap; display: flex; gap: 14px; justify-content: flex-end; }

/* ----------------------- Tags ----------------------- */
.tag {
  display: inline-block;
  padding: 4px 12px;
  font-size: 11px;
  letter-spacing: 0.08em;
  background: var(--ivory-deep);
  color: var(--ink);
  border-radius: 999px;
}
.tag--muted { color: var(--muted); }
.tag--accent {
  background: var(--ink);
  color: var(--ivory);
}

/* ----------------------- Toggle segmenté ----------------------- */
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--ivory-deep);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 8px;
  gap: 4px;
}
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label {
  text-align: center;
  padding: 10px 14px;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  border-radius: 999px;
  transition: background 0.18s ease, color 0.18s ease;
}
.segmented input:checked + label {
  background: var(--ink);
  color: var(--ivory);
}
.segmented input:focus-visible + label {
  outline: 1px solid var(--ink);
  outline-offset: 2px;
}

.field__hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

/* ----------------------- Boutons ----------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 30px;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--ink);
  color: var(--ivory);
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, transform 0.06s ease;
}
.btn:hover { background: var(--ink-soft); color: var(--ivory); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.35; cursor: not-allowed; }

.btn--primary {}
.btn--ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line-strong);
}
.btn--ghost:hover { background: var(--ivory-deep); color: var(--ink); border-color: transparent; }
.btn--small, .btn--sm { padding: 10px 22px; font-size: 11px; }
.btn--block { width: 100%; }

/* ----------------------- Liens ----------------------- */
.link {
  color: var(--ink);
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-decoration: none;
  border-bottom: 1px solid var(--line-strong);
  transition: border-color 0.15s ease, color 0.15s ease;
}
.link:hover { border-bottom-color: var(--ink); color: var(--ink); }
.link--small { font-size: 12px; }
.link--muted { color: var(--muted); }
.link--muted:hover { color: var(--ink); }

/* ----------------------- Formulaire ----------------------- */
.form { display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field__label {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.field input,
.field textarea {
  font: inherit;
  padding: 13px 16px;
  background: var(--ivory);
  border: 1px solid transparent;
  color: var(--ink);
  border-radius: var(--radius);
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.field input:focus,
.field textarea:focus {
  outline: none;
  background: var(--paper);
  box-shadow: 0 0 0 1px var(--ink);
}
.field textarea { resize: vertical; min-height: 120px; border-radius: var(--radius); }
.checkbox {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--ink-soft);
  margin-top: 4px;
}
.checkbox input { accent-color: var(--ink); }
.form__actions { display: flex; gap: 12px; margin-top: 8px; }

.alert {
  padding: 14px 18px;
  font-size: 13px;
  border-radius: var(--radius);
  margin-bottom: 18px;
}
.alert--error {
  background: #FBEEEE;
  color: var(--danger);
}
.alert--ok {
  background: var(--ivory-deep);
  color: var(--ink);
}

/* ----------------------- Dropzone ----------------------- */
.dropzone {
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--ivory);
  padding: 56px 32px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease;
  min-height: 240px;
  justify-content: center;
}
.dropzone:hover,
.dropzone:focus,
.dropzone.is-dragging {
  border-color: var(--ink);
  background: var(--paper);
  outline: none;
}
.dropzone__icon { color: var(--ink-soft); }
.dropzone__label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 14px; color: var(--ink-soft);
}
.dropzone__label strong {
  font-family: var(--font-display);
  font-size: 20px; color: var(--ink); font-weight: 500;
}

.filelist {
  list-style: none;
  margin: 18px 0 0 0;
  padding: 0;
  border-top: 1px solid var(--line);
}
.filelist li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  gap: 16px;
}
.filelist__name { color: var(--ink); word-break: break-all; }
.filelist--editable li button {
  background: none; border: 0; cursor: pointer;
  color: var(--muted);
  font-size: 18px; line-height: 1;
}
.filelist--editable li button:hover { color: var(--danger); }

.meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 18px;
}

/* ----------------------- Progression ----------------------- */
.progress { margin-top: 24px; }
.progress__track {
  height: 4px;
  background: var(--line);
  overflow: hidden;
  border-radius: 0;
}
.progress__bar {
  height: 100%;
  width: 0;
  background: var(--ink);
  transition: width 0.2s ease;
}
.progress__label {
  margin-top: 10px;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ----------------------- Résultat ----------------------- */
.result {
  margin-top: 32px;
  padding: 28px 32px;
  background: var(--ivory);
  border-radius: var(--radius-lg);
}
.result h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 22px;
  margin: 0 0 8px 0;
}
.result__link {
  display: flex;
  gap: 8px;
  margin: 12px 0;
}
.result__link input {
  flex: 1;
  padding: 13px 16px;
  border: 0;
  border-radius: var(--radius);
  background: var(--paper);
  font-family: 'JetBrains Mono', 'SF Mono', Menlo, monospace;
  font-size: 13px;
  color: var(--ink);
}
.result__muted { font-size: 12px; color: var(--muted); }

/* ----------------------- Drawer (détails admin) ----------------------- */
.drawer {
  position: fixed;
  top: 16px; right: 16px; bottom: 16px;
  width: 460px;
  max-width: calc(100% - 32px);
  background: var(--paper);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  z-index: 50;
  animation: slide-in 0.3s ease;
  overflow: hidden;
}
@keyframes slide-in { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer__head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 24px 32px;
  border-bottom: 1px solid var(--line);
}
.drawer__head h3 { margin: 0; font-family: var(--font-display); font-weight: 500; font-size: 20px; }
.drawer__close {
  font-size: 22px;
  color: var(--muted);
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  text-decoration: none;
}
.drawer__close:hover { color: var(--ink); }
.drawer__body { padding: 24px 32px 40px; overflow-y: auto; }

.kv { display: grid; grid-template-columns: 140px 1fr; gap: 14px 18px; margin: 0 0 24px 0; font-size: 14px; }
.kv dt { color: var(--muted); font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; }
.kv dd { margin: 0; color: var(--ink); word-break: break-word; }
.kv-title { font-family: var(--font-display); font-weight: 500; font-size: 16px; margin: 24px 0 8px; color: var(--ink); }
.code {
  font-family: 'JetBrains Mono', 'SF Mono', Menlo, monospace;
  font-size: 12px;
  background: var(--ivory);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  display: inline-block;
  margin-right: 8px;
  word-break: break-all;
}

/* ----------------------- Quote (message client) ----------------------- */
.quote {
  margin: 24px 0;
  padding: 22px 26px;
  background: var(--ivory);
  border-radius: var(--radius-lg);
  font-style: italic;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.6;
}

.muted-card {
  margin-top: 28px;
  padding: 22px;
  border-radius: var(--radius-lg);
  background: var(--ivory-deep);
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

/* ----------------------- Pagination ----------------------- */
.pagination {
  display: flex; gap: 6px; justify-content: center; margin-top: 32px;
  padding-bottom: 24px;
}
.pagination a {
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--ink-soft);
  background: var(--ivory-deep);
}
.pagination a.is-active {
  background: var(--ink);
  color: var(--ivory);
}

/* ----------------------- Footer ----------------------- */
.site-footer {
  padding: 28px 32px;
  display: flex;
  justify-content: center;
  gap: 12px;
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-transform: uppercase;
  background: var(--ivory);
}
.site-footer .dot { color: var(--line-strong); }

/* ----------------------- Grid ----------------------- */
.grid--two {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 48px;
}
@media (max-width: 880px) {
  .grid--two { grid-template-columns: 1fr; gap: 32px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .card { padding: 32px 28px; }
  .app-header { padding: 18px 20px; flex-wrap: wrap; gap: 16px; }
  .app-main { padding: 24px 20px 60px; }
  .table th:first-child, .table td:first-child { padding-left: 16px; }
  .table th:last-child, .table td:last-child { padding-right: 16px; }
  .drawer { width: 100%; }
}
