:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface2: #21262d;
  --surface3: #2d333b;
  --border: #30363d;
  --accent: #58a6ff;
  --accent2: #79c0ff;
  --text: #e6edf3;
  --sub: #8b949e;
  --muted: #6e7681;
  --green: #3fb950;
  --green-bg: rgba(63, 185, 80, 0.15);
  --blue-bg: rgba(88, 166, 255, 0.15);
  --r: 12px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.55);
}
*,
::before,
::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}
a {
  text-decoration: none;
  color: inherit;
}

/* NAV */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(13, 17, 23, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.nav-back {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-size: 14px;
  padding: 6px 12px;
  border-radius: 6px;
  transition: background 0.15s;
  cursor: pointer;
}
.nav-back:hover {
  background: var(--surface2);
}
.nav-back svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.nav-title {
  font-weight: 600;
  font-size: 15px;
}
.nav-spacer {
  flex: 1;
}
.pdf-btn {
  background: var(--accent);
  color: #0d1117;
  border: none;
  border-radius: 6px;
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: opacity 0.15s;
}
.pdf-btn:hover {
  opacity: 0.85;
}
.pdf-btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}
.save-btn {
  background: var(--surface2);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: all 0.15s;
}
.save-btn:hover {
  background: var(--accent);
  color: #0d1117;
}
.save-btn svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}

/* HERO */
.hero {
  padding: 72px 28px 40px;
  text-align: center;
  max-width: 860px;
  margin: 0 auto;
}
.hero h1 {
  font-size: clamp(26px, 5vw, 44px);
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 14px;
}
.hero p {
  color: var(--sub);
  font-size: 17px;
  max-width: 480px;
  margin: 0 auto;
}
.year-badge {
  display: inline-block;
  margin-bottom: 24px;
  padding: 4px 12px;
  border-radius: 20px;
  background: var(--surface2);
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--sub);
}

/* INDEX GRID */
.index-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  padding: 8px 28px 80px;
  max-width: 1100px;
  margin: 0 auto;
}
.index-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 340px));
  justify-content: center;
  gap: 16px;
  margin-bottom: 16px;
}
.index-row.single {
  grid-template-columns: minmax(220px, 340px);
}
.icard {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 26px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
  cursor: pointer;
}
.icard::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  opacity: 0;
  transition: opacity 0.2s;
}
.icard:hover {
  background: var(--surface2);
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}
.icard:hover::after {
  opacity: 1;
}
.icard h2 {
  font-size: 17px;
  font-weight: 700;
}
.icard-sub {
  color: var(--sub);
  font-size: 13px;
}
.icard-arrow {
  position: absolute;
  bottom: 26px;
  right: 22px;
  color: var(--accent);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
}

/* PAGE HEADER */
.phdr {
  padding: 36px 28px 20px;
  max-width: 1400px;
  margin: 0 auto;
}
.phdr h1 {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 4px;
}
.phdr-sub {
  color: var(--sub);
  font-size: 14px;
}

/* SECTION */
.section {
  max-width: 1400px;
  margin: 0 auto 48px;
  padding: 0 28px;
}
.sec-date {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  padding-top: 8px;
}
.sec-date h2 {
  font-size: 17px;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}
.sec-date::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* JURY GRID */
.jgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 14px;
}

/* JURY CARD */
.jcard {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
}
.jcard-hdr {
  padding: 12px 16px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.jury-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
}
.jury-date {
  font-size: 12px;
  color: var(--sub);
}
.jcard-meta {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.mrow {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.mlbl {
  color: var(--muted);
  width: 82px;
  flex-shrink: 0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.mval {
  color: var(--sub);
  font-style: italic;
}

/* SELECT */
.tselect {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 5px 8px;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.15s;
  font-family: inherit;
}
.tselect:hover,
.tselect:focus {
  border-color: var(--accent);
  outline: none;
}
.tselect option {
  background: var(--surface2);
  color: var(--text);
}
.tselect.filled {
  border-color: rgba(88, 166, 255, 0.4);
  color: var(--accent2);
}
.tselect-tuteur {
  flex: none;
  width: 100%;
  min-width: 90px;
}

/* STUDENTS TABLE */
.stable {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.stable th {
  padding: 7px 12px;
  text-align: left;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}
.stable td {
  padding: 7px 12px;
  border-bottom: 1px solid rgba(48, 54, 61, 0.6);
}
.stable tr:last-child td {
  border-bottom: none;
}
.stable tr:hover td {
  background: rgba(33, 38, 45, 0.5);
}
.sname {
  font-weight: 500;
}
.sname-edit {
  cursor: text;
  outline: none;
  border-radius: 3px;
  padding: 1px 4px;
  margin: -1px -4px;
  transition: background 0.15s;
  min-width: 20px;
  display: inline-block;
}
.sname-edit:hover {
  background: var(--surface3);
}
.sname-edit:focus {
  background: var(--surface2);
  box-shadow: 0 0 0 2px var(--accent);
}
.sname-empty {
  color: var(--muted);
  font-style: italic;
}
.badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}
.badge-crea {
  background: var(--blue-bg);
  color: var(--accent2);
}
.badge-dweb {
  background: var(--green-bg);
  color: var(--green);
}
.badge-other {
  background: var(--surface3);
  color: var(--sub);
}
.badge-empty {
  color: var(--muted);
}

/* GITHUB FOOTER LINK */
.gh-footer {
  text-align: center;
  padding: 28px 0 20px;
}
.gh-footer-link {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  opacity: 0.45;
  transition: opacity 0.2s;
  font-family: inherit;
}
.gh-footer-link:hover {
  opacity: 1;
}
.gh-footer-link--active {
  color: var(--green);
  opacity: 0.55;
}
.gh-footer-link--active:hover {
  opacity: 1;
}

/* GITHUB MODAL */
.gh-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.gh-modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}
.gh-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  width: min(520px, 92vw);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
  transform: translateY(16px);
  transition: transform 0.2s;
}
.gh-modal-overlay.open .gh-modal {
  transform: translateY(0);
}
.gh-modal-hdr {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: 15px;
}
.gh-modal-close {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 4px;
  transition: all 0.15s;
}
.gh-modal-close:hover {
  background: var(--surface2);
  color: var(--text);
}
.gh-modal-body {
  padding: 20px;
}
.gh-modal-desc {
  font-size: 13px;
  color: var(--sub);
  margin-bottom: 18px;
  line-height: 1.6;
}
.gh-modal-desc code {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 12px;
  color: var(--accent2);
}
.gh-modal-desc strong {
  color: var(--text);
}
.gh-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.gh-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.gh-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--sub);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.gh-hint {
  font-size: 11px;
  font-weight: 400;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
}
.gh-input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
  transition: border-color 0.15s;
  width: 100%;
}
.gh-input:focus {
  outline: none;
  border-color: var(--accent);
}
.gh-input::placeholder {
  color: var(--muted);
}
.gh-status {
  margin-top: 4px;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
}
.gh-status--success {
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid rgba(63, 185, 80, 0.3);
}
.gh-status--error {
  background: rgba(248, 81, 73, 0.12);
  color: #f85149;
  border: 1px solid rgba(248, 81, 73, 0.3);
}
.gh-status--info {
  background: var(--blue-bg);
  color: var(--accent);
  border: 1px solid rgba(88, 166, 255, 0.3);
}
.gh-modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.gh-btn-save {
  background: var(--accent);
  color: #0d1117;
  border: none;
  border-radius: 6px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.gh-btn-save:hover {
  opacity: 0.85;
}
.gh-btn-test {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.gh-btn-test:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.gh-btn-clear {
  background: none;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.gh-btn-clear:hover {
  color: #f85149;
  border-color: rgba(248, 81, 73, 0.4);
}

/* TOAST */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 20px;
  font-size: 13px;
  color: var(--text);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.3s;
  pointer-events: none;
  z-index: 999;
}
.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* print-value spans (hidden in screen, shown in print) */
.print-val {
  display: none;
}

/* ── CONFIG MODAL ── */
.cfg-btn {
  background: var(--surface2);
  color: #e3b341;
  border: 1px solid #e3b341;
  border-radius: 6px;
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: all 0.15s;
}
.cfg-btn:hover {
  background: #e3b341;
  color: #0d1117;
}
.cfg-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  width: min(700px, 95vw);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
  transform: translateY(16px);
  transition: transform 0.2s;
}
.gh-modal-overlay.open .cfg-modal {
  transform: translateY(0);
}
.cfg-modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}
.cfg-top-row {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.cfg-jury-section {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 10px;
  overflow: hidden;
}
.cfg-jury-hdr {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
}
.cfg-jury-num {
  font-weight: 600;
  font-size: 12px;
  color: var(--accent);
  white-space: nowrap;
  min-width: 46px;
}
.cfg-jury-date-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.cfg-date-input {
  flex: 1;
  min-width: 160px;
  padding: 6px 8px;
  font-size: 13px;
  color-scheme: dark;
}
.cfg-period-select {
  padding: 6px 8px;
  font-size: 12px;
  min-width: 110px;
}
.cfg-creneaux {
  padding: 10px 12px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.cfg-creneau-row {
  display: flex;
  align-items: center;
  gap: 5px;
}
.cfg-creneau-lbl {
  font-size: 11px;
  color: var(--muted);
  min-width: 12px;
  text-align: right;
  flex-shrink: 0;
}
.cfg-creneau-input {
  font-size: 12px !important;
  padding: 5px 7px !important;
}
.cfg-import-section {
  border-top: 1px solid var(--border);
  padding: 12px;
}
.cfg-section-lbl {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin-bottom: 8px;
}
.cfg-import-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.cfg-file-input {
  flex: 1;
  cursor: pointer;
  padding: 5px 7px;
  font-size: 13px;
}
.cfg-import-preview {
  margin-top: 10px;
  max-height: 220px;
  overflow-y: auto;
}
.cfg-import-preview-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.cfg-import-jury {
  flex: 1;
  min-width: 110px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
}
.cfg-import-jury strong {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  margin-bottom: 4px;
}
.cfg-import-jury ol {
  margin: 0;
  padding-left: 18px;
  font-size: 12px;
  line-height: 1.6;
}
.cfg-import-warn {
  margin-top: 6px;
  font-size: 12px;
  color: #f59e0b;
}

/* ── PRINT ── */
@media print {
  @page {
    size: A4 landscape;
    margin: 12mm 10mm;
  }

  body {
    background: #fff !important;
    color: #000 !important;
    font-size: 10pt;
  }
  .nav,
  .pdf-btn,
  .save-btn,
  .gh-footer,
  .gh-modal-overlay,
  .toast {
    display: none !important;
  }
  .phdr {
    padding: 0 0 8pt;
    page-break-after: avoid;
  }
  .phdr h1 {
    font-size: 14pt;
    color: #000;
    font-weight: 700;
  }
  .phdr-sub {
    font-size: 8pt;
    color: #555;
  }

  .section {
    max-width: 100%;
    padding: 0;
    margin: 0 0 14pt;
  }
  .section + .section {
    break-before: page;
    page-break-before: always;
  }
  .sec-date {
    margin-bottom: 8pt;
    padding-top: 4pt;
  }
  .sec-date h2 {
    font-size: 11pt;
    color: #1a4a8a;
    font-weight: 700;
  }
  .sec-date::after {
    background: #ccc;
  }

  .jgrid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8pt;
  }

  .jcard {
    border: 1pt solid #ccc;
    border-radius: 4pt;
    break-inside: avoid;
    background: #fff;
  }
  .jcard-hdr {
    background: #f0f4ff;
    border-bottom: 1pt solid #ccc;
    padding: 5pt 8pt;
  }
  .jury-name {
    font-size: 10pt;
    font-weight: 700;
    color: #1a4a8a;
  }
  .jury-date {
    font-size: 7.5pt;
    color: #555;
  }

  .jcard-meta {
    padding: 5pt 8pt;
    border-bottom: 1pt solid #eee;
    gap: 4pt;
  }
  .mrow {
    font-size: 8pt;
  }
  .mlbl {
    color: #666;
    font-size: 7.5pt;
    width: 70pt;
  }
  .mval {
    color: #333;
  }

  /* hide select, show span with value */
  .tselect {
    display: none !important;
  }
  .print-val {
    display: inline !important;
    font-size: 8.5pt;
    font-weight: 600;
    color: #1a4a8a;
  }
  .print-val:empty::before {
    content: "—";
    color: #aaa;
    font-weight: 400;
  }

  .stable {
    font-size: 8pt;
  }
  .stable th {
    background: #f5f5f5;
    color: #333;
    padding: 4pt 7pt;
    font-size: 7pt;
  }
  .stable td {
    padding: 4pt 7pt;
    border-bottom: 1pt solid #eee;
    color: #000;
  }
  .stable tr:last-child td {
    border-bottom: none;
  }
  .stable tr:hover td {
    background: none;
  }
  .sname {
    font-weight: 600;
  }
  .sname-edit {
    background: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    cursor: default !important;
  }
  .sname-empty {
    color: #aaa;
  }
  .badge {
    border: 1pt solid #ccc;
    background: none;
    color: #333;
    padding: 0 4pt;
  }
  .badge-empty {
    color: #aaa;
  }

  a[href]::after {
    content: none;
  }
}

@media (max-width: 640px) {
  .index-grid {
    grid-template-columns: 1fr 1fr;
  }
  .index-row {
    grid-template-columns: 1fr 1fr;
  }
  .index-row.single {
    grid-template-columns: 1fr;
  }
  .jgrid {
    grid-template-columns: 1fr;
  }
  .nav {
    padding: 0 16px;
  }
  .phdr,
  .section {
    padding-left: 16px;
    padding-right: 16px;
  }
}
