/* RefAgent — composants de l'interface. Toutes les valeurs viennent de tokens.css (tokens.json).
   Préfixe sc-. Angles vifs, aucune ombre, aucun pictogramme : les mots portent le sens. */

.sc-app { background: var(--surface); color: var(--ink); font-family: var(--font-text); font-size: 14px; line-height: 1.45; }
.sc-app *, .sc-app *::before, .sc-app *::after { box-sizing: border-box; }
.sc-app :focus-visible { outline: var(--stroke-strong) solid var(--focus); outline-offset: 2px; }

/* ---------- AppBar ---------- */
.sc-appbar { display: flex; align-items: center; gap: var(--space-6); height: var(--appbar-height); padding: 0 var(--space-4); background: var(--band); color: var(--on-band-alt); }
.sc-appbar__name { font-family: var(--font-display); font-weight: 600; font-size: 20px; letter-spacing: 0.02em; color: var(--on-band); white-space: nowrap; text-decoration: none; }
.sc-appbar__logo { display: block; flex: none; line-height: 0; }
.sc-appbar__logo img { display: block; height: 20px; width: auto; }
.sc-appbar__space { font-family: var(--font-display); font-weight: 500; font-size: 14px; color: var(--on-band-alt); white-space: nowrap; }
.sc-appbar__search { flex: 1; max-width: 480px; margin-left: auto; }
.sc-appbar__search input { width: 100%; height: 36px; padding: 0 var(--space-3); border: var(--stroke-hairline) solid var(--rule); border-radius: var(--radius-none); background: var(--band-field); color: var(--on-band-alt); font: inherit; font-size: 14px; }
.sc-appbar__search input::placeholder { color: #b0b0b0; }
.sc-appbar__user { font-size: 14px; color: var(--on-band-alt); white-space: nowrap; }
.sc-appbar a { color: var(--on-band); }

/* ---------- Sidebar ---------- */
.sc-sidebar { width: var(--sidebar-width); background: var(--surface-alt); border-right: var(--stroke-hairline) solid var(--border); padding: var(--space-4) 0; font-size: 14px; }
.sc-sidebar__label { font-family: var(--font-display); font-weight: 600; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-muted); padding: 0 var(--space-4); margin: var(--space-4) 0 var(--space-2); }
.sc-sidebar__label:first-child { margin-top: 0; }
.sc-nav { list-style: none; margin: 0; padding: 0; }
.sc-nav .sc-nav { margin: 0; }
.sc-nav a { display: flex; justify-content: space-between; gap: var(--space-2); padding: 6px var(--space-4); color: var(--ink); text-decoration: none; }
.sc-nav .sc-nav a { padding-left: calc(var(--space-4) * 2); }
.sc-nav .sc-nav .sc-nav a { padding-left: calc(var(--space-4) * 3); }
.sc-nav a:hover { background: var(--accent-tint); }
.sc-nav a[aria-current="page"] { background: var(--accent-tint); font-weight: 700; }
.sc-nav__count { font-size: 12px; font-weight: 700; color: var(--ink); }

/* ---------- Button ---------- */
.sc-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 0 var(--space-4); border: var(--stroke-hairline) solid transparent; border-radius: var(--radius-none); font-family: var(--font-display); font-weight: 500; font-size: 14px; line-height: 1; cursor: pointer; text-decoration: none; white-space: nowrap; }
.sc-btn--primary { background: var(--accent); color: var(--on-accent); }
.sc-btn--primary:hover { background: var(--accent-hover); }
.sc-btn--secondary { background: var(--surface); color: var(--ink); border-color: var(--rule); }
.sc-btn--secondary:hover { background: var(--surface-alt); }
.sc-btn--danger { background: var(--surface); color: var(--danger); border-color: var(--danger); }
.sc-btn--danger:hover { background: var(--callout-risk-bg); }
.sc-btn--link { background: none; color: var(--link); padding: 0; min-height: 0; text-decoration: underline; }
.sc-btn[disabled], .sc-btn[aria-disabled="true"] { background: var(--surface-alt); color: var(--ink-muted); border-color: var(--border); cursor: not-allowed; }
.sc-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }

/* ---------- StatusTag ---------- */
.sc-status { display: inline-flex; align-items: center; padding: 3px 8px; border: var(--stroke-hairline) solid currentColor; border-radius: var(--radius-none); background: var(--surface); font-family: var(--font-text); font-size: 12px; font-weight: 700; line-height: 1.2; white-space: nowrap; }
.sc-status--draft { color: var(--status-draft); }
.sc-status--proposed { color: var(--status-proposed); }
.sc-status--validated { color: var(--status-validated); }
.sc-status--to_review { color: var(--status-to-review); }
.sc-status--obsolete { color: var(--status-obsolete); border-style: dashed; }

/* ---------- AuthorTag ---------- */
.sc-author { display: inline-flex; align-items: center; padding: 3px 8px; border: var(--stroke-hairline) solid var(--border); border-radius: var(--radius-none); background: var(--surface); color: var(--ink); font-size: 12px; line-height: 1.2; white-space: nowrap; text-decoration: none; }
a.sc-author:hover { border-color: var(--rule); }
.sc-author--agent { background: var(--band); border-color: var(--band); color: var(--on-band); font-family: var(--font-mono); }

/* ---------- PropertiesPanel ---------- */
.sc-props { display: grid; grid-template-columns: minmax(0, 180px) minmax(0, 1fr); margin: 0; border-top: var(--stroke-hairline) solid var(--border); font-size: 14px; }
.sc-props dt, .sc-props dd { margin: 0; padding: var(--space-2) 0; border-bottom: var(--stroke-hairline) solid var(--border); }
.sc-props dt { color: var(--ink-muted); padding-right: var(--space-3); }
.sc-props dd { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-2); align-items: center; }
.sc-props__late { color: var(--status-to-review); font-weight: 700; }
.sc-props__raw { margin-top: var(--space-3); }
.sc-props__raw summary { cursor: pointer; color: var(--link); text-decoration: underline; }

/* ---------- Field ---------- */
.sc-field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.sc-field > label { font-weight: 700; color: var(--ink); }
.sc-input, .sc-select, .sc-textarea { width: 100%; min-height: 40px; padding: 8px var(--space-3); border: var(--stroke-hairline) solid var(--rule); border-radius: var(--radius-none); background: var(--surface); color: var(--ink); font: inherit; font-size: 16px; }
.sc-textarea { min-height: 120px; font-family: var(--font-mono); font-size: 13px; line-height: 1.5; }
.sc-field__hint { font-size: 12px; color: var(--ink-muted); }
.sc-field--error .sc-input { border-color: var(--danger); border-width: var(--stroke-strong); }
.sc-field__error { font-size: 12px; font-weight: 700; color: var(--danger); }
.sc-check { display: flex; gap: var(--space-2); align-items: flex-start; font-size: 14px; }
.sc-check input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--accent); }
.sc-code-input { letter-spacing: 0.3em; font-family: var(--font-mono); font-size: 20px; text-align: center; }

/* ---------- Notice ---------- */
.sc-notice { padding: var(--space-3) var(--space-4); border-radius: var(--radius-none); color: var(--ink); font-size: 14px; }
.sc-notice__title { margin: 0 0 var(--space-1); font-weight: 700; }
.sc-notice p { margin: 0; }
.sc-notice .sc-actions { margin-top: var(--space-3); }
.sc-notice--info { background: var(--surface-alt); }
.sc-notice--next { background: var(--callout-next-bg); }
.sc-notice--risk { background: var(--callout-risk-bg); }
.sc-notice--risk .sc-notice__title { color: var(--status-to-review); }

/* ---------- ListTable ---------- */
.sc-table { width: 100%; border-collapse: collapse; font-size: 14px; color: var(--ink); }
.sc-table th { padding: var(--space-2) var(--space-3); border-bottom: var(--stroke-strong) solid var(--ink); text-align: left; font-family: var(--font-display); font-weight: 600; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-muted); white-space: nowrap; }
.sc-table td { padding: 10px var(--space-3); border-bottom: var(--stroke-hairline) solid var(--border); vertical-align: top; }
.sc-table tbody tr:hover td { background: var(--surface-alt); }
.sc-table a { color: var(--link); }
.sc-table__meta { display: block; font-size: 12px; color: var(--ink-muted); }
.sc-table .sc-num { text-align: right; white-space: nowrap; }

/* ---------- Content (rendu du markdown d'une page) ---------- */
.sc-content { max-width: var(--content-width); font-size: 16px; line-height: 1.55; color: var(--ink); }
.sc-content > :first-child { margin-top: 0; }
.sc-content h2 { margin: var(--space-8) 0 var(--space-3); font-family: var(--font-display); font-weight: 600; font-size: 22px; line-height: 1.3; color: var(--heading); }
.sc-content h3 { margin: var(--space-6) 0 var(--space-2); font-family: var(--font-display); font-weight: 600; font-size: 18px; line-height: 1.35; color: var(--ink); }
.sc-content p, .sc-content ul, .sc-content ol, .sc-content table, .sc-content pre, .sc-content blockquote { margin: 0 0 var(--space-4); }
.sc-content a { color: var(--link); }
.sc-content a.sc-wikilink--missing { color: var(--status-to-review); text-decoration-style: dashed; }
.sc-content code { font-family: var(--font-mono); font-size: 13px; background: var(--surface-alt); padding: 1px 4px; overflow-wrap: anywhere; }
.sc-content pre { padding: var(--space-3) var(--space-4); background: var(--surface-alt); overflow-x: auto; }
.sc-content pre code { padding: 0; background: none; }
.sc-content blockquote { padding: var(--space-3) var(--space-4); background: var(--surface-alt); }
.sc-content blockquote p:last-child { margin-bottom: 0; }
.sc-content table { width: 100%; border-collapse: collapse; font-size: 14px; }
.sc-content th, .sc-content td { padding: var(--space-2) var(--space-3); border: var(--stroke-hairline) solid var(--border); text-align: left; vertical-align: top; }
.sc-content th { background: var(--surface-alt); font-weight: 700; }
.sc-content ul.contains-task-list { list-style: none; padding-left: 0; }
.sc-content ul.contains-task-list input { accent-color: var(--accent); margin-right: var(--space-2); }

/* ---------- Diff (liste de revue) ---------- */
.sc-diff { font-family: var(--font-mono); font-size: 13px; line-height: 1.5; }
.sc-diff__line { display: block; padding: 0 var(--space-3); white-space: pre-wrap; }
.sc-diff__line--add { background: var(--callout-next-bg); }
.sc-diff__line--del { background: var(--callout-risk-bg); }
.sc-diff__line--add::before { content: "+ "; }
.sc-diff__line--del::before { content: "− "; }

/* ---------- Mise en page ---------- */
.sc-layout { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: calc(100vh - var(--appbar-height)); }
.sc-main { padding: var(--space-8); }
.sc-page-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-4); align-items: flex-start; margin-bottom: var(--space-6); }
.sc-page-title { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 30px; line-height: 1.2; color: var(--ink); }
.sc-breadcrumb { margin: 0 0 var(--space-2); font-size: 12px; color: var(--ink-muted); }
.sc-breadcrumb a { color: var(--ink-muted); }
