/* Atelier — thème « Obsidienne & menthe » (SPEC §10). Mêmes jetons que Theme/AtelierTheme.cs : garder les deux alignés. */

:root {
  --bg: #0b1220;
  --nav: #08101c;
  --nav-border: #1a2540;
  --surface: #111a2e;
  --surface-2: #16213a;
  --surface-3: #1d2a46;
  --border: #22304d;
  --border-strong: #2b3b5c;
  --hairline: #1c2944;
  --text: #dbe7f5;
  --muted: #93a4bd;
  --faint: #5d6f8c;
  --accent: #2dd4bf;
  --accent-hover: #5eead4;
  --accent-ink: #04201c;
  --accent-soft: rgba(45, 212, 191, 0.12);
  --attente: #f5b454;
  --attente-soft: rgba(245, 180, 84, 0.12);
  --erreur: #f87171;
  --erreur-soft: rgba(248, 113, 113, 0.12);
  --diff-add: #5eead4;
  --diff-del: #fca5a5;
  --radius: 8px;
  --radius-sm: 6px;
  --font: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --nav-width: 232px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color-scheme: dark;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

h1:focus {
  outline: none;
}

code {
  font-family: var(--mono);
}

.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.muted {
  color: var(--muted);
}

.skip-link {
  position: absolute;
  left: 8px;
  top: -60px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}

.skip-link:focus {
  top: 8px;
}

/* ---------- Coque : navigation latérale + contenu ---------- */

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--nav-width) minmax(0, 1fr);
}

.topbar {
  display: none;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 20px 12px 16px;
  background: var(--nav);
  border-right: 1px solid var(--nav-border);
  overflow-y: auto;
}

.sidebar-brand {
  padding: 0 6px 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--text);
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--accent-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
}

.brand-name {
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.01em;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-weight: 500;
}

.nav-item:hover {
  color: var(--text);
  background: var(--surface);
  text-decoration: none;
}

.nav-item.active {
  color: var(--text);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--border);
}

.nav-item.active .icon {
  color: var(--accent);
}

.user-panel {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding: 12px 4px 0 8px;
  border-top: 1px solid var(--nav-border);
}

.user-panel form {
  margin: 0;
}

.user-switch {
  margin-top: 16px;
}

.avatar {
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
}

.user-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 13px;
}

.icon-btn {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.icon-btn:hover {
  color: var(--text);
  background: var(--surface);
}

.content {
  width: 100%;
  max-width: 1360px;
  min-width: 0;
  padding: 32px 40px 56px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.content:focus {
  outline: none;
}

.authorizing {
  padding: 40px;
  color: var(--muted);
}

/* ---------- En-tête de page ---------- */

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.page-heading {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.eyebrow {
  color: var(--muted);
  font-size: 13px;
}

.page-header h1 {
  margin: 0;
  font-weight: 600;
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.page-description {
  margin: 4px 0 0;
  max-width: 68ch;
  color: var(--muted);
}

.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.page-actions .mud-button-root {
  min-height: 44px;
  padding-inline: 16px;
}

/* A form that is only a button (the cockpit's way into a client's space): it sits in its row as the button alone. */
.inline-form {
  display: contents;
}

/* ---------- Cartes, panneaux, indicateurs ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.panel {
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding: 10px 20px;
}

.panel-title {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
}

.panel-body {
  border-top: 1px solid var(--hairline);
}

.panel-body > .muted {
  margin: 0;
  padding: 16px 20px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 14px;
}

.stat-tile {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.stat-figure {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}

.stat-value {
  font-size: 34px;
  font-weight: 500;
  line-height: 1;
}

.stat-suffix,
.stat-hint {
  color: var(--muted);
}

.stat-hint {
  font-size: 13px;
}

.tone-accent {
  color: var(--accent);
}

.tone-attente {
  color: var(--attente);
}

.tone-erreur {
  color: var(--erreur);
}

.gauge {
  height: 6px;
  border-radius: 1px;
  background: #23314f;
  overflow: hidden;
}

.gauge > span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.split {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 14px;
}

.split-main {
  flex: 2 1 520px;
  min-width: 0;
}

.split-side {
  flex: 1 1 300px;
  min-width: 0;
}

/* Page « Supervision » (M8): the summary line, green when all is well, red otherwise. */
.supervision-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 12px;
  margin-bottom: 14px;
  padding: 14px 20px;
  border-left: 3px solid var(--accent);
}

.supervision-summary.is-alert {
  border-left-color: var(--erreur);
  background: var(--erreur-soft);
}

.supervision-summary .muted {
  margin-left: auto;
  font-size: 12px;
}

.supervision-url {
  font-size: 12px;
  overflow-wrap: anywhere;
}

/* ---------- Étiquettes ---------- */

.tag {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--muted);
  white-space: nowrap;
}

.tag-accent {
  color: var(--accent);
  background: var(--accent-soft);
}

.tag-attente {
  color: var(--attente);
  background: var(--attente-soft);
}

.tag-erreur {
  color: var(--erreur);
  background: var(--erreur-soft);
}

/* ---------- États vides ---------- */

.empty-state {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 32px 28px;
}

.empty-state-compact {
  padding: 20px;
}

.soon .empty-state {
  padding: 40px 32px;
}

.empty-icon {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.empty-state-compact .empty-icon {
  width: 36px;
  height: 36px;
}

.empty-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
}

.empty-title {
  margin: 0;
  font-weight: 600;
}

.empty-text {
  margin: 0;
  max-width: 64ch;
  color: var(--muted);
}

/* ---------- Listes de contrôle (Réglages) ---------- */

.check-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.check-list li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-top: 1px solid var(--hairline);
}

.check-list li:first-child {
  border-top: 0;
}

.check-icon {
  display: inline-flex;
  color: var(--muted);
}

/* « Équipe » (M8): one row per operator, their role and state, then what an administrator may change. */
.team-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.team-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  padding: 14px 20px;
  border-top: 1px solid var(--hairline);
}

.team-row:first-child {
  border-top: 0;
}

.team-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.team-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
}

.check-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.check-title {
  font-weight: 500;
}

.check-meta {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.check-duration {
  font-size: 12px;
}

/* ---------- Boutons (pages statiques) ---------- */

.btn {
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  min-height: 44px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
}

.btn:hover {
  background: var(--surface-2);
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-block {
  width: 100%;
}

/* ---------- Pages de compte ---------- */

.auth-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 32px 16px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.auth-brand {
  margin-bottom: 4px;
}

.auth-title {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.auth-subtitle,
.auth-meta,
.auth-links,
.auth-footnote {
  margin: 0;
  color: var(--muted);
}

.auth-meta,
.auth-links,
.auth-footnote {
  font-size: 13px;
}

.auth-links {
  text-align: center;
}

/* The way in by Firebase (ADR-029): Google, then an address and a password. */
.auth-firebase {
  display: grid;
  gap: 14px;
}

.auth-firebase .field-error:empty,
.auth-firebase .auth-info:empty {
  display: none;
}

.auth-google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.auth-firebase-more {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
}

/* A button that reads as a link: the secondary ways (create a password, forgot it). */
.auth-link {
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.auth-info {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

/* « ou », between two lines. */
.auth-or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.auth-or::before,
.auth-or::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--border);
}

.auth-alert {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--erreur-soft);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: #fecaca;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  font: inherit;
  font-size: 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
}

.input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.input.invalid {
  border-color: var(--erreur);
}

.input-code {
  font-size: 22px;
  letter-spacing: 0.3em;
  text-align: center;
}

.field-error,
.validation-message {
  color: var(--erreur);
  font-size: 13px;
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--muted);
  cursor: pointer;
}

.check input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.auth-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: step;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.auth-steps > li {
  counter-increment: step;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--hairline);
}

.step-title {
  font-weight: 600;
}

.step-title::before {
  content: counter(step) ". ";
  color: var(--accent);
  font-family: var(--mono);
}

.step-meta {
  color: var(--muted);
  font-size: 13px;
}

.qr {
  align-self: center;
  width: 200px;
  height: 200px;
  padding: 8px;
  background: #ffffff;
  border-radius: var(--radius);
}

.qr svg {
  display: block;
  width: 100%;
  height: 100%;
}

.secret-key {
  display: block;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 15px;
  letter-spacing: 0.04em;
  text-align: center;
  overflow-wrap: anywhere;
  user-select: all;
}

.recovery-codes {
  margin: 0;
  padding: 14px 16px 14px 40px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 24px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 14px;
}

/* ---------- Catalogues, listes, tableaux ---------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.card-link {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 20px;
  color: var(--text);
  transition: border-color 120ms ease, background-color 120ms ease;
}

.card-link:hover {
  border-color: var(--border-strong);
  background: #13203a;
  text-decoration: none;
}

.card-link.is-archived {
  opacity: 0.6;
}

.card-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.card-text {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.section-title {
  margin: 8px 0 0;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.table-wrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th {
  padding: 12px 20px;
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  border-bottom: 1px solid var(--hairline);
  white-space: nowrap;
}

.table td {
  padding: 12px 20px;
  border-top: 1px solid var(--hairline);
  vertical-align: top;
}

.table tr:first-child td {
  border-top: 0;
}

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}

.link-button:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.toolbar > * {
  flex: 0 1 190px;
  min-width: 150px;
}

.toolbar > .toolbar-search {
  flex: 1 1 280px;
  max-width: 440px;
}

.toolbar > .mud-switch,
.toolbar > label {
  flex: 0 0 auto;
  min-width: 0;
}

/* The board uses the whole width of large screens; other pages keep a comfortable reading width. */
.content:has(.kanban) {
  max-width: none;
}

.form-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.form-hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.form-error {
  margin: 0;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--erreur-soft);
  color: #fecaca;
}

.mono-input textarea,
.mono-input input {
  font-family: var(--mono) !important;
  font-size: 13px !important;
}

.prose-text {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.6;
}

.meta-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 16px;
  margin: 0;
  padding: 16px 20px;
  font-size: 13px;
}

.meta-list dt {
  color: var(--muted);
}

.meta-list dd {
  margin: 0;
  overflow-wrap: anywhere;
}

/* ---------- Diff de versions ---------- */

.diff {
  margin: 0;
  padding: 8px 0;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.55;
  overflow-x: auto;
}

.diff-line {
  display: flex;
  gap: 12px;
  padding: 0 16px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.diff-sign {
  flex: 0 0 12px;
  color: var(--faint);
  user-select: none;
}

.diff-added {
  background: rgba(94, 234, 212, 0.08);
  color: var(--diff-add);
}

.diff-removed {
  background: rgba(252, 165, 165, 0.08);
  color: var(--diff-del);
}

.diff-skip {
  padding: 2px 16px;
  color: var(--muted);
  font-style: italic;
}

/* ---------- Kanban ---------- */

.kanban {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  overflow-x: auto;
  padding-bottom: 12px;
}

.kanban-column {
  flex: 0 0 286px;
  display: flex;
  flex-direction: column;
  background: var(--nav);
  border: 1px solid var(--nav-border);
  border-radius: var(--radius);
}

.kanban-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--nav-border);
}

.kanban-column-title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
}

.kanban-zone {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 120px;
  padding: 10px;
}

.kanban-zone.can-drop {
  background: rgba(45, 212, 191, 0.05);
  outline: 1px dashed var(--accent);
  outline-offset: -6px;
}

.kanban-zone.no-drop {
  background: var(--erreur-soft);
}

.kanban-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: grab;
}

.kanban-card:hover {
  border-color: var(--border-strong);
  text-decoration: none;
}

.kanban-card-title {
  margin: 0;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.kanban-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.priority-urgent {
  color: var(--erreur);
  background: var(--erreur-soft);
}

.priority-high {
  color: var(--attente);
  background: var(--attente-soft);
}

.trust-external {
  color: #fecaca;
  background: var(--erreur-soft);
}

.mud-drop-item-preview-start {
  border-color: var(--accent) !important;
}

/* ---------- Fil de commentaires ---------- */

.thread {
  list-style: none;
  margin: 0;
  padding: 0;
}

.thread li {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 20px;
  border-top: 1px solid var(--hairline);
}

.thread li:first-child {
  border-top: 0;
}

.thread-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.upload-label {
  cursor: pointer;
}

.upload-label input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

/* ---------- Erreurs Blazor ---------- */

#blazor-error-ui {
  display: none;
  position: fixed;
  left: 50%;
  bottom: 16px;
  z-index: 2000;
  transform: translateX(-50%);
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid rgba(248, 113, 113, 0.4);
  background: #2a0707;
  color: #fecaca;
}

#blazor-error-ui .reload {
  margin-left: 12px;
  color: #ffffff;
}

#blazor-error-ui .dismiss {
  margin-left: 8px;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 18px;
  cursor: pointer;
}

.blazor-error-boundary {
  padding: 1rem;
  border-radius: var(--radius);
  background: var(--erreur-soft);
  color: #fecaca;
}

.blazor-error-boundary::after {
  content: "Une erreur est survenue.";
}

/* ---------- Mobile ---------- */

@media (max-width: 960px) {
  /* The top bar keeps its height on a short page: only the content row takes the rest of the screen. */
  .shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto 1fr;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 10px;
    background: var(--nav);
    border-bottom: 1px solid var(--nav-border);
  }

  .topbar-spacer {
    width: 44px;
  }

  .sidebar {
    display: none;
    position: fixed;
    inset: 57px 0 0 0;
    z-index: 25;
    height: auto;
    border-right: 0;
  }

  .nav-open .sidebar {
    display: flex;
  }

  .sidebar-brand {
    display: none;
  }

  .content {
    padding: 20px 16px 40px;
  }

  .page-header h1 {
    font-size: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ---------- Moteur : bandeaux, pause, compteur du menu (M2c) ---------- */

.stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.banner {
  margin: 0;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-size: 14px;
}

.banner-attente {
  color: var(--attente);
  background: var(--attente-soft);
  border-color: rgba(245, 180, 84, 0.35);
}

.banner-action {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.banner-action p {
  margin: 0;
  flex: 1 1 320px;
}

.sidebar-actions {
  padding: 8px 12px 0;
}

.pause-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.sidebar-actions .pause-toggle {
  width: 100%;
}

.pause-toggle:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.pause-toggle.paused {
  color: var(--attente);
  border-color: rgba(245, 180, 84, 0.45);
  background: var(--attente-soft);
}

.nav-badge {
  margin-left: auto;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 10px;
  background: var(--attente-soft);
  color: var(--attente);
  font-size: 11px;
  text-align: center;
}

/* ---------- Graphe des workflows (SVG rendu côté serveur, ADR-005) ---------- */

.graph-scroll {
  overflow-x: auto;
  padding: 12px;
}

.graph {
  display: block;
  margin: 0 auto;
  width: 100%;
  height: auto;
}

.graph-edge {
  fill: none;
  stroke: var(--border-strong);
  stroke-width: 1.5;
}

.graph-edge.optional {
  stroke-dasharray: 5 4;
}

.graph-arrow {
  fill: var(--border-strong);
}

.graph-node rect {
  fill: var(--surface-2);
  stroke: var(--border-strong);
  stroke-width: 1;
}

.graph-node.type-approval rect {
  stroke-dasharray: 4 3;
}

.graph-label {
  fill: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
}

.graph-detail {
  fill: var(--muted);
  font-family: var(--font);
  font-size: 11px;
}

.graph-node.clickable {
  cursor: pointer;
}

.graph-node.clickable:hover rect,
.graph-node.clickable:focus-visible rect {
  stroke: var(--accent);
}

.graph-node:focus {
  outline: none;
}

.graph-node.selected rect {
  stroke: var(--text);
  stroke-width: 2;
}

.graph-node.status-succeeded rect {
  fill: var(--accent-soft);
  stroke: var(--accent);
}

.graph-node.status-claimed rect,
.graph-node.status-running rect {
  fill: var(--accent-soft);
  stroke: var(--accent);
  stroke-width: 2;
  animation: graph-pulse 1.6s ease-in-out infinite;
}

.graph-node.status-waitingapproval rect,
.graph-node.status-blockedbudget rect {
  fill: var(--attente-soft);
  stroke: var(--attente);
}

.graph-node.status-failed rect,
.graph-node.status-rejected rect {
  fill: var(--erreur-soft);
  stroke: var(--erreur);
}

.graph-node.status-skipped rect,
.graph-node.status-cancelled rect {
  fill: transparent;
  stroke: var(--faint);
  stroke-dasharray: 3 3;
}

.graph-node.status-skipped .graph-label,
.graph-node.status-cancelled .graph-label {
  fill: var(--faint);
}

@keyframes graph-pulse {
  50% {
    stroke-opacity: 0.45;
  }
}

/* ---------- Éditeur de workflow ---------- */

.workflow-editor {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 14px;
  align-items: start;
}

.workflow-editor-source,
.workflow-editor-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.yaml-editor {
  display: flex;
  max-height: 70vh;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--nav);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 20px;
}

.yaml-gutter {
  position: sticky;
  left: 0;
  display: flex;
  flex-direction: column;
  padding: 12px 10px 12px 12px;
  background: var(--nav);
  border-right: 1px solid var(--hairline);
  color: var(--faint);
  text-align: right;
  user-select: none;
  font-variant-numeric: tabular-nums;
}

.yaml-gutter .error {
  color: var(--erreur);
  font-weight: 600;
}

.yaml-text {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 12px;
  border: 0;
  outline: none;
  resize: none;
  overflow: hidden;
  background: transparent;
  color: var(--text);
  font: inherit;
  line-height: inherit;
  white-space: pre;
  tab-size: 2;
}

.yaml-editor:focus-within {
  border-color: var(--accent);
}

.error-list {
  margin: 0;
  padding: 12px 20px;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
}

.error-list li {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.panel-body > .tone-accent {
  margin: 0;
  padding: 16px 20px;
}

.subsection-title {
  margin: 16px 0 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.code-block {
  margin: 8px 0 0;
  padding: 12px;
  max-height: 360px;
  overflow: auto;
  border-radius: var(--radius-sm);
  background: var(--nav);
  border: 1px solid var(--hairline);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

details > summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
}

details > summary:hover {
  color: var(--text);
}

/* ---------- Runs, étapes, validations ---------- */

.table .num {
  text-align: right;
  white-space: nowrap;
}

.step-list {
  margin: 0;
  padding: 6px;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.step-row {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.step-row > span:first-child {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.step-row:hover {
  background: var(--surface-2);
}

.step-row.selected {
  background: var(--surface-2);
  border-color: var(--border);
}

.step-row-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.panel-body > .stack {
  padding: 16px 20px 20px;
}

.panel-body > .stack .meta-list {
  padding: 0;
}

.bullets {
  margin: 4px 0 8px;
  padding-left: 20px;
  font-size: 14px;
}

button.tag {
  border: 0;
  cursor: pointer;
  min-height: 28px;
}

.approval-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 820px;
}

.approval-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px 20px;
  border-color: rgba(245, 180, 84, 0.35);
}

.approval-header {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.approval-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

.approval-result .section-title {
  margin: 0 0 4px;
}

/* What is validated (§6.8): the commit, and the preview to open on a phone. */
.approval-subject {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin: 0;
}

.approval-subject a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.approval-reasons {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
}

.approval-actions .form-actions {
  margin-top: 10px;
}

.approval-actions .mud-button-root {
  min-height: 44px;
}

.approval-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* A choice (§6.8): the proposals side by side, their screenshots, links to the other deliverables. */
.plain-list {
  margin: 0 0 8px;
  padding-left: 18px;
  display: grid;
  gap: 4px;
}

.choice-options {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.choice-option {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}

.choice-option .section-title {
  margin: 0;
}

.choice-option p {
  margin: 0;
}

.choice-swatches {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 6px;
}

.choice-swatches li {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--border);
}

/* An ambiance's page at a third of its computer size (D-3c). */
.choice-apercu {
  width: 100%;
  max-width: 384px;
  height: 240px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #ffffff;
}

.choice-apercu iframe {
  display: block;
  width: 1280px;
  height: 800px;
  border: 0;
  transform: scale(0.3);
  transform-origin: 0 0;
  pointer-events: none;
}

.choice-image {
  display: block;
  width: 100%;
  height: auto;
  max-height: 320px;
  object-fit: cover;
  object-position: top;
  border: 1px solid var(--border);
  border-radius: 6px;
}

/* ---------- Flux d'événements (console, run) ---------- */

.event-feed {
  margin: 0;
  padding: 8px 20px 16px;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 70vh;
  overflow-y: auto;
}

.event {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-left: 12px;
  border-left: 2px solid var(--border);
  font-size: 14px;
}

.event-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--faint);
  font-size: 11px;
}

.event-label {
  color: var(--muted);
  text-transform: uppercase;
}

.event-body {
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.event-text {
  border-left-color: var(--accent);
}

.event-tool .event-body,
.event-result .event-body,
.event-command .event-body {
  font-family: var(--mono);
  font-size: 12px;
}

.event-error {
  border-left-color: var(--erreur);
}

.event-error .event-label {
  color: var(--erreur);
}

.event-done {
  border-left-color: var(--accent);
}

.event-done .event-label {
  color: var(--accent);
}

.event-cost .event-body {
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 960px) {
  .workflow-editor {
    grid-template-columns: minmax(0, 1fr);
  }

  .topbar .pause-toggle span {
    display: none;
  }

  .topbar .pause-toggle {
    width: 44px;
    padding: 0;
    justify-content: center;
  }

  .approval-actions .form-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .table th:nth-child(4),
  .table td:nth-child(4),
  .table th:nth-child(6),
  .table td:nth-child(6) {
    display: none;
  }
}

/* Agent test bench (§10.2): the conversation, one block per turn. */
.test-bench {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.test-bench-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.turns {
  list-style: none;
  margin: 0;
  padding: 0;
}

.turn {
  padding: 16px 20px;
  border-top: 1px solid var(--hairline);
}

.turn:first-child {
  border-top: 0;
}

.turn-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.turn-title {
  font-weight: 600;
}

.turn-summary {
  margin-top: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.turn-summary p {
  margin: 6px 0 0;
  white-space: pre-wrap;
}

/* Phone: figures two by two, so that the run or the approval shows without scrolling past them. */
@media (max-width: 600px) {
  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .stat-tile {
    padding: 14px;
    gap: 8px;
  }

  .stat-value {
    font-size: 26px;
  }
}

/* Page « Paliers » (M8): one card per tier, its form inside. */
.tiers-grid {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.tier-card {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 18px 20px 20px;
}

/* Page « Signalements » (M8): the reporter's words, kept as written. */
.report-text {
  margin: 12px 0;
  white-space: pre-line;
}
