:root {
  --pfp-primary: #2f6fed;
  --pfp-primary-dark: #1e54c0;
  --pfp-sidebar-bg: #11172b;
  --pfp-sidebar-fg: #dbe3f5;
  --pfp-sidebar-muted: #8792b3;
}

body {
  background-color: #f5f2ee;
  font-family: 'Segoe UI', Roboto, Arial, sans-serif;
}

/* Pages login/creer-compte : centre la carte mais ne la colle jamais aux bords
   sur les petits ecrans -- "safe center" evite que le contenu soit pousse
   hors champ quand il est plus haut que la fenetre. */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  align-items: safe center;
  justify-content: center;
  padding: 2.5rem 1rem;
}

.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--pfp-sidebar-bg);
  color: var(--pfp-sidebar-fg);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: 1.1rem 1rem;
  font-size: 1.05rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  color: #fff;
}

.sidebar-brand .brand-logo {
  width: 28px;
  height: 28px;
}

.sidebar-nav {
  padding: .75rem .5rem 1.5rem;
}

.nav-group-title {
  text-transform: uppercase;
  font-size: .7rem;
  letter-spacing: .05em;
  color: var(--pfp-sidebar-muted);
  padding: .9rem .75rem .25rem;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: .6rem;
  color: var(--pfp-sidebar-fg);
  padding: .5rem .75rem;
  border-radius: .4rem;
  font-size: .92rem;
}

.sidebar-nav .nav-link:hover {
  background: rgba(255,255,255,.06);
  color: #fff;
}

.sidebar-nav .nav-link.active {
  background: var(--pfp-primary);
  color: #fff;
}

/* Main */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  gap: .75rem;
  background: #fff;
  padding: .85rem 1.5rem;
  border-bottom: 1px solid #e5e0da;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 0;
  flex: 1;
}

/* Empeche un nom d'utilisateur long de faire deborder la topbar sur mobile. */
.topbar-user-name {
  display: inline-block;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

@media (max-width: 575.98px) {
  .topbar {
    padding: .75rem .85rem;
  }
  .topbar-user-name {
    max-width: 70px;
  }
}

.content {
  padding: 1.5rem;
  flex: 1;
}

.app-footer {
  padding: 1rem 1.5rem;
  color: #8a8378;
  font-size: .82rem;
  border-top: 1px solid #e5e0da;
}

.btn-primary {
  background-color: var(--pfp-primary);
  border-color: var(--pfp-primary);
}

.btn-primary:hover {
  background-color: var(--pfp-primary-dark);
  border-color: var(--pfp-primary-dark);
}

.stub-card {
  text-align: center;
  padding: 3.5rem 1.5rem;
  background: #fff;
  border: 1px dashed #d8cfc3;
  border-radius: .6rem;
}

.stub-card i {
  font-size: 2.5rem;
  color: var(--pfp-primary);
  margin-bottom: 1rem;
}

/* =======================================================================
   Gabarit "page liste" (Suivi du Pain, et tout module a base de tableau)
   ======================================================================= */

.list-back {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  color: #6b7280;
  font-size: .85rem;
  text-decoration: none;
  margin-bottom: .5rem;
}

.list-back:hover {
  color: var(--pfp-primary);
}

.list-page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.list-page-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.list-page-subtitle {
  color: #8792b3;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
  margin-top: .15rem;
}

.action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.action-bar .btn {
  border-radius: .5rem;
  font-weight: 600;
  font-size: .88rem;
}

.filter-bar {
  background: #fff;
  border: 1px solid #e5e0da;
  border-radius: .6rem;
  padding: 1rem;
  margin-bottom: 1.25rem;
}

.filter-bar .form-control,
.filter-bar .form-select {
  border-radius: .5rem;
}

.data-table-wrap {
  background: #fff;
  border-radius: .6rem;
  overflow: hidden;
  border: 1px solid #e5e0da;
}

table.data-table {
  margin-bottom: 0;
}

table.data-table thead {
  background: var(--pfp-sidebar-bg);
}

table.data-table thead th {
  color: #dbe3f5;
  text-transform: uppercase;
  font-size: .72rem;
  letter-spacing: .04em;
  font-weight: 700;
  border: none;
  padding: .75rem .9rem;
  white-space: nowrap;
}

table.data-table tbody td {
  padding: .7rem .9rem;
  vertical-align: middle;
  border-color: #f0ede8;
}

table.data-table tbody tr:hover {
  background: #f7f5f1;
}

table.data-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.diff-pos {
  color: #1a9c5c;
  font-weight: 700;
}

.diff-neg {
  color: #d9394a;
  font-weight: 700;
}

.diff-zero {
  color: #1a9c5c;
  font-weight: 700;
}

#receiptArea {
  padding: 1.5rem;
}

@media print {
  .sidebar, .topbar, .action-bar, .filter-bar, .app-footer, .list-back, .pagination {
    display: none !important;
  }
  .content {
    padding: 0 !important;
  }
  body.printing-receipt .content > *:not(#receiptArea) {
    display: none !important;
  }
  body.printing-receipt #receiptArea {
    display: block !important;
  }
}

@media (max-width: 991.98px) {
  .sidebar {
    position: fixed;
    left: -280px;
    z-index: 1050;
    transition: left .2s ease;
  }
  .sidebar.show {
    left: 0;
  }
}

/* =======================================================================
   Page d'accueil publique (index.php)
   ======================================================================= */

.landing-body {
  background-color: #f5f2ee;
}

.landing-hero {
  background: linear-gradient(135deg, var(--pfp-primary), var(--pfp-primary-dark));
}

.landing-card {
  background: #fff;
  border: 1px solid #e5e0da;
  border-radius: .75rem;
  padding: 1.5rem;
}

.landing-badge {
  background: #e8f0ff;
  color: var(--pfp-primary-dark);
  font-weight: 600;
  font-size: .8rem;
  padding: .4rem .8rem;
  border-radius: 2rem;
  display: inline-block;
}

.landing-flow-step {
  background: #f5f2ee;
  border-radius: .5rem;
  padding: .6rem .9rem;
  font-weight: 600;
  font-size: .92rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.landing-flow-step--final {
  background: var(--pfp-primary);
  color: #fff;
}

.landing-flow-arrow {
  text-align: center;
  color: #b8b0a4;
  line-height: 1.2;
  font-weight: 700;
}

.landing-plan-card {
  background: #fff;
  border: 1px solid #e5e0da;
  border-radius: .75rem;
  padding: 1.5rem 1.25rem;
  text-align: center;
  height: 100%;
}

.landing-plan-card.featured {
  border-color: var(--pfp-primary);
  box-shadow: 0 .5rem 1.5rem rgba(47,111,237,.15);
}

.landing-plan-price {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--pfp-primary);
}
