/* Panou admin — Academie. Temă proprie, separată de restul Academiei
   (login/curs/catalog rămân neschimbate), gândită întâi pentru telefon.
   Reutilizează componentele deja existente din academie.css (carduri,
   tabele, butoane) — aici rescriem paleta prin variabile CSS, cu 3 seturi
   de culori comutabile (data-tema), plus structura de header/meniu/bară
   de jos și transformarea tabelelor în carduri pe mobil. */

/* ---------- Cele 3 teme (comutabile din meniu, fără reîncărcare) ---------- */
body.academie.ac-admin {
  /* Varianta 1 — Ivory & Champagne Gold (implicită) */
  --text: #252525;
  --text-bland: #66645F;
  --text-sters: #8d8a83;
  --accent: #C9A66B;
  --aur-premium: #C9A66B;
  --card: #FFFFFF;
  --card-linie: #E5DFD5;
  --contur-premium: rgb(201 166 107 / 0.35);
  --linie: #E5DFD5;
  --crem: #F8F6F1;
  --crom-fundal: #FFFFFF;
  --crom-chip: #EFE9DF;
  --crom-text: #252525;
  --crom-text-bland: #66645F;
  --crom-linie: #E5DFD5;
  background: var(--crem);
  color: var(--text);
}
body.academie.ac-admin[data-tema="navy"] {
  --text: #202A35;
  --text-bland: #66717A;
  --text-sters: #8d969d;
  --accent: #C9A36A;
  --aur-premium: #C9A36A;
  --card-linie: #E2E3E2;
  --contur-premium: rgb(201 163 106 / 0.4);
  --linie: #E2E3E2;
  --crem: #F5F1E9;
  --crom-fundal: #0D2235;
  --crom-chip: #18354A;
  --crom-text: #FFFFFF;
  --crom-text-bland: rgb(255 255 255 / 0.7);
  --crom-linie: #18354A;
}
body.academie.ac-admin[data-tema="teal"] {
  --text: #263238;
  --text-bland: #687478;
  --text-sters: #8d9699;
  --accent: #C8A260;
  --aur-premium: #C8A260;
  --card-linie: #E8E4DB;
  --contur-premium: rgb(200 162 96 / 0.4);
  --linie: #E8E4DB;
  --crem: #FAF7F0;
  --crom-fundal: #24747A;
  --crom-chip: #19585E;
  --crom-text: #FFFFFF;
  --crom-text-bland: rgb(255 255 255 / 0.75);
  --crom-linie: #19585E;
}
.ac-admin [hidden] { display: none !important; }
.ac-admin .ac-bara { border-bottom-color: var(--contur-premium); }

/* ---------- Selector de temă (în meniul lateral) ---------- */
.ac-teme { display: flex; gap: 0.55rem; padding: 0.9rem 1.25rem 1.1rem; }
.ac-tema-buton {
  flex: 1; height: 2.75rem; border-radius: 10px; cursor: pointer;
  border: 2px solid transparent; padding: 0; -webkit-tap-highlight-color: transparent;
}
.ac-tema-buton[data-tema-valoare="ivoriu"] { background: linear-gradient(135deg, #F8F6F1 50%, #C9A66B 50%); }
.ac-tema-buton[data-tema-valoare="navy"] { background: linear-gradient(135deg, #0D2235 50%, #C9A36A 50%); }
.ac-tema-buton[data-tema-valoare="teal"] { background: linear-gradient(135deg, #24747A 50%, #C8A260 50%); }
.ac-tema-buton.ac-tema-buton--activa { border-color: var(--accent); }

/* ---------- Header ---------- */
.ac-bara--admin {
  position: sticky; top: 0; z-index: 20;
  background: var(--crom-fundal);
  border-bottom: 1px solid var(--crom-linie);
  padding: 0.6rem 1rem;
  padding-top: calc(0.6rem + env(safe-area-inset-top));
  min-height: 64px; box-sizing: border-box;
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
}
.ac-bara__marca { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }
.ac-bara__sigla {
  width: 2.25rem; height: 2.25rem; flex: none; border-radius: 10px;
  background: var(--crom-chip); border: 1px solid var(--crom-linie);
  padding: 0.4rem; object-fit: contain;
}
.ac-bara__texte { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.ac-bara__texte strong {
  font-family: var(--corp); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em;
  color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ac-bara__texte small { font-size: 0.9375rem; color: var(--crom-text); font-weight: 600; white-space: nowrap; }
.ac-meniu-buton {
  flex: none; width: 2.75rem; height: 2.75rem; border-radius: 10px;
  background: var(--crom-chip); border: 1px solid var(--crom-linie); color: var(--crom-text);
  display: grid; place-items: center; cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: background 0.2s var(--usor), border-color 0.2s var(--usor);
}
.ac-meniu-buton:hover, .ac-meniu-buton[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }
.ac-meniu-buton svg { width: 20px; height: 20px; }

/* ---------- Meniu lateral (drawer) ----------
   Se deschide din STÂNGA (ca în machetă), chiar dacă butonul de hamburger
   stă în dreapta antetului — exact poziția din imaginea de referință. */
.ac-drawer-fundal {
  position: fixed; inset: 0; z-index: 29; background: rgb(10 10 8 / 0.45);
  opacity: 0; transition: opacity 0.22s var(--usor);
}
.ac-drawer-fundal--vizibil { opacity: 1; }
.ac-drawer {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 30;
  width: min(20rem, 85vw);
  background: var(--crom-fundal); border-right: 1px solid var(--contur-premium);
  display: flex; flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.25s var(--usor);
  padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom);
}
.ac-drawer--deschis { transform: translateX(0); }
.ac-drawer__cap {
  display: flex; align-items: center; justify-content: space-between; gap: 0.6rem;
  padding: 0.85rem 1rem; border-bottom: 1px solid var(--crom-linie);
}
.ac-drawer__cap .ac-bara__sigla { background: var(--crom-chip); }
.ac-drawer__cap .ac-bara__texte strong { color: var(--accent); }
.ac-drawer__cap .ac-bara__texte small { color: var(--crom-text); }
.ac-drawer__inchide {
  flex: none; width: 2.25rem; height: 2.25rem; border-radius: 8px; background: none;
  border: 1px solid var(--crom-linie); color: var(--crom-text-bland); cursor: pointer;
  display: grid; place-items: center; -webkit-tap-highlight-color: transparent;
}
.ac-drawer__inchide:hover { color: var(--crom-text); border-color: var(--accent); }
.ac-drawer__inchide svg { width: 16px; height: 16px; }
.ac-drawer__corp { flex: 1; overflow-y: auto; padding: 0.5rem 0 0; color: var(--crom-text); }
.ac-drawer__corp a, .ac-drawer__corp button.ac-drawer__link {
  display: flex; align-items: center; gap: 0.75rem;
  width: 100%; text-align: left; font: inherit; background: none; border: 0;
  color: var(--crom-text); text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
  padding: 0.75rem 1.25rem; font-size: 0.9375rem; min-height: 46px; box-sizing: border-box;
  transition: background 0.18s var(--usor), color 0.18s var(--usor);
}
.ac-drawer__corp a svg, .ac-drawer__corp button.ac-drawer__link svg { flex: none; width: 19px; height: 19px; color: var(--crom-text-bland); transition: color 0.18s var(--usor); }
.ac-drawer__corp a:hover, .ac-drawer__corp button.ac-drawer__link:hover { background: var(--crom-chip); color: var(--accent); }
.ac-drawer__corp a:hover svg, .ac-drawer__corp button.ac-drawer__link:hover svg { color: var(--accent); }
.ac-drawer__separator { height: 1px; background: var(--crom-linie); margin: 0.5rem 1.25rem; }
.ac-drawer__extern { justify-content: space-between; }
.ac-drawer__extern .ac-drawer__extern-grup { display: flex; align-items: center; gap: 0.75rem; }

/* Rândul de jos „Admin / administrator” — se deschide pe loc, cu acțiunile de cont dedesubt */
.ac-drawer__profil {
  display: flex; align-items: center; gap: 0.75rem; width: 100%; text-align: left;
  font: inherit; background: none; border: 0; border-top: 1px solid var(--crom-linie);
  padding: 0.9rem 1.25rem; cursor: pointer; color: var(--crom-text); min-height: 60px; box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
.ac-drawer__profil-avatar {
  flex: none; width: 2.5rem; height: 2.5rem; border-radius: 50%;
  background: rgb(201 166 107 / 0.22); color: var(--accent);
  display: grid; place-items: center; font-weight: 700; font-size: 0.8125rem;
  overflow: hidden;
}
.ac-drawer__profil-avatar img { width: 100%; height: 100%; object-fit: cover; }
.ac-drawer__profil-texte { flex: 1; min-width: 0; line-height: 1.3; }
.ac-drawer__profil-texte strong { display: block; font-size: 0.9375rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-drawer__profil-texte span { display: block; font-size: 0.8125rem; color: var(--crom-text-bland); }
.ac-drawer__profil-chevron { flex: none; width: 15px; height: 15px; color: var(--crom-text-bland); transition: transform 0.2s var(--usor); }
.ac-drawer__profil[aria-expanded="true"] .ac-drawer__profil-chevron { transform: rotate(90deg); }
.ac-drawer__cont-actiuni { display: none; flex-direction: column; padding-bottom: 0.4rem; }
.ac-drawer__cont-actiuni--deschis { display: flex; }
.ac-drawer__cont-actiuni a, .ac-drawer__cont-actiuni button { padding-left: 2.6rem; font-size: 0.875rem; min-height: 42px; }

body.ac-corp-blocat { overflow: hidden; }
@media (prefers-reduced-motion: reduce) {
  .ac-drawer, .ac-drawer-fundal { transition: none; }
}

/* ---------- Pagini (o singură secțiune vizibilă deodată) ---------- */
.ac-admin .ac-cadru--larg {
  padding-inline: 1rem; padding-inline: max(1rem, env(safe-area-inset-left)) max(1rem, env(safe-area-inset-right));
  padding-top: 1.25rem; padding-bottom: calc(2.5rem + 4.5rem + env(safe-area-inset-bottom));
}
.ac-pagina-admin {
  display: none;
  background: var(--card); border: 1px solid var(--contur-premium); border-radius: 16px;
  box-shadow: 0 16px 40px -30px rgb(30 25 15 / 0.25);
  padding: clamp(1.5rem, 4vw, 2.5rem);
}
.ac-pagina-admin--activa { display: block; }
.ac-pagina-admin__titlu { margin: 0 0 1rem; font-family: var(--display); font-size: 1.5rem; font-weight: 400; color: var(--text); }
.ac-pagina-admin__subtitlu { margin: 0 0 1.5rem; font-size: 0.875rem; color: var(--text-bland); }

/* Buton de înapoi — vizibil pe fiecare pagină, nu doar în meniu */
.ac-inapoi {
  display: inline-flex; align-items: center; gap: 0.3rem;
  background: none; border: 0; padding: 0.5rem 0; margin-bottom: 0.75rem;
  color: var(--accent); font: inherit; font-size: 0.9375rem; font-weight: 600;
  cursor: pointer; -webkit-tap-highlight-color: transparent; min-height: 44px;
}
.ac-inapoi:hover { text-decoration: underline; }
.ac-modul-admin__chevron, .ac-lectie-admin__chevron { color: var(--accent); }

/* Navigarea din meniul lateral arată clar unde ești acum */
.ac-drawer__corp a.ac-drawer__link--activ {
  color: var(--accent); background: var(--crom-chip);
  box-shadow: inset 3px 0 0 var(--accent); font-weight: 600;
}

/* Acțiuni rapide pe Dashboard — maximum 3-4, restul se accesează din meniu */
.ac-actiuni-rapide { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.85rem; margin-top: 1.75rem; }
@media (min-width: 560px) { .ac-actiuni-rapide { grid-template-columns: repeat(4, 1fr); } }
.ac-actiuni-rapide .btn--sec { width: 100%; min-height: 44px; justify-content: center; }

.ac-modul-admin { background: var(--card); }
.ac-modul-admin__cap:hover { background: var(--crem); }
.ac-lectie-admin { background: var(--card); }
.ac-lectie-admin__cap:hover { background: var(--crem); }
.ac-acces-dropdown summary { background: var(--card); }
.ac-admin .ac-acces-dropdown { border-color: var(--contur-premium); }

/* ---------- Dashboard: cardul de bun-venit ---------- */
.ac-bun-venit {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
  background: linear-gradient(135deg, var(--crem) 0%, rgb(201 166 107 / 0.14) 100%);
  border: 1px solid var(--contur-premium); border-radius: 16px;
  padding: 1.5rem 1.6rem; margin-bottom: 1.5rem;
}
.ac-bun-venit__texte h2 { margin: 0 0 0.35rem; font-family: var(--display); font-weight: 400; font-size: 1.375rem; color: var(--text); }
.ac-bun-venit__texte p { margin: 0; font-size: 0.875rem; color: var(--text-bland); max-width: 32rem; }
.ac-bun-venit__avatar {
  flex: none; width: 3rem; height: 3rem; border-radius: 50%;
  background: rgb(201 166 107 / 0.22); color: var(--accent);
  display: grid; place-items: center; font-weight: 700; font-size: 0.9375rem;
}

/* ---------- Dashboard: carduri de statistici (2×2, cu iconiță și o cifră reală secundară) ---------- */
.ac-stats-grid { grid-template-columns: repeat(2, 1fr); gap: 0.65rem; margin-top: 1.1rem; }
.ac-stat-card {
  background: var(--card); border: 1px solid var(--contur-premium); border-radius: 12px;
  padding: 0.75rem 0.85rem; display: flex; flex-direction: row; align-items: center; gap: 0.65rem;
  width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer;
  -webkit-tap-highlight-color: transparent; transition: border-color 0.18s var(--usor, ease), transform 0.18s var(--usor, ease);
}
.ac-stat-card:hover { border-color: var(--accent); }
.ac-stat-card:active { transform: scale(0.98); }
.ac-stat-card__iconita {
  flex: none; width: 2rem; height: 2rem; border-radius: 50%;
  display: grid; place-items: center;
}
.ac-stat-card__iconita svg { width: 15px; height: 15px; }
.ac-stat-card__texte { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
/* Cifra și eticheta pe același rând — nu una deasupra celeilalte — ca
   fiecare card să rămână scund și lat, nu un pătrat înalt. */
.ac-stat-card__cifra-rand { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0.3rem 0.4rem; }
.ac-stat-card strong { font-family: var(--corp); font-size: 1.125rem; font-weight: 700; color: var(--text); line-height: 1.15; }
.ac-stat-card__cifra-rand > span { color: var(--text-bland); font-size: 0.8125rem; }
.ac-stat-card__caption { font-size: 0.6875rem; color: var(--text-sters); }
.ac-stat-card__caption--plus { color: #4d7c4a; }

/* ---------- Dashboard: secțiuni cu titlu + „Vezi toate” ---------- */
.ac-sectiune-dash { margin-top: 1.75rem; }
.ac-sectiune-dash__cap { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.9rem; }
.ac-sectiune-dash__cap h3 { margin: 0; font-family: var(--display); font-weight: 400; font-size: 1.0625rem; color: var(--text); }
.ac-sectiune-dash__cap button {
  background: none; border: 0; color: var(--accent); font: inherit; font-size: 0.8125rem; font-weight: 600;
  cursor: pointer; padding: 0.4rem 0; -webkit-tap-highlight-color: transparent;
}
.ac-sectiune-dash__cap button:hover { text-decoration: underline; }

/* ---------- Activitate recentă ---------- */
.ac-activitate { display: flex; flex-direction: column; }
.ac-activitate__rand {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.8rem 0; border-bottom: 1px solid var(--card-linie);
}
.ac-activitate__rand:last-child { border-bottom: 0; }
.ac-activitate__avatar {
  flex: none; width: 2.25rem; height: 2.25rem; border-radius: 50%;
  background: rgb(201 166 107 / 0.18); color: var(--accent);
  display: grid; place-items: center; font-size: 0.6875rem; font-weight: 700;
}
.ac-activitate__texte { flex: 1; min-width: 0; }
.ac-activitate__texte strong { display: block; font-size: 0.875rem; font-weight: 600; color: var(--text); }
.ac-activitate__texte span { display: block; font-size: 0.8125rem; color: var(--text-bland); }
.ac-activitate__cand { flex: none; font-size: 0.75rem; color: var(--text-sters); white-space: nowrap; }

/* ---------- Programe populare ---------- */
.ac-programe-populare { display: flex; flex-direction: column; gap: 0.75rem; }
.ac-programe-populare__card {
  display: flex; align-items: center; gap: 0.85rem;
  background: var(--card); border: 1px solid var(--card-linie); border-radius: 12px;
  padding: 0.7rem; cursor: pointer; text-align: left; width: 100%; font: inherit; color: inherit;
  -webkit-tap-highlight-color: transparent;
}
.ac-programe-populare__card:hover { border-color: var(--accent); }
.ac-programe-populare__poza {
  flex: none; width: 3.25rem; height: 3.25rem; border-radius: 10px; object-fit: cover;
  background: var(--crem); display: grid; place-items: center; color: var(--accent);
}
.ac-programe-populare__poza svg { width: 22px; height: 22px; }
.ac-programe-populare__texte { flex: 1; min-width: 0; }
.ac-programe-populare__texte strong { display: block; font-size: 0.9375rem; font-weight: 600; color: var(--text); }
.ac-programe-populare__texte span { display: block; font-size: 0.8125rem; color: var(--text-bland); }
.ac-programe-populare__card svg.ac-programe-populare__chevron { flex: none; width: 17px; height: 17px; color: var(--text-sters); }

/* ---------- Cursanți — rând compact (nume + stare) cu „Vezi mai mult” ---------- */
.ac-cursant {
  border: 1px solid var(--contur-premium); border-radius: 12px; margin-bottom: 0.65rem;
  background: var(--card); overflow: hidden;
}
.ac-cursant__rand {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.75rem 0.9rem;
}
.ac-cursant__cine { display: flex; align-items: center; gap: 0.65rem; min-width: 0; flex: 1; }
.ac-cursant__rand .ac-avatar { flex: none; width: 2.1rem; height: 2.1rem; font-size: 0.75rem; }
.ac-cursant__nume { min-width: 0; flex: 0 1 auto; font-weight: 600; font-size: 0.9375rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Starea de plată pe scurt — curge în spațiul gol rămas după nume, nu
   adaugă un rând nou, deci nu mărește cardul. */
.ac-cursant__stare-scurta {
  margin-left: auto; padding-left: 0.5rem; flex: 0 1 auto; min-width: 0;
  font-size: 0.75rem; color: var(--text-sters); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-align: right;
}
.ac-cursant__stare-scurta.ac-cursant__restanta { color: #b5452f; font-weight: 600; }
.ac-cursant__meta { flex: none; display: flex; align-items: center; gap: 0.6rem; }
.ac-cursant__rand .ac-badge { flex: none; }
.ac-cursant__buton {
  flex: none; background: none; border: 1px solid var(--card-linie); border-radius: 8px;
  color: var(--accent); font: inherit; font-size: 0.8125rem; font-weight: 600;
  padding: 0.4rem 0.75rem; cursor: pointer; min-height: 36px; -webkit-tap-highlight-color: transparent;
  transition: background 0.18s var(--usor, ease), border-color 0.18s var(--usor, ease);
}
.ac-cursant__buton:hover { background: var(--crem); border-color: var(--accent); }
.ac-cursant__detalii {
  padding: 0 1.1rem 1.1rem; border-top: 1px solid var(--card-linie);
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.9rem 1.5rem; margin-top: 0.1rem; padding-top: 0.9rem;
}
.ac-cursant__detalii--ascuns { display: none; }
.ac-cursant__camp { min-width: 0; }
.ac-cursant__camp span { display: block; font-size: 0.75rem; color: var(--text-sters); font-weight: 600; margin-bottom: 0.2rem; }
.ac-cursant__camp strong { display: block; font-size: 0.9375rem; color: var(--text); overflow-wrap: anywhere; }
.ac-cursant__camp strong.ac-cursant__restanta { color: #b5452f; }
.ac-cursant__camp--larg { grid-column: 1 / -1; }
/* Varianta pentru fișa completă a unui utilizator (Utilizatori): conținut
   în bloc, nu grilă de 2 coloane — profilul reutilizat are propriile
   secțiuni (.ac-profil-bloc), nu perechi scurte etichetă/valoare. */
.ac-cursant__detalii--profil { display: block; }
.ac-cursant__detalii--profil.ac-cursant__detalii--ascuns { display: none; }
.ac-cursant__email { margin: 0 0 0.75rem; font-size: 0.8125rem; color: var(--text-sters); }
.ac-cursant__email strong { color: var(--text); font-weight: 600; }
.ac-selecteaza-tot-eticheta {
  display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem;
  font-size: 0.8125rem; color: var(--text-bland);
}
@media (max-width: 480px) {
  /* Nume lungi: nu mai înghesuim totul pe un singur rând — sus avatarul cu
     numele (pe toată lățimea), dedesubt starea + butonul, aliniate la dreapta. */
  .ac-cursant__rand { flex-direction: column; align-items: stretch; }
  .ac-cursant__nume { white-space: normal; }
  .ac-cursant__meta { justify-content: flex-end; }
  .ac-cursant__detalii { grid-template-columns: 1fr; }
}

/* ---------- Căutare și filtre ---------- */
.ac-filtre-utilizatori { gap: 0.75rem; margin-bottom: 1.5rem; }
.ac-filtre-utilizatori input[type="search"] {
  padding-left: 2.25rem;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2366645F' stroke-width='2'><circle cx='10.5' cy='10.5' r='6.5'/><path d='M20 20l-4.6-4.6'/></svg>");
  background-repeat: no-repeat; background-position: 0.7rem center; background-size: 16px;
  font-size: 16px; /* previne zoom-ul automat pe iOS la focus */
}
.ac-filtre-utilizatori label {
  background: none; border: 1px solid var(--card-linie); border-radius: 99px;
  padding: 0.6rem 0.95rem; transition: background 0.18s var(--usor), border-color 0.18s var(--usor);
}
.ac-filtre-utilizatori label:has(input:checked) { background: rgb(201 166 107 / 0.16); border-color: var(--accent); color: var(--text); }

/* ---------- Aerisire generală a formularelor ---------- */
.ac-admin .ac-form-inline { gap: 0.85rem; margin-bottom: 1.5rem; }
/* input[type=file] nativ: pe WebKit nu se micșorează sub ~300px indiferent
   de restul rândului — forțat pe un rând întreg, altfel împinge pagina în
   lateral pe telefoanele mai mici. */
.ac-admin input[type="file"] { display: block; width: 100%; max-width: 100%; box-sizing: border-box; }
.ac-admin input[type="text"], .ac-admin input[type="email"], .ac-admin input[type="password"],
.ac-admin input[type="number"], .ac-admin input[type="date"], .ac-admin input:not([type]),
.ac-admin select, .ac-admin textarea {
  font-size: 16px; /* evită zoom-ul automat la focus pe Safari iPhone */
  background: var(--card); color: var(--text); border-color: var(--card-linie);
}

/* ---------- Butoane, în contextul admin ---------- */
.ac-admin .btn--sec {
  background: var(--card); color: var(--text); border: 1px solid var(--contur-premium);
  min-height: 44px; border-radius: 10px; font-weight: 600;
}
.ac-admin .btn--sec:hover { background: var(--crem); border-color: var(--accent); }
.ac-admin .btn--sec:disabled { opacity: 0.55; cursor: default; }

/* Segmentele fișei unui utilizator (Date personale, Programe, Acces,
   Plată, Istoric) — fiecare într-un cadru propriu, nu doar despărțite
   printr-o linie, ca separarea dintre ele să se vadă clar și elegant. */
.ac-admin .ac-profil-bloc {
  padding: 1rem 1.1rem; border: 1px solid var(--contur-premium); border-radius: 12px;
  margin-bottom: 0.85rem; background: var(--card);
}
.ac-admin .ac-profil-bloc:last-child { margin-bottom: 0; }

/* ---------- Avatar cu inițiale ---------- */
.ac-tabel__nume { display: flex; align-items: center; gap: 0.55rem; }
.ac-avatar {
  flex: none; width: 1.75rem; height: 1.75rem; border-radius: 50%;
  background: rgb(201 166 107 / 0.18); color: var(--accent);
  display: grid; place-items: center; font-size: 0.6875rem; font-weight: 700;
}

/* ---------- Bară de navigare de jos (mobil) ---------- */
.ac-bara-jos {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 18;
  display: flex; background: var(--crom-fundal); border-top: 1px solid var(--contur-premium);
  padding-bottom: env(safe-area-inset-bottom);
}
.ac-bara-jos__buton {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.2rem; padding: 0.5rem 0.2rem; background: none; border: 0; cursor: pointer;
  color: var(--crom-text-bland); font: inherit; font-size: 0.6875rem; min-height: 56px;
  -webkit-tap-highlight-color: transparent;
}
.ac-bara-jos__buton svg { width: 21px; height: 21px; }
.ac-bara-jos__buton--activ { color: var(--accent); }
@media (min-width: 760px) { .ac-bara-jos { display: none; } }
@media (max-width: 759px) { body.ac-admin { padding-bottom: 0; } }

/* ====================================================================
   Tabele → carduri pe telefon. Coloanele fiecărui tabel sunt fixe (vezi
   JS-ul din admin.html care le construiește) — etichetele de mai jos
   trebuie ținute sincron cu acel ordine de coloane dacă se schimbă.
   ==================================================================== */
@media (max-width: 760px) {
  /* <select> nativ: lățimea lui minimă pe WebKit urmează cea mai lungă
     opțiune din listă (ex. titlul unui program) — pe un telefon îngust
     (320px) poate împinge pagina în lateral. Pe mobil îl trecem pe un rând
     întreg; pe calculator (unde e loc) rămâne compact, lângă celelalte
     câmpuri din filtru. */
  .ac-admin select { display: block; width: 100%; max-width: 100%; box-sizing: border-box; }
  /* Rândurile de formular (.ac-form-inline) au mai multe câmpuri alăturate
     — pe telefon, trecerea lor pe rânduri separate (flex-wrap) depinde de
     fiecare câmp să se micșoreze corect, ceea ce unele controale native
     (dată, select) nu fac fiabil. Mai simplu și sigur: o coloană, un câmp
     pe rând, fiecare pe lățime întreagă — fără nicio ambiguitate. */
  .ac-admin .ac-form-inline { flex-direction: column; align-items: stretch; }
  .ac-admin .ac-form-inline > input, .ac-admin .ac-form-inline > textarea,
  .ac-admin .ac-form-inline > button, .ac-admin .ac-form-inline > .btn {
    width: 100%; max-width: 100%; box-sizing: border-box;
  }

  /* IMPORTANT: #ac-tabel-fisiere / #ac-tabel-biblioteca sunt ID-uri puse
     direct pe <tbody> în admin.html, NU pe <table> — de-aia regulile de mai
     jos nu scriu niciodată "#id tbody ...", ci "#id tr" direct. <table> în
     sine se prinde doar prin clasa .ac-tabel (comună). Fără asta, Safari/
     WebKit amestecă display:block cu modul de tabel rămas pe <table> și
     rupe textul lung literă cu literă.
     (Utilizatori și Cursanți nu mai sunt tabele — sunt carduri .ac-cursant,
     care își au deja propriul stil, identic pe mobil și pe calculator.) */
  .ac-admin .ac-tabel { display: block; width: 100%; border: 0; }
  .ac-admin .ac-tabel thead { display: none; }
  #ac-tabel-fisiere, #ac-tabel-biblioteca { display: block; width: 100%; }
  #ac-tabel-fisiere tr:not(:has(td[colspan])),
  #ac-tabel-biblioteca tr:not(:has(td[colspan])) {
    display: block;
    background: var(--card); border: 1px solid var(--card-linie); border-radius: 14px;
    padding: 1.1rem 1.1rem; margin-bottom: 1rem;
  }
  #ac-tabel-fisiere tr:has(td[colspan]), #ac-tabel-biblioteca tr:has(td[colspan]) {
    display: block; width: 100%; margin-bottom: 1rem;
  }
  #ac-tabel-fisiere tr[hidden], #ac-tabel-biblioteca tr[hidden] { display: none; }
  /* Bloc simplu, nu flex/grid: eticheta (::before) pe rândul ei, valoarea
     curge dedesubt ca text obișnuit, pe toată lățimea cardului — fără
     niciun container flex/grid care își poate micșora greșit coloana pe
     text foarte lung (bug cunoscut în Safari/WebKit cu "automatic minimum
     size" pe noduri de text simple). */
  #ac-tabel-fisiere td, #ac-tabel-biblioteca td {
    display: block; width: 100%; box-sizing: border-box;
    padding: 0.55rem 0; border-bottom: 1px dashed var(--card-linie);
    white-space: normal; text-align: left; overflow-wrap: anywhere;
  }
  #ac-tabel-fisiere td:last-child, #ac-tabel-biblioteca td:last-child { border-bottom: 0; }
  #ac-tabel-fisiere td::before, #ac-tabel-biblioteca td::before {
    display: block; font-size: 0.75rem; color: var(--text-sters); font-weight: 600; margin-bottom: 0.15rem;
  }
  #ac-tabel-fisiere td[colspan], #ac-tabel-biblioteca td[colspan] { border-bottom: 0; padding: 0.3rem 0; }
  #ac-tabel-fisiere td[colspan]::before, #ac-tabel-biblioteca td[colspan]::before { content: none; }

  #ac-tabel-fisiere td:nth-child(1) { font-weight: 700; }
  #ac-tabel-fisiere td:nth-child(1)::before { content: none; }
  #ac-tabel-fisiere td:nth-child(2)::before { content: "Tip"; }
  #ac-tabel-fisiere td:nth-child(3)::before { content: "Program"; }
  #ac-tabel-fisiere td:nth-child(4)::before { content: "Mărime"; }
  #ac-tabel-fisiere td:nth-child(5) { padding-top: 0.6rem; }
  #ac-tabel-fisiere td:nth-child(5)::before { content: none; }

  #ac-tabel-biblioteca td:nth-child(1) { font-weight: 700; }
  #ac-tabel-biblioteca td:nth-child(1)::before { content: none; }
  #ac-tabel-biblioteca td:nth-child(2)::before { content: "Mărime"; }
  #ac-tabel-biblioteca td:nth-child(3)::before { content: "Încărcat"; }
  #ac-tabel-biblioteca td:nth-child(4) { padding-top: 0.6rem; }
  #ac-tabel-biblioteca td:nth-child(4)::before { content: none; }

  #ac-tabel-fisiere td .btn, #ac-tabel-biblioteca td .btn { width: 100%; justify-content: center; }
  #ac-tabel-fisiere td span[style*="display:flex"], #ac-tabel-biblioteca td span[style*="display:flex"] { width: 100%; flex-wrap: wrap; }
}
