body {
  font-family: Arial, sans-serif;
  background: #f5f7fb;
  margin: 0;
  color: #222;
}

body {
  overflow-x: hidden;
}

.container {
  width: 1100px;
  max-width: calc(100% - 40px);
  margin: 0 auto;
}

.container {
  max-width: 100%;
  box-sizing: border-box;
}

.narrow {
  width: 520px;
  max-width: calc(100% - 40px);
}

.topbar {
  background: #111827;
  color: #fff;
  padding: 16px 0;
  margin-bottom: 24px;
}

.nav a {
  color: #fff;
  text-decoration: none;
  margin-left: 16px;
}

.flex {
  display: flex;
}

.between {
  justify-content: space-between;
}

.center {
  align-items: center;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

h1, h2, h3 {
  margin-top: 0;
}

label {
  display: block;
  font-weight: bold;
  margin: 12px 0 6px;
}

input, select, button, .btn {
  width: 100%;
  box-sizing: border-box;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #cfd4dc;
  font-size: 14px;
}

form {
  width: 100%;
}

input,
select {
  width: 100%;
  box-sizing: border-box;
}

.card {
  width: 100%;
  overflow: hidden;
}

table {
  display: block;
  overflow-x: auto;
  width: 100%;
}

button, .btn {
  margin-top: 14px;
  background: #2563eb;
  color: #fff;
  border: none;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.btn-danger {
  background: #dc2626;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 12px 10px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
}

.alert {
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 15px;
}

.alert.error {
  background: #fee2e2;
  color: #991b1b;
}

.alert.success {
  background: #dcfce7;
  color: #166534;
}

.actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.actions form {
  margin: 0;
  flex: 1;
}

.actions .btn {
  flex: 1;
}

@media (max-width: 768px) {
  body {
    font-size: 18px;
  }

  .container {
    width: 100%;
    padding: 16px;
  }

  .topbar .container {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }

  .nav a {
    font-size: 16px;
  }

  h1 {
    font-size: 28px;
  }

  .grid-4,
  .grid-3,
  .grid-2 {
    grid-template-columns: 1fr !important;
  }

  .card {
    padding: 20px;
  }

  input,
  select,
  button {
    font-size: 18px;
    min-height: 48px;
  }

  table {
    font-size: 16px;
  }
}

/* 🔥 FIX MOBILE GLOBAL */
* {
  max-width: 100%;
  box-sizing: border-box;
}

body {
  overflow-x: hidden;
}

/* container */
.container {
  width: 100% !important;
  max-width: 100% !important;
  padding: 12px;
}

/* grilles */
.grid-2,
.grid-3,
.grid-4 {
  display: grid;
  grid-template-columns: 1fr !important;
  gap: 12px;
}

/* cartes */
.card {
  width: 100% !important;
}

/* formulaires */
input,
select,
button {
  width: 100%;
  font-size: 16px;
}

/* tables */
table {
  display: block;
  width: 100%;
  overflow-x: auto;
}
.billing-options {
  margin-top: 24px;
  padding-top: 8px;
}

.option-card {
  border: 1px solid #d9dee8;
  border-radius: 12px;
  padding: 18px;
  background: #f8fafc;
  margin-top: 14px;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 12px;
}

.checkbox-line input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin: 0;
  flex: 0 0 auto;
}

.option-card form {
  margin-bottom: 10px;
}

.form-actions {
  margin-top: 12px;
}

.field-help {
  color: #666;
  font-size: 14px;
  margin: 8px 0 14px;
}

.smallbtn.danger,
button.danger {
  background: #dc2626;
}

.invoice-edit-actions {
  margin-top: 22px;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.btn-secondary {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 8px;
  background: #e5e7eb;
  color: #111827;
  text-decoration: none;
  font-weight: 600;
}

.btn-secondary:hover {
  background: #d1d5db;
}
.link-danger {
  border: 0;
  background: none;
  color: #dc2626;
  text-decoration: underline;
  cursor: pointer;
  font: inherit;
  padding: 0;
  margin-left: 8px;
}

.link-danger:hover {
  color: #991b1b;
}

.invoice-actions-cell {
  white-space: nowrap;
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: auto;
  max-width: max-content;
  cursor: pointer;
  font-weight: 600;
}

.checkbox-inline input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  flex: 0 0 auto;
}