html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 0;
}

/* ── EduCycle Admin Shell ─────────────────────────────────── */
.ec-shell {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.ec-sidebar {
  width: 252px;
  min-width: 252px;
  background: #1b3d6f;
  color: #fff;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width .2s ease, min-width .2s ease;
}

/* ── Focus mode (collapsed) ───────────────────────────────── */
.ec-sidebar.is-collapsed {
  width: 56px;
  min-width: 56px;
}
.ec-sidebar.is-collapsed .ec-brand-text,
.ec-sidebar.is-collapsed .ec-search-form,
.ec-sidebar.is-collapsed .ec-nav-section,
.ec-sidebar.is-collapsed .ec-nav-label,
.ec-sidebar.is-collapsed .ec-user-info,
.ec-sidebar.is-collapsed .ec-logout-btn {
  display: none;
}
.ec-sidebar.is-collapsed .ec-brand {
  justify-content: center;
  padding: 18px 0;
}
.ec-sidebar.is-collapsed .ec-nav-link,
.ec-sidebar.is-collapsed .ec-focus-btn {
  justify-content: center;
  padding: 8px 0;
  border-left-color: transparent;
}
.ec-sidebar.is-collapsed .ec-nav-link.active {
  border-left-color: transparent;
  background: rgba(255,255,255,.13);
}
.ec-sidebar.is-collapsed .ec-sidebar-user {
  justify-content: center;
  padding: 12px 0;
}

/* ── Search form ──────────────────────────────────────────── */
.ec-search-form {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 12px 4px;
  padding: 6px 10px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
  transition: background .15s, border-color .15s;
}
.ec-search-form:focus-within {
  background: rgba(255,255,255,.12);
  border-color: rgba(255,255,255,.22);
}
.ec-search-icon {
  font-size: 1.1rem;
  color: rgba(255,255,255,.45);
  flex-shrink: 0;
  font-variation-settings: 'FILL' 0, 'wght' 300;
}
.ec-search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: #fff;
  font-size: .8rem;
  min-width: 0;
}
.ec-search-input::placeholder { color: rgba(255,255,255,.38); }

/* ── Focus toggle button ──────────────────────────────────── */
.ec-focus-btn {
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  margin-top: auto;
  color: rgba(255,255,255,.38);
  padding-bottom: 6px;
}
.ec-focus-btn:hover {
  color: rgba(255,255,255,.7);
  background: rgba(255,255,255,.07);
}
.ec-focus-btn .material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 300;
}

/* Brand */
.ec-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,.09);
}

.ec-brand-icon {
  font-size: 1.75rem;
  color: #93c5fd;
  flex-shrink: 0;
  font-variation-settings: 'FILL' 1;
}

.ec-brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ec-brand-name {
  font-weight: 800;
  font-size: .95rem;
  color: #fff;
  letter-spacing: .01em;
  line-height: 1;
}

.ec-brand-baseline {
  font-size: .62rem;
  color: rgba(255,255,255,.42);
  letter-spacing: .06em;
  text-transform: uppercase;
}

/* Nav */
.ec-nav {
  flex: 1;
  padding: 8px 12px 6px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  list-style: none;
  margin: 0;
}

.ec-nav-section {
  display: block;
  font-size: .58rem;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: rgba(255,255,255,.38);
  padding: 16px 4px 5px;
  user-select: none;
}

.ec-nav-section:first-child { padding-top: 8px; }

.ec-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 8px 7px;
  color: rgba(255,255,255,.58);
  text-decoration: none;
  border-radius: 8px;
  font-size: .81rem;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: background .13s, color .13s, border-color .13s;
}

.ec-nav-link .material-symbols-outlined {
  font-size: 1.4rem;
  flex-shrink: 0;
  font-variation-settings: 'FILL' 0, 'wght' 300;
  transition: font-variation-settings .13s;
}

.ec-nav-link:hover {
  background: rgba(255,255,255,.09);
  color: rgba(255,255,255,.92);
  text-decoration: none;
  border-left-color: rgba(255,255,255,.2);
}

.ec-nav-link.active {
  background: rgba(255,255,255,.13);
  color: #fff;
  font-weight: 600;
  border-left-color: #60a5fa;
}

.ec-nav-link.active .material-symbols-outlined {
  font-variation-settings: 'FILL' 1, 'wght' 400;
  color: #93c5fd;
}

.ec-nav-link.disabled { pointer-events: none; opacity: .3; }

/* User footer */
.ec-sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid rgba(255,255,255,.09);
  background: rgba(0,0,0,.15);
  flex-shrink: 0;
}

.ec-user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: .05em;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
}

.ec-user-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.ec-user-name {
  font-size: .74rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ec-user-role {
  font-size: .63rem;
  color: rgba(255,255,255,.42);
}

.ec-logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: rgba(255,255,255,.4);
  cursor: pointer;
  padding: 5px;
  border-radius: 6px;
  transition: color .13s, background .13s;
  flex-shrink: 0;
}

.ec-logout-btn:hover {
  color: #fff;
  background: rgba(255,255,255,.1);
}

.ec-logout-btn .material-symbols-outlined { font-size: 1.15rem; }

.ec-content {
  flex: 1;
  background: #f0f4fa;
  padding: 2rem;
  overflow-y: auto;
  min-height: 100vh;
}

.ec-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.ec-page-header h1 {
  font-size: 1.5rem;
  margin: 0;
  font-weight: 600;
}

/* ── Student Hero ─────────────────────────────────────────── */
.ec-student-hero {
  background: #fff;
  border-radius: .75rem;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
  padding: 1.5rem;
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

.ec-avatar {
  width: 120px;
  height: 120px;
  border-radius: .625rem;
  object-fit: cover;
  flex-shrink: 0;
}

.ec-avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #e2e8f0;
  color: #94a3b8;
}

.ec-avatar-wrap {
  position: relative;
  display: block;
  cursor: pointer;
  border-radius: .625rem;
  overflow: hidden;
}

.ec-avatar-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  opacity: 0;
  transition: opacity .2s;
  border-radius: .625rem;
}

.ec-avatar-wrap:hover .ec-avatar-overlay { opacity: 1; }

.ec-hero-body { flex: 1; min-width: 0; }

.ec-hero-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.ec-hero-name { font-size: 1.75rem; font-weight: 700; margin: 0 0 .25rem; }
.ec-hero-sub  { color: #64748b; font-size: .875rem; margin: 0; }

.ec-hero-stats {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  padding-top: 1rem;
  border-top: 1px solid #e2e8f0;
}

.ec-stat { display: flex; flex-direction: column; gap: .15rem; }
.ec-stat-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: #94a3b8; font-weight: 600; }
.ec-stat-value { font-size: .9rem; font-weight: 600; color: #1e293b; }

/* ── Badges ───────────────────────────────────────────────── */
.ec-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.ec-badge-active   { background: #dcfce7; color: #15803d; }
.ec-badge-inscrit  { background: #dbeafe; color: #1d4ed8; }
.ec-badge-archived { background: #e2e8f0; color: #475569; }
.ec-badge-leave    { background: #ffdad9; color: #92001f; border: 1px solid rgba(146,0,31,.2); }
.ec-badge-inactive { background: rgba(196,198,205,.3); color: #44474c; border: 1px solid rgba(116,119,125,.2); }

/* ── Definition list ──────────────────────────────────────── */
.ec-dl { margin: 0; }
.ec-dl-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: .6rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  font-size: .875rem;
}
.ec-dl-row:last-child { border-bottom: none; }
.ec-dl-row dt { color: #64748b; font-weight: 400; flex-shrink: 0; }
.ec-dl-row dd { margin: 0; font-weight: 600; text-align: right; word-break: break-all; }

/* ── Parent card ──────────────────────────────────────────── */
.ec-parent-card {
  background: #f8fafc;
  border-radius: .5rem;
  padding: .75rem;
}
.ec-parent-card:last-child { margin-bottom: 0 !important; }

/* ── List avatar (initiales) ──────────────────────────────── */
.ec-list-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: .75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
/* ── Classe card ──────────────────────────────────────────── */
.ec-classe-card { transition: box-shadow .15s; }
.ec-classe-card:hover { box-shadow: 0 4px 16px rgba(4,22,39,.1); }

.ec-classe-icon {
  width: 44px;
  height: 44px;
  border-radius: .5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* ── KPI card (dashboard) ─────────────────────────────────── */
.ec-kpi-card { transition: box-shadow .15s, transform .15s; }
.ec-kpi-card:hover { box-shadow: 0 4px 16px rgba(4,22,39,.1); transform: translateY(-1px); }

/* ── KPI inline (Notes, Finance…) ────────────────────────── */
.ec-kpi-val {
  font-size: 2rem;
  font-weight: 800;
  color: #1e293b;
  line-height: 1;
  margin-bottom: 4px;
}

.ec-kpi-lbl {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #94a3b8;
  font-weight: 600;
}

/* ── Tabs (Notes, Finance…) ───────────────────────────────── */
.ec-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 0;
}

.ec-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: .82rem;
  font-weight: 500;
  color: #64748b;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  border-radius: 6px 6px 0 0;
  transition: color .13s, border-color .13s, background .13s;
}

.ec-tab:hover {
  color: #1e293b;
  background: #f1f5f9;
  text-decoration: none;
}

.ec-tab.active {
  color: #1d4ed8;
  border-bottom-color: #1d4ed8;
  font-weight: 600;
}

.ec-tab-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 20px;
  font-size: .62rem;
  font-weight: 700;
  background: #dbeafe;
  color: #1d4ed8;
  letter-spacing: .02em;
}

/* ── Notes rows ───────────────────────────────────────────── */
.ec-notes-row:hover { background: #f8fafc; }

/* ── Année scolaire selector ──────────────────────────────── */
.ec-annee-btn {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: .78rem;
  font-weight: 500;
  color: #64748b;
  background: #f1f5f9;
  text-decoration: none;
  border: 1px solid #e2e8f0;
  transition: background .13s, color .13s, border-color .13s;
}
.ec-annee-btn:hover {
  background: #e2e8f0;
  color: #1e293b;
  text-decoration: none;
}
.ec-annee-btn.active {
  background: #1d4ed8;
  color: #fff;
  border-color: #1d4ed8;
  font-weight: 600;
}

/* ── Sort links ───────────────────────────────────────────── */
.ec-sort-link {
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
}
.ec-sort-link:hover { color: #1d4ed8; text-decoration: none; }
