:root {
  --primary: 255 204 0;
  --primary-2: 255 184 0;
  --primary-soft: 255 246 204;
  --primary-ink: 161 110 0;
  --accent: 255 204 0;
  --accent-soft: 255 248 214;
  --gradient: linear-gradient(135deg, #ffd500 0%, #ffc400 100%);
  --dark: 28 28 30;
  --surface: rgba(255, 255, 255, 0.92);
  --field: 255 253 245;
  --border: 240 231 200;
  --ink: 17 17 17;
  --muted: 107 101 87;
  --success: 16 185 129;
  --danger: 239 68 68;
  --radius: 0.875rem;
  --shadow: 0 1px 2px rgba(60, 45, 0, 0.04), 0 8px 24px -8px rgba(60, 45, 0, 0.10);
  --shadow-lg: 0 2px 4px rgba(60, 45, 0, 0.04), 0 18px 36px -14px rgba(60, 45, 0, 0.18);
}

html, body {
  max-width: 100%;
  overflow-x: hidden !important;
  overscroll-behavior-x: none;
  touch-action: pan-y;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
main { min-width: 0; max-width: 100%; }
img, svg, video, canvas { max-width: 100%; }
/* iOS zooms into fields with text smaller than 16px */
input, select, textarea { font-size: 16px !important; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif !important;
  color: rgb(var(--ink));
  background-color: #fff8e1 !important;
  background-image:
    radial-gradient(at 50% 0%, rgba(255, 221, 87, 0.35) 0, transparent 55%),
    linear-gradient(180deg, #fff6d6 0%, #fffaf0 45%, #ffffff 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

/* Primary (MVola yellow) */
.bg-primary {
  background: var(--gradient) !important;
  color: rgb(var(--ink)) !important;
  font-weight: 600 !important;
  box-shadow: 0 6px 16px -6px rgba(214, 160, 0, 0.55);
}
.bg-primary:hover { filter: brightness(1.03); }
.bg-primary:active { transform: translateY(1px); }
.text-primary, .hover\:text-primary:hover { color: rgb(var(--primary-ink)) !important; }
.focus\:ring-primary:focus { --tw-ring-color: rgb(var(--primary) / 0.35) !important; }
.focus\:border-primary:focus { border-color: rgb(var(--primary)) !important; }

a.font-\[\'Pacifico\'\], h1.font-\[\'Pacifico\'\] {
  color: rgb(var(--ink)) !important;
  text-shadow: 2px 2px 0 rgb(var(--primary));
}

/* Sidebar & navigation */
aside {
  background: #fffdf6 !important;
  border-color: rgb(var(--border)) !important;
}
main > div.lg\:hidden, .top-bar {
  background: rgba(255, 248, 225, 0.88) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: none !important;
  border-bottom: 1px solid rgb(var(--border) / 0.7);
  position: sticky;
  top: 0;
  z-index: 20;
}
.top-bar #openSidebar { color: rgb(var(--ink)) !important; font-size: 1.35rem; }
.page-title { flex: 1; min-width: 0; text-align: center; line-height: 1.2; }
.page-title-main {
  font-size: 1rem;
  font-weight: 700;
  color: rgb(var(--ink));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.page-title-sub {
  font-size: 0.7rem;
  color: rgb(var(--muted));
  margin-top: 0.1rem;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.page-title-sub code { font-size: 0.65rem; padding: 0 0.2rem; }
@media (min-width: 1024px) {
  .top-bar #openSidebar { visibility: hidden; }
  .page-title-main { font-size: 1.1rem; }
  .page-title-sub { font-size: 0.75rem; }
}
.nav-link { border-radius: 0.75rem !important; }
.nav-link:hover, .hover\:bg-blue-50:hover { background-color: rgb(var(--primary-soft)) !important; color: rgb(var(--ink)) !important; }
.nav-link.active {
  background: var(--gradient) !important;
  color: rgb(var(--ink)) !important;
  font-weight: 600 !important;
  box-shadow: 0 6px 16px -8px rgba(214, 160, 0, 0.6);
}
.nav-link.active .w-5, .nav-link.active:hover { color: rgb(var(--ink)) !important; }

/* Cards */
.bg-white.shadow-lg, .bg-white.shadow, .bg-white.shadow-sm.rounded-lg, .bg-white.rounded-lg {
  background: var(--surface) !important;
  border: 1px solid rgb(var(--border)) !important;
}
.shadow-lg { box-shadow: var(--shadow-lg) !important; }
.shadow, .shadow-md { box-shadow: var(--shadow) !important; }
.rounded-lg { border-radius: 1.25rem !important; }
.rounded-md { border-radius: var(--radius) !important; }
.rounded-button, .\!rounded-button { border-radius: var(--radius) !important; }

/* Form controls */
input, select, textarea { transition: border-color .15s, box-shadow .15s, background-color .15s; }
input.border-gray-300, select.border-gray-300, textarea.border-gray-300 {
  border-color: rgb(var(--border)) !important;
  background-color: rgb(var(--field));
  padding-top: 0.625rem;
  padding-bottom: 0.625rem;
}
input.border-gray-300:focus, select.border-gray-300:focus, textarea.border-gray-300:focus {
  background-color: #fff;
  border-color: rgb(var(--primary)) !important;
  box-shadow: 0 0 0 4px rgb(var(--primary) / 0.25) !important;
}
.relative > .absolute.left-0 .text-gray-400 { color: rgb(var(--ink)) !important; }
input.bg-gray-50[readonly] {
  background-color: rgb(var(--accent-soft)) !important;
  border-color: rgb(var(--primary) / 0.45) !important;
  color: rgb(var(--ink)) !important;
  font-weight: 600;
}

/* Secondary button (Effacer) */
button.bg-gray-200 {
  background-color: rgb(var(--dark)) !important;
  color: #fff !important;
  border: 1px solid rgb(var(--dark));
}
button.bg-gray-200:hover { background-color: #000 !important; }

/* Neutral palette (warm) */
.text-gray-900, .text-gray-800 { color: rgb(var(--ink)) !important; }
.text-gray-700 { color: #2b2a27 !important; }
.text-gray-600 { color: #4a463d !important; }
.text-gray-500 { color: rgb(var(--muted)) !important; }
.text-gray-400 { color: #a39d8c !important; }
.hover\:text-gray-700:hover, .hover\:text-gray-600:hover { color: rgb(var(--ink)) !important; }
.border-gray-100, .border-gray-200, .border-t, .divide-gray-200 > * + * { border-color: rgb(var(--border)) !important; }
.bg-gray-50 { background-color: rgb(var(--field)) !important; }
.bg-gray-100 { background-color: #fbf4dc !important; }
.bg-gray-200 { background-color: #f4ebcd !important; }
.hover\:bg-gray-50:hover, .hover\:bg-gray-100:hover { background-color: #fbf4dc !important; }
.hover\:bg-gray-300:hover { background-color: #efe3bb !important; }

/* Accent badges */
.bg-blue-50 { background-color: rgb(var(--primary-soft)) !important; }
.bg-blue-100 { background-color: #fff0a8 !important; }
.text-blue-700 { color: rgb(var(--primary-ink)) !important; }
.bg-purple-100 { background-color: #fff0a8 !important; }
.text-purple-700 { color: rgb(var(--primary-ink)) !important; }

/* Status colors */
.text-green-500, .text-green-600 { color: rgb(var(--success)) !important; }
.text-green-700 { color: #047857 !important; }
.bg-green-100 { background-color: #d1fae5 !important; }
.text-red-500 { color: rgb(var(--danger)) !important; }
.hover\:text-red-700:hover { color: #b91c1c !important; }
.bg-red-100 { background-color: #fee2e2 !important; }

/* History type badges */
.badge-transfert { background-color: #fff0a8; color: #7a5600; }
.badge-depot { background-color: #d1fae5; color: #047857; }
.badge-retrait { background-color: #ffe4cc; color: #b45309; }
.badge-epargne { background-color: #e0f2fe; color: #0369a1; }

.filter-chip {
  border: 1px solid rgb(var(--border));
  background-color: #fff;
  color: #4a463d;
  transition: all .15s;
}
.filter-chip:hover { border-color: rgb(var(--primary)); color: rgb(var(--ink)); }
.filter-chip.active {
  background: var(--gradient);
  border-color: transparent;
  color: rgb(var(--ink));
  font-weight: 600;
  box-shadow: 0 6px 16px -8px rgba(214, 160, 0, 0.6);
}

/* Saved numbers */
.contacts-box { margin-top: 0.5rem; }
.contacts-dropdown {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  z-index: 30;
  background-color: #fff;
  border: 1px solid rgb(var(--border));
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 0.25rem;
}
.contacts-dropdown-title {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #a39d8c;
  padding: 0.35rem 0.5rem 0.25rem;
}
.contacts-manage { text-transform: none; letter-spacing: 0; font-size: 0.7rem; color: rgb(var(--primary-ink)); font-weight: 600; }
.contacts-manage:hover { text-decoration: underline; }
.contacts-scroll {
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #e5d9b0 transparent;
}
.contacts-scroll::-webkit-scrollbar { width: 6px; }
.contacts-scroll::-webkit-scrollbar-thumb { background-color: #e5d9b0; border-radius: 999px; }
.contact-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.5rem;
  border-radius: 0.6rem;
  cursor: pointer;
}
.contact-option:hover, .contact-option.highlighted { background-color: #fbf4dc; }
.contact-option.selected { background-color: rgb(var(--primary-soft)); }
.contact-avatar {
  flex-shrink: 0;
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 999px;
  background: var(--gradient);
  color: rgb(var(--ink));
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.contact-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.contact-name { font-size: 0.85rem; font-weight: 600; color: rgb(var(--ink)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-phone { font-size: 0.75rem; color: rgb(var(--muted)); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.contact-remove { padding: 0.35rem; color: #a39d8c; border-radius: 0.5rem; }
.contact-remove:hover { color: rgb(var(--danger)); background-color: #fee2e2; }
.contact-save {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: rgb(var(--ink));
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  border: 1px dashed rgb(var(--primary-2));
  background-color: rgb(var(--primary-soft) / 0.6);
}
.contact-save:hover { background-color: rgb(var(--primary-soft)); }

/* Bottom navigation (mobile) */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 35;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: end;
  padding: 0.45rem 0.25rem calc(0.45rem + env(safe-area-inset-bottom));
  background: rgb(var(--dark));
  border-top-left-radius: 1.25rem;
  border-top-right-radius: 1.25rem;
  box-shadow: 0 -8px 24px -12px rgba(0, 0, 0, 0.35);
}
.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.68rem;
  font-weight: 500;
  text-align: center;
  line-height: 1.15;
}
.bottom-nav a i { font-size: 1.3rem; line-height: 1; }
.bottom-nav a.active { color: rgb(var(--primary)); }
.bottom-nav .bottom-nav-main i {
  width: 3.4rem;
  height: 3.4rem;
  margin-top: -1.9rem;
  border-radius: 1.1rem;
  background: var(--gradient);
  color: rgb(var(--ink));
  font-size: 1.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 4px solid rgb(var(--dark));
  box-shadow: 0 6px 16px -4px rgba(255, 196, 0, 0.55);
}
.bottom-nav .bottom-nav-main { color: #fff; }
body.has-bottom-nav main { padding-bottom: 5.5rem; }
body.has-bottom-nav .sticky.bottom-0 { bottom: calc(4.4rem + env(safe-area-inset-bottom)); }
body.has-bottom-nav .pwa-status { bottom: calc(5.2rem + env(safe-area-inset-bottom)); }
@media (min-width: 1024px) {
  .bottom-nav { display: none; }
  body.has-bottom-nav main { padding-bottom: 0; }
  body.has-bottom-nav .sticky.bottom-0 { bottom: 0; }
  body.has-bottom-nav .pwa-status { bottom: 1rem; }
}

/* Home (Accueil) */
.home-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1.1rem;
}
.home-header .home-hello { flex: 1; font-size: 0.95rem; font-weight: 500; }
.home-header a, .home-header button { color: rgb(var(--ink)); font-size: 1.45rem; line-height: 1; position: relative; }
.home-dot { position: absolute; top: 0; right: 0; width: 0.5rem; height: 0.5rem; border-radius: 999px; background: rgb(var(--ink)); border: 2px solid #fff6d6; }
.home-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.1rem 0.4rem;
  padding: 1rem 0.75rem;
}
.home-action { display: flex; flex-direction: column; align-items: center; gap: 0.45rem; text-align: center; color: rgb(var(--ink)); }
.home-action i { font-size: 1.65rem; line-height: 1; }
.home-action span { font-size: 0.75rem; line-height: 1.2; }
.home-action:active i { transform: scale(0.92); }
.home-banner {
  margin: 0.5rem 1rem 0;
  border-radius: 1rem;
  background: var(--gradient);
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  overflow: hidden;
  position: relative;
}
.home-banner::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-radial-gradient(circle at 0% 50%, rgba(255, 255, 255, 0.18) 0 2px, transparent 2px 14px);
  pointer-events: none;
}
.home-banner-text { flex: 1; font-size: 1.15rem; font-weight: 600; line-height: 1.25; position: relative; }
.home-banner-box {
  position: relative;
  background: rgb(var(--dark));
  color: #fff;
  border-radius: 0.9rem;
  padding: 0.6rem 0.75rem;
  display: flex;
  gap: 0.6rem;
  border: 2px solid rgba(255, 255, 255, 0.7);
}
.home-banner-box div { line-height: 1.1; }
.home-banner-box small { display: block; font-size: 0.55rem; font-weight: 600; letter-spacing: 0.04em; opacity: 0.85; }
.home-banner-box strong { display: block; font-size: 1.15rem; color: rgb(var(--primary)); font-weight: 800; }
.home-banner-box + .home-banner-box { margin-left: 0; }
.home-banner-sep { width: 1px; background: rgba(255, 255, 255, 0.3); }
.home-section-title { font-size: 1.05rem; font-weight: 700; padding: 1.4rem 1.1rem 0.75rem; display: flex; align-items: center; justify-content: space-between; }
.home-section-title a { font-size: 0.75rem; font-weight: 600; color: rgb(var(--primary-ink)); }
.home-people { display: flex; gap: 0.9rem; overflow-x: auto; touch-action: pan-x pan-y; overscroll-behavior-x: contain; padding: 0 1.1rem 0.5rem; scrollbar-width: none; }
.home-people::-webkit-scrollbar { display: none; }
.home-person { flex-shrink: 0; width: 4rem; display: flex; flex-direction: column; align-items: center; gap: 0.35rem; color: rgb(var(--ink)); }
.home-person-avatar {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 999px;
  background: var(--gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.15rem;
}
.home-person-avatar.add { background: #fff; border: 2px dashed rgb(var(--primary-2)); font-size: 1.4rem; }
.home-person > span:last-child { font-size: 0.68rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-recent { margin: 0 1rem; background: #fff; border: 1px solid rgb(var(--border)); border-radius: 1rem; overflow: hidden; }
.home-recent-row { display: flex; align-items: center; gap: 0.7rem; padding: 0.65rem 0.8rem; }
.home-recent-row + .home-recent-row { border-top: 1px solid rgb(var(--border)); }
.home-recent-icon { width: 2.1rem; height: 2.1rem; border-radius: 0.7rem; background: rgb(var(--primary-soft)); display: flex; align-items: center; justify-content: center; font-size: 1.05rem; flex-shrink: 0; }
.home-recent-main { flex: 1; min-width: 0; line-height: 1.25; }
.home-recent-main strong { display: block; font-size: 0.8rem; }
.home-recent-main span { display: block; font-size: 0.7rem; color: rgb(var(--muted)); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-recent-amount { font-size: 0.8rem; font-weight: 700; white-space: nowrap; }
.home-empty { padding: 1rem; text-align: center; font-size: 0.75rem; color: rgb(var(--muted)); }

/* PWA status */
.pwa-status {
  position: fixed;
  left: 50%;
  bottom: calc(1rem + env(safe-area-inset-bottom));
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  max-width: calc(100% - 2rem);
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  color: #fff;
  background: rgba(28, 28, 30, 0.92);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 1rem);
  transition: opacity .2s, transform .2s;
}
.pwa-status i { color: rgb(var(--primary)); }
.pwa-status.show { opacity: 1; transform: translate(-50%, 0); }

/* Overlay */
#overlay { background-color: rgba(20, 16, 0, 0.45) !important; opacity: 1 !important; backdrop-filter: blur(4px); }
.bg-black\/50 { background-color: rgba(20, 16, 0, 0.45) !important; backdrop-filter: blur(4px); }

/* Scrollbar */
* { scrollbar-width: thin; scrollbar-color: #e5d9b0 transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #e5d9b0; border-radius: 999px; }
::-webkit-scrollbar-track { background: transparent; }
