/* Shared portal base: reset, type, layout, buttons, forms and the public header/footer.
   Colours, fonts and sizes come from rtz-tokens.css (loaded first). The client space and
   Alexia's admin refine these in app-shell.css; page families keep their own small files. */

/* Base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--rtz-font-body); font-size: var(--rtz-fs-body); line-height: 1.55; color: var(--ink); background: var(--canvas); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-underline-offset: 4px; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
img { display: block; max-width: 100%; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-family: var(--rtz-font-display); font-weight: 500; line-height: 1.12; letter-spacing: var(--rtz-tracking-display); color: var(--ink); overflow-wrap: break-word; }
h1 { font-size: var(--rtz-fs-h1); line-height: 1.05; max-width: 860px; }
h2 { font-size: var(--rtz-fs-h2); }
h3 { font-size: var(--rtz-fs-h3); letter-spacing: -.025em; line-height: 1.25; }
p { overflow-wrap: anywhere; }
:is(h1, h2, h3, h4, label, legend, summary, dt, th) { text-wrap-style: balance; }
:is(p, li, dd, .help, .notice) { text-wrap-style: pretty; }
:is(input, textarea, select, option, [contenteditable]) { text-wrap-style: auto; }
[hidden] { display: none !important; }
:focus-visible { outline: var(--rtz-focus); outline-offset: var(--rtz-focus-offset); }
/* Browsers without <dialog> (Safari < 15.4) would show every closed dialog inline. */
dialog:not([open]) { display: none; }
/* Classic scrollbars (Windows, macOS with a mouse): the gutter is always reserved, so a short page and a long one
   keep the same width and nothing moves sideways when navigating or when the PDF reader locks the scroll. */
@media (min-width: 701px) { html { scrollbar-gutter: stable; } }
.skip-link { position: absolute; top: -100px; left: 20px; z-index: 50; padding: 12px 16px; background: var(--rtz-offwhite); color: var(--rtz-dark); border-radius: var(--rtz-radius); }
.skip-link:focus { top: 10px; }

/* Public header (site V4): logo, hairline, « Espace client » link and « Contact » pill. */
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 82px; padding: 0 var(--rtz-gutter); background: var(--rtz-offwhite); border-bottom: 1px solid var(--rtz-line); }
.site-wordmark { display: flex; align-items: center; width: 112px; min-height: var(--rtz-target); flex: none; }
.site-wordmark img { width: 100%; height: auto; }
.site-header-actions { display: flex; align-items: center; gap: 22px; }
.site-header-link { display: inline-flex; align-items: center; min-height: var(--rtz-target); font-size: var(--rtz-fs-label); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; text-decoration: none; color: var(--rtz-dark); }
.site-header-link:hover { text-decoration: underline; text-underline-offset: 5px; }
.site-header-contact { display: inline-flex; align-items: center; min-height: var(--rtz-target); padding: 0 18px; border-radius: var(--rtz-pill); background: var(--rtz-dark); color: var(--rtz-on-dark); font-size: var(--rtz-fs-label); font-weight: 800; letter-spacing: .07em; text-transform: uppercase; text-decoration: none; }
@media (hover: hover) { .site-header-contact:hover { background: var(--rtz-dark-hover); } }
/* Site menu (same as the one-page site): button in the header, full-screen sheet on the off-white ground. */
.site-menu-button, .site-menu-close { display: inline-flex; align-items: center; gap: 8px; min-height: var(--rtz-target); padding: 0 2px; border: 0; background: none; color: var(--rtz-dark); font: 700 var(--rtz-fs-label)/1 var(--rtz-font-body); letter-spacing: .04em; text-transform: uppercase; cursor: pointer; }
.site-menu-close span { font-size: 24px; font-weight: 400; }
.site-menu { position: fixed; inset: 0; z-index: 80; display: flex; flex-direction: column; overflow-y: auto; padding: 0 var(--rtz-gutter) calc(28px + env(safe-area-inset-bottom)); background: var(--rtz-offwhite); color: var(--rtz-dark); }
.site-menu[hidden] { display: none; }
.site-menu-bar { display: flex; flex: none; align-items: center; justify-content: space-between; height: 82px; border-bottom: 1px solid var(--rtz-line); }
.site-menu ul { margin: 0; padding: 24px 0; list-style: none; }
.site-menu nav a { display: block; padding: 6px 0; font: 500 clamp(34px, 5vw, 56px)/1.12 var(--rtz-font-display); letter-spacing: -.04em; color: var(--rtz-dark); text-decoration: none; }
.site-menu nav a:hover, .site-menu nav a[aria-current] { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 8px; }
.site-menu-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 22px; margin-top: auto; padding-top: 22px; border-top: 1px solid var(--rtz-line); }
.site-menu-actions .site-header-link { display: inline-flex; }
@media (max-width: 820px) { .site-menu-button-label { display: none; } .site-menu-bar { height: 66px; } }

/* Public footer (site V4): the one dark ground, solid off-white and warm-grey text. */
.site-footer { display: grid; grid-template-columns: 1fr 1fr 1fr; align-items: start; gap: 24px 5vw; padding: 55px var(--rtz-gutter) 35px; background: var(--rtz-dark); color: var(--rtz-on-dark); font-size: var(--rtz-fs-caption); }
.site-footer-logo { display: block; width: 200px; max-width: 100%; }
.site-footer-logo img { width: 100%; height: auto; }
.site-footer-details { display: grid; gap: 14px; }
.site-footer-details p { color: var(--rtz-on-dark-2); }
.site-footer address { font-size: .875rem; font-style: normal; line-height: 1.6; }
.site-footer-links { display: flex; flex-direction: column; }
.site-footer-links a { display: flex; align-items: center; min-height: 32px; text-decoration: none; }
.site-footer-links a:hover { text-decoration: underline; }
.site-footer small { grid-column: 1 / -1; padding-top: 23px; border-top: 1px solid var(--rtz-dark-line); color: var(--rtz-on-dark-2); font-size: var(--rtz-fs-caption); line-height: 2; }
.site-footer small a { color: var(--rtz-on-dark-2); text-decoration: underline; text-underline-offset: 3px; }
.site-footer :focus-visible { outline-color: var(--rtz-on-dark); }

/* Layout */
/* Public pages: the footer stays at the bottom of short pages (sign-in, errors). */
body.site-shell { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.site-shell > .portal-frame, .site-shell > main { flex: 1 0 auto; width: 100%; margin-inline: auto; }
.site-shell > main { margin-block: 0; }
.portal-frame { max-width: 1500px; margin: auto; }
.portal-main { width: 100%; min-width: 0; max-width: 1200px; min-height: 60vh; margin: auto; padding: clamp(32px, 5vw, 64px) var(--rtz-gutter) clamp(56px, 7vw, 96px); }
.admin-shell .portal-frame { display: grid; grid-template-columns: 210px minmax(0, 1fr); }
.admin-shell .portal-main { padding: 38px 3vw 80px; }
.admin-nav { padding: 38px 24px; border-right: 1px solid var(--line); }
.admin-nav nav { display: grid; gap: 5px; }
.admin-nav a { padding: 10px 12px; border-radius: var(--rtz-radius); text-decoration: none; font-size: .92rem; }
.admin-nav a[aria-current], .admin-nav a:hover { background: var(--soft); }
.nav-label, .eyebrow { font-size: var(--rtz-fs-caption); letter-spacing: .035em; color: var(--muted); margin-bottom: 12px; }
.portal-footer { display: flex; flex-wrap: wrap; gap: 12px 25px; padding: 28px var(--rtz-gutter); border-top: 1px solid var(--line); font-size: var(--rtz-fs-caption); color: var(--muted); }
.page-heading { display: grid; gap: 14px; margin-bottom: 35px; }
.page-heading > p { max-width: 750px; }
.with-action { display: flex; align-items: center; justify-content: space-between; gap: 25px; }
.with-action > div { display: grid; gap: 10px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 20px; }
.section-heading > span { font-size: .87rem; color: var(--muted); }

/* Buttons (site V4): primary = solid dark pill, secondary = dark outline pill, tertiary = text link. */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; max-width: 100%; min-height: 50px; padding: 0 22px; border: 1px solid var(--rtz-dark); border-radius: var(--rtz-pill); background: var(--rtz-dark); color: var(--rtz-on-dark); font-size: var(--rtz-fs-label); font-weight: 800; line-height: 1.3; letter-spacing: var(--rtz-tracking-caps); text-transform: uppercase; text-align: center; text-decoration: none; cursor: pointer; }
.button.secondary { background: transparent; color: var(--rtz-dark); border-color: var(--rtz-dark); }
@media (hover: hover) {
  .button:hover { background: var(--rtz-dark-hover); border-color: var(--rtz-dark-hover); }
  .button.secondary:hover { background: var(--rtz-dark); border-color: var(--rtz-dark); color: var(--rtz-on-dark); }
}
.button:disabled { cursor: wait; opacity: .65; }
.link-button { min-height: var(--rtz-target); padding: 6px; border: 0; background: none; color: inherit; text-decoration: underline; cursor: pointer; }
.text-link { display: inline-flex; align-items: center; min-height: var(--rtz-target); font-size: .92rem; font-weight: 600; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 5px; }
.site-shell .button .app-icon { width: 16px; height: 16px; }
.site-shell .eyebrow { font-size: var(--rtz-fs-label); font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.action-row, .row-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 15px; }
.action-row { margin-top: 22px; }

/* Feedback */
.help, small, .optional { font-size: .86rem; color: var(--muted); }
.help { margin-top: 15px; }
.notice { margin-bottom: 26px; padding: 18px 22px; border: 1px solid var(--line); border-left: 3px solid var(--rtz-dark); border-radius: var(--rtz-radius); background: var(--rtz-cream); }
.notice.success { border-left-color: var(--tone-done-ink); }
.notice.error { border-left-color: var(--tone-danger-ink); }
.notice ul { margin-bottom: 0; padding-left: 22px; }
.notice h2 { margin-bottom: 8px; }
.status { padding: 4px 10px; border-radius: var(--rtz-pill); background: var(--soft); font-size: .8rem; white-space: nowrap; }
.copy-row { display: flex; gap: 12px; margin-top: 16px; }
.copy-row input { flex: 1; min-width: 0; }

/* Forms */
.stack { display: grid; gap: 21px; }
.stack label:not(.check) { display: grid; gap: 8px; font-size: .93rem; font-weight: 600; }
.stack > .button { justify-self: start; }
input:not([type=checkbox], [type=radio]), textarea, select { width: 100%; min-width: 0; min-height: 46px; padding: 12px; border: 1px solid var(--rtz-field-border); border-radius: var(--rtz-radius); background: var(--rtz-white); color: var(--ink); font-size: 1rem; font-weight: 400; }
textarea { resize: vertical; line-height: 1.6; }
.check { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px; font-size: .91rem; }
.check input { flex: none; width: 19px; height: 19px; margin: 3px 0; accent-color: var(--rtz-dark); }
.check a { display: inline; }
.check > span { flex: 1; min-width: 0; }
fieldset { min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: var(--rtz-radius); }
legend { padding: 0 7px; }
fieldset > .check { margin-bottom: 10px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.form-panel { max-width: 840px; padding: 30px; border-radius: var(--rtz-radius); background: var(--rtz-cream); }
.form-panel > h2 { margin-bottom: 25px; }
.panel { display: grid; gap: 14px; padding: 28px 0; border-bottom: 1px solid var(--line); }
.secret-key { display: block; margin: 20px 0; padding: 20px; border-radius: var(--rtz-radius); background: var(--soft); font-size: 1.1rem; overflow-wrap: anywhere; }
.captcha-field { max-width: 100%; min-height: 74px; --altcha-border-color: var(--rtz-field-border); --altcha-border-radius: var(--rtz-radius); --altcha-color-base: var(--rtz-white); --altcha-color-text: var(--rtz-ink); --altcha-color-primary: var(--rtz-dark); }
/* Room of the drawn widget (74 px, 86 px when its label wraps on the narrowest phones): no jump when it appears. */
@media (max-width: 339px) { .captcha-field { min-height: 86px; } }
.captcha-field :is(.altcha-footer, .altcha-logo) { opacity: 1; color: var(--rtz-muted); } /* solid colours: no faded footer */

/* Lists and records */
.record-list { border-top: 1px solid var(--line); }
.record-row { display: flex; align-items: center; gap: 20px; padding: 24px 0; border-bottom: 1px solid var(--line); }
.record-row > div:first-child { flex: 1; min-width: 0; }
.record-row h2 { margin-bottom: 7px; font-size: 1.2rem; }
.record-row p { font-size: .93rem; }
.empty-state { display: grid; gap: 12px; grid-column: 1 / -1; padding: 40px 28px; border-radius: var(--rtz-radius); background: var(--soft); }
.empty-state h2, .empty-state h3 { font-size: 1.4rem; }
.empty-state p { max-width: 650px; }
.section-nav, .tag-list { display: flex; flex-wrap: wrap; gap: 10px; margin: 25px 0 35px; }
.section-nav a, .tag-list a { display: inline-flex; align-items: center; min-height: var(--rtz-target); padding: 0 16px; border: 1px solid var(--line); border-radius: var(--rtz-pill); text-decoration: none; }
.tag-list a[aria-current] { background: var(--rtz-dark); border-color: var(--rtz-dark); color: var(--rtz-on-dark); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; font-size: .78rem; color: var(--muted); }
.tags span { padding: 3px 10px; border-radius: var(--rtz-pill); background: var(--soft); }
.video-player { display: grid; place-items: center; aspect-ratio: 16 / 9; overflow: hidden; border-radius: var(--rtz-radius); background: var(--soft); }
.video-player iframe { width: 100%; height: 100%; border: 0; }
.workspace-tools { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.workspace-tool { display: flex; align-items: center; gap: 16px; min-width: 0; padding: 22px; border: 1px solid var(--line); border-radius: var(--rtz-radius); background: var(--rtz-offwhite); text-decoration: none; }
.workspace-tool > div { display: grid; gap: 6px; min-width: 0; }
.workspace-tool svg { flex: none; color: var(--muted); }
.workspace-tool h2, .workspace-tool h3 { margin: 0; font-size: 1rem; }
.workspace-tool p { margin: 0; font-size: .875rem; line-height: 1.5; color: var(--muted); }
.feedback-editor { padding: 20px 0; border-top: 1px solid var(--line); }
.feedback-editor summary { display: flex; justify-content: space-between; gap: 20px; min-height: var(--rtz-target); cursor: pointer; }
.feedback-editor summary span { font-size: .83rem; color: var(--muted); }
.feedback-editor form { max-width: 760px; padding: 15px 0; }
.message-card { margin-bottom: 24px; padding: 28px; border: 1px solid var(--line); border-radius: var(--rtz-radius); background: var(--rtz-offwhite); }
.message-card > .plain-text { margin-top: 20px; }
.pagination { display: flex; justify-content: space-between; gap: 18px; margin-top: 35px; font-size: .88rem; }

/* Reading pages: legal texts, articles, install guide */
.reading { max-width: 790px; margin: auto; }
.reading h1 { margin: 25px 0; }
.reading .lead { margin-bottom: 32px; font-size: var(--rtz-fs-lead); color: var(--muted); }
.reading ol { padding-inline-start: 22px; }
.reading ol li { margin-block-end: 10px; }
.reading section { margin-block-start: 32px; }
.plain-text { white-space: pre-wrap; overflow-wrap: anywhere; }
article.prose { max-width: 790px; margin-inline: auto; }
.prose { overflow-wrap: anywhere; }
.prose > h1 { margin-bottom: 24px; }
.prose h2 { margin: 40px 0 14px; }
.prose h3 { margin: 26px 0 12px; }
.prose p { margin-bottom: 18px; }
.prose ul { padding-left: 25px; }
.prose li { margin-bottom: 10px; }
.prose blockquote { margin: 26px 0; padding: 2px 0 2px 18px; border-left: 2px solid var(--line); color: var(--muted); }
.prose img { height: auto; margin: 26px 0; border-radius: var(--rtz-radius); }
.prose hr { margin: 36px 0; border: 0; border-top: 1px solid var(--line); }
.prose a { padding-block: 11px; } /* taller hit area for links, no layout change (inline) */
.prose table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.prose td, .prose th { padding: 12px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.prose td:first-child { width: 35%; }
.conditions-text { white-space: pre-line; line-height: 1.75; overflow-wrap: anywhere; }
.article-list article { padding: 30px 0; border-bottom: 1px solid var(--line); }
.article-list article h2, .article-list article h3 { margin: 0 0 2px; }
.article-list article h2 a, .article-list article h3 a { display: inline-block; padding-block: 10px; text-decoration: none; }
.article-related { margin-block-start: 56px; padding-block-start: 32px; border-top: 1px solid var(--line); }
.article-related .article-list article { padding: 18px 0; }
.article-list time { font-size: var(--rtz-fs-caption); color: var(--muted); }

@media (max-width: 1100px) {
  .admin-shell .portal-frame { grid-template-columns: 190px minmax(0, 1fr); }
  .admin-nav { padding: 30px 12px; }
}
@media (max-width: 820px) {
  .site-header { min-height: 66px; gap: 12px; }
  .site-wordmark { width: 104px; }
  .site-header-actions { gap: 16px; }
  .site-footer { grid-template-columns: minmax(0, 1fr); gap: 24px; padding: 40px var(--rtz-gutter) 36px; }
  .site-footer-logo { width: 160px; }
  .site-footer-links a { min-height: var(--rtz-target); }
}
@media (max-width: 800px) {
  .admin-shell .portal-frame { display: block; }
  .admin-nav { padding: 15px 20px; border-right: 0; border-bottom: 1px solid var(--line); }
  .admin-nav .nav-label { display: none; }
  .admin-nav nav { display: flex; flex-wrap: wrap; gap: 3px; }
  .admin-nav a { padding: 8px 10px; font-size: .84rem; }
  .admin-shell .portal-main { padding: 30px 20px 50px; }
  .with-action { flex-direction: column; align-items: flex-start; }
  .form-panel { padding: 24px; }
  .record-row { flex-wrap: wrap; gap: 12px; }
  .record-row > div:first-child { flex-basis: 65%; }
  .record-row .row-actions { width: 100%; }
  .workspace-tools { gap: 12px; }
}
@media (max-width: 520px) {
  .workspace-tools { grid-template-columns: 1fr; }
  .workspace-tool { padding: 18px; }
  .admin-shell .portal-main { padding-inline: 18px; }
}
@media (max-width: 480px) {
  .field-row { grid-template-columns: 1fr; }
  .copy-row { flex-direction: column; }
  .video-player { aspect-ratio: auto; min-height: 300px; }
  .video-player:has(iframe) { aspect-ratio: 16 / 9; min-height: 0; }
  .form-panel { padding: 20px 16px; }
  .section-heading { align-items: flex-start; }
  .message-card { padding: 22px 16px; }
}
/* Very narrow phones: the « Espace client » link stays in the footer, the Contact pill stays here. */
@media (max-width: 379px) {
  .site-wordmark { width: 92px; }
  .site-header-link { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
