/* ============================================================
   MetaDocs – Design System
   METAFORA Biosystèmes SAS
   Thèmes : Light & Dark
   ============================================================ */

/* --- Variables : thème clair -------------------------------- */
:root,
[data-theme="light"] {
  --bg:            #f0f4f8;
  --bg-card:       #ffffff;
  --bg-nav:        rgba(255,255,255,0.92);
  --bg-input:      #f7fafc;
  --bg-hover:      #edf2f7;
  --bg-section:    #f8fafc;

  --text:          #1a202c;
  --text-muted:    #718096;
  --text-light:    #a0aec0;
  --text-inv:      #ffffff;

  --border:        #e2e8f0;
  --border-focus:  #0069a6;
  --shadow-sm:     0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow:        0 4px 16px rgba(0,0,0,.08), 0 1px 4px rgba(0,0,0,.04);
  --shadow-lg:     0 12px 40px rgba(0,0,0,.12);
  --shadow-nav:    0 2px 20px rgba(0,0,0,.06);

  --accent:        #0069a6;
  --accent-hover:  #005580;
  --accent-light:  #e6f2f9;
  --accent2:       #00b4d8;

  --success:       #38a169;
  --success-light: #f0fff4;
  --warning:       #dd6b20;
  --warning-light: #fffaf0;
  --danger:        #e53e3e;
  --danger-light:  #fff5f5;

  --nav-height:    64px;
  --radius:        10px;
  --radius-lg:     16px;
  --radius-sm:     6px;
  --transition:    .2s cubic-bezier(.4,0,.2,1);
}

/* --- Variables : thème sombre ------------------------------ */
[data-theme="dark"] {
  --bg:            #0f1117;
  --bg-card:       #1a1d27;
  --bg-nav:        rgba(18,21,32,0.95);
  --bg-input:      #141720;
  --bg-hover:      #242837;
  --bg-section:    #14161f;

  --text:          #e2e8f0;
  --text-muted:    #718096;
  --text-light:    #4a5568;
  --text-inv:      #0f1117;

  --border:        #2d3148;
  --border-focus:  #00b4d8;
  --shadow-sm:     0 1px 3px rgba(0,0,0,.3);
  --shadow:        0 4px 16px rgba(0,0,0,.3);
  --shadow-lg:     0 12px 40px rgba(0,0,0,.5);
  --shadow-nav:    0 2px 20px rgba(0,0,0,.4);

  --accent:        #00b4d8;
  --accent-hover:  #0096b3;
  --accent-light:  #0d2130;
  --accent2:       #0069a6;

  --success:       #48bb78;
  --success-light: #1a2f1e;
  --warning:       #ed8936;
  --warning-light: #2d1f0a;
  --danger:        #fc8181;
  --danger-light:  #2d1010;
}

/* --- Reset & Base ------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
  transition: background var(--transition), color var(--transition);
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }

ul { list-style: none; }
img { max-width: 100%; }

/* --- Navigation -------------------------------------------- */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-height);
  background: var(--bg-nav);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-nav);
  z-index: 100;
  transition: background var(--transition);
}

.navbar-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
}

.navbar-brand {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: 2px;
  text-decoration: none;
  margin-right: 16px;
  flex-shrink: 0;
}

.brand-meta { color: var(--text); }
.brand-docs { color: var(--accent); }

.navbar-menu {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: .875rem;
  font-weight: 500;
  transition: all var(--transition);
  text-decoration: none;
}

.nav-link:hover,
.nav-link.active {
  background: var(--accent-light);
  color: var(--accent);
}

.nav-badge-wrapper { position: relative; }

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  background: var(--danger);
  color: #fff;
  border-radius: 9px;
  font-size: .7rem;
  font-weight: 700;
  line-height: 1;
}

.nav-divider {
  flex: 1;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border-radius: var(--radius);
  background: var(--bg-hover);
}

.nav-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.nav-user-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.nav-user-name {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
}

.nav-user-role {
  font-size: .7rem;
  font-weight: 500;
  padding: 1px 6px;
  border-radius: 4px;
  text-transform: capitalize;
  line-height: 1.4;
}

.nav-hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 8px;
  border-radius: var(--radius-sm);
  margin-left: auto;
}

/* --- Rôles couleurs ---------------------------------------- */
.badge-role-admin   { background: linear-gradient(135deg,#553c9a,#764ba2); color:#fff; }
.badge-role-manager { background: linear-gradient(135deg,#0069a6,#00b4d8); color:#fff; }
.badge-role-reader  { background: var(--bg-hover); color: var(--text-muted); }

/* --- Main Content ------------------------------------------ */
.main-content {
  padding-top: calc(var(--nav-height) + 32px);
  padding-bottom: 64px;
  max-width: 1400px;
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
  min-height: 100vh;
}

/* --- Page Header ------------------------------------------- */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: .875rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: .875rem;
  margin-bottom: 8px;
  transition: color var(--transition);
}

.back-link:hover { color: var(--accent); }

/* --- Stats cards ------------------------------------------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stats-grid-sm {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: #fff;
  flex-shrink: 0;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}

.stat-label {
  font-size: .8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Stat cards petites */
.stat-card-sm {
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 16px;
  gap: 6px;
}

.stat-sm-icon  { font-size: 1.4rem; color: var(--accent); }
.stat-sm-value { font-size: 1.8rem; font-weight: 800; }
.stat-sm-label { font-size: .75rem; color: var(--text-muted); }

/* --- Section --------------------------------------------- */
.section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.section-title {
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

/* --- Table ----------------------------------------------- */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}

.table th {
  padding: 12px 16px;
  background: var(--bg-section);
  color: var(--text-muted);
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

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

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

.table tbody tr:hover td { background: var(--bg-hover); }

.table .text-right { text-align: right; }

.doc-title-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
}

.doc-title-cell i { font-size: 1.1rem; flex-shrink: 0; }

/* --- Badges ---------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-green  { background: var(--success-light); color: var(--success); }
.badge-orange { background: var(--warning-light); color: var(--warning); }
.badge-red    { background: var(--danger-light);  color: var(--danger); }
.badge-done   { background: var(--accent-light);  color: var(--accent); }

.version-badge {
  display: inline-block;
  padding: 2px 8px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: .75rem;
  font-weight: 600;
  font-family: 'Courier New', monospace;
  color: var(--text-muted);
}

.badge-count {
  display: inline-block;
  padding: 2px 8px;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: 12px;
  font-size: .75rem;
  font-weight: 600;
  margin-left: 8px;
}

/* --- Progress Bar ----------------------------------------- */
.progress-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 160px;
}

.progress-bar-wrap {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .4s ease;
}

.progress-bar-fill.done { background: var(--success); }
.progress-bar-fill.high { background: var(--accent); }
.progress-bar-fill.low  { background: var(--warning); }

.progress-label {
  font-size: .75rem;
  color: var(--text-muted);
  white-space: nowrap;
  font-weight: 500;
}

/* --- Document Cards --------------------------------------- */
.doc-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

.doc-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
}

.doc-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.doc-card-indicator {
  width: 5px;
  flex-shrink: 0;
}

.doc-card-indicator.status-green  { background: var(--success); }
.doc-card-indicator.status-orange { background: var(--warning); }
.doc-card-indicator.status-red    { background: var(--danger); }
.doc-card-indicator.status-done   { background: var(--border); }

.doc-card-body {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.doc-card-top {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.doc-card-icon { font-size: 1.5rem; flex-shrink: 0; margin-top: 2px; }

.doc-card-meta { flex: 1; }

.doc-card-title {
  font-size: .95rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.3;
}

.doc-card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.doc-deadline {
  font-size: .8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}

.status-text-red    { color: var(--danger) !important; }
.status-text-orange { color: var(--warning) !important; }
.status-text-green  { color: var(--success) !important; }

/* --- Boutons --------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}

.btn:disabled {
  opacity: .6;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,105,166,.3);
}

.btn-secondary {
  background: var(--bg-hover);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) {
  background: var(--border);
  color: var(--text);
}

.btn-success {
  background: var(--success);
  color: #fff;
}
.btn-success:hover:not(:disabled) {
  background: #2f855a;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(56,161,105,.3);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover:not(:disabled) {
  background: #c53030;
  color: #fff;
}

.btn-outline {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-outline:hover:not(:disabled) {
  background: var(--bg-hover);
  color: var(--text);
}

.btn-sm   { padding: 5px 12px; font-size: .8rem; }
.btn-lg   { padding: 12px 24px; font-size: 1rem; }
.btn-block { width: 100%; justify-content: center; }

.btn-outline-sm {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: .8rem;
  font-weight: 500;
  cursor: pointer;
  background: none;
  transition: all var(--transition);
  text-decoration: none;
}

.btn-outline-sm:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}

.btn-icon:hover {
  background: var(--bg-hover);
  color: var(--text);
}

/* --- Formulaires ------------------------------------------ */
.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.form-section {
  padding: 28px 32px;
  border-bottom: 1px solid var(--border);
}

.form-section:last-of-type { border-bottom: none; }

.form-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-section-title i { color: var(--accent); }

.form-group { margin-bottom: 16px; }
.form-group:last-child { margin-bottom: 0; }

.form-label {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.form-label.required::after {
  content: ' *';
  color: var(--danger);
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: .9rem;
  font-family: inherit;
  transition: all var(--transition);
  outline: none;
}

.form-control:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(0,105,166,.1);
  background: var(--bg-card);
}

.form-control::placeholder { color: var(--text-light); }

.form-control-sm {
  padding: 7px 10px;
  font-size: .825rem;
  width: 200px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.form-col-2 { grid-column: span 2; }
.form-col-1 { grid-column: span 1; }

.form-help {
  display: block;
  font-size: .775rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 20px 32px;
  background: var(--bg-section);
  border-top: 1px solid var(--border);
}

.input-group {
  position: relative;
  display: flex;
}

.input-group .form-control {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  flex: 1;
}

.input-addon {
  padding: 10px 14px;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-left: none;
  border-top-right-radius: var(--radius-sm);
  border-bottom-right-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}

.input-addon:hover { background: var(--border); color: var(--text); }

/* Radio cards pour type de fichier */
.radio-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.radio-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}

.radio-card input { display: none; }
.radio-card i { font-size: 1.8rem; color: var(--text-muted); transition: color var(--transition); }
.radio-card span { font-weight: 600; font-size: .9rem; }
.radio-card small { color: var(--text-muted); font-size: .77rem; }

.radio-card:hover,
.radio-card.checked {
  border-color: var(--accent);
  background: var(--accent-light);
}

.radio-card.checked i { color: var(--accent); }

/* File drop zone */
.file-drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
}

.file-drop-zone:hover,
.file-drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-light);
}

.file-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.file-drop-content i   { font-size: 2.5rem; color: var(--text-light); margin-bottom: 10px; }
.file-drop-content p   { font-weight: 500; margin-bottom: 4px; }
.file-drop-content small { color: var(--text-muted); }

/* Lecteurs */
.reader-search-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.select-all-btns {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.readers-list {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.reader-group-header {
  padding: 8px 16px;
  background: var(--bg-section);
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
}

.reader-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid var(--border);
}

.reader-item:last-child { border-bottom: none; }
.reader-item input[type=checkbox] { display: none; }
.reader-item:hover { background: var(--bg-hover); }
.reader-item.selected { background: var(--accent-light); }

.reader-check-icon {
  margin-left: auto;
  color: var(--accent);
  opacity: 0;
  font-size: .85rem;
}

.reader-item.selected .reader-check-icon { opacity: 1; }

.reader-info { flex: 1; }
.reader-name { display: block; font-size: .875rem; font-weight: 500; }
.reader-username { font-size: .75rem; color: var(--text-muted); }

.user-avatar-sm {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

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

.current-file-info {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: var(--bg-section);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: .9rem;
}

/* Filter tabs */
.filter-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-section);
  padding: 3px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.filter-tab {
  padding: 5px 12px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}

.filter-tab.active,
.filter-tab:hover {
  background: var(--bg-card);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* --- Doc viewer ------------------------------------------- */
.doc-meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: .82rem;
  color: var(--text-muted);
}

.doc-viewer-container {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
}

.viewer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--bg-section);
  border-bottom: 1px solid var(--border);
  font-size: .875rem;
  font-weight: 500;
}

.pdf-viewer { width: 100%; background: #525659; }
.pdf-iframe {
  width: 100%;
  height: 80vh;
  border: none;
  display: block;
}

.docx-viewer {
  padding: 32px;
  min-height: 300px;
}

.docx-content { line-height: 1.8; }
.docx-content h1, .docx-content h2, .docx-content h3 {
  margin: 1em 0 .5em;
  color: var(--text);
}
.docx-content p { margin-bottom: .75em; color: var(--text); }
.docx-content table { border-collapse: collapse; width: 100%; margin: 1em 0; }
.docx-content td, .docx-content th { border: 1px solid var(--border); padding: 8px; }

.viewer-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px;
  color: var(--text-muted);
  font-size: .9rem;
}

.viewer-loading i { font-size: 2rem; color: var(--accent); }

.doc-url-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 60px;
  text-align: center;
  color: var(--text-muted);
}

.doc-url-info i { font-size: 2.5rem; color: var(--accent); }

/* Read confirm bar */
.read-confirm-bar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.read-confirm-bar.read-confirm-done {
  background: var(--success-light);
  border-color: var(--success);
}

.read-confirm-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.read-confirm-text {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .9rem;
  color: var(--text-muted);
}

/* --- Alertes ---------------------------------------------- */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 18px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  font-size: .9rem;
}

.alert-danger  { background: var(--danger-light);  color: var(--danger);  border-left: 4px solid var(--danger); }
.alert-warning { background: var(--warning-light); color: var(--warning); border-left: 4px solid var(--warning); }
.alert-success { background: var(--success-light); color: var(--success); border-left: 4px solid var(--success); }
.alert-info    { background: var(--accent-light);  color: var(--accent);  border-left: 4px solid var(--accent); }

/* --- Modal ------------------------------------------------ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.active { display: flex; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 480px;
  width: 100%;
  animation: modalIn .2s ease;
}

@keyframes modalIn {
  from { transform: scale(.96) translateY(8px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 { font-size: 1rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }

.modal-body {
  padding: 20px 24px;
  color: var(--text-muted);
  font-size: .9rem;
  line-height: 1.6;
}

.modal-body strong { color: var(--text); }

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* --- Login ----------------------------------------------- */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #071e3d 0%, #0a2d54 50%, #071e3d 100%);
}

.login-bg { position: fixed; inset: 0; z-index: 0; }

.login-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .3;
}

.blob-1 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, #0069a6, transparent);
  top: -100px;
  left: -100px;
}

.blob-2 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, #00b4d8, transparent);
  bottom: -80px;
  right: -80px;
}

.login-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  padding: 20px;
}

.login-card {
  background: rgba(255,255,255,.05);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 25px 60px rgba(0,0,0,.4);
}

[data-theme="light"] .login-card {
  background: #fff;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: 3px;
  margin-bottom: 8px;
}

[data-theme="light"] .login-logo .brand-meta { color: #071e3d; }
[data-theme="dark"]  .login-logo .brand-meta { color: #e2e8f0; }
.login-logo .brand-docs  { color: #00b4d8; }

.login-subtitle {
  color: rgba(255,255,255,.6);
  font-size: .875rem;
  margin-bottom: 4px;
}

[data-theme="light"] .login-subtitle { color: var(--text-muted); }

.login-company {
  color: rgba(255,255,255,.4);
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
}

[data-theme="light"] .login-company { color: var(--text-light); }

.login-form .form-label { color: rgba(255,255,255,.7); }
[data-theme="light"] .login-form .form-label { color: var(--text); }

.login-form .form-control {
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.15);
  color: #fff;
}

[data-theme="light"] .login-form .form-control {
  background: var(--bg-input);
  border-color: var(--border);
  color: var(--text);
}

.login-form .form-control:focus {
  background: rgba(255,255,255,.12);
  border-color: #00b4d8;
}

[data-theme="light"] .login-form .form-control:focus {
  background: var(--bg-card);
  border-color: var(--border-focus);
}

.login-form .input-addon {
  background: rgba(255,255,255,.08);
  border-color: rgba(255,255,255,.15);
  color: rgba(255,255,255,.5);
}

[data-theme="light"] .login-form .input-addon {
  background: var(--bg-hover);
  border-color: var(--border);
  color: var(--text-muted);
}

.login-footer {
  text-align: center;
  font-size: .77rem;
  color: rgba(255,255,255,.3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 24px;
}

[data-theme="light"] .login-footer { color: var(--text-light); }

.login-theme-btn {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2;
  background: rgba(255,255,255,.1);
  color: #fff;
  border: 1px solid rgba(255,255,255,.2);
  width: 40px;
  height: 40px;
}

[data-theme="light"] .login-theme-btn {
  background: var(--bg-card);
  color: var(--text);
  border-color: var(--border);
}

/* --- Footer ---------------------------------------------- */
.app-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40px;
  background: var(--bg-nav);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.footer-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .75rem;
  color: var(--text-muted);
}

.footer-sep { opacity: .4; }

/* --- Utilitaires ----------------------------------------- */
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.text-danger  { color: var(--danger) !important; }
.text-muted   { color: var(--text-muted) !important; }
.text-accent  { color: var(--accent) !important; }
.text-sm      { font-size: .8rem !important; }
.text-right   { text-align: right; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 3rem;
  color: var(--text-light);
  margin-bottom: 16px;
  display: block;
}

/* --- Responsive ------------------------------------------ */
@media (max-width: 900px) {
  .nav-hamburger { display: flex; }

  .navbar-menu {
    display: none;
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: var(--bg-nav);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    align-items: stretch;
    padding: 16px;
    gap: 4px;
    box-shadow: var(--shadow);
  }

  .navbar-menu.open { display: flex; }

  .nav-link { justify-content: flex-start; }
  .nav-divider { display: none; }
  .nav-user { margin: 8px 0; }

  .main-content {
    padding-left: 16px;
    padding-right: 16px;
  }

  .form-section { padding: 20px; }
  .form-actions { padding: 16px 20px; }
  .form-col-2 { grid-column: span 1; }
  .radio-group { grid-template-columns: 1fr; }

  .doc-cards { grid-template-columns: 1fr; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-grid-sm { grid-template-columns: repeat(4, 1fr); }

  .section-header { flex-direction: column; align-items: flex-start; }

  .page-header { flex-direction: column; }

  .read-confirm-inner { flex-direction: column; align-items: flex-start; }

  .login-card { padding: 28px 24px; }
}

@media (max-width: 480px) {
  .stats-grid   { grid-template-columns: 1fr; }
  .stats-grid-sm { grid-template-columns: repeat(2,1fr); }
  .navbar-brand { font-size: 1.1rem; }
  .page-title   { font-size: 1.2rem; }
}

/* --- Scrollbar ------------------------------------------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

/* --- Transitions thème ----------------------------------- */
*, *::before, *::after {
  transition: background-color var(--transition),
              border-color var(--transition),
              color .1s;
}
