/* Console d'administration BaaraSanté : mêmes couleurs que le poste (design « Terre » : fond sable, menu brun, accent terre cuite). */
@font-face { font-family: 'Source Sans 3'; src: url('assets/source-sans-3-latin-400-normal.woff2') format('woff2'); font-weight: 400; }
@font-face { font-family: 'Source Sans 3'; src: url('assets/source-sans-3-latin-600-normal.woff2') format('woff2'); font-weight: 600; }
@font-face { font-family: 'Source Sans 3'; src: url('assets/source-sans-3-latin-700-normal.woff2') format('woff2'); font-weight: 700; }
@font-face { font-family: 'Bitter'; src: url('assets/bitter-latin-600-normal.woff2') format('woff2'); font-weight: 600; }
@font-face { font-family: 'Bitter'; src: url('assets/bitter-latin-700-normal.woff2') format('woff2'); font-weight: 700; }

:root {
  --ground: #f6f1e7; --surface: #fffdf8; --well: #efe6d8; --ink: #2b211b; --ink-soft: #6b5a4c; --line: #eadfcf;
  --nav: #2e2119; --nav-ink: #d9c8b4; --accent: #a3471f; --accent-soft: #f4dccd;
  --good: #3f6a22; --good-soft: #e7eedc; --warn: #8a5a1c; --warn-soft: #f6e7cc; --bad: #b3261e; --bad-soft: #f9dedb;
  --radius: 16px; --radius-control: 10px;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 15px/1.45 'Source Sans 3', system-ui, sans-serif; }
h1, h2, h3 { font-family: 'Bitter', Georgia, serif; font-weight: 700; margin: 0; }
h1 { font-size: 24px; } h2 { font-size: 19px; } h3 { font-size: 16px; }
.muted { color: var(--ink-soft); }
.small { font-size: 13px; }

/* Barre du haut */
.topbar { display: flex; align-items: center; gap: 14px; padding: 12px 24px; background: var(--nav); color: #fff; flex-wrap: wrap; }
.logo { width: 40px; height: 40px; border-radius: 11px; }
.brand { display: flex; flex-direction: column; line-height: 1.2; margin-right: 12px; }
.brand span { color: var(--nav-ink); font-size: 12.5px; }
.tabs { display: flex; gap: 4px; flex: 1; }
.tabs button { background: none; border: 0; color: var(--nav-ink); padding: 9px 14px; border-radius: 10px; font: inherit; font-weight: 500; cursor: pointer; }
.tabs button:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.tabs button[aria-current='page'] { background: rgba(255, 255, 255, 0.14); color: #fff; font-weight: 600; }
.account { display: flex; align-items: center; gap: 10px; color: var(--nav-ink); font-size: 13.5px; }
.account button { background: rgba(255, 255, 255, 0.1); color: #fff; border: 0; border-radius: 10px; padding: 7px 12px; font: inherit; cursor: pointer; white-space: nowrap; }
@media (max-width: 640px) {
  .topbar { padding: 12px 16px; }
  .account { width: 100%; flex-wrap: wrap; }
  .account span { flex: 1 0 100%; }
}

/* Page */
.page { max-width: 1100px; margin: 0 auto; padding: 24px 16px 48px; display: flex; flex-direction: column; gap: 18px; }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: 0 10px 28px rgba(46, 33, 25, 0.08); padding: 22px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.narrow { max-width: 440px; margin: 40px auto; width: 100%; }

/* Formulaires */
form { display: flex; flex-direction: column; gap: 14px; }
form p, dialog p { margin: 0; }
.toolbar p { margin: 4px 0 0; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 500; }
input { font: inherit; padding: 11px 14px; border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--ground); color: var(--ink); }
input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.hint { font-size: 13px; color: var(--ink-soft); font-weight: 400; }
.code-input { font-size: 26px; letter-spacing: 8px; text-align: center; font-family: 'Bitter', monospace; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }

button.primary, button.secondary, button.danger, button.ghost {
  font: inherit; font-weight: 600; border-radius: var(--radius-control); padding: 10px 16px; cursor: pointer; border: 1px solid transparent;
}
button.primary { background: var(--accent); color: #fff; }
button.primary:hover { filter: brightness(0.95); }
button.secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
button.secondary:hover, button.ghost:hover { background: var(--well); }
button.danger { background: var(--surface); color: var(--bad); border-color: var(--bad-soft); }
button.danger:hover { background: var(--bad-soft); }
button.ghost { background: none; color: var(--ink); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

.message { padding: 12px 14px; border-radius: var(--radius-control); font-size: 14px; }
.message.bad { background: var(--bad-soft); color: var(--bad); }
.message.good { background: var(--good-soft); color: var(--good); }
.message.warn { background: var(--warn-soft); color: var(--warn); }

/* Abonnements */
select { font: inherit; padding: 11px 14px; border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--ground); color: var(--ink); }
select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
button.filter { font: inherit; font-size: 14px; font-weight: 500; border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft); border-radius: 999px; padding: 6px 14px; cursor: pointer; }
button.filter[aria-pressed='true'] { background: var(--nav); border-color: var(--nav); color: #fff; }
button.link { font: inherit; background: none; border: 0; padding: 0; color: var(--accent); font-weight: 600; cursor: pointer; text-decoration: underline; }
dialog.wide { width: min(780px, calc(100vw - 32px)); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.section { border-top: 1px solid var(--line); padding-top: 14px; gap: 10px; display: flex; flex-direction: column; }
.actions.start { justify-content: flex-start; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px 14px; }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
label.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.inline { display: flex; gap: 10px; flex-wrap: wrap; }
.inline input { flex: 1 1 220px; }
ul.plain { margin: 0; padding-left: 18px; color: var(--ink-soft); }
td.actions, td .chip { white-space: nowrap; }
a.button-link { font-weight: 600; color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-control); padding: 10px 16px; text-decoration: none; display: inline-flex; align-items: center; }
a.button-link:hover { background: var(--well); }
p.late { color: var(--warn); }

/* Tableaux */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--ink-soft); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }
.address { font-family: ui-monospace, Consolas, monospace; font-size: 13px; color: var(--ink-soft); }

.chip { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 3px 11px; font-size: 13px; font-weight: 500; }
.chip::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.good { background: var(--good-soft); color: var(--good); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.bad { background: var(--bad-soft); color: var(--bad); }
.chip.neutral { background: var(--well); color: var(--ink-soft); }

/* Fenêtre */
dialog { border: 0; border-radius: var(--radius); padding: 0; width: min(560px, calc(100vw - 32px)); box-shadow: 0 24px 60px rgba(46, 33, 25, 0.25); }
dialog::backdrop { background: rgba(46, 33, 25, 0.35); }
dialog .card { box-shadow: none; }

.qr { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.qr img { width: 180px; height: 180px; border-radius: 12px; border: 1px solid var(--line); }
.secret { font-family: ui-monospace, Consolas, monospace; background: var(--well); padding: 8px 10px; border-radius: 10px; word-break: break-all; font-size: 13px; }
.empty { text-align: center; padding: 32px 12px; color: var(--ink-soft); }

/* Création d'une école : filières autorisées */
.program-row { display: grid; grid-template-columns: 2fr 1.4fr 1fr auto; gap: 8px; align-items: center; }
.program-row input, .program-row select { min-width: 0; }
@media (max-width: 640px) { .program-row { grid-template-columns: 1fr; } }
.stack.small-gap { gap: 8px; }
dialog { max-height: calc(100vh - 32px); overflow-y: auto; }
