/* Stage chez Kairos IT — feuille de style unique (aucune ressource externe) */
:root {
  color-scheme: light dark;
  --bg: #f4f5f7;
  --card: #ffffff;
  --ink: #1b2430;
  --muted: #5d6b7c;
  --line: #e1e5eb;
  --primary: #1f3a5f;
  --primary-ink: #ffffff;
  --accent: #e8a33d;
  --accent-soft: #fff4de;
  --accent-ink: #5a3b00;
  --ok: #1e7d4f;
  --ok-soft: #e4f5ec;
  --err: #b3261e;
  --err-soft: #fdecea;
  --focus: #2f6fd1;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 30, 50, .06), 0 4px 14px rgba(20, 30, 50, .04);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141b;
    --card: #172029;
    --ink: #e7ebf0;
    --muted: #9aa8b8;
    --line: #273445;
    --primary: #3d70b8;
    --primary-ink: #ffffff;
    --accent: #f0b254;
    --accent-soft: #33280f;
    --accent-ink: #f6d9a1;
    --ok: #52c08a;
    --ok-soft: #12301f;
    --err: #ff8a80;
    --err-soft: #3a1815;
    --focus: #7aa7ee;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
}
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
a { color: var(--primary); }
@media (prefers-color-scheme: dark) { a { color: #8fb6f0; } }
code { background: var(--bg); padding: .1rem .35rem; border-radius: 4px; font-size: .9em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 20px; padding-bottom: 40px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.row { display: flex; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; gap: .5rem; }
.row.gap { gap: .5rem; }
.narrow { max-width: 640px; }
.inline { display: inline; margin: 0; }
.noprint {}

/* ---- Barre de navigation ---- */
.topbar { background: var(--primary); color: var(--primary-ink); position: sticky; top: 0; z-index: 10; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 56px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: .6rem; color: #fff; text-decoration: none; font-weight: 700; }
.logo, .auth-logo {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px;
  background: var(--accent); color: #2b1c00; font-weight: 800;
}
.nav { display: flex; align-items: center; gap: .25rem; flex-wrap: wrap; }
.nav a, .nav .linklike {
  color: #fff; text-decoration: none; padding: .45rem .7rem; border-radius: 8px; font-size: .95rem;
  opacity: .92;
}
.nav a:hover, .nav .linklike:hover { background: rgba(255, 255, 255, .14); opacity: 1; }
.nav a.active { background: rgba(255, 255, 255, .2); opacity: 1; }
.nav a.cta { background: var(--accent); color: #2b1c00; font-weight: 600; }
.nav-toggle, .burger { display: none; }
@media (max-width: 820px) {
  .burger { display: inline-block; color: #fff; padding: .45rem .8rem; border: 1px solid rgba(255,255,255,.5); border-radius: 8px; cursor: pointer; }
  .nav { display: none; width: 100%; flex-direction: column; align-items: stretch; padding-bottom: .75rem; }
  .nav a, .nav .linklike { padding: .8rem .75rem; text-align: left; width: 100%; }
  .nav .inline { display: block; }
  .nav-toggle:checked ~ .nav { display: flex; }
  .nav-toggle:focus-visible ~ .burger { outline: 3px solid #fff; }
}

/* ---- Messages ---- */
.flashes { margin-bottom: 1rem; }
.flash { padding: .7rem 1rem; border-radius: 10px; margin: 0 0 .5rem; border: 1px solid; }
.flash.ok { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.flash.error { background: var(--err-soft); border-color: var(--err); color: var(--err); }
.notice { background: var(--accent-soft); color: var(--accent-ink); border: 1px solid var(--accent); padding: .8rem 1rem; border-radius: 10px; margin-bottom: 1rem; }
.notice a { color: inherit; font-weight: 600; }
.warn { color: var(--accent-ink); background: var(--accent-soft); padding: .5rem .75rem; border-radius: 8px; }
.badge { display: inline-block; padding: .1rem .6rem; border-radius: 999px; background: var(--line); font-size: .85rem; font-weight: 600; margin-right: .4rem; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }

/* ---- Cartes et mise en page ---- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; box-shadow: var(--shadow); }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head h1 { margin-bottom: .1rem; }
.page-head p { margin: 0; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.cols > .card { margin-bottom: 0; }
.cols { margin-bottom: 16px; }
@media (max-width: 820px) { .cols { grid-template-columns: 1fr; } }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }
.foot { color: var(--muted); font-size: .85rem; padding-bottom: 24px; }
.crumbs { margin-bottom: .5rem; }

/* ---- Statistiques ---- */
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.stat .num { font-size: 1.6rem; font-weight: 700; color: var(--primary); }
@media (prefers-color-scheme: dark) { .stat .num { color: #8fb6f0; } }
.stat .lbl { color: var(--muted); font-size: .85rem; }
@media (max-width: 820px) { .stats { grid-template-columns: repeat(2, 1fr); } }

progress { width: 100%; height: 12px; border: 0; border-radius: 999px; overflow: hidden; background: var(--line); accent-color: var(--accent); }
progress::-webkit-progress-bar { background: var(--line); border-radius: 999px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 999px; }

/* ---- Tableaux et listes ---- */
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th { text-align: left; color: var(--muted); font-weight: 600; font-size: .8rem; border-bottom: 1px solid var(--line); padding: .3rem .4rem; }
.table td { padding: .45rem .4rem; border-bottom: 1px solid var(--line); }
.table tr:last-child td { border-bottom: 0; }
.num-col { text-align: right; white-space: nowrap; }
.bar-col { width: 45%; }
.list { list-style: none; margin: 0; padding: 0; }
.list li a { display: flex; gap: .75rem; padding: .6rem .2rem; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.list li:last-child a { border-bottom: 0; }
.list li a:hover { background: var(--bg); }
.list .when { color: var(--muted); min-width: 5.5rem; font-variant-numeric: tabular-nums; }
.list .what { flex: 1; }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { display: inline-block; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; padding: .2rem .7rem; text-decoration: none; color: inherit; font-size: .9rem; }
.chip:hover { border-color: var(--primary); }
.chip-n { color: var(--muted); font-size: .8rem; margin-left: .25rem; }
.starmark { color: var(--accent); }

/* ---- Liste du journal ---- */
.entry-list { list-style: none; padding: 0; margin: 0; }
.entry-item { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 10px; padding: 14px 16px; }
.entry-date { min-width: 64px; text-align: center; background: var(--bg); border-radius: 10px; padding: .4rem .3rem; line-height: 1.1; }
.entry-date .d { display: block; font-size: 1.5rem; font-weight: 700; color: var(--primary); }
@media (prefers-color-scheme: dark) { .entry-date .d { color: #8fb6f0; } }
.entry-date .mo { display: block; font-size: .7rem; color: var(--muted); text-transform: capitalize; }
.entry-main { flex: 1; min-width: 0; }
.entry-main h2 { margin: 0 0 .15rem; font-size: 1.05rem; }
.entry-main h2 a { text-decoration: none; color: inherit; }
.entry-main h2 a:hover { text-decoration: underline; }
.entry-title { margin: 0 0 .2rem; font-weight: 500; }
.snippet { margin: 0 0 .3rem; }
.meta { display: flex; flex-wrap: wrap; gap: .3rem 1rem; margin: 0; }
.entry-side { padding-top: 2px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 18px 0; }

/* ---- Formulaires ---- */
.form .field, .field { margin-bottom: 14px; }
.field.grow { flex: 1 1 260px; }
label { display: block; font-weight: 600; margin-bottom: .3rem; font-size: .95rem; }
.req { color: var(--err); }
.hint { color: var(--muted); font-size: .85rem; margin: .25rem 0 0; }
input[type=text], input[type=password], input[type=date], input[type=search], input[type=file], select, textarea {
  width: 100%; padding: .65rem .75rem; font: inherit; color: var(--ink);
  background: var(--card); border: 1px solid #b8c1cd; border-radius: 10px;
}
@media (prefers-color-scheme: dark) {
  input[type=text], input[type=password], input[type=date], input[type=search], input[type=file], select, textarea { border-color: #3a4a60; }
}
textarea { resize: vertical; min-height: 5.5rem; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--focus); outline: 2px solid var(--focus); outline-offset: 0; }
.check { display: inline-flex; align-items: center; gap: .5rem; font-weight: 500; cursor: pointer; margin: 0 0 .5rem; }
.check input { width: 1.1rem; height: 1.1rem; }
.filters { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; }
.filters .field { margin: 0; min-width: 150px; }
.filters .check { margin: 0 0 .6rem; }
.ident { display: flex; flex-wrap: wrap; gap: 8px 32px; background: var(--bg); border-radius: 10px; padding: .7rem .9rem; margin-bottom: 1rem; }
.ident .lbl { display: block; color: var(--muted); font-size: .8rem; }
.actions { display: flex; gap: .6rem; margin-top: .5rem; }
.actions.sticky { position: sticky; bottom: 0; background: var(--bg); padding: 12px 0; border-top: 1px solid var(--line); margin-bottom: 16px; z-index: 5; }
.code-input { font-size: 1.6rem; letter-spacing: .3em; text-align: center; font-variant-numeric: tabular-nums; }
.secret { word-break: break-all; }
.qr { background: #fff; padding: 8px; border-radius: 10px; }

/* ---- Boutons ---- */
.btn {
  display: inline-block; padding: .6rem 1.1rem; border-radius: 10px; border: 1px solid transparent;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; line-height: 1.3; text-align: center;
}
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { filter: brightness(1.12); }
.btn-ghost { background: transparent; color: var(--ink); border-color: #b8c1cd; }
.btn-ghost:hover { background: var(--bg); }
.btn-danger { background: var(--err); color: #fff; }
@media (prefers-color-scheme: dark) { .btn-danger { color: #2b0b08; } .btn-ghost { border-color: #3a4a60; } }
.block-btn { width: 100%; padding: .8rem; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--primary); cursor: pointer; text-decoration: underline; }
.linklike.danger { color: var(--err); }
.star { background: none; border: 0; font-size: 1.5rem; line-height: 1; cursor: pointer; color: var(--muted); padding: .25rem .4rem; border-radius: 8px; }
.star.on { color: var(--accent); }
.star:hover { background: var(--bg); }
.danger-zone { border-color: var(--err); }

/* ---- Vue d'une entrée ---- */
.entry-head { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; flex-wrap: wrap; }
.entry-head p { margin: 0; }
.facts { display: flex; flex-wrap: wrap; gap: 8px 32px; margin: 1rem 0; padding: .8rem 1rem; background: var(--bg); border-radius: 10px; }
.facts dt { color: var(--muted); font-size: .8rem; }
.facts dd { margin: 0; font-weight: 600; }
.block { margin-top: 1.25rem; }
.block h3 { color: var(--primary); border-bottom: 2px solid var(--accent); display: inline-block; padding-bottom: .1rem; margin-bottom: .5rem; }
@media (prefers-color-scheme: dark) { .block h3 { color: #8fb6f0; } }
.prose { white-space: pre-wrap; overflow-wrap: anywhere; }
.stamp { margin: 1.5rem 0 0; }
.files { list-style: none; padding: 0; margin: .5rem 0 1rem; }
.files li { padding: .35rem 0; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: .3rem .8rem; align-items: baseline; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; margin: 1rem 0; }
.gallery figure { margin: 0; }
.gallery img { width: 100%; height: 140px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: var(--bg); }
.gallery figcaption { color: var(--muted); margin-top: .2rem; overflow-wrap: anywhere; }
.upload { border-top: 1px solid var(--line); margin-top: 1rem; padding-top: 1rem; }

/* ---- Rapport ---- */
.report-head { border-bottom: 2px solid var(--accent); margin-bottom: 1rem; }
.report-title { font-size: 1.4rem; }
.group-title { margin-top: 1.8rem; padding-bottom: .3rem; border-bottom: 1px solid var(--line); font-size: 1.3rem; }
.report-entry { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 18px; margin: 12px 0; }
.report-entry h3 { margin-bottom: .2rem; }

/* ---- Connexion ---- */
body.auth main.wrap { display: grid; place-items: center; min-height: 85vh; }
.auth-card { width: 100%; max-width: 400px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 28px 24px; box-shadow: var(--shadow); }
.auth-card h1 { text-align: center; font-size: 1.4rem; margin-top: .75rem; }
.auth-logo { display: grid; margin: 0 auto; width: 52px; height: 52px; font-size: 1.6rem; border-radius: 14px; }
.error-card { max-width: 480px; margin: 40px auto; }
.error-code { font-size: 3rem; font-weight: 800; color: var(--accent); margin: 0; }
body.auth .foot { display: none; }

/* ---- Impression ---- */
@media print {
  :root { color-scheme: light; --bg: #fff; --card: #fff; --ink: #000; --muted: #444; --line: #ccc; --shadow: none; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .topbar, .foot, .noprint, .flashes { display: none !important; }
  main.wrap { padding: 0; max-width: none; }
  .report-entry { break-inside: avoid-page; border-color: #bbb; }
  .group-title { break-after: avoid; }
  a { color: #000; text-decoration: none; }
}
