:root {
  --accent: #4B32D6;
  --accent-dark: #35229E;
  --ink: #15171C;
  --muted: #5B616E;
  --line: #E3E5EA;
  --soft: #F4F5F7;
  --danger: #B4233C;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--soft); color: var(--ink); font: 15px/1.45 Inter, system-ui, sans-serif; }
h1, h2, h3, p { margin: 0; }
h1 { font: 600 28px/1.15 'Space Grotesk', Inter, sans-serif; }
h2 { font-size: 17px; font-weight: 600; }
h3 { font-size: 15px; font-weight: 600; margin-top: 8px; }
[hidden] { display: none !important; }

.boot { padding: 48px 24px; text-align: center; color: var(--muted); }
.muted { color: var(--muted); }
.muted-light { color: #A3A8B3; }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 15px; overflow-wrap: anywhere; }
.ok-text { color: #1B6B3A; }
.warn-text { color: #8A4B00; }

.brand { font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.brand.light { font-size: 12px; color: #A3A8B3; }

/* Écrans centrés : connexion, règlement, maintenance */
.center { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.center.top { align-items: flex-start; padding-top: 32px; }
.card { background: #FFFFFF; border: 1px solid var(--line); border-radius: 12px; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.card-narrow { width: 100%; max-width: 440px; border-radius: 16px; padding: 32px; gap: 18px; }
.card-wide { width: 100%; max-width: 760px; border-radius: 16px; padding: 28px; gap: 18px; }
.card-form { max-width: 520px; }
.stack { display: flex; flex-direction: column; gap: 16px; }

form { display: flex; flex-direction: column; gap: 14px; }
form.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); align-items: end; }
form.grid .note { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.end { justify-content: flex-end; }
label { font-size: 14px; font-weight: 500; }
.hint { font-size: 13px; color: var(--muted); }
input[type="text"], input[type="password"], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 14px; border: 1px solid #C4C8D0; border-radius: 10px;
  font: inherit; color: var(--ink); background: #FFFFFF;
}
textarea { resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.checkline { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 12px; border: 1px solid #C4C8D0; border-radius: 10px; font-weight: 400; cursor: pointer; }
.checkline input { width: 20px; height: 20px; flex: none; accent-color: var(--ink); }

.row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.btn { min-height: 46px; padding: 0 18px; border: 1px solid #C4C8D0; border-radius: 10px; background: #FFFFFF; color: var(--ink); font: inherit; font-weight: 500; cursor: pointer; }
.btn:hover { background: var(--soft); }
.btn.primary { border-color: var(--accent); background: var(--accent); color: #FFFFFF; font-weight: 600; }
.btn.primary:hover { background: var(--accent-dark); }
.btn.dark { border-color: var(--ink); background: var(--ink); color: #FFFFFF; font-weight: 600; }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.danger:hover { background: #FBEDEF; }
.btn.ghost { border-color: #4A4E59; background: transparent; color: #FFFFFF; min-height: 44px; }
.btn.ghost:hover { background: #2E313A; }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.link { align-self: flex-start; min-height: 44px; padding: 0; border: 0; background: transparent; color: var(--accent); font: inherit; font-size: 14px; text-decoration: underline; cursor: pointer; }

.note { padding: 12px 14px; border-radius: 10px; background: var(--soft); font-size: 14px; }
.note.bad { background: #FBEDEF; color: #7A1226; }
.note.ok { background: #DDEBFB; color: #0F4C97; }
.note.warn { background: #FFF1D6; color: #5C3800; }
.banner { padding: 12px 14px; border-radius: 10px; background: #FFF1D6; color: #5C3800; font-weight: 600; }
.cred { padding: 16px; border: 2px solid var(--accent); border-radius: 12px; background: #FFFFFF; display: flex; flex-direction: column; gap: 8px; }

.rules-box { max-height: 46vh; overflow: auto; border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; background: #FAFAFB; }
.rules { display: flex; flex-direction: column; gap: 12px; font-size: 14px; }
.rules-h { font-weight: 600; }

/* Application connectée */
.shell { display: flex; flex-wrap: wrap; min-height: 100vh; }
.side { flex: 1 1 230px; max-width: 100%; background: var(--ink); color: #C9CCD3; padding: 20px 14px; display: flex; flex-direction: column; gap: 20px; }
.side-head { padding: 0 12px; }
.side-title { font: 600 20px 'Space Grotesk', Inter, sans-serif; color: #FFFFFF; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item { min-height: 44px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: #C9CCD3; font: inherit; text-align: left; cursor: pointer; }
.nav-item:hover, .nav-item.on { background: #2E313A; color: #FFFFFF; }
.side-foot { margin-top: auto; padding: 12px; border-top: 1px solid #2E313A; display: flex; flex-direction: column; gap: 8px; }
.who { color: #FFFFFF; font-weight: 500; overflow-wrap: anywhere; }
.main { flex: 999 1 520px; min-width: 0; padding: 28px 24px 48px; display: flex; flex-direction: column; gap: 20px; }
.content { max-width: 1080px; }

.acc { display: flex; flex-direction: column; gap: 10px; padding: 14px 0; border-top: 1px solid #ECEEF1; }
.acc-main { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.acc-edit { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.tag { padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: #ECEEF1; color: #454A55; }
.tag.actif { background: #DDEBFB; color: #0F4C97; }
.tag.attente { background: #FFF1D6; color: #7A4A00; }
.line { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 10px 0; border-top: 1px solid #ECEEF1; font-size: 14px; overflow-wrap: anywhere; }

@media (prefers-reduced-motion: no-preference) {
  .btn, .nav-item { transition: background-color 0.12s ease; }
}

.label { font-size: 14px; font-weight: 500; }
.checkline.slim { min-height: 44px; padding: 6px 12px; }
.news { display: flex; flex-direction: column; gap: 8px; padding: 14px 0; border-top: 1px solid #ECEEF1; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.kpi { gap: 6px; padding: 18px; }
.kpi-v { font: 600 26px/1.15 'Space Grotesk', Inter, sans-serif; overflow-wrap: anywhere; }
.month { min-width: 150px; text-align: center; text-transform: capitalize; }
.acc-edit.four { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); align-items: end; }
.scroll { overflow-x: auto; }
table { width: 100%; min-width: 560px; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; border-top: 1px solid #ECEEF1; text-align: left; vertical-align: top; font-variant-numeric: tabular-nums; }
thead th { border-top: 0; color: var(--muted); font-weight: 600; }
tbody th { font-weight: 600; }
tfoot th, tfoot td { font-weight: 600; background: var(--soft); }

.line.plain { border-top: 0; padding: 0; align-items: baseline; }
.strike { text-decoration: line-through; }
.panel { display: flex; flex-direction: column; gap: 12px; padding: 14px; border: 1px solid var(--accent); border-radius: 12px; background: #FAFAFB; }
input[type="date"], input[type="time"] { width: 100%; min-height: 46px; padding: 10px 14px; border: 1px solid #C4C8D0; border-radius: 10px; font: inherit; color: var(--ink); background: #FFFFFF; }

/* Jeux : trois cartes */
.cards { display: flex; gap: 12px; padding: 18px 0; overflow: hidden; }
.pcard { flex: none; width: 96px; height: 136px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; font: inherit; }
.pcard.back { padding: 0; border: 5px solid #FFFFFF; box-shadow: 0 2px 8px rgba(21, 23, 28, 0.25), 0 0 0 1px #C4C8D0; color: #FFFFFF; cursor: pointer;
  font: 600 30px 'Space Grotesk', Inter, sans-serif; background-color: var(--accent);
  background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.16) 0 6px, transparent 6px 12px), repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.16) 0 6px, transparent 6px 12px); }
.pcard.back:hover, .pcard.back:focus-visible { box-shadow: 0 10px 22px rgba(21, 23, 28, 0.22); outline: 3px solid var(--ink); outline-offset: 3px; }
.pcard.face { border: 3px solid #C4C8D0; background: #FFFFFF; color: #454A55; font-weight: 600; }
.pcard.face.good { border-color: var(--accent); background: var(--accent); color: #FFFFFF; }
.pcard.face.mine { border-color: var(--ink); }
.pnum { font: 600 30px/1 'Space Grotesk', Inter, sans-serif; }
@keyframes shuffle1 { 0%, 100% { transform: translate(0, 0) rotate(0); } 18% { transform: translate(216px, -16px) rotate(5deg); } 38% { transform: translate(108px, 10px) rotate(-3deg); } 58% { transform: translate(216px, 12px) rotate(4deg); } 80% { transform: translate(0, -12px) rotate(-4deg); } }
@keyframes shuffle2 { 0%, 100% { transform: translate(0, 0) rotate(0); } 18% { transform: translate(-108px, 14px) rotate(-5deg); } 38% { transform: translate(108px, -14px) rotate(4deg); } 58% { transform: translate(-108px, -8px) rotate(-3deg); } 80% { transform: translate(108px, 12px) rotate(4deg); } }
@keyframes shuffle3 { 0%, 100% { transform: translate(0, 0) rotate(0); } 18% { transform: translate(-108px, -12px) rotate(4deg); } 38% { transform: translate(-216px, 14px) rotate(-5deg); } 58% { transform: translate(0, -14px) rotate(3deg); } 80% { transform: translate(-108px, 0) rotate(-4deg); } }
@keyframes flip { 0% { transform: rotateY(90deg) scale(0.92); opacity: 0; } 100% { transform: rotateY(0) scale(1); opacity: 1; } }
@media (prefers-reduced-motion: no-preference) {
  .shuffle1 { animation: shuffle1 2.2s cubic-bezier(0.45, 0.05, 0.35, 1) both; }
  .shuffle2 { animation: shuffle2 2.2s cubic-bezier(0.45, 0.05, 0.35, 1) both; }
  .shuffle3 { animation: shuffle3 2.2s cubic-bezier(0.45, 0.05, 0.35, 1) both; }
  .pcard.face { animation: flip 0.45s ease-out both; }
  .pcard.face.late { animation-delay: 0.35s; }
}

.goal { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: 8px; background: var(--soft); }
tr.on th, tr.on td { background: #ECE9FB; font-weight: 600; }
.row > input[type="text"] { flex: 1 1 200px; max-width: 280px; }

input[type="file"] { width: 100%; min-height: 46px; padding: 9px 12px; border: 1px solid #C4C8D0; border-radius: 10px; font: inherit; background: #FFFFFF; }

.line.mid { align-items: center; }

.danger-panel { border-color: var(--danger); background: #FBEDEF; }
.btn.danger.solid { background: var(--danger); color: #FFFFFF; font-weight: 600; }
.btn.danger.solid:hover { background: #8E1B30; }
