:root,
html[data-theme="light"] {
  --bg: #f8fafc;
  --surface: #ffffff;
  --muted: #f8fafc;
  --text-900: #0f172a;
  --text-800: #1f2937;
  --text-700: #334155;
  --text-600: #475569;
  --text-500: #64748b;
  --border-200: #e5e7eb;
  --border-300: #cbd5e1;
  --overlay-80: rgba(255, 255, 255, .80);
  --surface-90: rgba(241, 245, 249, .90);
  --glass-panel-bg: rgba(255, 255, 255, .80);
  --glass-panel-bg-strong: rgba(255, 255, 255, .86);
  --glass-panel-border: rgba(226, 232, 240, .90);
  --glass-panel-shadow: 0 22px 46px rgba(0, 0, 0, .12);
  --glass-panel-blur: saturate(110%) blur(3px);
  --glass-soft-shadow: 0 10px 18px rgba(0, 0, 0, .18);
  --glass-soft-shadow-hover: 0 14px 24px rgba(0, 0, 0, .20);
  --glass-soft-shadow-disabled: 0 8px 12px rgba(0, 0, 0, .13);
  --focus-ring-glass: 0 0 0 3px rgba(0, 0, 0, .20);
  --overlay-scrim: rgba(0, 0, 0, .46);
  --elev-shadow-soft: 0 4px 12px rgba(0, 0, 0, .24);
  --elev-shadow-hover: 0 6px 16px rgba(0, 0, 0, .24);
  --elev-shadow-modal: 0 14px 40px rgba(0, 0, 0, .24);
  --elev-shadow-modal-lg: 0 20px 70px rgba(0, 0, 0, .24);
  /* tables (light): outline = black */
  --table-head-bg: #0f6ad8;
  --table-head-text: #ffffff;
  --table-row-alt: #f3f6fb;
  --table-border: rgba(15, 106, 216, .15);
  --table-col-border: #d0d7e2;
  --table-outline: #000000;
}
html {
  scrollbar-gutter: stable;
}
html[data-theme="dark"] {
  --bg: #020617;
  --surface: #0f172a;
  --muted: #1e293b;
  --text-900: #e2e8f0;
  --text-800: #e2e8f0;
  --text-700: #cbd5e1;
  --text-600: #94a3b8;
  --text-500: #94a3b8;
  --border-200: #334155;
  --border-300: #475569;
  --overlay-80: rgba(2, 6, 23, .70);
  --surface-90: rgba(30, 41, 59, .90);
  --glass-panel-bg: rgba(2, 6, 23, .74);
  --glass-panel-bg-strong: rgba(2, 6, 23, .82);
  --glass-panel-border: rgba(148, 163, 184, .35);
  --glass-panel-shadow: 0 22px 46px rgba(0, 0, 0, .45);
  --glass-panel-blur: saturate(110%) blur(3px);
  --glass-soft-shadow: 0 10px 18px rgba(0, 0, 0, .40);
  --glass-soft-shadow-hover: 0 14px 24px rgba(0, 0, 0, .48);
  --glass-soft-shadow-disabled: 0 8px 12px rgba(0, 0, 0, .30);
  --focus-ring-glass: 0 0 0 3px rgba(148, 163, 184, .35);
  --overlay-scrim: rgba(2, 6, 23, .70);
  --elev-shadow-soft: 0 4px 12px rgba(0, 0, 0, .45);
  --elev-shadow-hover: 0 6px 16px rgba(0, 0, 0, .45);
  --elev-shadow-modal: 0 14px 40px rgba(0, 0, 0, .52);
  --elev-shadow-modal-lg: 0 20px 70px rgba(0, 0, 0, .60);
  /* tables (dark): outline = white */
  --table-head-bg: #0f4fa3;
  --table-head-text: #ffffff;
  --table-row-alt: rgba(15, 79, 163, .25);
  --table-border: rgba(255, 255, 255, .04);
  --table-col-border: rgba(226, 232, 240, .25);
  --table-outline: #ffffff;
}
html[data-theme="light"] { color-scheme: light; }
html[data-theme="dark"]  { color-scheme: dark; }
/* -------------------------------------------------
   Utility-like mappings (used across pages)
   ------------------------------------------------- */
.bg-slate-50 { background-color: var(--bg) !important; }
.bg-slate-100 { background-color: var(--muted) !important; }
.bg-white { background-color: var(--surface) !important; }
.bg-white\/80 { background-color: var(--overlay-80) !important; }
.border-slate-200 { border-color: var(--border-200) !important; }
.border-slate-300 { border-color: var(--border-300) !important; }
.text-slate-900 { color:var(--text-900) !important; }
.text-slate-800 { color:var(--text-900) !important; }
.text-slate-700 { color:var(--text-700) !important; }
.text-slate-600 { color:var(--text-600) !important; }
.text-slate-500 { color:var(--text-600) !important; }
.hover\:bg-white:hover { background-color: var(--surface) !important; }
.hover\:bg-slate-50:hover { background-color: var(--muted) !important; }
.glass {
  backdrop-filter: blur(8px);
  background: var(--overlay-80);
}
/* lightweight utilities to replace repeated inline styles */
.is-hidden {
  display: none;
}
.notif-actions-end {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}
/* generic utilities for inline-style cleanup */
.u-m-0 {
  margin: 0 !important;
}
.u-mt-6 {
  margin-top: 6px;
}
.u-mt-8 {
  margin-top: 8px;
}
.u-my-16 {
  margin: 16px 0;
}
.u-gap-12 {
  gap: 12px;
}
.u-minw-0 {
  min-width: 0;
}
.u-p-0 {
  padding: 0 !important;
}
.u-p-8 {
  padding: 8px;
}
.u-no-shadow {
  box-shadow: none !important;
}
.u-border-bottom-0 {
  border-bottom: none !important;
}
.u-jc-between {
  justify-content: space-between;
}
.u-w-full {
  width: 100%;
}
.u-flex-none {
  flex: none;
}
.u-cursor-pointer {
  cursor: pointer;
}
.u-text-600 {
  color:var(--text-600);
}
.u-text-700 {
  color:var(--text-700);
}
.u-fs-13 {
  font-size: 13px;
}
.u-fs-14 {
  font-size: 14px;
}
.u-fw-600 {
  font-weight: 600;
}
.u-fw-800 {
  font-weight: 800;
}
.u-mt-10 {
  margin-top: 10px;
}
.u-mb-8 {
  margin-bottom: 8px;
}
.u-mb-10 {
  margin-bottom: 10px;
}
.u-mb-12 {
  margin-bottom: 12px;
}
.u-ml-12 {
  margin-left: 12px;
}
.u-flex-1 {
  flex: 1;
}
.u-flex-gap8-wrap-mt16 {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.u-flex-center-gap8-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.u-flex-between-gap8-start {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}
.u-flex-center-gap6-wrap {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}
.u-flex-center-gap6-wrap-mb10 {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.u-flex-gap12-end-wrap {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.u-word-break-all {
  word-break: break-all;
}
.u-pre-wrap {
  white-space: pre-wrap;
}
.u-text-center {
  text-align: center;
}
.u-overflow-x-auto {
  overflow-x: auto;
}
.u-collapse {
  border-collapse: collapse;
}
.u-border-200 {
  border-color: var(--border-200) !important;
}
.u-border-bottom-100 {
  border-bottom: 1px solid var(--border-100);
}
.u-p-12 {
  padding: 12px;
}
.u-p-40 {
  padding: 40px;
}
.u-btn-muted {
  background: var(--btn-muted-bg) !important;
  color:#fff !important;
  border-color: rgba(148, 163, 184, .4) !important;
}
.u-btn-compact-14 {
  padding: 6px 12px;
  font-size: 14px;
}
.u-btn-compact-10 {
  padding: 6px 10px;
}
.u-bg-606060 {
  background: #606060 !important;
}
.u-minw-160 {
  min-width: 160px;
}
.u-minw-260 {
  min-width: 260px;
}
.u-w-120 {
  width: 120px;
}
.u-h1-24 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 4px;
}
.u-flex-between-gap12 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.u-fs16-fw600 {
  font-size: 16px;
  font-weight: 600;
}
.u-text-600-12 {
  color:var(--text-600);
  font-size: 12px;
}
.u-btn-compact-13 {
  padding: 6px 12px;
  font-size: 13px;
}
.u-th-left {
  text-align: left;
  padding: 8px;
  border-bottom: 2px solid var(--border-200);
}
.u-modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}
.u-pill-select {
  padding: 6px 10px;
  border-radius:var(--radius-pill);
}
/* invert svg in dark mode */
html[data-theme="dark"] img[src$=".svg"],
html[data-theme="dark"] img[src*=".svg?"] {
  filter: invert(1) brightness(1.05);
}
/* -------------------------------------------------
   Notifications (global, as before)
   ------------------------------------------------- */
.notif-area {
  position: relative;
  display: flex;
  align-items: center;
}
.notif-bell {
  width: 34px;
  height: 34px;
  cursor: pointer;
  user-select: none;
}
.notif-count {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #e02424;
  color:#fff;
  border-radius:var(--radius-pill);
  padding: 2px 6px;
  font-size: 12px;
  line-height: 1;
  font-weight: 700;
  min-width: 18px;
  text-align: center;
}
.notif-panel {
  position: absolute;
  right: 0;
  top: 40px;
  width: 340px;
  max-height: 70vh;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border-300);
  border-radius:var(--control-radius);
  box-shadow: 0 12px 28px rgba(0,0,0,.15);
  z-index: 999;
  padding: 10px;
  display: none;
}
.notif-panel h3 {
  margin: 6px 6px 10px 6px;
  font-size: 16px;
}
.notif-item {
  border: 1px solid #eee;
  border-radius:var(--control-radius);
  padding: 8px;
  margin: 8px;
}
.notif-title {
  font-weight: 700;
  margin-bottom: 4px;
}
.notif-dates {
  font-size: 12px;
  color:var(--text-700);
  margin-top: 4px;
}
/* =========================================================
   PAIEMENTS-PAGE STYLES (scoped but safe for reuse)
   ========================================================= */
/* used on that page to make tables 100% */
.holebody {
  width: 100%;
}
/* top toggle bar */
.view-togglebar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0 0 12px;
  width: 100%;
  box-sizing: border-box;
  position: relative;
  z-index: 3;
  background: transparent;
  padding: 0;
}
.view-togglebar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--border-200);
  z-index: 1;
}
.toggle-btn {
  margin: 0;
  padding: 10px 12px;
  background: var(--muted);
  color:var(--text-900);
  border: 1px solid var(--border-200);
  border-bottom: none;
  border-radius:var(--control-radius);
  border-bottom-left-radius:0;
  border-bottom-right-radius:0;
  font-weight: 600;
  cursor: pointer;
  position: relative;
  z-index: 2;
}
.toggle-btn.active {
  background: var(--surface);
  z-index: 4;
  margin-bottom: -1px;
}
/* main tab container */
.tab-section {
  margin: 0 0 16px;
  border: 1px solid var(--border-200);
  background: var(--surface);
  border-radius:var(--control-radius);
  padding: 12px;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
}
/* inputs in those tab-sections (scoped, so other pages are safe) */
.tab-section input[type="text"],
.tab-section input[type="number"],
.tab-section select {
  padding: var(--control-pad-y) var(--control-pad-x);
  border: 1px solid var(--border-300);
  border-radius:var(--control-radius);
  background: var(--surface);
  color:var(--text-900);
  min-height: var(--control-height);
}
/* big grid for "Nouvelle vente" */
.nouveau-debit {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr minmax(360px, 4fr) minmax(90px, .8fr) 1fr auto;
  gap: 12px;
  align-items: center;
}
.nouveau-debit input[type="text"],
.nouveau-debit input[type="number"],
.nouveau-debit select {
  width: 100%;
  height: 44px;
  padding: 10px 12px;
  box-sizing: border-box;
  background: var(--surface);
  border: 1px solid var(--border-300);
  color:var(--text-900);
}
.nouveau-debit > button {
  height: 44px;
  white-space: nowrap;
}
/* creator/category selects are muted */
#creatorSelect,
#categorySelect {
  background: var(--muted);
  border-color: var(--border-200);
}
/* caisse / pochette cards */
.cash-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 4px 0 16px;
  color:var(--text-900);
}
.cash-title span {
  font-weight: 800;
  color:var(--text-900);
}
.cash-subtitle {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 12px 0 6px;
  font-size: 1.1rem;
  font-weight: 700;
  color:var(--text-900);
}
.cash-row-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  padding: 8px;
  box-sizing: border-box;
}
.cash-item {
  background: var(--muted);
  border: 1px solid var(--border-200);
  border-radius:var(--control-radius);
  padding: 8px 8px 12px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0,0,0,.03);
  min-width: 0;
  overflow: hidden;
  box-sizing: border-box;
}
.cash-item label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
  margin-bottom: 8px;
  font-weight: 700;
  color:var(--text-900);
  user-select: none;
  min-width: 0;
}
.cash-item img {
  display: block;
  width: clamp(88px, 10vw, 120px);
  height: clamp(88px, 10vw, 120px);
  object-fit: contain;
  border-radius:var(--control-radius);
  background: transparent;
  margin: 0 auto;
}
.cash-item img.fallback {
  background: var(--muted);
}
.cash-item input[type="number"] {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 36px;
  padding: 4px 6px;
  text-align: center;
  border: .0625rem solid var(--border-300);
  border-radius:var(--control-radius);
  font-size: .95rem;
  box-sizing: border-box;
  background: var(--surface);
  color:var(--text-900);
}
/* transfer amount input (caisse -> pochette) */
#transferAmount {
  background: var(--surface);
  border: 1px solid var(--border-300);
  color:var(--text-900);
}
/* delete icon in table rows */
.delete-icon,
.edit-icon {
  cursor: pointer;
  color:var(--text-700);
  font-size: 1.25rem;
}
/* =========================================================
   Buttons (global-ish, theme-aware)
   ========================================================= */
/* Theme vars for buttons */
:root,
html[data-theme="light"] {
  --btn-bg: #0f6ad8;
  --btn-bg-hover: #0d5bb9;
  --btn-text: #ffffff;
  --btn-muted-bg: #e2e8f0;
  --btn-muted-text: #0f172a;
}
html[data-theme="dark"] {
  --btn-bg: #3b82f6;
  --btn-bg-hover: #2563eb;
  --btn-text: #ffffff;
  --btn-muted-bg: #1f2937;
  --btn-muted-text: #e2e8f0;
}
/* 1) Generic app buttons (.btn) — used a lot in plannings.html */
.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius:var(--control-radius);
  padding: var(--control-pad-y) var(--control-pad-x);
  min-height: var(--control-height);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  background: var(--btn-bg);
  color:#fff;
  cursor: pointer;
  transition: background .15s ease, transform .15s ease, box-shadow .15s ease;
  line-height: 1.2;
}
.btn:hover {
  background: var(--btn-bg-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 106, 216, .25);
}
.btn:active {
  transform: translateY(0);
}
/* size helper */
.btn-sm {
  padding: 6px 10px;
  min-height: 2rem;
  font-size: .8125rem;
  border-radius:var(--control-radius);
}
/* variants already used in plannings.html */
.btn-primary {
  background: var(--btn-bg);
  color:#fff;
}
.btn-secondary {
  background: var(--btn-muted-bg);
  color:#fff;
  border-color: rgba(148, 163, 184, .4);
}
.btn-danger {
  background: #e02424;
  color:#fff;
}
/* 2) Page buttons inside tab content (paiements.html) */
.tab-section button {
  appearance: none;
  border: 1px solid transparent;
  border-radius:var(--control-radius);
  padding: var(--control-pad-y) var(--control-pad-x);
  min-height: var(--control-height);
  font-weight: 600;
  background: var(--btn-bg);
  color:#fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  cursor: pointer;
  transition: background .15s ease, transform .15s ease, box-shadow .15s ease;
}
.tab-section button:hover {
  background: var(--btn-bg-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 106, 216, .25);
}
/* keep your top toggle tabs untouched */
.toggle-btn {
  /* already styled above in theme.css, so we don’t override it here */
}

