/* Portail Algae — maquette locale v1 (logique portail TwinPulse) */
:root {
  --bg: #eef4f2;
  --surface: #fff;
  --text: #1a2421;
  --muted: #5a6b65;
  --brand: #1a5c4a;
  --brand-light: #2a7a62;
  --accent: #3d8b72;
  --water: #7ecfb0;
  --border: #d4e0db;
  --warn-bg: #fff8e6;
  --warn-border: #e6c200;
  --ok: #1a7a42;
  --soon: #888;
  --page-gutter: 0.5rem;
  --horiz-tab-row: 2.85rem;
}

* { box-sizing: border-box; }

html {
  height: 100%;
  height: 100dvh;
  overflow: hidden;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  height: 100%;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.app-chrome {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 20;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.brand h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 650;
  color: var(--brand);
}

.brand .meta {
  font-size: 0.78rem;
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}

.badge {
  font-size: 0.72rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--muted);
}

.badge-attention {
  background: var(--warn-bg);
  border-color: var(--warn-border);
}

.badge-demo {
  background: var(--warn-bg);
  border-color: var(--warn-border);
  color: #6b5a00;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.topbar-link {
  background: none;
  border: none;
  font: inherit;
  color: var(--accent);
  cursor: pointer;
  padding: 0.35rem 0.5rem;
  border-radius: 4px;
}

.topbar-link:hover { background: var(--bg); }

.topbar-sep {
  width: 1px;
  height: 1.1rem;
  background: var(--border);
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0;
  padding: 0 var(--page-gutter);
}

.tab-sep {
  width: 1px;
  align-self: stretch;
  min-height: 1.6rem;
  margin: 0.35rem 0.35rem;
  background: var(--border);
  flex-shrink: 0;
  pointer-events: none;
}

@media (max-width: 720px) {
  .tab-sep { display: none; }
}

.tab {
  position: relative;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font: inherit;
  font-size: 0.9rem;
  padding: 0.65rem 0.85rem;
  cursor: pointer;
  color: var(--muted);
}

.tab-dot,
.subtab-dot,
.horiz-tab-dot {
  display: none;
  width: 0.42rem;
  height: 0.42rem;
  border-radius: 50%;
  background: var(--brand);
  flex-shrink: 0;
}

.tab-dot,
.horiz-tab-dot {
  position: absolute;
  top: 0.42rem;
  right: 0.22rem;
}

.horiz-tab-dot {
  top: 0.18rem;
  right: 0.18rem;
}

.tab.has-dot .tab-dot,
.subtab.has-dot .subtab-dot,
.horiz-tab.has-dot .horiz-tab-dot {
  display: inline-block;
}

.tab:hover { color: var(--text); }

.tab.active {
  color: var(--brand);
  border-bottom-color: var(--brand);
  font-weight: 600;
}

main {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0.5rem var(--page-gutter);
  max-width: none;
  width: 100%;
  margin: 0;
}

.panel { display: none; }
.panel.active:not([hidden]) {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.project-header h2 {
  margin: 0 0 1rem;
  font-size: 1.25rem;
  color: var(--brand);
}

.project-split {
  display: grid;
  grid-template-columns: minmax(7.25rem, 8.75rem) 1fr;
  gap: 0.5rem;
  align-items: stretch;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.project-sidebar {
  margin-left: 0;
  min-height: 0;
  overflow: hidden;
}

@media (max-width: 640px) {
  .project-split {
    display: flex;
    flex-direction: column;
    grid-template-columns: 1fr;
  }
  .project-sidebar { flex-shrink: 0; }
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.subtab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  text-align: left;
  background: none;
  border: none;
  border-left: 3px solid transparent;
  font: inherit;
  font-size: 0.88rem;
  padding: 0.4rem 0.45rem 0.4rem calc(0.85rem - 3px);
  cursor: pointer;
  color: var(--muted);
  border-radius: 0 4px 4px 0;
}

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

.subtab.active {
  border-left-color: var(--brand);
  background: var(--surface);
  color: var(--brand);
  font-weight: 600;
}

.project-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.3rem 1rem 0.85rem;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.subpanel { display: none; }
.subpanel.active:not([hidden]) {
  display: block;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.subpanel h3 {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
}

.archive-section-title {
  margin: 1.25rem 0 0.5rem;
  font-size: 0.95rem;
}

.subpanel > .visually-hidden + .archive-section-title {
  margin-top: 0;
}

.horiz-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 0.85rem;
  border-bottom: 1px solid var(--border);
  padding-top: 0.1rem;
  padding-bottom: 0.35rem;
  position: sticky;
  top: 0;
  z-index: 6;
  background: var(--surface);
  flex-shrink: 0;
}

.horiz-tabs[hidden],
.explorer-panel > .horiz-tabs[hidden] {
  display: none !important;
}

.subpanel > .horiz-tabs ~ * .horiz-tabs,
#explorer-panels-mount > .horiz-tabs {
  top: var(--horiz-tab-row);
  z-index: 5;
}

.horiz-tab {
  position: relative;
  background: none;
  border: 1px solid transparent;
  border-radius: 4px 4px 0 0;
  font: inherit;
  font-size: 0.88rem;
  padding: 0.35rem 0.75rem;
  cursor: pointer;
  color: var(--muted);
}

.horiz-tab:hover {
  background: var(--bg);
  color: var(--text);
}

.horiz-tab.active {
  border-color: var(--border);
  border-bottom-color: var(--surface);
  background: var(--surface);
  color: var(--brand);
  font-weight: 600;
  margin-bottom: -1px;
}

.horiz-tab-action {
  color: var(--brand);
  font-weight: 600;
  margin-left: auto;
}

.depot-state-tabs {
  margin-top: 0.35rem;
}

.published-notes-sub-panel { display: none; }
.published-notes-sub-panel.active:not([hidden]) { display: block; }

.subpanel.active:not([hidden])[data-subpanel="mandat"] {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.subpanel[data-subpanel="mandat"] > .visually-hidden,
.subpanel[data-subpanel="mandat"] > #mandates-status {
  flex-shrink: 0;
}
.subpanel.active:not([hidden])[data-subpanel="explorateur"] {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.subpanel[data-subpanel="explorateur"] > .horiz-tabs {
  flex-shrink: 0;
}
#explorer-panels-mount {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.explorer-panel { display: none; }
.explorer-panel.active:not([hidden]) {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.explorer-panel > .horiz-tabs {
  flex-shrink: 0;
  position: static;
}
.explorer-panel-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
}
.explorer-panel-body:has(.explorer-cols) {
  overflow: hidden;
}
.explorer-panel-body > .explorer-cols,
.explorer-panel-body > .depot-state-panel:not([hidden]),
.explorer-panel-body > .published-notes-sub-panel.active:not([hidden]) {
  flex: 1 1 auto;
  min-height: 0;
}
.depot-state-panel[hidden] {
  display: none !important;
}
.explorer-panel-body > .depot-state-panel:not([hidden]) {
  overflow: auto;
}
.explorer-panel-body > .depot-state-panel:not([hidden]):has(.explorer-cols),
.published-notes-sub-panel.active:not([hidden]):has(.explorer-cols) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.explorer-cols {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
}
.explorer-cols-head {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: var(--explorer-cols, minmax(9rem, 1fr) var(--explorer-actions, max-content));
  column-gap: 0.65rem;
  align-items: center;
  padding: 0.15rem 0 0.35rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.explorer-cols-head button {
  appearance: none;
  background: none;
  border: 0;
  margin: 0;
  padding: 0.15rem 0;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
}
.explorer-cols-head button[aria-sort="ascending"]::after {
  content: " ↑";
}
.explorer-cols-head button[aria-sort="descending"]::after {
  content: " ↓";
}
.explorer-cols-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.explorer-cols .doc-list > li:not(.msg) {
  display: grid;
  grid-template-columns: var(--explorer-cols, minmax(9rem, 1fr) var(--explorer-actions, max-content));
  column-gap: 0.65rem;
  align-items: center;
  justify-content: stretch;
}
.explorer-cell-name {
  min-width: 0;
}
.explorer-cell-date,
.explorer-cell-rev,
.explorer-cell-size,
.explorer-cell-created,
.explorer-cell-modified,
.explorer-cell-messages {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}
.explorer-cols[data-fixed-actions] .explorer-cols-head {
  overflow: hidden;
}
.explorer-cols[data-fixed-actions] .explorer-cols-scroll {
  overflow-x: auto;
}
.agent-tab-panel[data-agent-panel="sessions"] > .pane-scroll:has(.explorer-cols) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.agent-tab-panel[data-agent-panel="sessions"] > .pane-scroll:has(.explorer-cols) > .explorer-cols {
  flex: 1 1 auto;
  min-height: 0;
}
.explorer-cols .agent-session-title {
  display: flex;
  min-width: 0;
}
.explorer-cols .agent-session-list .explorer-cell-actions {
  justify-self: stretch;
  white-space: nowrap;
}
.explorer-cols .agent-session-actions {
  flex-wrap: nowrap;
  justify-content: flex-end;
}
.agent-session-more > summary.btn-sm {
  display: inline-block;
  list-style: none;
}
.agent-session-more > summary::-webkit-details-marker {
  display: none;
}
.agent-session-more[open] > .agent-session-menu {
  position: fixed;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.25rem;
  min-width: 11.5rem;
  padding: 0.35rem;
  background: var(--surface, #fff);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}
.agent-session-menu .btn-sm {
  text-align: left;
  width: 100%;
}
.explorer-cell-actions {
  justify-self: end;
  text-align: right;
  white-space: nowrap;
}
.explorer-panel > .opt-row {
  flex-shrink: 0;
}

.opt-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.55rem 0.85rem;
  flex-shrink: 0;
  min-height: 1.7rem;
  margin: 0 0 0.45rem;
  overflow-x: auto;
  overflow-y: hidden;
}
.opt-row[hidden] {
  display: none !important;
}
.opt-row .meta-hint {
  margin: 0;
  white-space: nowrap;
}
.opt-row .activity-range {
  margin: 0;
  flex-shrink: 0;
}

.pane-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

#panel-admin .subpanel.active:not([hidden])[data-subpanel="commentaires"],
#panel-admin .subpanel.active:not([hidden])[data-subpanel="actions"],
#panel-admin .subpanel.active:not([hidden])[data-subpanel="sources-web"] {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#panel-admin .subpanel[data-subpanel="commentaires"] > .horiz-tabs,
#panel-admin .subpanel[data-subpanel="sources-web"] > .horiz-tabs {
  flex-shrink: 0;
  position: static;
}
.founder-comments-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.founder-comments-body > .comment-list {
  margin-top: 0;
}

.fetch-group-panel { display: none; }
.fetch-group-panel.active:not([hidden]) { display: block; }

.status-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  margin-right: 0.25rem;
  vertical-align: middle;
}

.status-badge.status-ok {
  background: #e8f5e9;
  color: #2e7d32;
}

.status-badge.status-pending {
  background: #fff8e1;
  color: #f57f17;
}

.status-badge.status-later {
  background: #eceff1;
  color: #455a64;
}

.comment-status-label {
  display: inline-block;
  margin-right: 0.35rem;
}

.comment-status-select {
  font-size: 0.75rem;
  padding: 0.05rem 0.2rem;
}

.meta-hint {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 0.75rem;
}

.note {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  margin-top: 1rem;
}

.project-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.project-table th,
.project-table td {
  text-align: left;
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--border);
}

.project-table th {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}

.project-row {
  cursor: pointer;
}

.project-row:hover { background: var(--bg); }

.project-row:focus {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.status-open { color: var(--accent); font-weight: 500; }
.status-done { color: var(--ok); font-weight: 500; }
.status-ready { color: var(--brand-light); font-weight: 500; }

.status-guide {
  margin: 0.5rem 0 0;
  padding-left: 1.2rem;
}

.status-guide li { margin-bottom: 0.5rem; }

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

.doc-list li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
}

.doc-kind {
  font-size: 0.78rem;
  color: var(--muted);
}

.btn, .btn-sm {
  font: inherit;
  cursor: pointer;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 0.45rem 0.85rem;
}

.btn-sm {
  font-size: 0.82rem;
  padding: 0.3rem 0.6rem;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.btn-primary:hover { background: var(--brand-light); }

.btn:disabled, .btn-sm:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.comment-form label {
  display: block;
  font-size: 0.85rem;
  margin: 0.75rem 0 0.25rem;
}

.comment-form input,
.comment-form select,
.comment-form textarea {
  width: 100%;
  font: inherit;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.comment-list {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0;
}

.comment-item {
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}

.comment-thread {
  margin-top: 0.45rem;
}

.comment-thread summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.82rem;
}

.comment-reply {
  margin: 0.4rem 0 0.4rem 0.55rem;
  padding-left: 0.55rem;
  border-left: 2px solid var(--border);
}

.comment-reply-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.45rem 0 0;
}

.comment-reply-form input[name="reply"] {
  flex: 1 1 12rem;
  font: inherit;
  padding: 0.3rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.comment-meta {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.msg { font-size: 0.88rem; margin: 0.5rem 0 0; }
.msg:empty { display: none; margin: 0; }
.msg.ok { color: var(--ok); }
.msg.error { color: #b00020; }

.modal-backdrop[hidden] {
  display: none !important;
  pointer-events: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 100;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 101;
  background: var(--surface);
  border-radius: 10px;
  padding: 1.25rem;
  width: min(420px, calc(100vw - 2rem));
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.modal h3 { margin: 0 0 0.75rem; }

.login-page main.login-main {
  max-width: 400px;
  margin: 2rem auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
}

.login-form { margin-top: 1rem; }
.login-field-hint {
  margin: 0.25rem 0 0.85rem;
  font-size: 0.88rem;
}
.login-pass-wrap {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}
.login-pass-wrap input {
  flex: 1;
  min-width: 0;
}
.login-pass-toggle {
  flex-shrink: 0;
  align-self: center;
  white-space: nowrap;
}
.login-reminder {
  margin: 0.75rem 0 0.25rem;
  font-size: 0.92rem;
}
.login-reminder ol {
  margin: 0.4rem 0 0 1.1rem;
  padding: 0;
}
.login-reminder code {
  font-size: 0.88em;
}

.clu-box {
  margin: 1rem 0 0.75rem;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  background: rgba(255, 255, 255, 0.55);
}
.clu-box summary {
  cursor: pointer;
  font-weight: 600;
}
.clu-text {
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.45;
  max-height: 320px;
  overflow: auto;
  margin: 0.5rem 0 0;
  padding: 0.5rem 0.65rem;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.75);
}
.clu-text p { margin: 0 0 0.65rem; }
.clu-text p:last-child { margin-bottom: 0; }
.clu-text ul { margin: 0 0 0.65rem 1.1rem; padding: 0; }
.clu-text li { margin: 0.25rem 0; }
.clu-text strong { font-weight: 700; }
.clu-title { font-size: 1rem; margin: 0 0 0.35rem; }
.clu-version { font-size: 0.82rem; color: #555; margin: 0 0 0.75rem; }
.clu-section { font-size: 0.92rem; margin: 0.85rem 0 0.35rem; font-weight: 700; }
.clu-section + p { margin-top: 0.25rem; }
.clu-fallback {
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 0.88rem;
  margin: 0;
}
.clu-accept {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  margin: 0.75rem 0 1rem;
  font-size: 0.95rem;
}
.clu-accept input:disabled + span,
label.clu-accept:has(input:disabled) {
  opacity: 0.55;
}
#settings-clu-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
#settings-clu-read-hint {
  color: #6a4a00;
  font-weight: 600;
}
.msg-error { color: #a33; }

a.topbar-link {
  text-decoration: none;
}

.tab.tab-locked {
  opacity: 0.45;
  cursor: not-allowed;
  text-decoration: none;
}

body.clu-ok .tab.tab-locked {
  opacity: 1;
  cursor: pointer;
}
.tab.tab-locked:hover {
  background: transparent;
}

.settings-stack {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  max-width: 52rem;
  padding: 0;
}
/* Onglet sans sous-panneau : le corps défile dans le cadre (html est overflow hidden). */
.panel-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-bottom: 1.5rem;
}
tr.job-fail td {
  font-weight: 600;
}
tr.fiche-row { cursor: pointer; }
tr.fiche-row:hover td { background: rgba(47, 111, 92, 0.06); }
.fiche-popup { width: min(36rem, calc(100vw - 2rem)); max-height: 70vh; overflow: auto; }
.fiche-history { margin-top: 0.6rem; }
.settings-card {
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  background: rgba(255, 255, 255, 0.65);
}
.settings-card h3 {
  margin: 0 0 0.5rem;
}
.settings-dl {
  display: grid;
  grid-template-columns: 8rem 1fr;
  gap: 0.35rem 1rem;
  margin: 0.75rem 0 0;
}
.settings-dl dt {
  color: rgba(0, 0, 0, 0.55);
  font-size: 0.9rem;
}
.settings-dl dd {
  margin: 0;
  font-weight: 600;
}
.account-form label {
  display: block;
  font-size: 0.85rem;
  margin: 0.75rem 0 0.25rem;
}
.account-form input[type="text"],
.account-form input[type="email"],
.account-form input[type="password"],
#panel-regles .account-form select {
  width: 100%;
  max-width: 24rem;
  font: inherit;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.account-form .btn {
  margin-top: 0.75rem;
  margin-right: 0.5rem;
}
.channel-list,
.prefs-list {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
}
.prefs-frequency {
  border: 0;
  margin: 0 0 0.85rem;
  padding: 0;
}
.prefs-frequency legend {
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0 0 0.35rem;
  padding: 0;
}
.prefs-frequency label {
  display: block;
  margin: 0.2rem 0;
  font-weight: 400;
}
.prefs-class {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  margin: 0.15rem 0 0.25rem;
}
.prefs-list.is-nested {
  margin-top: 0;
  padding-left: 1.35rem;
}
.channel-row,
.prefs-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: baseline;
  padding: 0.45rem 0;
  border-top: 1px solid var(--border, #e4e8ec);
}
.prefs-list li.is-mandatory {
  opacity: 0.92;
}
.prefs-always {
  color: var(--text-muted, #556);
  font-size: 0.8rem;
  font-weight: 400;
}
.channel-row.locked {
  opacity: 0.72;
}
.channel-status {
  color: var(--text-muted, #556);
  font-size: 0.85rem;
}
.activity-event-list li.unread span,
.activity-event-list li.unread .activity-event-title {
  font-weight: 600;
}
.activity-event-body {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}
.activity-event-title {
  font-weight: 600;
}
#settings-clu-actions {
  margin-top: 0.75rem;
}

.piece-num {
  font-variant-numeric: tabular-nums;
  color: var(--brand);
  font-weight: 600;
  min-width: 2rem;
}

.decisions-list {
  margin: 0.75rem 0 0;
  padding-left: 1.2rem;
  font-size: 0.92rem;
}

.decisions-list li { margin-bottom: 0.35rem; }

/* Agent chat (étape 3) */
.agent-capabilities {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.agent-capabilities summary {
  cursor: pointer;
  font-weight: 600;
}
.agent-session-label {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 0 1 auto;
  line-height: 1.35;
}
.agent-tab-panel,
.settings-tab-panel,
.comments-mine-panel { margin-top: 0.35rem; }
.settings-coord-panel,
.settings-notif-panel { margin-top: 0.15rem; }
.agent-tab-panel[hidden],
.settings-tab-panel[hidden],
.settings-coord-panel[hidden],
.settings-notif-panel[hidden],
.comments-mine-panel[hidden] { display: none !important; }
.subpanel.active:has(> .agent-horiz-tabs) {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.subpanel.active:has(> .agent-horiz-tabs) > .horiz-tabs {
  flex-shrink: 0;
}
.agent-tab-panel.active:not([hidden]) {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin-top: 0.15rem;
}
.agent-tab-panel > .horiz-tabs {
  flex-shrink: 0;
  position: static;
}
.agent-moteur-panel[hidden] { display: none !important; }
.agent-moteur-panel.active:not([hidden]) {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.agent-session-list {
  margin: 0.15rem 0 0;
}
.agent-session-item.active .agent-session-title {
  color: var(--brand);
}
.agent-session-title {
  font-weight: 600;
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}
.agent-session-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.agent-session-owner-tabs {
  margin: 0.35rem 0 0;
}
.agent-session-kind-row {
  margin: 0.35rem 0 0;
  flex-shrink: 0;
}
.agent-session-kind-chip {
  appearance: none;
  border: 1px solid var(--border);
  background: #fff;
  color: inherit;
  border-radius: 999px;
  padding: 0.12rem 0.7rem;
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
}
.agent-session-kind-chip[aria-pressed="true"] {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}
.agent-session-search-row {
  margin: 0.35rem 0 0;
  flex-shrink: 0;
}
.agent-session-search-field {
  position: relative;
  flex: 1 1 12rem;
  min-width: 8rem;
}
.agent-session-search-field input[type="search"] {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
}
.agent-session-search-field:has(.agent-session-search-spin:not([hidden])) input[type="search"] {
  padding-left: 1.65rem;
}
.agent-session-search-hits {
  margin: 0;
}
.agent-session-search-hits .is-trash {
  opacity: 0.85;
}
.agent-session-search-spin {
  position: absolute;
  left: 0.4rem;
  top: 50%;
  width: 0.75rem;
  height: 0.75rem;
  margin-top: -0.375rem;
  border: 2px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: agent-session-spin 0.7s linear infinite;
  pointer-events: none;
}
@keyframes agent-session-spin {
  to { transform: rotate(360deg); }
}
#agent-convo-verbosity-wrap select {
  margin-left: 0.35rem;
  font: inherit;
}
.agent-session-pills {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}
.agent-session-pill {
  border: 1px solid var(--border, #ccc);
  background: transparent;
  border-radius: 999px;
  padding: 0.05rem 0.45rem;
  font-size: 0.8em;
  cursor: pointer;
}
.agent-session-invite-dialog {
  max-width: 28rem;
  width: calc(100% - 2rem);
  padding: 1rem 1.1rem;
  border: 1px solid var(--border, #ccc);
  border-radius: var(--radius);
}
.agent-invite-field,
.agent-invite-modes {
  display: block;
  margin: 0.6rem 0;
}
.agent-invite-mode {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  margin: 0.4rem 0;
}
.agent-invite-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}
.mandates-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.75rem;
}
.mandates-stack {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  gap: 0;
}
.mandates-stack > .horiz-tabs {
  flex-shrink: 0;
  position: static;
}
.activite-chrome {
  flex-shrink: 0;
  padding-bottom: 0.15rem;
  margin-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
}
.mandate-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.mandate-group h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}
.mandate-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.mandate-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.65rem 0.75rem;
  background: rgba(255, 255, 255, 0.5);
}
.mandate-title { margin: 0 0 0.25rem; }
.mandate-meta { margin: 0 0 0.5rem; }
.mandate-budget-badge {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  font-size: 0.78rem;
  background: var(--surface-2, #f0f4f8);
  color: var(--text-muted, #556);
}
.agent-quota-bars {
  margin: 0.75rem 0 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.quota-row {
  display: grid;
  grid-template-columns: 7.5rem 1fr auto;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.85rem;
}
.quota-label { color: var(--text-muted, #556); }
.quota-track {
  height: 0.45rem;
  background: var(--surface-2, #e8edf2);
  border-radius: 999px;
  overflow: hidden;
}
.quota-track > span {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--accent, #2a6f97);
  border-radius: 999px;
  transition: width 0.2s ease;
}
.quota-track.quota-warn > span { background: #c77d28; }
.quota-track.quota-full > span { background: #b42318; }
.quota-nums { font-variant-numeric: tabular-nums; font-size: 0.8rem; }
.mandate-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.mandate-fields { display: flex; flex-direction: column; gap: 0.75rem; max-width: 42rem; }
.mandate-fields label, .mandate-fields fieldset { display: flex; flex-direction: column; gap: 0.25rem; }
.mandate-fields input, .mandate-fields textarea { width: 100%; font: inherit; }
.mandate-fields textarea { min-height: 4.5rem; }
.mandate-field-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.35rem; margin-bottom: 0.35rem; }
.activite-sums {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0 0 0.75rem;
  padding: 0.15rem 0 0.35rem;
}
.activite-sum {
  flex: 1 1 8rem;
}
.activite-sum p { margin: 0; }
.activite-sum strong { font-variant-numeric: tabular-nums; }
.execution-fiche {
  padding: 0.15rem 0 0.5rem;
}
.revue-gauges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0 0 0.75rem;
}
.revue-gauge {
  flex: 1 1 12rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.65rem;
  background: rgba(255, 255, 255, 0.5);
}
.revue-gauge p { margin: 0; }
.revue-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.revue-table th,
.revue-table td {
  text-align: left;
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.revue-badge {
  display: inline-block;
  padding: 0.05rem 0.4rem;
  border-radius: 4px;
  font-size: 0.75rem;
  background: var(--surface-2, #f0f4f8);
  color: var(--text-muted, #556);
}
button.linkish {
  border: 0;
  background: none;
  padding: 0;
  color: inherit;
  text-decoration: underline;
  cursor: pointer;
  font: inherit;
}
.mandate-fiche { margin: 0.5rem 0; font-size: 0.92rem; }
.mandate-fiche summary { cursor: pointer; color: var(--accent, #2563eb); }

.versions-page { max-width: 40rem; }
.versions-current { margin: 0 0 0.75rem; }
.versions-current p { margin: 0.15rem 0; }
.versions-history { margin: 0 0 1.25rem; }
.versions-history summary { cursor: pointer; color: var(--accent); }
.versions-list { margin: 0.4rem 0 1.1rem; padding-left: 1.1rem; }
.versions-list li { margin: 0.45rem 0; }
.mandate-body-preview {
  white-space: pre-wrap;
  font-size: 0.85rem;
  max-height: 12rem;
  overflow: auto;
  background: var(--surface-2, #f4f4f5);
  padding: 0.5rem;
  border-radius: 4px;
}

.agent-stack {
  gap: 1rem;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.agent-convo-toolbar {
  margin: 0 0 0.35rem;
}
.agent-send-pref-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.88rem;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}
.agent-toolbar { display: flex; flex-direction: column; gap: 0.5rem; }
.agent-status-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 0.75rem;
}
#agent-status-hint:empty,
#agent-status-hint[hidden] {
  display: none;
}
.agent-indicator {
  font-weight: 600;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.85rem;
  border: none;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.15s ease;
}
.agent-indicator:hover:not(:disabled) {
  opacity: 0.85;
}
.agent-indicator:disabled {
  cursor: default;
  opacity: 0.75;
}
.agent-indicator.agent-on {
  background: rgba(46, 125, 50, 0.12);
  color: #2e7d32;
}
.agent-indicator.agent-off {
  background: rgba(198, 40, 40, 0.1);
  color: #c62828;
}
.agent-indicator.agent-wait {
  background: rgba(0, 0, 0, 0.06);
  color: rgba(0, 0, 0, 0.55);
}
.agent-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.92rem;
}
.agent-chat-card {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}
.agent-messages {
  flex: 0 0 auto;
  height: 46vh;
  min-height: 10rem;
  max-height: 72vh;
  overflow-y: auto;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 0.75rem 1.85rem;
  background: rgba(255, 255, 255, 0.65);
  margin-bottom: 0.75rem;
  overscroll-behavior: contain;
}
.agent-revue-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: -0.35rem 0 0.65rem;
}
.agent-revue-bar[hidden] {
  display: none;
}
.agent-prompt-suggestions,
.agent-form,
#agent-chat-status {
  flex-shrink: 0;
}
.agent-msg {
  margin: 0 0 0.65rem;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  font-size: 0.92rem;
  line-height: 1.45;
  white-space: pre-wrap;
}
.agent-msg-rich {
  white-space: normal;
}
.agent-msg-rich p {
  margin: 0 0 0.5rem;
}
.agent-msg-rich p:last-child {
  margin-bottom: 0;
}
.agent-msg-rich ul {
  margin: 0.25rem 0 0.5rem 1.1rem;
  padding: 0;
}
.agent-msg-rich .agent-md-h {
  margin: 0.75rem 0 0.35rem;
  font-weight: 600;
  line-height: 1.3;
}
.agent-msg-rich .agent-md-h:first-child {
  margin-top: 0;
}
.agent-msg-rich .agent-md-h2,
.agent-msg-rich h4.agent-md-h2 {
  font-size: 0.98rem;
}
.agent-msg-rich .agent-md-h3,
.agent-msg-rich h5.agent-md-h3 {
  font-size: 0.94rem;
}
.agent-msg-rich .agent-md-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85em;
  background: rgba(0, 0, 0, 0.06);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}
.agent-msg-rich .agent-md-pre {
  margin: 0.5rem 0 0.75rem;
  padding: 0.65rem 0.75rem;
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow-x: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.agent-msg-rich .agent-md-pre code {
  background: none;
  padding: 0;
}
.agent-md-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.35rem 0 0.65rem;
  font-size: 0.88rem;
}
.agent-md-table th,
.agent-md-table td {
  border: 1px solid var(--border);
  padding: 0.35rem 0.5rem;
  text-align: left;
  vertical-align: top;
}
.agent-md-table th {
  background: rgba(0, 0, 0, 0.05);
  font-weight: 600;
}
.agent-msg-user {
  background: rgba(0, 105, 92, 0.08);
  margin-left: 1.5rem;
}
.agent-msg-queued {
  opacity: 0.78;
  border-left: 3px solid var(--brand, #00695c);
}
.agent-msg-queue-tag {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted, #5a6b64);
  text-transform: lowercase;
}
.agent-msg-who {
  font-weight: 600;
}
.agent-msg-assistant {
  background: rgba(0, 0, 0, 0.04);
  margin-right: 1.5rem;
}
.agent-msg-system {
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}
.agent-msg-pending {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.4rem;
  background: rgba(0, 0, 0, 0.04);
  margin-right: 1.5rem;
  color: var(--muted);
  font-size: 0.88rem;
}
.agent-pending-clock {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}
.agent-pending-clock .agent-typing-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.agent-pending-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.55rem;
  padding-left: 1.15rem;
}
.agent-pending-chip {
  font-variant-numeric: tabular-nums;
  font-size: 0.82rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.12rem 0.5rem;
}
.agent-pending-chip-count {
  display: inline-block;
  min-width: 2ch;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.agent-pending-chip.is-active {
  color: var(--text, #1a1a1a);
  border-color: rgba(0, 105, 92, 0.35);
  background: rgba(0, 105, 92, 0.08);
}
.agent-typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  height: 1rem;
}
.agent-typing-dots span {
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: rgba(0, 105, 92, 0.55);
  animation: agent-typing-bounce 1.2s ease-in-out infinite;
}
.agent-typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.agent-typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes agent-typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.45; }
  30% { transform: translateY(-0.25rem); opacity: 1; }
}
.agent-chat-status-progress {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.88rem;
}
.agent-chat-status-progress::before {
  content: "";
  width: 0.65rem;
  height: 0.65rem;
  border: 2px solid rgba(0, 105, 92, 0.25);
  border-top-color: rgba(0, 105, 92, 0.85);
  border-radius: 50%;
  animation: agent-status-spin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes agent-status-spin {
  to { transform: rotate(360deg); }
}
.agent-composer {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}
.agent-form textarea,
.agent-input-ce {
  width: 100%;
  resize: vertical;
  min-height: 2.6rem;
  font: inherit;
  padding: 0.6rem 0.75rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  white-space: pre-wrap;
  word-break: break-word;
}
.agent-form textarea:focus,
.agent-input-ce:focus {
  outline: none;
}
.agent-input-ce.is-empty:before {
  content: attr(data-placeholder);
  color: var(--muted, #8a9690);
  pointer-events: none;
}
.agent-input-ce.is-disabled {
  opacity: 0.55;
  pointer-events: none;
}
.agent-input-ce .agent-tok-hash,
.agent-input-ce .agent-tok-slash,
.agent-input-ce .agent-tok-at {
  pointer-events: auto;
}
.agent-composer:focus-within {
  border-color: rgba(0, 105, 92, 0.45);
  box-shadow: 0 0 0 2px rgba(0, 105, 92, 0.12);
}
.agent-composer-bar {
  display: flex;
  justify-content: flex-end;
  padding: 0 0.5rem 0.45rem;
}
.agent-composer-bar[hidden] {
  display: none;
}
.agent-form {
  position: relative;
}
.agent-ref-palette {
  list-style: none;
  margin: 0 0 0.4rem;
  padding: 0.15rem 0;
  max-height: 12.5rem;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f7faf8;
  box-shadow: 0 4px 14px rgba(26, 46, 40, 0.08);
  font-size: 0.78rem;
  line-height: 1.25;
  color: var(--muted, #5a6b64);
}
.agent-ref-palette[hidden] {
  display: none;
}
.agent-ref-item {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  padding: 0.35rem 0.65rem;
  cursor: pointer;
}
.agent-ref-item:hover {
  background: #e6f3ec;
}
.agent-ref-item[aria-selected="true"] {
  background: #cfe8d8;
  box-shadow: inset 3px 0 0 #2a6f97;
}
.agent-ref-item-main {
  min-width: 0;
  flex: 1;
  text-align: left;
  border: 0;
  background: none;
  font: inherit;
  cursor: pointer;
  color: inherit;
}
.agent-ref-item-title {
  display: flex;
  align-items: center;
  gap: 0.28em;
  min-width: 0;
  max-width: 100%;
  font-size: 0.78rem;
  font-weight: 400;
  color: #3d524b;
}
.agent-ref-title-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.agent-ref-kind {
  display: block;
  font-size: 0.68rem;
  color: var(--muted, #5a6b64);
}
.agent-ref-more {
  flex-shrink: 0;
  color: #2a6f97;
  font-size: 0.72rem;
  line-height: 1;
}
.agent-ref-item .share-link-btn {
  margin-left: auto;
}
.agent-ref-empty {
  padding: 0.5rem 0.65rem;
  color: var(--muted, #5a6b64);
  font-size: 0.85rem;
}
.agent-ref-item-section {
  padding-left: 1.35rem;
}
.agent-ref-item[data-ref-depth="2"] {
  padding-left: 2.1rem;
}
.agent-ref-item[data-ref-depth="3"] {
  padding-left: 2.85rem;
}
.agent-aide-inline {
  max-height: 16rem;
  overflow-y: auto;
  margin-top: 0.35rem;
}
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.modal-wide {
  width: min(920px, calc(100vw - 2rem));
  max-height: min(88vh, 900px);
  display: flex;
  flex-direction: column;
}
.mandate-reason-body {
  width: 100%;
  min-height: 16rem;
  margin: 0.5rem 0 1rem;
  padding: 0.6rem 0.7rem;
  font: inherit;
  line-height: 1.45;
  resize: vertical;
}
.mandate-reason-actions {
  justify-content: flex-end;
  gap: 0.5rem;
}

.document-modal-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.document-modal-head h3 {
  margin: 0;
  flex: 1 1 auto;
}

.document-modal-actions {
  display: flex;
  gap: 0.5rem;
}

.document-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.1rem;
  background: #fafcfb;
  min-height: 200px;
  max-height: calc(88vh - 8rem);
}

.document-body .agent-msg-rich {
  font-size: 0.95rem;
}

.document-body-toc {
  overflow: hidden;
}

.document-body-toc > .agent-msg-rich {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.viewer-toc {
  flex: 0 0 auto;
  margin: 0 0 0.75rem;
  padding: 0 0 0.5rem;
  background: #fafcfb;
  border-bottom: 1px solid var(--border);
}

.viewer-toc summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--muted, #5a6b64);
}

.viewer-toc-list {
  margin: 0.4rem 0 0;
  padding: 0;
  list-style: none;
  max-height: min(40vh, 16rem);
  overflow: auto;
}

.viewer-toc-list a {
  display: block;
  font-size: 0.8rem;
  line-height: 1.35;
  padding: 0.16rem 0;
  color: var(--brand-light);
  text-decoration: none;
}

.viewer-toc-list a:hover {
  text-decoration: underline;
}

.viewer-toc-l2 {
  padding-left: 0.85rem;
}

.viewer-toc-l3 {
  padding-left: 1.6rem;
}

.document-body iframe {
  width: 100%;
  min-height: 70vh;
  border: 0;
}

a.agent-doc-link,
a.agent-tok-hash {
  color: var(--brand-light);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

a.agent-doc-link:hover,
a.agent-tok-hash:hover {
  color: var(--brand);
}

.agent-tok-slash {
  display: inline-block;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88em;
  font-weight: 600;
  color: #fff;
  background: #1565c0;
  padding: 0.05em 0.4em;
  border-radius: 4px;
}

.agent-tok-at {
  display: inline-block;
  font-weight: 600;
  background: rgba(230, 126, 34, 0.18);
  color: inherit;
  padding: 0.05em 0.4em;
  border-radius: 4px;
}

.agent-messages[data-skin="term"] .agent-msg {
  border-radius: 0;
  padding: 0.4rem 0;
  border-top: 1px solid var(--border);
}

.agent-messages[data-skin="term"] .agent-msg-user,
.agent-messages[data-skin="term"] .agent-msg-assistant,
.agent-messages[data-skin="term"] .agent-msg-pending {
  background: transparent;
  margin-left: 0;
  margin-right: 0;
}

.agent-messages[data-skin="term"] .agent-msg-system {
  text-align: left;
}

.agent-messages[data-skin="compact"] .agent-msg {
  margin: 0 0 0.28rem;
  padding: 0.28rem 0.45rem;
  font-size: 0.84rem;
  line-height: 1.28;
  border-radius: 6px;
}

.agent-messages[data-skin="compact"] .agent-msg-user {
  margin-left: 0.55rem;
}

.agent-messages[data-skin="compact"] .agent-msg-assistant,
.agent-messages[data-skin="compact"] .agent-msg-pending {
  margin-right: 0.55rem;
}

.agent-messages[data-skin="transcript"] .agent-msg,
.agent-messages[data-skin="transcript"] .agent-msg-user,
.agent-messages[data-skin="transcript"] .agent-msg-assistant,
.agent-messages[data-skin="transcript"] .agent-msg-pending {
  background: transparent;
  margin-left: 0;
  margin-right: 0;
  border-radius: 0;
  padding: 0.2rem 0;
}

.agent-messages[data-skin="transcript"] .agent-msg-user:not(:has(.agent-msg-who))::before,
.agent-messages[data-skin="transcript"] .agent-msg-assistant::before {
  display: block;
  font-weight: 600;
  font-size: 0.78rem;
  margin-bottom: 0.12rem;
}

.agent-messages[data-skin="transcript"] .agent-msg-user:not(:has(.agent-msg-who))::before {
  content: "Vous";
}

.agent-messages[data-skin="transcript"] .agent-msg-assistant::before {
  content: "TwinPulse";
}

.agent-messages[data-skin="transcript"] .agent-msg-system {
  text-align: left;
}

.agent-messages[data-skin="terminal"] {
  background: #0e1412;
  color: #d6f5e8;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.agent-messages[data-skin="terminal"] .agent-msg,
.agent-messages[data-skin="terminal"] .agent-msg-user,
.agent-messages[data-skin="terminal"] .agent-msg-assistant,
.agent-messages[data-skin="terminal"] .agent-msg-pending {
  background: transparent;
  color: inherit;
  margin-left: 0;
  margin-right: 0;
  border-radius: 0;
  font-family: inherit;
  border-top: 1px solid rgba(214, 245, 232, 0.14);
}

.agent-messages[data-skin="terminal"] .agent-msg-user {
  color: #9be7c4;
}

.agent-messages[data-skin="terminal"] .agent-msg-system,
.agent-messages[data-skin="terminal"] .agent-msg-pending {
  color: #8aa898;
  text-align: left;
}

.agent-messages[data-skin="terminal"] a.agent-doc-link,
.agent-messages[data-skin="terminal"] a.agent-tok-hash {
  color: #8fd4ff;
}

.agent-messages[data-skin="terminal"] .btn-sm {
  color: #d6f5e8;
  border-color: rgba(214, 245, 232, 0.35);
  background: transparent;
}

.agent-msg-actions {
  margin-top: 0.5rem;
}
.agent-prompt-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  padding: 0.35rem 0 0.5rem;
  border-top: 1px solid var(--border, #d8e8e0);
}
.agent-prompt-label {
  font-size: 0.78rem;
  color: var(--muted, #5a6b64);
  margin-right: 0.25rem;
}
.agent-ux-echo {
  font-size: 0.86rem;
  color: var(--text, #1a2e28);
}
.agent-prompt-chip {
  font-size: 0.78rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border, #c5d9cf);
  background: #f4faf7;
  color: var(--text, #1a2e28);
  cursor: pointer;
  max-width: 100%;
  text-align: left;
}
.agent-prompt-chip:hover {
  background: #e6f3ec;
}
.agent-arch-diagram {
  font-size: 0.82rem;
  background: #f4faf7;
  padding: 0.75rem;
  border-radius: 6px;
  overflow-x: auto;
}
.agent-about-body {
  max-width: 52rem;
  line-height: 1.5;
}
.agent-about-body h3 {
  margin-top: 0;
}
.agent-about-body h4 {
  margin-top: 1.25rem;
}
.agent-about-body ul,
.agent-about-body ol {
  margin: 0.5rem 0 1rem 1.25rem;
}
.agent-about-body p {
  margin: 0.5rem 0;
}
.note-editor-title-input {
  width: 100%;
  margin: 0.5rem 0 0.75rem;
  padding: 0.4rem 0.5rem;
}
.note-editor-body {
  width: 100%;
  font-family: ui-monospace, monospace;
  font-size: 0.85rem;
  margin-top: 0.35rem;
  padding: 0.5rem;
}
.note-editor-modal {
  display: flex;
  flex-direction: column;
  max-height: 88vh;
}
.note-body-view {
  margin-top: 0.5rem;
}
.agent-sovereignty-table td {
  vertical-align: top;
}
.agent-moteur-panel[data-moteur-panel="local"] > .opt-row,
.agent-moteur-panel[data-moteur-panel="local"] > .msg {
  flex-shrink: 0;
}
.agent-local-form {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.75rem 1rem;
  align-items: flex-end;
  margin: 0.15rem 0 0.35rem;
  overflow-x: auto;
}
.agent-local-form label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
}
.agent-local-form input {
  font: inherit;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--border);
}

.depot-form label {
  display: block;
  margin: 0.75rem 0 0.35rem;
  font-weight: 600;
}
.depot-form select {
  width: 100%;
  max-width: 28rem;
  font: inherit;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.depot-dropzone {
  margin-top: 0.75rem;
  padding: 1.25rem 1rem;
  border: 2px dashed var(--border);
  border-radius: 10px;
  text-align: center;
  cursor: pointer;
  background: var(--surface, #fafafa);
}
.depot-dropzone-active {
  border-color: var(--accent, #2a6);
  background: color-mix(in srgb, var(--accent, #2a6) 8%, transparent);
}
.depot-form .btn-primary {
  margin-top: 0.75rem;
}
.activity-range {
  display: flex;
  gap: 0.4rem;
  margin: 0.5rem 0 0.75rem;
}
.activity-range .btn.active {
  background: var(--accent, #2a6f97);
  color: #fff;
  border-color: var(--accent, #2a6f97);
}
.day-chart {
  margin: 0 0 1rem;
}
.day-chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 4.5rem;
  padding: 0.15rem 0;
  border-bottom: 1px solid var(--border, #e4e8ec);
}
.day-chart-axis {
  display: flex;
  gap: 2px;
  margin-top: 0.2rem;
  font-size: 0.65rem;
  line-height: 1.15;
  color: var(--text-muted, #556);
  font-variant-numeric: tabular-nums;
}
.day-chart-axis span {
  flex: 1 1 0;
  min-width: 0;
  overflow: visible;
  text-align: center;
  white-space: nowrap;
}
.day-chart-axis span:first-child {
  text-align: left;
}
.day-chart-axis span:last-child {
  text-align: right;
}
.day-bar {
  flex: 1 1 0;
  min-width: 3px;
  background: var(--accent, #2a6f97);
  border-radius: 2px 2px 0 0;
  opacity: 0.9;
}
.day-bar.is-empty {
  background: var(--surface-2, #e8edf2);
  min-height: 2px;
  height: 2px !important;
  opacity: 1;
}
.day-bar.is-stack {
  display: flex;
  flex-direction: column-reverse;
  background: transparent;
  opacity: 1;
  overflow: hidden;
}
.day-bar-seg {
  width: 100%;
  min-height: 0;
}
.day-bar-seg:last-child {
  border-radius: 2px 2px 0 0;
}
.day-chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  color: var(--text-muted, #556);
}
.day-chart-legend i {
  display: inline-block;
  width: 0.65rem;
  height: 0.65rem;
  margin-right: 0.3rem;
  border-radius: 1px;
  vertical-align: -0.05rem;
}
.day-chart-meta {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  color: var(--text-muted, #556);
}
.activity-event-list {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
}
.activity-event-list li {
  display: flex;
  gap: 0.75rem;
  padding: 0.35rem 0;
  border-top: 1px solid var(--border, #e4e8ec);
  font-size: 0.9rem;
}
.activity-event-list time {
  color: var(--text-muted, #556);
  font-variant-numeric: tabular-nums;
  min-width: 11rem;
}
.admin-users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.admin-users-table th,
.admin-users-table td {
  text-align: left;
  padding: 0.45rem 0.5rem 0.45rem 0;
  border-bottom: 1px solid var(--border, #e4e8ec);
  vertical-align: middle;
}
.admin-users-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.admin-password-once code {
  font-size: 1rem;
}

.depot-cat-share {
  margin: 0;
}
.opt-row .depot-cat-share:not([hidden]),
.opt-row .depot-label-bar:not([hidden]),
.opt-row #depot-promote-all-wrap:not([hidden]) {
  display: contents;
}
.depot-cat-share-ticks {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.45rem 0.85rem;
}
.depot-cat-tick {
  font-size: 0.88rem;
  white-space: nowrap;
}
.depot-label-bar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.55rem 0.85rem;
  margin: 0;
}
.depot-label-field,
.depot-label-tick-all {
  font-size: 0.88rem;
  white-space: nowrap;
}

.depot-label-field select {
  margin-left: 0.35rem;
}

.depot-row-tick {
  margin-right: 0.4rem;
}

.depot-row-main {
  flex: 1 1 12rem;
  min-width: 0;
}

.depot-caption {
  display: block;
  margin-top: 0.22rem;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.35;
}

#calendar-form input[type="text"],
#calendar-form input[type="date"],
#calendar-form input[type="time"],
#calendar-form select,
#calendar-form textarea {
  width: 100%;
  max-width: 24rem;
  font: inherit;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.calendar-when {
  display: flex;
  gap: 0.5rem;
  max-width: 24rem;
}
.calendar-when input {
  flex: 1 1 0;
  min-width: 0;
  max-width: none;
}
#calendar-invite-list label {
  display: block;
  margin: 0.15rem 0;
}
.calendar-list {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
}
.calendar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
}
.calendar-month-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.75rem 0;
}
.calendar-weekdays,
.calendar-month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}
.calendar-weekdays {
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 4px;
}
.calendar-day {
  min-height: 4.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.2rem;
  font-size: 0.78rem;
}
.calendar-day.is-out {
  opacity: 0.35;
}
.calendar-year-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem 1rem;
  padding-bottom: 0.5rem;
}
.calendar-mini-name {
  display: block;
  margin: 0 0 0.25rem;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 600;
  text-transform: capitalize;
  cursor: pointer;
}
.calendar-mini-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
}
.calendar-mini-day,
.calendar-mini-pad {
  min-height: 1.35rem;
  font-size: 0.68rem;
  line-height: 1.35rem;
  text-align: center;
}
.calendar-mini-day {
  border: 0;
  padding: 0;
  background: transparent;
  font: inherit;
  font-size: 0.68rem;
  cursor: pointer;
  border-radius: 2px;
}
.calendar-mini-day.is-today {
  outline: 1px solid var(--border);
}
.calendar-mini-day.has-events {
  font-weight: 700;
  background: #d7efe4;
}
#panel-calendrier .subpanel.active:not([hidden])[data-subpanel="agenda"] {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#panel-calendrier .subpanel[data-subpanel="agenda"] > .horiz-tabs {
  position: static;
  flex-shrink: 0;
  margin-bottom: 0.35rem;
}
#panel-calendrier #calendar-form:not([hidden]) {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}
.calendar-toolbar {
  margin-top: 0;
  margin-bottom: 0.35rem;
}
.calendar-filters {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.45rem 0.85rem;
  margin: 0;
  padding: 0;
  border: 0;
  flex-shrink: 0;
}
.calendar-chrome-nav {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}
.calendar-chrome-nav[hidden] { display: none; }
.calendar-chrome-nav strong {
  white-space: nowrap;
  font-size: 0.9rem;
}
.calendar-density {
  display: inline-flex;
  gap: 0.4rem;
  margin: 0;
}
.calendar-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  font-size: 0.85rem;
  white-space: nowrap;
}
.calendar-swatch {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 2px;
}
.calendar-src-manual { background: #d7efe4; color: #1a5c4a; }
.calendar-src-agent { background: #fff1cc; color: #6a4b00; }
.calendar-src-system { background: #e6eaed; color: #3d4a50; }
.calendar-src-import { background: #e4e9f6; color: #243056; }
.calendar-row.calendar-src-manual,
.calendar-row.calendar-src-agent,
.calendar-row.calendar-src-system,
.calendar-row.calendar-src-import {
  padding-left: 0.45rem;
}
.calendar-open {
  flex: 1 1 12rem;
  margin: 0;
  padding: 0.15rem 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.calendar-density .btn.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}
.calendar-week-compact {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}
.calendar-hours,
.calendar-allday,
.calendar-week-head {
  display: grid;
  grid-template-columns: 3.2rem repeat(7, minmax(4.2rem, 1fr));
  gap: 0 4px;
}
.calendar-hours.is-day,
.calendar-allday.is-day {
  grid-template-columns: 3.2rem minmax(0, 1fr);
}
.calendar-week-head {
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface);
}
.calendar-hour {
  font-size: 0.72rem;
  color: var(--muted);
  padding-top: 0.15rem;
}
.calendar-slot {
  min-height: 1.45rem;
  border-top: 1px solid var(--border);
  padding: 1px 0 2px;
}
.calendar-event {
  display: block;
  width: 100%;
  margin-top: 0.15rem;
  padding: 0.1rem 0.28rem;
  border: 0;
  border-radius: 4px;
  text-align: left;
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
}
.calendar-event.is-pill {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.calendar-event[data-calendar-drag] { cursor: grab; touch-action: none; }
.calendar-slot.is-hot { background: rgba(47, 111, 92, 0.12); }
.calendar-import-label input { display: none; }
.calendar-popup {
  position: fixed;
  z-index: 80;
  left: 50%;
  top: 16vh;
  transform: translateX(-50%);
  width: min(26rem, calc(100vw - 2rem));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 10px 32px rgba(26, 36, 33, 0.16);
  padding: 0.85rem 1rem 1rem;
}
.calendar-popup[hidden] { display: none; }
.calendar-popup h4 { margin: 0 0 0.35rem; }
.calendar-popup p { margin: 0.25rem 0; }
.calendar-popup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.75rem;
}
.digest-report-list {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
}
.digest-report-list li { margin: 0 0 0.35rem; }
.digest-report-list a {
  color: var(--brand);
  text-decoration: underline;
  cursor: pointer;
}
