/* ===== Expensio design system (ExpenseFlow shell) ===== */
:root {
  --accent: #2563EB;
  --accent-soft: #DBEAFE;
  --accent-hover: #1D4ED8;
  --ex-max: 80rem;
  --ex-radius: 1.5rem;
  --ex-radius-md: 1rem;
  --ex-radius-sm: 0.75rem;
}

body.ex-app {
  background: #F8FAFC;
  margin: 0;
}

/* Shell: no sidebar */
.ex-shell { min-height: 100vh; display: flex; flex-direction: column; }
.ex-shell .main-content { margin-left: 0 !important; width: 100%; flex: 1; }
.ex-shell .page,
.ex-shell .page--dense {
  max-width: var(--ex-max);
  margin: 0 auto;
  padding: 1.25rem 1.25rem 2.5rem;
}

/* Sticky header */
.ex-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: #fff;
  border-bottom: 1px solid #E2E8F0;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.ex-header-inner {
  max-width: var(--ex-max);
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4rem;
  flex-wrap: wrap;
}
.ex-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none !important;
  color: inherit !important;
}
.ex-brand-logo {
  height: 42px;
  width: auto;
  max-width: 180px;
  object-fit: contain;
}
.ex-brand-meta { display: flex; flex-direction: column; gap: 0.1rem; }
.ex-brand-row { display: flex; align-items: center; gap: 0.45rem; }
.ex-brand-name {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #0F172A;
}
.ex-pill {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: #EFF6FF;
  color: #1D4ED8;
  border: 1px solid #BFDBFE;
}
.ex-brand-sub {
  font-size: 0.7rem;
  color: #64748B;
  margin: 0;
}

.ex-header-tools {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}
.ex-month-select {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: #F1F5F9;
  border: 1px solid #E2E8F0;
  border-radius: 0.75rem;
  padding: 0.35rem 0.65rem;
}
.ex-month-select select,
.ex-soc-select select {
  border: 0;
  background: transparent;
  font-weight: 700;
  font-size: 0.85rem;
  color: #0F172A;
  cursor: pointer;
  outline: none;
}
.ex-month-select select:disabled {
  cursor: default;
  opacity: 0.85;
}
.ex-month-select:hover {
  border-color: #CBD5E1;
  background: #E2E8F0;
}
.ex-soc-select {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 0.75rem;
  padding: 0.35rem 0.65rem;
}
.ex-stat-mini {
  display: none;
  flex-direction: column;
  align-items: flex-end;
}
@media (min-width: 900px) {
  .ex-stat-mini { display: flex; }
}
.ex-stat-mini span { font-size: 0.65rem; color: #64748B; }
.ex-stat-mini strong { font-size: 0.9rem; font-weight: 800; color: #0F172A; }
.ex-badge-warn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: #FEF3C7;
  color: #B45309;
  border: 1px solid #FCD34D;
}
.ex-user-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.35rem 0.25rem 0.25rem;
  border-radius: 999px;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
}
.ex-user-chip .avatar {
  width: 32px; height: 32px; font-size: 0.7rem;
}
.ex-user-chip .meta strong { font-size: 0.75rem; display: block; line-height: 1.2; }
.ex-user-chip .meta small { font-size: 0.65rem; color: #64748B; }
.ex-logout {
  font-size: 0.75rem; font-weight: 700; color: #64748B !important;
  padding: 0.35rem 0.55rem;
}
.ex-logout:hover { color: #B91C1C !important; }

/* Tabs */
.ex-tabs-wrap {
  max-width: var(--ex-max);
  margin: 0 auto;
  padding: 0.65rem 1.25rem 0.85rem;
}
.ex-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  background: #F1F5F9;
  border-radius: 1rem;
  padding: 0.35rem;
  border: 1px solid #E2E8F0;
}
.ex-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.95rem;
  border-radius: 0.75rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #475569 !important;
  text-decoration: none !important;
  border: 0;
  background: transparent;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.ex-tab:hover { background: #fff; color: #0F172A !important; }
.ex-tab.is-active {
  background: #fff;
  color: #2563EB !important;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}
.ex-tab--accent {
  background: #F5F3FF !important;
  color: #6D28D9 !important;
  margin-left: auto;
}
.ex-tab--accent.is-active { background: #EDE9FE !important; }
.ex-tab-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #10B981; box-shadow: 0 0 0 2px #D1FAE5;
}

/* Hero */
.ex-hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--ex-radius);
  padding: 1.5rem 1.75rem;
  color: #fff;
  background: linear-gradient(135deg, #0F172A 0%, #1E293B 45%, #172554 100%);
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.18);
  margin-bottom: 1.25rem;
}
.ex-hero::before {
  content: '';
  position: absolute;
  right: -4rem; top: -4rem;
  width: 18rem; height: 18rem;
  background: rgba(37, 99, 235, 0.22);
  border-radius: 50%;
  filter: blur(48px);
  pointer-events: none;
}
.ex-hero > * { position: relative; z-index: 1; }
.ex-hero-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.ex-hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #93C5FD;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  margin: 0 0 0.65rem;
}
.ex-hero h2 {
  margin: 0 0 0.4rem;
  font-size: clamp(1.35rem, 2.5vw, 1.85rem);
  font-weight: 800;
  letter-spacing: -0.03em;
}
.ex-hero p {
  margin: 0;
  max-width: 36rem;
  font-size: 0.9rem;
  color: #94A3B8;
  line-height: 1.55;
}
.ex-hero-side {
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 1rem;
  padding: 0.85rem 1rem;
  min-width: 140px;
}
.ex-hero-side span {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #94A3B8;
}
.ex-hero-side strong { font-size: 1.15rem; font-weight: 800; }
.ex-hero-side em {
  display: inline-block;
  margin-top: 0.35rem;
  font-style: normal;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: #FEF3C7;
  color: #B45309;
}

.ex-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-top: 1.15rem;
}
.ex-kpi {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 1rem;
  padding: 0.9rem 1rem;
}
.ex-kpi span {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  color: #94A3B8;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.25rem;
}
.ex-kpi strong {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.ex-kpi strong.is-warn { color: #FCD34D; }
.ex-kpi strong.is-ok { color: #34D399; }
.ex-kpi small { display: block; margin-top: 0.2rem; font-size: 0.72rem; color: #64748B; }

/* Panels / cards */
.ex-panel {
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: var(--ex-radius);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  overflow: hidden;
  margin-bottom: 1.15rem;
}
.ex-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1.1rem 1.25rem 0.85rem;
}
.ex-panel-head h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.ex-panel-head p {
  margin: 0.25rem 0 0;
  font-size: 0.82rem;
  color: #64748B;
}
.ex-panel-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}
.ex-search {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 0.75rem;
  padding: 0.4rem 0.7rem;
  min-width: 180px;
}
.ex-search input {
  border: 0;
  background: transparent;
  outline: none;
  font-size: 0.85rem;
  width: 100%;
}

/* Member rows */
.ex-member-list { padding: 0 0.65rem 0.65rem; }
.ex-member-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 1rem;
  align-items: center;
  padding: 0.95rem 0.85rem;
  border-radius: 1rem;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}
.ex-member-row:hover {
  background: #F8FAFC;
  border-color: #E2E8F0;
}
.ex-member-id {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}
.ex-member-id .avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  font-size: 0.85rem;
  flex-shrink: 0;
  background: linear-gradient(145deg, #2563EB, #1D4ED8);
  color: #fff;
}
.ex-member-id strong {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  font-size: 0.95rem;
}
.ex-member-id .role {
  display: block;
  font-size: 0.78rem;
  color: #64748B;
  margin-top: 0.1rem;
}
.ex-member-id .meta-line {
  display: block;
  font-size: 0.7rem;
  color: #94A3B8;
  margin-top: 0.1rem;
}
.ex-member-money {
  text-align: right;
}
.ex-member-money span {
  display: block;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #94A3B8;
}
.ex-member-money strong {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.ex-progress {
  margin-top: 0.35rem;
  min-width: 110px;
}
.ex-progress-label {
  font-size: 0.68rem;
  color: #64748B;
  margin-bottom: 0.2rem;
}
.ex-progress-track {
  height: 6px;
  background: #E2E8F0;
  border-radius: 999px;
  overflow: hidden;
}
.ex-progress-fill {
  height: 100%;
  background: #2563EB;
  border-radius: 999px;
}
.ex-member-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Queue OCR-like */
.ex-queue-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1.15rem;
  border-top: 1px solid #F1F5F9;
}
.ex-queue-item:first-of-type { border-top: 0; }
.ex-queue-meta strong { display: block; font-size: 0.9rem; }
.ex-queue-meta span { font-size: 0.75rem; color: #64748B; }

/* Buttons override for Expensio feel */
.ex-app .btn-primary {
  background: #2563EB;
  background-image: none;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}
.ex-app .btn-primary:hover {
  background: #1D4ED8;
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.3);
}
.ex-app .btn-ghost {
  background: #fff;
  border: 1px solid #E2E8F0;
}
.ex-badge-pending {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: #FEF3C7;
  color: #B45309;
}

/* Groupe cards under Expensio */
.ex-app .grp-hero {
  border-radius: var(--ex-radius);
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.16);
}
.ex-app .grp-card {
  border-radius: var(--ex-radius);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.ex-app .grp-card:hover {
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.1);
}

/* Auth polish */
.ex-app-auth .auth-card {
  border-radius: 1.5rem;
  border: 1px solid #E2E8F0;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.08);
}

/* PWA polish */
.pwa-body-root {
  background: #F8FAFC;
}
.pwa-shell .bottom-nav {
  background: #fff;
  border-top: 1px solid #E2E8F0;
  box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.04);
}
.pwa-shell .bottom-nav a.active { color: #2563EB; }

@media (max-width: 1000px) {
  .ex-kpi-row { grid-template-columns: 1fr 1fr; }
  .ex-member-row {
    grid-template-columns: 1fr;
    gap: 0.65rem;
  }
  .ex-member-money, .ex-member-actions { text-align: left; justify-content: flex-start; }
}
@media (max-width: 640px) {
  .ex-kpi-row { grid-template-columns: 1fr; }
  .ex-brand-sub { display: none; }
  .ex-header-inner { padding: 0.65rem 1rem; }
}

/* Kill legacy sidebar offset when Expensio shell is active */
.ex-app .main-content {
  margin-left: 0 !important;
  width: 100% !important;
}
.ex-app .sidebar { display: none !important; }

/* Analytics grid */
.ex-analytics-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1rem;
  margin-bottom: 1.15rem;
}
.ex-cat-bars { list-style: none; margin: 0; padding: 0; }
.ex-cat-bars li { margin-bottom: 0.75rem; }
.ex-cat-bar-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.82rem; margin-bottom: 0.25rem; gap: 0.5rem;
}
.ex-cat-bar-head .dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 0.35rem;
}
.ex-cat-bars small { font-size: 0.7rem; color: #94A3B8; }

/* Team switcher */
.ex-team-switch {
  display: flex; flex-wrap: wrap; gap: 0.45rem;
}
.ex-team-chip {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.4rem 0.65rem 0.4rem 0.4rem;
  border-radius: 0.75rem;
  border: 1px solid #E2E8F0;
  background: #F8FAFC;
  color: #0F172A !important;
  text-decoration: none !important;
  font-size: 0.78rem; font-weight: 700;
}
.ex-team-chip .avatar { width: 28px; height: 28px; font-size: 0.65rem; }
.ex-team-chip.is-selected {
  background: #EFF6FF;
  border-color: #2563EB;
  box-shadow: 0 0 0 1px #2563EB;
  color: #1D4ED8 !important;
}

/* Note cards with thumbs */
.ex-note-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.85rem;
  padding: 0 1.15rem 1.25rem;
}
.ex-note-card {
  border: 1px solid #E2E8F0;
  border-radius: 1rem;
  overflow: hidden;
  background: #fff;
  display: flex; flex-direction: column;
}
.ex-note-card-preview { background: #F1F5F9; min-height: 140px; }
.ex-viewer-thumb, .ex-viewer-full {
  position: relative; display: block; width: 100%; border: 0; padding: 0;
  background: #0F172A; cursor: zoom-in; min-height: 140px;
}
.ex-viewer-thumb img, .ex-viewer-full img {
  width: 100%; height: 160px; object-fit: cover; display: block;
}
.ex-viewer-full img { height: auto; max-height: 480px; object-fit: contain; margin: 0 auto; }
.ex-viewer-zoom {
  position: absolute; right: 0.5rem; bottom: 0.5rem;
  font-size: 0.68rem; font-weight: 800;
  background: rgba(15,23,42,0.75); color: #fff;
  padding: 0.25rem 0.5rem; border-radius: 999px;
}
.ex-viewer-thumb--pdf, .ex-viewer-empty {
  display: grid; place-items: center; min-height: 140px;
  background: linear-gradient(145deg, #1E293B, #0F172A); color: #94A3B8;
  font-size: 0.85rem; font-weight: 700;
}
.ex-pdf-badge {
  font-size: 1.25rem; font-weight: 800; color: #F87171;
  border: 2px solid #F87171; padding: 0.35rem 0.75rem; border-radius: 0.5rem;
}
.ex-note-card-body { padding: 0.85rem; display: flex; flex-direction: column; gap: 0.35rem; flex: 1; }
.ex-note-card-top { display: flex; justify-content: space-between; gap: 0.5rem; align-items: flex-start; }
.ex-note-card-amt { font-size: 1.15rem; font-weight: 800; letter-spacing: -0.02em; }
.ex-note-card-meta { font-size: 0.75rem; color: #64748B; }
.ex-note-card-actions { display: flex; gap: 0.35rem; flex-wrap: wrap; margin-top: auto; padding-top: 0.5rem; }

/* Detail layout */
.ex-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 1rem;
}
.ex-detail-amt {
  font-size: 2rem; font-weight: 800; letter-spacing: -0.03em; color: #0F172A;
}
.ex-viewer-stage { padding: 0 1rem 1rem; }
.ex-viewer-iframe {
  width: 100%; min-height: 420px; border: 1px solid #E2E8F0; border-radius: 0.75rem; background: #fff;
}

/* Lightbox */
.ex-lightbox[hidden] { display: none !important; }
.ex-lightbox {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
}
.ex-lightbox-backdrop {
  position: absolute; inset: 0; background: rgba(15, 23, 42, 0.72); backdrop-filter: blur(4px);
}
.ex-lightbox-dialog {
  position: relative; z-index: 1;
  width: min(960px, 94vw); max-height: 92vh;
  background: #0F172A; border-radius: 1rem; overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 30px 60px rgba(0,0,0,0.4);
}
.ex-lightbox-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 0.75rem;
  padding: 0.75rem 1rem; background: #1E293B; color: #fff;
}
.ex-lightbox-body {
  flex: 1; overflow: auto; display: grid; place-items: center; padding: 1rem; min-height: 50vh;
}
.ex-lightbox-body img { max-width: 100%; max-height: 75vh; object-fit: contain; border-radius: 0.5rem; }
.ex-lightbox-body iframe { width: 100%; height: 75vh; border: 0; background: #fff; border-radius: 0.5rem; }

@media (max-width: 900px) {
  .ex-analytics-grid, .ex-detail-grid { grid-template-columns: 1fr; }
}

/* Collaborateurs grid */
.ex-collab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}
.ex-collab-card {
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 1rem;
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  box-shadow: 0 1px 2px rgba(15,23,42,0.04);
  transition: box-shadow .15s ease, border-color .15s ease;
}
.ex-collab-card:hover {
  border-color: #CBD5E1;
  box-shadow: 0 8px 24px rgba(15,23,42,0.08);
}
.ex-collab-card.is-inactive { opacity: 0.6; }
.ex-collab-card-top {
  display: flex; align-items: flex-start; gap: 0.75rem;
}
.ex-collab-card-top strong {
  display: block; font-size: 0.95rem; color: #0F172A;
}
.ex-collab-card-top .role {
  display: block; font-size: 0.75rem; color: #64748B; font-weight: 600;
}
.ex-collab-card-top .meta-line {
  display: block; font-size: 0.7rem; color: #94A3B8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ex-collab-stats {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem;
  background: #F8FAFC; border-radius: 0.75rem; padding: 0.75rem;
}
.ex-collab-stats span {
  display: block; font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.04em;
  color: #94A3B8; font-weight: 700;
}
.ex-collab-stats strong {
  font-size: 0.95rem; color: #0F172A; font-weight: 800;
}
.ex-collab-stats strong.is-warn { color: #D97706; }
.ex-collab-meta {
  font-size: 0.75rem; color: #64748B; font-weight: 600;
}
.ex-collab-actions {
  display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center;
  padding-top: 0.25rem; border-top: 1px solid #F1F5F9;
}

/* Statut analytics */
.ex-statut-list { list-style: none; margin: 0; padding: 0; }
.ex-statut-list li {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.65rem 0; border-bottom: 1px solid #F1F5F9;
}
.ex-statut-list li:last-child { border-bottom: 0; }
.ex-statut-list strong { margin-left: auto; font-size: 1.05rem; font-weight: 800; }
.ex-statut-list em { font-style: normal; font-size: 0.8rem; color: #64748B; min-width: 5.5rem; text-align: right; }

/* Notes table thumbs */
.ex-note-row-thumb {
  width: 44px; height: 44px; border-radius: 0.5rem; object-fit: cover;
  background: #0F172A; vertical-align: middle;
}
.ex-note-row-pdf {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; border-radius: 0.5rem;
  background: #1E293B; color: #F87171; font-size: 0.65rem; font-weight: 800;
}
.ex-viewer-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.35rem;
}
