.app-body {
  background: var(--paper);
}

.app-top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 0.9rem 0;
}

.app-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.9rem;
  padding: 0.7rem 0 1rem;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.app-nav a {
  text-decoration: none;
  color: var(--ink);
  font-size: 0.92rem;
}

.app-nav a[aria-current="page"] {
  color: var(--leaf);
  font-weight: 600;
}

.app-main {
  padding: 1.6rem 0 3rem;
}

.flash {
  background: #eef6f1;
  color: var(--forest);
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  margin-bottom: 1rem;
}

.flash-error {
  background: #fdecec;
  color: #6d2430;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.8rem;
  margin: 1rem 0 1.4rem;
}

.stat {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1rem;
}

.stat strong {
  display: block;
  font-family: var(--serif);
  font-size: 1.7rem;
  font-weight: 560;
}

.table-wrap {
  overflow-x: auto;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 16px;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

table.data th,
table.data td {
  text-align: left;
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

table.data th {
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  font-size: 0.82rem;
  background: var(--sand);
}

.badge-envoyee,
.badge-envoye {
  background: #f8efd8;
  color: #6d4e16;
}

.badge-reglee,
.badge-accepte,
.badge-livre {
  background: #e5f4ec;
  color: #0e5c3c;
}

.form-card,
.login-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 1.2rem;
}

.login-card {
  max-width: 440px;
  margin: 8vh auto;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}

.line-row,
.tax-row {
  display: grid;
  grid-template-columns: 1.6fr 0.5fr 0.7fr auto;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.tax-row {
  grid-template-columns: 1fr 0.5fr auto;
}

.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0.8rem 0;
}

.money {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.totals {
  margin-top: 1rem;
  max-width: 420px;
  margin-left: auto;
}

.totals div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--line);
}

.totals .ttc {
  font-family: var(--serif);
  font-size: 1.35rem;
}

.muted {
  color: var(--muted);
}

.mail-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.print-sheet {
  max-width: 820px;
  margin: 2rem auto;
  background: white;
  padding: 2rem;
}

.print-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

@media print {
  .no-print {
    display: none !important;
  }
  .print-sheet {
    margin: 0;
    padding: 0;
  }
}

@media (max-width: 800px) {
  .stats,
  .grid-2,
  .line-row,
  .tax-row {
    grid-template-columns: 1fr;
  }
}
