:root {
  --main: #418811;
  --main-dark: #d9584d;
  --main-soft: #fff0ee;
  --text: #252b33;
  --muted: #6c7580;
  --border: #edf0f3;
  --bg: #f7f8fa;
  --success: #2ead6b;
  --warning: #f2a93b;
  --danger: #d94d4d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Gill Sans", "Gill Sans MT", Calibri, "Trebuchet MS", sans-serif;
  color: var(--text);
  background: var(--bg);
}

a {
  text-decoration: none;
}

.app-layout {
  min-height: 100vh;
  display: flex;
}

.sidebar {
  width: 250px;
  background: #fff;
  border-right: 1px solid var(--border);
  padding: 22px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.brand-logo {
  width: 46px;
  height: 46px;
  border-radius: 15px;
  background: var(--main);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 1.45rem;
  box-shadow: 0 14px 30px rgba(236, 106, 93, 0.22);
}

.brand-title {
  font-weight: 850;
  line-height: 1.05;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 2px;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-link-app {
  color: #49515b;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 16px;
  font-weight: 650;
  transition: 0.2s;
}

.nav-link-app:hover,
.nav-link-app.active {
  color: var(--main);
  background: var(--main-soft);
}

.nav-link-app i {
  font-size: 1.22rem;
}

.sidebar-footer {
  margin-top: auto;
  background: #fafafb;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 14px;
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--main-soft);
  color: var(--main);
  display: grid;
  place-items: center;
  font-weight: 800;
}

.main {
  flex: 1;
  min-width: 0;
}

.topbar {
  height: 76px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 34px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.mobile-menu-btn {
  border: 0;
  background: var(--main-soft);
  color: var(--main);
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: none;
}

.content {
  padding: 32px 34px 42px;
}

.hero {
  background: linear-gradient(135deg, var(--main) 0%, #f08a7f 100%);
  color: #fff;
  border-radius: 28px;
  padding: 30px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 22px 55px rgba(236, 106, 93, 0.25);
}

.hero:after {
  content: "";
  position: absolute;
  width: 280px;
  height: 280px;
  right: -85px;
  top: -95px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
}

.hero > * {
  position: relative;
  z-index: 1;
}

.hero h1 {
  font-weight: 850;
  letter-spacing: -0.04em;
  margin-bottom: 8px;
}

.hero p {
  max-width: 760px;
  opacity: 0.93;
  margin: 0;
}

.btn-main {
  background: var(--main);
  color: #fff;
  border: 0;
  font-weight: 750;
  border-radius: 15px;
  padding: 11px 17px;
}

.btn-main:hover {
  background: var(--main-dark);
  color: #fff;
}

.btn-soft {
  background: var(--main-soft);
  color: var(--main);
  border: 0;
  font-weight: 750;
  border-radius: 15px;
  padding: 11px 17px;
}

.btn-white {
  background: #fff;
  color: var(--main);
  border: 0;
  font-weight: 750;
  border-radius: 15px;
  padding: 11px 17px;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
  margin: 32px 0 16px;
}

.section-title h2 {
  font-size: 1.35rem;
  font-weight: 850;
  margin: 0;
}

.section-title p {
  margin: 4px 0 0;
  color: var(--muted);
}

.stat-card,
.panel,
.workshop-card,
.table-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: 0 14px 36px rgba(35, 42, 52, 0.05);
}

.stat-card {
  padding: 20px;
  height: 100%;
}

.stat-icon {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--main-soft);
  color: var(--main);
  font-size: 1.35rem;
  margin-bottom: 14px;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 850;
  line-height: 1;
}

.stat-label {
  color: var(--muted);
  font-weight: 600;
  margin-top: 6px;
}

.panel {
  padding: 24px;
}

.badge-soft {
  background: var(--main-soft);
  color: var(--main);
  border-radius: 999px;
  padding: 7px 10px;
  font-weight: 800;
  font-size: 0.78rem;
}

.badge-full {
  background: #f1f2f4;
  color: #69717a;
  border-radius: 999px;
  padding: 7px 10px;
  font-weight: 800;
  font-size: 0.78rem;
}

.meta-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.meta-pill {
  background: #f7f8fa;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.workshop-card {
  padding: 18px;
  position: relative;
  overflow: hidden;
}

.workshop-card:before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 7px;
  background: var(--main);
}

.workshop-card.full:before {
  background: #b8bdc3;
}

.workshop-title {
  font-weight: 850;
  margin-bottom: 8px;
  padding-left: 4px;
}

.available-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.app-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.app-table th {
  background: #30343a;
  color: #fff;
  padding: 13px;
  font-size: 0.9rem;
}

.app-table td {
  padding: 13px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.app-table tr:nth-child(even) td {
  background: #fff4f2;
}

.table-card {
  overflow: hidden;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.form-panel {
  max-width: 980px;
}

.form-control,
.form-select {
  border-radius: 14px;
  border: 1px solid #dde2e8;
  padding: 11px 13px;
}

.calendar-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.week-grid {
  display: grid;
  grid-template-columns: 90px repeat(5, minmax(160px, 1fr));
  border: 1px solid var(--border);
  border-radius: 24px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 14px 36px rgba(35, 42, 52, 0.05);
}

.week-cell {
  min-height: 138px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 12px;
}

.week-head {
  background: #fff7f6;
  font-weight: 850;
  text-align: center;
  min-height: auto;
}

.time-head {
  background: #fafafb;
  font-weight: 850;
  color: var(--main);
  display: flex;
  align-items: center;
  justify-content: center;
}

.slot-card {
  background: var(--main-soft);
  border-left: 5px solid var(--main);
  border-radius: 14px;
  padding: 10px;
  font-size: 0.86rem;
  margin-bottom: 8px;
}

.slot-card.grey {
  background: #f3f4f6;
  border-color: #adb3ba;
}

.slot-card.green {
  background: #f1ffe7;
  border-color: #a8e76a;
}

.slot-card.blue {
  background: #edf8ff;
  border-color: #9bd6f7;
}

.slot-card.salmon {
  background: #fff0ee;
  border-color: #ecaa9d;
}

.slot-title {
  font-weight: 850;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #fff 0%, var(--main-soft) 100%);
  padding: 20px;
}

.login-card {
  width: min(460px, 100%);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 32px;
  box-shadow: 0 22px 55px rgba(35, 42, 52, 0.08);
}

@media (max-width: 991.98px) {
  .app-layout {
    display: block;
  }

  .sidebar {
    position: fixed;
    z-index: 100;
    left: -270px;
    transition: 0.25s;
  }

  .sidebar.open {
    left: 0;
  }

  .mobile-menu-btn {
    display: grid;
    place-items: center;
  }

  .topbar {
    padding: 0 18px;
  }

  .content {
    padding: 22px 18px 32px;
  }

  .available-grid {
    grid-template-columns: 1fr;
  }

  .week-grid {
    overflow-x: auto;
    display: block;
    white-space: nowrap;
  }

  .week-cell {
    display: inline-block;
    width: 210px;
    height: 138px;
    white-space: normal;
    vertical-align: top;
  }

  .time-head,
  .week-head {
    height: auto;
  }
}

@media (max-width: 575.98px) {
  .hero {
    padding: 24px 20px;
    border-radius: 22px;
  }

  .hero h1 {
    font-size: 1.8rem;
  }

  .section-title {
    display: block;
  }

  .actions .btn {
    width: 100%;
  }
}

/* Brique cantine + interface élève mobile */
.student-fun-hero {
  background: linear-gradient(135deg, #ec6a5d 0%, #ff9f7a 100%);
  color: #fff;
  border-radius: 32px;
  padding: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  box-shadow: 0 24px 58px rgba(236, 106, 93, 0.28);
  position: relative;
  overflow: hidden;
}

.student-fun-hero:before {
  content: "";
  position: absolute;
  right: -70px;
  top: -90px;
  width: 230px;
  height: 230px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
}

.student-fun-hero h1 {
  font-weight: 900;
  letter-spacing: -0.045em;
  margin: 10px 0 8px;
}

.student-fun-hero p {
  margin: 0;
  max-width: 720px;
  opacity: 0.95;
}

.pill-light {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  padding: 8px 13px;
  font-weight: 850;
}

.fun-counter {
  width: 156px;
  height: 156px;
  border-radius: 36px;
  background: #fff;
  color: var(--main);
  display: grid;
  place-items: center;
  text-align: center;
  flex: 0 0 auto;
  box-shadow: 0 18px 36px rgba(35, 42, 52, 0.12);
  transform: rotate(2deg);
}

.fun-counter span {
  font-size: 3.1rem;
  font-weight: 950;
  line-height: 1;
}

.fun-counter small {
  font-weight: 800;
  color: #6c7580;
  max-width: 110px;
}

.mobile-week-switch {
  margin-top: 18px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  box-shadow: 0 14px 36px rgba(35, 42, 52, 0.05);
}

.cantine-mobile-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.meal-day {
  background: #fff;
  border: 2px solid #eef1f4;
  border-radius: 26px;
  padding: 18px 14px;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
  box-shadow: 0 14px 36px rgba(35, 42, 52, 0.05);
  cursor: pointer;
  transition: 0.18s ease;
  position: relative;
  overflow: hidden;
}

.meal-day input {
  position: absolute;
  opacity: 0;
}

.meal-day.checked {
  border-color: var(--main);
  background: var(--main-soft);
  transform: translateY(-2px);
}

.meal-day.disabled {
  opacity: 0.55;
  background: #f4f5f7;
}

.day-name {
  font-size: 1.25rem;
  font-weight: 950;
}

.day-date {
  color: var(--muted);
  font-weight: 750;
}

.meal-icon {
  margin-top: auto;
  width: 54px;
  height: 54px;
  border-radius: 20px;
  background: #f4f5f7;
  color: #8b929b;
  display: grid;
  place-items: center;
  font-size: 1.8rem;
}

.meal-day.checked .meal-icon {
  background: var(--main);
  color: #fff;
}

.meal-status {
  font-weight: 850;
  color: #3c424a;
}

.mini-days {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.mini-day {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 13px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mini-day span {
  color: var(--muted);
  font-size: 0.9rem;
}

.meal-bars {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.meal-bar-row {
  display: grid;
  grid-template-columns: 150px 1fr 70px;
  align-items: center;
  gap: 14px;
}

.meal-bar-label {
  display: flex;
  flex-direction: column;
}

.meal-bar-label span {
  color: var(--muted);
  font-size: 0.9rem;
}

.meal-bar {
  height: 18px;
  background: #f1f2f4;
  border-radius: 999px;
  overflow: hidden;
}

.meal-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--main), #ff9f7a);
}

.meal-bar-count {
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--main);
  text-align: right;
}

.profile-eleve .sidebar {
  background: linear-gradient(180deg, #fff 0%, #fff8f7 100%);
}

.profile-eleve .brand-logo {
  border-radius: 18px;
  transform: rotate(-4deg);
}

@media (max-width: 991.98px) {
  .student-fun-hero {
    border-radius: 28px;
    align-items: flex-start;
  }

  .cantine-mobile-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mini-days {
    grid-template-columns: 1fr 1fr;
  }

  .meal-bar-row {
    grid-template-columns: 1fr;
  }

  .meal-bar-count {
    text-align: left;
  }

  .profile-eleve .topbar {
    height: 70px;
  }

  .profile-eleve .content {
    padding: 16px 14px 90px;
  }

  .profile-eleve .stat-card,
  .profile-eleve .panel,
  .profile-eleve .workshop-card {
    border-radius: 24px;
  }

  .profile-eleve .hero {
    border-radius: 28px;
    padding: 24px 20px;
  }

  .profile-eleve .available-grid {
    gap: 12px;
  }

  .profile-eleve .workshop-card {
    padding: 18px 16px;
  }

  .profile-eleve .btn-main,
  .profile-eleve .btn-soft,
  .profile-eleve .btn-white {
    min-height: 48px;
    border-radius: 18px;
  }
}

@media (max-width: 575.98px) {
  .student-fun-hero {
    display: block;
    padding: 24px 20px;
  }

  .student-fun-hero h1 {
    font-size: 1.75rem;
  }

  .fun-counter {
    width: 120px;
    height: 120px;
    margin: 18px auto 0;
    border-radius: 30px;
  }

  .fun-counter span {
    font-size: 2.4rem;
  }

  .cantine-mobile-grid {
    grid-template-columns: 1fr;
  }

  .meal-day {
    min-height: 118px;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas: "name icon" "date icon" "status icon";
    align-items: center;
  }

  .day-name {
    grid-area: name;
  }

  .day-date {
    grid-area: date;
  }

  .meal-icon {
    grid-area: icon;
    margin: 0;
  }

  .meal-status {
    grid-area: status;
  }

  .mobile-week-switch {
    position: sticky;
    top: 76px;
    z-index: 9;
  }

  .mini-days {
    grid-template-columns: 1fr;
  }

  .profile-eleve .topbar .dropdown .btn {
    padding: 9px 10px;
    font-size: 0.85rem;
  }

  .profile-eleve .section-title {
    margin: 24px 0 12px;
  }

  .profile-eleve .stat-value {
    font-size: 1.55rem;
  }
}

/* Extension repas : choix Cantine / Snack / Aucun */
.meal-choice-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}

.meal-choice-day {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 16px;
  box-shadow: 0 14px 36px rgba(35, 42, 52, 0.05);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.meal-choice-day.disabled {
  opacity: 0.55;
  background: #f5f6f8;
}

.meal-day-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.meal-day-head .day-name {
  display: block;
}

.meal-current-label {
  font-size: 0.76rem;
  font-weight: 900;
  background: var(--main-soft);
  color: var(--main);
  border-radius: 999px;
  padding: 7px 10px;
  white-space: nowrap;
}

.meal-picto-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.meal-picto {
  border: 2px solid #eef1f4;
  background: #fff;
  border-radius: 22px;
  min-height: 98px;
  display: grid;
  place-items: center;
  gap: 4px;
  color: #7a838e;
  font-weight: 900;
  transition: 0.16s ease;
}

.meal-picto i {
  font-size: 2.15rem;
}

.meal-picto span {
  font-size: 0.84rem;
}

.meal-picto.selected {
  border-color: var(--main);
  background: var(--main-soft);
  color: var(--main);
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(236, 106, 93, 0.13);
}

.meal-picto.snack.selected {
  border-color: #f59e0b;
  background: #fff7e8;
  color: #d97706;
  box-shadow: 0 12px 24px rgba(217, 119, 6, 0.13);
}

.meal-small-note {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 700;
}

.mini-choice {
  font-weight: 900;
  border-radius: 999px;
  padding: 5px 9px;
  background: #f1f2f4;
}

.mini-choice.cantine {
  background: var(--main-soft);
  color: var(--main);
}

.mini-choice.snack {
  background: #fff7e8;
  color: #d97706;
}

.mini-choice.none {
  background: #f1f2f4;
  color: #6b7280;
}

.stacked-bar {
  height: 22px;
  background: #eef1f4;
  border-radius: 999px;
  display: flex;
  overflow: hidden;
}

.stacked-bar span {
  height: 100%;
  display: block;
}

.bar-cantine {
  background: linear-gradient(90deg, var(--main), #ff9f7a);
}

.bar-snack {
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.bar-legend-line {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 7px;
  font-size: 0.86rem;
  color: var(--muted);
  font-weight: 750;
}

.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 5px;
}

.legend-dot.cantine {
  background: var(--main);
}

.legend-dot.snack {
  background: #f59e0b;
}

.meal-bar-row.two {
  grid-template-columns: 150px 1fr 80px;
}

@media (max-width: 991.98px) {
  .meal-choice-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .meal-bar-row.two {
    grid-template-columns: 1fr;
  }

  .meal-picto {
    min-height: 88px;
  }
}

@media (max-width: 575.98px) {
  .meal-choice-grid {
    grid-template-columns: 1fr;
  }

  .meal-choice-day {
    border-radius: 24px;
  }

  .meal-picto {
    min-height: 86px;
  }

  .meal-picto i {
    font-size: 2rem;
  }

  .meal-day-head .day-name {
    font-size: 1.15rem;
  }

  .meal-current-label {
    font-size: 0.72rem;
  }

  .bar-legend-line {
    display: block;
  }

  .bar-legend-line span {
    display: block;
    margin-bottom: 4px;
  }

}
