:root {
  color-scheme: light;
  --ink: #202124;
  --muted: #626a73;
  --line: #d9dee4;
  --soft: #f5f7f8;
  --panel: #ffffff;
  --accent: #236f63;
  --accent-strong: #15564b;
  --rose: #f5d7d7;
  --sun: #f9edb8;
  --sky: #d8e8f7;
  --leaf: #dcebd8;
  --lilac: #e7ddf1;
  --peach: #f5dfc9;
  --pink: #edd8e4;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #eef2f1;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
}

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #eef2f1;
}

.login-panel {
  width: min(420px, 100%);
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  box-shadow: 0 18px 60px rgb(16 37 34 / 14%);
  display: grid;
  gap: 16px;
}

.login-panel h1,
.login-panel p {
  margin-bottom: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.sidebar {
  background: #102522;
  color: #f5faf8;
  min-height: 100vh;
  padding: 22px 18px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: sticky;
  top: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #dcebd8;
  color: #102522;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: #b9c7c2;
  margin-top: 2px;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-button,
.secondary-button,
.primary-button,
.ghost-button,
.icon-button {
  min-height: 40px;
  border-radius: 8px;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.nav-button {
  text-align: left;
  padding: 0 14px;
  background: transparent;
  color: #d8e1de;
}

.nav-button:hover,
.nav-button.active {
  background: #24413c;
  color: #ffffff;
}

.side-actions {
  margin-top: auto;
  display: grid;
  gap: 10px;
}

.primary-button {
  background: var(--accent);
  color: white;
  padding: 0 14px;
  font-weight: 700;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.secondary-button,
.ghost-button {
  background: #e7efec;
  color: #13332d;
  padding: 0 14px;
  font-weight: 700;
}

.ghost-button {
  background: transparent;
  color: var(--accent-strong);
  border: 1px solid var(--line);
}

.app-shell {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-strong);
  font-size: 0.78rem;
  text-transform: uppercase;
  font-weight: 800;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 2rem;
}

h2 {
  font-size: 1.25rem;
  margin-bottom: 14px;
}

h3 {
  font-size: 1rem;
  margin-bottom: 8px;
}

.context-controls,
.toolbar,
.form-grid,
.compact-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

input,
select,
textarea {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  border-radius: 8px;
  min-height: 38px;
  padding: 8px 10px;
  min-width: 0;
}

textarea {
  resize: vertical;
  min-height: 70px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.panel,
.print-page {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.panel {
  padding: 18px;
  margin-bottom: 16px;
}

.journal-head,
.section-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
}

.session-list {
  display: grid;
  gap: 10px;
}

.session-row {
  display: grid;
  grid-template-columns: 94px minmax(150px, 1.1fr) 190px minmax(180px, 1fr) minmax(220px, 1.3fr) minmax(130px, 0.8fr) 36px;
  gap: 8px;
  align-items: stretch;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
}

.session-row textarea {
  min-height: 38px;
}

.icon-button {
  width: 36px;
  height: 36px;
  background: #f0dede;
  color: #9f3030;
  font-size: 1.4rem;
  line-height: 1;
}

.domain-langage { background: var(--sun); }
.domain-eleve { background: var(--lilac); }
.domain-maths { background: var(--sky); }
.domain-arts { background: var(--peach); }
.domain-monde { background: var(--leaf); }
.domain-physique { background: var(--pink); }
.domain-evar { background: #d8d0eb; }
.domain-neutre { background: #e5e8eb; }
.domain-ateliers { background: #d3a0bb; }

.week-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(210px, 1fr));
  gap: 12px;
}

.day-column {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: white;
}

.day-column h3 {
  margin: 0;
  padding: 11px 12px;
  background: #24413c;
  color: white;
}

.week-session {
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  min-height: 82px;
}

.week-session small {
  color: var(--muted);
  font-weight: 800;
}

.progression-table,
.items-table,
.notes-table {
  width: 100%;
  border-collapse: collapse;
}

.progressions-board {
  display: grid;
  gap: 14px;
}

.progression-block {
  border: 2px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: white;
}

.progression-block-title {
  padding: 8px 10px;
  font-size: 1.05rem;
  font-weight: 800;
}

.progression-row {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) 94px 210px minmax(220px, 1.25fr) minmax(260px, 1.5fr) minmax(160px, 0.8fr) 42px;
  gap: 0;
  border-top: 1px solid var(--line);
}

.progression-row > label {
  padding: 6px;
  border-right: 1px solid var(--line);
  background: rgb(255 255 255 / 64%);
}

.progression-row > label:last-child {
  border-right: 0;
}

.progression-row input,
.progression-row select,
.progression-row textarea {
  width: 100%;
}

.calendar-grid {
  display: grid;
  grid-template-columns: 86px repeat(4, minmax(180px, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.calendar-cell,
.calendar-head {
  min-height: 54px;
  padding: 8px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: white;
}

.calendar-head {
  background: #cfe0f1;
  font-weight: 800;
  text-align: center;
}

.calendar-time {
  background: #f3f3f3;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.calendar-cell select {
  width: 100%;
}

.calendar-time button {
  width: 28px;
  height: 28px;
  min-height: 28px;
  border-radius: 6px;
  background: #f0dede;
  color: #9f3030;
  font-weight: 800;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 9px 8px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  background: white;
  font-size: 0.82rem;
}

.chip.used {
  background: #dcebd8;
  border-color: #b9d3b2;
}

.student-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 16px;
}

.agenda-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) 320px;
  gap: 16px;
}

.event-list {
  display: grid;
  gap: 10px;
}

.event-card {
  border: 1px solid var(--line);
  border-left: 6px solid var(--accent);
  border-radius: 8px;
  background: white;
  padding: 10px 12px;
}

.event-card.school {
  border-left-color: #a34f78;
}

.event-card.student {
  border-left-color: #4b86c2;
}

.event-card.personal {
  border-left-color: #777;
}

.event-card strong,
.event-card small {
  display: block;
}

.event-card small {
  color: var(--muted);
  margin-top: 2px;
}

.hours-meter {
  display: grid;
  gap: 10px;
}

.meter-bar {
  height: 16px;
  border-radius: 999px;
  background: #e5e8eb;
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  width: var(--progress, 0%);
  max-width: 100%;
  background: var(--accent);
}

.student-list {
  display: grid;
  gap: 8px;
}

.student-button {
  min-height: 38px;
  border-radius: 8px;
  background: #eef4f2;
  text-align: left;
  padding: 0 12px;
}

.student-button.active {
  background: var(--accent);
  color: white;
}

.danger-text {
  color: #9f3030;
}

.muted {
  color: var(--muted);
}

.hidden {
  display: none !important;
}

@media (max-width: 980px) {
  body {
    display: block;
  }

  .sidebar {
    min-height: auto;
    position: static;
  }

  .nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .nav-button {
    text-align: center;
  }

  .topbar,
  .journal-head,
  .section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .session-row,
  .student-layout,
  .agenda-layout,
  .week-grid {
    grid-template-columns: 1fr;
  }
}

@media print {
  body {
    display: block;
    background: white;
  }

  .sidebar,
  .topbar,
  .toolbar,
  .delete-session,
  .no-print {
    display: none !important;
  }

  .app-shell {
    padding: 0;
  }

  .view {
    display: none !important;
  }

  .view.active {
    display: block !important;
  }

  .panel {
    border: 0;
    padding: 0;
    margin: 0;
  }

  .session-row {
    break-inside: avoid;
    grid-template-columns: 70px 1fr 120px 1.4fr 1.4fr;
  }

  input,
  select,
  textarea {
    border: 0;
    padding: 0;
    background: transparent;
    appearance: none;
  }
}
