/* ============================================================
   Jumping Access v2 — Design system "extension"
   ============================================================ */

* {
  box-sizing: border-box;
}

body.extension {
  background: #f5f7fa;
  font-family:
    "Segoe UI",
    -apple-system,
    BlinkMacSystemFont,
    Roboto,
    Arial,
    sans-serif;
  color: #2c3e50;
  margin: 0;
  padding: 0;
  font-size: 14px;
  min-height: 100vh;
}

/* ─── Top nav ─── */
.top-nav {
  background: #2c3e50;
  color: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}
.top-nav-inner {
  max-width: 1600px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.top-nav-brand {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}
.top-nav-brand .fa {
  color: #f39c12;
}
.top-nav-links {
  flex: 1;
  display: flex;
  gap: 6px;
}
.top-nav-links a {
  color: #ecf0f1;
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 4px;
  font-size: 13px;
  transition: background 0.15s;
}
.top-nav-links a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.top-nav-links a.active {
  background: #3498db;
  color: #fff;
}
.top-nav-links .fa {
  margin-right: 4px;
  opacity: 0.85;
}
.top-nav-user {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}
.top-nav-user .user-name {
  color: #fff;
}
.top-nav-user .fa {
  color: #5dade2;
  margin-right: 4px;
}
.badge-role-super_admin {
  background: #e74c3c;
  color: #fff;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}
.badge-role-company_admin {
  background: #f39c12;
  color: #fff;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}
.badge-role-user {
  background: #95a5a6;
  color: #fff;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}
.btn-logout {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 12px;
  transition: background 0.15s;
}
.btn-logout:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

/* ─── Page content ─── */
.page-content {
  padding: 25px 15px;
}

/* ─── Flash messages ─── */
.flash-container {
  max-width: 1600px;
  margin: 0 auto 16px;
}
.flash {
  padding: 12px 18px;
  border-radius: 6px;
  margin-bottom: 10px;
  font-size: 13.5px;
  border-left: 4px solid;
}
.flash-success {
  background: #d4edda;
  color: #155724;
  border-color: #28a745;
}
.flash-error {
  background: #f8d7da;
  color: #721c24;
  border-color: #dc3545;
}
.flash-warning {
  background: #fff3cd;
  color: #856404;
  border-color: #ffc107;
}
.flash-notice {
  background: #d1ecf1;
  color: #0c5460;
  border-color: #17a2b8;
}

/* ─── Main container ─── */
.main-container {
  max-width: 1600px;
  margin: 0 auto;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  overflow: hidden;
}

.header-section {
  background: #2c3e50;
  color: #fff;
  padding: 22px 28px;
}
.header-section h3 {
  margin: 0 0 14px;
  font-size: 22px;
  font-weight: 600;
  color: #fff;
}
.header-section h3 .fa {
  margin-right: 8px;
  color: #f39c12;
}
.header-section .info-box {
  background: #34495e;
  border-left: 3px solid #3498db;
  padding: 12px 16px;
  border-radius: 4px;
  color: #ecf0f1;
  font-size: 13px;
  line-height: 1.6;
}
.header-section .info-box .fa-info-circle {
  color: #3498db;
  margin-right: 6px;
}
.header-section .info-box a {
  color: #5dade2;
  text-decoration: none;
}
.header-section .info-box a:hover {
  text-decoration: underline;
}
.header-section .info-box code {
  background: rgba(255, 255, 255, 0.15);
  color: #f8c471;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 12px;
}

/* ─── Content + sections numérotées ─── */
.content-section {
  padding: 22px 28px;
  background: #fafbfc;
}
.qualification-section {
  background: #fff;
  border: 1px solid #e1e5ea;
  border-radius: 6px;
  padding: 18px 22px;
  margin-bottom: 16px;
}
.qualification-section:last-child {
  margin-bottom: 0;
}

.section-title {
  font-size: 15px;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid #ecf0f1;
  display: flex;
  align-items: center;
}
.section-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  background: #3498db;
  color: #fff;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
  margin-right: 12px;
}

/* ─── Form controls ─── */
.form-group {
  margin-bottom: 16px;
}
.form-group label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 6px;
}
.form-group label .fa {
  color: #3498db;
  margin-right: 5px;
}

.form-control {
  height: 38px;
  padding: 7px 12px;
  font-size: 13.5px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  background: #fff;
  color: #2c3e50;
  width: 100%;
  display: block;
}
.form-control:focus {
  border-color: #3498db;
  outline: none;
  box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}
select.form-control {
  appearance: auto;
  height: 38px;
}

/* ─── Boutons ─── */
.btn {
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 13.5px;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-block;
  text-decoration: none;
  line-height: 1.4;
}
.btn-primary {
  background: #3498db;
  color: #fff;
}
.btn-primary:hover {
  background: #2980b9;
  color: #fff;
}
.btn-success {
  background: #27ae60;
  color: #fff;
}
.btn-success:hover {
  background: #229954;
  color: #fff;
}
.btn-warning {
  background: #f39c12;
  color: #fff;
}
.btn-warning:hover {
  background: #d68910;
  color: #fff;
}
.btn-danger {
  background: #e74c3c;
  color: #fff;
}
.btn-danger:hover {
  background: #c0392b;
  color: #fff;
}
.btn-default {
  background: #ecf0f1;
  color: #2c3e50;
  border-color: #bdc3c7;
}
.btn-default:hover {
  background: #d5dbde;
}
.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
}
.btn-block {
  display: block;
  width: 100%;
  text-align: center;
}

/* ─── Form helpers ─── */
.form-control.has-error {
  border-color: #e74c3c;
  background: #fdedeb;
}
.error-message {
  display: block;
  color: #c0392b;
  font-size: 12px;
  margin-top: 4px;
  font-weight: 500;
}
.help-text {
  display: block;
  color: #888;
  font-size: 11.5px;
  margin-top: 5px;
  font-style: italic;
}
.help-text code {
  background: #f4f6f8;
  padding: 1px 5px;
  border-radius: 3px;
  color: #c0392b;
  font-size: 11px;
  font-style: normal;
}
.required {
  color: #e74c3c;
  font-weight: 700;
}
.form-actions {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #ecf0f1;
  display: flex;
  gap: 10px;
}

/* ─── Tables de données ─── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: #fff;
}
.data-table thead {
  background: #2c3e50;
  color: #fff;
}
.data-table th {
  padding: 10px 12px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  border: 1px solid #2c3e50;
}
.data-table td {
  padding: 10px 12px;
  border: 1px solid #e1e5ea;
  vertical-align: middle;
}
.data-table tbody tr:nth-child(even) {
  background: #f8f9fa;
}
.data-table tbody tr:hover {
  background: #f0f3f7;
}
.data-table tbody tr.row-inactive {
  opacity: 0.55;
  background: #fafafa;
}
.data-table tbody tr.row-inactive:hover {
  opacity: 0.85;
}
.data-table .text-center {
  text-align: center;
}
.data-table .text-right {
  text-align: right;
}
.data-table code {
  background: #f4f6f8;
  color: #c0392b;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 11.5px;
}

/* ─── Badges génériques ─── */
.badge-state {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}
.badge-state .fa {
  font-size: 7px;
}
.badge-active {
  background: #d4edda;
  color: #155724;
}
.badge-active .fa {
  color: #28a745;
}
.badge-pending {
  background: #fff3cd;
  color: #856404;
}
.badge-pending .fa {
  color: #f39c12;
}
.badge-inactive {
  background: #f8d7da;
  color: #721c24;
}
.badge-inactive .fa {
  color: #dc3545;
}

.badge-country {
  display: inline-block;
  padding: 2px 8px;
  background: #e6f1fb;
  color: #185fa5;
  border: 1px solid #b8d4ed;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* ─── Badges source (manual/email/api) ─── */
.badge-source-manual,
.badge-source-email,
.badge-source-api {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.badge-source-manual {
  background: #ecf0f1;
  color: #2c3e50;
  border: 1px solid #bdc3c7;
}
.badge-source-email {
  background: #f4f6f8;
  color: #555;
  border: 1px solid #c0c4c9;
}
.badge-source-api {
  background: #e3edfa;
  color: #1f4e79;
  border: 1px solid #b8c9e0;
}

/* Label pill (catégorie d'épreuve dans la table des semaines) */
.label-pill {
  display: inline-block;
  padding: 3px 10px;
  margin: 2px 3px 2px 0;
  background: #eaf2f9;
  color: #1f4e79;
  border: 1px solid #c8d9e9;
  border-radius: 12px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
}
.label-pill small {
  color: #6a8db0;
  font-weight: 500;
}

/* ─── Riders layout (sidebar + tableau) ─── */
.riders-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 18px;
  align-items: flex-start;
  padding: 14px;
  max-width: 100%;
}
.riders-sidebar {
  position: sticky;
  top: 14px;
  background: #fff;
  border: 1px solid #e0e4e9;
  border-radius: 6px;
  padding: 14px;
  max-height: calc(100vh - 90px);
  overflow-y: auto;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  font-size: 12px;
}
.riders-sidebar h4 {
  font-size: 14px;
  margin: 0 0 6px;
  color: #2c3e50;
  font-weight: 700;
}
.sidebar-section {
  padding: 8px 0;
  border-bottom: 1px solid #eef1f4;
}
.sidebar-section:last-child {
  border-bottom: none;
}
.sidebar-section.sidebar-actions {
  padding-top: 12px;
}
.sidebar-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 6px;
}
.sidebar-select {
  width: 100%;
  padding: 5px 8px;
  font-size: 12px;
  border-radius: 4px;
  border: 1px solid #ccc;
}
.sidebar-checkboxes {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 240px;
  overflow-y: auto;
}
.sidebar-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 3px;
  font-size: 12px;
  line-height: 1.3;
}
.sidebar-checkbox:hover {
  background: #f5f8fb;
}
.sidebar-checkbox input[type="checkbox"] {
  margin-top: 3px;
  flex-shrink: 0;
}
.sidebar-checkbox .check-label {
  display: flex;
  flex-direction: column;
}
.sidebar-checkbox .check-label small {
  color: #888;
  font-size: 10.5px;
}
.btn-block {
  display: block;
  width: 100%;
  margin-bottom: 6px;
}

.riders-main {
  min-width: 0;
}

/* Table récap */
.riders-table-wrapper {
  overflow-x: auto;
  max-width: 100%;
  border: 1px solid #e0e4e9;
  border-radius: 4px;
}
.riders-recap-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
  white-space: nowrap;
}
.riders-recap-table th,
.riders-recap-table td {
  padding: 4px 7px;
  border: 1px solid #dfe3e7;
  text-align: center;
}
.riders-recap-table thead th {
  background: #f0f3f6;
  color: #2c3e50;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.riders-recap-table .week-header {
  font-size: 12px;
}
.riders-recap-table .label-header {
  font-weight: 700;
}
.riders-recap-table .subhead {
  font-size: 10px;
  color: #666;
  font-weight: 500;
}
.riders-recap-table .total-header {
  background: #e0e4e9 !important;
}

/* Couleurs alternées par semaine (S1=bleu, S2=vert, S3=jaune, S4=rose, S5=violet) */
.week-color-1 {
  background: #cfe2ff !important;
}
.week-color-2 {
  background: #d1e7dd !important;
}
.week-color-3 {
  background: #fff3cd !important;
}
.week-color-4 {
  background: #f8d7da !important;
}
.week-color-5 {
  background: #e2d6f3 !important;
}
.week-color-6 {
  background: #cfe2ff !important;
}
.week-color-7 {
  background: #d1e7dd !important;
}
.week-color-8 {
  background: #fff3cd !important;
}

/* Lignes alternées */
.rider-row-color-0 {
  background: #ffffff;
}
.rider-row-color-1 {
  background: #f9fbfd;
}
.rider-row:hover {
  background: #fef9e7;
}

/* Cellules tête de ligne (cavalier) */
.cell-nation,
.cell-name,
.cell-firstname,
.cell-label,
.cell-weeks {
  text-align: center !important;
  padding-left: 8px !important;
}
.cell-name {
  font-weight: 700;
  color: #2c3e50;
}
.cell-num {
  width: 38px;
}
.cell-total {
  background: #e9ecef !important;
  font-weight: 700;
}

/* Cellule modifiée (retrait/substitution) */
.has-change {
  background-color: #fff3cd !important;
  color: #856404;
}
.has-change:hover {
  background-color: #ffe69c !important;
}

/* Cellule "ajout NF en attente" (cavalier ajouté mais sans cheval encore) */
.cell-pending {
  background-color: #e0f0ff !important;
  color: #1f4e79;
}
.cell-pending:hover {
  background-color: #c5e0fa !important;
}
.cell-pending-mark {
  font-size: 14px;
  font-weight: 700;
  color: #1f4e79;
  letter-spacing: -1px;
}

/* Notes */
.cell-note {
  font-size: 10.5px !important;
  color: #b35900;
  max-width: 280px;
  white-space: normal !important;
  text-align: left !important;
}
.note-warning {
  font-weight: 700;
  margin-right: 3px;
}

/* Totals row */
.totals-row th {
  background: #2c3e50 !important;
  color: #fff !important;
  font-weight: 700;
}

/* Colonnes fixes */
.col-nation {
  width: 56px;
}
.col-name {
  width: 130px;
}
.col-firstname {
  width: 110px;
}
.col-note {
  width: 220px;
}
.col-label {
  width: 70px;
}
.col-weeks {
  width: 70px;
}

/* Cartes de sélection de show */
.show-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 8px;
}
.show-card {
  display: block;
  padding: 16px;
  background: #fff;
  border: 1px solid #d8dde2;
  border-radius: 6px;
  text-decoration: none;
  color: inherit;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}
.show-card:hover {
  border-color: #3498db;
  box-shadow: 0 4px 10px rgba(52, 152, 219, 0.15);
  transform: translateY(-1px);
  text-decoration: none;
  color: inherit;
}
.show-card-year {
  font-size: 11px;
  color: #888;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.show-card-name {
  font-size: 16px;
  font-weight: 700;
  color: #2c3e50;
  margin: 4px 0;
}
.show-card-venue {
  font-size: 12px;
  color: #555;
  margin-bottom: 4px;
}
.show-card-company {
  font-size: 11px;
  color: #888;
  margin-bottom: 8px;
  font-style: italic;
}
.show-card-action {
  font-size: 11px;
  color: #3498db;
  font-weight: 700;
  margin-top: 8px;
}

/* ─── Cellules cliquables ─── */
.cell-clickable {
  cursor: pointer;
  position: relative;
  transition: background 0.1s ease;
}
.cell-clickable:hover {
  background: #e8f4fd !important;
  box-shadow: inset 0 0 0 1px #3498db;
}
.cell-clickable.has-change:hover {
  background: #ffe69c !important;
}

/* Dot rouge sur events non acquittés */
.unacked-dot {
  position: absolute;
  top: 1px;
  right: 1px;
  background: #dc3545;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  border-radius: 8px;
  min-width: 14px;
  height: 14px;
  line-height: 14px;
  padding: 0 3px;
  text-align: center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* ─── Drawer latérale ─── */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 9000;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.2s ease,
    visibility 0.2s ease;
}
.drawer-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.rider-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 540px;
  max-width: 100vw;
  background: #fff;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
  z-index: 9001;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  display: flex;
  flex-direction: column;
}
.rider-drawer.open {
  transform: translateX(0);
}

.drawer-header {
  padding: 16px 20px;
  background: #2c3e50;
  color: #fff;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}
.drawer-title-wrap {
  flex: 1;
  min-width: 0;
}
.drawer-header h3 {
  margin: 0 0 4px;
  font-size: 16px;
  color: #fff;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.drawer-subtitle {
  font-size: 12px;
  color: #bdc3c7;
}
.drawer-close {
  background: transparent;
  color: #fff;
  border: none;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  border-radius: 4px;
}
.drawer-close:hover {
  background: rgba(255, 255, 255, 0.15);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px 20px;
}

.drawer-stats {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  padding: 10px 14px;
  background: #f5f8fb;
  border-radius: 5px;
  margin-bottom: 14px;
  font-size: 12px;
}
.drawer-stat {
  color: #555;
}
.drawer-stat strong {
  color: #2c3e50;
  font-size: 14px;
}
.drawer-stat-pending strong {
  color: #b35900;
}
.drawer-stat-acked strong {
  color: #1f6e2e;
}

.drawer-loading,
.drawer-error,
.drawer-empty {
  padding: 20px;
  text-align: center;
  color: #777;
  font-size: 13px;
}
.drawer-error {
  color: #c0392b;
  background: #fdecea;
  border-radius: 4px;
}

.drawer-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #e1e5ea;
  margin-bottom: 10px;
  font-size: 12px;
}
.drawer-select-all {
  cursor: pointer;
  color: #555;
}
.drawer-select-all input {
  margin-right: 5px;
  vertical-align: middle;
}
.drawer-selected-count {
  color: #3498db;
  font-weight: 600;
}

.drawer-events {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.event-row {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #e1e5ea;
  border-radius: 5px;
  font-size: 12.5px;
}
.event-row.event-acked {
  background: #f6faf6;
  border-color: #c8e0c8;
  opacity: 0.85;
}
.event-row:hover:not(.event-acked) {
  border-color: #3498db;
  background: #f5fbff;
}

.event-check {
  flex-shrink: 0;
  padding-top: 2px;
}
.event-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
}
.event-acked-icon {
  color: #28a745;
  font-size: 16px;
}

.event-main {
  flex: 1;
  min-width: 0;
}
.event-line1 {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 4px;
  font-size: 11.5px;
}
.event-action {
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 11px;
}
.action-accept {
  background: #d4edda;
  color: #155724;
}
.action-withdraw {
  background: #f8d7da;
  color: #721c24;
}
.action-other {
  background: #e2e3e5;
  color: #383d41;
}

.event-date {
  color: #777;
}
.event-perf {
  color: #888;
  font-style: italic;
}
.event-line2 {
  font-size: 13px;
  color: #2c3e50;
}
.event-desc {
  margin-top: 5px;
  color: #666;
  font-size: 11.5px;
  font-style: italic;
  line-height: 1.4;
}
.event-acked-info {
  margin-top: 5px;
  font-size: 10.5px;
  color: #1f6e2e;
}

.drawer-footer {
  padding: 12px 20px;
  border-top: 1px solid #e1e5ea;
  background: #fafbfc;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
}

/* ─── Section title avec action à droite ─── */
.section-title {
  display: flex;
  align-items: center;
}

/* ─── Login page ─── */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  max-width: 520px;
  width: 100%;
}
.login-footer {
  background: #f8f9fa;
  padding: 14px 20px;
  text-align: center;
  color: #777;
  font-size: 12px;
  border-top: 1px solid #e1e5ea;
}

/* ─── Dashboard ─── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}
.stat-card {
  padding: 18px 20px;
  border-radius: 8px;
  border: 1px solid #e1e5ea;
}
.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  color: #2c3e50;
  line-height: 1;
  margin-bottom: 8px;
}
.stat-card .stat-label {
  font-size: 12px;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.stat-card .stat-label .fa {
  color: #3498db;
  margin-right: 4px;
}
.stat-purple {
  background: #f3eaff;
  border-color: #d1baf0;
}
.stat-purple .stat-value {
  color: #533397;
}
.stat-blue {
  background: #e3edfa;
  border-color: #b8c9e0;
}
.stat-blue .stat-value {
  color: #1f4e79;
}
.stat-teal {
  background: #e1f0e6;
  border-color: #b4d4be;
}
.stat-teal .stat-value {
  color: #0f6e56;
}
.stat-amber {
  background: #fff3cd;
  border-color: #e0c66a;
}
.stat-amber .stat-value {
  color: #856404;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.quick-action {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: #fff;
  border: 1px solid #e1e5ea;
  border-radius: 6px;
  text-decoration: none;
  color: #2c3e50;
  font-size: 13.5px;
  transition: all 0.15s;
}
.quick-action:hover {
  border-color: #3498db;
  background: #f3f9fe;
  color: #1f4e79;
}
.quick-action .fa {
  font-size: 22px;
  color: #3498db;
}
/* Drapeau inline (dans un titre/sous-titre, format réduit) */
.flag-inline {
  display: inline-block;
  width: 18px;
  height: 13.5px;
  background-size: cover;
  background-position: 50%;
  border-radius: 1px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
  vertical-align: 0px;
  margin-left: 4px;
}
h3 .flag-inline {
  vertical-align: middle;
  margin-bottom: 2px; /* ajuste optique selon la font */
}

/* V5.x : drapeau neutre (codes FEI AIN/NI2/NPA/RPC) — carre blanc bord gris */
.fi.fi-neutral {
  background-color: #fff !important;
  background-image: none !important;
  box-shadow: inset 0 0 0 1px #bbb;
}
.header-section h3 .horse-icon {
    width: 1.5em;
    height: 1.5em;
    vertical-align: -0.18em;
    margin-right: .35em;
    color:#e67e22;
}
.horse-icon-top {
    width: 1.5em;
    height: 1.5em;
    vertical-align: -0.50em;
    margin-right: .35em;
}
/* ============================================================
   TOP-NAV (fusionné depuis _top-nav-v511.css)
   ============================================================ */
/* ═══════════════════════════════════════════════════════════════
   _top-nav-v511.css
   Patch complétant le top-nav pour V5.11 :
   les classes brand-logo, brand-text, lang-switcher, lang-menu,
   user-name-link, user-role, app-version, btn-logout n'avaient
   pas de styles dans app.css après le passage à V5.11.

   À inclure dans index.volt <head> APRÈS app.css :
     <link rel="stylesheet" href="{{ url('css/_top-nav-v511.css') }}">

   OU à concaténer à la fin de app.css (équivalent).
   ═══════════════════════════════════════════════════════════════ */

/* ─── Brand : logo + sous-titre "FEI Stables" ─── */
.top-nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.brand-logo {
  height: 36px;
  width: auto;
  display: block;
  flex-shrink: 0;
}
.brand-text {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.3px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
/* V5.x : logo FEI intégré dans le titre, à la place du mot "FEI" */
.brand-fei-logo {
  height: 28px;
  width: auto;
  display: block;
  filter: brightness(1.4);
}

/* ─── Liens de la nav : pas de retour à la ligne ─── */
.top-nav-links {
  flex: 1;
  min-width: 0;
  overflow: visible; /* le sous-menu Administration doit pouvoir déborder */
}
.top-nav-links a {
  white-space: nowrap;
}

/* ─── Bloc utilisateur à droite ─── */
.top-nav-user {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
  flex-shrink: 0;
  white-space: nowrap;
}

.top-nav-user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  line-height: 1.1;
  white-space: nowrap;
  max-width: 240px;
  overflow: hidden;
}

/* Lien sur le nom : clic = /my-account */
.user-name-link {
  color: #fff;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 4px;
  transition: background 0.15s;
  line-height: 1;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-name-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  text-decoration: none;
}
.user-name-link .fa {
  color: #5dade2;
  font-size: 14px;
  flex-shrink: 0;
}
.user-name {
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ─── Badge rôle (super_admin / company_admin / user) ─── */
.user-role {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1.3;
  margin-left: 22px; /* aligné avec le texte du nom, après l'icône user-circle */
}
.user-role.role-super_admin {
  background: #e74c3c;
  color: #fff;
}
.user-role.role-company_admin {
  background: #3498db;
  color: #fff;
}
.user-role.role-user {
  background: #7f8c8d;
  color: #fff;
}

/* ─── Sous-menu "Administration" (dropdown nav, ouverture au survol) ─── */
.nav-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.nav-dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: transparent;
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 4px;
  white-space: nowrap;
  transition: background 0.15s;
}
.nav-dropdown-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
}
.nav-dropdown-caret {
  font-size: 11px;
  opacity: 0.8;
}
.nav-dropdown.active > .nav-dropdown-toggle {
  background: rgba(255, 255, 255, 0.12);
}
.nav-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  background: #fff;
  border: 1px solid #d6dde5;
  border-radius: 5px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  min-width: 190px;
  padding: 4px 0;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition:
    opacity 0.12s,
    transform 0.12s,
    visibility 0.12s;
}
/* Pseudo-élément qui comble le gap toggle↔menu pour ne pas refermer au survol */
.nav-dropdown::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  height: 8px;
  pointer-events: none;
}
.nav-dropdown:hover::after {
  pointer-events: auto;
}
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu,
.nav-dropdown.open .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.nav-dropdown-menu a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 14px;
  color: #2c3e50;
  text-decoration: none;
  font-size: 13px;
  white-space: nowrap;
  transition: background 0.1s;
}
.nav-dropdown-menu a:hover {
  background: #f5f8fb;
  color: #1f4e79;
}
.nav-dropdown-menu a.active {
  background: #e8f4fd;
  color: #1f4e79;
  font-weight: 600;
}
.nav-dropdown-menu a .fa {
  color: #5dade2;
  width: 16px;
  text-align: center;
}
.nav-dropdown-sep {
  height: 1px;
  background: #e1e4e8;
  margin: 4px 0;
}

/* ─── Switcher de langue (FR / EN) ─── */
.lang-switcher {
  position: relative;
  display: inline-block;
}
/* Pseudo-élément qui comble le gap entre .lang-current et .lang-menu
   pour empêcher la fermeture du menu quand on glisse la souris vers le bas. */
.lang-switcher::after {
  content: "";
  position: absolute;
  top: 100%;
  right: 0;
  width: 100%;
  height: 10px;
  pointer-events: none;
}
.lang-switcher:hover::after {
  pointer-events: auto;
}
.lang-current {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.lang-current:hover {
  background: rgba(255, 255, 255, 0.18);
}
.lang-current .fa {
  color: #5dade2;
  font-size: 12px;
}

/* Menu déroulant : caché par défaut, visible au hover/focus */
.lang-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: #fff;
  border: 1px solid #d6dde5;
  border-radius: 5px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  min-width: 150px;
  padding: 4px 0;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition:
    opacity 0.12s,
    transform 0.12s,
    visibility 0.12s;
}

/* Fallback "click-to-toggle" : si .lang-switcher a la classe .open, le menu reste visible.
   Ajoutée par le JS du layout pour les périphériques tactiles ou si :hover ne marche pas. */
.lang-switcher.open .lang-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Ouverture au hover ou au focus-within (accessibilité clavier) */
.lang-switcher:hover .lang-menu,
.lang-switcher:focus-within .lang-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.lang-option {
  display: block;
  width: 100%;
  padding: 7px 14px;
  background: transparent;
  color: #2c3e50;
  border: 0;
  text-align: left;
  font-size: 12.5px;
  cursor: pointer;
  transition: background 0.1s;
}
.lang-option:hover {
  background: #f5f8fb;
}
.lang-option.active {
  background: #e8f4fd;
  color: #1f4e79;
  font-weight: 600;
}

/* ─── Bouton "Quitter" ─── */
.btn-logout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition:
    background 0.15s,
    border-color 0.15s;
}
/* V5.x : "Quitter" iconifié — texte masqué (tooltip via title="…") */
.btn-logout {
  gap: 0;
  padding: 6px 10px;
}
.btn-logout-text {
  display: none;
}
/* V5.x : sélecteur de langue iconifié — globe seul (code masqué) */
.lang-current .lang-code {
  display: none;
}
.lang-current {
  gap: 0;
  padding: 6px 10px;
}

/* V5.x : icône Journal d'audit — même rendu "bouton" que langue / Quitter */
.top-nav-audit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  font-size: 14px;
  text-decoration: none;
  transition:
    background 0.15s,
    border-color 0.15s;
}
.top-nav-audit:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  text-decoration: none;
}
.top-nav-audit.active {
  background: rgba(93, 173, 226, 0.25);
  border-color: #5dade2;
}
.top-nav-audit .fa {
  color: #5dade2;
}
.btn-logout:hover {
  background: #e74c3c;
  border-color: #e74c3c;
  color: #fff;
  text-decoration: none;
}
.btn-logout .fa {
  color: #fff;
  font-size: 12px;
}

/* ─── Numéro de version (petit, discret) ─── */
.app-version {
  font-size: 10.5px;
  color: rgba(255, 255, 255, 0.45);
  font-weight: 500;
  letter-spacing: 0.3px;
  padding-left: 4px;
  border-left: 1px solid rgba(255, 255, 255, 0.15);
  margin-left: 2px;
}

/* ─── Responsive : sur petit écran, compresser ─── */
@media (max-width: 1100px) {
  .brand-text {
    display: none; /* on garde juste le logo */
  }
  .user-role {
    display: none; /* on cache le badge rôle */
  }
}
@media (max-width: 900px) {
  .top-nav-user {
    gap: 8px;
  }
  .app-version {
    display: none;
  }
  .btn-logout span,
  .lang-current {
    font-size: 11px;
  }
}

/* ═══════════════════════════════════════════════════════════════
   Colonne BOXES : affichage par semaine, codes empilés verticalement
   ═══════════════════════════════════════════════════════════════ */
.cell-boxes {
  text-align: left !important;
  padding: 4px 8px !important;
  vertical-align: top !important;
  width: 70px;
  min-width: 60px;
  max-width: 90px;
  font-size: 10.5px;
  white-space: normal;
  word-break: break-word;
}
.col-boxes {
  width: 70px;
  min-width: 60px;
  max-width: 90px;
}

/* V5.x : rétrécir les colonnes TOT et BOX (ne contiennent qu'un petit nombre) */
.riders-recap-table .total-header,
.riders-recap-table .nch-total-cell,
.riders-recap-table .nch-box-cell {
  width: 42px !important;
  min-width: 42px !important;
  max-width: 48px !important;
  text-align: center !important;
}

/* V5.x : drapeau de nationalité dans le récap riders */
.cell-nation .fi {
  font-size: 15px;
  vertical-align: middle;
  border-radius: 2px;
  box-shadow: 0 0 1px rgba(0, 0, 0, 0.3);
}
.cell-nation .nation-code {
  margin-left: 5px;
  font-size: 11px;
  color: #555;
  vertical-align: middle;
}

/* V5.x : barre de défilement horizontale collée en bas de l'écran (récap) */
.recap-sticky-scrollbar {
  position: fixed;
  bottom: 0;
  z-index: 900;
  height: 16px;
  overflow-x: auto;
  overflow-y: hidden;
  background: rgba(245, 247, 250, 0.95);
  border-top: 1px solid #d0d6dd;
  box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.08);
  display: none;
}
.recap-sticky-scrollbar-inner {
  height: 1px;
}
.cell-boxes-week {
  margin-bottom: 4px;
}
.cell-boxes-week:last-child {
  margin-bottom: 0;
}
.cell-boxes-week-label {
  display: inline-block;
  background: #34495e;
  color: #fff;
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.3px;
  margin-bottom: 3px;
  line-height: 1.3;
}
.cell-boxes-code {
  display: block;
  background: #ecf0f1;
  color: #2c3e50;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10.5px;
  font-family: monospace;
  font-weight: 600;
  margin-top: 2px;
  width: fit-content;
}

/* ═══════════════════════════════════════════════════════════════
   Cellule NOTE compactée : bouton ⚠ qui ouvre un popover
   (override des règles avec !important dans app.css)
   ═══════════════════════════════════════════════════════════════ */
.riders-recap-table .cell-note {
  text-align: center !important;
  padding: 4px 6px !important;
  width: 50px !important;
  max-width: 50px !important;
  white-space: nowrap !important;
  font-size: 12px !important;
}

.note-auto-trigger {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  background: #fff3cd;
  color: #856404;
  border: 1px solid #f5d99a;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  line-height: 1.3;
  white-space: nowrap;
  transition:
    background 0.12s,
    border-color 0.12s;
}
.note-auto-trigger:hover {
  background: #ffe69c;
  border-color: #e6a932;
}
.note-auto-trigger:active {
  transform: translateY(1px);
}
.note-auto-trigger small {
  font-size: 10px;
  color: #b35900;
  font-weight: 600;
}

/* ─── Popover notes (positionné dynamiquement par JS) ─── */
.notes-popover {
  position: fixed;
  z-index: 9500;
  min-width: 260px;
  max-width: 420px;
  background: #fff;
  border: 1px solid #d6dde5;
  border-radius: 6px;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.18);
  padding: 10px 14px 12px;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.12s,
    visibility 0.12s;
  pointer-events: none;
}
.notes-popover.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.notes-popover-close {
  position: absolute;
  top: 4px;
  right: 6px;
  background: transparent;
  border: 0;
  font-size: 18px;
  line-height: 1;
  color: #95a5a6;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition:
    color 0.12s,
    background 0.12s;
}
.notes-popover-close:hover {
  color: #2c3e50;
  background: #f5f8fb;
}

.notes-popover-list {
  list-style: none;
  margin: 0;
  padding: 4px 18px 0 0;
}
.notes-popover-list li {
  position: relative;
  padding: 6px 0 6px 18px;
  font-size: 12.5px;
  color: #2c3e50;
  line-height: 1.4;
  border-bottom: 1px dashed #eef1f4;
}
.notes-popover-list li:last-child {
  border-bottom: none;
}
.notes-popover-list li::before {
  content: "⚠";
  position: absolute;
  left: 0;
  top: 6px;
  color: #b35900;
  font-size: 11px;
}
/* ═══════════ V5.x : Colonnes options dans le récap ═══════════ */
.riders-recap-table th.option-col-header {
  width: 40px;
  font-size: 10px;
  white-space: nowrap;
  max-width: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.riders-recap-table td.option-cell,
.riders-recap-table th.option-cell {
  width: 40px;
  text-align: center;
  font-size: 12px;
  background: #faf7fd;
}
.riders-recap-table .option-cab {
  background: #f3eafa;
}
.riders-recap-table th.option-col-header.option-cab {
  color: #8e44ad;
}
.riders-recap-table .option-cell.option-cab {
  font-weight: 600;
  color: #8e44ad;
}