/* ─── LicensePanel — page « Ma licence » (admin établissement) ──────
 * Utilise les design tokens app.css pour cohérence visuelle avec le
 * reste de la plateforme. Layout sp-page (header + sidebar collapse). */

.license-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
}

.license-loading,
.license-error,
.license-empty {
  padding: 24px;
  text-align: center;
  color: var(--gray-500);
  background: var(--gray-50);
  border-radius: var(--radius);
}
.license-error { color: #c0392b; background: rgba(231, 76, 60, 0.08); }

/* ── Bandeau école + tier ───────────────────────────────────────── */
.license-head { margin-bottom: 24px; }
.license-school-name {
  margin: 0 0 12px;
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  display: flex; align-items: center;
}
.license-school-name i { color: var(--primary); }

.license-no-license {
  padding: 14px 18px;
  background: rgba(231, 76, 60, 0.08);
  border-left: 4px solid #e74c3c;
  border-radius: var(--radius);
  color: #c0392b;
}

.license-tier-banner {
  padding: 14px 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
/* Tiers : alignés sur la charte — gris pour basique, secondary bleu pour
 * standard, primary rose (signature marque) pour premium. */
.license-tier-essentiel { background: linear-gradient(135deg, var(--gray-300), var(--gray-500)); color: #fff; }
.license-tier-standard  { background: linear-gradient(135deg, var(--secondary), var(--secondary-dark)); color: #fff; }
.license-tier-premium   { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; }

.license-tier-label {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.4px;
}
.license-tier-validity {
  font-size: 13px;
  opacity: 0.92;
}
.license-tier-validity.is-expiring {
  background: rgba(255, 255, 255, 0.25);
  padding: 4px 10px;
  border-radius: 12px;
  font-weight: 600;
}

/* ── Jauges ──────────────────────────────────────────────────────── */
.license-gauges {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.license-gauge {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.license-gauge-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}
.license-gauge-head i { color: var(--primary); font-size: 14px; }
.license-gauge-title {
  font-size: 12px;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}
.license-gauge-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  margin: 2px 0 8px;
}
.license-gauge-value.is-warn { color: #d68910; }
.license-gauge-value.is-crit { color: #c0392b; }

.license-gauge-bar {
  height: 8px;
  background: var(--gray-100);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 6px;
}
.license-gauge-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #a8125f);
  transition: width 0.3s;
}
.license-gauge-bar-fill.is-warn { background: linear-gradient(90deg, #f0b400, #d68910); }
.license-gauge-bar-fill.is-crit { background: linear-gradient(90deg, #e74c3c, #c0392b); }

.license-gauge-hint {
  font-size: 12px;
  color: var(--gray-500);
}

/* ── Sections ────────────────────────────────────────────────────── */
.license-section {
  margin-top: 20px;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px;
}
.license-section-title {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.license-section-title i { color: var(--primary); font-size: 14px; }

/* ── Grille des fonctionnalités ──────────────────────────────────── */
.license-features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}
.license-feature-card {
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid var(--gray-200);
}
.license-feature-card.is-on  { border-left: 3px solid #27ae60; background: rgba(39, 174, 96, 0.05); }
.license-feature-card.is-off { border-left: 3px solid var(--gray-300); background: var(--gray-50); opacity: 0.7; }
.license-feature-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.license-feature-value {
  font-size: 12px;
  color: var(--gray-500);
}

/* ── Tables (enseignants, élèves, historique) ────────────────────── */
.license-table {
  width: 100%;
  border-collapse: collapse;
}
.license-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 10px;
  border-bottom: 2px solid var(--gray-200);
}
.license-table td {
  padding: 10px;
  border-bottom: 1px solid var(--gray-100);
  font-size: 14px;
  color: var(--text);
}
.license-cell-muted { color: var(--gray-500); font-size: 13px; }

.license-release-btn {
  background: transparent;
  border: 1px solid var(--gray-300);
  color: var(--gray-500);
  width: 32px;
  height: 32px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}
.license-release-btn:hover {
  border-color: #e74c3c;
  color: #e74c3c;
  background: rgba(231, 76, 60, 0.08);
}

.license-status {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.license-status-active    { background: rgba(39, 174, 96, 0.12);  color: #1e7e34; }
.license-status-trial     { background: rgba(241, 196, 15, 0.18); color: #856404; }
.license-status-expired   { background: rgba(231, 76, 60, 0.12);  color: #721c24; }
.license-status-suspended { background: var(--gray-100);          color: var(--gray-700); }
/* Tags tier alignés sur les bandeaux */
.license-status-tier-essentiel { background: var(--gray-200); color: var(--gray-700); }
.license-status-tier-standard  { background: rgba(48, 176, 243, 0.15); color: var(--secondary-dark); }
.license-status-tier-premium   { background: rgba(207, 21, 120, 0.12); color: var(--primary-dark); }

/* ─── Gating : éléments verrouillés par la licence ─────────────── */
.is-locked {
  position: relative;
  opacity: 0.55;
  cursor: not-allowed !important;
}
.is-locked:hover { opacity: 0.7; }
.is-locked .lock-icon {
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 11px;
  color: var(--primary);
  background: var(--bg-card);
  border-radius: 50%;
  padding: 2px 3px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
/* Sidebar items verrouillés : cadenas inline à la fin du label */
.sidebar-item.is-locked .lock-icon {
  position: static;
  margin-left: auto;
  box-shadow: none;
  background: transparent;
}

/* ─── Super-admin (Plateforme) ──────────────────────────────────── */
.plat-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 14px;
}
.plat-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--gray-300);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
}
.plat-btn:hover { border-color: var(--primary); color: var(--primary); }
.plat-btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.plat-btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.plat-btn-small { padding: 4px 10px; font-size: 12px; }

.plat-row-btn {
  background: transparent;
  border: 1px solid var(--gray-300);
  color: var(--gray-500);
  width: 32px;
  height: 32px;
  border-radius: 4px;
  cursor: pointer;
  margin-left: 4px;
  transition: all 0.15s;
}
.plat-row-btn:hover { border-color: var(--primary); color: var(--primary); }

/* Form rows : on délègue le rendu des inputs aux FormField (.ff-input,
 * .ff-textarea, .ff-select, .ff-date, .ff-number) — ici uniquement les
 * espacements et le label.
 *
 * Comportement responsive :
 *   - PORTRAIT (mobile, ou fenêtre étroite) : label au-dessus du champ
 *     (pile verticale, gain de largeur pour le champ).
 *   - PAYSAGE (tablette/desktop) : label à GAUCHE du champ (forme
 *     traditionnelle Settings/iOS), pour lecture en F-pattern. */

/* On ajoute un peu plus de respiration que le .win-body par défaut
 * (18×20) car les formulaires admin sont denses. */
.plat-form {
  padding: 22px 26px;
  display: flex;
  flex-direction: column;
  gap: 0; /* on gère l'espacement via marges .plat-form-row */
}

.plat-form-row {
  display: flex;
  flex-direction: column;
  margin-bottom: 18px;
}
.plat-form-row label {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
  letter-spacing: 0.2px;
}
.plat-form-row small {
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--gray-500);
  line-height: 1.4;
}
.plat-form-row > .ff-input,
.plat-form-row > .ff-textarea,
.plat-form-row > .ff-select,
.plat-form-row > .ff-date,
.plat-form-row > .ff-number {
  width: 100%;
}

/* Grille 3 colonnes (sièges / cap / profs et dates / statut) :
 * en paysage ≥ 600px, 3 colonnes ; en portrait, empilé. */
.plat-form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-bottom: 18px;
}
.plat-form-grid .plat-form-row { margin-bottom: 0; }
@media (orientation: landscape) and (min-width: 600px) {
  .plat-form-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ── Mode paysage : label à gauche du champ ──
 * Cible uniquement les .plat-form-row qui sont DIRECTEMENT dans le form
 * (pas dans la grille 3-cols, qui garde le label au-dessus pour ne pas
 * écraser les cellules étroites). */
@media (orientation: landscape) and (min-width: 600px) {
  .plat-form > .plat-form-row {
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
  }
  .plat-form > .plat-form-row > label {
    flex: 0 0 160px;
    margin-bottom: 0;
    text-align: right;
    padding-top: 0;
  }
  /* Le textarea reste aligné en haut (multi-lignes) */
  .plat-form > .plat-form-row:has(.ff-textarea) {
    align-items: flex-start;
  }
  .plat-form > .plat-form-row:has(.ff-textarea) > label {
    padding-top: 8px;
  }
  .plat-form > .plat-form-row > .ff-input,
  .plat-form > .plat-form-row > .ff-textarea,
  .plat-form > .plat-form-row > .ff-select,
  .plat-form > .plat-form-row > .ff-date,
  .plat-form > .plat-form-row > .ff-number {
    flex: 1 1 0;
    min-width: 0;
    width: auto;
  }
  .plat-form > .plat-form-row > small {
    flex: 1 0 100%;
    margin-top: 4px;
    margin-left: 176px;  /* 160 label + 16 gap */
    text-align: left;
  }
}

.plat-attach-results {
  max-height: 220px;
  overflow-y: auto;
  margin-top: 8px;
  border: 1px solid var(--gray-200);
  border-radius: 4px;
  background: var(--gray-50);
}
.plat-attach-results:empty { display: none; }
.plat-attach-result {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  border-bottom: 1px solid var(--gray-200);
  gap: 10px;
}
.plat-attach-result:last-child { border-bottom: none; }
.plat-attach-result small { color: var(--gray-500); font-weight: normal; }
.plat-attach-empty {
  padding: 12px;
  text-align: center;
  color: var(--gray-500);
  font-size: 13px;
}
