body {
  font-family: Arial, sans-serif;
  color: #111827;
  background: #f9fafb;
  margin: 0;
}

header {
  background: #111827;
  color: #fff;
  padding: 12px 16px;
}

nav.admin-menu {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px 0;
}

nav.admin-menu a {
  background: #f3f4f6;
  color: #111827;
  padding: 8px 10px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 14px;
}

main {
  margin: 16px;
  background: #fff;
  padding: 16px;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  text-align: left;
  padding: 8px;
  border-bottom: 1px solid #e5e7eb;
  font-size: 14px;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 4px;
}

input, select, button {
  padding: 10px;
  margin-bottom: 12px;
  width: 100%;
  box-sizing: border-box;
}

button {
  background: #111827;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}

.link {
  color: #2563eb;
  text-decoration: none;
}

.alert {
  background: #fee2e2;
  color: #991b1b;
  padding: 10px;
  border-radius: 4px;
  margin-bottom: 16px;
}

.flash {
  padding: 10px;
  border-radius: 4px;
  margin-bottom: 16px;
}

.flash.success {
  background: #dcfce7;
  color: #166534;
}

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 12px;
}

.toolbar form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.toolbar input {
  width: auto;
  min-width: 220px;
}

.btn-edit {
  background: #e0f2fe;
  color: #075985;
  padding: 6px 10px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 13px;
  display: inline-block;
}

.btn-primary {
  background: #2563eb;
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary:hover {
  background: #1d4ed8;
}

.btn-icon {
  width: 16px;
  height: 16px;
  display: inline-block;
}

.btn-delete {
  background: #fee2e2;
  color: #991b1b;
  padding: 6px 10px;
  border-radius: 6px;
  border: none;
  font-size: 13px;
  cursor: pointer;
}

.actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.scan-result {
  margin-top: 16px;
  padding: 14px;
  border-radius: 10px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
}

.scan-result.scan-ok {
  border-color: #16a34a;
  background: #dcfce7;
  color: #166534;
}

.scan-result.scan-error {
  border-color: #dc2626;
  background: #fee2e2;
  color: #991b1b;
}

.scan-title {
  font-size: 16px;
  font-weight: 700;
}

.scan-sub,
.scan-meta {
  margin-top: 6px;
  font-size: 13px;
}

.scan-name {
  margin-top: 10px;
  font-size: 18px;
  font-weight: 700;
}

.scan-details {
  margin-top: 10px;
  display: grid;
  gap: 6px;
  font-size: 13px;
}

.scan-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  margin-right: 8px;
  letter-spacing: 0.4px;
}

.scan-badge-ok {
  background: #16a34a;
  color: #fff;
}

.scan-badge-error {
  background: #dc2626;
  color: #fff;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.status-sent {
  background: #e0f2fe;
  color: #075985;
}

.status-draft {
  background: #fef3c7;
  color: #92400e;
}

.status-cloturee {
  background: #dcfce7;
  color: #166534;
}

.status-cancelled {
  background: #fee2e2;
  color: #991b1b;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 16px;
}

.kpi-card {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px;
  background: #f9fafb;
}

.kpi-label {
  font-size: 13px;
  color: #4b5563;
}

.kpi-value {
  font-size: 22px;
  font-weight: 700;
  margin-top: 6px;
}

.kpi-sub {
  font-size: 12px;
  color: #6b7280;
  margin-top: 6px;
}

.chart-card {
  margin-top: 16px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  min-height: 260px;
  position: relative;
}

.chart-title {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 8px;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 16px;
}

.chart-card canvas {
  width: 100% !important;
  height: 220px !important;
}

.pagination {
  margin-top: 12px;
}

.pagination nav {
  display: flex;
  justify-content: center;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
}

.modal {
  background: #fff;
  border-radius: 8px;
  padding: 16px;
  width: 100%;
  max-width: 420px;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

@media (min-width: 900px) {
  main {
    max-width: 1000px;
    margin: 24px auto;
    padding: 20px;
  }

  nav.admin-menu a {
    font-size: 15px;
  }
}

@media (max-width: 900px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .chart-grid {
    grid-template-columns: 1fr;
  }
}
