/* Academie Toolbox: design-system tokens (Académie des Étoiles) and the closed list of component classes.
   Templates use no other class (tests/toolbox/test_css_contract.py); connexion.css adds the sign-in ones. */

@font-face {
  font-family: "Inter";
  src: url("/static/fonts/inter-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Mulish";
  src: url("/static/fonts/mulish-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 1000;
  font-style: normal;
  font-display: swap;
}

:root {
  --purple-900:#10004E; --purple-800:#350D68; --purple-700:#4D1A89; --purple-600:#6E2FB8;
  --violet-500:#9451FB; --violet-400:#B07EFC; --violet-200:#DDC8FE; --violet-50:#F4ECFE;
  --ink-900:#0C1B23; --ink-700:#27334B; --ink-600:#3B4153;
  --gray-400:#B0CBE2; --gray-200:#E0E5EE; --gray-100:#F5F5F5; --gray-50:#F8FAFD; --white:#FFFFFF;

  --ok-ink:#05701A; --ok-bg:#E6F6E9; --err-ink:#B42318; --err-bg:#FDECEA; --warn-ink:#8A5300; --warn-bg:#FFF4E0;
  --run-ink:#4D1A89; --run-bg:#F4ECFE; --idle-ink:#3B4153; --idle-bg:#F5F5F5;

  --r-sm:8px; --r-md:12px; --r-lg:16px; --r-xl:24px; --r-pill:999px;

  --shadow-1:0 1px 3px rgba(12,27,35,.06); --shadow-2:0 4px 12px rgba(12,27,35,.08);
  --shadow-cta:0 8px 24px rgba(148,81,251,.32); --shadow-menu:0 12px 32px rgba(53,13,104,.18);

  --font-body:"Inter",system-ui,sans-serif; --font-display:"Mulish","Inter",sans-serif;
  --font-mono:ui-monospace,"SF Mono",Menlo,Consolas,monospace;
}

*, *::before, *::after { box-sizing: border-box; }

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

a { color: var(--purple-600); }
a:hover { color: var(--purple-800); }

/* Page layout */

.page {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--gray-50);
  color: var(--ink-700);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
}

.page__main {
  width: 100%;
  max-width:1120px; margin:0 auto; padding:40px 24px 64px;
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* Header */

.header {
  position: relative;
  z-index: 20;
  width: 100%;
  min-height: 72px;
  padding: 10px 32px;
  background: var(--purple-800);
  color: var(--white);
  display: flex;
  flex-wrap:wrap;
  align-items: center;
  gap: 12px 28px;
}

.header__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--white);
  text-decoration: none;
}

.header__brand:hover { color: var(--white); }

.header__brand svg { flex: none; }

.header__name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 20px;
  letter-spacing: -0.01em;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  flex: 1 1 auto;
}

.nav__link, .menu__trigger {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height:44px;
  padding: 8px 14px;
  border-radius: var(--r-pill);
  font-size: 14px;
  font-weight: 600;
  color: var(--white);
  text-decoration: none;
  cursor: pointer;
}

.nav__link:hover, .menu__trigger:hover { color: var(--white); background: rgba(255,255,255,.12); }

/* White text sits on --purple-600 (7.6:1): --violet-500 gives 4.35:1, under WCAG AA (user, 2026-11-30, Q13). */
/* The --purple-600 pill is 1.96:1 against the header: a --violet-200 inset ring (9.77:1) marks it (user, Q14). */
.nav__link.is-active, .menu__trigger.is-active { background: var(--purple-600); box-shadow: inset 0 0 0 2px var(--violet-200); }

/* Menus: <details> work without JavaScript; menus.js closes them on Escape and on a click outside. */

.menu, .account { position: relative; }

.menu > summary, .account > summary { list-style: none; }
.menu > summary::-webkit-details-marker, .account > summary::-webkit-details-marker { display: none; }

.menu__panel {
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  z-index: 30;
  width: 320px;
  max-width: calc(100vw - 32px);
  padding: 6px;
  display: flex;
  flex-direction: column;
  background: var(--white);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-menu);
}

/* Phone (#40): a panel anchored at its button ran past the right edge (Rise, Edusign) and made every page scroll
   sideways. Under 720px it hangs from the header instead, as wide as the screen less a 16px margin each side. */
@media (max-width: 720px) {
  .menu { position: static; }
  .menu__panel { left: 16px; right: 16px; width: auto; max-width: none; }
}

.menu__item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height:44px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  color: var(--purple-800);
  text-decoration: none;
}

a.menu__item:hover { background: var(--violet-50); color: var(--purple-800); }

.menu__item--soon { color: var(--ink-600); cursor: default; }

.menu__title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
}

.menu__desc { font-size: 13px; color: var(--ink-600); }

/* Account block (as in Lifecycle) */

.account { margin-left: auto; }

.account summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height:44px;
  padding: 4px 8px 4px 12px;
  border-radius: 10px;
  color: var(--violet-200);
  cursor: pointer;
}

.account summary:hover { background: rgba(255,255,255,.12); }

.account__id {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.25;
  min-width: 0;
}

.account__name { font-size: 14px; font-weight: 600; color: var(--white); }

.account__mail { font-size: 12px; color: var(--violet-200); overflow-wrap: anywhere; }

.account__badge {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: var(--r-pill);
  background: var(--purple-600);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
}

.account__menu {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 30;
  min-width: 220px;
  padding: 4px;
  display: flex;
  flex-direction: column;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  box-shadow: var(--shadow-2);
}

.account__role {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  font-size: 13px;
  color: var(--ink-600);
}

.account__link {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border-radius: var(--r-sm);
  font-size: 14px;
  color: var(--ink-900);
  text-decoration: none;
}

.account__link:hover { background: var(--violet-50); color: var(--ink-900); }

/* Footer (as in Lifecycle) */

.footer {
  width: 100%;
  max-width: 1120px;
  margin: 8px auto 0;
  padding: 16px 24px 24px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 16px;
  text-align: center;
  font-size: 12px;
  color: var(--ink-600);
  border-top: 1px solid var(--gray-200);
}

.footer__mono { font-family: var(--font-mono); color: var(--ink-900); }

.footer--dark { color: var(--violet-200); border-top-color: rgba(255,255,255,.16); }
.footer--dark .footer__mono { color: var(--white); }

/* Text */

.h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 800;
  line-height: 1.2;
  color: var(--purple-800);
}

.lead { margin: 0; font-size: 16px; color: var(--ink-600); }

.muted { color: var(--ink-600); font-size: 14px; }

.back-link { align-self: flex-start; font-size: 14px; font-weight: 600; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Sections and cards */

.section { display: flex; flex-direction: column; gap: 12px; }

.section__head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
}

.section__head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  color: var(--purple-800);
}

.card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 24px;
  background: var(--white);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
  color: var(--ink-700);
}

.card p { margin: 0; }

.card__eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--purple-600);
}

.card__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  color: var(--purple-800);
}

.card__text { margin: 0; font-size: 15px; color: var(--ink-600); }

.card__meta { font-size: 14px; color: var(--ink-600); }

/* Home: greeting, then the feature cards; each card is one link (Main.dc.html) */

.intro { display: flex; flex-direction: column; gap: 6px; }

/* A page title with its main action beside it (2a page, Repair.dc.html). */
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; }
.page-head .intro { max-width: 680px; }
.start { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.start__reason { margin: 0; max-width: 380px; color: var(--ink-600); font-size: 14px; text-align: right; }
@media (max-width: 720px) {
  .start { align-items: flex-start; }
  .start__reason { text-align: left; }
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: 24px;
}

a.card { text-decoration: none; }
a.card:hover { color: var(--ink-700); box-shadow: var(--shadow-menu); }

.card__action { align-self: flex-start; margin-top: 4px; }

.section__link { font-size: 14px; font-weight: 600; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 20px;
  background: var(--white);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
}

.stat__value {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  color: var(--purple-800);
}

.stat__label { font-size: 13px; color: var(--ink-600); }

/* Tables: they scroll inside their box on a phone */

.table-wrap {
  overflow-x:auto;
  background: var(--white);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
}

.table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
  font-size: 14px;
}

.table th, .table td { padding: 12px 16px; text-align: left; vertical-align: top; }

.table th { font-weight: 600; color: var(--ink-600); }

.table tr { border-bottom: 1px solid var(--gray-200); }

.table tbody tr:last-child { border-bottom: 0; }

/* A table whose rows hold a button: cells centred on it (2b results). */
.table--actions td { vertical-align: middle; }

.table .table__action { text-align: right; }

.job-row:hover { background: var(--gray-50); }

/* Badges: the word is always written, the colour only repeats it */

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
}

.badge--ok { background: var(--ok-bg); color: var(--ok-ink); }
.badge--err { background: var(--err-bg); color: var(--err-ink); }
.badge--warn { background: var(--warn-bg); color: var(--warn-ink); }
.badge--run { background: var(--run-bg); color: var(--run-ink); }
.badge--idle { background: var(--idle-bg); color: var(--idle-ink); }
.badge--outline { background: var(--white); color: var(--idle-ink); border: 1px solid var(--gray-200); }
.badge--soon { background: var(--idle-bg); color: var(--idle-ink); font-size: 11px; padding: 2px 8px; }

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height:44px;
  padding: 12px 24px;
  border: 2px solid transparent;
  border-radius: var(--r-pill);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.btn--primary { background: var(--purple-600); color: var(--white); box-shadow: var(--shadow-cta); }
.btn--primary:hover { background: var(--purple-700); color: var(--white); }

.btn--ghost { background: transparent; color: var(--purple-800); border-color: var(--purple-800); }
.btn--ghost:hover { background: var(--violet-50); color: var(--purple-800); }

.btn--small { padding: 8px 18px; font-size: 14px; }

/* A disabled action stays in place, greyed; its reason sits under it (2a page, Q38). */
.btn:disabled, .btn:disabled:hover { background: var(--gray-200); color: var(--ink-600); box-shadow: none; cursor: not-allowed; }

/* Alerts */

.alert {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 16px 20px;
  border-radius: var(--r-md);
  font-size: 14px;
}

.alert svg { flex: none; margin-top: 1px; }

.alert--info { background: var(--violet-50); color: var(--purple-800); }
.alert--warn { background: var(--warn-bg); color: var(--warn-ink); }
.alert--error { background: var(--err-bg); color: var(--err-ink); }

/* Confirm block of a dry run */

.confirm {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  background: var(--white);
  border: 2px solid var(--violet-500);
  border-radius: var(--r-lg);
}

.confirm__title { margin: 0; font-size: 18px; font-weight: 700; color: var(--purple-800); }

.confirm__text { margin: 0; font-size: 14px; color: var(--ink-600); }

/* Progress of a running job */

.progress {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px 24px;
  background: var(--white);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
}

.progress__bar {
  height: 10px;
  border-radius: var(--r-pill);
  background: var(--violet-50);
  overflow: hidden;
}

.progress__bar > span {
  display: block;
  height: 100%;
  background: var(--violet-500);
  border-radius: var(--r-pill);
  transition: width .3s ease;
}

.progress__counts { display: flex; flex-wrap: wrap; gap: 16px; font-size: 14px; color: var(--ink-600); }

/* Forms */

.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }

.field { display: flex; flex-direction: column; gap: 6px; }

/* A field that takes the row's free width (2b search). */
.field--grow { flex: 1 1 320px; }

.field__label { font-size: 13px; font-weight: 600; color: var(--purple-800); }

/* Border --ink-600, 10.16:1 on white: --gray-400 was 1.68:1, under the 3:1 a field's boundary needs (WCAG 1.4.11, #41). */
.field__input, .field__select {
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--ink-600);
  border-radius: var(--r-sm);
  background: var(--white);
  color: var(--ink-700);
  font-family: var(--font-body);
  font-size: 15px;
}

.field__select { font-size: 14px; min-width: 180px; }

@media (prefers-reduced-motion: reduce) { * { transition:none !important; animation:none !important } }
