@font-face {
  font-family: "Barlow Condensed";
  src: url("fonts/barlow-condensed-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Barlow Condensed";
  src: url("fonts/barlow-condensed-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Barlow";
  src: url("fonts/barlow-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Barlow";
  src: url("fonts/barlow-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #16181a;
  --bar: #121212;
  --paper: #f7f6f3;
  --sheet: #fffcf7;
  --amber: #e2b93b;
  --amber-ink: #6e4a08;
  --late: #f8f1d0;
  --line: #d9d3c6;
  --quiet: #5c574e;
  --blue: #1d4e89;
  --ok: #1f6b45;
  --danger: #8d1d1d;
  --focus: #e2b93b;
  color-scheme: light;
  font-family: "Barlow", "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
}

::selection {
  background: var(--amber);
  color: var(--bar);
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

a { color: inherit; }

.bar {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  min-height: 4.25rem;
  padding: 0.75rem 1.5rem;
  background: var(--bar);
  color: #fff;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-family: "Barlow Condensed", "Arial Narrow", sans-serif;
  font-weight: 600;
  font-size: 1.7rem;
  letter-spacing: -0.02em;
  text-decoration: none;
  white-space: nowrap;
}

.brand-logo {
  display: block;
  height: 2.5rem;
  max-height: 2.5rem;
  width: auto;
}

.nav {
  display: flex;
  gap: 0.4rem;
}

.nav a {
  text-decoration: none;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
}

.nav a[aria-current="page"] {
  background: #fff;
  color: var(--bar);
}

.bar-end {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.who {
  color: #efe7d4;
  text-decoration: none;
}

.bar .logout {
  color: #fff;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.55);
}

.btn, button, .btn-quiet {
  font: 500 1rem/1 "Barlow", "Segoe UI", sans-serif;
  border: 0;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.6rem;
  padding: 0.4rem 0.95rem;
  border-radius: 4px;
}

.btn {
  background: var(--amber);
  color: var(--bar);
}

.btn:hover { background: #f0cb5c; }

.btn-quiet {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid #e4c2c2;
}

main {
  width: min(1120px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.75rem 0 4rem;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 1rem 1.5rem;
  margin: 0 0 1.75rem;
}

.filter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}

label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.92rem;
  color: var(--quiet);
}

input, select, textarea {
  font: 400 1rem/1.4 "Barlow", "Segoe UI", sans-serif;
  color: var(--ink);
  background: #fff;
  border: 1px solid #c9c3b6;
  border-radius: 4px;
  padding: 0.55rem 0.7rem;
  min-height: 2.6rem;
  caret-color: var(--bar);
}

textarea { min-height: 7rem; width: min(40rem, 100%); resize: vertical; }

.datepick { position: relative; display: grid; gap: 0.35rem; }

.datepick-caption { font-size: 0.92rem; color: var(--quiet); }

.datepick-open {
  width: 100%;
  justify-content: flex-start;
  background: #fff;
  border: 1px solid #c9c3b6;
  color: var(--ink);
  font: 400 1rem/1.4 "Barlow", "Segoe UI", sans-serif;
}

.datepick-native {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.datepop {
  position: absolute;
  z-index: 6;
  top: calc(100% + 0.35rem);
  left: 0;
  width: min(19rem, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.7rem;
  box-shadow: 0 10px 28px rgba(22, 24, 26, 0.1);
}

.datepop-head { display: flex; align-items: center; gap: 0.35rem; }

.datepop-title {
  flex: 1;
  min-height: 2.2rem;
  background: transparent;
  border: 0;
  color: var(--ink);
  font: 500 1rem/1 "Barlow", "Segoe UI", sans-serif;
}

.datepop-nav {
  width: 2.2rem;
  min-height: 2.2rem;
  padding: 0;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}

.datepop-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.2rem;
  margin-top: 0.55rem;
}

.datepop-grid.months { grid-template-columns: repeat(3, 1fr); }

.datepop-dow {
  text-align: center;
  color: var(--quiet);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  padding: 0.2rem 0;
}

.datepop-day, .datepop-month {
  min-height: 2.15rem;
  padding: 0.2rem;
  background: transparent;
  border: 0;
  color: var(--ink);
  font: 400 0.95rem/1 "Barlow", "Segoe UI", sans-serif;
}

.datepop-day.is-today { box-shadow: inset 0 0 0 1px var(--line); }

.datepop-day.is-selected, .datepop-month.is-selected {
  background: var(--amber);
  border-radius: 4px;
}

input:focus, select:focus, textarea:focus, .datepick-open:focus {
  border-color: var(--bar);
  outline: 3px solid var(--focus);
  outline-offset: 1px;
}

.sheet {
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1rem 0 0.25rem;
  margin: 0 0 1.5rem;
}

.sheet.late {
  background: var(--late);
  border-color: #e4d7a4;
}

.sheet h1, .sheet h2, .gate h1, .detail h1, .detail h2 {
  font-family: "Barlow Condensed", "Arial Narrow", sans-serif;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1;
}

.sheet h1, .sheet h2, .gate h1 { margin: 0.2rem 1rem 0.8rem; }

.detail h1, .detail h2 { margin: 0 0 0.85rem; }

.sheet h1, .detail h1, .gate h1 { font-size: 2.4rem; }
.sheet h2, .detail h2 { font-size: 2rem; }

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  font-family: "Barlow Condensed", "Arial Narrow", sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-align: left;
  color: var(--quiet);
  padding: 0.35rem 0.8rem 0.55rem;
}

th a.sort {
  color: inherit;
  text-decoration: none;
}

th a.sort:hover,
th a.sort.is-on { color: var(--ink); text-decoration: underline; text-underline-offset: 0.15em; }

.filters .check { align-self: end; min-height: 2.6rem; }

td {
  padding: 0.85rem 0.8rem;
  border-top: 1px solid rgba(22, 24, 26, 0.08);
  vertical-align: top;
}

.late td { border-top-color: rgba(110, 74, 8, 0.12); }

.title-link {
  font-weight: 500;
  text-decoration: none;
}

.title-link:hover { text-decoration: underline; text-underline-offset: 0.15em; }

.note-line {
  display: block;
  margin-top: 0.2rem;
  color: var(--quiet);
  max-width: 36rem;
}

.date { font-variant-numeric: tabular-nums; white-space: nowrap; }

.pill {
  display: inline-block;
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 0.12rem 0.55rem;
  font-size: 0.92rem;
  white-space: nowrap;
}

.pill.retard { color: var(--amber-ink); background: #fff8e4; }
.pill.cours { color: var(--blue); background: #f3f7fc; }
.pill.faire { color: #4e4a43; background: #fff; }
.pill.termine { color: var(--ok); background: #f3f8f5; }

.empty {
  margin: 0 1rem 1rem;
  color: var(--quiet);
}

.flash {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  border-radius: 4px;
  background: #e7f3ea;
  color: #143c26;
}

.flash.err { background: #fde8e8; color: var(--danger); }

.banner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  background: #fff;
  border: 1px dashed #c9b56a;
}

.gate {
  width: min(32rem, calc(100% - 2rem));
  margin: 8vh auto;
  background: var(--sheet);
  border: 1px solid var(--line);
  padding: 1.5rem 1.4rem 1.6rem;
}

.gate p, .detail p { max-width: 62ch; }

.form-grid {
  display: grid;
  gap: 0.9rem;
  margin-top: 1rem;
}

.form-grid input:not([type="checkbox"]),
.form-grid select,
.form-grid textarea {
  width: 100%;
}

.action-form {
  margin-top: 0;
}

.check {
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 0.55rem;
  color: var(--ink);
}

.check input {
  order: -1;
  width: 1.1rem;
  height: 1.1rem;
  min-height: 0;
}

.note-edit-row .member-form { margin: 0; }

.row-actions, .form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: flex-end;
}

.member-delete { margin-top: 0.75rem; }

.member-form { margin: 0 0 1.25rem; padding: 1rem; background: #fff; border: 1px solid var(--line); border-radius: 6px; }

.member-form h2 { margin-top: 0; }

.detail.members { max-width: 62rem; }

.member-table th,
.member-table td {
  vertical-align: middle;
}

.member-table td.member-actions {
  width: 9rem;
  padding-left: 1rem;
  white-space: nowrap;
  text-align: right;
}

.member-table .btn-quiet {
  min-height: 2.15rem;
  padding: 0.25rem 0.8rem;
  font-size: 0.95rem;
}

.detail { max-width: 46rem; }

.back { color: var(--quiet); }

.journal-table { margin-top: 0.4rem; }

.journal-table .muted {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.92rem;
}

.journal-table td.journal-actions {
  width: 8rem;
  white-space: nowrap;
  text-align: right;
}

.journal-table .inline-delete { display: inline; }

.action-delete { margin-top: 1.5rem; }

.note-edit-row td { background: #fff; }

.note-edit { margin: 0; max-width: 36rem; }

.note-edit textarea { min-height: 5.5rem; }

.journal time, .meta {
  color: var(--quiet);
  font-variant-numeric: tabular-nums;
}

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

.done-list { margin-top: 0.5rem; }

.done-list summary {
  cursor: pointer;
  font-family: "Barlow Condensed", "Arial Narrow", sans-serif;
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  margin: 0 0 1.1rem;
}

.toolbar-exports {
  margin-left: auto;
  display: flex;
  gap: 0.6rem;
}

tr.is-late td { background: #f8f1d0; }

.progress { white-space: nowrap; font-variant-numeric: tabular-nums; }

.meter {
  display: inline-block;
  width: 4.2rem;
  height: 0.45rem;
  background: #e4ddd0;
  vertical-align: middle;
}

.meter::before {
  content: "";
  display: block;
  width: var(--p);
  height: 100%;
  background: #1d4e89;
}

.note-edit { margin-top: 0.4rem; }

@media print {
  .bar,
  .toolbar,
  .filters,
  .banner,
  .flash,
  .back,
  form,
  .btn,
  .btn-quiet,
  .btn-danger,
  .note-edit-row,
  .journal-table th:last-child,
  .journal-table td.journal-actions {
    display: none !important;
  }

  body { background: #fff; }
  main { width: auto; margin: 0; padding: 0; }
  .sheet, .detail { max-width: none; border: 0; background: #fff; box-shadow: none; }
  .sheet h1, .detail h1 { margin-left: 0; }
  a { color: inherit; text-decoration: none; }
  table { display: table !important; width: 100%; }
  thead { display: table-header-group !important; position: static !important; width: auto !important; height: auto !important; overflow: visible !important; clip: auto !important; }
  tbody { display: table-row-group !important; }
  tr { display: table-row !important; }
  th, td { display: table-cell !important; }
}

@media (max-width: 800px) {
  .bar { flex-wrap: wrap; align-items: flex-start; }
  .bar-end { width: 100%; margin-left: 0; justify-content: space-between; }
  table, thead, tbody, tr, th, td { display: block; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  td { border-top: 0; padding: 0.15rem 1rem; }
  tr { padding: 0.85rem 0; border-top: 1px solid rgba(22, 24, 26, 0.1); }
  td.action-cell { padding-top: 0.7rem; }
  td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-family: "Barlow Condensed", "Arial Narrow", sans-serif;
    letter-spacing: 0.08em;
    font-size: 0.85rem;
    color: var(--quiet);
  }
  td.action-cell::before { display: none; }
  .toolbar-exports { margin-left: 0; }
  tr.is-late { background: #f8f1d0; }
}
