/* ══════════════════════════════════════════════════════
   CASHFLOW PRO PWA — Mobile First Design System
   Palette : Vert forêt #1B5E20 / Or #F9A825
══════════════════════════════════════════════════════ */
:root {
  --green:        #1B5E20;
  --green-mid:    #2E7D32;
  --green-light:  #E8F5E9;
  --green-border: #B8D0B8;
  --gold:         #F9A825;
  --gold-light:   #FFF8E1;
  --red:          #B71C1C;
  --red-light:    #FFEBEE;
  --orange:       #E65100;
  --orange-light: #FFF3E0;
  --blue:         #1565C0;
  --blue-light:   #E3F2FD;
  --bg:           #F5F4EF;
  --surface:      #FFFFFF;
  --surface-2:    #F0EFE9;
  --border:       #E0DED6;
  --border-2:     #C8C6BE;
  --text:         #1A1A18;
  --text-2:       #5A5A52;
  --text-3:       #9A9A90;
  --topbar-h:     56px;
  --nav-h:        64px;
  --radius:       12px;
  --radius-sm:    8px;
  --radius-xs:    6px;
  --shadow-sm:    0 1px 3px rgba(0,0,0,0.08);
  --shadow:       0 4px 16px rgba(0,0,0,0.12);
  --transition:   0.15s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  overscroll-behavior: none;
}

/* ══ UTILITAIRES ════════════════════════════════════════ */
.hidden { display: none !important; }
.screen { display: none; min-height: 100vh; min-height: 100dvh; }
.screen.active { display: flex; flex-direction: column; }
.montant { font-variant-numeric: tabular-nums; }

/* ══ AUTH ═══════════════════════════════════════════════ */
#screen-auth {
  background: var(--green);
  justify-content: flex-end;
}

.auth-wrap {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

.auth-header {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px 32px;
  text-align: center;
}

.auth-logo-wrap {
  margin-bottom: 16px;
}

.auth-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.auth-sub {
  font-size: 0.88rem;
  color: rgba(255,255,255,0.6);
}

.auth-card {
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  padding: 24px 20px calc(24px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 24px rgba(0,0,0,0.15);
}

.auth-tabs {
  display: flex;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 3px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
}

.tab-btn {
  flex: 1;
  padding: 9px;
  border: none;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text-2);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.tab-btn.active { background: var(--green); color: #fff; box-shadow: var(--shadow-sm); }

.tab-panel { display: flex; flex-direction: column; gap: 14px; }
.tab-panel.hidden { display: none; }

/* FORM */
.form-group { display: flex; flex-direction: column; gap: 5px; }

.form-group label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.optional { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--text-3); }

input[type="tel"],
input[type="text"],
input[type="number"],
input[type="search"],
input[type="date"],
input[type="month"],
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  -webkit-appearance: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(27,94,32,0.12);
}

input::placeholder, textarea::placeholder { color: var(--text-3); }

/* PIN */
.pin-dots {
  display: flex;
  justify-content: center;
  gap: 16px;
  padding: 10px 0 6px;
}

.pin-dots span {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--border);
  border: 2px solid var(--border);
  transition: background var(--transition), transform var(--transition);
}

.pin-dots span.filled {
  background: var(--green);
  border-color: var(--green);
  transform: scale(1.15);
}

.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 8px;
}

.pin-key {
  padding: 14px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 1.2rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  box-shadow: var(--shadow-sm);
}

.pin-key:active { transform: scale(0.93); background: var(--green-light); border-color: var(--green); }
.pin-key.empty { visibility: hidden; box-shadow: none; border: none; }
.pin-key.del { color: var(--text-2); font-size: 0.9rem; }

/* BOUTONS */
.btn-primary {
  width: 100%;
  padding: 14px 16px;
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: var(--transition);
  box-shadow: 0 2px 8px rgba(27,94,32,0.3);
  -webkit-tap-highlight-color: transparent;
}

.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary:active:not(:disabled) { transform: scale(0.98); }
.btn-primary i { font-size: 1.1rem; }

.btn-secondary {
  padding: 10px 16px;
  background: var(--surface);
  color: var(--green);
  border: 1.5px solid var(--green);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.btn-secondary:active { background: var(--green-light); }

.btn-gold {
  padding: 10px 16px;
  background: var(--gold);
  color: #0D1F0D;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  -webkit-tap-highlight-color: transparent;
}

.btn-danger {
  padding: 10px 16px;
  background: transparent;
  color: var(--red);
  border: 1.5px solid var(--red);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border: 1.5px solid rgba(255,255,255,0.25);
  border-radius: var(--radius-xs);
  background: rgba(255,255,255,0.1);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.icon-btn i { font-size: 1.1rem; }

.form-error {
  background: var(--red-light);
  border: 1px solid rgba(183,28,28,0.2);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--red);
  font-size: 0.82rem;
  font-weight: 600;
}

/* ══ APP LAYOUT ═════════════════════════════════════════ */
#screen-app {
  background: var(--bg);
}

.topbar {
  height: var(--topbar-h);
  background: var(--green);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  padding-top: env(safe-area-inset-top);
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }

.topbar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--green);
  flex-shrink: 0;
}

.topbar-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.topbar-plan {
  font-size: 0.65rem;
  color: var(--gold);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.banner-warning {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  background: var(--orange-light);
  border-bottom: 1px solid rgba(230,81,0,0.2);
  color: var(--orange);
  font-size: 0.78rem;
  font-weight: 600;
  flex-shrink: 0;
}

.banner-warning i { font-size: 0.95rem; flex-shrink: 0; }
.banner-warning span { flex: 1; }
.banner-warning button {
  background: var(--orange);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}

.app-main {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  padding-bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom));
  -webkit-overflow-scrolling: touch;
}

/* ══ BOTTOM NAV ═════════════════════════════════════════ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
  z-index: 100;
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: none;
  background: transparent;
  color: var(--text-3);
  font-size: 0.6rem;
  font-weight: 600;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: color var(--transition);
  -webkit-tap-highlight-color: transparent;
  padding: 6px 0;
}

.nav-btn i { font-size: 1.35rem; }
.nav-btn.active { color: var(--green); }
.nav-btn.active i { color: var(--green); }

/* ══ MENU PLUS (bottom sheet) ═══════════════════════════ */
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  display: flex;
  align-items: flex-end;
}

.sheet {
  width: 100%;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  padding: 12px 0 calc(16px + env(safe-area-inset-bottom));
  animation: slideUp 0.22s ease;
}

@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.sheet-handle {
  width: 40px;
  height: 4px;
  background: var(--border-2);
  border-radius: 2px;
  margin: 0 auto 14px;
}

.sheet-title {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0 20px 8px;
}

.sheet-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 20px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  -webkit-tap-highlight-color: transparent;
  border-bottom: 1px solid var(--border);
}

.sheet-item:last-child { border-bottom: none; }
.sheet-item:active { background: var(--surface-2); }
.sheet-item i { font-size: 1.2rem; color: var(--green); width: 24px; }

/* ══ DASHBOARD ══════════════════════════════════════════ */
.dash-grid { display: flex; flex-direction: column; gap: 14px; }

.kpi-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition);
}

.kpi-card:active { border-color: var(--green); }
.kpi-card.revealed { border-color: var(--green); border-width: 1.5px; }
.kpi-card.full { grid-column: 1 / -1; }

.kpi-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-2);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.kpi-label i { font-size: 0.8rem; color: var(--green); }
.kpi-masked { font-size: 1.1rem; letter-spacing: 5px; color: var(--border-2); margin-bottom: 4px; }
.kpi-hint { font-size: 0.65rem; color: var(--green); display: flex; align-items: center; gap: 3px; font-weight: 600; }
.kpi-hint i { font-size: 0.75rem; }
.kpi-value { font-size: 1.2rem; font-weight: 800; color: var(--green); margin-bottom: 2px; letter-spacing: -0.01em; }
.kpi-value.neutral { color: var(--text); }
.kpi-sub { font-size: 0.65rem; color: var(--text-3); display: flex; align-items: center; gap: 3px; }
.trend-up { color: var(--green); font-size: 0.65rem; }

.kpi-panel {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.kpi-panel label { font-size: 0.7rem; color: var(--text-2); font-weight: 600; display: block; margin-bottom: 5px; }

.kpi-result {
  margin-top: 8px;
  padding: 8px 12px;
  background: var(--green-light);
  border-radius: var(--radius-xs);
  text-align: center;
}

.kpi-result-value { font-size: 1.05rem; font-weight: 800; color: var(--green); }
.kpi-result-sub { font-size: 0.68rem; color: #3B6D11; margin-top: 2px; }

/* CARD */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow-sm);
}

.card-header {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-2);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header a { font-size: 0.7rem; color: var(--green); font-weight: 700; text-transform: none; letter-spacing: 0; cursor: pointer; }

/* CHART */
.chart-bars { display: flex; align-items: flex-end; gap: 3px; height: 64px; }
.c-bar { flex: 1; border-radius: 2px 2px 0 0; background: var(--green-border); min-height: 3px; }
.c-bar.today { background: var(--green); }

/* ALERTES */
.alert-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.alert-row:last-child { border-bottom: none; }
.a-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.a-nom { flex: 1; font-size: 0.82rem; color: var(--text); font-weight: 500; }
.a-val { font-size: 0.78rem; font-weight: 700; }
.text-red { color: var(--red); }
.text-orange { color: var(--orange); }
.text-green { color: var(--green); }

/* TOP PRODUITS */
.top-row { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.top-row:last-child { border-bottom: none; }
.top-rank { width: 20px; height: 20px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 0.65rem; font-weight: 700; color: var(--text-2); flex-shrink: 0; }
.top-nom { flex: 1; font-size: 0.8rem; font-weight: 500; color: var(--text); }
.top-qte { font-size: 0.68rem; color: var(--text-3); }
.top-ca { font-size: 0.8rem; font-weight: 700; color: var(--green); }

/* ══ IMPORT ═════════════════════════════════════════════ */
.import-zone {
  border: 2px dashed var(--border-2);
  border-radius: var(--radius);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  background: var(--surface-2);
  transition: border-color var(--transition), background var(--transition);
}

.import-zone:active { border-color: var(--green); background: var(--green-light); }
.import-zone i { font-size: 2.2rem; color: var(--green); display: block; margin-bottom: 10px; }
.import-title { font-size: 0.92rem; font-weight: 700; color: var(--text); }
.import-sub { font-size: 0.78rem; color: var(--text-2); margin-top: 4px; }

.import-types { display: flex; justify-content: center; gap: 6px; margin-top: 12px; }
.file-type { font-size: 0.7rem; font-weight: 700; padding: 3px 10px; border-radius: 4px; }
.file-type.xlsx { background: var(--green-light); color: var(--green); }
.file-type.docx { background: var(--blue-light); color: var(--blue); }
.file-type.pdf  { background: var(--red-light); color: var(--red); }

.import-dest-label { font-size: 0.72rem; color: var(--text-2); font-weight: 700; margin: 14px 0 8px; text-transform: uppercase; letter-spacing: 0.06em; }
.import-dest { display: flex; gap: 8px; }
.dest-btn { flex: 1; padding: 10px 6px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text-2); font-size: 0.75rem; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 5px; transition: var(--transition); }
.dest-btn:active { border-color: var(--green); color: var(--green); }
.dest-btn.active { border-color: var(--green); color: var(--green); background: var(--green-light); }
.dest-btn i { font-size: 0.9rem; }

/* ══ PRODUITS / LISTES ══════════════════════════════════ */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.page-actions { display: flex; align-items: center; gap: 8px; }

.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  margin-bottom: 12px;
}

.search-bar i { color: var(--text-3); font-size: 1rem; flex-shrink: 0; }
.search-bar input { flex: 1; border: none; background: transparent; padding: 11px 0; font-size: 0.9rem; color: var(--text); outline: none; }

.filter-chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; -webkit-overflow-scrolling: touch; }
.filter-chips::-webkit-scrollbar { display: none; }

.filter-chip {
  padding: 6px 14px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.filter-chip.active { border-color: var(--green); color: var(--green); background: var(--green-light); }

/* CARTES PRODUITS */
.produit-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 8px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.produit-card:active { background: var(--surface-2); }
.produit-nom { font-size: 0.9rem; font-weight: 700; color: var(--text); margin-bottom: 3px; }
.produit-cat { font-size: 0.72rem; color: var(--text-3); }
.produit-card-bottom { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border); }

/* BADGES */
.badge-ok     { background: var(--green-light);  color: var(--green);  font-size: 0.68rem; font-weight: 700; padding: 2px 9px; border-radius: 20px; white-space: nowrap; }
.badge-low    { background: var(--orange-light); color: var(--orange); font-size: 0.68rem; font-weight: 700; padding: 2px 9px; border-radius: 20px; white-space: nowrap; }
.badge-out    { background: var(--red-light);    color: var(--red);    font-size: 0.68rem; font-weight: 700; padding: 2px 9px; border-radius: 20px; white-space: nowrap; }
.badge-valid  { background: var(--green-light);  color: var(--green);  font-size: 0.68rem; font-weight: 700; padding: 2px 9px; border-radius: 20px; }
.badge-cancel { background: var(--red-light);    color: var(--red);    font-size: 0.68rem; font-weight: 700; padding: 2px 9px; border-radius: 20px; }

/* VENTES PANIER */
.panier-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 8px; display: flex; align-items: center; gap: 10px; box-shadow: var(--shadow-sm); }
.panier-nom { flex: 1; font-size: 0.85rem; font-weight: 700; color: var(--text); }
.panier-prix { font-size: 0.75rem; color: var(--text-2); }
.qty-btn { width: 28px; height: 28px; border: 1.5px solid var(--border); border-radius: 6px; background: var(--surface); color: var(--text); font-size: 1rem; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; -webkit-tap-highlight-color: transparent; }
.qty-btn:active { background: var(--green-light); border-color: var(--green); }
.qty-val { min-width: 22px; text-align: center; font-size: 0.9rem; font-weight: 700; }

.total-bar { background: var(--green); color: #fff; border-radius: var(--radius); padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }
.total-label { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; opacity: 0.85; }
.total-value { font-size: 1.2rem; font-weight: 800; }

/* FAB */
.fab {
  position: fixed;
  bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom));
  right: 16px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--gold);
  color: #0D1F0D;
  border: none;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(249,168,37,0.45);
  cursor: pointer;
  z-index: 90;
  -webkit-tap-highlight-color: transparent;
}

.fab:active { transform: scale(0.94); }

/* ══ OCR TABLE ══════════════════════════════════════════ */
.ocr-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); margin-top: 12px; }
.ocr-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; min-width: 320px; }
.ocr-table th { padding: 8px 8px; background: var(--green); color: #fff; text-align: left; font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.ocr-table th.gold { background: var(--gold); color: #0D1F0D; }
.ocr-table td { padding: 6px 4px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.ocr-table tr:last-child td { border-bottom: none; }
.ocr-table tr:nth-child(even) td { background: var(--surface-2); }
.ocr-input { width: 100%; border: 1.5px solid transparent; border-radius: 4px; padding: 4px 6px; font-size: 0.78rem; background: transparent; color: var(--text); font-family: inherit; }
.ocr-input:focus { border-color: var(--green); background: var(--surface); outline: none; }
.ocr-input.num { text-align: right; width: 64px; }
.ocr-pt-cell { font-weight: 700; color: var(--green); text-align: right; padding-right: 8px; white-space: nowrap; }
.ocr-del { background: none; border: none; color: var(--red); cursor: pointer; font-size: 1rem; padding: 2px 4px; }
.ocr-footer-row { background: var(--green-light); }
.ocr-footer-row td { padding: 8px 8px; font-weight: 800; color: var(--green); font-size: 0.82rem; border-top: 2px solid var(--green); }

/* ══ MODAL ══════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 300;
  display: flex;
  align-items: flex-end;
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px 18px calc(20px + env(safe-area-inset-bottom));
  animation: slideUp 0.2s ease;
}

.modal.center {
  border-radius: var(--radius);
  max-width: 480px;
  margin: auto;
  max-height: 85vh;
  padding: 20px 18px;
}

.modal-handle { width: 36px; height: 4px; background: var(--border-2); border-radius: 2px; margin: 0 auto 16px; }

.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.modal-title { font-size: 0.95rem; font-weight: 800; color: var(--text); }
.modal-close { width: 30px; height: 30px; border: 1.5px solid var(--border); border-radius: 7px; background: var(--surface-2); color: var(--text-2); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.modal-actions .btn-primary { flex: 1; }

/* ══ HISTORIQUE STOCK ═══════════════════════════════════ */
.hist-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.hist-kpi { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 8px; text-align: center; }
.hist-kpi-l { font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-2); margin-bottom: 4px; }
.hist-kpi-v { font-size: 1rem; font-weight: 800; }

.mouv-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.mouv-row:last-child { border-bottom: none; }
.mouv-icon { width: 32px; height: 32px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.mouv-icon i { font-size: 0.9rem; }
.mouv-info { flex: 1; min-width: 0; }
.mouv-type { font-size: 0.8rem; font-weight: 700; color: var(--text); }
.mouv-date { font-size: 0.68rem; color: var(--text-3); }
.mouv-note { font-size: 0.68rem; color: var(--text-3); font-style: italic; }
.mouv-qty { font-size: 0.9rem; font-weight: 800; }
.mouv-stock { font-size: 0.62rem; color: var(--text-3); text-align: right; }

/* ══ EMPTY STATE ════════════════════════════════════════ */
.empty-state { text-align: center; padding: 48px 24px; }
.empty-icon { width: 56px; height: 56px; background: var(--green-light); border: 1.5px solid var(--green-border); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; }
.empty-icon i { font-size: 1.5rem; color: var(--green); }
.empty-state h3 { font-size: 0.95rem; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.empty-state p { font-size: 0.82rem; color: var(--text-2); line-height: 1.5; }

/* ══ LOADER & TOAST ═════════════════════════════════════ */
.global-loader { position: fixed; inset: 0; background: var(--bg); z-index: 999; display: flex; align-items: center; justify-content: center; }
.loader-ring { width: 40px; height: 40px; border: 3px solid var(--border); border-top-color: var(--green); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.spinner { width: 18px; height: 18px; border: 2px solid rgba(255,255,255,0.35); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; display: inline-block; }

.toast { position: fixed; bottom: calc(var(--nav-h) + 12px + env(safe-area-inset-bottom)); left: 16px; right: 16px; background: var(--text); color: #fff; padding: 12px 16px; border-radius: var(--radius-sm); font-size: 0.85rem; font-weight: 600; z-index: 500; box-shadow: var(--shadow); display: flex; align-items: center; gap: 8px; animation: toastIn 0.2s ease; }
.toast.success { background: var(--green); }
.toast.error   { background: var(--red); }
.toast i { font-size: 1rem; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

::-webkit-scrollbar { display: none; }
