/* DocuVault Scanner v1.3 — Style inspiré EDMS — Abdiel NovaLab 2026 */

:root {
  /* Palette principale — dark profond EDMS-style */
  --bg:          #0B1437;
  --bg-card:     #0c1a3e;
  --bg-elevated: #0f2050;
  --bg-header:   #0a1230;
  --navy:        #1E2761;
  --navy-light:  #2a3580;
  --gold:        #C9A84C;
  --gold-light:  #e4c068;
  --gold-dark:   #a8883a;
  --blue:        #0ea5e9;
  --blue-dark:   #0369a1;
  --success:     #10B981;
  --success-bg:  rgba(5,150,105,0.15);
  --danger:      #EF4444;
  --danger-bg:   rgba(239,68,68,0.15);
  --warning:     #f59e0b;
  --white:       #ffffff;
  --text-dim:    rgba(255,255,255,0.55);
  --border:      rgba(255,255,255,0.08);
  --border-gold: rgba(201,168,76,0.35);
  --border-blue: rgba(14,165,233,0.25);
  --radius:      16px;
  --radius-sm:   10px;
  --shadow:      0 8px 32px rgba(0,0,0,0.4);
  --shadow-gold: 0 4px 20px rgba(201,168,76,0.35);
  --shadow-blue: 0 4px 16px rgba(14,165,233,0.3);
}

*, *::before, *::after {
  box-sizing: border-box; margin: 0; padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--white);
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

/* ================================================================
   PORTAIL LOGIN
================================================================ */
#login-portal {
  position: fixed; inset: 0; z-index: 1000;
  background: linear-gradient(135deg, #060d24 0%, var(--bg) 40%, #0a1850 100%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px;
  transition: opacity 0.4s, visibility 0.4s;
}
#login-portal.hidden { opacity: 0; visibility: hidden; pointer-events: none; }

.login-card {
  width: 100%; max-width: 380px;
  background: rgba(255,255,255,0.05);
  border-radius: 24px; padding: 36px 28px;
  border: 1px solid rgba(255,255,255,0.12);
  backdrop-filter: blur(20px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 0 1px rgba(201,168,76,0.1);
}

.login-logo-wrapper {
  text-align: center; margin-bottom: 24px;
}
.login-logo {
  width: 96px; height: 96px; border-radius: 20px;
  object-fit: cover;
  border: 2px solid rgba(201,168,76,0.4);
  box-shadow: 0 0 30px rgba(201,168,76,0.2);
}
.login-logo-fallback {
  width: 96px; height: 96px; border-radius: 20px;
  background: linear-gradient(135deg, var(--gold-dark) 0%, var(--gold) 100%);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 40px; box-shadow: var(--shadow-gold);
  border: 2px solid rgba(201,168,76,0.4);
}

.login-brand    { font-size: 20px; font-weight: 800; color: var(--white); margin-top: 14px; letter-spacing: 0.3px; }
.login-sub      { font-size: 12px; color: var(--gold); font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase; margin-top: 4px; }
.login-desc     { font-size: 13px; color: var(--text-dim); margin-top: 6px; }

.login-divider  { height: 1px; background: rgba(255,255,255,0.1); margin: 24px 0; }

.login-field-label { font-size: 11px; font-weight: 700; color: var(--gold); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }

.login-input-wrapper {
  position: relative; display: flex; align-items: center;
  background: rgba(255,255,255,0.07);
  border: 1.5px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s, background 0.2s;
}
.login-input-wrapper:focus-within {
  border-color: var(--gold);
  background: rgba(201,168,76,0.07);
}
.login-input-icon { padding: 0 12px; font-size: 18px; flex-shrink: 0; }
.login-input {
  flex: 1; padding: 14px 4px;
  background: transparent; border: none; outline: none;
  font-size: 16px; font-weight: 600; color: var(--white);
  letter-spacing: 3px;
}
.login-input::placeholder { color: rgba(255,255,255,0.25); letter-spacing: 1px; font-weight: 400; }
.login-eye {
  padding: 0 14px; font-size: 18px; cursor: pointer; flex-shrink: 0;
  background: none; border: none; color: var(--text-dim);
}

.login-error {
  display: none;
  align-items: center; gap: 8px;
  background: var(--danger-bg);
  border: 1px solid rgba(239,68,68,0.3);
  border-radius: 10px; padding: 10px 14px; margin-top: 12px;
  font-size: 13px; color: #fca5a5;
}
.login-error.show { display: flex; }

.login-btn {
  width: 100%; height: 52px; margin-top: 20px;
  background: linear-gradient(135deg, var(--gold-dark) 0%, var(--gold) 100%);
  color: var(--bg); border: none; border-radius: 14px;
  font-size: 15px; font-weight: 800; cursor: pointer;
  box-shadow: var(--shadow-gold); transition: all 0.2s;
  letter-spacing: 0.3px;
}
.login-btn:active { transform: scale(0.97); box-shadow: none; }
.login-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.login-footer {
  text-align: center; margin-top: 24px;
  font-size: 11px; color: rgba(255,255,255,0.2);
}

/* ================================================================
   HEADER
================================================================ */
.app-header {
  background: var(--bg-header);
  padding: 12px 18px;
  display: flex; align-items: center; gap: 12px;
  position: sticky; top: 0; z-index: 200;
  border-bottom: 1px solid rgba(201,168,76,0.15);
  box-shadow: 0 2px 24px rgba(0,0,0,0.4);
}

.header-logo     { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.logo-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--gold-dark) 0%, var(--gold) 100%);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; box-shadow: var(--shadow-gold);
}
.header-title h1 { font-size: 15px; font-weight: 800; letter-spacing: 0.2px; }
.header-title p  { font-size: 10px; color: var(--gold); font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase; }

.desktop-nav { display: none; flex: 1; justify-content: center; gap: 4px; }
.desktop-nav-btn {
  padding: 7px 16px; border: none; border-radius: 8px; cursor: pointer;
  font-size: 13px; font-weight: 600; color: rgba(255,255,255,0.45); background: transparent;
  transition: all 0.2s;
}
.desktop-nav-btn:hover  { color: var(--white); background: rgba(255,255,255,0.06); }
.desktop-nav-btn.active {
  color: var(--bg);
  background: linear-gradient(135deg, var(--gold-dark) 0%, var(--gold) 100%);
  box-shadow: var(--shadow-gold);
}

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

.header-badge {
  background: rgba(201,168,76,0.12); border: 1px solid var(--border-gold);
  color: var(--gold); padding: 5px 12px; border-radius: 20px;
  font-size: 11px; font-weight: 700; white-space: nowrap;
}

.btn-logout {
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.25);
  color: #fca5a5; font-size: 14px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.btn-logout:hover { background: rgba(239,68,68,0.2); }

/* ================================================================
   LAYOUT
================================================================ */
.app-main   { min-height: calc(100vh - 62px); padding-bottom: 72px; }
.page       { display: none; padding: 14px; }
.page.active{ display: block; }

/* ================================================================
   BOTTOM NAV MOBILE
================================================================ */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--bg-header);
  display: flex;
  border-top: 1px solid rgba(201,168,76,0.15);
  z-index: 100;
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -4px 24px rgba(0,0,0,0.4);
}

.nav-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 10px 4px; background: none; border: none; cursor: pointer; gap: 3px;
  position: relative; transition: all 0.2s;
}
.nav-btn .nav-icon  { font-size: 19px; transition: transform 0.2s; }
.nav-btn .nav-label { font-size: 10px; font-weight: 600; color: rgba(255,255,255,0.35); text-transform: uppercase; letter-spacing: 0.5px; }
.nav-btn.active .nav-icon  { transform: scale(1.15); }
.nav-btn.active .nav-label { color: var(--gold); }
.nav-btn.active::before {
  content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  width: 28px; height: 3px; background: var(--gold); border-radius: 0 0 3px 3px;
}

.nav-scan-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 4px; background: none; border: none; cursor: pointer;
}
.scan-fab {
  width: 52px; height: 52px;
  background: linear-gradient(135deg, var(--gold-dark) 0%, var(--gold) 100%);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 20px;
  box-shadow: 0 0 0 3px var(--bg-header), var(--shadow-gold);
  margin-top: -20px; transition: transform 0.2s;
}
.scan-fab:active { transform: scale(0.92); }

/* ================================================================
   COMPOSANTS COMMUNS
================================================================ */
.section-title {
  font-size: 11px; font-weight: 800; color: var(--gold);
  text-transform: uppercase; letter-spacing: 1.5px;
  margin-bottom: 10px;
  display: flex; align-items: center; gap: 8px;
}
.section-title::before {
  content: ''; display: inline-block; width: 3px; height: 14px;
  background: var(--gold); border-radius: 2px;
}

.sync-banner {
  background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.3);
  border-radius: var(--radius-sm); padding: 10px 14px;
  display: flex; align-items: center; gap: 8px; margin-bottom: 14px;
  font-size: 12px; color: var(--warning); font-weight: 600;
}

/* ================================================================
   DASHBOARD
================================================================ */
.dashboard-greeting {
  background: linear-gradient(135deg, var(--bg-elevated) 0%, var(--navy) 100%);
  border-radius: var(--radius); padding: 20px; margin-bottom: 16px;
  position: relative; overflow: hidden;
  border: 1px solid var(--border-gold);
}
.dashboard-greeting::before {
  content: ''; position: absolute; right: -30px; top: -30px;
  width: 160px; height: 160px;
  background: radial-gradient(circle, rgba(201,168,76,0.1) 0%, transparent 70%);
  border-radius: 50%;
}
.dashboard-greeting::after {
  content: '📄'; position: absolute; right: 18px; bottom: 12px;
  font-size: 40px; opacity: 0.08;
}
.greeting-date { font-size: 11px; color: var(--gold); font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 6px; }
.greeting-text { font-size: 19px; font-weight: 800; }
.greeting-sub  { font-size: 12px; color: var(--text-dim); margin-top: 4px; }

.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-sm); padding: 14px;
  display: flex; flex-direction: column; gap: 6px;
  border: 1px solid var(--border);
  position: relative; overflow: hidden; transition: transform 0.2s;
  box-shadow: 0 2px 12px rgba(0,0,0,0.2);
}
.stat-card::after {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 3px;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}
.stat-card.gold::after    { background: var(--gold); }
.stat-card.navy::after    { background: var(--blue); }
.stat-card.success::after { background: var(--success); }
.stat-card.warning::after { background: var(--warning); }
.stat-card:active { transform: scale(0.97); }

.stat-icon  { font-size: 20px; }
.stat-value { font-size: 28px; font-weight: 900; line-height: 1; }
.stat-label { font-size: 11px; color: rgba(255,255,255,0.45); font-weight: 600; }

/* ================================================================
   DOC ITEMS (EDMS-style dark cards)
================================================================ */
.recent-list, .history-list { display: flex; flex-direction: column; gap: 1px; }

.doc-item {
  background: var(--bg-card);
  padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s; cursor: pointer;
}
.doc-item:first-child { border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.doc-item:last-child  { border-radius: 0 0 var(--radius-sm) var(--radius-sm); border-bottom: none; }
.doc-item:only-child  { border-radius: var(--radius-sm); border-bottom: none; }
.doc-item:active { background: var(--bg-elevated); }

.doc-thumb {
  width: 44px; height: 54px; border-radius: 8px;
  background: rgba(201,168,76,0.07); border: 1px solid var(--border-gold);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0; overflow: hidden;
}
.doc-thumb img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }

.doc-info    { flex: 1; min-width: 0; }
.doc-name    { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-meta    { font-size: 11px; color: rgba(255,255,255,0.4); margin-top: 2px; }
.doc-extract { font-size: 11px; color: var(--gold); opacity: 0.8; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.doc-status { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.doc-status.synced  { background: var(--success); box-shadow: 0 0 6px var(--success); }
.doc-status.pending { background: var(--warning); box-shadow: 0 0 6px var(--warning); }

/* ================================================================
   SCANNER LAYOUT
================================================================ */
.scanner-layout { display: flex; flex-direction: column; gap: 14px; }

.doc-type-selector { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.doc-type-selector::-webkit-scrollbar { display: none; }

.type-chip {
  flex-shrink: 0; padding: 7px 14px; border-radius: 20px;
  border: 1.5px solid var(--border-gold);
  background: rgba(201,168,76,0.05);
  color: rgba(255,255,255,0.5); font-size: 12px; font-weight: 600; cursor: pointer;
  transition: all 0.2s; white-space: nowrap;
}
.type-chip.active {
  background: linear-gradient(135deg, var(--gold-dark) 0%, var(--gold) 100%);
  border-color: var(--gold); color: var(--bg); box-shadow: var(--shadow-gold);
}

/* ================================================================
   CAMÉRA + BOUTON FLIP (HORS WRAPPER)
================================================================ */
.camera-section { position: relative; }

.camera-wrapper {
  position: relative; background: #000;
  border-radius: var(--radius); overflow: hidden;
  aspect-ratio: 3/4; max-height: 56vh;
  border: 1px solid rgba(14,165,233,0.2);
  box-shadow: 0 0 0 1px rgba(14,165,233,0.1), var(--shadow);
}

#camera-video { width: 100%; height: 100%; object-fit: cover; display: block; }
#scan-canvas  { display: none; }

/* Vignette EDMS-style */
.camera-vignette {
  position: absolute; inset: 0;
  border: 44px solid rgba(0,0,0,0.6);
  pointer-events: none;
}

.camera-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center; pointer-events: none;
}

/* Cadre EDMS-style — coins or animés avec glow */
.scan-frame-wrapper { width: 76%; height: 74%; position: relative; }

.scan-corner {
  position: absolute; width: 26px; height: 26px;
  border-color: var(--gold);
  border-style: solid;
  animation: cornerGlow 1.4s ease-in-out infinite;
}
.scan-corner.tl { top:0;    left:0;  border-width: 3px 0 0 3px; border-radius: 5px 0 0 0; }
.scan-corner.tr { top:0;    right:0; border-width: 3px 3px 0 0; border-radius: 0 5px 0 0; animation-delay: 0.2s; }
.scan-corner.bl { bottom:0; left:0;  border-width: 0 0 3px 3px; border-radius: 0 0 0 5px; animation-delay: 0.35s; }
.scan-corner.br { bottom:0; right:0; border-width: 0 3px 3px 0; border-radius: 0 0 5px 0; animation-delay: 0.5s; }

@keyframes cornerGlow {
  0%, 100% { border-color: var(--gold); opacity: 1; box-shadow: 0 0 6px var(--gold-dark); }
  50%       { border-color: var(--gold-light); opacity: 0.5; box-shadow: none; }
}

.scan-line {
  position: absolute; left: 2px; right: 2px; height: 2px;
  background: var(--gold);
  box-shadow: 0 0 10px var(--gold), 0 0 20px rgba(201,168,76,0.4);
  top: 0;
  animation: scanMove 2s ease-in-out infinite;
}
@keyframes scanMove {
  0%   { top: 4%;  opacity: 0; }
  5%   { opacity: 1; }
  95%  { opacity: 1; }
  100% { top: 92%; opacity: 0; }
}

.camera-hint {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  background: rgba(11,20,55,0.8); backdrop-filter: blur(8px);
  color: rgba(255,255,255,0.8); padding: 6px 16px; border-radius: 20px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  border: 1px solid var(--border-gold);
}

.camera-placeholder {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #060d24 0%, var(--bg) 100%); gap: 12px;
}
.camera-placeholder .placeholder-icon { font-size: 48px; opacity: 0.3; }
.camera-placeholder p { font-size: 13px; color: var(--text-dim); text-align: center; padding: 0 24px; line-height: 1.5; }

/* ========================================================
   BOUTON FLIP — 60px, or, icône navy, HORS du wrapper
======================================================== */
.btn-flip-camera {
  position: absolute;
  bottom: 14px; right: 14px;
  z-index: 50;
  width: 60px; height: 60px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-dark) 0%, var(--gold) 100%);
  border: 3px solid #fff;
  box-shadow: 0 6px 20px rgba(0,0,0,0.5), var(--shadow-gold);
  display: none;
  flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  cursor: pointer; transition: transform 0.25s, box-shadow 0.2s; padding: 0;
}
.btn-flip-camera.visible { display: flex; }
.btn-flip-camera:active  { transform: scale(0.88) rotate(-20deg); box-shadow: 0 2px 8px rgba(0,0,0,0.4); }
.flip-icon  { font-size: 22px; line-height: 1; color: var(--bg); }
.flip-label { font-size: 8px; font-weight: 800; color: var(--bg); letter-spacing: 0.5px; text-transform: uppercase; }

/* ================================================================
   CONTRÔLES SCANNER
================================================================ */
.scanner-controls { display: flex; gap: 10px; align-items: center; }

.btn-capture {
  flex: 1; height: 52px;
  background: var(--bg-elevated);
  color: var(--white); border: 1.5px solid var(--border-gold);
  border-radius: 14px; font-size: 14px; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: var(--shadow); transition: all 0.2s;
}
.btn-capture:active  { transform: scale(0.97); }
.btn-capture:disabled{ opacity: 0.4; cursor: not-allowed; }
.btn-capture.primary {
  background: linear-gradient(135deg, var(--gold-dark) 0%, var(--gold) 100%);
  color: var(--bg); border-color: var(--gold); box-shadow: var(--shadow-gold);
}

.btn-gallery {
  width: 52px; height: 52px;
  background: rgba(201,168,76,0.08); border: 1.5px solid var(--border-gold);
  border-radius: 14px; font-size: 22px;
  cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s;
}
.btn-gallery:active { background: rgba(201,168,76,0.18); }

/* ================================================================
   PREVIEW & OCR
================================================================ */
.scanner-col-form { display: flex; flex-direction: column; }

.form-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px 24px; color: var(--text-dim); text-align: center; flex: 1;
}
.form-placeholder .empty-icon { font-size: 44px; margin-bottom: 12px; opacity: 0.25; }
.form-placeholder h3 { font-size: 15px; font-weight: 700; color: rgba(255,255,255,0.35); margin-bottom: 8px; }
.form-placeholder p  { font-size: 13px; line-height: 1.5; max-width: 280px; }

.preview-section {
  background: var(--bg-card); border-radius: var(--radius);
  padding: 16px; border: 1px solid var(--border-gold);
  box-shadow: var(--shadow);
}
.preview-image-wrapper { text-align: center; margin-bottom: 14px; }
.preview-image-wrapper img {
  max-width: 100%; max-height: 220px; border-radius: 10px;
  border: 1px solid var(--border-gold);
}

.ocr-status {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  background: rgba(201,168,76,0.06); border: 1px solid rgba(201,168,76,0.15);
  border-radius: var(--radius-sm); margin-bottom: 14px;
}
.ocr-spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(201,168,76,0.2); border-top-color: var(--gold);
  border-radius: 50%; animation: spin 0.8s linear infinite; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
.ocr-progress { flex: 1; }
.ocr-progress-label { font-size: 12px; font-weight: 600; color: var(--gold); margin-bottom: 4px; }
.progress-bar { height: 4px; background: rgba(255,255,255,0.08); border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--blue), var(--gold)); transition: width 0.3s; }

.extracted-fields { display: flex; flex-direction: column; gap: 10px; }

.field-group {
  background: rgba(255,255,255,0.03); border-radius: var(--radius-sm);
  padding: 11px; border-left: 3px solid var(--gold);
}
.field-label { font-size: 10px; font-weight: 800; color: var(--gold); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 5px; }

.field-input {
  width: 100%; padding: 9px 12px;
  border: 1.5px solid rgba(255,255,255,0.1); border-radius: 8px;
  font-size: 14px; font-weight: 600; color: var(--white);
  background: rgba(255,255,255,0.05); outline: none; transition: border-color 0.2s;
}
.field-input:focus { border-color: var(--gold); background: rgba(201,168,76,0.07); }
textarea.field-input { resize: vertical; min-height: 80px; }

.btn-save {
  width: 100%; height: 52px;
  background: linear-gradient(135deg, var(--gold-dark) 0%, var(--gold) 100%);
  color: var(--bg); border: none; border-radius: 14px;
  font-size: 15px; font-weight: 900; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: var(--shadow-gold); transition: all 0.2s; margin-top: 14px;
}
.btn-save:active   { transform: scale(0.97); box-shadow: none; }
.btn-save:disabled { opacity: 0.5; cursor: not-allowed; }

/* ================================================================
   HISTORIQUE
================================================================ */
.history-toolbar {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
}
.search-bar {
  flex: 1; display: flex; align-items: center;
  background: rgba(255,255,255,0.05); border-radius: 12px; padding: 10px 14px; gap: 10px;
  border: 1.5px solid rgba(255,255,255,0.1); transition: border-color 0.2s;
}
.search-bar:focus-within { border-color: var(--gold); background: rgba(201,168,76,0.06); }
.search-bar input { flex: 1; border: none; outline: none; font-size: 14px; color: var(--white); background: transparent; }
.search-bar input::placeholder { color: rgba(255,255,255,0.3); }

.btn-export-inline {
  padding: 10px 14px; border-radius: 12px;
  background: rgba(201,168,76,0.08); border: 1.5px solid var(--border-gold);
  color: var(--gold); font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap;
  transition: all 0.2s;
}
.btn-export-inline:active { background: rgba(201,168,76,0.18); }

/* ================================================================
   RÉGLAGES
================================================================ */
.settings-grid { display: flex; flex-direction: column; gap: 0; }

.settings-section {
  background: var(--bg-card); border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border); margin-bottom: 14px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}
.settings-section-title {
  padding: 11px 16px 8px;
  font-size: 10px; font-weight: 800; color: var(--gold);
  text-transform: uppercase; letter-spacing: 1.5px;
  background: rgba(201,168,76,0.04);
  border-bottom: 1px solid rgba(201,168,76,0.1);
}
.settings-item {
  display: flex; align-items: center; padding: 14px 16px; gap: 14px;
  border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.2s;
}
.settings-item:last-child { border-bottom: none; }
.settings-item:active     { background: rgba(255,255,255,0.04); }
.settings-icon  { font-size: 20px; width: 32px; text-align: center; }
.settings-text  { flex: 1; }
.settings-label { font-size: 14px; font-weight: 600; }
.settings-desc  { font-size: 12px; color: rgba(255,255,255,0.4); margin-top: 2px; }
.settings-arrow { color: rgba(255,255,255,0.2); font-size: 18px; }

/* ================================================================
   EMPTY STATE
================================================================ */
.empty-state { text-align: center; padding: 44px 24px; color: rgba(255,255,255,0.35); }
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.3; }
.empty-state h3 { font-size: 16px; font-weight: 700; color: rgba(255,255,255,0.4); margin-bottom: 8px; }
.empty-state p  { font-size: 13px; line-height: 1.5; }

/* ================================================================
   MODAL
================================================================ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.8);
  z-index: 300; display: none; align-items: flex-end; justify-content: center;
  backdrop-filter: blur(8px);
}
.modal-overlay.open { display: flex; }
.modal-sheet {
  background: var(--bg-card);
  border-radius: 22px 22px 0 0; padding: 20px;
  width: 100%; max-height: 88vh; overflow-y: auto;
  animation: slideUp 0.26s ease-out;
  border-top: 1px solid var(--border-gold);
  border-left: 1px solid rgba(201,168,76,0.1);
  border-right: 1px solid rgba(201,168,76,0.1);
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.modal-handle { width: 36px; height: 4px; background: rgba(201,168,76,0.3); border-radius: 2px; margin: 0 auto 16px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-title  { font-size: 17px; font-weight: 800; }
.btn-close {
  width: 34px; height: 34px; background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08); border-radius: 50%;
  font-size: 16px; cursor: pointer; color: var(--white);
  display: flex; align-items: center; justify-content: center;
}
.modal-doc-image { width: 100%; border-radius: 12px; margin-bottom: 14px; border: 1px solid var(--border-gold); }
.modal-fields    { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.modal-actions   { display: flex; gap: 10px; }
.btn-delete {
  flex: 1; height: 46px;
  background: var(--danger-bg); border: 1.5px solid rgba(239,68,68,0.3);
  color: #fca5a5; border-radius: 12px; font-size: 13px; font-weight: 700; cursor: pointer;
}
.btn-sync {
  flex: 2; height: 46px;
  background: rgba(14,165,233,0.15); border: 1px solid var(--border-blue);
  color: var(--white); border-radius: 12px; font-size: 13px; font-weight: 700; cursor: pointer;
}

/* ================================================================
   FEEDBACK OVERLAY — EDMS style (success vert / erreur rouge)
================================================================ */
.feedback-overlay {
  position: fixed; bottom: 90px; left: 16px; right: 16px;
  z-index: 250;
  border-radius: 20px; overflow: hidden;
  transform: translateY(20px); opacity: 0;
  transition: all 0.3s ease-out; pointer-events: none;
}
.feedback-overlay.show { transform: translateY(0); opacity: 1; }
.feedback-card {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 22px; border-radius: 20px;
}
.feedback-card.success { background: rgba(5,150,105,0.97); }
.feedback-card.danger  { background: rgba(225,29,72,0.97); }
.feedback-icon { font-size: 30px; }
.feedback-text .feedback-title { font-size: 18px; font-weight: 800; color: #fff; }
.feedback-text .feedback-sub   { font-size: 12px; color: rgba(255,255,255,0.75); margin-top: 2px; }

/* ================================================================
   TOAST
================================================================ */
.toast {
  position: fixed; bottom: 84px; left: 50%;
  transform: translateX(-50%) translateY(14px);
  background: rgba(11,20,55,0.95); backdrop-filter: blur(10px);
  border: 1px solid var(--border-gold); color: var(--white);
  padding: 11px 20px; border-radius: 12px;
  font-size: 13px; font-weight: 600; z-index: 400;
  opacity: 0; transition: all 0.25s; white-space: nowrap;
  box-shadow: var(--shadow); max-width: 88vw; text-align: center;
}
.toast.success { border-color: var(--success); color: var(--success); }
.toast.warning { border-color: var(--warning); color: var(--warning); }
.toast.danger  { border-color: var(--danger);  color: #fca5a5; }
.toast.show    { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ================================================================
   LOADING
================================================================ */
.loading-overlay {
  position: fixed; inset: 0; background: rgba(7,13,38,0.94); backdrop-filter: blur(8px);
  z-index: 500; display: none;
  flex-direction: column; align-items: center; justify-content: center; gap: 18px;
}
.loading-overlay.show { display: flex; }
.loading-spinner { width: 50px; height: 50px; border: 3px solid rgba(201,168,76,0.15); border-top-color: var(--gold); border-radius: 50%; animation: spin 0.8s linear infinite; }
.loading-text    { font-size: 14px; font-weight: 700; color: var(--gold); letter-spacing: 0.5px; }

/* Scrollbar */
::-webkit-scrollbar { width: 3px; height: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(201,168,76,0.2); border-radius: 2px; }

/* ================================================================
   DESKTOP ≥ 768px
================================================================ */
@media (min-width: 768px) {
  .app-header  { padding: 12px 28px; }
  .desktop-nav { display: flex; }
  .bottom-nav  { display: none; }
  .app-main    { padding-bottom: 0; }
  .page        { padding: 22px 28px; }

  .stats-grid { grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
  .stat-value { font-size: 32px; }

  .scanner-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
  .scanner-col-camera { display: flex; flex-direction: column; gap: 14px; }
  .camera-wrapper { max-height: none; aspect-ratio: 3/4; }

  .btn-flip-camera { width: 68px; height: 68px; bottom: 16px; right: 16px; }
  .flip-icon { font-size: 26px; }

  .scanner-col-form { min-height: 400px; }
  .preview-image-wrapper img { max-height: 180px; }

  .settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }

  .modal-overlay { align-items: center; padding: 24px; }
  .modal-sheet   { border-radius: 22px; max-width: 540px; }

  .toast { bottom: 24px; }
  .feedback-overlay { bottom: 24px; left: calc(50% - 220px); right: auto; width: 440px; }

  .docs-table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--bg-card); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
  .docs-table th {
    padding: 11px 16px; text-align: left; font-size: 10px; font-weight: 800;
    color: var(--gold); text-transform: uppercase; letter-spacing: 1.2px;
    background: rgba(201,168,76,0.05); border-bottom: 1px solid rgba(201,168,76,0.12);
  }
  .docs-table td { padding: 12px 16px; font-size: 13px; border-bottom: 1px solid var(--border); vertical-align: middle; }
  .docs-table tr:last-child td { border-bottom: none; }
  .docs-table tr:hover td { background: rgba(255,255,255,0.03); cursor: pointer; }
  .td-thumb { width: 48px; }
  .td-thumb-img { width: 36px; height: 44px; border-radius: 6px; object-fit: cover; background: rgba(201,168,76,0.07); border: 1px solid var(--border-gold); display: flex; align-items: center; justify-content: center; font-size: 18px; }
  .td-thumb-img img { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; }
  .td-name { font-weight: 700; }
  .td-number { color: var(--gold); font-weight: 600; }
  .td-date, .td-oper { color: rgba(255,255,255,0.45); font-size: 12px; }
  .td-status span { padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; }
  .td-status .s-synced  { background: var(--success-bg); color: var(--success); }
  .td-status .s-pending { background: rgba(245,158,11,0.15); color: var(--warning); }

  .doc-item { display: none; }
  .recent-list, .history-list { display: block; }
}

@media (min-width: 1100px) {
  .page { padding: 26px 40px; }
  .scanner-layout { grid-template-columns: 1fr 1.1fr; }
}
