/* Charte reprise d'ericbadarou.com : palette zinc (shadcn/ui), Inter, thème clair. */
:root {
  --background: #ffffff;
  --foreground: #09090b;
  --card: #ffffff;
  --muted: #f4f4f5;
  --muted-foreground: #71717a;
  --border: #e4e4e7;
  --primary: #18181b;
  --primary-foreground: #fafafa;
  --accent: #f4f4f5;
  --destructive: #ef4444;
  --ring: #18181b;

  --success: #15803d; --success-bg: #f0fdf4; --success-border: #bbf7d0;
  --warning: #a16207; --warning-bg: #fefce8; --warning-border: #eab308;
  --danger: #b91c1c;  --danger-bg: #fef2f2;  --danger-border: #fecaca;
  --info: #1d4ed8;    --info-bg: #eff6ff;    --info-border: #bfdbfe;

  --radius: 0.5rem;
  --radius-xl: 0.75rem;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font: 14px/1.6 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "rlig" 1, "calt" 1;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--foreground); text-underline-offset: 3px; }
a:hover { color: var(--muted-foreground); }

/* --- En-tête ---------------------------------------------------------------------------- */
header.top {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(228, 228, 231, 0.6);
}
header.top .bar {
  max-width: 1200px; margin: 0 auto; padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--foreground); }
.brand img { width: 32px; height: 32px; }
.brand span { font-size: 1.05rem; font-weight: 700; letter-spacing: -0.02em; }
.brand:hover { color: var(--foreground); }
header.top nav { display: flex; align-items: center; gap: 28px; }
header.top nav a, header.top nav button.link {
  position: relative; font-size: 0.875rem; font-weight: 500;
  color: rgba(9, 9, 11, 0.6); text-decoration: none;
}
header.top nav a:hover, header.top nav button.link:hover { color: var(--foreground); }
header.top nav a.active { color: var(--foreground); }
header.top nav a.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -19px; height: 2px; background: var(--primary);
}
header.top .who { font-size: 0.875rem; color: var(--muted-foreground); }

main { width: 100%; max-width: 1200px; margin: 0 auto; padding: 32px 24px 80px; flex: 1; }
main.narrow { max-width: 480px; padding-top: 64px; }
main.wide { max-width: 1840px; }
footer.bottom { border-top: 1px solid var(--border); color: var(--muted-foreground); font-size: 0.8rem; }
footer.bottom div { max-width: 1200px; margin: 0 auto; padding: 18px 24px; }

/* --- Typographie ------------------------------------------------------------------------ */
h1 { font-size: 1.875rem; line-height: 1.2; font-weight: 700; letter-spacing: -0.025em; margin: 0; }
h2 { font-size: 1.125rem; font-weight: 600; letter-spacing: -0.01em; margin: 40px 0 14px; }
h3 { font-size: 1rem; font-weight: 600; margin: 0 0 6px; }
p { margin: 0 0 12px; }
.muted { color: var(--muted-foreground); }
.small { font-size: 0.8125rem; }
.lead { color: var(--muted-foreground); font-size: 0.95rem; margin-top: 6px; }
code, .mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.85em; }
code { background: var(--muted); padding: 1px 5px; border-radius: 4px; }
pre {
  background: var(--muted); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; overflow-x: auto; font-size: 0.8125rem; white-space: pre-wrap; margin: 8px 0;
}

.breadcrumb { font-size: 0.8125rem; margin-bottom: 14px; }
.breadcrumb a { color: var(--muted-foreground); text-decoration: none; }
.breadcrumb a:hover { color: var(--foreground); }

.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 28px; }
.page-header .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* --- Blocs ------------------------------------------------------------------------------ */
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-xl);
  padding: 24px; margin: 0 0 16px;
}
.card > :last-child { margin-bottom: 0; }
.card.tight { padding: 16px 20px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.card-head h3 { margin: 0; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid > .card { margin: 0; display: flex; flex-direction: column; }
.grid > .card .push { margin-top: auto; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.stack > * + * { margin-top: 12px; }
.divider { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }

.stats { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin-bottom: 24px; }
.stat { border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 18px 20px; }
.stat .label { font-size: 0.8125rem; color: var(--muted-foreground); font-weight: 500; }
.stat .value { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.3; }
.stat .hint { font-size: 0.75rem; color: var(--muted-foreground); }

.empty { text-align: center; padding: 40px 20px; color: var(--muted-foreground); }

/* --- Formulaires ------------------------------------------------------------------------ */
label { display: block; font-size: 0.875rem; font-weight: 500; margin: 16px 0 6px; }
label:first-child { margin-top: 0; }
.hint { display: block; font-size: 0.8125rem; color: var(--muted-foreground); margin-top: 6px; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=url],
input[type=datetime-local], select, textarea {
  width: 100%; padding: 10px 14px; font: inherit; font-size: 0.875rem; color: var(--foreground);
  background: var(--background); border: 1px solid var(--border); border-radius: var(--radius-xl);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input::placeholder, textarea::placeholder { color: #a1a1aa; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ring); box-shadow: 0 0 0 1px var(--ring); }
textarea { min-height: 120px; resize: vertical; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.8125rem; line-height: 1.55; }
textarea.prose { font-family: inherit; font-size: 0.875rem; min-height: 80px; }
textarea.tall { min-height: 440px; }
input.code-input {
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 1.5rem; letter-spacing: 0.2em;
  text-transform: uppercase; text-align: center; padding: 14px;
}
input.points { width: 84px; text-align: right; }
select { appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; }
select.auto { width: auto; }

input[type=file] {
  display: block; width: 100%; font: inherit; font-size: 0.875rem; color: var(--muted-foreground);
  border: 1px dashed #d4d4d8; border-radius: var(--radius-xl); padding: 10px; background: #fafafa; cursor: pointer;
}
input[type=file]:hover { border-color: #a1a1aa; }
input[type=file]::file-selector-button {
  font: inherit; font-weight: 600; font-size: 0.8125rem; margin-right: 12px; padding: 7px 14px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--background);
  color: var(--foreground); cursor: pointer;
}

/* --- Boutons ---------------------------------------------------------------------------- */
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 20px; font: inherit; font-size: 0.875rem; font-weight: 600; line-height: 1.2;
  border-radius: var(--radius-xl); border: 1px solid var(--primary);
  background: var(--primary); color: var(--primary-foreground);
  text-decoration: none; cursor: pointer; white-space: nowrap;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05); transition: background 0.15s, box-shadow 0.15s;
}
button:hover, .button:hover { background: #27272a; color: var(--primary-foreground); box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1); }
button:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
button.secondary, .button.secondary { background: var(--background); color: var(--foreground); border-color: var(--border); }
button.secondary:hover, .button.secondary:hover { background: var(--accent); color: var(--foreground); box-shadow: none; }
button.danger { background: var(--background); color: var(--danger); border-color: var(--danger-border); box-shadow: none; }
button.danger:hover { background: var(--danger-bg); }
button.link {
  background: none; border: none; box-shadow: none; padding: 0; font-weight: 500; color: var(--muted-foreground);
  text-decoration: none;
}
button.link:hover { color: var(--foreground); background: none; box-shadow: none; }
button.block, .button.block { width: 100%; }
button.sm, .button.sm { padding: 6px 12px; font-size: 0.8125rem; border-radius: var(--radius); }
form.inline { display: inline; }

/* --- Tableaux --------------------------------------------------------------------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-xl); }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafafa; }
th { font-size: 0.75rem; font-weight: 500; color: var(--muted-foreground); background: #fafafa; }
td.num, th.num { text-align: right; white-space: nowrap; }
td a { font-weight: 500; }
.actions-cell { text-align: right; white-space: nowrap; }
.actions-cell form + form::before { content: "·"; color: var(--border); margin: 0 8px; }

/* --- Badges, messages ------------------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 999px;
  font-size: 0.75rem; font-weight: 600; white-space: nowrap; border: 1px solid transparent;
}
.badge.success { background: var(--success-bg); color: var(--success); border-color: var(--success-border); }
.badge.error { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-border); }
.badge.warn { background: #eab308; color: #fff; }
.badge.info { background: var(--info-bg); color: var(--info); border-color: var(--info-border); }
.badge.neutral { background: var(--muted); color: var(--muted-foreground); border-color: var(--border); }

.flash, .callout {
  padding: 12px 16px; border-radius: var(--radius-xl); margin: 0 0 16px; font-size: 0.875rem; border: 1px solid;
}
.flash.success { background: var(--success-bg); color: var(--success); border-color: var(--success-border); }
.flash.error { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-border); }
.flash.info { background: var(--info-bg); color: var(--info); border-color: var(--info-border); }
.callout { background: rgba(234, 179, 8, 0.05); border-color: rgba(234, 179, 8, 0.5); color: var(--foreground); }
.callout strong { color: var(--warning); }
.callout ul { margin: 6px 0 0; padding-left: 18px; }
.callout li + li { margin-top: 4px; }

.receipt { border: 1px solid var(--success-border); background: var(--success-bg); border-radius: var(--radius-xl); padding: 14px 16px; margin-bottom: 18px; font-size: 0.875rem; }
.receipt .title { font-weight: 600; color: var(--success); }
.receipt ul { margin: 8px 0 0; padding-left: 18px; }

/* --- Relecture d'une copie ---------------------------------------------------------------- */
.review { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(400px, 1fr); gap: 24px; align-items: start; }
.review .viewer { position: sticky; top: 80px; }
.review iframe { width: 100%; height: calc(100vh - 170px); border: 1px solid var(--border); border-radius: var(--radius-xl); background: #fff; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; padding: 4px; background: var(--muted); border-radius: var(--radius-xl); margin-bottom: 12px; }
.tabs button {
  background: transparent; color: var(--muted-foreground); border: none; box-shadow: none;
  padding: 6px 12px; font-weight: 500; font-size: 0.8125rem; border-radius: var(--radius);
}
.tabs button:hover { background: rgba(255, 255, 255, 0.6); color: var(--foreground); box-shadow: none; }
.tabs button.active { background: var(--background); color: var(--foreground); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }

.criterion { border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 16px 18px; margin: 0 0 12px; background: var(--card); }
.criterion.to-check { border-color: rgba(234, 179, 8, 0.5); background: rgba(234, 179, 8, 0.05); }
.criterion .head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.criterion .head strong { font-size: 0.9375rem; }
.criterion .score { font-size: 1.125rem; font-weight: 700; letter-spacing: -0.02em; white-space: nowrap; }
.criterion .score span { color: var(--muted-foreground); font-weight: 500; font-size: 0.875rem; }
.criterion .proposal { font-size: 0.875rem; margin-top: 8px; }
.criterion .proposal p { margin: 0 0 6px; }
.criterion .why { color: var(--warning); }
.criterion .decision { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.criterion .decision label { margin: 0; font-size: 0.8125rem; }
details summary { cursor: pointer; font-size: 0.8125rem; color: var(--muted-foreground); font-weight: 500; }
details summary:hover { color: var(--foreground); }
details[open] summary { margin-bottom: 8px; }

.sticky-actions { position: sticky; bottom: 0; background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(8px); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 16px 18px; margin-top: 4px; }
.total { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; }

/* --- Espace étudiant -------------------------------------------------------------------- */
.auth-card { text-align: center; }
.auth-card .logo { width: 48px; height: 48px; margin: 0 auto 16px; display: block; }
.auth-card h1 { font-size: 1.5rem; }
.auth-card form { text-align: left; margin-top: 24px; }
.status-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8125rem; font-weight: 500; }
.status-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.status-dot.open { color: var(--success); }
.status-dot.closed { color: var(--muted-foreground); }
.deliverable { padding: 14px 0; border-top: 1px solid var(--border); }
.deliverable:first-of-type { border-top: none; padding-top: 0; }
.deliverable label { margin-top: 0; }
.deadline { font-weight: 600; color: var(--foreground); }

/* --- Responsive ------------------------------------------------------------------------- */
@media (max-width: 1100px) {
  .review { grid-template-columns: 1fr; }
  .review .viewer { position: static; }
  .review iframe { height: 70vh; }
}
@media (max-width: 640px) {
  header.top .bar { padding: 12px 16px; }
  header.top nav { gap: 16px; }
  .brand span { display: none; }
  main { padding: 24px 16px 64px; }
  main.narrow { padding-top: 32px; }
  h1 { font-size: 1.5rem; }
  .card { padding: 18px; }
  th, td { padding: 10px 12px; }
}

/* --- Papiers à découper ----------------------------------------------------------------- */
.slips { display: grid; grid-template-columns: repeat(3, 1fr); }
.slip { border: 1px dashed #a1a1aa; padding: 16px 12px; text-align: center; break-inside: avoid; }
.slip img { width: 22px; height: 22px; }
.slip .name { font-weight: 700; margin-top: 4px; }
.slip .code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 1.5rem; font-weight: 600; letter-spacing: 0.12em; margin: 8px 0; }
@media print {
  header.top, footer.bottom, .no-print { display: none !important; }
  main { padding: 0; max-width: none; }
  @page { margin: 10mm; }
}
