/* ═══════════════════════════════════════════════════════════
   ZenoiaIQ Design System v5.0
   "Friendly Hybrid" — Swiss Precision · Genève
   Responsive: Mobile-first + Desktop sidebar
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,300;9..40,400;9..40,500;9..40,600;9..40,700;9..40,800&display=swap');

/* ── CSS Variables ── */
html { background: #2A2A3C; }
/* JS switches html bg on login/logout — CSS fallback */
body.z-authenticated { background: var(--z-bg); }
/* Fix iOS safe-area white/dark bar: html bg must match app bg when authenticated */
html:has(body.z-authenticated) { background: var(--z-bg, #F8F7FC) !important; }
:root {
  --z-font: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  --z-bg: #F8F7FC;
  --z-surface: #FFFFFF;
  --z-surface2: #EEECF4;
  --z-text: #1A1632;
  --z-text2: #6B6580;
  --z-text3: #A8A3B8;
  --z-accent: #7C3AED;
  --z-accent-dark: #5B21B6;
  --z-accent-light: #EDE9FE;
  --z-border: #E8E5F0;
  --z-border2: #F0EEF6;
  --z-tab-bg: rgba(248,247,252,0.92);
  --z-radius: 14px;
  --z-radius-sm: 10px;
  --z-shadow: 0 1px 3px rgba(26,22,50,0.04);
  --z-shadow-md: 0 4px 16px rgba(26,22,50,0.06);
  --z-transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --sidebar-width: 0px;
}

[data-theme="dark"] {
  --z-bg: #0C0A14;
  --z-surface: #1A1826;
  --z-surface2: #252336;
  --z-text: #F5F3FA;
  --z-text2: #9B95B0;
  --z-text3: #4A4560;
  --z-accent: #A78BFA;
  --z-accent-dark: #7C3AED;
  --z-accent-light: #2D2350;
  --z-border: #2A2740;
  --z-border2: #1E1C30;
  --z-tab-bg: rgba(12,10,20,0.92);
  --z-shadow: 0 1px 3px rgba(0,0,0,0.3);
  --z-shadow-md: 0 4px 16px rgba(0,0,0,0.2);
}

/* ═══════════════════════════════════════
   RESPONSIVE BREAKPOINTS
   ═══════════════════════════════════════ */

@media (min-width: 1024px) {
  :root { --sidebar-width: 250px; }
}

/* Admin debug: force mobile view on desktop */
body.z-force-mobile { --sidebar-width: 0px !important; }
body.z-force-mobile .z-sidebar { display: none !important; }
body.z-force-mobile #zenoiaFloatingNav { display: flex !important; }
body.z-force-mobile .z-desktop-only { display: none !important; }
body.z-force-mobile .z-app-main { max-width: 480px; padding-bottom: 90px; }
body.z-force-mobile #moreScreen .z-more-content,
body.z-force-mobile #moreScreen .z-more-header { max-width: 480px; }
body.z-force-mobile [id$="Screen"]:not(#loginScreen):not(#signupScreen):not(#planSelectionScreen):not(#verificationScreen):not(#deniedScreen):not(#onboardingScreen):not(#twoFactorScreen):not(#resetPasswordScreen):not(#forgotPasswordScreen) {
  margin-left: 0 !important;
}

/* ═══════════════════════════════════════
   GLOBAL RESET
   ═══════════════════════════════════════ */

*, *::before, *::after {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  box-sizing: border-box;
}

html, body {
  margin: 0; padding: 0; height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  font-family: var(--z-font) !important;
  background: var(--z-bg) !important;
  color: var(--z-text);
  transition: background 0.3s ease, color 0.3s ease;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
}

/* Prevent white flash on overscroll / safe area */
body.z-authenticated,
body.z-authenticated #app,
body.z-authenticated .z-shell,
body.z-authenticated .z-shell-content,
body.z-authenticated .z-app-main {
  background: var(--z-bg, #F8F7FC);
}

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

/* ═══════════════════════════════════════
   SPLASH SCREEN
   ═══════════════════════════════════════ */

#zenoiaSplash {
  position: fixed; inset: 0; z-index: 9999;
  background: #08080F;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  transition: opacity 0.4s ease;
}
#zenoiaSplash.z-hide { opacity: 0; pointer-events: none; }
#zenoiaSplash .z-logo { opacity: 0; animation: zLogoIn 0.7s cubic-bezier(.16,1,.3,1) 0.3s forwards; }
#zenoiaSplash .z-tagline {
  font-size: 9px; font-weight: 500; color: #F5F5F7;
  letter-spacing: 0.25em; text-transform: uppercase;
  margin-top: 10px; opacity: 0;
  animation: zTagIn 0.5s ease 0.7s forwards;
}
#zenoiaSplash .z-dots { display: flex; gap: 4px; margin-top: 36px; }
#zenoiaSplash .z-dot {
  width: 4px; height: 4px; border-radius: 2px;
  background: #7C3AED; animation: zDotPulse 1s ease infinite;
}
#zenoiaSplash .z-dot:nth-child(2) { animation-delay: 0.15s; }
#zenoiaSplash .z-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes zLogoIn { 0% { opacity: 0; letter-spacing: 0.2em; } 100% { opacity: 1; letter-spacing: -0.02em; } }
@keyframes zTagIn { 0% { opacity: 0; } 100% { opacity: 0.4; } }
@keyframes zDotPulse { 0%,100% { opacity: 0.2; } 50% { opacity: 0.7; } }
@keyframes zFadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.z-fade-up { animation: zFadeUp 0.35s ease-out both; }
@keyframes pulse-dot { 0%,100%{opacity:1} 50%{opacity:0.4} }

/* ═══════════════════════════════════════
   ZENOIA LOGO (reusable)
   ═══════════════════════════════════════ */

.z-logo-text {
  display: inline-flex; align-items: baseline;
  letter-spacing: -0.02em; line-height: 1;
}
.z-logo-text .z-name { font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 300; color: var(--z-text); letter-spacing: -0.02em; }
.z-logo-text .z-iq { font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 800; color: #7C3AED; margin-left: 1px; letter-spacing: -0.05em; }
#zenoiaSplash .z-logo-text .z-name { color: #F5F5F7; }
[data-theme="dark"] .z-logo-text .z-iq { color: #A78BFA; }

.z-logo-sm .z-name { font-size: 16px; } .z-logo-sm .z-iq { font-size: 17px; }
.z-logo-md .z-name { font-size: 22px; } .z-logo-md .z-iq { font-size: 24px; }
.z-logo-lg .z-name { font-size: 32px; } .z-logo-lg .z-iq { font-size: 35px; }
.z-logo-xl .z-name { font-size: 38px; } .z-logo-xl .z-iq { font-size: 42px; }

/* ═══════════════════════════════════════
   LOGIN SCREEN
   ═══════════════════════════════════════ */

#loginScreen, #signupScreen, #planSelectionScreen,
#verificationScreen, #deniedScreen, #onboardingScreen {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  overflow-y: auto;
  z-index: 100;
}
#twoFactorScreen { z-index: 100; }
#loginScreen { background: #08080F !important; }
/* Card only — not the wrapper */
.z-login-card {
  background: var(--z-surface) !important;
  border: 0.5px solid var(--z-border);
  border-radius: 20px !important;
  box-shadow: 0 8px 40px rgba(0,0,0,0.12) !important;
}
@media (min-width: 1024px) {
  .z-login-card {
    background: #FFFFFF !important;
    border-color: rgba(0,0,0,0.06);
  }
}

/* ═══════════════════════════════════════
   DESKTOP SIDEBAR
   ═══════════════════════════════════════ */

.z-sidebar {
  display: none;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--z-surface);
  border-right: 1px solid var(--z-border);
  z-index: 90;
  flex-direction: column;
  padding: 20px 12px;
  overflow: hidden;
}

@media (min-width: 1024px) {
  body.z-authenticated:not(.z-force-mobile) .z-sidebar { display: flex; }
  body.z-authenticated:not(.z-force-mobile) #zenoiaFloatingNav { display: none !important; }

  /* Shift all screens right for sidebar — ONLY when authenticated */
  /* Absolute-positioned screens use left */
  body.z-authenticated:not(.z-force-mobile) #appScreen,
  body.z-authenticated:not(.z-force-mobile) #moreScreen {
    left: var(--sidebar-width);
  }
  /* Other screens use margin-left */
  body.z-authenticated:not(.z-force-mobile) #facturoScreen,
  body.z-authenticated:not(.z-force-mobile) #facturoFormScreen,
  body.z-authenticated:not(.z-force-mobile) #facturoArchivesScreen,
  body.z-authenticated:not(.z-force-mobile) #recettesScreen,
  body.z-authenticated:not(.z-force-mobile) #planifioScreen,
  body.z-authenticated:not(.z-force-mobile) #arbitroScreen,
  body.z-authenticated:not(.z-force-mobile) #inventaireScreen,
  body.z-authenticated:not(.z-force-mobile) #achatsScreen,
  body.z-authenticated:not(.z-force-mobile) #contactoScreen,
  body.z-authenticated:not(.z-force-mobile) #archivoScreen,
  body.z-authenticated:not(.z-force-mobile) #usersScreen,
  body.z-authenticated:not(.z-force-mobile) #companiesScreen,
  body.z-authenticated:not(.z-force-mobile) #auditScreen {
    margin-left: var(--sidebar-width);
  }
}

/* Sidebar logo */
.z-sidebar-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 0 12px 20px;
}
.z-sidebar-logo-icon {
  width: 34px; height: 34px; border-radius: 10px;
  background: #1A1632;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}
.z-sidebar-logo-icon::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, #7C3AED, #A855F7);
}
.z-sidebar-logo-icon svg { width: 16px; height: 16px; stroke: white; stroke-width: 2.5; fill: none; }

/* Sidebar company selector */
.z-sidebar-company {
  margin: 0 4px 16px;
  padding: 10px 12px;
  background: var(--z-bg);
  border-radius: 12px;
  display: flex; align-items: center; gap: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--z-transition);
  position: relative;
}
.z-sidebar-company:hover { border-color: var(--z-border); }
.z-sb-select-hidden { display: none; }
.z-sb-company-name {
  flex: 1; font-size: 13px; font-weight: 600; color: var(--z-text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  min-width: 0;
}
.z-sb-chevron {
  display: flex; align-items: center; color: var(--z-text3);
  flex-shrink: 0; transition: transform 0.2s;
}
.z-sidebar-company.dd-open { border-color: var(--z-accent); background: var(--z-surface); }
.z-sidebar-company.dd-open .z-sb-chevron { transform: rotate(180deg); }
.z-sb-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px); left: 0; right: 0;
  background: var(--z-surface);
  border: 1px solid var(--z-border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,0,0,0.04);
  z-index: 200; padding: 4px; overflow: hidden;
}
.z-sb-dropdown.open { display: block; animation: z-dd-in 0.15s ease-out; }
.z-sb-dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 8px;
  cursor: pointer; transition: background 0.15s;
  font-size: 13px; font-weight: 500; color: var(--z-text);
}
.z-sb-dropdown-item:hover { background: var(--z-bg); }
.z-sb-dropdown-item.active { background: rgba(124,58,237,0.08); color: #7C3AED; font-weight: 600; }
.z-sb-dropdown-item .z-sb-dd-emoji { font-size: 16px; width: 24px; text-align: center; flex-shrink: 0; }
.z-sb-dropdown-item .z-sb-dd-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.z-sb-dropdown-item .z-sb-dd-check { flex-shrink: 0; color: #7C3AED; display: none; }
.z-sb-dropdown-item.active .z-sb-dd-check { display: flex; }
.z-sb-dropdown-overlay { display: none; position: fixed; inset: 0; z-index: 199; }
.z-sb-dropdown-overlay.open { display: block; }

/* Sidebar search */
.z-sidebar-search {
  margin: 0 4px 14px;
  padding: 8px 12px;
  background: var(--z-bg);
  border-radius: 10px;
  display: flex; align-items: center; gap: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--z-transition);
}
.z-sidebar-search:hover { border-color: var(--z-border); }
.z-sidebar-search svg { width: 14px; height: 14px; stroke: var(--z-text3); stroke-width: 2; fill: none; flex-shrink: 0; }
.z-sidebar-search span { font-size: 12px; color: var(--z-text3); }
.z-sidebar-search-kbd {
  margin-left: auto;
  font-size: 10px; padding: 2px 6px;
  background: var(--z-surface);
  border-radius: 4px; color: var(--z-text3);
  border: 1px solid var(--z-border);
  font-family: monospace;
}

/* Sidebar nav items */
.z-sidebar-nav { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.z-sidebar-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 10px;
  cursor: pointer; background: transparent;
  border: none; width: 100%; text-align: left;
  font-family: var(--z-font);
  transition: all 0.15s ease;
}
.z-sidebar-item:hover { background: var(--z-bg); }
.z-sidebar-item.active { background: var(--z-accent-light); }
[data-theme="dark"] .z-sidebar-item.active { background: var(--z-accent-light); }
.z-sidebar-item svg {
  width: 18px; height: 18px;
  stroke: var(--z-text2); stroke-width: 1.6; fill: none;
  transition: var(--z-transition);
  flex-shrink: 0;
}
.z-sidebar-item.active svg { stroke-width: 2; }
.z-sidebar-item-label {
  font-size: 13px; font-weight: 500; color: var(--z-text);
  letter-spacing: -0.01em;
}
.z-sidebar-item.active .z-sidebar-item-label { font-weight: 650; }
.z-sidebar-item-dot {
  margin-left: auto;
  width: 6px; height: 6px; border-radius: 50%;
  display: none;
}
.z-sidebar-item.active .z-sidebar-item-dot { display: block; }

/* Sidebar divider */
.z-sidebar-divider { height: 1px; background: var(--z-border); margin: 8px 12px; }

/* Sidebar bottom */
.z-sidebar-bottom {
  flex-shrink: 0;
  padding-top: 4px;
  display: flex; flex-direction: column; gap: 1px;
}
.z-sidebar-bottom .z-sidebar-item { padding: 7px 12px; }
.z-sidebar-bottom .z-sidebar-item-label { font-size: 12px; }
.z-sidebar-user {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; margin-top: 4px;
}
.z-sidebar-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #7C3AED 0%, #EC4899 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: white; font-weight: 700;
  flex-shrink: 0;
}
.z-sidebar-user-name { font-size: 12px; font-weight: 600; color: var(--z-text); }
.z-sidebar-user-plan { font-size: 10px; color: var(--z-text3); }

/* ═══════════════════════════════════════
   DEBUG MODE BADGE
   ═══════════════════════════════════════ */

.z-debug-badge {
  position: fixed; bottom: 80px; right: 12px; z-index: 9998;
  background: linear-gradient(135deg, #EF4444, #DC2626);
  color: white;
  padding: 6px 12px; border-radius: 8px;
  font-size: 11px; font-weight: 700;
  cursor: pointer; display: none;
  font-family: var(--z-font);
  box-shadow: 0 2px 12px rgba(239,68,68,0.3);
  align-items: center; gap: 6px;
  user-select: none;
  transition: var(--z-transition);
}
.z-debug-badge:hover { transform: scale(1.05); }
body.z-force-mobile .z-debug-badge { display: none; }
body.z-authenticated.z-force-mobile .z-debug-badge { display: flex; }

/* ═══════════════════════════════════════
   MAIN APP HEADER
   ═══════════════════════════════════════ */

/* ── Unified App Header (mobile + desktop) ── */
.z-app-header {
  flex-shrink: 0;
  padding: 14px 0 10px;
  padding-top: calc(env(safe-area-inset-top, 14px) + 6px);
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--z-bg);
}
.z-app-header-row1 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.z-app-header-greeting { flex: 1; min-width: 0; }
.z-mg-brand {
  font-size: 11px; font-weight: 700; color: var(--z-accent);
  letter-spacing: 0.03em; margin: 0 0 2px;
  text-transform: none;
}
.z-mobile-only { display: block; }
@media (min-width: 1024px) {
  body:not(.z-force-mobile) .z-mobile-only { display: none !important; }
}
body.z-force-mobile .z-mobile-only { display: block !important; }
.z-app-header-actions {
  display: flex; align-items: center; gap: 6px;
  flex-shrink: 0;
}
.z-app-header-row2 {
  position: relative;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}
/* Desktop-only buttons */
.z-desktop-only { display: none !important; }
@media (min-width: 1024px) {
  body:not(.z-force-mobile) .z-desktop-only { display: inline-flex !important; }
  body:not(.z-force-mobile) .z-app-header {
    padding-top: 24px;
    padding-bottom: 12px;
  }
  /* Hide company pill on desktop — sidebar already has it */
  body:not(.z-force-mobile) .z-app-header-row2 { display: none; }
  body:not(.z-force-mobile) .z-mg-greeting { font-size: 22px; }
}
body.z-force-mobile .z-desktop-only { display: none !important; }
/* Mobile Search Pill */
.z-mobile-search-pill {
  flex: 1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  background: #F0EDF6;
  border: 1px solid rgba(124,58,237,0.08);
  border-radius: 12px;
  font-size: 13px;
  color: #9C97B2;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  white-space: nowrap;
  overflow: hidden;
}
.z-mobile-search-pill:active {
  background: #E8E3F0;
  transform: scale(0.98);
}
.z-mobile-search-pill svg { flex-shrink: 0; opacity: 0.6; }
@media (min-width: 1024px) {
  body:not(.z-force-mobile) .z-mobile-search-pill { display: none; }
}

/* Inventory Toggle — Facturo */
/* Inventory Toggle — refined */
.z-inv-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
  -webkit-tap-highlight-color: transparent;
}
.z-inv-toggle.active {
  background: linear-gradient(135deg, rgba(124,58,237,0.04) 0%, rgba(124,58,237,0.08) 100%);
  box-shadow: inset 0 0 0 1px rgba(124,58,237,0.15);
}
.z-inv-toggle:not(.active) {
  background: #F5F4F7;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.04);
}
.z-inv-toggle:active { transform: scale(0.985); }

/* Switch track */
.z-inv-toggle-switch {
  width: 44px; height: 26px;
  border-radius: 13px;
  position: relative;
  flex-shrink: 0;
  transition: background 0.3s cubic-bezier(0.4,0,0.2,1);
}
.z-inv-toggle.active .z-inv-toggle-switch {
  background: #7C3AED;
  box-shadow: 0 2px 8px rgba(124,58,237,0.3);
}
.z-inv-toggle:not(.active) .z-inv-toggle-switch {
  background: #D4D2DC;
  box-shadow: none;
}

/* Switch thumb */
.z-inv-toggle-thumb {
  width: 22px; height: 22px;
  border-radius: 11px;
  background: #fff;
  position: absolute;
  top: 2px;
  transition: left 0.3s cubic-bezier(0.34,1.56,0.64,1);
  box-shadow: 0 1px 4px rgba(0,0,0,0.1), 0 0 0 0.5px rgba(0,0,0,0.03);
}
.z-inv-toggle.active .z-inv-toggle-thumb { left: 20px; }
.z-inv-toggle:not(.active) .z-inv-toggle-thumb { left: 2px; }

/* Content */
.z-inv-toggle-content {
  display: flex;
  flex-direction: column;
  gap: 1px;
  text-align: left;
}
.z-inv-toggle-label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: color 0.3s;
}
.z-inv-toggle.active .z-inv-toggle-label { color: #1A1632; }
.z-inv-toggle:not(.active) .z-inv-toggle-label { color: #B0AEC0; }
.z-inv-toggle-sub {
  font-size: 11px;
  font-weight: 400;
  transition: color 0.3s;
}
.z-inv-toggle.active .z-inv-toggle-sub { color: #7C3AED; }
.z-inv-toggle:not(.active) .z-inv-toggle-sub { color: #CFCDD8; }

.z-mg-company {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px 7px 7px;
  background: var(--z-surface);
  border-radius: 14px;
  border: 1px solid var(--z-border);
  box-shadow: 0 1px 4px rgba(0,0,0,0.05), 0 0 0 0.5px rgba(124,58,237,0.08);
  transition: all 0.2s;
  position: relative;
  cursor: pointer;
}
.z-mg-company:active { transform: scale(0.97); }
.z-mg-company-icon {
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--z-surface);
  border: 1px solid var(--z-border);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 16px; line-height: 1;
}
.z-mg-select { display: none; }
.z-mg-selected {
  font-size: 14px; font-weight: 600;
  color: var(--z-text); cursor: pointer;
  max-width: 160px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.z-mg-chevron {
  display: flex; align-items: center;
  color: var(--z-text3); flex-shrink: 0;
  transition: transform 0.2s;
}
.z-mg-greeting {
  font-size: 18px; font-weight: 700; color: var(--z-text);
  margin: 0; letter-spacing: -0.02em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.z-mg-subtitle {
  font-size: 11px; color: var(--z-text2); margin: 2px 0 0;
}

/* Custom company dropdown */
.z-mg-select { display: none; }
.z-mg-selected {
  font-size: 14px; font-weight: 600;
  color: var(--z-text); cursor: pointer;
  max-width: 160px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.z-mg-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 220px; max-width: 300px;
  background: var(--z-surface);
  border: 1px solid var(--z-border);
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,0,0,0.04);
  z-index: 200;
  padding: 6px;
  overflow: hidden;
}
.z-mg-dropdown.open { display: block; animation: z-dd-in 0.15s ease-out; }
@keyframes z-dd-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.z-mg-company.dd-open .z-mg-chevron { transform: rotate(180deg); }
.z-mg-company.dd-open { border-color: var(--z-accent); box-shadow: 0 1px 4px rgba(124,58,237,0.12), 0 0 0 1px rgba(124,58,237,0.15); }
.z-mg-dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
  font-size: 14px; font-weight: 500;
  color: var(--z-text);
}
.z-mg-dropdown-item:hover { background: var(--z-bg); }
.z-mg-dropdown-item:active { background: var(--z-surface2); }
.z-mg-dropdown-item.active {
  background: rgba(124,58,237,0.08);
  color: #7C3AED;
  font-weight: 600;
}
.z-mg-dropdown-item .z-mg-dd-emoji {
  font-size: 18px; width: 28px; text-align: center; flex-shrink: 0;
}
.z-mg-dropdown-item .z-mg-dd-name {
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.z-mg-dropdown-item .z-mg-dd-check {
  flex-shrink: 0; color: #7C3AED; display: none;
}
.z-mg-dropdown-item.active .z-mg-dd-check { display: flex; }
.z-mg-dropdown-overlay {
  display: none; position: fixed; inset: 0; z-index: 199;
}
.z-mg-dropdown-overlay.open { display: block; }

/* Header action buttons */
.z-header-btn {
  width: 36px; height: 36px; border-radius: 12px;
  background: var(--z-surface2);
  border: 0.5px solid var(--z-border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: var(--z-transition);
  position: relative; padding: 0;
}
.z-header-btn:hover { background: var(--z-border); }
.z-header-btn svg { width: 16px; height: 16px; stroke: var(--z-text2); stroke-width: 1.8; fill: none; }

.z-notif-dot {
  position: absolute; top: 6px; right: 6px;
  width: 7px; height: 7px; border-radius: 50%;
  background: #EF4444; border: 2px solid var(--z-surface);
}

.z-header-avatar {
  width: 36px; height: 36px; border-radius: 12px;
  background: linear-gradient(135deg, #7C3AED 0%, #EC4899 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: white; font-weight: 700;
  cursor: pointer; flex-shrink: 0;
}

/* Hide mobile header on desktop; show desktop header */
@media (min-width: 1024px) {
  body:not(.z-force-mobile) .z-app-main {
    max-width: min(960px, 100%);
    padding: 0 32px 32px;
    box-sizing: border-box;
  }
}

/* ═══════════════════════════════════════
   APP SCREEN LAYOUT
   ═══════════════════════════════════════ */

#appScreen {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex; flex-direction: column;
  background: var(--z-bg);
  overflow: hidden;
}
#appScreen.hidden { display: none !important; }
/* Universal hidden class — don't rely solely on Tailwind CDN */
.hidden { display: none !important; }

/* All module screens: absolute on desktop to properly overlay */
@media (min-width: 1024px) {
  body:not(.z-force-mobile) #facturoScreen,
  body:not(.z-force-mobile) #facturoFormScreen,
  body:not(.z-force-mobile) #facturoArchivesScreen,
  body:not(.z-force-mobile) #recettesScreen,
  body:not(.z-force-mobile) #planifioScreen,
  body:not(.z-force-mobile) #arbitroScreen,
  body:not(.z-force-mobile) #inventaireScreen,
  body:not(.z-force-mobile) #achatsScreen,
  body:not(.z-force-mobile) #contactoScreen,
  body:not(.z-force-mobile) #archivoScreen,
  body:not(.z-force-mobile) #usersScreen,
  body:not(.z-force-mobile) #companiesScreen,
  body:not(.z-force-mobile) #auditScreen {
    position: absolute;
    top: 0; left: var(--sidebar-width); right: 0; bottom: 0;
    overflow-y: auto; overflow-x: hidden;
   
    z-index: 10;
    margin-left: 0 !important;
  }
}

.z-app-main {
  flex: 1 1 0%;
  display: flex; flex-direction: column;
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
  padding: 0;
  padding-top: calc(env(safe-area-inset-top, 14px) + 56px);
  padding-bottom: 90px;
  min-height: 0;
  box-sizing: border-box;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 1024px) {
  body:not(.z-force-mobile) #facturoScreen .max-w-2xl,
  body:not(.z-force-mobile) #recettesScreen .max-w-2xl,
  body:not(.z-force-mobile) #arbitroScreen .max-w-2xl,
  body:not(.z-force-mobile) #inventaireScreen .max-w-2xl,
  body:not(.z-force-mobile) #achatsScreen .max-w-2xl,
  body:not(.z-force-mobile) #contactoScreen .max-w-2xl,
  body:not(.z-force-mobile) #archivoScreen .max-w-2xl {
    max-width: 56rem;
  }
}

/* Desktop action buttons */
@media (min-width: 1024px) {
  body:not(.z-force-mobile) .z-app-main { padding-bottom: 32px; overflow-y: auto; }
}
.z-desktop-action-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 10px;
  font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: var(--z-font);
  border: none; transition: var(--z-transition);
}
.z-desktop-action-btn.primary { background: var(--z-accent); color: white; }
.z-desktop-action-btn.primary:hover { background: var(--z-accent-dark); }
.z-desktop-action-btn.secondary { background: var(--z-surface); color: var(--z-text); border: 1px solid var(--z-border); }
.z-desktop-action-btn.secondary:hover { background: var(--z-bg); }
.z-desktop-action-btn svg { width: 15px; height: 15px; stroke-width: 2; fill: none; }

/* ═══════════════════════════════════════
   DASHBOARD — Widgets & Modules
   ═══════════════════════════════════════ */

#dashboardContent {
  flex: 0 0 auto;
  display: flex; flex-direction: column;
}

.z-dashboard-fixed { flex: 0 0 auto; overflow: visible; }
.z-dashboard-scroll {
  flex: 0 0 auto;
  overflow: visible;
  padding-bottom: 20px;
}

/* KPIs */
.z-kpis { display: flex; gap: 8px; margin-bottom: 14px; }
.z-kpi-card {
  flex: 1; padding: 16px 14px;
  background: var(--z-surface);
  border: 1px solid var(--z-border); border-radius: 16px;
  transition: var(--z-transition);
}
.z-kpi-card:hover { border-color: var(--z-accent); box-shadow: var(--z-shadow-md); }
.z-kpi-icon {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 8px;
}
.z-kpi-icon svg { width: 18px; height: 18px; stroke-width: 2; fill: none; }
.z-kpi-value { font-size: 24px; font-weight: 700; color: var(--z-text); letter-spacing: -0.02em; line-height: 1.1; }
.z-kpi-label { font-size: 11px; font-weight: 500; color: var(--z-text2); margin-top: 4px; }

@media (min-width: 1024px) {
  body:not(.z-force-mobile) .z-kpis { gap: 12px; }
}

/* Widgets (Team, Stock Alerts) */
.z-widget {
  background: var(--z-surface); border: 1px solid var(--z-border);
  border-radius: 16px; overflow: hidden; margin-bottom: 10px;
}
.z-widget-header {
  display: flex; align-items: center; width: 100%; padding: 12px 14px;
  background: transparent; border: none; cursor: pointer; gap: 8px;
  font-family: var(--z-font);
}
.z-widget-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.z-widget-title { flex: 1; font-size: 13px; font-weight: 700; color: var(--z-text); text-align: left; }
.z-widget-meta { font-size: 12px; font-weight: 500; color: var(--z-text3); margin-right: 4px; }
.z-widget-chevron { display: flex; align-items: center; color: var(--z-text3); }
.z-widget-body {
  padding: 0 14px 12px; overflow: hidden; max-height: 500px;
  transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
}
.z-widget-body.z-collapsed { max-height: 0; opacity: 0; padding-top: 0; padding-bottom: 0; }
.z2-compact-list.z-collapsed { max-height: 0; opacity: 0; overflow: hidden; transition: max-height 0.3s ease, opacity 0.2s ease; }
.z2-compact-list:not(.z-collapsed) { max-height: 500px; transition: max-height 0.3s ease, opacity 0.2s ease; }

/* Team Widget */
.z-team-ruler { display: flex; justify-content: space-between; padding: 0 0 4px; margin-bottom: 2px; }
.z-team-ruler span { font-size: 10px; color: var(--z-text3); font-weight: 500; font-variant-numeric: tabular-nums; }
.z-team-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.z-team-row:last-child { margin-bottom: 0; }
.z-team-avatar { width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; }
.z-team-info { flex: 1; min-width: 0; }
.z-team-meta { display: flex; align-items: center; justify-content: space-between; margin-bottom: 3px; }
.z-team-meta span { font-size: 13px; font-variant-numeric: tabular-nums; }
.z-team-bar { position: relative; height: 5px; border-radius: 2.5px; background: var(--z-surface2); }
.z-team-fill { position: absolute; top: 0; height: 100%; border-radius: 2px; transition: all 0.3s; }

/* Stock Alerts Widget */
.z-stock-badge { font-size: 10px; font-weight: 600; color: #EF4444; padding: 2px 8px; border-radius: 20px; background: #EF444410; }
[data-theme="dark"] .z-stock-badge { background: #EF444420; }
.z-stock-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.z-stock-row:last-child { margin-bottom: 0; }
.z-stock-icon { width: 24px; height: 24px; border-radius: 6px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; }
.z-stock-info { flex: 1; min-width: 0; }
.z-stock-meta { display: flex; align-items: center; justify-content: space-between; margin-bottom: 3px; }
.z-stock-name { font-size: 11px; font-weight: 600; color: var(--z-text); }
.z-stock-qty { font-size: 10px; font-weight: 500; font-variant-numeric: tabular-nums; }
.z-stock-bar { position: relative; height: 4px; border-radius: 2px; background: var(--z-surface2); }
.z-stock-fill { position: absolute; top: 0; height: 100%; border-radius: 2px; }

/* Section labels */
.z-section { margin-top: 20px; }
.z-section-label { font-size: 11px; font-weight: 700; color: var(--z-text2); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 10px; padding: 0 2px; }
.z-section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; padding: 0 2px; }
.z-section-action { font-size: 12px; color: var(--z-accent); background: none; border: none; cursor: pointer; font-weight: 600; font-family: var(--z-font); }
.z-section-action:hover { text-decoration: underline; }

/* Module Grid */
.z-modules-grid { display: grid; gap: 8px; }
.z-module-btn {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 16px 4px 12px; border-radius: 16px;
  background: var(--z-surface); border: 1px solid var(--z-border);
  cursor: pointer; font-family: var(--z-font); transition: var(--z-transition);
}
.z-module-btn:hover { transform: translateY(-2px); box-shadow: var(--z-shadow-md); }
.z-module-btn:active { transform: scale(0.97); }
.z-module-icon {
  width: 48px; height: 48px; border-radius: 14px; border: 0.5px solid;
  display: flex; align-items: center; justify-content: center;
  transition: var(--z-transition);
}
.z-module-btn:hover .z-module-icon { transform: scale(1.06); }
.z-module-name { font-size: 11px; font-weight: 600; color: var(--z-text); letter-spacing: -0.01em; }

/* Activity */
.z-activity-list { background: var(--z-surface); border-radius: 14px; border: 1px solid var(--z-border); overflow: hidden; }
.z-activity-row { display: flex; align-items: center; padding: 10px 14px; gap: 10px; }
.z-activity-avatar { width: 22px; height: 22px; border-radius: 6px; flex-shrink: 0; background: var(--z-surface2); display: flex; align-items: center; justify-content: center; font-size: 8px; font-weight: 600; color: var(--z-text2); }
.z-activity-text { flex: 1; font-size: 12px; color: var(--z-text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.z-activity-time { font-size: 11px; color: var(--z-text3); flex-shrink: 0; }

/* Module cards legacy */
.module-card {
  background: var(--z-surface) !important;
  border: 1px solid var(--z-border) !important;
  border-radius: var(--z-radius) !important;
  box-shadow: none !important;
  transition: var(--z-transition) !important;
}
.module-card:hover { transform: translateY(-2px) !important; box-shadow: var(--z-shadow-md) !important; }
.module-card:active { transform: scale(0.98) !important; }
.module-card h3 { color: var(--z-text) !important; font-weight: 600 !important; font-size: 13px !important; }
.module-card p { color: var(--z-text3) !important; }

.z-app-main .bg-white {
  background: var(--z-surface) !important;
  border: 0.5px solid var(--z-border) !important;
  box-shadow: none !important;
}
#scanCard {
  border-radius: var(--z-radius) !important;
  box-shadow: none !important;
  border: 0.5px solid var(--z-border);
  overflow: hidden;
}

/* ═══════════════════════════════════════
   ALL MODULE HEADERS → Friendly Hybrid
   ═══════════════════════════════════════ */

#facturoScreen > header, #facturoFormScreen > header,
#facturoArchivesScreen > header, #recettesScreen > header,
#planifioScreen > header, #arbitroScreen > header,
#inventaireScreen > header, #achatsScreen > header,
#contactoScreen > header, #archivoScreen > header,
#usersScreen > header, #companiesScreen > header,
#auditScreen > header {
  background: var(--z-surface) !important;
  color: var(--z-text) !important;
  border-bottom: 1px solid var(--z-border) !important;
  box-shadow: none !important;
  padding-top: calc(env(safe-area-inset-top, 0px) + 12px) !important;
}

#facturoScreen > header h1, #facturoFormScreen > header h1,
#facturoArchivesScreen > header h1, #recettesScreen > header h1,
#planifioScreen > header h1, #arbitroScreen > header h1,
#inventaireScreen > header h1, #achatsScreen > header h1,
#contactoScreen > header h1, #archivoScreen > header h1,
#usersScreen > header h1, #companiesScreen > header h1,
#auditScreen > header h1 {
  color: var(--z-text) !important;
}

#facturoScreen > header p, #facturoFormScreen > header p,
#facturoArchivesScreen > header p, #recettesScreen > header p,
#planifioScreen > header p, #arbitroScreen > header p,
#inventaireScreen > header p, #achatsScreen > header p,
#contactoScreen > header p, #archivoScreen > header p,
#usersScreen > header p, #companiesScreen > header p,
#auditScreen > header p {
  color: var(--z-text2) !important;
}

#facturoScreen > header button, #facturoFormScreen > header button,
#facturoArchivesScreen > header button, #recettesScreen > header button,
#planifioScreen > header button, #arbitroScreen > header button,
#inventaireScreen > header button, #achatsScreen > header button,
#contactoScreen > header button, #archivoScreen > header button,
#usersScreen > header button, #companiesScreen > header button,
#auditScreen > header button {
  background: var(--z-surface2) !important;
  color: var(--z-text) !important;
  border: 0.5px solid var(--z-border) !important;
  border-radius: var(--z-radius-sm) !important;
}
#facturoScreen > header button:hover, #facturoFormScreen > header button:hover,
#facturoArchivesScreen > header button:hover, #recettesScreen > header button:hover,
#planifioScreen > header button:hover, #arbitroScreen > header button:hover,
#inventaireScreen > header button:hover, #achatsScreen > header button:hover,
#contactoScreen > header button:hover, #archivoScreen > header button:hover,
#usersScreen > header button:hover, #companiesScreen > header button:hover,
#auditScreen > header button:hover {
  background: var(--z-border) !important;
}

/* Module Tab Strips */
.facturo-tab, .planifio-tab {
  font-family: var(--z-font) !important;
  transition: all 0.2s !important;
  -webkit-tap-highlight-color: transparent;
}
.facturo-tab.border-white,
.facturo-tab[style*="border-bottom-color: white"] {
  color: var(--z-text) !important;
  border-bottom-color: var(--z-accent) !important;
}
.facturo-tab:hover { color: var(--z-text2) !important; }
.planifio-tab:hover { opacity: 0.9; }

#inventaireScreen [onclick*="switchInventoryTab"] { font-family: var(--z-font) !important; transition: all 0.2s !important; }
#inventaireScreen .text-slate-500[onclick*="switchInventoryTab"] { color: var(--z-text3) !important; border-bottom-color: transparent !important; }
#inventaireScreen .text-amber-600[onclick*="switchInventoryTab"],
#inventaireScreen .border-amber-500[onclick*="switchInventoryTab"] { color: var(--z-text) !important; border-bottom-color: var(--z-accent) !important; }

/* Module backgrounds */
#facturoScreen, #facturoFormScreen, #facturoArchivesScreen,
#recettesScreen, #planifioScreen, #arbitroScreen,
#inventaireScreen, #achatsScreen, #contactoScreen,
#archivoScreen, #usersScreen, #companiesScreen, #auditScreen {
  background: var(--z-bg) !important;
}

/* Module content cards */
#facturoScreen .bg-white, #recettesScreen .bg-white,
#planifioScreen .bg-white, #arbitroScreen .bg-white,
#inventaireScreen .bg-white, #achatsScreen .bg-white,
#contactoScreen .bg-white, #archivoScreen .bg-white,
#usersScreen .bg-white, #companiesScreen .bg-white,
#auditScreen .bg-white {
  background: var(--z-surface) !important;
  border: 0.5px solid var(--z-border) !important;
  box-shadow: none !important;
}

/* ═══════════════════════════════════════
   BOTTOM SHEET (Facturo Quick Capture)
   ═══════════════════════════════════════ */
.z-sheet-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.z-sheet-overlay.z-sheet-visible { opacity: 1; pointer-events: auto; }
.z-sheet-overlay.z-sheet-visible .z-sheet { transform: translateY(0); }

.z-sheet {
  position: absolute; bottom: 0; left: 0; right: 0;
  max-height: 85vh;
  background: var(--z-surface);
  border-radius: 20px 20px 0 0;
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
  display: flex; flex-direction: column;
  box-shadow: 0 -8px 40px rgba(0,0,0,0.15);
}
.z-sheet-handle {
  width: 36px; height: 4px;
  background: var(--z-text3);
  border-radius: 2px;
  margin: 10px auto 6px;
  opacity: 0.35;
  flex-shrink: 0;
}
.z-sheet-scroll {
  flex: 1; overflow-y: auto;
  padding: 4px 16px 24px;
  overscroll-behavior: contain;
}
@media (min-width: 640px) {
  .z-sheet { max-width: 520px; margin: 0 auto; left: 0; right: 0; }
}

/* ═══════════════════════════════════════
   INVENTORY CATEGORY GRID
   ═══════════════════════════════════════ */
.inv-cat-card {
  background: var(--z-surface);
  border: 1px solid var(--z-border);
  border-radius: 16px;
  padding: 16px;
  cursor: pointer;
  transition: transform 0.15s cubic-bezier(0.16,1,0.3,1), box-shadow 0.15s ease;
  position: relative;
  overflow: hidden;
}
.inv-cat-card:active { transform: scale(0.97); }
.inv-cat-card:hover { box-shadow: 0 4px 20px rgba(26,22,50,0.08); }
.inv-cat-card .cat-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
}
.inv-cat-card .cat-name {
  font-weight: 600; font-size: 14px;
  color: var(--z-text);
  margin-bottom: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.inv-cat-card .cat-meta {
  font-size: 11px; color: var(--z-text3);
}
.inv-cat-card .cat-alert-dot {
  position: absolute; top: 12px; right: 12px;
  width: 8px; height: 8px; border-radius: 50%;
}
.inv-cat-card--special {
  border: 1.5px dashed var(--z-border);
  background: var(--z-bg);
}
.inv-cat-card--pending {
  border-color: rgba(239,68,68,0.3);
  background: linear-gradient(135deg, #FEF2F2 0%, var(--z-surface) 100%);
}
.inv-cat-card--pending .cat-icon { background: #FEE2E2; color: #DC2626; }

.inv-context-menu {
  animation: invSlideDown 0.15s cubic-bezier(0.16,1,0.3,1);
}
@keyframes invSlideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════
   BOTTOM TAB BAR
   ═══════════════════════════════════════ */

/* ═══════════════════════════════════════
   APP SHELL — V1 Flexbox Flow
   Tab bar in document flow, not fixed.
   Content scrolls in its own container.
   ═══════════════════════════════════════ */

.z-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  position: relative;
}

.z-shell-content {
  flex: 1 1 0%;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

/* Desktop: screens handle their own scroll via position:absolute + overflow-y:auto */
@media (min-width: 1024px) {
  body:not(.z-force-mobile) .z-shell-content {
    overflow: visible;
    position: relative;
  }
}

/* ═══════════════════════════════════════
   A1 FLOATING DARK PILL — replaces tab bar
   ═══════════════════════════════════════ */

#zenoiaFloatingNav {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 0;
  background: #1A1632;
  border-radius: 34px;
  padding: 6px;
  box-shadow: 0 8px 32px rgba(26,22,50,0.28), 0 2px 8px rgba(124,58,237,0.1);
  margin-bottom: env(safe-area-inset-bottom, 0px);
}

.z-float-btn {
  width: 55px;
  height: 55px;
  border-radius: 28px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.06);
  transition: all 0.2s ease;
  padding: 0;
}
.z-float-btn svg {
  width: 24px;
  height: 24px;
  stroke: rgba(255,255,255,0.5);
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: all 0.2s ease;
}
.z-float-btn:active {
  transform: scale(0.92);
}

/* Home button active state */
.z-float-home.active {
  background: rgba(124,58,237,0.15);
}
.z-float-home.active svg {
  stroke: #A78BFA;
  stroke-width: 2;
}

/* Dot separator */
.z-float-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(255,255,255,0.1);
  margin: 0 12px;
}

/* Scan button — purple gradient */
.z-float-scan {
  background: linear-gradient(135deg, #7C3AED 0%, #5B21B6 100%) !important;
  box-shadow: 0 2px 12px rgba(124,58,237,0.4);
}
.z-float-scan svg {
  stroke: #FFFFFF !important;
  stroke-width: 2 !important;
  width: 24px !important;
  height: 24px !important;
}
.z-float-scan:active {
  transform: scale(0.92);
  box-shadow: 0 1px 6px rgba(124,58,237,0.3);
}
.z-float-scan:hover {
  box-shadow: 0 4px 20px rgba(124,58,237,0.5);
}

/* Hide floating pill when any overlay/modal/bottom-sheet is open */
body.z-overlay-open #zenoiaFloatingNav {
  display: none !important;
}

/* Dashboard Settings Modal */
.z-cfg-sheet {
  max-height: 85vh !important;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
}
.z-cfg-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--z-text3);
  margin: 16px 0 6px;
}
.z-cfg-group {
  background: var(--z-bg);
  border-radius: 12px;
  overflow: hidden;
}
.z-cfg-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 0.5px solid var(--z-border2);
  transition: opacity 0.2s;
}
.z-cfg-row:last-child { border-bottom: none; }
.z-cfg-grip {
  color: var(--z-text3);
  opacity: 0.4;
  cursor: grab;
  touch-action: none;
  flex-shrink: 0;
}
.z-cfg-grip:active { cursor: grabbing; }
.z-cfg-icon {
  flex-shrink: 0;
  width: 28px; height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--z-surface);
}
.z-cfg-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--z-text);
  white-space: nowrap;
}
.z-cfg-desc {
  font-size: 10px;
  color: var(--z-text3);
  flex: 1;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.z-cfg-pos {
  font-size: 9px;
  font-weight: 800;
  color: #7C3AED;
  background: rgba(124,58,237,0.1);
  padding: 1px 6px;
  border-radius: 6px;
  margin-left: 2px;
}
.z-cfg-drag-over {
  border-top: 2px solid #7C3AED !important;
}
.z-cfg-placeholder {
  background: rgba(124,58,237,0.06);
  border: 1.5px dashed rgba(124,58,237,0.25);
  border-radius: 8px;
  margin: 2px 0;
}
.z-cfg-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.z-cfg-chip {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--z-border);
  background: var(--z-bg);
  font-size: 12px;
  font-weight: 600;
  color: var(--z-text2);
  cursor: pointer;
  font-family: var(--z-font);
  transition: all 0.15s;
}
.z-cfg-chip-active {
  background: #7C3AED;
  color: #FFF;
  border-color: #7C3AED;
}

/* Content clearance no longer needed — V1 flexbox handles it */

/* ═══════════════════════════════════════
   DARK MODE TOGGLE
   ═══════════════════════════════════════ */

.z-toggle {
  width: 44px; height: 26px; border-radius: 13px;
  border: none; cursor: pointer; position: relative;
  background: var(--z-surface2); transition: background 0.2s;
  flex-shrink: 0;
}
.z-toggle.active { background: #7C3AED; }
[data-theme="dark"] .z-toggle.active { background: #A78BFA; }
.z-toggle .z-knob {
  width: 20px; height: 20px; border-radius: 10px;
  background: #FFF; position: absolute; top: 3px; left: 3px;
  transition: left 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.z-toggle.active .z-knob { left: 21px; }
.z-toggle-sm {
  width: 24px; height: 24px; border-radius: 6px;
  border: 1.5px solid var(--z-border);
  background: var(--z-surface);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.2s ease;
  color: var(--z-text3);
}
.z-toggle-sm.active { background: #FBBF24; border-color: #FBBF24; color: #FFF; }
.z-toggle-sm svg { width: 10px; height: 10px; }

/* Drag & Drop reorder */
.z-drag-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  user-select: none;
  -webkit-user-drag: none;
  transition: background 0.15s ease;
}
.z-drag-row:active { background: var(--z-bg); }
.z-drag-handle {
  font-size: 16px; color: var(--z-text3); cursor: grab;
  padding: 4px 2px; line-height: 1;
  touch-action: none;
  font-weight: 700; letter-spacing: 1px;
}
.z-drag-handle:active { cursor: grabbing; }
.z-drag-ghost {
  position: fixed; z-index: 9999;
  pointer-events: none;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  background: var(--z-surface);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.1);
  opacity: 0.95;
}
.z-drag-placeholder {
  background: var(--z-accent);
  opacity: 0.12;
  border-radius: 8px;
  margin: 2px 0;
  min-height: 4px;
  transition: height 0.15s ease;
}

/* Dashboard feed */
.z2-feed {
  background: var(--z-surface);
  border: 0.5px solid var(--z-border2);
  border-radius: 12px;
  overflow: hidden;
}
.z2-feed-row {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 14px 16px;
  background: none; border: none; cursor: pointer;
  text-align: left;
  transition: background 0.12s ease;
}
.z2-feed-row:active { background: var(--z-bg); }
.z2-feed-icon {
  width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.z2-feed-emoji {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 24px; line-height: 1;
}
.z2-feed-info {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
}
.z2-feed-title {
  font-size: 15px; font-weight: 600;
  color: var(--z-text); line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.z2-feed-sub {
  font-size: 13px; color: var(--z-text3);
  line-height: 1.3;
}
.z2-feed-amount {
  font-size: 15px; font-weight: 600;
  color: var(--z-text);
  white-space: nowrap;
}
.z2-feed-badge {
  font-size: 11px; font-weight: 600;
  color: #D97706;
  background: #D9770612;
  padding: 2px 6px; border-radius: 4px;
  white-space: nowrap;
}
.z2-feed-time {
  font-size: 13px; color: var(--z-text3);
  min-width: 28px; text-align: right;
  white-space: nowrap;
}

/* Facturo Chart Overlay */
.z-chart-overlay {
  position: fixed; inset: 0; z-index: 9990;
  background: var(--z-bg);
  display: flex; flex-direction: column;
  animation: slideUpFull 0.3s ease;
}
@keyframes slideUpFull {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.z-chart-sheet {
  flex: 1; overflow-y: auto;
  padding-bottom: 100px;
}
.z-chart-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px 8px;
}
.z-chart-back {
  background: none; border: none; cursor: pointer;
  color: var(--z-text2); padding: 4px;
  transform: rotate(0deg);
}
.z-chart-title {
  flex: 1; font-size: 16px; font-weight: 700; color: var(--z-text);
}
.z-chart-action {
  background: none; border: none; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--z-accent);
  font-family: var(--z-font);
}
.z-chart-amount {
  font-size: 32px; font-weight: 800; color: var(--z-text);
  padding: 4px 20px 0; letter-spacing: -0.5px;
}
.z-chart-period {
  font-size: 12px; color: var(--z-text3); font-weight: 500;
  padding: 0 20px 16px;
}
.z-chart-canvas {
  padding: 8px 20px 12px;
  min-height: 140px;
}
.z-chart-filters {
  display: flex; gap: 4px;
  padding: 0 20px 16px;
}
.z-chart-filter {
  flex: 1; padding: 7px 4px;
  border-radius: 8px; border: none;
  background: var(--z-surface);
  font-size: 11px; font-weight: 600;
  color: var(--z-text3);
  cursor: pointer;
  font-family: var(--z-font);
  transition: all 0.15s ease;
}
.z-chart-filter.active {
  background: var(--z-accent);
  color: #FFF;
}
.z-chart-filter:active { transform: scale(0.95); }
.z-chart-list {
  margin: 0 20px;
  background: var(--z-surface);
  border: 0.5px solid var(--z-border2);
  border-radius: 12px;
  overflow: hidden;
}

/* Chart filter buttons */
.z-chart-filter {
  padding: 3px 8px;
  font-size: 10px; font-weight: 600;
  border-radius: 6px;
  border: none;
  background: var(--z-bg);
  color: var(--z-text3);
  cursor: pointer;
  transition: all 0.15s ease;
}
.z-chart-filter.active {
  background: var(--z-accent);
  color: #FFF;
}
.z-chart-filter:active { opacity: 0.7; }

/* ═══════════════════════════════════════
   CUSTOMIZE MODAL
   ═══════════════════════════════════════ */

.z-customize-overlay { position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,0.3); display: flex; align-items: flex-end; backdrop-filter: blur(4px); }
.z-customize-sheet { width: 100%; max-width: 480px; margin: 0 auto; background: var(--z-surface); border-radius: 20px 20px 0 0; padding: 8px 20px 32px; max-height: 80vh; overflow-y: auto; }
.z-sheet-handle { width: 36px; height: 4px; border-radius: 2px; background: var(--z-border); margin: 0 auto 14px; }
.z-customize-label { font-size: 11px; font-weight: 700; color: var(--z-text2); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 10px; }
.z-customize-group { background: var(--z-bg); border-radius: 14px; border: 1px solid var(--z-border); overflow: hidden; }
.z-customize-row { display: flex; align-items: center; padding: 12px; gap: 10px; }
.z-customize-module-icon { width: 28px; height: 28px; border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.z-customize-done { width: 100%; padding: 13px; border-radius: 12px; background: var(--z-accent); border: none; cursor: pointer; font-size: 14px; font-weight: 600; color: white; margin-top: 20px; font-family: var(--z-font); }
.z-customize-done:hover { background: var(--z-accent-dark); }

/* ═══════════════════════════════════════
   "PLUS" SCREEN
   ═══════════════════════════════════════ */

#moreScreen {
  background: var(--z-bg) !important;
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  overflow-y: auto; overflow-x: hidden;
 
}
.z-more-header { padding: 76px 20px 4px; padding-top: calc(env(safe-area-inset-top, 14px) + 68px); max-width: 480px; margin: 0 auto; }
.z-more-header h1 { font-size: 22px; font-weight: 700; color: var(--z-text); letter-spacing: -0.02em; }
.z-more-content { padding: 0 20px 24px; max-width: 480px; margin: 0 auto; }

@media (min-width: 1024px) {
  body:not(.z-force-mobile) #moreScreen .z-more-header,
  body:not(.z-force-mobile) #moreScreen .z-more-content { max-width: 800px; }
}

.z-more-list { background: var(--z-surface); border-radius: 14px; border: 1px solid var(--z-border); overflow: hidden; }
.z-more-row {
  display: flex; align-items: center; gap: 10px; padding: 11px 14px;
  background: transparent; border: none; cursor: pointer; width: 100%;
  text-align: left; font-family: var(--z-font); transition: background 0.15s;
}
.z-more-row:active { background: var(--z-surface2); }
.z-more-row:hover { background: var(--z-bg); }
.z-more-row-icon { width: 30px; height: 30px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.z-more-row-name { flex: 1; font-size: 14px; font-weight: 500; color: var(--z-text); }
.z-more-row-desc { font-size: 11px; color: var(--z-text3); margin-right: 4px; }
.z-more-row-chevron { color: var(--z-text3); flex-shrink: 0; display: flex; align-items: center; }

/* ═══════════════════════════════════════
   FAB
   ═══════════════════════════════════════ */

.z-fab {
  position: fixed; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); right: 20px; z-index: 30;
  width: 48px; height: 48px; border-radius: 14px;
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.15s, box-shadow 0.15s;
}
.z-fab:active { transform: scale(0.93); }
.z-fab svg { width: 22px; height: 22px; stroke: #FFFFFF; stroke-width: 2.5; fill: none; }

@media (min-width: 1024px) {
  body:not(.z-force-mobile) .z-fab { bottom: 24px; right: 32px; }
}

/* ═══════════════════════════════════════
   FORM ELEMENTS
   ═══════════════════════════════════════ */

#facturoScreen input, #facturoFormScreen input,
#recettesScreen input, #inventaireScreen input,
#achatsScreen input, #contactoScreen input,
#archivoScreen input, #arbitroScreen input {
  background: var(--z-surface) !important;
  border: 1px solid var(--z-border) !important;
  border-radius: 10px !important;
  font-family: var(--z-font) !important;
  color: var(--z-text) !important;
}

#facturoScreen select, #facturoFormScreen select,
#recettesScreen select, #inventaireScreen select,
#achatsScreen select, #arbitroScreen select {
  background: var(--z-surface) !important;
  border: 1px solid var(--z-border) !important;
  border-radius: 8px !important;
  font-family: var(--z-font) !important;
  color: var(--z-text) !important;
}

#facturoFormScreen textarea, #recettesScreen textarea, #arbitroScreen textarea {
  background: var(--z-surface) !important;
  border: 1px solid var(--z-border) !important;
  border-radius: 10px !important;
  font-family: var(--z-font) !important;
  color: var(--z-text) !important;
}

/* ═══════════════════════════════════════
   MODALS
   ═══════════════════════════════════════ */

#genericModal > div {
  background: var(--z-surface) !important;
  border: 1px solid var(--z-border) !important;
  border-radius: 20px !important;
}
#genericModal input, #genericModal select, #genericModal textarea {
  background: var(--z-bg) !important;
  border: 1px solid var(--z-border) !important;
  border-radius: 10px !important;
  font-family: var(--z-font) !important;
  color: var(--z-text) !important;
}

/* App confirm/notification modals */
.z-app-confirm, .z-app-notification {
  border-radius: 20px !important;
}

#scanModal > div {
  background: var(--z-surface) !important;
  border: 1px solid var(--z-border) !important;
}

#floatingCompareBtn button { border-radius: 14px !important; font-family: var(--z-font) !important; }

/* ═══════════════════════════════════════
   TAILWIND CLASS OVERRIDES
   ═══════════════════════════════════════ */

.text-slate-600 { color: var(--z-text2) !important; }
.text-gray-500, .text-gray-400 { color: var(--z-text3) !important; }
.text-gray-600, .text-gray-700 { color: var(--z-text2) !important; }
.text-gray-800, .text-gray-900 { color: var(--z-text) !important; }
.bg-slate-200, .bg-gray-100, .bg-gray-200 { background: var(--z-surface2) !important; }
.bg-slate-50 { background: var(--z-bg) !important; }
.rounded-xl { border-radius: var(--z-radius) !important; }
.rounded-2xl { border-radius: var(--z-radius) !important; }
.shadow-sm { box-shadow: var(--z-shadow) !important; }
.shadow-lg { box-shadow: 0 4px 16px rgba(0,0,0,0.06) !important; }
.shadow-xl { box-shadow: 0 8px 24px rgba(0,0,0,0.06) !important; }

/* ═══════════════════════════════════════
   DARK MODE OVERRIDES
   ═══════════════════════════════════════ */

[data-theme="dark"] .text-slate-500,
[data-theme="dark"] .text-slate-400,
[data-theme="dark"] .text-slate-300 { color: var(--z-text2) !important; }
[data-theme="dark"] .text-slate-700,
[data-theme="dark"] .text-slate-800,
[data-theme="dark"] .text-slate-900,
[data-theme="dark"] .font-bold { color: var(--z-text) !important; }
[data-theme="dark"] .bg-slate-100,
[data-theme="dark"] .bg-slate-50 { background: var(--z-bg) !important; }
[data-theme="dark"] .bg-white { background: var(--z-surface) !important; }
[data-theme="dark"] .border-slate-200,
[data-theme="dark"] .border-slate-300 { border-color: var(--z-border) !important; }
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background: var(--z-surface2) !important;
  color: var(--z-text) !important;
  border-color: var(--z-border) !important;
}

/* ═══════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════ */

.z-footer {
  text-align: center; font-size: 10px;
  color: var(--z-text3); padding: 24px 0;
  letter-spacing: 0.04em;
}

/* Login PWA install link */
.z-login-wrapper {
  display: flex; flex-direction: column; align-items: center;
  width: 100%; max-width: 24rem;
  gap: 16px;
}
.z-login-pwa {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 0;
  background: none; border: none;
  cursor: pointer; text-decoration: none;
  font-family: var(--z-font);
  transition: opacity 0.2s;
}
.z-login-pwa:hover { opacity: 0.7; }
.z-login-pwa-icon {
  width: 18px; height: 18px;
  fill: none; stroke: rgba(255,255,255,0.7); stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
  flex-shrink: 0;
}
.z-login-pwa span {
  font-size: 14px; font-weight: 500; color: rgba(255,255,255,0.7);
}
@media (min-width: 1024px) {
  .z-login-pwa-icon { stroke: var(--z-accent); }
  .z-login-pwa span { color: var(--z-accent); }
}

/* QR Modal */
.z-qr-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(4px);
  z-index: 9999; align-items: center; justify-content: center;
}
.z-qr-overlay.open { display: flex; animation: z-dd-in 0.2s ease-out; }
.z-qr-modal {
  background: var(--z-surface); border-radius: 20px;
  padding: 32px; text-align: center;
  max-width: 300px; width: 90%;
  position: relative;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.z-qr-close {
  position: absolute; top: 12px; right: 12px;
  background: var(--z-bg); border: 1px solid var(--z-border);
  border-radius: 10px; width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--z-text3); transition: var(--z-transition);
}
.z-qr-close:hover { background: var(--z-border); }
.z-qr-icon {
  width: 52px; height: 52px; border-radius: 14px;
  background: linear-gradient(135deg, #7C3AED 0%, #5B21B6 100%);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  box-shadow: 0 4px 16px rgba(124,58,237,0.3);
}
.z-qr-title { font-size: 18px; font-weight: 700; color: var(--z-text); margin: 0 0 6px; }
.z-qr-desc { font-size: 13px; color: var(--z-text2); margin: 0 0 20px; line-height: 1.4; }
.z-qr-code {
  display: flex; align-items: center; justify-content: center;
  padding: 12px; background: #fff; border-radius: 14px;
  margin: 0 auto 12px; width: fit-content;
}
.z-qr-url { font-size: 12px; font-weight: 600; color: var(--z-accent); margin: 0; }

/* iOS Install Guide Modal */
.z-pwa-ios-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.z-pwa-ios-overlay.z-hidden { display: none; }
.z-pwa-ios-modal {
  background: var(--z-surface); border-radius: 20px;
  padding: 32px 28px; max-width: 340px; width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: z-dd-in 0.2s ease-out;
}
.z-pwa-ios-header { margin-bottom: 24px; }
.z-pwa-ios-icon {
  width: 56px; height: 56px; border-radius: 16px;
  background: linear-gradient(135deg, #7C3AED 0%, #5B21B6 100%);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
  box-shadow: 0 4px 16px rgba(124,58,237,0.3);
}
.z-pwa-ios-header h3 { font-size: 18px; font-weight: 700; color: var(--z-text); margin: 0 0 4px; }
.z-pwa-ios-header p { font-size: 13px; color: var(--z-text2); margin: 0; }
.z-pwa-ios-steps { text-align: left; margin-bottom: 24px; display: flex; flex-direction: column; gap: 14px; }
.z-pwa-ios-step {
  display: flex; align-items: flex-start; gap: 12px;
  font-size: 14px; color: var(--z-text); line-height: 1.4;
}
.z-pwa-ios-num {
  width: 26px; height: 26px; border-radius: 50%;
  background: rgba(124,58,237,0.1); color: #7C3AED;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.z-pwa-ios-btn {
  width: 100%; padding: 12px; border: none;
  background: linear-gradient(135deg, #7C3AED 0%, #5B21B6 100%);
  color: #fff; border-radius: 12px;
  font-size: 15px; font-weight: 600; cursor: pointer;
  font-family: var(--z-font);
  transition: opacity 0.2s;
}
.z-pwa-ios-btn:hover { opacity: 0.9; }

/* ═══════════════════════════════════════
   MODULE SCREENS — Bottom padding
   ═══════════════════════════════════════ */

#facturoScreen > main, #facturoFormScreen > main,
#facturoArchivesScreen > main, #recettesScreen > main,
#planifioScreen > main, #arbitroScreen > main,
#inventaireScreen > main, #achatsScreen > main,
#contactoScreen > main, #archivoScreen > main,
#usersScreen > main, #companiesScreen > main,
#auditScreen > main {
  padding-bottom: 24px !important;
}

@media (min-width: 1024px) {
  body:not(.z-force-mobile) #facturoScreen > main,
  body:not(.z-force-mobile) #facturoFormScreen > main,
  body:not(.z-force-mobile) #facturoArchivesScreen > main,
  body:not(.z-force-mobile) #recettesScreen > main,
  body:not(.z-force-mobile) #planifioScreen > main,
  body:not(.z-force-mobile) #arbitroScreen > main,
  body:not(.z-force-mobile) #inventaireScreen > main,
  body:not(.z-force-mobile) #achatsScreen > main,
  body:not(.z-force-mobile) #contactoScreen > main,
  body:not(.z-force-mobile) #archivoScreen > main,
  body:not(.z-force-mobile) #usersScreen > main,
  body:not(.z-force-mobile) #companiesScreen > main,
  body:not(.z-force-mobile) #auditScreen > main {
    padding-bottom: 32px !important;
    max-width: 960px;
    margin: 0 auto;
  }
}

/* ═══════════════════════════════════════
   PLANIFIO — Mobile Day Strip
   ═══════════════════════════════════════ */

#planifioDayStrip button { -webkit-tap-highlight-color: transparent; }
#planifioCalendar [onclick] { cursor: pointer; }
@media (max-width: 639px) {
  #planifioTodayCard { display: none !important; }
}

/* ═══════════════════════════════════════
   DESKTOP LAYOUT OPTIMIZATIONS
   ═══════════════════════════════════════ */

/* Hide elements on desktop (modules grid = sidebar handles it) */
@media (min-width: 1024px) {
  body:not(.z-force-mobile) .z-mobile-only { display: none !important; }

  /* KPIs: wider cards with more breathing room */
  body:not(.z-force-mobile) .z-kpi-card { padding: 20px 18px; }
  body:not(.z-force-mobile) .z-kpi-value { font-size: 28px; }
  body:not(.z-force-mobile) .z-kpi-label { font-size: 12px; }

  /* Widgets: side by side on desktop */
  body:not(.z-force-mobile) .z-dashboard-fixed {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
  }
  body:not(.z-force-mobile) .z-dashboard-fixed > .z-kpis {
    width: 100%;
    flex-shrink: 0;
  }
  body:not(.z-force-mobile) .z-dashboard-fixed > .z-widget {
    flex: 1;
    min-width: 280px;
    margin-bottom: 0;
  }
  body:not(.z-force-mobile) .z-dashboard-fixed > #teamWidget {
    width: 100%;
    flex: 0 0 100%;
  }
  body:not(.z-force-mobile) .z-dashboard-fixed > #stockAlertsWidget {
    flex: 1;
    min-width: 280px;
  }

  /* Activity: wider rows on desktop */
  body:not(.z-force-mobile) .z-activity-row { padding: 12px 18px; }
  body:not(.z-force-mobile) .z-activity-text { font-size: 13px; }

  /* Section inside dashboard must span full width */
  body:not(.z-force-mobile) .z-dashboard-fixed > .z-section {
    width: 100%;
    flex: 0 0 100%;
  }
}

/* Force-mobile overrides: show everything like mobile */
body.z-force-mobile .z-mobile-only { display: block !important; }
body.z-force-mobile .z-widget-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 8px !important; }
body.z-force-mobile .z-dashboard-fixed { display: block !important; }

/* ═══════════════════════════════════════
   MODULE WIDGET CARDS (Desktop)
   ═══════════════════════════════════════ */

.z-widget-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (min-width: 1280px) {
  .z-widget-grid { grid-template-columns: repeat(3, 1fr); }
}

.z-mw-card {
  background: var(--z-surface);
  border: 1px solid var(--z-border);
  border-radius: 16px;
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
  display: flex;
  flex-direction: column;
}
.z-mw-card:hover {
  border-color: var(--z-accent);
  box-shadow: 0 4px 20px rgba(124,58,237,0.08);
  transform: translateY(-2px);
}
.z-mw-card:active { transform: scale(0.98); }

.z-mw-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.z-mw-icon {
  width: 34px; height: 34px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.z-mw-icon svg { stroke-width: 1.8; }
.z-mw-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--z-text);
  letter-spacing: -0.01em;
}
.z-mw-pro {
  font-size: 9px;
  font-weight: 700;
  color: #7C3AED;
  background: rgba(124,58,237,0.1);
  padding: 1px 6px;
  border-radius: 99px;
  margin-left: 6px;
  vertical-align: middle;
}

.z-mw-body { flex: 1; }

.z-mw-stat { margin-bottom: 10px; }
.z-mw-stat-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--z-text);
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.z-mw-stat-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--z-text2);
  margin-top: 2px;
  display: block;
}

.z-mw-list { display: flex; flex-direction: column; gap: 1px; }
.z-mw-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 0;
  border-top: 0.5px solid var(--z-border2);
}
.z-mw-list-item:first-child { border-top: none; }
.z-mw-list-text {
  font-size: 12px;
  font-weight: 500;
  color: var(--z-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}
.z-mw-list-meta {
  font-size: 11px;
  color: var(--z-text3);
  flex-shrink: 0;
  margin-left: 8px;
  font-variant-numeric: tabular-nums;
}

/* Mobile compact widget cards */
@media (max-width: 480px) {
  .z-mw-card { padding: 12px; border-radius: 14px; }
  .z-mw-header { gap: 8px; margin-bottom: 10px; }
  .z-mw-icon { width: 30px; height: 30px; border-radius: 8px; }
  .z-mw-icon svg { width: 16px !important; height: 16px !important; }
  .z-mw-title { font-size: 12px; }
  .z-mw-stat-value { font-size: 18px; }
  .z-mw-stat-label { font-size: 10px; }
  .z-mw-list-item { padding: 3px 0; }
  .z-mw-list-text { font-size: 11px; }
  .z-mw-list-meta { font-size: 10px; }
  .z-mw-empty { font-size: 11px; }
  .z-widget-grid { gap: 8px; }
}

.z-mw-empty {
  font-size: 12px;
  color: var(--z-text3);
  padding: 4px 0;
}
.z-mw-loading {
  font-size: 11px;
  color: var(--z-text3);
  padding: 8px 0;
  text-align: center;
}

/* ═══════════════════════════════════════
   V2 DASHBOARD — Mercury × Stripe × Revolut
   ═══════════════════════════════════════ */

/* Hero KPI */
.z2-hero {
  padding: 16px 20px 4px;
}
.z2-hero-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--z-text2);
  margin-bottom: 4px;
}
.z2-hero-amount {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.z2-hero-big {
  font-size: 42px;
  font-weight: 900;
  letter-spacing: -2px;
  line-height: 1;
  color: var(--z-text);
}
.z2-hero-dec {
  font-size: 22px;
  font-weight: 700;
  opacity: 0.4;
}
.z2-hero-currency {
  font-size: 18px;
  font-weight: 600;
  opacity: 0.35;
  color: var(--z-text);
}
.z2-hero-delta {
  margin-top: 2px;
  font-size: 13px;
  display: flex;
  align-items: center;
}
.z2-hero-spark {
  width: 100%;
  opacity: 0.6;
}
.z2-hero-charts {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  margin-top: 0;
}
.z2-hero-spark-btn {
  flex: 1; min-width: 0;
  background: none; border: none; cursor: pointer;
  padding: 0; text-align: left;
  border-radius: 8px;
  transition: background 0.15s ease;
  display: flex;
  flex-direction: column;
}
.z2-hero-spark-btn .z2-hero-amount {
  position: relative; z-index: 2;
}
.z2-hero-spark-btn .z2-hero-delta {
  position: relative; z-index: 2;
}
.z2-hero-spark-btn .z2-hero-spark {
  width: 100%;
  z-index: 1;
  margin-top: 8px;
  height: 56px;
}
.z2-hero-spark-btn:active { background: var(--z-bg); }
.z2-hero-stock {
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.z2-hero-side {
  flex-shrink: 0;
  display: flex; flex-direction: column;
  align-items: center; gap: 4px;
}
.z2-hero-onsite {
  min-height: 28px;
}
.z2-hero-dates {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  position: relative;
  z-index: 2;
}
.z2-hero-dates span {
  font-size: 12px;
  color: var(--z-text3);
  font-weight: 500;
}

/* Quick Actions */
.z2-actions {
  display: flex;
  gap: 10px;
  padding: 0 20px 8px;
}
.z2-action-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 0;
  border-radius: var(--z-radius);
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: var(--z-font);
  color: var(--z-text);
  transition: var(--z-transition);
}
.z2-action-btn:active { transform: scale(0.92); opacity: 0.7; }
.z2-action-btn span {
  font-size: 13px;
  font-weight: 600;
  color: var(--z-text2);
}
.z2-action-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--z-accent);
}

/* Section */
.z2-section {
  padding: 0 20px;
  margin-top: 4px;
}
.z2-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding: 0 2px;
}
.z2-section-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--z-text3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.z2-section-action {
  font-size: 14px;
  color: var(--z-accent);
  background: none;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-family: var(--z-font);
}

/* Primary Cards */
.z2-primary-card {
  width: 100%;
  text-align: left;
  display: block;
  padding: 16px 18px;
  border-radius: var(--z-radius);
  border: 1px solid var(--z-border);
  background: var(--z-surface);
  cursor: pointer;
  margin-bottom: 8px;
  font-family: var(--z-font);
  color: var(--z-text);
  transition: var(--z-transition);
}
.z2-primary-card:active { transform: scale(0.985); }
.z2-primary-card:hover { border-color: var(--z-accent); box-shadow: var(--z-shadow-md); }

.z2-pc-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.z2-pc-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.z2-pc-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.z2-pc-icon svg { stroke-width: 1.8; }
.z2-pc-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.z2-pc-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--z-text);
}
.z2-pc-desc {
  font-size: 13px;
  color: var(--z-text2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.z2-pc-right {
  text-align: right;
  flex-shrink: 0;
  margin-left: 12px;
}
.z2-pc-kpi {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--z-text);
  display: block;
}
.z2-pc-delta {
  font-size: 12px;
  display: block;
}

/* Primary card body items */
.z2-pc-body { margin-top: 0; }
.z2-pc-items {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--z-border2);
}
.z2-pc-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 14px;
  color: var(--z-text2);
}
.z2-pc-item-val {
  font-weight: 600;
  color: var(--z-text);
  flex-shrink: 0;
  margin-left: 8px;
}
.z2-pc-empty {
  font-size: 13px;
  color: var(--z-text3);
  padding: 4px 0;
  margin-top: 8px;
}

/* Compact List (secondary modules) */
.z2-compact-list {
  background: var(--z-surface);
  border-radius: var(--z-radius);
  border: 1px solid var(--z-border);
  overflow: hidden;
}
.z2-compact-row {
  width: 100%;
  text-align: left;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  cursor: pointer;
  font-family: var(--z-font);
  color: var(--z-text);
  background: transparent;
  border: none;
  transition: var(--z-transition);
}
.z2-compact-row:active { background: var(--z-surface2); }
.z2-compact-border { border-bottom: 1px solid var(--z-border2); }

.z2-cr-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.z2-cr-icon svg { stroke-width: 1.8; }
.z2-cr-info {
  flex: 1;
  min-width: 0;
  margin-left: 10px;
  display: flex;
  flex-direction: column;
}
.z2-cr-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--z-text);
}
.z2-cr-desc {
  font-size: 12px;
  color: var(--z-text3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.z2-cr-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: 8px;
}
.z2-cr-kpi {
  font-size: 17px;
  font-weight: 800;
  color: var(--z-text);
}

/* V2 Header — compact top bar */
.z2-topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 14px 20px 8px;
  padding-top: calc(env(safe-area-inset-top, 14px) + 8px);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 45;
  background: var(--z-bg);
  transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
  will-change: transform;
}
.z2-topbar.z-topbar-hidden {
  transform: translateY(-100%);
}
.z2-topbar-left {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  position: relative;
}
.z2-topbar-brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.z2-topbar-appname {
  font-size: 20px;
  font-weight: 900;
  color: var(--z-text);
  letter-spacing: -0.5px;
  line-height: 1;
}
.z2-topbar-company-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 4px;
  border-radius: 20px;
  border: 1px solid var(--z-border);
  background: var(--z-surface);
  cursor: pointer;
  font-family: var(--z-font);
  transition: all 0.15s;
}
.z2-topbar-company-pill:active {
  transform: scale(0.97);
  background: var(--z-bg);
}
.z2-topbar-company-pill svg {
  color: var(--z-text3);
  flex-shrink: 0;
}
.z2-topbar-avatar {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--z-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 900;
  color: #fff;
  flex-shrink: 0;
}
.z2-topbar-company {
  font-size: 13px;
  font-weight: 600;
  color: var(--z-text);
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.z2-topbar-actions {
  display: flex;
  gap: 8px;
}
.z2-topbar-btn {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  border: 1px solid var(--z-border);
  background: var(--z-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--z-text2);
  position: relative;
  transition: var(--z-transition);
}
.z2-topbar-btn:active { transform: scale(0.92); }
.z2-topbar-btn svg { width: 22px; height: 22px; stroke-width: 1.8; }

/* Hamburger ↔ × animation */
.z-ham { transition: transform 0.3s cubic-bezier(0.4,0,0.2,1), opacity 0.2s ease; transform-origin: 12px 12px; }
#btnTopbarMenu.is-open .z-ham-1 { transform: translateY(5px) rotate(45deg); }
#btnTopbarMenu.is-open .z-ham-2 { opacity: 0; }
#btnTopbarMenu.is-open .z-ham-3 { transform: translateY(-5px) rotate(-45deg); }
.z2-topbar-dot {
  display: none;
}

/* Alert badge on bell icon */
.z2-alert-badge {
  position: absolute;
  top: 4px; right: 4px;
  min-width: 18px; height: 18px;
  border-radius: 9px;
  background: #EF4444;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
  font-family: var(--z-font);
}
.z2-alert-badge.hidden { display: none; }

/* Alert panel overlay */
.z-alert-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.z-alert-overlay.hidden { display: none; }

/* Alert panel bottom sheet */
.z-alert-panel {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 201;
  background: var(--z-surface);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -4px 32px rgba(26,22,50,0.15);
  max-height: 70vh;
  min-height: 35vh;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  animation: alertSlideUp 0.25s ease;
}
.z-alert-panel.hidden { display: none; }
@keyframes alertSlideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.z-alert-handle {
  display: flex;
  justify-content: center;
  padding: 10px 0 4px;
  cursor: pointer;
}
.z-alert-handle-bar {
  width: 36px; height: 4px;
  border-radius: 2px;
  background: rgba(26,22,50,0.1);
}
.z-alert-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 20px 12px;
  border-bottom: 0.5px solid var(--z-border2);
}
.z-alert-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--z-text);
  letter-spacing: -0.3px;
}
.z-alert-count {
  background: #EF4444;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 10px;
  font-family: var(--z-font);
}
.z-alert-list {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px 12px 16px;
}

/* Individual alert row */
.z-alert-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s;
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
  font-family: var(--z-font);
}
.z-alert-row:active { background: var(--z-bg); }
.z-alert-icon {
  width: 38px; height: 38px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
}
.z-alert-content {
  flex: 1;
  min-width: 0;
}
.z-alert-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--z-text);
  line-height: 1.2;
}
.z-alert-desc {
  font-size: 11px;
  color: var(--z-text3);
  margin-top: 1px;
}
.z-alert-chevron {
  flex-shrink: 0;
  color: var(--z-text3);
}
.z-alert-divider {
  height: 0.5px;
  background: var(--z-border2);
  margin: 0 12px;
}

/* Alert section header */
.z-alert-section {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--z-text3);
  padding: 10px 12px 4px;
}

/* Empty state */
.z-alert-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--z-text3);
}
.z-alert-empty-icon {
  font-size: 32px;
  margin-bottom: 8px;
  opacity: 0.3;
}
.z-alert-empty-text {
  font-size: 13px;
  font-weight: 500;
}

/* Desktop overrides */
@media (min-width: 1024px) {
  body:not(.z-force-mobile) .z2-hero { padding: 24px 24px 16px; }
  body:not(.z-force-mobile) .z2-hero-big { font-size: 44px; }
  body:not(.z-force-mobile) .z2-actions { padding: 0 24px 20px; gap: 12px; }
  body:not(.z-force-mobile) .z2-section { padding: 0 24px; }
  body:not(.z-force-mobile) .z2-topbar { padding: 18px 24px 10px; }
}

/* ═══════════════════════════════════════
   PWA INSTALL BANNER (iOS Safari)
   ═══════════════════════════════════════ */

.z-pwa-banner {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 9997;
  background: var(--z-surface);
  border-top: 1px solid var(--z-border);
  box-shadow: 0 -4px 24px rgba(0,0,0,0.08);
  padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
  font-family: var(--z-font);
  transition: transform 0.3s ease;
  max-width: 480px;
  margin: 0 auto;
  border-radius: 16px 16px 0 0;
}
.z-pwa-banner.z-hidden { transform: translateY(100%); }
.z-pwa-banner-icon {
  width: 44px; height: 44px; border-radius: 12px;
  background: linear-gradient(135deg, #7C3AED 0%, #5B21B6 100%);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.z-pwa-banner-icon svg { width: 20px; height: 20px; stroke: white; stroke-width: 2; fill: none; }
.z-pwa-banner-text { flex: 1; min-width: 0; }
.z-pwa-banner-title { font-size: 14px; font-weight: 700; color: var(--z-text); margin-bottom: 2px; }
.z-pwa-banner-desc { font-size: 12px; color: var(--z-text2); line-height: 1.3; }
.z-pwa-banner-desc b { color: var(--z-text); font-weight: 600; }
.z-pwa-banner-close {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--z-surface2); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.z-pwa-banner-close svg { width: 14px; height: 14px; stroke: var(--z-text3); stroke-width: 2; fill: none; }

/* Fix dropdown options visibility */
#companySelector option { color: #1e293b; background: white; }
.hide-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }
.hide-scrollbar::-webkit-scrollbar { display: none; }

/* Photo Lightbox animations */
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.9) } to { opacity: 1; transform: scale(1) } }
/* ═══════════════════════════════════════
   PLANIFIO v8.1.0 — Tab styles
   ═══════════════════════════════════════ */

.planifio-tab.z-tab-active {
  background: var(--z-accent) !important;
  color: #FFFFFF !important;
  font-weight: 700 !important;
  box-shadow: 0 3px 12px rgba(124,58,237,0.35) !important;
  letter-spacing: 0.2px !important;
}
.planifio-tab.z-tab-inactive {
  background: transparent !important;
  color: var(--z-text3) !important;
  font-weight: 400 !important;
  box-shadow: none !important;
  opacity: 0.6;
}
.planifio-tab.z-tab-inactive:hover {
  opacity: 0.85;
  color: var(--z-text2) !important;
}

/* Day strip touch */
#planifioDayStrip button { -webkit-tap-highlight-color: transparent; }
#planifioCalendar [onclick] { cursor: pointer; }

/* Timeline current time pulse */
@keyframes plPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Drag feedback */
[draggable="true"] { cursor: grab; }
[draggable="true"]:active { cursor: grabbing; opacity: 0.7; }

/* ═══════════════════════════════════════
   PLANIFIO — Print Mode
   ═══════════════════════════════════════ */

@media print {
  body.planifio-print-mode * { visibility: hidden !important; }
  body.planifio-print-mode #planifioScreen,
  body.planifio-print-mode #planifioScreen * { visibility: visible !important; }
  body.planifio-print-mode #planifioScreen {
    position: absolute !important;
    left: 0 !important; top: 0 !important;
    width: 100% !important;
    display: block !important;
    background: #fff !important;
    min-height: auto !important;
  }
  body.planifio-print-mode #planifioScreen > header {
    position: static !important;
    background: #fff !important;
    border-bottom: 2px solid #1A1632 !important;
    padding: 8px 16px !important;
  }
  body.planifio-print-mode #planifioScreen > header button:not(:first-child) { display: none !important; }
  body.planifio-print-mode .planifio-tab { display: none !important; }
  body.planifio-print-mode .z-fab { display: none !important; }
  body.planifio-print-mode #planifioTodayCard { display: none !important; }
  body.planifio-print-mode #planifioRequestsTab { display: none !important; }
  body.planifio-print-mode #planifioCalendar {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  body.planifio-print-mode #planifioCalendar table {
    font-size: 11px !important;
    border-collapse: collapse !important;
  }
  body.planifio-print-mode #planifioCalendar td,
  body.planifio-print-mode #planifioCalendar th {
    border: 1px solid #E8E5F0 !important;
    padding: 4px !important;
  }
}

/* Hide today card on mobile (already handled in JS but CSS safety) */
@media (max-width: 639px) {
  #planifioTodayCard { display: none !important; }
}

/* ═══════════════════════════════════════════
   FACTURO REDESIGN — Build 703u
   ═══════════════════════════════════════════ */

/* Topbar */
.z2-facturo-topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 14px 20px 8px;
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--z-bg);
}
.z2-facturo-topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.z2-facturo-title {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -0.5px;
  color: var(--z-text);
}
.z2-facturo-sub {
  font-size: 12px;
  font-weight: 500;
  color: var(--z-text3);
}
.z2-facturo-topbar-right {
  display: flex;
  gap: 6px;
}
.z2-facturo-topbar-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--z-border);
  background: var(--z-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--z-text2);
  transition: var(--z-transition);
}
.z2-facturo-topbar-btn:active { transform: scale(0.92); }
.z2-facturo-topbar-btn svg { stroke-width: 1.8; }

/* KPI Cards */
.z2-facturo-kpis {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 8px 0 14px;
}
.z2-facturo-kpi-card {
  background: var(--z-surface);
  border: 1px solid var(--z-border);
  border-radius: 14px;
  padding: 14px 16px;
}
.z2-facturo-kpi-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--z-text3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.z2-facturo-kpi-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--z-text);
  margin-top: 2px;
  letter-spacing: -0.5px;
}
.z2-facturo-kpi-reimb {
  cursor: pointer;
  transition: var(--z-transition);
}
.z2-facturo-kpi-reimb:active { transform: scale(0.97); }
.z2-facturo-kpi-hint {
  font-size: 10px;
  color: var(--z-text3);
  margin-top: 2px;
  transition: opacity 0.3s ease;
}

/* Section headers */
.z2-facturo-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.z2-facturo-section-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--z-text3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.z2-facturo-section-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.z2-facturo-section-action {
  font-size: 14px;
  color: var(--z-accent);
  background: none;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-family: var(--z-font);
}

/* Drafts banner */
.z2-facturo-drafts {
  background: #FEF3C7;
  border: 1px solid #FDE68A;
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.z2-facturo-drafts-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(251, 191, 36, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #D97706;
}
.z2-facturo-drafts-btn {
  padding: 6px 12px;
  border-radius: 8px;
  border: none;
  font-family: var(--z-font);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--z-transition);
}
.z2-facturo-drafts-btn:active { transform: scale(0.95); }
.z2-facturo-drafts-btn.primary { background: #10B981; color: white; }
.z2-facturo-drafts-btn.secondary { background: rgba(251, 191, 36, 0.2); color: #92400E; }

/* ═══ Reimbursement Panel ═══ */
.z2-reimb-tabs {
  display: flex;
  gap: 4px;
  background: var(--z-surface2, #EEECF4);
  border-radius: 10px;
  padding: 3px;
  margin-bottom: 16px;
}
.z2-reimb-tab {
  flex: 1;
  padding: 8px 12px;
  border: none;
  border-radius: 8px;
  font-family: var(--z-font);
  font-size: 13px;
  font-weight: 600;
  color: var(--z-text3);
  background: transparent;
  cursor: pointer;
  transition: var(--z-transition);
  display: flex;
  align-items: center;
  justify-content: center;
}
.z2-reimb-tab.active {
  background: var(--z-surface);
  color: var(--z-accent);
  box-shadow: var(--z-shadow);
}
.z2-reimb-content { display: none; }
.z2-reimb-content.active { display: block; }

.z2-reimb-summary {
  background: var(--z-accent-light, #EDE9FE);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.z2-reimb-summary-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--z-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.z2-reimb-card {
  background: var(--z-surface);
  border: 1px solid var(--z-border);
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 8px;
  transition: var(--z-transition);
}
.z2-reimb-card.faded { opacity: 0.5; }
.z2-reimb-progress {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--z-border2, #F0EEF6);
  display: flex;
  align-items: center;
  gap: 8px;
}
.z2-reimb-progress-bar {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--z-surface2, #EEECF4);
}
.z2-reimb-progress-fill {
  height: 100%;
  border-radius: 2px;
}
.z2-reimb-progress-label {
  font-size: 11px;
  color: var(--z-text3);
  white-space: nowrap;
}

/* Manager summary */
.z2-reimb-mgr-summary {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}
.z2-reimb-mgr-stat {
  border-radius: 10px;
  padding: 12px;
  text-align: center;
}
.z2-reimb-mgr-stat-value {
  font-size: 22px;
  font-weight: 800;
}
.z2-reimb-mgr-stat-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

/* Manager action buttons */
.z2-reimb-actions {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--z-border2, #F0EEF6);
  display: flex;
  gap: 8px;
}
.z2-reimb-btn {
  padding: 6px 12px;
  border-radius: 8px;
  border: none;
  font-family: var(--z-font);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--z-transition);
}
.z2-reimb-btn:active { transform: scale(0.95); }
.z2-reimb-btn.view { background: var(--z-surface2, #EEECF4); color: var(--z-text2); }
.z2-reimb-btn.share { background: rgba(124,58,237,0.05); color: var(--z-accent); }
.z2-reimb-btn.approve { background: #10B981; color: white; }
.z2-reimb-btn.reject { background: rgba(239,68,68,0.08); color: #EF4444; }

/* Person avatar */
.z2-reimb-avatar {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

/* Spinner animation */
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
