/* ==========================================================================
   Polices hébergées localement (SIL Open Font License 1.1).
   Inter et JetBrains Mono sont des fontes variables : un seul fichier couvre
   toutes les graisses de 400 à 700, d'où font-weight en intervalle.
   Les deux sous-ensembles sont déclarés avec leur unicode-range : le navigateur
   ne télécharge latin-ext que si un caractère l'exige.
   Voir web/static/fonts/LICENSE.txt
   ========================================================================== */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/static/fonts/inter-latin-ext.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: "Inter";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/static/fonts/inter-latin.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: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/static/fonts/jetbrains-mono-latin-ext.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: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/static/fonts/jetbrains-mono-latin.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;
}

/* ==========================================================================
   CMFI — Suivi de production vidéo
   Fond quasi-noir, accent lime, valeurs techniques en monospace.
   Registre « outil de précision » : les libellés sont de petites capitales
   espacées, les chiffres sont tabulaires, et le lime ne sert qu'à l'action
   et à l'état actif — jamais en décoration.
   ========================================================================== */

:root {
  /* Fonds */
  --bg: #0a0a0c;
  --surface: #101013;
  --surface-2: #161619;
  --surface-3: #1c1c20;
  --surface-4: #232329;

  /* Traits */
  --border: #26262b;
  --border-strong: #35353c;

  /* Texte */
  --text: #f4f4f5;
  --text-2: #a1a1aa;
  --muted: #8b8b96;
  --faint: #84848f;

  /* Accent */
  --accent: #c3f53c;
  --accent-hover: #d4ff5c;
  --accent-dim: rgba(195, 245, 60, 0.13);
  --accent-border: rgba(195, 245, 60, 0.4);
  --on-accent: #0a0a0c;

  /* États */
  --success: #a3e635;
  --success-dim: rgba(163, 230, 53, 0.12);
  --info: #60a5fa;
  --info-dim: rgba(96, 165, 250, 0.12);
  --warning: #fbbf24;
  --warning-dim: rgba(251, 191, 36, 0.12);
  --danger: #f87171;
  --danger-dim: rgba(248, 113, 113, 0.12);

  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 12px;

  --font-sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas,
    monospace;

  font-family: var(--font-sans);
  font-size: 15px;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
  color: var(--text);
  letter-spacing: -0.01em;
}

/* Petites capitales espacées : la signature des libellés de section. */
.eyebrow,
.stat-label,
.filters h2,
thead th,
.users-table th,
.metadata-terms h4,
.related-videos h4,
.label-history h4,
.metadata-field > span,
.metadata-field-label,
.filters label,
.workflow-card span,
.workflow-label,
.status-badge,
.new-badge,
.completion-badge {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

/* Valeurs techniques : toujours en monospace, chiffres alignés. */
.internal-id code,
.source-id,
.file-name,
.folder-path,
.detail-row div,
tbody td:nth-child(5),
tbody td:nth-child(6),
tbody td:nth-child(7),
tbody td:nth-child(8),
tbody td:nth-child(9) {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

/* ---------- Ossature ---------------------------------------------------- */

.app {
  max-width: 1520px;
  margin: 0 auto;
  padding: 24px 28px 64px;
}

.header {
  display: flex;
  align-items: center;
  gap: 18px 36px;
  flex-wrap: wrap;
  padding-bottom: 18px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--border);
}

/* Le titre absorbe l'espace libre : les stats et le compte gardent leur
   largeur naturelle et ne se retrouvent jamais collés l'un à l'autre. */
.header > div:first-child {
  flex: 1 1 260px;
  min-width: 0;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
}

h1 {
  margin: 0;
  font-size: 23px;
  font-weight: 600;
}

/* ---------- Statistiques d'en-tête -------------------------------------- */

.stats-bar {
  display: flex;
  flex: 0 0 auto;
  gap: 30px;
  flex-wrap: wrap;
}

.stat {
  text-align: right;
}

.stat strong {
  display: block;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

/* ---------- Compte connecté --------------------------------------------- */

.account-menu {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 14px;
  padding-left: 26px;
  border-left: 1px solid var(--border);
}

.account-identity {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.account-identity span {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-2);
  overflow-wrap: anywhere;
}

.account-menu span {
  font-size: 13px;
  font-weight: 500;
}

.account-menu small {
  display: block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}

.account-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ---------- Onglets et pilules ------------------------------------------ */

.view-tabs,
.auth-tabs {
  display: inline-flex;
  gap: 4px;
  margin-bottom: 20px;
}

.view-tab,
.auth-tab {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.view-tab:hover,
.auth-tab:hover {
  color: var(--text);
  background: var(--surface-2);
}

.view-tab.active,
.auth-tab.active {
  color: var(--accent);
  background: var(--accent-dim);
  border-color: var(--accent-border);
}

/* ---------- Vue production ---------------------------------------------- */

.production-overview {
  margin-bottom: 18px;
}

.workflow-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  gap: 8px;
}

.workflow-card {
  display: flex;
  flex-direction: column;
  gap: 5px;
  text-align: left;
  color: var(--text);
  padding: 13px 15px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.workflow-card:hover {
  border-color: var(--border-strong);
  background: var(--surface-3);
}

.workflow-card.active {
  border-color: var(--accent-border);
  background: var(--accent-dim);
}

.workflow-card span,
.workflow-label {
  color: var(--muted);
}

.workflow-card.active span,
.workflow-card.active .workflow-label {
  color: var(--accent);
}

.workflow-card strong {
  font-size: 25px;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.workflow-card small {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--faint);
}

/* ---------- Bandeau de suivi -------------------------------------------- */

.tracking-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(186px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.tracking-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text);
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}

.tracking-card:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.tracking-card span {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.tracking-card strong {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.tracking-card.active {
  border-color: var(--accent-border);
  background: var(--accent-dim);
}

.tracking-card.active span,
.tracking-card.active strong {
  color: var(--accent);
}

.tracking-card-action strong {
  color: var(--accent);
  font-size: 11px;
  letter-spacing: 0.06em;
}

/* ---------- Barre de recherche ------------------------------------------ */

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 11px 12px;
  margin-bottom: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 300px;
  min-width: 220px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 12px;
  transition: border-color 0.12s ease;
}

.search-box:focus-within {
  border-color: var(--accent-border);
}

.search-box svg {
  width: 16px;
  height: 16px;
  flex: none;
  fill: var(--faint);
}

.search-box input {
  flex: 1;
  border: 0;
  background: transparent;
  padding: 9px 10px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
}

.search-box input::placeholder {
  color: var(--faint);
}

.search-box input:focus {
  outline: none;
}

.toolbar-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  align-items: center;
}

/* ---------- Contrôles --------------------------------------------------- */

select,
input[type="number"],
input[type="text"],
input[type="search"],
input[type="email"],
input[type="password"],
textarea {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text);
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  transition: border-color 0.12s ease;
}

select:focus,
input:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent-border);
}

select:disabled,
input:disabled,
textarea:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

textarea {
  resize: vertical;
  line-height: 1.55;
}

::placeholder {
  color: var(--faint);
}

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

button {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--on-accent);
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

button:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-secondary,
.icon-button {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.03em;
  background: var(--surface-3);
  color: var(--text-2);
  border-color: var(--border);
}

.btn-secondary:hover,
.icon-button:hover {
  background: var(--surface-4);
  border-color: var(--border-strong);
  color: var(--text);
}

.icon-button {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}

.semantic-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 4px;
  white-space: nowrap;
  cursor: pointer;
}

.semantic-toggle input {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ---------- Colonnes ---------------------------------------------------- */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 250px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.filters {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}

.filters h2 {
  margin: 0;
  color: var(--muted);
}

.filters label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: var(--muted);
}

.filters label select,
.filters label input {
  font-size: 12.5px;
  letter-spacing: 0;
  text-transform: none;
}

.filters-separator {
  height: 1px;
  background: var(--border);
  margin: 2px 0;
}

.filters-help,
.filters-status,
.metadata-hint {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

.range-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

/* ---------- Résultats --------------------------------------------------- */

.results {
  min-width: 0;
  padding: 0;
}

.results-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  white-space: nowrap;
  padding: 11px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  color: var(--muted);
}

tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--text-2);
  font-size: 12.5px;
}

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

tbody tr {
  transition: background 0.1s ease;
}

tbody tr:hover {
  background: var(--surface-2);
}

tbody td:nth-child(1) {
  white-space: nowrap;
}

tbody td:nth-child(2) {
  min-width: 250px;
}

tbody td:nth-child(3) {
  max-width: 210px;
}

.file-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  line-height: 1.45;
  margin-bottom: 3px;
  word-break: break-word;
}

.folder-path {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
  word-break: break-word;
}

.empty {
  padding: 56px 16px;
  text-align: center;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

.empty-inline {
  color: var(--faint);
  font-size: 12px;
}

.row-badges {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin: 6px 0;
}

/* ---------- Pastilles à point ------------------------------------------- */

.status-badge,
.new-badge,
.completion-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-3);
  color: var(--text-2);
  white-space: nowrap;
}

.status-badge::before,
.new-badge::before,
.completion-badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

.status-badge {
  margin-right: 4px;
}

.asset-raw {
  color: var(--text-2);
}

.asset-cut {
  color: var(--accent);
  border-color: var(--accent-border);
  background: var(--accent-dim);
}

.stage-to_review {
  color: var(--warning);
  border-color: rgba(251, 191, 36, 0.32);
  background: var(--warning-dim);
}

/* Visionnée : l'action est faite mais le parcours continue — d'où le bleu,
   entre l'ambre de « à visionner » et le vert des étapes terminales. */
.stage-watched {
  color: var(--info);
  border-color: rgba(96, 165, 250, .32);
  background: var(--info-dim);
}

.stage-treated,
.stage-published {
  color: var(--success);
  border-color: rgba(163, 230, 53, 0.32);
  background: var(--success-dim);
}

.new-badge {
  color: var(--info);
  border-color: rgba(96, 165, 250, 0.32);
  background: var(--info-dim);
}

.completion-complete {
  color: var(--success);
  border-color: rgba(163, 230, 53, 0.32);
  background: var(--success-dim);
}

.completion-partial {
  color: var(--warning);
  border-color: rgba(251, 191, 36, 0.32);
  background: var(--warning-dim);
}

.completion-missing {
  color: var(--danger);
  border-color: rgba(248, 113, 113, 0.32);
  background: var(--danger-dim);
}

/* ---------- Étiquettes -------------------------------------------------- */

.video-labels,
.term-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}

.video-label,
.term-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text-2);
  white-space: nowrap;
}

.label-edit-by {
  margin-top: 5px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--faint);
}

.assignee-badge {
  display: inline-block;
  margin-top: 5px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-2);
}

/* ---------- Actions de ligne -------------------------------------------- */

.detail-btn,
.link-btn {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-3);
  color: var(--text-2);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.detail-btn:hover,
.link-btn:hover {
  background: var(--surface-4);
  border-color: var(--accent-border);
  color: var(--accent);
}

/* ---------- ID interne --------------------------------------------------- */

.internal-id {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.internal-id code,
.source-id {
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
}

.internal-id-missing {
  color: var(--faint);
  font-family: var(--font-mono);
  font-size: 11px;
}

.copy-id-btn {
  padding: 2px 5px;
  font-size: 11px;
  line-height: 1.3;
  border-radius: var(--radius-sm);
  background: transparent;
  border-color: transparent;
  color: var(--faint);
  cursor: pointer;
}

.copy-id-btn:hover {
  background: var(--surface-3);
  border-color: var(--border);
  color: var(--accent);
}

/* ---------- Pagination ---------------------------------------------------- */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px 0 0;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Dialogues ----------------------------------------------------- */

dialog {
  width: min(780px, calc(100vw - 32px));
  max-height: calc(100vh - 56px);
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}

.wide-dialog {
  width: min(1020px, calc(100vw - 32px));
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.7);
}

dialog form {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 56px);
}

dialog article {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 22px 26px;
}

dialog menu {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: 0;
  padding: 13px 26px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

.dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 6px;
}

.dialog-heading h2,
dialog h2 {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 600;
}

/* ---------- Fiche vidéo ---------------------------------------------------- */

.detail-row {
  display: grid;
  grid-template-columns: 172px minmax(0, 1fr);
  gap: 16px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}

.detail-row span {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding-top: 2px;
}

.detail-row div {
  font-size: 12.5px;
  word-break: break-word;
  color: var(--text);
}

.detail-row a {
  color: var(--accent);
}

/* ---------- Blocs d'édition ------------------------------------------------ */

.assignee-block,
.label-editor,
.workflow-editor,
.metadata-editor {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.assignee-block h3,
.metadata-header h3,
.workflow-editor h3,
.label-editor h3 {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent);
}

.metadata-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.metadata-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.metadata-grid,
.workflow-editor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: 11px;
  margin-top: 12px;
}

.metadata-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.metadata-field > span,
.metadata-field-label {
  color: var(--muted);
}

.metadata-field input,
.metadata-field select,
.metadata-field textarea {
  width: 100%;
  letter-spacing: 0;
  text-transform: none;
}

.metadata-field-wide {
  grid-column: 1 / -1;
}

.metadata-terms {
  margin-top: 16px;
}

.metadata-terms h4,
.related-videos h4,
.label-history h4 {
  margin: 0 0 7px;
  color: var(--muted);
}

.label-editor input {
  width: 100%;
  margin: 9px 0;
}

.assignee-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin: 9px 0 4px;
}

.assignee-row select {
  flex: 1 1 240px;
}

.assignee-current {
  margin: 8px 0 2px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
}

/* ---------- Vidéos liées ---------------------------------------------------- */

.related-videos {
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.related-video-btn {
  display: inline-block;
  margin: 3px 5px 3px 0;
  padding: 5px 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-2);
  cursor: pointer;
}

.related-video-btn:hover {
  border-color: var(--accent-border);
  color: var(--accent);
  background: var(--accent-dim);
}

/* ---------- Recherche de source ---------------------------------------------- */

.source-results {
  margin-top: 8px;
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.source-result,
.relink-option {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
  text-align: left;
  padding: 9px 12px;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  cursor: pointer;
}

.source-result:hover,
.relink-option:hover {
  background: var(--accent-dim);
  color: var(--text);
}

.source-result:last-child {
  border-bottom: 0;
}

.source-result-label {
  color: var(--text);
}

.source-selected {
  margin-top: 8px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-left: 2px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.source-selected-main {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
  font-family: var(--font-mono);
  font-size: 12.5px;
}

.source-selected #clearSourceButton {
  margin-top: 9px;
}

.source-empty {
  margin: 8px 0 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
}

.source-hint {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.6;
}

.source-hint code {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius-sm);
  padding: 1px 5px;
}

/* ---------- File à rattacher -------------------------------------------------- */

.relink-item {
  display: grid;
  gap: 10px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}

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

.relink-cut {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-family: var(--font-mono);
  font-size: 12.5px;
}

.relink-options {
  display: grid;
  gap: 6px;
}

.relink-option {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.relink-option-main {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  color: var(--text);
}

.relink-done {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ---------- Titres manquants --------------------------------------------------- */

.fill-titles-status {
  margin: 0 0 14px;
  padding: 13px 15px;
  border: 1px solid var(--accent-border);
  border-left: 2px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent-dim);
  color: var(--text-2);
  font-size: 12.5px;
  line-height: 1.65;
}

.fill-titles-sample {
  margin: 9px 0;
  padding-left: 18px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
}

.fill-titles-sample li {
  margin: 3px 0;
}

/* ---------- Équipe -------------------------------------------------------------- */

.users-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.users-table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-size: 12.5px;
}

.users-table th,
.users-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.users-table th {
  color: var(--muted);
}

.users-table td {
  font-family: var(--font-mono);
  color: var(--text-2);
}

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

.user-name-input {
  width: 100%;
  max-width: 210px;
}

/* ---------- Configuration Drive ------------------------------------------------- */

.drive-config-grid {
  display: grid;
  gap: 14px;
}

.drive-config-grid h3 {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent);
}

.drive-current-folder {
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 12px;
}

.drive-current-folder span {
  display: block;
  color: var(--text-2);
}

.drive-search-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.drive-search-row input {
  flex: 1 1 240px;
}

.drive-search-results {
  display: grid;
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
}

.drive-folder-result {
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-align: left;
  padding: 9px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  cursor: pointer;
}

.drive-folder-result:hover {
  border-color: var(--accent-border);
  background: var(--accent-dim);
  color: var(--text);
}

.drive-folder-result span {
  font-size: 11px;
  color: var(--muted);
}

.button-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---------- Guide ----------------------------------------------------------------- */

.guide-layout ol {
  margin: 0;
  padding-left: 20px;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.75;
}

.status-guide {
  margin: 0;
}

.status-guide dt {
  margin-top: 13px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--accent);
}

.status-guide dd {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.65;
}

/* ---------- Historique des labels -------------------------------------------------- */

.label-history {
  margin-top: 14px;
}

.label-history-entry {
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}

.label-history-entry:last-child {
  border-bottom: 0;
}

.label-history-entry p {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-2);
}

/* ---------- Bandeau démo -------------------------------------------------------------- */

.demo-notice {
  padding: 12px 15px;
  margin-bottom: 16px;
  background: var(--warning-dim);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-left: 2px solid var(--warning);
  border-radius: var(--radius);
  color: var(--warning);
  font-size: 12.5px;
}

.demo-notice span {
  font-weight: 600;
}

/* ---------- Connexion ------------------------------------------------------------------ */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}

.auth-shell {
  width: 100%;
  max-width: 400px;
}

.auth-panel {
  padding: 30px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.auth-panel h1 {
  margin: 0 0 6px;
  font-size: 20px;
}

.auth-panel form {
  display: flex;
  flex-direction: column;
  gap: 13px;
  margin-top: 18px;
}

.auth-panel label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.auth-panel input {
  letter-spacing: 0;
  text-transform: none;
}

.auth-tabs {
  display: flex;
  width: 100%;
  margin-bottom: 0;
}

.auth-tab {
  flex: 1;
  text-align: center;
}

.auth-status {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--danger);
  min-height: 17px;
}

.auth-status.success {
  color: var(--accent);
}

.auth-help {
  margin: 16px 0 0;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

.auth-help strong {
  color: var(--text-2);
}

.auth-text-button {
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
}

.auth-text-button:hover {
  background: transparent;
  color: var(--accent-hover);
}

/* ---------- Adaptatif --------------------------------------------------------------------- */

@media (max-width: 1080px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .filters {
    position: static;
    max-height: none;
  }
}

@media (max-width: 720px) {
  .app {
    padding: 18px 14px 48px;
  }

  .header {
    gap: 16px;
  }

  h1 {
    font-size: 20px;
  }

  .stats-bar {
    gap: 16px;
  }

  .stat {
    text-align: left;
  }

  .toolbar-actions {
    width: 100%;
  }

  .toolbar-actions select,
  .toolbar-actions button {
    flex: 1 1 auto;
  }

  .detail-row {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  dialog article {
    padding: 18px 16px;
  }

  dialog menu {
    padding: 12px 16px;
  }
}
