/* Tiro – système visuel
   Registre de procès-verbaux : sobre, lisible, la classification comme repère principal.
   Aucune police externe (souveraineté) : Charter / polices système. */
:root {
  --paper: #f3f5f7;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --ink: #172331;
  --ink-2: #4a5868;
  --ink-3: #7a8796;
  --line: #d9dfe6;
  --line-2: #e8ecf0;
  --primary: #0e5160;
  --primary-hover: #0a3f4b;
  --primary-ink: #ffffff;
  --primary-soft: #e3eff1;
  --ok: #2f7d4f;
  --warn: #9a5a0c;
  --bad: #a61b29;
  --lvl: #4a5868;

  --serif: Charter, "Bitstream Charter", "Iowan Old Style", "Sitka Text", Cambria, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --r-sm: 6px;
  --r-md: 10px;
  --shadow: 0 1px 2px rgba(23, 35, 49, .06), 0 4px 16px rgba(23, 35, 49, .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #121a22; --surface: #18222c; --surface-2: #1d2833; --ink: #e6ebf0; --ink-2: #a3b0bd;
    --ink-3: #7d8b99; --line: #2b3946; --line-2: #233140; --primary: #5fb3c2; --primary-hover: #7cc4d1;
    --primary-ink: #0d2328; --primary-soft: #1d3a41; --ok: #6cc08c; --warn: #e0a24f; --bad: #ef6b77;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.55 var(--sans); background: var(--paper); color: var(--ink);
       font-variant-numeric: tabular-nums; }
a { color: var(--primary); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* --- Barre supérieure --------------------------------------------------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar-in { max-width: 1120px; margin: 0 auto; height: 56px; padding: 0 20px;
             display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none;
         font-family: var(--serif); font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.brand-mark { width: 28px; height: 28px; display: block; }
.topbar .spacer { flex: 1; }
.lang-switch { display: inline-flex; border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }
.lang-switch button { border: 0; border-radius: 0; padding: 5px 10px; font-size: 13px; font-weight: 600;
                      background: transparent; color: var(--ink-2); }
.lang-switch button[aria-pressed="true"] { background: var(--primary-soft); color: var(--primary); }

/* --- Mise en page ------------------------------------------------------- */
main { max-width: 1120px; margin: 0 auto; padding: 28px 20px 96px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap;
             margin-bottom: 20px; }
h1 { font-family: var(--serif); font-size: 30px; line-height: 1.2; font-weight: 700; margin: 0;
     letter-spacing: -.015em; }
h2 { font-size: 16px; font-weight: 650; margin: 0 0 12px; }
h3 { font-size: 14px; font-weight: 650; margin: 18px 0 8px; color: var(--ink-2); }
.lead { color: var(--ink-2); margin: 6px 0 0; max-width: 62ch; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
@media (max-width: 960px) { .layout { grid-template-columns: 1fr; } }
.stack > * + * { margin-top: 16px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
         padding: 20px; box-shadow: var(--shadow); }
.panel + .panel { margin-top: 16px; }
.layout > div, .layout > aside, #results { display: flex; flex-direction: column; gap: 16px; }
.layout .panel + .panel, #results .panel + .panel { margin-top: 0; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.panel-head h2 { margin: 0; }
.hidden { display: none !important; }

/* --- Formulaires et boutons --------------------------------------------- */
label.field { display: block; font-weight: 600; font-size: 14px; margin: 16px 0 6px; }
input[type=text], input[type=password], select {
  width: 100%; padding: 10px 12px; font: inherit; font-size: 16px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
input:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; margin: 10px 0; cursor: pointer; }
.check input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--primary); }

button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 14px;
  font: inherit; font-size: 14px; font-weight: 600; border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; white-space: nowrap; }
button:hover, .btn:hover { border-color: var(--ink-3); }
button.primary, .btn.primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
button.primary:hover, .btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
button.ghost { border-color: transparent; background: transparent; color: var(--ink-2); padding: 6px 8px; }
button.ghost:hover { color: var(--ink); background: var(--surface-2); }
button.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); background: transparent; }
button:disabled, .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; pointer-events: none; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.err { color: var(--bad); font-size: 14px; margin: 10px 0 0; min-height: 1px; }

/* --- Classification ----------------------------------------------------- */
.level-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 650;
             color: var(--lvl); }
.level-tag::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--lvl); }
.levels { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px; }
.level-opt { border: 1px solid var(--line); border-left: 5px solid var(--lvl); border-radius: var(--r-sm);
             padding: 10px 12px; cursor: pointer; background: var(--surface); }
.level-opt input { position: absolute; opacity: 0; pointer-events: none; }
.level-opt b { display: block; color: var(--lvl); font-size: 15px; }
.level-opt small { display: block; color: var(--ink-2); font-size: 13px; line-height: 1.4; }
.level-opt.selected { background: color-mix(in srgb, var(--lvl) 8%, var(--surface));
                      box-shadow: 0 0 0 2px color-mix(in srgb, var(--lvl) 55%, transparent); }
.level-opt:focus-within { box-shadow: 0 0 0 3px var(--primary-soft); }
.level-banner { border-left: 6px solid var(--lvl); padding-left: 16px; }

/* --- Tableau de bord ---------------------------------------------------- */
.toolbar { display: flex; gap: 8px; margin-bottom: 14px; }
.toolbar input { max-width: 420px; }
.sessions { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
            overflow: hidden; box-shadow: var(--shadow); }
.srow { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 18px; align-items: center;
        padding: 14px 20px 14px 16px; border-left: 5px solid var(--lvl); color: inherit; text-decoration: none;
        border-bottom: 1px solid var(--line-2); }
.srow:last-child { border-bottom: 0; }
.srow:hover { background: var(--surface-2); }
.sdate { text-align: center; line-height: 1.1; }
.sdate .d { font-family: var(--serif); font-size: 26px; font-weight: 700; display: block; }
.sdate .m { font-size: 12px; color: var(--ink-2); }
.stitle { font-family: var(--serif); font-size: 18px; font-weight: 700; margin: 0 0 2px;
          overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.smeta { font-size: 13px; color: var(--ink-2); }
.speople { font-size: 13px; margin-top: 4px; color: var(--ink); overflow: hidden; text-overflow: ellipsis;
           white-space: nowrap; }
.sright { text-align: right; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.pill { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-2);
        border: 1px solid var(--line); color: var(--ink-2); }
.pill.live { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
.pill.done { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); }
@media (max-width: 640px) {
  .srow { grid-template-columns: 48px minmax(0, 1fr); }
  .sright { grid-column: 2; flex-direction: row; align-items: center; }
  .stitle, .speople { white-space: normal; }
}
.empty { padding: 40px 24px; text-align: center; }
.empty p { color: var(--ink-2); max-width: 46ch; margin: 0 auto 16px; }

/* --- Étapes de la séance ------------------------------------------------ */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; margin: 18px 0 4px; counter-reset: s; }
.step { position: relative; padding-top: 14px; font-size: 13px; color: var(--ink-3); }
.step::before { content: ""; position: absolute; top: 0; left: 0; right: 4px; height: 4px; border-radius: 2px;
                background: var(--line); }
.step.done { color: var(--ink-2); }
.step.done::before { background: var(--primary); }
.step.current { color: var(--ink); font-weight: 650; }
.step.current::before { background: linear-gradient(90deg, var(--primary) 50%, var(--line) 50%); }
.status-line { font-size: 14px; color: var(--ink-2); margin-top: 10px; display: flex; gap: 8px; align-items: center; }

/* --- Tableaux ----------------------------------------------------------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
th { color: var(--ink-2); font-weight: 600; font-size: 13px; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; }

/* --- Invitation --------------------------------------------------------- */
.qr { width: 100%; max-width: 220px; aspect-ratio: 1; background: #fff; border-radius: var(--r-sm);
      border: 1px solid var(--line); padding: 8px; display: block; margin: 0 auto 12px; }
.linkbox { display: flex; gap: 6px; }
.linkbox input { font-size: 13px; padding: 8px 10px; }
.notice { border-left: 3px solid var(--warn); background: color-mix(in srgb, var(--warn) 8%, var(--surface));
          padding: 10px 12px; font-size: 13px; border-radius: 0 var(--r-sm) var(--r-sm) 0; margin: 12px 0 0; }

/* --- Résultats ---------------------------------------------------------- */
.prose p { margin: 0 0 10px; max-width: 72ch; }
.prose ul { margin: 0 0 8px; padding-left: 20px; }
.prose li { margin: 3px 0; }
.bar { height: 6px; background: var(--line-2); border-radius: 3px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--primary); }
.transcript { max-height: 520px; overflow: auto; font-size: 14px; }
.tline { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 10px; padding: 6px 0;
         border-bottom: 1px solid var(--line-2); }
.tline time { color: var(--ink-3); font-size: 13px; }
.tline b { font-weight: 650; }
.person { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 10px 0;
          border-bottom: 1px solid var(--line-2); }
.person:last-child { border-bottom: 0; }
.person .who { font-weight: 650; }

/* --- Indicateurs -------------------------------------------------------- */
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--bad);
       animation: blink 1.2s ease-in-out infinite; flex: none; }
@keyframes blink { 50% { opacity: .25; } }
.spinner { width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--primary);
           border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.checks div { padding: 3px 0; font-size: 14px; }
.ok { color: var(--ok); } .warn { color: var(--warn); } .bad { color: var(--bad); }
details summary { cursor: pointer; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink);
         color: var(--surface); padding: 10px 16px; border-radius: var(--r-sm); font-size: 14px; z-index: 50; }

/* --- Page participant --------------------------------------------------- */
.narrow { max-width: 560px; }
.rec-state { font-family: var(--serif); font-size: 28px; font-weight: 700; display: flex; align-items: center;
             gap: 10px; margin: 4px 0 8px; }
.meter { height: 10px; background: var(--line-2); border-radius: 5px; overflow: hidden; margin: 14px 0; }
.meter > span { display: block; height: 100%; width: 0; background: var(--ok); transition: width .08s linear; }
.big { width: 100%; padding: 16px; font-size: 17px; border-radius: var(--r-md); }

/* --- Comptes et journal (0.4) ------------------------------------------- */
.code-input { max-width: 180px; letter-spacing: .18em; font-variant-numeric: tabular-nums; }
.settings { margin-top: 28px; display: flex; flex-direction: column; gap: 16px; }
.settings > .panel + .panel { margin-top: 0; }
.roles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; margin-top: 6px; }
.role-opt { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 10px 12px; margin: 0; cursor: pointer; }
.role-opt:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.role-opt b { display: block; font-size: 14px; }
.role-opt small { display: block; color: var(--ink-2); font-size: 13px; line-height: 1.4; font-weight: 400; }
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 999px;
       border: 1px solid var(--line); color: var(--ink-2); background: var(--surface-2); margin: 0 4px 4px 0; }
.tag.on { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, var(--line)); }
.tag.off { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, var(--line)); }
.table-wrap { overflow-x: auto; margin: 0 -10px; }
.acct-edit td { background: var(--surface-2); }
.totp-setup { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 20px; align-items: start; margin-top: 12px; }
.totp-setup .qr { margin: 0; max-width: 200px; }
@media (max-width: 640px) { .totp-setup { grid-template-columns: 1fr; } .totp-setup .qr { margin: 0 auto; } }
.secret { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 14px; word-break: break-all;
          background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 6px 8px;
          display: inline-block; }
.codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 6px; margin: 12px 0;
         font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 15px; }
.codes span { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--r-sm);
              padding: 6px 8px; text-align: center; }
.audit td { font-size: 13px; }
.audit td:first-child { white-space: nowrap; color: var(--ink-2); }
.audit .det { color: var(--ink-2); }

/* --- Passkeys (0.4.1) ------------------------------------------------------ */
.or { display: flex; align-items: center; gap: 12px; margin: 18px 0 12px; color: var(--ink-3); font-size: 13px; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.passkey-btn { width: 100%; font-size: 15px; padding: 12px 16px; }
.pk-list { list-style: none; margin: 0 0 12px; padding: 0; border: 1px solid var(--line-2); border-radius: var(--r-sm); }
.pk-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; }
.pk-list li + li { border-top: 1px solid var(--line-2); }
.pk-list .tag { margin: 0 0 0 6px; vertical-align: 1px; }
.pk-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 10px; align-items: end; max-width: 640px; }
.pk-form .field { margin-top: 0; }
@media (max-width: 640px) { .pk-form { grid-template-columns: 1fr; } }

/* Conservation (0.5) : préavis, vue Archives, séance archivée en lecture seule */
.pill.expiring { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, var(--line)); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; flex: none; }
.seg button { border: 0; border-radius: 0; background: transparent; padding: 6px 14px; }
.seg button.on { background: var(--surface-2); font-weight: 600; }
#retention { margin: 16px 0 4px; }
#retention h3 { margin: 0 0 6px; font-size: 15px; }
#retention .row select { margin: 0; width: auto; }
#retention h4 { margin: 0 0 4px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); }
#retention .ret-part { border-top: 1px solid var(--line-2); margin-top: 14px; padding-top: 12px; }
#retention .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .02em; }
body.archived #renameBtn, body.archived #hostCard, body.archived #joinCard, body.archived #analysisCard,
body.archived #micAll, body.archived #closeBtn, body.archived #reopenBtn, body.archived #transcribeBtn,
body.archived #pdfBtn, body.archived #pdfShortBtn, body.archived #presCard, body.archived #applyAllBtn, body.archived [data-link] { display: none !important; }

/* --- Mode présentation (0.5.1) : visionneuse sur téléphone, tablette, portable et projecteur ------------- */
.narrow.wide { max-width: 980px; }
.switch { font-weight: 600; white-space: nowrap; }
input[type=file] { width: 100%; font: inherit; font-size: 14px; padding: 8px; border: 1px dashed var(--line);
                   border-radius: var(--r-sm); background: var(--surface-2); color: var(--ink-2); }
.pres-opts { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr); gap: 4px 20px; align-items: end; }
@media (max-width: 640px) { .pres-opts { grid-template-columns: 1fr; } }
.pres-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.pres-head b { font-family: var(--serif); font-size: 17px; word-break: break-word; }
.pv { display: flex; flex-direction: column; gap: 8px; }
.pv-stage { position: relative; display: flex; align-items: center; justify-content: center; min-height: 220px;
            background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--r-sm);
            overflow: hidden; touch-action: pan-y pinch-zoom; }
.pv-stage:focus-visible { outline-offset: -2px; }
.pv-canvas { display: block; max-width: 100%; max-height: 72vh; width: auto; height: auto; background: #fff;
             user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.pv-empty { display: flex; gap: 10px; align-items: center; padding: 40px 20px; color: var(--ink-2); font-size: 14px;
            text-align: center; }
.pv-busy .pv-stage::after { content: ""; position: absolute; top: 10px; right: 10px; width: 14px; height: 14px;
                            border: 2px solid var(--line); border-top-color: var(--primary); border-radius: 50%;
                            animation: spin .8s linear infinite; }
.pv-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pv-bar .pv-prev, .pv-bar .pv-next { min-width: 44px; min-height: 40px; font-size: 20px; line-height: 1; padding: 6px 12px; }
.pv-count { min-width: 92px; text-align: center; color: var(--ink-2); }
.pv-live-tag { display: inline-flex; align-items: center; gap: 6px; color: var(--bad); font-weight: 600; }
.pv-space { flex: 1; }
.pv:fullscreen, .pv.pv-max { background: #000; padding: 12px; justify-content: center; }
.pv.pv-max { position: fixed; inset: 0; z-index: 60; }
.pv:fullscreen .pv-stage, .pv.pv-max .pv-stage { flex: 1; background: #000; border: 0; }
.pv:fullscreen .pv-canvas, .pv.pv-max .pv-canvas { max-height: calc(100vh - 70px); }
.pv:fullscreen .pv-bar, .pv.pv-max .pv-bar { color: #ddd; }
.pv:fullscreen .pv-count, .pv.pv-max .pv-count { color: #ddd; }
@media (max-width: 640px) {
  .pv-canvas { max-height: 64vh; }
  .pv-bar .small { font-size: 13px; }
  .pres-head { flex-direction: column; }
}
