/*
 * Classeur — feuille de style.
 * Palette : métal de classeur (fond), papier (documents), chemise cartonnée (dossiers),
 * bleu stylo (actions), rouge tampon (suppression).
 */

@font-face {
  font-family: "Atkinson Hyperlegible";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(../fonts/atkinson-hyperlegible-latin-400-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(../fonts/atkinson-hyperlegible-latin-ext-400-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(../fonts/atkinson-hyperlegible-latin-700-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(../fonts/atkinson-hyperlegible-latin-ext-700-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --steel: #e9edf0;
  --steel-2: #dfe4e9;
  --steel-3: #c7cfd7;
  --steel-4: #9aa5b1;
  --paper: #ffffff;
  --paper-2: #f7f8fa;
  --ink: #1d2533;
  --ink-2: #4c5768;
  --ink-3: #5f6a7a;
  --pen: #2342b0;
  --pen-dark: #182f86;
  --pen-tint: #e4e9fb;
  --pen-ring: rgba(35, 66, 176, 0.35);
  --manila: #ecc568;
  --manila-light: #f7e5b5;
  --manila-mid: #f1d58e;
  --manila-dark: #d9a441;
  --manila-edge: #c9a04c;
  --stamp: #b3261e;
  --stamp-dark: #8f1d17;
  --stamp-tint: #fbe8e6;
  --leaf: #2b7a4b;
  --leaf-tint: #e2f2e7;
  --amber-tint: #fff4d6;

  --font: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --fs-xs: 13px;
  --fs-sm: 14.5px;
  --fs: 17px;
  --fs-lg: 20px;
  --fs-xl: 24px;
  --fs-2xl: 30px;

  --r-paper: 3px;
  --r: 8px;
  --r-lg: 14px;
  --shadow-paper: 0 1px 0 rgba(29, 37, 51, 0.04), 0 1px 3px rgba(29, 37, 51, 0.12);
  --shadow-raise: 0 6px 18px rgba(29, 37, 51, 0.14), 0 1px 3px rgba(29, 37, 51, 0.1);
  --shadow-float: 0 18px 50px rgba(29, 37, 51, 0.24), 0 3px 10px rgba(29, 37, 51, 0.12);

  --topbar-h: 64px;
  --sidebar-w: 272px;
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs);
  line-height: 1.5;
  color: var(--ink);
  background: var(--steel);
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

img,
svg {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--pen);
}

h1,
h2,
h3 {
  line-height: 1.2;
  margin: 0;
}

p {
  margin: 0 0 0.75em;
}

:focus-visible {
  outline: 3px solid var(--pen-ring);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.muted {
  color: var(--ink-2);
}

.i {
  width: 20px;
  height: 20px;
  flex: none;
}

.i-sm {
  width: 16px;
  height: 16px;
}

.i-lg {
  width: 28px;
  height: 28px;
}

/* ------------------------------------------------------------------ */
/* Boutons                                                             */
/* ------------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 9px 16px;
  border: 1px solid var(--steel-3);
  border-radius: var(--r);
  background: var(--paper);
  color: var(--ink);
  font-weight: 700;
  font-size: var(--fs-sm);
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.12s, border-color 0.12s, box-shadow 0.12s;
}

.btn:hover {
  background: var(--paper-2);
  border-color: var(--steel-4);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--pen);
  border-color: var(--pen);
  color: #fff;
}

.btn-primary:hover {
  background: var(--pen-dark);
  border-color: var(--pen-dark);
}

.btn-danger {
  background: var(--stamp);
  border-color: var(--stamp);
  color: #fff;
}

.btn-danger:hover {
  background: var(--stamp-dark);
  border-color: var(--stamp-dark);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
}

.btn-ghost:hover {
  background: rgba(29, 37, 51, 0.06);
  border-color: transparent;
}

.btn-quiet-danger {
  color: var(--stamp);
}

.btn-lg {
  min-height: 52px;
  padding: 12px 22px;
  font-size: var(--fs);
}

.btn-block {
  width: 100%;
}

.btn-split {
  display: inline-flex;
}

.btn-split > .btn:first-child {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.btn-split > .btn:last-child {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-left: 1px solid rgba(255, 255, 255, 0.35);
  padding-left: 10px;
  padding-right: 10px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: var(--r);
  background: transparent;
  color: var(--ink-2);
}

.icon-btn:hover {
  background: rgba(29, 37, 51, 0.07);
  color: var(--ink);
}

.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--pen);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ------------------------------------------------------------------ */
/* Formulaires                                                         */
/* ------------------------------------------------------------------ */

.form {
  display: grid;
  gap: 18px;
}

.field {
  display: grid;
  gap: 6px;
}

.field > label,
.label {
  font-weight: 700;
  font-size: var(--fs-sm);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

input[type="text"],
input[type="password"],
input[type="search"],
input[type="number"],
select,
textarea {
  width: 100%;
  min-height: 48px;
  padding: 10px 13px;
  border: 1.5px solid var(--steel-3);
  border-radius: var(--r);
  background: var(--paper);
  font-size: var(--fs);
  transition: border-color 0.12s, box-shadow 0.12s;
}

textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.45;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--pen);
  box-shadow: 0 0 0 3px var(--pen-ring);
}

.hint {
  margin: 0;
  font-size: var(--fs-sm);
  color: var(--ink-2);
}

.checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: var(--fs-sm);
  line-height: 1.4;
  cursor: pointer;
}

.checkbox input {
  width: 22px;
  height: 22px;
  margin: 0;
  flex: none;
  accent-color: var(--pen);
}

.password {
  position: relative;
}

.password input {
  padding-right: 96px;
}

.password-toggle {
  position: absolute;
  top: 6px;
  right: 6px;
  bottom: 6px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: var(--steel);
  color: var(--ink);
  font-size: var(--fs-xs);
  font-weight: 700;
}

.password-toggle:hover {
  background: var(--steel-2);
}

.caps-warning {
  margin: 0;
  color: #8a5a00;
  font-size: var(--fs-sm);
  font-weight: 700;
}

.notice {
  padding: 12px 14px;
  border-radius: var(--r);
  border: 1px solid;
  font-size: var(--fs-sm);
}

.notice-bad {
  background: var(--stamp-tint);
  border-color: #efc2bd;
  color: #7c1913;
}

.notice-ok {
  background: var(--leaf-tint);
  border-color: #b9dcc5;
  color: #1d5535;
}

.notice-warn {
  background: var(--amber-tint);
  border-color: #ecd59a;
  color: #6b4a00;
}

/* ------------------------------------------------------------------ */
/* Pages de connexion et d'installation : une chemise cartonnée        */
/* ------------------------------------------------------------------ */

.page-auth {
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(circle at 1px 1px, rgba(29, 37, 51, 0.07) 1px, transparent 0) 0 0 / 22px 22px,
    var(--steel);
}

.auth {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 40px 16px;
}

.folder-sheet {
  width: 100%;
  max-width: 460px;
}

.auth-wide .folder-sheet {
  max-width: 640px;
}

.folder-tab {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  max-width: 82%;
  padding: 10px 22px 8px 14px;
  border-radius: 12px 16px 0 0;
  background: var(--manila);
  font-weight: 700;
  font-size: var(--fs-lg);
  color: #3a2c08;
}

.folder-tab span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-tab .brand-mark {
  width: 30px;
  height: 30px;
}

.folder-body {
  padding: 14px 14px 18px;
  border-radius: 0 14px 14px 14px;
  background: var(--manila);
  box-shadow: 0 1px 0 var(--manila-edge), var(--shadow-raise);
}

.paper {
  padding: 30px 30px 26px;
  border-radius: var(--r-paper);
  background: var(--paper);
  box-shadow: 0 1px 2px rgba(58, 44, 8, 0.25);
}

.paper h1 {
  font-size: var(--fs-2xl);
  margin-bottom: 6px;
}

.paper .lead {
  color: var(--ink-2);
  margin-bottom: 22px;
}

.paper .notice {
  margin-bottom: 18px;
}

.h-small {
  font-size: var(--fs);
  margin: 0 0 10px;
}

.checks {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
  display: grid;
  gap: 8px;
}

.check-item {
  display: flex;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r);
  background: var(--paper-2);
  border: 1px solid var(--steel-2);
}

.check-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 50%;
  font-weight: 700;
  color: #fff;
}

.is-ok .check-icon {
  background: var(--leaf);
}

.is-bad .check-icon {
  background: var(--stamp);
}

.is-warn .check-icon {
  background: #b07800;
}

.check-text {
  display: grid;
  gap: 2px;
  font-size: var(--fs-sm);
}

.check-help {
  margin-top: 4px;
  color: var(--ink);
}

.forgot {
  margin-top: 20px;
  font-size: var(--fs-sm);
  color: var(--ink-2);
}

.forgot summary {
  cursor: pointer;
  color: var(--pen);
  font-weight: 700;
}

.forgot p {
  margin: 8px 0 0;
}

.auth-foot {
  margin-top: 18px;
  font-size: var(--fs-xs);
  color: var(--ink-3);
}

.who {
  margin-bottom: 22px;
}

.who-title {
  font-weight: 700;
  margin-bottom: 10px;
}

.who-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 10px;
}

.who-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 14px 8px 12px;
  border: 1.5px solid var(--steel-2);
  border-radius: var(--r);
  background: var(--paper);
  font-size: var(--fs-sm);
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
}

.who-tile:hover {
  border-color: var(--steel-4);
}

.who-tile.is-selected {
  border-color: var(--pen);
  background: var(--pen-tint);
}

.who-name {
  overflow-wrap: anywhere;
}

/* ------------------------------------------------------------------ */
/* Avatars                                                             */
/* ------------------------------------------------------------------ */

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  background: var(--pen);
  letter-spacing: 0.02em;
}

.avatar-lg {
  width: 52px;
  height: 52px;
  font-size: 19px;
}

.avatar.c0 { background: #2342b0; }
.avatar.c1 { background: #2b7a4b; }
.avatar.c2 { background: #8a4fa3; }
.avatar.c3 { background: #b3511e; }
.avatar.c4 { background: #1f7a8c; }
.avatar.c5 { background: #a3324f; }
.avatar.c6 { background: #5a6a1f; }
.avatar.c7 { background: #4d5566; }

/* ------------------------------------------------------------------ */
/* Structure de l'application                                          */
/* ------------------------------------------------------------------ */

.page-app {
  overflow: hidden;
}

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  grid-template-rows: var(--topbar-h) minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
}

.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 16px 0 18px;
  background: var(--paper);
  border-bottom: 1px solid var(--steel-3);
  z-index: 20;
}

.menu-btn {
  display: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: calc(var(--sidebar-w) - 34px);
  max-width: 400px;
  flex: 0 1 auto;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  font-size: var(--fs-lg);
}

.brand-mark {
  width: 32px;
  height: 32px;
  flex: none;
}

.brand-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search {
  position: relative;
  flex: 1 1 auto;
  max-width: 620px;
}

.search input {
  min-height: 46px;
  padding-left: 46px;
  padding-right: 44px;
  border-color: var(--steel-2);
  background: var(--steel);
  border-radius: 23px;
}

.search input:focus {
  background: var(--paper);
}

.search input::-webkit-search-cancel-button {
  display: none;
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 13px;
  color: var(--ink-2);
  pointer-events: none;
}

.search-clear {
  position: absolute;
  right: 4px;
  top: 3px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.search-clear:hover {
  background: var(--steel-2);
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.user-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 5px 10px 5px 6px;
  border: 1px solid transparent;
  border-radius: 23px;
  background: transparent;
  font-weight: 700;
  font-size: var(--fs-sm);
}

.user-btn:hover,
.user-btn[aria-expanded="true"] {
  background: var(--steel);
}

.user-name {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Menus déroulants */

.menu-pop {
  position: fixed;
  z-index: 80;
  min-width: 230px;
  max-width: calc(100vw - 24px);
  padding: 6px;
  border: 1px solid var(--steel-3);
  border-radius: var(--r);
  background: var(--paper);
  box-shadow: var(--shadow-float);
}

.menu-head {
  padding: 8px 12px 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--steel-2);
  font-size: var(--fs-sm);
}

.menu-head strong {
  display: block;
  font-size: var(--fs);
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  text-align: left;
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
}

.menu-item:hover,
.menu-item:focus-visible {
  background: var(--steel);
  outline: none;
}

.menu-item .i {
  color: var(--ink-2);
}

.menu-item.is-danger,
.menu-item.is-danger .i {
  color: var(--stamp);
}

.menu-sep {
  height: 1px;
  margin: 6px 4px;
  background: var(--steel-2);
}

/* ------------------------------------------------------------------ */
/* Barre latérale : les tiroirs du classeur                            */
/* ------------------------------------------------------------------ */

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px 10px 10px;
  background: var(--paper-2);
  border-right: 1px solid var(--steel-3);
}

.nav {
  display: grid;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 6px 10px;
  border-radius: var(--r);
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  font-size: var(--fs-sm);
}

.nav-item .i {
  color: var(--ink-2);
}

.nav-item:hover {
  background: var(--steel-2);
}

.nav-item.is-active {
  background: var(--pen-tint);
  color: var(--pen-dark);
}

.nav-item.is-active .i {
  color: var(--pen);
}

.nav-count {
  margin-left: auto;
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--ink-2);
}

.nav-title {
  margin: 18px 10px 6px;
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--ink-2);
}

.tree {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tree .tree {
  padding-left: 18px;
}

.tree-row {
  display: flex;
  align-items: center;
  border-radius: var(--r);
}

.tree-row:hover {
  background: var(--steel-2);
}

.tree-row.is-active {
  background: var(--pen-tint);
}

.tree-row.is-drop {
  background: var(--manila-mid);
  box-shadow: inset 0 0 0 2px var(--manila-dark);
}

.tree-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 36px;
  flex: none;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink-2);
  border-radius: 6px;
}

.tree-toggle .i {
  width: 16px;
  height: 16px;
  transition: transform 0.15s;
}

.tree-toggle[aria-expanded="true"] .i {
  transform: rotate(90deg);
}

.tree-toggle.is-empty {
  visibility: hidden;
}

.tree-link {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  min-height: 36px;
  padding: 4px 8px 4px 2px;
  color: var(--ink);
  text-decoration: none;
  font-size: var(--fs-sm);
}

.tree-row.is-active .tree-link {
  font-weight: 700;
  color: var(--pen-dark);
}

.tree-link .folder-glyph {
  width: 18px;
  height: 18px;
  flex: none;
}

.tree-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-foot {
  margin-top: auto;
  padding: 18px 10px 6px;
  font-size: var(--fs-xs);
  color: var(--ink-2);
  line-height: 1.45;
}

.storage-bar {
  height: 6px;
  margin-top: 6px;
  border-radius: 3px;
  background: var(--steel-2);
  overflow: hidden;
}

/* Petite chemise utilisée comme pictogramme de dossier. */
.folder-glyph .fg-back { fill: var(--manila-dark); }
.folder-glyph .fg-front { fill: var(--manila); }

/* ------------------------------------------------------------------ */
/* Zone principale                                                     */
/* ------------------------------------------------------------------ */

.main {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 26px 32px 120px;
  outline: none;
}

.view-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px 20px;
  margin-bottom: 22px;
}

.view-title {
  flex: 1 1 320px;
  min-width: 0;
}

.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 4px;
  margin: 0 0 4px;
  padding: 0;
  list-style: none;
  font-size: var(--fs-sm);
  color: var(--ink-2);
}

.crumbs a {
  color: var(--ink-2);
  font-weight: 700;
  text-decoration: none;
  padding: 2px 4px;
  border-radius: 4px;
}

.crumbs a:hover {
  color: var(--pen);
  background: rgba(35, 66, 176, 0.08);
}

.crumbs .i {
  width: 14px;
  height: 14px;
  color: var(--steel-4);
}

.crumbs a.is-drop {
  background: var(--manila-mid);
  color: var(--ink);
}

.view-title h1 {
  font-size: var(--fs-2xl);
  overflow-wrap: anywhere;
}

.view-sub {
  margin: 6px 0 0;
  color: var(--ink-2);
  font-size: var(--fs-sm);
}

.view-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0 0 18px;
}

.toolbar-spacer {
  flex: 1;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: var(--r);
  background: var(--steel-2);
}

.segmented button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-2);
  font-size: var(--fs-sm);
  font-weight: 700;
}

.segmented button[aria-pressed="true"] {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(29, 37, 51, 0.15);
}

.sort-select {
  width: auto;
  min-height: 44px;
  padding: 8px 36px 8px 12px;
  font-size: var(--fs-sm);
  font-weight: 700;
  border-color: var(--steel-3);
}

.section-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 28px 0 12px;
  font-size: var(--fs-lg);
}

.section-title:first-child {
  margin-top: 0;
}

.section-title .count {
  font-size: var(--fs-sm);
  color: var(--ink-2);
  font-weight: 400;
}

.drop-hint {
  margin: 26px 0 0;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-2);
  font-size: var(--fs-sm);
}

/* ------------------------------------------------------------------ */
/* Dossiers : des chemises cartonnées                                  */
/* ------------------------------------------------------------------ */

.folders {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(208px, 1fr));
  gap: 22px 16px;
  padding-top: 10px;
}

.folder-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 2px;
  min-height: 92px;
  padding: 16px 16px 14px;
  border: 0;
  border-radius: 3px 10px 10px 10px;
  background: var(--manila-light);
  box-shadow: inset 0 0 0 1px var(--manila-edge), 0 1px 2px rgba(58, 44, 8, 0.12);
  color: #2c2206;
  text-align: left;
  text-decoration: none;
}

.folder-tile::before {
  content: "";
  position: absolute;
  left: 0;
  top: -11px;
  width: 44%;
  height: 12px;
  border-radius: 7px 12px 0 0;
  background: var(--manila-light);
  box-shadow: inset 1px 1px 0 var(--manila-edge), inset -1px 0 0 var(--manila-edge);
}

.folder-tile::after {
  /* la feuille qui dépasse */
  content: "";
  position: absolute;
  left: 12px;
  right: 18px;
  top: -5px;
  height: 8px;
  border-radius: 2px 2px 0 0;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(58, 44, 8, 0.12);
  opacity: 0;
}

.folder-tile.has-docs::after {
  opacity: 1;
}

.folder-tile:hover {
  background: var(--manila-mid);
}

.folder-tile:hover::before {
  background: var(--manila-mid);
}

.folder-tile:focus-visible {
  outline-offset: 4px;
}

.folder-tile.is-drop,
.folder-tile.is-drop::before {
  background: var(--manila);
}

.folder-tile.is-drop {
  box-shadow: inset 0 0 0 2px var(--manila-edge), 0 0 0 4px rgba(217, 164, 65, 0.45);
}

.folder-name {
  font-weight: 700;
  font-size: var(--fs);
  line-height: 1.25;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.folder-meta {
  font-size: var(--fs-xs);
  color: #5b4a1c;
}

.folder-path {
  font-size: var(--fs-xs);
  color: #5b4a1c;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ------------------------------------------------------------------ */
/* Documents : des feuilles de papier                                  */
/* ------------------------------------------------------------------ */

.docs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 22px 18px;
}

.doc-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-radius: var(--r-paper);
  background: var(--paper);
  box-shadow: var(--shadow-paper);
  cursor: pointer;
  transition: box-shadow 0.12s, transform 0.12s;
}

.doc-card:hover {
  box-shadow: var(--shadow-raise);
}

.doc-card.is-selected {
  box-shadow: 0 0 0 3px var(--pen), var(--shadow-raise);
}

.doc-card.is-dragging {
  opacity: 0.45;
}

.doc-open {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  border: 0;
  border-radius: var(--r-paper);
  background: transparent;
}

.doc-thumb {
  position: relative;
  aspect-ratio: 8.5 / 11;
  overflow: hidden;
  border-radius: var(--r-paper) var(--r-paper) 0 0;
  background: var(--paper);
  border-bottom: 1px solid var(--steel-2);
}

.doc-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.doc-thumb.is-landscape img {
  object-fit: contain;
  object-position: center;
  background: var(--paper-2);
}

.doc-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background:
    repeating-linear-gradient(to bottom, transparent 0 21px, rgba(29, 37, 51, 0.05) 21px 22px) 0 40px / 100% calc(100% - 70px) no-repeat,
    var(--paper);
}

.doc-placeholder .i {
  width: 46px;
  height: 46px;
  stroke-width: 1.5;
}

.kind-pdf .doc-placeholder .i { color: var(--stamp); }
.kind-image .doc-placeholder .i { color: #1f7a8c; }
.kind-word .doc-placeholder .i { color: var(--pen); }
.kind-sheet .doc-placeholder .i { color: var(--leaf); }
.kind-slides .doc-placeholder .i { color: #b3511e; }
.kind-email .doc-placeholder .i { color: #8a4fa3; }
.kind-text .doc-placeholder .i,
.kind-archive .doc-placeholder .i,
.kind-other .doc-placeholder .i { color: var(--ink-3); }

.doc-badge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(29, 37, 51, 0.78);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.kind-pdf .doc-badge { background: var(--stamp); }
.kind-image .doc-badge { background: #1f6f80; }
.kind-word .doc-badge { background: var(--pen); }
.kind-sheet .doc-badge { background: var(--leaf); }

.doc-new {
  position: absolute;
  left: 8px;
  bottom: 8px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--manila);
  color: #3a2c08;
  font-size: 11.5px;
  font-weight: 700;
}

.doc-info {
  display: grid;
  gap: 2px;
  padding: 10px 12px 12px;
}

.doc-name {
  font-weight: 700;
  font-size: 15px;
  line-height: 1.3;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.doc-meta {
  font-size: var(--fs-xs);
  color: var(--ink-2);
}

.doc-where {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: var(--fs-xs);
  color: var(--ink-2);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.doc-where .folder-glyph {
  width: 14px;
  height: 14px;
  flex: none;
}

.doc-where span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.doc-match {
  font-size: var(--fs-xs);
  color: var(--leaf);
  font-weight: 700;
}

/* Case à cocher de sélection */

.doc-check {
  position: absolute;
  z-index: 2;
  top: 8px;
  left: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 2px solid var(--steel-4);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.95);
  color: #fff;
  opacity: 0;
  transition: opacity 0.12s;
}

.doc-check .i {
  width: 18px;
  height: 18px;
  stroke-width: 3;
  opacity: 0;
}

.doc-card:hover .doc-check,
.doc-check:focus-visible,
.is-selecting .doc-check {
  opacity: 1;
}

.doc-card.is-selected .doc-check {
  opacity: 1;
  border-color: var(--pen);
  background: var(--pen);
}

.doc-card.is-selected .doc-check .i {
  opacity: 1;
}

@media (hover: none) {
  .doc-check {
    opacity: 0;
  }

  .is-selecting .doc-check {
    opacity: 1;
  }
}

/* Vue en liste */

.docs-list {
  border-radius: var(--r);
  background: var(--paper);
  box-shadow: var(--shadow-paper);
  overflow: hidden;
}

.docs-list .doc-card {
  flex-direction: row;
  align-items: center;
  gap: 14px;
  min-height: 64px;
  padding: 8px 14px 8px 52px;
  border-radius: 0;
  box-shadow: none;
  border-bottom: 1px solid var(--steel-2);
}

.docs-list .doc-card:last-child {
  border-bottom: 0;
}

.docs-list .doc-card:hover {
  background: var(--paper-2);
  box-shadow: none;
}

.docs-list .doc-card.is-selected {
  background: var(--pen-tint);
  box-shadow: none;
}

.docs-list .doc-check {
  top: 50%;
  left: 12px;
  margin-top: -15px;
  opacity: 1;
}

.docs-list .doc-thumb {
  width: 40px;
  height: 50px;
  aspect-ratio: auto;
  flex: none;
  border: 1px solid var(--steel-2);
  border-radius: 2px;
}

.docs-list .doc-placeholder .i {
  width: 22px;
  height: 22px;
}

.docs-list .doc-placeholder {
  background: var(--paper);
}

.docs-list .doc-badge,
.docs-list .doc-new {
  display: none;
}

.docs-list .doc-info {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  flex: 1;
  min-width: 0;
  padding: 0;
  column-gap: 18px;
  row-gap: 2px;
}

.docs-list .doc-name {
  flex: 1 1 240px;
  min-width: 0;
}

.docs-list .doc-where,
.docs-list .doc-match {
  order: 3;
  flex-basis: 100%;
}

.docs-list .doc-name {
  -webkit-line-clamp: 1;
  font-size: var(--fs);
}

.docs-list .doc-meta {
  margin-left: auto;
  white-space: nowrap;
}

/* ------------------------------------------------------------------ */
/* États vides                                                         */
/* ------------------------------------------------------------------ */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 560px;
  margin: 10px auto 0;
  padding: 44px 28px;
  text-align: center;
  border-radius: var(--r-lg);
  color: var(--ink-2);
}

.empty h2 {
  color: var(--ink);
  font-size: var(--fs-xl);
}

.empty p {
  margin: 0;
}

.empty-drop {
  border: 2.5px dashed var(--steel-4);
  background: rgba(255, 255, 255, 0.55);
}

.empty-icon {
  width: 56px;
  height: 56px;
  color: var(--steel-4);
  stroke-width: 1.5;
}

.empty .btn {
  margin-top: 8px;
}

.empty-tips {
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
  font-size: var(--fs-sm);
}

/* ------------------------------------------------------------------ */
/* Glisser-déposer : toute la page devient une chemise ouverte         */
/* ------------------------------------------------------------------ */

.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 24px;
  pointer-events: none;
  background: rgba(236, 197, 104, 0.18);
  box-shadow: inset 0 0 0 6px var(--manila-dark);
  animation: drop-in 0.16s ease-out;
}

.drop-card {
  display: grid;
  justify-items: center;
  gap: 4px;
  width: min(560px, 100%);
  padding: 22px 28px 24px;
  border-radius: 6px 18px 18px 18px;
  background: var(--manila);
  box-shadow: var(--shadow-float);
  color: #2c2206;
  text-align: center;
}

.drop-icon {
  width: 40px;
  height: 40px;
  stroke-width: 2.2;
}

.drop-title {
  margin: 4px 0 0;
  font-size: var(--fs-xl);
  font-weight: 700;
}

.drop-target {
  margin: 0;
  font-size: var(--fs);
}

@keyframes drop-in {
  from {
    opacity: 0;
  }
}

/* ------------------------------------------------------------------ */
/* Panneau d'envoi                                                     */
/* ------------------------------------------------------------------ */

.upload-panel {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  display: flex;
  flex-direction: column;
  width: 420px;
  max-width: calc(100vw - 32px);
  max-height: min(70vh, 640px);
  border-radius: var(--r-lg);
  background: var(--paper);
  box-shadow: var(--shadow-float);
  overflow: hidden;
}

.up-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 10px 12px 18px;
  border-bottom: 1px solid var(--steel-2);
}

.up-title {
  flex: 1;
  min-width: 0;
}

.up-title strong {
  display: block;
  font-size: var(--fs);
}

.up-title span {
  font-size: var(--fs-xs);
  color: var(--ink-2);
}

.up-progress {
  height: 6px;
  background: var(--steel-2);
}

.up-progress > div {
  height: 100%;
  width: 0;
  background: var(--pen);
  transition: width 0.25s;
}

.upload-panel.is-done .up-progress > div {
  background: var(--leaf);
}

.upload-panel.has-errors .up-progress > div {
  background: #b07800;
}

.up-list {
  margin: 0;
  padding: 6px 0;
  list-style: none;
  overflow-y: auto;
}

.upload-panel.is-collapsed .up-list,
.upload-panel.is-collapsed .up-foot {
  display: none;
}

.up-item {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 2px 10px;
  padding: 8px 16px;
}

.up-item + .up-item {
  border-top: 1px solid var(--paper-2);
}

.up-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  color: var(--ink-3);
}

.up-item.is-done .up-status {
  background: var(--leaf-tint);
  color: var(--leaf);
}

.up-item.is-error .up-status {
  background: var(--stamp-tint);
  color: var(--stamp);
}

.up-item.is-active .up-status .i {
  animation: spin 1s linear infinite;
  color: var(--pen);
}

.up-name {
  font-size: var(--fs-sm);
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.up-detail {
  grid-column: 2 / -1;
  font-size: var(--fs-xs);
  color: var(--ink-2);
}

.up-item.is-error .up-detail {
  color: var(--stamp-dark);
}

.up-bar {
  grid-column: 2 / -1;
  height: 4px;
  border-radius: 2px;
  background: var(--steel-2);
  overflow: hidden;
}

.up-bar > div {
  height: 100%;
  width: 0;
  background: var(--pen);
}

.up-retry {
  font-size: var(--fs-xs);
}

.up-foot {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 10px 14px;
  border-top: 1px solid var(--steel-2);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ------------------------------------------------------------------ */
/* Barre de sélection                                                  */
/* ------------------------------------------------------------------ */

.selection-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 22px;
  z-index: 45;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  width: max-content;
  max-width: calc(100vw - 24px);
  margin: 0 auto;
  padding: 8px 8px 8px 18px;
  border-radius: 14px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow-float);
}

.selection-bar .sel-count {
  margin-right: 10px;
  font-weight: 700;
  font-size: var(--fs-sm);
  white-space: nowrap;
}

.selection-bar .btn {
  min-height: 40px;
  border-color: transparent;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.selection-bar .btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.selection-bar .btn-danger-soft:hover {
  background: var(--stamp);
}

.selection-bar .icon-btn {
  color: #fff;
}

.selection-bar .icon-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* ------------------------------------------------------------------ */
/* Notifications                                                       */
/* ------------------------------------------------------------------ */

.toasts {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 90;
  display: grid;
  gap: 10px;
  width: max-content;
  max-width: calc(100vw - 24px);
  transform: translateX(-50%);
  pointer-events: none;
}

.has-selection .toasts {
  bottom: 96px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 50px;
  padding: 10px 10px 10px 18px;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow-float);
  font-size: var(--fs-sm);
  pointer-events: auto;
  animation: toast-in 0.18s ease-out;
}

.toast .i {
  color: #9fd8b3;
}

.toast.is-error {
  background: var(--stamp-dark);
}

.toast.is-error .i {
  color: #fff;
}

.toast-msg {
  max-width: 520px;
}

.toast .btn {
  min-height: 36px;
  padding: 6px 12px;
  border: 0;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.toast .btn:hover {
  background: rgba(255, 255, 255, 0.28);
}

.toast-close {
  width: 36px;
  height: 36px;
  color: rgba(255, 255, 255, 0.8);
}

.toast-close:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* ------------------------------------------------------------------ */
/* Fenêtres (dialogues)                                                */
/* ------------------------------------------------------------------ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(29, 37, 51, 0.5);
  animation: fade-in 0.14s ease-out;
}

.modal {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 500px;
  max-height: calc(100dvh - 32px);
  border-radius: var(--r-lg);
  background: var(--paper);
  box-shadow: var(--shadow-float);
}

.modal-wide {
  max-width: 640px;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 22px 22px 6px 24px;
}

.modal-head h2 {
  flex: 1;
  font-size: var(--fs-xl);
  padding-top: 4px;
}

.modal-head .icon-btn {
  margin: -6px -8px 0 0;
}

.modal-body {
  padding: 10px 24px 8px;
  overflow-y: auto;
}

.modal-body > p {
  color: var(--ink-2);
}

.modal-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px 22px;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

/* Choix d'un dossier (déplacer) */

.picker {
  max-height: min(52vh, 420px);
  overflow-y: auto;
  padding: 6px;
  border: 1.5px solid var(--steel-3);
  border-radius: var(--r);
}

.picker .tree-row {
  cursor: pointer;
}

.picker .tree-row.is-chosen {
  background: var(--pen-tint);
  box-shadow: inset 0 0 0 2px var(--pen);
}

.picker .tree-row.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.picker .tree-link {
  cursor: inherit;
}

.picker-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  gap: 10px;
  flex-wrap: wrap;
}

.picker-dest {
  font-size: var(--fs-sm);
  color: var(--ink-2);
}

/* Choix du rôle */

.roles {
  display: grid;
  gap: 8px;
}

.role-option {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1.5px solid var(--steel-3);
  border-radius: var(--r);
  cursor: pointer;
}

.role-option:has(input:checked) {
  border-color: var(--pen);
  background: var(--pen-tint);
}

.role-option input {
  width: 20px;
  height: 20px;
  margin: 3px 0 0;
  accent-color: var(--pen);
  flex: none;
}

.role-option strong {
  display: block;
}

.role-option span span {
  font-size: var(--fs-sm);
  color: var(--ink-2);
}

/* ------------------------------------------------------------------ */
/* Visionneuse                                                         */
/* ------------------------------------------------------------------ */

.viewer {
  position: fixed;
  inset: 0;
  z-index: 65;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  grid-template-rows: 64px minmax(0, 1fr);
  background: #262d3a;
  color: #fff;
  animation: fade-in 0.14s ease-out;
}

.vw-bar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  background: #1a202b;
}

.vw-bar .btn {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.vw-bar .btn:hover {
  background: rgba(255, 255, 255, 0.18);
}

.vw-title {
  flex: 1;
  min-width: 0;
  font-size: var(--fs-lg);
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vw-pos {
  font-size: var(--fs-sm);
  color: rgba(255, 255, 255, 0.7);
  white-space: nowrap;
}

.vw-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.vw-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #525659;
}

.vw-image {
  max-width: calc(100% - 32px);
  max-height: calc(100% - 32px);
  object-fit: contain;
  background: #fff;
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.45);
  cursor: zoom-in;
}

.vw-image-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
}

.vw-image-wrap.is-zoomed {
  display: block;
  padding: 16px;
}

.vw-image-wrap.is-zoomed .vw-image {
  max-width: none;
  max-height: none;
  cursor: zoom-out;
  margin: 0 auto;
}

.vw-pages {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  padding: 16px;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 14px;
  background: #525659;
}

.vw-pages canvas {
  max-width: 100%;
  height: auto;
  background: #fff;
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.4);
}

.vw-page-slot {
  width: 100%;
  max-width: 900px;
  background: #fff;
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.4);
}

.vw-none {
  display: grid;
  justify-items: center;
  gap: 14px;
  max-width: 420px;
  padding: 24px;
  text-align: center;
  color: rgba(255, 255, 255, 0.85);
}

.vw-none img {
  max-height: 46vh;
  background: #fff;
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.45);
}

.vw-none .i {
  width: 64px;
  height: 64px;
  stroke-width: 1.4;
}

.vw-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 52px;
  height: 52px;
  margin-top: -26px;
  border: 0;
  border-radius: 50%;
  background: rgba(26, 32, 43, 0.75);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.vw-nav:hover {
  background: rgba(26, 32, 43, 0.95);
}

.vw-nav .i {
  width: 26px;
  height: 26px;
}

.vw-prev {
  left: 14px;
}

.vw-next {
  right: 14px;
}

.vw-side {
  min-height: 0;
  overflow-y: auto;
  padding: 22px 22px 28px;
  background: var(--paper);
  color: var(--ink);
}

.vw-side h2 {
  font-size: var(--fs-xl);
  overflow-wrap: anywhere;
  margin-bottom: 4px;
}

.vw-facts {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px 14px;
  margin: 18px 0 20px;
  font-size: var(--fs-sm);
}

.vw-facts dt {
  color: var(--ink-2);
}

.vw-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.vw-actions {
  display: grid;
  gap: 8px;
  margin-bottom: 22px;
}

.vw-actions .btn {
  justify-content: flex-start;
}

.vw-notes label {
  display: block;
  font-weight: 700;
  font-size: var(--fs-sm);
  margin-bottom: 6px;
}

.vw-notes .hint {
  margin-top: 6px;
  min-height: 1.4em;
}

.vw-loading {
  color: rgba(255, 255, 255, 0.75);
  display: flex;
  align-items: center;
  gap: 10px;
}

.vw-loading .i {
  animation: spin 1s linear infinite;
}

/* ------------------------------------------------------------------ */
/* Administration                                                      */
/* ------------------------------------------------------------------ */

.tabs {
  display: flex;
  gap: 4px;
  margin: 0 0 22px;
  border-bottom: 1px solid var(--steel-3);
  overflow-x: auto;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 14px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: none;
  color: var(--ink-2);
  font-weight: 700;
  font-size: var(--fs-sm);
  text-decoration: none;
  white-space: nowrap;
}

.tab:hover {
  color: var(--ink);
}

.tab.is-active {
  color: var(--pen-dark);
  border-bottom-color: var(--pen);
}

.panel {
  max-width: 980px;
  padding: 22px 24px;
  border-radius: var(--r);
  background: var(--paper);
  box-shadow: var(--shadow-paper);
}

.panel + .panel {
  margin-top: 18px;
}

.panel h2 {
  font-size: var(--fs-lg);
  margin-bottom: 8px;
}

.panel-narrow {
  max-width: 680px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}

.table th {
  padding: 10px 12px;
  text-align: left;
  font-size: var(--fs-xs);
  color: var(--ink-2);
  border-bottom: 1px solid var(--steel-3);
}

.table td {
  padding: 12px;
  border-bottom: 1px solid var(--steel-2);
  vertical-align: middle;
}

.table tr:last-child td {
  border-bottom: 0;
}

.user-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-cell strong {
  display: block;
}

.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: var(--fs-xs);
  font-weight: 700;
  background: var(--steel-2);
  color: var(--ink);
  white-space: nowrap;
}

.pill-admin {
  background: var(--pen-tint);
  color: var(--pen-dark);
}

.pill-viewer {
  background: var(--amber-tint);
  color: #6b4a00;
}

.pill-off {
  background: var(--stamp-tint);
  color: var(--stamp-dark);
}

.facts {
  display: grid;
  grid-template-columns: minmax(180px, auto) minmax(0, 1fr);
  gap: 10px 20px;
  margin: 12px 0 0;
  font-size: var(--fs-sm);
}

.facts dt {
  color: var(--ink-2);
}

.facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.copy-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.copy-row code {
  padding: 8px 12px;
  border-radius: 6px;
  background: var(--steel);
  font-size: var(--fs-sm);
  overflow-wrap: anywhere;
}

.log-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.log-item {
  display: grid;
  grid-template-columns: 150px 150px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--steel-2);
  font-size: var(--fs-sm);
}

.log-item time {
  color: var(--ink-2);
}

.log-user {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trash-list {
  border-radius: var(--r);
  background: var(--paper);
  box-shadow: var(--shadow-paper);
}

.trash-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--steel-2);
}

.trash-item:last-child {
  border-bottom: 0;
}

.trash-icon {
  width: 40px;
  height: 50px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--steel-2);
  border-radius: 2px;
  overflow: hidden;
  background: var(--paper);
  color: var(--ink-3);
}

.trash-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

.trash-icon.is-folder {
  border: 0;
  background: transparent;
}

.trash-icon .folder-glyph {
  width: 36px;
  height: 36px;
}

.trash-text {
  flex: 1;
  min-width: 0;
}

.trash-text strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trash-text span {
  font-size: var(--fs-xs);
  color: var(--ink-2);
}

.trash-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.help-list {
  display: grid;
  gap: 16px;
}

.help-list h3 {
  font-size: var(--fs);
  margin-bottom: 4px;
}

.help-list p {
  margin: 0;
  color: var(--ink-2);
  font-size: var(--fs-sm);
}

.loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-2);
  padding: 30px 0;
}

.loading .i {
  animation: spin 1s linear infinite;
}

.fab {
  display: none;
}

.more-wrap {
  display: flex;
  justify-content: center;
  margin-top: 22px;
}

/* ------------------------------------------------------------------ */
/* Écrans moyens                                                       */
/* ------------------------------------------------------------------ */

@media (max-width: 1180px) {
  :root {
    --sidebar-w: 240px;
  }

  .main {
    padding: 22px 22px 120px;
  }

  .viewer {
    grid-template-columns: minmax(0, 1fr) 320px;
  }
}

/* ------------------------------------------------------------------ */
/* Téléphones et petites tablettes                                     */
/* ------------------------------------------------------------------ */

@media (max-width: 820px) {
  :root {
    --topbar-h: 116px;
    --fs-2xl: 26px;
  }

  .app {
    grid-template-columns: minmax(0, 1fr);
  }

  .topbar {
    flex-wrap: wrap;
    gap: 6px 8px;
    padding: 8px 10px 10px;
    align-content: center;
  }

  .menu-btn {
    display: inline-flex;
  }

  .brand {
    min-width: 0;
    max-width: none;
    flex: 1;
    font-size: var(--fs);
  }

  .brand-mark {
    width: 28px;
    height: 28px;
  }

  .search {
    order: 3;
    flex: 1 1 100%;
    max-width: none;
  }

  .topbar-right {
    margin-left: 0;
  }

  .user-name,
  .user-btn > .i {
    display: none;
  }

  .user-btn {
    padding: 4px;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 40;
    width: min(320px, 86vw);
    padding-top: 18px;
    box-shadow: var(--shadow-float);
    transform: translateX(-102%);
    transition: transform 0.2s ease-out;
    visibility: hidden;
  }

  .sidebar.is-open {
    transform: none;
    visibility: visible;
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 39;
    background: rgba(29, 37, 51, 0.45);
  }

  .main {
    grid-column: 1;
    padding: 18px 16px 120px;
  }

  .view-head {
    align-items: stretch;
  }

  .view-actions {
    width: 100%;
  }

  .view-actions .btn-split {
    flex: 1;
  }

  .view-actions .btn-split > .btn:first-child {
    flex: 1;
  }

  .hide-mobile {
    display: none !important;
  }

  .folders {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px 12px;
  }

  .folder-tile {
    min-height: 80px;
    padding: 14px 12px 12px;
  }

  .docs-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px 12px;
  }

  .docs-list .doc-card {
    padding-left: 50px;
    padding-right: 10px;
  }

  .docs-list .doc-meta {
    margin-left: 0;
    flex-basis: 100%;
  }

  .fab {
    position: fixed;
    right: 16px;
    bottom: 18px;
    z-index: 30;
    display: inline-flex;
    min-height: 58px;
    padding: 0 22px;
    border-radius: 29px;
    box-shadow: var(--shadow-float);
  }

  .has-selection .fab,
  .viewer:not([hidden]) ~ .fab {
    display: none;
  }

  .upload-panel {
    right: 8px;
    left: 8px;
    bottom: 8px;
    width: auto;
    max-width: none;
  }

  .selection-bar {
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
    max-width: none;
    justify-content: center;
    padding: 8px;
  }

  .selection-bar .sel-count {
    width: 100%;
    text-align: center;
    margin: 0 0 4px;
  }

  .selection-bar .btn-label {
    display: none;
  }

  .viewer {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: 58px minmax(0, 1fr);
    overflow-y: auto;
  }

  .vw-stage {
    height: calc(100dvh - 58px);
    min-height: 360px;
  }

  .vw-side {
    overflow: visible;
  }

  .vw-bar .btn-label {
    display: none;
  }

  .vw-nav {
    width: 44px;
    height: 44px;
    margin-top: -22px;
  }

  .vw-prev {
    left: 6px;
  }

  .vw-next {
    right: 6px;
  }

  .field-row {
    grid-template-columns: 1fr;
  }

  .paper {
    padding: 24px 20px 22px;
  }

  .panel {
    padding: 18px 16px;
  }

  .table-wrap {
    overflow-x: auto;
  }

  .log-item {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .facts {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .facts dd {
    margin-bottom: 10px;
  }

  .trash-item {
    flex-wrap: wrap;
  }

  .trash-actions {
    width: 100%;
    justify-content: flex-start;
    padding-left: 54px;
  }

  .toasts {
    bottom: 90px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ------------------------------------------------------------------ */
/* Compléments                                                         */
/* ------------------------------------------------------------------ */

.spin {
  animation: spin 1s linear infinite;
}

.nav-gap {
  height: 14px;
}

.toolbar .section-title {
  margin: 0;
}

.doc-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0 10px;
}

.docs-grid .hide-grid {
  display: none;
}

.folder-open {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
}

.folder-more,
.doc-more {
  position: absolute;
  z-index: 2;
  width: 36px;
  height: 36px;
  opacity: 0;
  transition: opacity 0.12s;
}

.folder-more {
  top: 4px;
  right: 4px;
  color: #5b4a1c;
}

.folder-more:hover {
  background: rgba(58, 44, 8, 0.1);
  color: #2c2206;
}

.doc-more {
  top: 6px;
  right: 6px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 0 1px var(--steel-3);
}

.doc-more:hover {
  background: #fff;
}

.folder-tile:hover .folder-more,
.folder-more:focus-visible,
.folder-more[aria-expanded="true"],
.doc-card:hover .doc-more,
.doc-more:focus-visible,
.doc-more[aria-expanded="true"] {
  opacity: 1;
}

@media (hover: none) {
  .folder-more {
    opacity: 1;
  }
}

.docs-list .doc-more {
  position: static;
  order: 3;
  opacity: 1;
  background: transparent;
  box-shadow: none;
  flex: none;
}

.docs-list .doc-card {
  position: relative;
}

.docs-list .doc-more,
.docs-list .doc-check {
  z-index: 2;
}

.folder-tile.is-dragging {
  opacity: 0.5;
}

.drag-ghost {
  position: fixed;
  top: -100px;
  left: -100px;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--pen);
  color: #fff;
  font-weight: 700;
  font-size: var(--fs-sm);
}

.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.panel-head h2 {
  margin: 0;
}

.cell-actions {
  text-align: right;
  white-space: nowrap;
}

.user-cell .muted {
  font-size: var(--fs-xs);
}

.stack {
  display: grid;
  gap: 10px;
}

.steps {
  margin: 0;
  padding-left: 22px;
  display: grid;
  gap: 10px;
}

.steps code,
.credentials dd {
  overflow-wrap: anywhere;
}

.steps code {
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--steel);
  font-size: var(--fs-sm);
}

.credentials {
  padding: 14px 16px;
  border-radius: var(--r);
  background: var(--steel);
}

.modal-foot-left {
  margin-right: auto;
}

.field-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 10px;
}

.field-inline .btn {
  min-height: 36px;
  padding: 6px 10px;
}

.input-suffix {
  display: flex;
  align-items: center;
  gap: 8px;
}

.input-suffix span {
  color: var(--ink-2);
  font-weight: 700;
}

.vw-frame.vw-text {
  background: #fff;
}

.vw-page-slot canvas {
  display: block;
  width: 100%;
  height: auto;
}

.vw-folder {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
}

.vw-folder .folder-glyph {
  width: 18px;
  height: 18px;
  flex: none;
}

.vw-notes-text {
  white-space: pre-wrap;
  font-size: var(--fs-sm);
}

.viewer-open .fab,
.viewer-open .selection-bar {
  display: none !important;
}

.selection-bar .btn-danger-soft {
  background: rgba(179, 38, 30, 0.55);
}

.checks-summary {
  margin: 0 0 24px;
  padding: 12px 14px;
  border-radius: var(--r);
  background: var(--leaf-tint);
  border: 1px solid #b9dcc5;
  font-size: var(--fs-sm);
}

.checks-summary summary {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-weight: 700;
  color: #1d5535;
  list-style: none;
}

.checks-summary summary::-webkit-details-marker {
  display: none;
}

.checks-summary .check-icon {
  background: var(--leaf);
}

.checks-summary .link-like {
  margin-left: auto;
  color: var(--pen);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 400;
}

.checks-summary[open] .checks {
  margin: 12px 0 0;
}

.checks-summary[open] .link-like {
  display: none;
}

@media (max-width: 820px) {
  .folder-body {
    padding: 10px 10px 14px;
  }
}

a.doc-open {
  display: block;
}
