/* Ahmed & Denis : jetons repris du design system « Ahmed & Denis ».
   L'ambre est la lettre d'Ahmed, le bleu celle de Denis, le marine leur fond commun.
   Mise en page : accueil en deux panneaux (marque sur marine, accès sur fond),
   application en barre latérale + liste. */

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/fonts/bricolage-grotesque.woff2") format("woff2");
  font-weight: 600 800;
  font-display: swap;
}
@font-face {
  font-family: "Figtree";
  src: url("/fonts/figtree.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --fond: #EEF2F7;
  --surface: #FFFFFF;
  --survol: #E2E8F0;
  --filet: #CBD4E0;
  --contour: #7D8BA1;
  --encre: #162036;
  --encre-douce: #56637A;
  --ambre: #F2B12E;
  --sur-ambre: #241A05;
  --bleu: #2152A3;
  --bleu-fond: #E3ECFA;
  --alerte: #B42318;
  --sur-alerte: #FFFFFF;
  --alerte-fond: #FDECEA;
  --marine: #162036;
  --marine-texte: #E9EEF6;
  --marine-doux: #A9B5C9;
  --ombre-flottante: 0 10px 32px rgba(22, 32, 54, .16);

  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-texte: Figtree, "Segoe UI", system-ui, sans-serif;

  --espace-1: 4px;
  --espace-2: 8px;
  --espace-3: 12px;
  --espace-4: 16px;
  --espace-6: 24px;
  --espace-8: 32px;
  --rayon-s: 6px;
  --rayon-m: 10px;
  --rayon-l: 16px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fond: #0F141D;
    --surface: #171E2B;
    --survol: #212A3A;
    --filet: #2C3749;
    --contour: #66748C;
    --encre: #E9EEF6;
    --encre-douce: #9DA9BD;
    --ambre: #F5BD45;
    --bleu: #8DB2F2;
    --bleu-fond: #1E2E4D;
    --alerte: #FF8A7E;
    --sur-alerte: #2A0B08;
    --alerte-fond: #3A1D1B;
    --marine: #1F2B47;
    --marine-doux: #B3BED0;
    --ombre-flottante: 0 10px 32px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--fond);
  color: var(--encre);
  font: 400 15px/22px var(--font-texte);
  -webkit-font-smoothing: antialiased;
}

h1, h2 { font-family: var(--font-display); text-wrap: balance; margin: 0; }
h2 { font-size: 19px; line-height: 24px; font-weight: 700; }
p { margin: 0; }
a { color: var(--bleu); text-decoration: none; }
a:hover { text-decoration: underline; }

.sprite { position: absolute; width: 0; height: 0; }
.icon { width: 20px; height: 20px; fill: currentColor; flex: none; }
.muted { color: var(--encre-douce); }
.small { font-size: 13px; line-height: 18px; }
.erreur, .error { color: var(--alerte); font-size: 14px; }

:focus-visible { outline: 2px solid var(--bleu); outline-offset: 2px; }

/* ----------------------------------------------------------------- logo */

.logo { display: inline-flex; align-items: center; gap: 10px; color: var(--encre); text-decoration: none; }
.logo:hover { text-decoration: none; }
.logo-symbole { width: 36px; height: 36px; flex: none; }
/* Logotype « Ahmed & Denis » : rapport 9,1 pour 1. */
.logo-mot { width: 160px; height: 18px; flex: none; }
.logo-negatif { color: var(--marine-texte); }

/* -------------------------------------------------------------- boutons */

.btn {
  font: 600 15px/22px var(--font-texte);
  padding: var(--espace-2) 14px;
  border: 1px solid var(--contour);
  border-radius: var(--rayon-m);
  background: var(--surface);
  color: var(--encre);
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: var(--survol); }
.btn.principal { background: var(--ambre); border-color: var(--ambre); color: var(--sur-ambre); }
.btn.principal:hover { filter: brightness(1.05); }
.btn.alerte { background: var(--alerte); border-color: var(--alerte); color: var(--sur-alerte); }
.btn.lien { border-color: transparent; background: none; padding: var(--espace-1) 6px; color: var(--bleu); font-weight: 600; }
.btn.lien:hover { text-decoration: underline; background: none; }
.btn:disabled { opacity: .55; cursor: default; }

label { display: grid; gap: 6px; font-size: 14px; font-weight: 600; color: var(--encre); }
input[type=text], input[type=password], select {
  font: 400 15px/22px var(--font-texte);
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--contour);
  border-radius: var(--rayon-m);
  background: var(--surface);
  color: var(--encre);
}
label.check { display: flex; align-items: center; gap: var(--espace-2); font-weight: 400; }

/* --------------------------------------------------------------- accueil */

.accueil { min-height: 100%; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }

.marque {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: var(--espace-6);
  padding: var(--espace-8) 48px;
  background: var(--marine);
  color: var(--marine-texte);
}
.marque .logo-symbole { width: 44px; height: 44px; }
.marque .logo-mot { width: 200px; height: 22px; }
.marque-texte { display: grid; gap: var(--espace-4); max-width: 26rem; }
.marque h1 { font-size: clamp(34px, 4.2vw, 52px); line-height: 1; font-weight: 800; letter-spacing: -.02em; }
.marque-texte p { color: var(--marine-doux); font-size: 16px; line-height: 24px; max-width: 34ch; }
.fiche { display: flex; flex-wrap: wrap; gap: var(--espace-6) var(--espace-8); margin: 0; }
.fiche div { display: grid; gap: 2px; }
.fiche dt { font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--marine-doux); }
.fiche dd { margin: 0; font: 700 19px/24px var(--font-display); color: var(--marine-texte); }

/* Esperluette géante entre le logo et le texte, qui déborde à droite :
   le « et » qui relie les deux noms, posé sur un bloc bleu. */
.esperluette { display: block; align-self: flex-end; width: min(280px, 56%, 34vh); height: auto; margin: auto -48px 0 0; }
.e-bloc { fill: var(--bleu); }
.e-et { fill: var(--ambre); stroke: var(--marine); stroke-width: 10px; stroke-linejoin: round; paint-order: stroke; }

.acces { display: grid; place-items: center; padding: var(--espace-8) max(16px, 4vw); }
.carte {
  width: min(400px, 100%);
  display: grid;
  gap: var(--espace-4);
  padding: var(--espace-8);
  background: var(--surface);
  border: 1px solid var(--filet);
  border-radius: var(--rayon-l);
}
.carte h2 { font-size: 28px; line-height: 32px; letter-spacing: -.01em; }
.carte .btn.principal { margin-top: var(--espace-2); padding-block: 10px; }
.carte .btn.lien { justify-self: center; }
.logo-compact { display: none; }
.aide { color: var(--encre-douce); font-size: 14px; line-height: 20px; }
.regle { color: var(--encre-douce); font-size: 13px; line-height: 18px; margin-top: -8px; }
.sur-titre {
  display: inline-flex; align-items: center; gap: 6px; justify-self: start;
  padding: 3px 10px 3px 8px; border-radius: 99px;
  background: var(--bleu-fond); color: var(--bleu);
  font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
}
.sur-titre .icon { width: 14px; height: 14px; }

/* ----------------------------------------------------------- application */

.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100%; }
.sidebar {
  display: flex;
  flex-direction: column;
  gap: var(--espace-6);
  padding: 20px 14px;
  background: var(--surface);
  border-right: 1px solid var(--filet);
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar > .logo { padding: 0 6px; }
.nav { display: grid; gap: 2px; }
.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--rayon-m);
  color: var(--encre);
  font-weight: 500;
}
.nav a .icon { color: var(--encre-douce); }
.nav a:hover { background: var(--survol); text-decoration: none; }
.nav a[aria-current=page] { background: var(--bleu-fond); color: var(--bleu); font-weight: 600; }
.nav a[aria-current=page] .icon { color: var(--bleu); }
.sidebar-foot { margin-top: auto; display: grid; gap: 14px; }
.bar { height: 6px; border-radius: 3px; background: var(--survol); overflow: hidden; margin-bottom: 6px; }
.bar > div { height: 100%; width: 0; background: var(--ambre); }
.account { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; padding-top: 12px; border-top: 1px solid var(--filet); }
.account-name { flex: 1 0 100%; font-weight: 600; padding: 0 6px; }

.main { min-width: 0; padding: 22px 28px 80px; position: relative; }
.head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.crumbs { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; font: 700 19px/24px var(--font-display); min-width: 0; }
.crumbs a { color: var(--encre-douce); font-weight: 600; }
.crumbs .sep { color: var(--contour); font-weight: 400; }
.crumbs span.here { overflow-wrap: anywhere; }
.actions { display: flex; flex-wrap: wrap; gap: var(--espace-2); }

/* Pas d'overflow: hidden ici : les menus « ··· » doivent pouvoir déborder du cadre. */
.content { background: var(--surface); border: 1px solid var(--filet); border-radius: var(--rayon-m); }
.empty { padding: 56px 20px; text-align: center; color: var(--encre-douce); }
.note { padding: 12px 16px; border-bottom: 1px solid var(--filet); color: var(--encre-douce); font-size: 14px; }

table { width: 100%; border-collapse: collapse; }
th, td { padding: var(--espace-3) var(--espace-4); text-align: left; }
th { font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--encre-douce); border-bottom: 1px solid var(--filet); padding-block: var(--espace-2); }
tbody tr + tr td { border-top: 1px solid var(--filet); }
tbody tr:hover td { background: var(--survol); }
/* Coins arrondis de la dernière ligne, sans couper le contenu du cadre. */
tbody tr:last-child td:first-child { border-bottom-left-radius: calc(var(--rayon-m) - 1px); }
tbody tr:last-child td:last-child { border-bottom-right-radius: calc(var(--rayon-m) - 1px); }
td.num, th.num { white-space: nowrap; }
td.num { color: var(--encre-douce); font-size: 13px; line-height: 18px; font-weight: 500; font-variant-numeric: tabular-nums; }
td.tight, th.tight { width: 1%; white-space: nowrap; text-align: right; }

.name { display: flex; align-items: center; gap: 10px; min-width: 0; }
.name a, .name span.label { color: var(--encre); overflow-wrap: anywhere; }
.name .icon { color: var(--encre-douce); }
.name.dir .icon { color: var(--ambre); }
.tag { font-size: 12px; line-height: 16px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--survol); color: var(--encre-douce); }
.tag.warn { background: var(--alerte-fond); color: var(--alerte); }

/* --------------------------------------------------------- menu de ligne */

.menu { position: relative; display: inline-block; }
.menu > summary {
  list-style: none;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: var(--rayon-s);
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--encre-douce);
}
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary:hover, .menu[open] > summary { background: var(--filet); color: var(--encre); }
.menu-list {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 20;
  min-width: 210px;
  padding: 6px;
  display: grid;
  background: var(--surface);
  border: 1px solid var(--filet);
  border-radius: var(--rayon-m);
  box-shadow: var(--ombre-flottante);
}
/* Pas assez de place en dessous : le menu s'ouvre vers le haut. */
.menu.vers-le-haut .menu-list { top: auto; bottom: calc(100% + 4px); }
.menu-list button, .menu-list a {
  font: inherit;
  text-align: left;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--rayon-s);
  background: none;
  color: var(--encre);
  cursor: pointer;
}
.menu-list button:hover, .menu-list a:hover { background: var(--survol); text-decoration: none; }
.menu-list .danger { color: var(--alerte); }

/* ---------------------------------------------------------------- dépôt */

.main.dragging .content { outline: 2px dashed var(--bleu); outline-offset: 4px; }
.drop-hint {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  padding: 10px 18px;
  border-radius: 99px;
  background: var(--ambre);
  color: var(--sur-ambre);
  font-weight: 600;
  box-shadow: var(--ombre-flottante);
  pointer-events: none;
  z-index: 30;
}

.uploads {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: min(360px, calc(100vw - 36px));
  max-height: 50vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--filet);
  border-radius: var(--rayon-l);
  box-shadow: var(--ombre-flottante);
  z-index: 40;
}
.uploads header { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--filet); }
.uploads ul { list-style: none; margin: 0; padding: 6px 14px 12px; overflow: auto; }
.uploads li { padding: 8px 0; font-size: 14px; }
.uploads li .row { display: flex; justify-content: space-between; gap: 10px; }
.uploads li .row span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uploads li .state { font-variant-numeric: tabular-nums; }
.uploads li .bar { margin: 6px 0 0; }
.uploads li.failed .bar > div { background: var(--alerte); }
.uploads li.failed .state { color: var(--alerte); }

/* -------------------------------------------------------------- dialogue */

.dialog {
  width: min(460px, calc(100vw - 32px));
  padding: var(--espace-6);
  border: 1px solid var(--filet);
  border-radius: var(--rayon-l);
  background: var(--surface);
  color: var(--encre);
  box-shadow: var(--ombre-flottante);
}
.dialog::backdrop { background: rgba(10, 14, 24, .55); }
.dialog h2 { margin-bottom: 14px; }
.dialog-body { display: grid; gap: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: var(--espace-2); margin-top: 18px; }
.dialog .erreur { margin-top: 12px; }
.copy-row { display: flex; gap: var(--espace-2); }
.copy-row input { flex: 1; min-width: 0; }

.picker-tabs { display: flex; gap: 6px; }
.picker-tabs .btn[aria-pressed=true] { background: var(--bleu-fond); border-color: var(--bleu); color: var(--bleu); }
.picker-path { font-size: 14px; color: var(--encre-douce); overflow-wrap: anywhere; }
.picker-list {
  display: grid;
  max-height: 240px;
  overflow: auto;
  border: 1px solid var(--filet);
  border-radius: var(--rayon-m);
}
.picker-list button {
  font: inherit;
  display: flex;
  align-items: center;
  gap: var(--espace-2);
  padding: 8px 10px;
  border: 0;
  background: none;
  color: var(--encre);
  text-align: left;
  cursor: pointer;
}
.picker-list button:hover { background: var(--survol); }
.picker-list .icon { color: var(--ambre); }
.picker-list p { padding: 14px; text-align: center; }

.toast {
  position: fixed;
  left: 50%;
  top: 18px;
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border-radius: var(--rayon-m);
  background: var(--encre);
  color: var(--fond);
  font-weight: 500;
  box-shadow: var(--ombre-flottante);
  z-index: 100;
}
.toast.bad { background: var(--alerte); color: var(--sur-alerte); }

/* ------------------------------------------------------ page de partage */

.public { max-width: 860px; margin: 0 auto; padding: 28px 16px 60px; display: grid; gap: 20px; }
.public > .logo { justify-self: start; }
.public .file-card { padding: 40px 20px; display: grid; gap: 14px; justify-items: center; text-align: center; }
.public .file-card .icon { width: 56px; height: 56px; color: var(--encre-douce); }
.public .file-card strong { font: 700 19px/24px var(--font-display); overflow-wrap: anywhere; }
.public .actions { justify-content: center; }

/* ---------------------------------------------------------------- mobile */

@media (max-width: 900px) {
  .accueil { grid-template-columns: minmax(0, 1fr); }
  .marque { display: none; }
  .acces { align-items: start; padding-top: 10vh; }
  .logo-compact { display: inline-flex; margin-bottom: var(--espace-2); }
}

@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .sidebar { min-width: 0; position: static; height: auto; padding: 12px; gap: 10px; border-right: 0; border-bottom: 1px solid var(--filet); }
  .sidebar > .logo .logo-symbole { width: 32px; height: 32px; }
  .nav { display: flex; overflow-x: auto; gap: 4px; }
  .nav a { white-space: nowrap; }
  .sidebar-foot { margin-top: 0; }
  .usage { display: none; }
  .account { border-top: 0; padding-top: 0; }
  .account-name { flex: 0 0 auto; }
  .main { padding: 14px 12px 90px; }
  .hide-sm { display: none; }
  th, td { padding: 10px 8px; }
  .carte { padding: var(--espace-6); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
