:root {
  /* Text, grounds, borders, accent and font come from brand.css (packages/brand, generated).
     Local on purpose: the dark rail, the status colours (gauges, badges) and the panel radii. */
  --rail: #1f1f21;
  --rail-icon: #8a8a90;
  --rail-icon-active: var(--on-accent);
  --panel: var(--on-surface);
  --card: var(--on-background);
  --text: var(--on-text-primary);
  --muted: var(--on-text-secondary);
  --line: var(--on-border);
  /* A notch darker than the panel (pills, secondary buttons sit on it): ~#E7E7E7 in light. */
  --panel-deep: color-mix(in srgb, var(--panel) 70%, var(--line));
  --green: #4cc94a;
  --red: #d64545;
  --orange: #c9730a;
  --radius-panel: 36px;
  --radius-card: 28px;
  font-family: var(--on-font-family);
  font-size: 15px;
  color: var(--text);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--rail); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }

/* Layout: dark rail · light panel (submenu + content) */
.shell { display: flex; min-height: 100vh; }
.rail { width: 88px; flex: none; display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 22px 0; background: var(--rail); }
.rail .logo { width: 56px; height: auto; margin-bottom: 12px; }
/* No chip behind the icons: grey by default, white for the section you are in. */
.rail-button { width: 56px; height: 56px; border: 0; border-radius: 18px; background: transparent; color: var(--rail-icon); display: grid; place-items: center; }
.rail-button.active { color: var(--rail-icon-active); }
.rail-button:hover:not(.active) { color: #bdbdc4; }
.rail .spacer { flex: 1; }
.rail-backdrop { display: none; }
.panel { flex: 1; display: flex; background: var(--panel); border-radius: var(--radius-panel) 0 0 var(--radius-panel); min-width: 0; }
.submenu { width: 240px; flex: none; padding: 40px 12px 40px 28px; display: flex; flex-direction: column; gap: 6px; }
.submenu h2 { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 14px 12px; font-weight: 600; }
.submenu a { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 14px; text-decoration: none; color: var(--muted); font-size: 15px; }
.submenu a.active { color: var(--text); font-weight: 600; }
.submenu a:hover { background: var(--card); }
.content { flex: 1; padding: 36px 40px 60px 16px; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 26px; gap: 16px; }
.topbar h1 { margin: 0; font-size: 24px; font-weight: 600; }
.whoami { color: var(--muted); font-size: 13px; text-align: right; }
.burger { display: none; border: 0; background: transparent; padding: 0; color: var(--text); }
.topbar-logo { display: none; align-items: center; gap: 10px; height: 50px; flex: none; }
.topbar-logo-img { height: 40px; width: auto; display: block; }

/* Cards, pills, forms, tables */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
.card { background: var(--card); border-radius: var(--radius-card); padding: 26px 28px; }
.card h3 { margin: 0 0 16px; font-size: 16px; color: var(--muted); font-weight: 500; }
.card + .card { margin-top: 20px; }
.app-message textarea { font-family: inherit; font-size: 14px; min-height: 80px; }
.app-message h4 { margin: 22px 0 0; font-size: 14px; font-weight: 600; }
.notification-preview p { white-space: pre-wrap; }
.notice-alert { color: var(--red); }
.big { font-size: 44px; font-weight: 600; letter-spacing: -.02em; }
.pills { display: inline-flex; gap: 4px; background: var(--panel-deep); border-radius: 999px; padding: 4px; }
.pill { border: 0; background: transparent; border-radius: 999px; padding: 8px 16px; color: var(--muted); }
.pill.active { background: var(--card); color: var(--text); font-weight: 600; }
label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; }
input, select, textarea { width: 100%; border: 1px solid var(--line); background: var(--panel); border-radius: 14px; padding: 12px 14px; }
textarea { min-height: 140px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--text); outline-offset: 1px; }
.row { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 160px; }
.actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.btn { border: 0; border-radius: 14px; padding: 12px 18px; background: var(--text); color: var(--card); font-weight: 600; }
.btn.secondary { background: var(--panel-deep); color: var(--text); }
.btn.danger { background: #fbe9e9; color: var(--red); }
.btn:disabled { opacity: .45; cursor: default; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--muted); font-weight: 500; padding: 10px 8px; border-bottom: 1px solid var(--line); }
td { padding: 12px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 13px; background: var(--panel); color: var(--muted); }
.badge.ok { background: #e7f8e7; color: #2f8f2d; }
.badge.bad { background: #fbe9e9; color: var(--red); }
pre { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 14px; overflow: auto; font-size: 13px; }
.prompt-locked { color: var(--muted); white-space: pre-wrap; margin: 8px 0; }
.prompt-preview { white-space: pre-wrap; }
.prompt-editor { min-height: 280px; white-space: pre-wrap; }
.prompt-stale { color: var(--orange); }
.prompt-history-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.muted { color: var(--muted); font-size: 13px; }
.row.center { align-items: center; }
.row > .shrink { flex: 0; }
.playground { margin-top: 16px; }
.actions.tight { margin: 0; }
.switch { width: 46px; height: 28px; border-radius: 999px; border: 0; background: var(--line); position: relative; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--card); transition: left .15s; }
.switch.on { background: var(--on-accent); }
.switch.on::after { left: 21px; }

/* Statistics screens: toolbar, number cards, charts (HTML text + SVG shapes) */
.stats-toolbar { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 22px; }
/* Stats › App has eight tabs: they wrap instead of pushing the page sideways on a phone. */
.stats-toolbar .pills[role="tablist"] { flex-wrap: wrap; border-radius: 22px; max-width: 100%; }
.switch-field { display: inline-flex; align-items: center; gap: 10px; border: 0; padding: 4px; background: transparent; border-radius: 999px; }
.switch-field .switch { display: inline-block; }
.switch-field:focus-visible { outline: 2px solid var(--text); outline-offset: 1px; }
.switch-label { font-size: 14px; color: var(--muted); }
.stats-body > p.muted:first-child { margin-top: 0; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 16px 18px; min-width: 0; }
.stat-label { color: var(--muted); font-size: 13px; }
.stat-value { font-size: 30px; font-weight: 600; letter-spacing: -.02em; margin-top: 4px; overflow-wrap: anywhere; }
.stat-hint { color: var(--muted); font-size: 12px; margin-top: 6px; }
/* Gauges (Serveur block, account storage): green, orange from 80 %, red from 90 %. */
.meter { appearance: none; -webkit-appearance: none; display: block; width: 100%; height: 10px; margin-top: 10px; border: 0; border-radius: 999px; background: var(--panel); color: var(--green); }
.meter::-webkit-progress-bar { background: var(--panel); border-radius: 999px; }
.meter::-webkit-progress-value { background: var(--green); border-radius: 999px; }
.meter::-moz-progress-bar { background: var(--green); border-radius: 999px; }
.stat.warn { background: #fff7ec; border-color: #f3d3a4; }
.stat.warn .stat-value, .stat.warn .stat-level { color: var(--orange); }
.stat.warn .meter { color: var(--orange); }
.stat.warn .meter::-webkit-progress-value { background: var(--orange); }
.stat.warn .meter::-moz-progress-bar { background: var(--orange); }
.stat.alert { background: #fdf0f0; border-color: #f0b9b9; }
.stat.alert .stat-value, .stat.alert .stat-level { color: var(--red); }
.stat.alert .meter { color: var(--red); }
.stat.alert .meter::-webkit-progress-value { background: var(--red); }
.stat.alert .meter::-moz-progress-bar { background: var(--red); }
.stat-level { font-size: 12px; font-weight: 600; margin-top: 6px; }
/* Account page: the way back to the list. */
.back-link { display: inline-block; margin-bottom: 16px; color: var(--muted); text-decoration: none; font-size: 14px; }
.back-link:hover { color: var(--text); }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--panel); }
/* Account list: selection and features (spec 2026-10-11 fonctionnalités par compte). */
th.pick, td.pick { width: 36px; }
th.pick input[type="checkbox"], td.pick input[type="checkbox"] { width: 18px; height: 18px; margin: 0; padding: 0; accent-color: var(--on-accent); cursor: pointer; }
.feature-pills { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.manual-mark { font-size: 14px; }
.users-toolbar { align-items: center; justify-content: space-between; margin: 12px 0; }
.load-more { margin-top: 12px; }
.chart-block { margin-top: 26px; }
.chart-block h4 { margin: 0 0 10px; font-size: 14px; font-weight: 600; color: var(--text); }
.chart-block p.muted { margin: 8px 0 0; }
/* Only the shapes live in the SVG: it may scale freely, no text inside it. */
.chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart-line { fill: none; stroke: var(--text); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chart-axis { stroke: var(--line); stroke-width: 1; }
.chart-dot { fill: var(--text); }
.chart-hit { fill: transparent; }

/* Per-day line chart: scale, last value and days are HTML around the drawing. */
.line-chart { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 10px; }
.line-chart-scale { display: flex; flex-direction: column; justify-content: space-between; color: var(--muted); font-size: 13px; }
.line-chart-plot { position: relative; min-width: 0; }
.line-chart-last { position: absolute; top: 0; right: 0; font-size: 14px; font-weight: 600; color: var(--text); background: var(--card); padding-left: 6px; }
.line-chart-days { display: flex; justify-content: space-between; gap: 12px; margin-top: 6px; color: var(--muted); font-size: 13px; }

/* Distribution: one HTML row per entry, the bar is a <progress> (no inline style needed). */
.bars { display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 210px) minmax(60px, 1fr) auto; align-items: center; gap: 12px; font-size: 14px; }
.bar-label { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-value { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.bar-track { appearance: none; -webkit-appearance: none; display: block; width: 100%; height: 14px; border: 0; border-radius: 999px; background: var(--panel); color: var(--text); }
.bar-track::-webkit-progress-bar { background: var(--panel); border-radius: 999px; }
.bar-track::-webkit-progress-value { background: var(--text); border-radius: 999px; }
.bar-track::-moz-progress-bar { background: var(--text); border-radius: 999px; }
.bar-row:hover .bar-track::-webkit-progress-value { background: var(--muted); }
.bar-row:hover .bar-track::-moz-progress-bar { background: var(--muted); }
@media (max-width: 620px) {
  .bar-row { grid-template-columns: minmax(60px, 1fr) auto; row-gap: 4px; }
  .bar-label { grid-column: 1 / -1; }
}
.funnel td:nth-child(2) { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

/* Sign-in / 2FA screens */
.auth { min-height: 100vh; display: grid; place-items: center; background: var(--panel); padding: 16px; }
.auth .card { width: min(420px, 100%); }
.auth .logo { width: 56px; height: 56px; display: block; margin-bottom: 18px; }
.auth h1 { margin: 0 0 6px; font-size: 24px; }
.qr { width: 200px; height: 200px; display: block; margin: 16px auto; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-family: ui-monospace, Menlo, monospace; font-size: 16px; }

/* Toasts, modal */
#toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 10px; z-index: 20; }
.toast { background: var(--text); color: var(--card); padding: 12px 16px; border-radius: 14px; max-width: 360px; }
.toast.error { background: var(--red); }
.backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .35); display: grid; place-items: center; z-index: 10; padding: 16px; }
.backdrop .card { width: min(480px, 100%); }

/* Phone: rail + submenu slide in together from the right as one drawer, opened by the hamburger */
@media (max-width: 760px) {
  .burger { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; flex: none; order: 2; margin-left: auto; }
  .topbar-logo { display: flex; order: 1; }
  .topbar { flex-wrap: wrap; row-gap: 10px; }
  .topbar h1 { order: 3; flex: 0 0 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar .whoami { display: none; }
  .rail {
    position: fixed;
    inset: 0 0 0 auto;
    width: 88px;
    transform: translateX(100%);
    transition: transform .2s ease;
    background: var(--rail);
    z-index: 31;
  }
  .shell.rail-open .rail { transform: none; }
  .shell.rail-open .rail-backdrop { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 25; }
  .panel { border-radius: 0; }
  /* Submenu becomes the light column of the drawer, sliding in with the rail, immediately to its left. */
  .submenu {
    position: fixed;
    top: 0;
    bottom: 0;
    right: 88px;
    width: min(220px, calc(100vw - 88px));
    padding: 24px 16px 16px;
    /* Off-canvas means clearing its own width AND the rail it sits against,
       otherwise a strip of it stays on screen over the content. */
    transform: translateX(calc(100% + 88px));
    transition: transform .2s ease;
    background: var(--panel);
    z-index: 30;
    overflow-y: auto;
    box-shadow: -4px 0 16px rgba(0, 0, 0, .3);
  }
  .shell.rail-open .submenu { transform: none; }
  .content { padding: 8px 16px 40px; }
  .card { overflow-x: auto; }
  .stat-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .stat-value { font-size: 26px; }
}

/* Stats › Liste d'attente: one sign-up (facts table, consent checkboxes). */
.facts th { width: 140px; border-bottom: 1px solid var(--line); }
label.consent { display: flex; gap: 12px; align-items: flex-start; margin: 0; padding: 14px 0; border-bottom: 1px solid var(--line); font-size: 14px; color: var(--text); cursor: pointer; }
label.consent:last-of-type { border-bottom: 0; }
.consent input[type="checkbox"] { width: 20px; height: 20px; flex: none; margin: 1px 0 0; padding: 0; accent-color: var(--on-accent); cursor: pointer; }
.consent input[type="checkbox"]:disabled { cursor: default; }
.consent-text { display: flex; flex-direction: column; gap: 4px; }
.consent-text .muted { font-size: 13px; }
.report-body { max-width: 420px; white-space: pre-wrap; overflow-wrap: anywhere; }

/* Stats › Rapports (owner 25/10/2026): the report on screen, then its print (« Télécharger en PDF » = window.print()). */
.report-controls .report-shortcuts { flex-wrap: wrap; border-radius: 22px; max-width: 100%; }
.report-controls .report-dates { margin-top: 6px; }
.report-controls .report-dates > div { max-width: 240px; }
.activity-report-body { margin-top: 20px; }
.report > .card + .card { margin-top: 20px; }
.report-head h2 { margin: 14px 0 6px; font-size: 24px; font-weight: 600; }
.report-head p { margin: 4px 0; }
.report-logo { height: 34px; width: auto; display: block; }
.report-range { font-size: 17px; font-weight: 600; }
.report-warning { color: var(--orange); font-size: 13px; }
.report-section h3 { color: var(--text); font-size: 19px; font-weight: 600; }
.report-section .stat-grid { margin-bottom: 18px; }
.report-table td:not(:first-child), .report-table th:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.report-table td { padding: 8px; }
.report .line-chart-days { grid-column: 2; }
.report-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); column-gap: 28px; }

@media print {
  @page { size: A4; margin: 14mm 12mm; }
  html, body { height: auto; background: var(--card); }
  .rail, .rail-backdrop, .submenu, .topbar, .report-controls, #toasts, .backdrop { display: none !important; }
  .shell, .panel, .content { display: block; min-height: 0; padding: 0; margin: 0; border-radius: 0; background: var(--card); }
  .activity-report-body { margin: 0; }
  .report { font-size: 10.5pt; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .report .card { background: var(--card); border-radius: 0; padding: 0; overflow: visible; }
  .report > .card + .card { margin-top: 18pt; }
  .report-section + .report-section { break-before: page; margin-top: 0; }
  .report-head h2 { font-size: 20pt; }
  .report-section h3 { font-size: 14pt; margin-bottom: 8pt; }
  .report-table { font-size: 9.5pt; }
  .report-table td, .report-table th { padding: 3pt 4pt; }
  .report tr, .chart-block, .stat { break-inside: avoid; }
  .report h3, .report h4 { break-after: avoid; }
  .report .stat { padding: 6pt 8pt; border-radius: 6pt; }
  .report .stat-value { font-size: 16pt; }
  .report-charts { grid-template-columns: 1fr 1fr; column-gap: 14pt; }
  .report .chart-block { margin-top: 12pt; }
  .report .line-chart-last { background: var(--card); }
}

/* Licences › Clubs (plan partie 1 Task 13): licence cell (tier, end, source) and row actions. */
.club-license { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
.club-actions { flex-wrap: nowrap; }
.club-actions .btn { white-space: nowrap; min-height: 44px; }
@media (max-width: 760px) {
  .club-actions { flex-wrap: wrap; }
}
/* Boutique (plan boutique phase 1, task 9): products, orders, shipping. */
a.btn { display: inline-block; text-decoration: none; }
.badge.warn { background: #fdf1e2; color: var(--orange); }
.pills.wrap { flex-wrap: wrap; border-radius: 22px; max-width: 100%; }
fieldset.plain { border: 0; padding: 0; margin: 0; min-width: 0; }
.table-scroll { overflow-x: auto; max-width: 100%; }
.shop-thumb { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; display: block; background: var(--panel); }
.shop-images { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
span.shop-image { display: inline-block; }
.shop-image { width: 112px; height: 112px; border-radius: 12px; object-fit: cover; background: var(--panel); }
.shop-variants input, .shop-variants select { min-width: 96px; padding: 8px 10px; border-radius: 10px; }
.shop-variants td.pick input { min-width: 0; }
.shop-stock { display: flex; flex-direction: column; gap: 6px; }
.shop-collections { display: flex; flex-wrap: wrap; gap: 10px 20px; margin-top: 8px; }
.shop-names { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 4px 16px; }
.shop-order-cell { display: flex; gap: 6px; }
.btn.shop-order { min-width: 36px; padding: 6px 10px; }
.shop-members { margin: 8px 0 0; padding-left: 20px; line-height: 1.8; }
label.shop-check { display: flex; gap: 6px; align-items: center; margin: 0; font-size: 13px; white-space: nowrap; }
label.shop-check input { width: 16px; height: 16px; min-width: 0; padding: 0; margin: 0; accent-color: var(--on-accent); }
.shop-rates input { min-width: 96px; }
.shop-rates input.shop-country { width: 72px; min-width: 72px; text-transform: uppercase; }
textarea.shop-description { font-family: inherit; font-size: 14px; }
.shop-address { display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px; }
.lang-panel[hidden] { display: none; }
