/*
 * Stelie's charte on the client portal (design handoffs « espace client »,
 * ADR-061, and « refonte v2 », docs/design/stelie-v2/). Hand-written, no build
 * step. The back office takes the same colours through Unfold (backoffice.css).
 * Fonts are served by the portal itself (SIL Open Font License 1.1, see
 * fonts/OFL-*.txt): no request to a third party.
 *
 * Accessibility (WCAG 2.2 AA, the v2 audit): text is never fainter than
 * --faint; --control (#6b6a65, 3:1 at least on --bg and --surface) borders the
 * controls, --line only separates; focus is always visible; text is 12 px at
 * least; secondary buttons are 32 px high at least; motion stops when asked.
 */

@import url("fonts.e54769b5dea3.css");

/* ---- Tokens -------------------------------------------------------------- */

:root {
  --bg: #121312;
  --surface: #1b1c1b;
  --surface-log: #0e0f0e;
  --hover: #2c2e2c;
  --line: #2c2e2c;
  --control: #6b6a65;
  --text: #ecebe6;
  --text-log: #dcdbd5;
  --text-2: #c9c8c2;
  --muted: #a3a29c;
  --faint: #8a8983;
  --accent: #5fd28a;
  --accent-hover: #74dc9b;
  --on-accent: #0e130f;
  --amber: #e2b55a;
  --on-amber: #121312;
  --error: #e9776b;
  --sans: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}
@supports (color: oklch(0 0 0)) {
  :root {
    --accent: oklch(0.78 0.14 150);
    --accent-hover: oklch(0.84 0.13 150);
    --amber: oklch(0.8 0.12 80);
    --error: oklch(0.7 0.15 25);
  }
}

/* ---- Base ---------------------------------------------------------------- */

* { box-sizing: border-box; }
html { color-scheme: dark; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font: 400 14px/1.5 var(--sans); }
a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: 0; }
h1 { font-size: 28px; line-height: 1.2; }
h2 { font-size: 18px; line-height: 1.3; }
h3 { font-size: 15px; line-height: 1.35; }
p { margin: 0; }
input, textarea, select, button { font: inherit; color: inherit; }
::placeholder { color: var(--faint); opacity: 1; }
[hidden] { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.logo { display: block; height: auto; filter: invert(1); }
.logo-large { width: 160px; }
.logo-small { width: 80px; }

/* ---- Buttons and fields -------------------------------------------------- */

.input, textarea, select, input[type=text], input[type=email], input[type=password], input[type=url],
input[type=date], input[type=time], input[type=search] {
  width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--control); border-radius: 8px;
  background: var(--bg); font-size: 15px; color: var(--text);
}
textarea { height: auto; min-height: 120px; padding: 10px 12px; line-height: 1.5; resize: vertical; }
.input:focus, textarea:focus, select:focus, input:focus { border-color: var(--accent); }
[aria-invalid="true"] { border-color: var(--error) !important; }
input[type=file] { color: var(--muted); font-size: 14px; }
input[type=file]::file-selector-button {
  margin-right: 12px; padding: 7px 12px; border: 1px solid var(--control); border-radius: 8px;
  background: none; color: var(--text); font: 600 13px var(--sans); cursor: pointer;
}
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }

/* A primary action: green. Secondary: bordered, 32 px at least. Danger: red text. */
.button, .button-submit, button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border: 1px solid var(--accent); border-radius: 8px; background: var(--accent);
  color: var(--on-accent); font: 600 14px var(--sans); text-decoration: none; white-space: nowrap; cursor: pointer;
}
.button:hover, .button-submit:hover, button:hover {
  border-color: var(--accent-hover); background: var(--accent-hover); color: var(--on-accent);
}
.button-submit { height: 52px; justify-content: space-between; padding: 0 20px; font-size: 16px; }
.button[disabled], button[disabled], .button-submit[disabled] { opacity: 0.7; cursor: progress; }
.button-secondary, button.button-secondary, button.secondary {
  min-height: 32px; height: auto; padding: 6px 12px; border: 1px solid var(--control); border-radius: 8px;
  background: none; color: var(--text); font: 600 13px var(--sans); text-decoration: none; cursor: pointer;
}
.button-secondary:hover, button.button-secondary:hover, button.secondary:hover { border-color: var(--muted); background: none; color: var(--text); }
.button-danger, button.button-danger { color: var(--error); }
.button-danger:hover, button.button-danger:hover { border-color: var(--error); color: var(--error); }
.button-link, button.button-link {
  height: auto; padding: 0; border: none; background: none; color: var(--text); font: inherit;
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.button-link:hover, button.button-link:hover { border: none; background: none; color: var(--accent); }
form.inline { display: inline; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { display: block; color: var(--text); font-size: 14px; font-weight: 600; }
.field-label .optional { color: var(--muted); font-weight: 400; }
.field-hint { color: var(--muted); font-size: 13px; }
.error { color: var(--error); font-size: 13px; }
.form-alert {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--error);
  border-radius: 8px; background: var(--surface); color: var(--text); font-size: 14px; line-height: 1.5;
}
.alert-mark { color: var(--error); font-weight: 600; }

/* ---- Sign-in ------------------------------------------------------------- */

.login { min-height: 100vh; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); }
.login-pitch {
  padding: clamp(32px, 6vw, 64px); display: flex; flex-direction: column; justify-content: space-between; gap: 48px;
  border-right: 1px solid var(--line);
}
.pitch { display: flex; flex-direction: column; gap: 20px; }
.pitch-title {
  max-width: 520px; font: 400 44px/1.12 var(--sans); letter-spacing: -0.02em; text-wrap: balance;
}
.pitch-text { max-width: 400px; color: var(--muted); font-size: 17px; line-height: 1.55; text-wrap: pretty; }
.login-side { display: flex; align-items: center; padding: clamp(32px, 6vw, 64px) clamp(24px, 8vw, 96px); }
.login-form { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 28px; }
.login .logo-large { width: 140px; }
.form-head { display: flex; flex-direction: column; gap: 6px; }
.form-head h2 { font-size: 28px; }
.form-head p, .form-foot { color: var(--muted); }
.form-head p { font-size: 15px; }
.form-foot { font-size: 14px; }
.fields { display: flex; flex-direction: column; gap: 18px; }
.login .input { height: 48px; padding: 0 14px; font-size: 16px; }
.password { position: relative; }
.password .input { padding-right: 96px; }
button.password-toggle {
  position: absolute; top: 50%; right: 6px; transform: translateY(-50%); min-height: 32px; height: auto;
  padding: 4px 10px; border: none; background: none; color: var(--text); font: 600 13px var(--sans);
}
button.password-toggle:hover { border: none; background: var(--hover); color: var(--text); }
.forgot { align-self: flex-start; font-size: 14px; }
.login .field-label { color: var(--text-2); font-weight: 400; }
.login .input { background: var(--surface); }
@media (max-width: 760px) {
  .login-pitch { border-right: none; border-bottom: 1px solid var(--line); padding: 40px 24px; }
  .pitch-title { font-size: 34px; }
  .login-side { padding: 40px 24px; }
}

/* ---- Header, menus, breadcrumb and page (redesign v2) ------------------- */

.app-header {
  position: relative; z-index: 5; height: 56px; padding: 0 24px; display: flex; align-items: center;
  justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line);
}
.header-start { display: flex; align-items: center; gap: 24px; min-width: 0; }
.brand { display: block; }
.main-nav { display: flex; align-items: center; gap: 4px; }
.header-link, button.header-link {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border: none;
  border-radius: 6px; background: none; color: var(--text-2); font: 400 14px var(--sans); text-decoration: none;
}
.header-link:hover, button.header-link:hover { border: none; background: var(--surface); color: var(--text); }
.header-link[aria-current="page"], button.header-link[aria-expanded="true"], button.header-link.is-current {
  background: var(--surface); color: var(--text);
}
.caret { font-size: 12px; color: var(--text-2); }

.menu { position: relative; }
.menu-panel {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 10; min-width: 280px; padding: 6px;
  background: var(--surface); border: 1px solid var(--control); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
.menu-end .menu-panel { left: auto; right: 0; min-width: 240px; }
.menu-list { list-style: none; margin: 0; padding: 0; }
.menu-item, button.menu-item {
  width: 100%; height: auto; display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 9px 12px; border: none; border-radius: 8px; background: none; color: var(--text);
  font: 400 14px var(--sans); text-align: left; text-decoration: none; white-space: normal;
}
.menu-item:hover, button.menu-item:hover { border: none; background: var(--hover); color: var(--text); }
.menu-title { font-weight: 600; }
.menu-meta { color: var(--muted); font-size: 12px; }
.menu-separated { margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--line); }
.menu-who {
  margin-bottom: 4px; padding: 8px 12px 10px; border-bottom: 1px solid var(--line); color: var(--muted);
  font-size: 12px; line-height: 1.4;
}
.menu-who span { color: var(--text); }
.menu-empty { padding: 9px 12px; color: var(--muted); }
.menu-panel form { margin: 0; }

.account-button, button.account-button {
  height: 34px; padding: 0 8px 0 4px; display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--control); border-radius: 8px; background: none; color: var(--text); font: 500 14px var(--sans);
}
.account-button:hover, button.account-button:hover, button.account-button[aria-expanded="true"] {
  border-color: var(--muted); background: var(--surface); color: var(--text);
}
.initials {
  width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; border-radius: 6px;
  background: var(--hover); font-size: 12px; font-weight: 600;
}

.page { padding: 24px 24px 40px; display: flex; flex-direction: column; gap: 20px; }
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; color: var(--muted); }
.crumbs li + li::before { content: "/"; margin-right: 6px; color: var(--muted); }
.crumbs a { color: var(--text-2); }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-title { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.page-title p { color: var(--muted); font-size: 15px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.page-intro { max-width: 720px; }
/* The privacy policy and the deletion instructions (ADR-098): a column to read. */
.page.legal { width: 100%; max-width: 760px; margin: 0 auto; gap: 28px; padding-bottom: 64px; }
.legal section { display: flex; flex-direction: column; gap: 10px; }
.legal p, .legal li { line-height: 1.6; text-wrap: pretty; }
.legal p { margin: 0; }
.legal ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }
.legal code { font-size: 0.9em; overflow-wrap: anywhere; }

@media (max-width: 640px) {
  .app-header { padding: 0 16px; gap: 8px; }
  .header-start { gap: 8px; }
  .header-dashboard { display: none; }
  .account-name {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  .page { padding: 16px 16px 32px; }
}

/* ---- Notices --------------------------------------------------------------- */

.welcome {
  padding: 20px; display: flex; flex-direction: column; gap: 16px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px;
}
.welcome-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.welcome-step {
  padding: 12px; display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  border: 1px solid var(--line); border-radius: 8px;
}
.welcome-step .step-number { width: 28px; height: 28px; font-size: 13px; }
.welcome-step.is-done .step-number { border-color: var(--accent); color: var(--accent); }
.welcome-step a { white-space: nowrap; }
.notice {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--surface); font-size: 14px; line-height: 1.5;
}
.notice.is-warning { border-color: var(--amber); }
.notice.is-error { border-color: var(--error); }
.notice-mark { color: var(--amber); font-weight: 600; }
.notice.is-error .notice-mark { color: var(--error); }

/* ---- Dashboard (redesign v2) ---------------------------------------------- */

#dashboard { display: flex; flex-direction: column; gap: 20px; }
.counters {
  list-style: none; margin: 0; padding: 0; max-width: 640px; display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
}
.counter {
  padding: 16px; display: flex; flex-direction: column; gap: 6px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px;
}
.counter-label { color: var(--text-2); font-size: 13px; }
.counter-value { font: 600 28px/1.1 var(--sans); font-variant-numeric: tabular-nums; }
.counter-detail { color: var(--muted); font-size: 12px; line-height: 1.4; }
.dashboard-columns {
  display: grid; gap: 20px; align-items: start; grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr));
}
.dashboard-list { display: flex; flex-direction: column; gap: 10px; }
.list-heading { display: flex; align-items: center; gap: 8px; font-size: 16px; }
.count {
  padding: 1px 8px; border-radius: 999px; background: var(--amber); color: var(--on-amber); font: 500 12px var(--sans);
}
.cards { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.todo-card {
  padding: 14px 16px; display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--amber); border-radius: 12px;
}
.todo-card.is-blocked { border-color: var(--error); }
.todo-card .button { height: 36px; padding: 0 14px; }
.card-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.card-kind { color: var(--amber); font-size: 13px; }
.todo-card.is-blocked .card-kind { color: var(--error); }
.card-title { font: 600 15px var(--sans); }
.card-meta { color: var(--muted); font-size: 13px; }
.quiet-card {
  padding: 14px 16px; display: flex; align-items: center; gap: 10px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; color: var(--text-2); font-size: 14px;
}
.quiet-card.is-dashed { background: none; border: 1px dashed var(--control); color: var(--muted); }
.tick { color: var(--accent); font-weight: 600; }
.work-card {
  padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; color: var(--text); text-decoration: none;
}
.work-card:hover { border-color: var(--control); color: var(--text); }
.work-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.follow { color: var(--text-2); font-size: 13px; white-space: nowrap; }
.work-step { display: flex; align-items: center; gap: 4px; color: var(--text-2); font-size: 13px; }
.progress { display: block; height: 4px; overflow: hidden; border-radius: 2px; background: var(--hover); }
.progress-bar { display: block; height: 100%; background: var(--amber); }

/* ---- An automation: tabs, runs (redesign v2) ----------------------------- */

.page.automation { gap: 16px; padding-top: 20px; }
.tabs { display: flex; align-items: center; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.tab {
  height: 40px; margin-bottom: -1px; padding: 0 12px; display: flex; align-items: center; gap: 8px;
  border-bottom: 2px solid transparent; color: var(--text-2); font: 500 14px var(--sans); text-decoration: none;
  white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { border-bottom-color: var(--text); color: var(--text); }
.tab-count { color: var(--muted); font-size: 12px; font-weight: 400; }
.tab-panel { display: flex; flex-direction: column; gap: 12px; }
.tab-panel[hidden] { display: none; }
.tab-panel:focus-visible { outline-offset: 4px; }
.run-list {
  max-width: 880px; list-style: none; margin: 0; padding: 6px; display: flex; flex-direction: column;
  background: var(--surface-log); border: 1px solid var(--line); border-radius: 12px;
}
.run-row {
  padding: 10px 12px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 14px; align-items: center;
  border-radius: 8px; color: var(--text); text-decoration: none;
}
.run-row:hover { background: var(--surface); color: var(--text); }
.run-row-title { overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.run-row-meta { color: var(--muted); font-size: 12px; }
.run-list-box .quiet-card { max-width: 880px; }
.status {
  justify-self: end; padding: 1px 8px; border: 1px solid var(--control); border-radius: 999px;
  color: var(--text); font-size: 12px; white-space: nowrap;
}
.status.is-waiting { border-color: var(--amber); color: var(--amber); }
.status.is-done { border-color: var(--accent); color: var(--accent); }
.status.is-error { border-color: var(--error); color: var(--error); }

/* ---- An automation's knowledge (redesign v2) ------------------------------ */

.prep-banner {
  padding: 10px 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
}
.prep-banner.is-ok { border-color: var(--accent); }
.prep-banner.is-waiting { border-color: var(--amber); }
.prep-banner.is-error { border-color: var(--error); }
.prep-text { display: flex; align-items: center; gap: 10px; min-width: 0; flex-wrap: wrap; }
.prep-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--muted); }
.prep-banner.is-ok .prep-dot { background: var(--accent); }
.prep-banner.is-waiting .prep-dot { background: var(--amber); }
.prep-banner.is-error .prep-dot { background: var(--error); }
.prep-label { font: 600 13px var(--sans); }
.prep-banner.is-ok .prep-label { color: var(--accent); }
.prep-banner.is-waiting .prep-label { color: var(--amber); }
.prep-banner.is-error .prep-label { color: var(--error); }
.prep-says { color: var(--text-2); font-size: 13px; text-wrap: pretty; }
.prep-banner form { margin: 0; }
.prep-banner .live-dot { margin-right: 0; }

.kb { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.kb-list {
  flex: 1 1 420px; min-width: 0; display: flex; flex-direction: column;
  background: var(--surface-log); border: 1px solid var(--line); border-radius: 12px;
}
.kb-toolbar {
  padding: 8px; display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
}
.kb-filters { display: flex; gap: 4px; flex-wrap: wrap; }
.kb-filters[hidden] { display: none; }
button.chip {
  height: 32px; padding: 0 10px; display: flex; align-items: center; gap: 6px; border: 1px solid transparent;
  border-radius: 6px; background: none; color: var(--text-2); font: 400 13px var(--sans);
}
button.chip:hover { border-color: transparent; background: none; color: var(--text); }
button.chip[aria-pressed="true"] { border-color: var(--control); background: var(--surface); color: var(--text); }
.chip-count { color: var(--muted); font-size: 12px; }
button.kb-add { background: var(--surface); }
.kb-kinds {
  padding: 8px; display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  border-bottom: 1px solid var(--line); background: var(--bg);
}
.kb-kinds[hidden] { display: none; }
.kb-kind {
  padding: 8px 10px; display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--text); text-decoration: none;
}
.kb-kind:hover { border-color: var(--control); color: var(--text); }
.kb-kind-name { font: 500 14px var(--sans); }
.kb-kind-short { color: var(--muted); font-size: 12px; line-height: 1.4; }
.kb-groups { padding: 4px 8px 8px; display: flex; flex-direction: column; }
.kb-group { display: flex; flex-direction: column; }
.kb-group[hidden] { display: none; }
.kb-group-head { padding: 12px 8px 4px; display: flex; align-items: center; justify-content: space-between; }
.kb-group-head h3 { color: var(--muted); font: 600 12px var(--sans); letter-spacing: 0.04em; text-transform: uppercase; }
.kb-group-add { padding: 4px; color: var(--text-2); font-size: 13px; text-decoration: none; }
.kb-group-add:hover { color: var(--text); }
.kb-item {
  min-height: 38px; padding: 4px 8px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px;
  align-items: center; border: 1px solid transparent; border-radius: 8px; color: var(--text); text-decoration: none;
}
.kb-item:hover { background: var(--surface); color: var(--text); }
.kb-item.is-current { border-color: var(--control); background: var(--surface); }
.kb-item.has-thumb { grid-template-columns: 28px minmax(0, 1fr) auto; }
.kb-thumb { width: 28px; height: 28px; display: block; border-radius: 5px; background: var(--hover); object-fit: cover; }
.kb-item-title { overflow: hidden; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.kb-item-says {
  max-width: 240px; overflow: hidden; color: var(--muted); font-size: 12px; text-align: right; text-overflow: ellipsis;
  white-space: nowrap;
}
.kb-empty { padding: 4px 8px 6px; color: var(--muted); font-size: 13px; line-height: 1.45; text-wrap: pretty; }

.kb-editor {
  flex: 1 1 380px; min-width: 0; display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
}
.kb-intro { padding: 28px 20px; display: flex; flex-direction: column; gap: 6px; }
.kb-intro h2 { font-size: 15px; }
.kb-intro p { max-width: 420px; color: var(--muted); font-size: 14px; line-height: 1.55; text-wrap: pretty; }
.kb-intro .kb-removed { margin-top: 10px; color: var(--text-2); font-size: 13px; }
.kb-editor-head {
  min-height: 48px; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border-bottom: 1px solid var(--line);
}
.kb-editor-title { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.kb-editor-title h2 { overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.kind-chip { padding: 1px 6px; border: 1px solid var(--control); border-radius: 4px; color: var(--text-2); font-size: 12px; }
.icon-button {
  width: 32px; height: 32px; flex: none; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--control); border-radius: 8px; color: var(--text-2); font-size: 14px; text-decoration: none;
}
.icon-button:hover { border-color: var(--muted); color: var(--text); }
.facebook-state { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.facebook-state .status { display: inline-flex; align-items: center; gap: 4px; }
.facebook-page { color: var(--text-2); font-size: 13px; }
/* a button, yet not a primary one: no padding (the icon would be squeezed to nothing), no green */
.facebook-state .icon-button { margin-left: auto; padding: 0; background: none; color: var(--text-2); cursor: pointer; }
.facebook-state .icon-button svg { flex: none; }
.facebook-state .icon-button:hover { border-color: var(--error); background: none; color: var(--error); }
.facebook-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.kb-form { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 14px; }
.kb-form .field-label { color: var(--text-2); font: 500 13px var(--sans); }
.kb-form .input { height: 38px; padding: 0 10px; background: var(--bg); font-size: 14px; }
.kb-form textarea { min-height: 80px; background: var(--bg); font-size: 14px; line-height: 1.55; }
.kb-form textarea.is-tall { min-height: 160px; }
.kb-hint { color: var(--muted); font-size: 13px; line-height: 1.45; text-wrap: pretty; }
.kb-image { max-width: 100%; max-height: 220px; align-self: flex-start; border-radius: 8px; }
.kb-read {
  padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px;
}
.kb-read-excerpt { color: var(--text-2); font-size: 14px; line-height: 1.5; text-wrap: pretty; }
.file-zone {
  padding: 8px 10px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  border: 1px dashed var(--control); border-radius: 8px;
}
.file-input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); opacity: 0; }
.file-input:focus-visible + .file-pick { outline: 2px solid var(--accent); outline-offset: 2px; }
.file-pick { cursor: pointer; background: var(--bg); }
.file-hint { flex: 1; min-width: 160px; color: var(--muted); font-size: 13px; line-height: 1.4; text-wrap: pretty; }
.kb-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.kb-save { display: flex; align-items: center; gap: 10px; }
.kb-save button { height: 36px; }
.saved { color: var(--accent); font-size: 13px; }
.unsaved { color: var(--amber); font-size: 13px; }
.guard, .confirm {
  padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; background: var(--bg);
  border: 1px solid var(--amber); border-radius: 8px;
}
.confirm { border-color: var(--error); }
.guard[hidden], .confirm[hidden] { display: none; }
.guard p, .confirm p { font-size: 14px; line-height: 1.45; }
.guard-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.button-small, button.button-small { height: 32px; padding: 0 12px; font-size: 13px; }

/* ---- An automation's settings (redesign v2) ------------------------------- */

.settings { max-width: 760px; display: flex; flex-direction: column; gap: 16px; }
.settings-card {
  min-width: 0; margin: 0; padding: 20px; display: flex; flex-direction: column; gap: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
}
.settings-card h2, .card-head h2 { font-size: 16px; }
.card-head { display: flex; flex-direction: column; gap: 4px; }
.card-head p { color: var(--muted); font-size: 14px; }
.settings-card .input { background: var(--bg); }
.settings-actions { display: flex; align-items: center; gap: 10px; }
.pills { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; flex-wrap: wrap; }
.pill {
  height: 32px; padding: 0 4px 0 10px; display: flex; align-items: center; gap: 4px;
  border: 1px solid var(--control); border-radius: 999px; font-size: 14px;
}
button.pill-remove {
  width: 24px; height: 24px; padding: 0; border: none; border-radius: 50%; background: none; color: var(--text-2);
  font: 400 14px var(--sans);
}
button.pill-remove:hover { border: none; background: var(--hover); color: var(--text); }
.pill-add { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.pill-add .field { flex: 1; min-width: 220px; }
.pill-add[hidden] { display: none; }
.pill-add .button-secondary { height: 40px; }
.checks { display: flex; flex-direction: column; gap: 8px; }
.check { min-height: 32px; display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.check-meta { color: var(--muted); font-size: 13px; }

/* ---- The launch page (redesign v2) ---------------------------------------- */

.launch { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.launch-form {
  flex: 1 1 520px; max-width: 800px; min-width: 0; padding: 20px; display: flex; flex-direction: column; gap: 22px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
}
.launch-field .field-label { font-size: 15px; }
.launch-field textarea { min-height: 148px; background: var(--bg); font-size: 15px; }
input.input-date { width: auto; min-width: 220px; align-self: flex-start; background: var(--bg); color-scheme: dark; }
.drop-zone {
  padding: 14px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  border: 1px dashed var(--control); border-radius: 8px;
}
.drop-zone.is-over { border-color: var(--accent); background: var(--bg); }
.drop-preview { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.drop-preview[hidden] { display: none; }
.drop-image { width: 72px; height: 72px; border-radius: 8px; object-fit: cover; }
.drop-image[hidden] { display: none; }
.drop-name { color: var(--text-2); font-size: 14px; }
.drop-list { list-style: none; margin: 0; padding: 0; width: 100%; display: grid; gap: 8px; }
.drop-list[hidden] { display: none; }
.drop-list li { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.drop-list .drop-image { width: 56px; height: 56px; }
.drop-list .drop-remove { margin-left: auto; }
.drop-total { color: var(--text-2); font-size: 13px; }
.drop-total:empty { display: none; }
.drop-list .drop-crop { margin-left: auto; }
.drop-list .drop-crop + .drop-remove { margin-left: 0; }
.drop-warning { width: 100%; color: var(--amber); font-size: 13px; }
/* The crop tool (ADR-097): the picture moved and enlarged under the frame. */
.crop-dialog { margin: 8vh auto auto; color: var(--text); }
.crop-dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
.crop-formats { display: flex; gap: 6px; }
.crop-formats[hidden] { display: none; }
.crop-stage {
  position: relative; flex: none; align-self: center; width: min(100%, 52vh); overflow: hidden; border-radius: 8px;
  background: #000; touch-action: none; cursor: grab;
}
.crop-stage:active { cursor: grabbing; }
.crop-stage:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.crop-image { position: absolute; top: 0; left: 0; max-width: none; transform-origin: 0 0; user-select: none; pointer-events: none; }
.crop-zoom { width: 100%; }
.crop-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.launch-actions {
  padding-top: 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border-top: 1px solid var(--line);
}
.launch-actions button { height: 44px; padding: 0 18px; font-size: 15px; }
.launch-side { flex: 1 1 300px; max-width: 420px; display: flex; flex-direction: column; gap: 16px; }
.side-card {
  padding: 16px 20px; display: flex; flex-direction: column; gap: 10px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; font-size: 14px;
}
.side-card h2 { font-size: 15px; }
.steps-ahead { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.step-line { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 10px; align-items: start; line-height: 1.4; }
.step-number {
  width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; border: 1px solid var(--control);
  border-radius: 50%; font-size: 12px;
}
.step-line.is-yours .step-number { border-color: var(--amber); color: var(--amber); }
.step-text { color: var(--muted); font-size: 13px; }
.side-note { color: var(--muted); font-size: 13px; line-height: 1.45; }
.side-status { display: flex; align-items: center; gap: 8px; }
.prep-dot.is-ok { background: var(--accent); }
.prep-dot.is-waiting { background: var(--amber); }

/* ---- An automation's context: switches, charte summary (redesign v2) ---- */

#panel-contexte > * { max-width: 1040px; }
.switches { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.switch-row {
  padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0;
  background: var(--surface-log);
}
.switch-row + .switch-row { border-top: 1px solid var(--line); }
.switch-text { display: flex; flex-direction: column; gap: 2px; }
.switch-title { font-weight: 600; font-size: 14px; }
.switch-hint { color: var(--muted); font-size: 12px; }
.switch-control { display: flex; align-items: center; gap: 10px; min-width: 120px; }
button.switch {
  width: 44px; height: 26px; padding: 2px; display: flex; justify-content: flex-start; border: 1px solid var(--control);
  border-radius: 999px; background: var(--bg);
}
button.switch:hover { border-color: var(--muted); background: var(--bg); }
button.switch[aria-checked="true"] { justify-content: flex-end; border-color: var(--accent); background: var(--accent); }
.switch-knob { width: 20px; height: 20px; border-radius: 50%; background: var(--muted); }
button.switch[aria-checked="true"] .switch-knob { background: var(--on-accent); }
.switch-state { font-size: 14px; font-weight: 600; }
.context-note { display: flex; gap: 10px; align-items: baseline; color: var(--text-2); font-size: 13px; line-height: 1.5; }
.context-note .dot { flex: none; transform: translateY(-1px); }
.charte-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; font-size: 13px; }
.swatches { display: inline-flex; gap: 4px; }
.swatch { width: 18px; height: 18px; border: 1px solid var(--control); border-radius: 50%; }
.shared-note { color: var(--muted); font-size: 13px; }
.shared-note a { color: var(--text-2); }

/* ---- An automation's schedule (redesign v2, ADR-076) ---------------------- */

#panel-programmation > * { max-width: 760px; }
.schedule .key-head { align-items: flex-start; }
.schedule-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-start; }
.schedule-row .field { min-width: 110px; }
.schedule-summary { font-size: 14px; }
.switch-input { position: absolute; width: 1px; height: 1px; opacity: 0; }
label.switch-control { position: relative; cursor: pointer; }
label.switch-control .switch {
  width: 44px; height: 26px; padding: 2px; display: flex; justify-content: flex-start; flex: none;
  border: 1px solid var(--control); border-radius: 999px; background: var(--bg);
}
.switch-input:checked + .switch { justify-content: flex-end; border-color: var(--accent); background: var(--accent); }
.switch-input:checked + .switch .switch-knob { background: var(--on-accent); }
.switch-input:focus-visible + .switch { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- My company: fiche, used by, visual identity (redesign v2) ------------ */

button.account-button.is-current { background: var(--surface); }
.split { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.split-main { flex: 1 1 520px; max-width: 800px; }
.split-side { flex: 1 1 280px; max-width: 420px; }
.fiche-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.fiche-grid .is-wide { grid-column: 1 / -1; }
.fiche-grid textarea { min-height: 110px; background: var(--bg); }
.used-by { display: flex; flex-direction: column; gap: 4px; }
.used-by + .used-by { padding-top: 10px; border-top: 1px solid var(--line); }
.used-by a { font-weight: 600; }
.used-by ul { list-style: none; margin: 0; padding: 0; color: var(--text-2); font-size: 13px; }
.used-by li.is-used span[aria-hidden] { color: var(--accent); }
.warning { color: var(--amber); font-size: 13px; line-height: 1.4; }

.charte { max-width: 1080px; }
.charte-body { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.charte-fields { flex: 1 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 22px; }
.charte-group { min-width: 0; margin: 0; padding: 0; border: none; display: flex; flex-direction: column; gap: 10px; }
.charte-group > legend { margin-bottom: 8px; padding: 0; font: 600 15px var(--sans); }
.logos { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.logo-card {
  padding: 10px; display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--line); border-radius: 10px;
}
.logo-frame {
  height: 72px; padding: 8px; display: flex; align-items: center; justify-content: center; margin-bottom: 6px;
  border-radius: 6px; background: #ffffff;
}
.logo-frame.is-dark { background: #2b2420; }
.logo-frame img { max-width: 100%; max-height: 100%; }
.logo-label { font-weight: 600; font-size: 13px; }
.logo-file { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logo-card .file-pick { margin-top: 6px; justify-content: center; }
.color-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) 110px; gap: 12px; align-items: center; }
.color-row input[type=color] {
  width: 44px; height: 36px; padding: 3px; border: 1px solid var(--control); border-radius: 8px; background: var(--bg);
  cursor: pointer;
}
.color-name { display: flex; flex-direction: column; font-weight: 600; font-size: 14px; }
.color-hint { color: var(--muted); font-size: 12px; font-weight: 400; }
input.color-hex { height: 36px; font: 400 13px var(--mono); text-align: right; background: var(--bg); }
.checks-list {
  list-style: none; margin: 4px 0 0; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px;
  border: 1px solid var(--line); border-radius: 8px; font-size: 13px;
}
.checks-list .is-ok span, .checks-list li.is-ok::first-letter { color: var(--accent); }
.checks-list .is-low { color: var(--amber); }
.buttons-row { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-end; }
.buttons-row .field { min-width: 140px; }
.field.radius { margin: 0; padding: 0; border: none; }
.segmented { display: flex; gap: 4px; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented span {
  height: 40px; padding: 0 12px; display: inline-flex; align-items: center; border: 1px solid var(--control);
  border-radius: 8px; font: 600 13px var(--sans); cursor: pointer;
}
.segmented input:checked + span { border-color: var(--muted); background: var(--hover); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.charte-preview { flex: 1 1 300px; min-width: 0; position: sticky; top: 16px; display: flex; flex-direction: column; gap: 8px; }
.preview-title { font: 600 15px var(--sans); }
.preview {
  padding: 20px; display: flex; flex-direction: column; gap: 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg, #ffffff); color: var(--t);
}
.preview-brand { text-align: center; color: var(--p); font: 600 12px var(--tf); letter-spacing: 0.14em; }
.preview-brand img { max-height: 40px; max-width: 60%; }
.preview-image { height: 90px; border-radius: 4px; background: var(--s); }
.preview-heading { color: var(--t); font: 400 22px/1.2 var(--tf); }
.preview-text { color: var(--t); font: 400 14px/1.6 var(--xf); }
.preview-button {
  align-self: flex-start; padding: 10px 16px; border-radius: var(--r); background: var(--bb); color: var(--bt);
  font: 600 14px var(--xf);
}

/* ---- My profile (redesign v2) --------------------------------------------- */

.field-pair { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.field[hidden] { display: none; }
.input-narrow, input.input-narrow { max-width: 360px; }
.rules { list-style: none; margin: 2px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; color: var(--muted); font-size: 13px; }
.rules li { display: flex; align-items: center; gap: 8px; }
.rules li.is-ok { color: var(--accent); }
.rule-mark { width: 12px; text-align: center; }

/* ---- Smaller pages: a document, a key, a choice, a launch starting -------- */

iframe.newsletter { width: 100%; height: 75vh; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
pre {
  margin: 0; padding: 16px; white-space: pre-wrap; overflow-x: auto; color: var(--text-log);
  background: var(--surface-log); border: 1px solid var(--line); border-radius: 12px; font: 400 13px/1.5 var(--mono);
}
.key-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.key-head .status { display: inline-flex; align-items: center; gap: 4px; }
.key-head .live-dot { margin-right: 2px; }
.key-purpose { color: var(--muted); font-size: 14px; }
.key-form { display: flex; flex-direction: column; gap: 12px; }
.choice-cards { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.choice-card {
  padding: 12px 14px; display: flex; align-items: flex-start; gap: 10px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--bg); cursor: pointer;
}
.choice-card:has(input:checked) { border-color: var(--accent); }
.choice-card input { margin-top: 2px; }
.choice-card > span { display: flex; flex-direction: column; gap: 2px; }
.choice-title { font-weight: 600; }
.choice-text { color: var(--muted); font-size: 13px; line-height: 1.45; }
.job-card { max-width: 640px; }
.job-card h1 { display: flex; align-items: center; gap: 8px; font-size: 20px; }

/* ---- Live dot: something is being worked on (preparation, check, step) ---- */

:root { --amber-glow: rgba(226, 181, 90, 0.55); --amber-clear: rgba(226, 181, 90, 0); }
@supports (color: oklch(0 0 0)) {
  :root { --amber-glow: oklch(0.8 0.12 80 / 0.55); --amber-clear: oklch(0.8 0.12 80 / 0); }
}
@keyframes stPulse {
  0% { box-shadow: 0 0 0 0 var(--amber-glow); }
  70% { box-shadow: 0 0 0 6px var(--amber-clear); }
  100% { box-shadow: 0 0 0 0 var(--amber-clear); }
}
@keyframes stShimmer { 0%, 100% { opacity: 0.35; } 50% { opacity: 0.7; } }
.live-dot {
  display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; vertical-align: 1px;
  background: var(--amber); animation: stPulse 1.6s ease-out infinite;
}

/* ---- A run (design handoffs « suivi du run », ADR-068, and v2) ---------- */

.page.run-page { gap: 16px; padding-top: 20px; }
.run-fragment { display: flex; flex-direction: column; gap: 16px; }
.run-head { align-items: flex-start; }
.run-title-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.run-title-line h1 { font-size: 22px; }
.run-meta { color: var(--muted); font-size: 13px; }
.run-progress { color: var(--text-2); }
button.button-danger-hover:hover { border-color: var(--error); color: var(--error); }
.confirm-bar {
  padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--error); border-radius: 10px;
}
.confirm-bar[hidden] { display: none; }
.confirm-bar p { max-width: 560px; font-size: 14px; line-height: 1.45; }
.confirm-bar form { margin: 0; }

.run-body { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.steps {
  flex: 0 1 300px; min-width: 240px; padding: 8px; position: relative;
  background: var(--surface-log); border: 1px solid var(--line); border-radius: 10px;
}
.step-list { list-style: none; margin: 0; padding: 0; position: relative; display: flex; flex-direction: column; }
.step-list::before { content: ""; position: absolute; left: 14px; top: 16px; bottom: 16px; width: 1px; background: var(--line); }
.step {
  position: relative; min-height: 36px; padding: 5px 8px; display: grid; gap: 10px; align-items: center;
  grid-template-columns: 12px minmax(0, 1fr) auto; border: 1px solid transparent; border-radius: 7px;
  color: var(--text); text-decoration: none;
}
.step:hover { background: var(--surface); color: var(--text); }
.step.is-pending, .step.is-skipped { color: var(--muted); }
.step.is-selected { background: var(--surface); border-color: var(--control); }
.step-dot { display: flex; justify-content: center; }
.step-label { overflow: hidden; font-size: 14px; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.step-meta { color: var(--muted); font-size: 12px; white-space: nowrap; }
.step.is-running .step-meta, .step.is-waiting .step-meta { color: var(--amber); }
.step.is-stopped .step-meta { color: var(--error); }
.dot { display: block; width: 8px; height: 8px; border-radius: 50%; }
.dot--done { background: var(--accent); }
.dot--running { background: var(--amber); animation: stPulse 1.6s ease-out infinite; }
.dot--waiting { background: var(--amber); border-radius: 2px; }
.dot--pending, .dot--skipped { width: 6px; height: 6px; border: 1px solid var(--faint); background: var(--surface-log); }
.dot--skipped { border-style: dashed; }
.dot--stopped { background: var(--error); }
/* The phases of a run (ADR-099): a row each, its steps folded underneath. */
.phase-list { list-style: none; margin: 4px 0 0; padding: 4px 0 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.phase-head {
  min-height: 38px; padding: 6px 8px; display: grid; gap: 10px; align-items: center;
  grid-template-columns: 12px minmax(0, 1fr) auto auto; border-radius: 7px; list-style: none;
}
summary.phase-head { cursor: pointer; }
summary.phase-head::-webkit-details-marker { display: none; }
summary.phase-head::after { content: "›"; color: var(--muted); font-size: 14px; transition: transform .15s; }
details[open] > summary.phase-head::after { transform: rotate(90deg); }
summary.phase-head:hover { background: var(--surface); }
.phase-label { overflow: hidden; font-size: 14px; font-weight: 600; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.phase.is-pending .phase-label, .phase.is-skipped .phase-label { color: var(--muted); font-weight: 500; }
.phase.is-running .step-meta, .phase.is-waiting .step-meta { color: var(--amber); }
.phase.is-stopped .step-meta { color: var(--error); }
.phase .step-list { margin: 0 0 6px 14px; padding-left: 4px; border-left: 1px solid var(--line); }
.phase .step-list::before, .step-list:has(+ .phase-list)::before { display: none; }
.phase .step { min-height: 32px; }
.phase .step-label { font-size: 13px; }

.result-col { flex: 1 1 460px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.gate {
  padding: 14px 16px; display: flex; flex-direction: column; gap: 12px;
  background: var(--surface); border: 1px solid var(--amber); border-radius: 10px;
}
.gate.is-error { border-color: var(--error); }
.gate-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.gate-text { display: flex; flex-direction: column; gap: 4px; max-width: 640px; }
.gate-step { color: var(--amber); font: 600 13px var(--sans); }
.gate.is-error .gate-step { color: var(--error); }
.gate-prompt { font: 600 15px/1.45 var(--sans); text-wrap: pretty; }
.gate-link { align-self: flex-start; margin-top: 4px; font-size: 14px; }
.gate-note { color: var(--muted); font-size: 13px; }
/* A worker starting (ADR-100): three stages, the current one live. */
.startup { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.startup-stages { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.startup-stage { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.startup-stage.is-running { color: var(--amber); }
.startup-stage.is-done { color: var(--text); }
.startup-why { color: var(--muted); font-size: 12px; }
.gate-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.gate-actions form { margin: 0; }
.gate-actions button, .gate-actions .button-secondary { height: 36px; min-height: 36px; padding: 0 14px; font-size: 14px; }
.gate textarea { min-height: 72px; background: var(--bg); font-size: 14px; }
.gate-remark, .gate-questions { display: flex; flex-direction: column; gap: 10px; }
.gate-remark[hidden] { display: none; }
.gate-remark .field-label, .gate-questions .field-label { color: var(--text-2); font: 500 13px var(--sans); }
.question { min-width: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; border: none; }
.question legend { padding: 0; margin-bottom: 4px; }
.question[hidden] { display: none; }

.result { display: flex; flex-direction: column; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.result-head {
  min-height: 52px; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; border-bottom: 1px solid var(--line);
}
.result-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; min-width: 0; }
.result-title h2 { font-size: 15px; }
.result-meta { color: var(--muted); font-size: 13px; }
.result-nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pass-link, .nav-button {
  height: 32px; padding: 0 10px; display: inline-flex; align-items: center; gap: 4px;
  border: 1px solid var(--control); border-radius: 8px; color: var(--text); font: 600 13px var(--sans);
  text-decoration: none; white-space: nowrap;
}
.pass-link { border-color: var(--line); color: var(--text-2); }
.pass-link[aria-current="true"] { border-color: var(--muted); color: var(--text); }
.pass-link:hover, .nav-button:hover { border-color: var(--muted); color: var(--text); }
.nav-button.is-disabled { opacity: 0.4; }
.result-html { padding: 12px; display: flex; flex-direction: column; gap: 8px; background: var(--bg); }
.result-field { color: var(--muted); font-size: 14px; }
.result-field span { color: var(--text); }
.result-html iframe { display: block; width: 100%; height: 560px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.doc { max-width: 720px; padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 8px; }
.doc-h { padding-top: 8px; color: var(--muted); font: 600 12px var(--sans); letter-spacing: 0.04em; text-transform: uppercase; }
.doc-p { color: var(--text-log); font-size: 14px; line-height: 1.55; text-wrap: pretty; }
.doc-li { display: grid; grid-template-columns: 12px minmax(0, 1fr); gap: 6px; color: var(--text-log); font-size: 14px; line-height: 1.5; }
.doc-li::before { content: "–"; color: var(--faint); }
.doc-li.is-nested { padding-left: 18px; }
.result-running { padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 10px; }
.running-line { display: flex; align-items: center; gap: 8px; color: var(--amber); font-size: 13px; }
.shimmer { display: block; height: 10px; border-radius: 4px; background: var(--line); animation: stShimmer 1.6s ease-in-out infinite; }
.shimmer:nth-of-type(1) { width: 92%; }
.shimmer:nth-of-type(2) { width: 78%; animation-delay: 0.15s; }
.shimmer:nth-of-type(3) { width: 85%; animation-delay: 0.3s; }
.shimmer:nth-of-type(4) { width: 40%; animation-delay: 0.45s; }
.result-note { padding: 16px 20px 20px; color: var(--text-2); font-size: 14px; line-height: 1.55; text-wrap: pretty; }

@media (prefers-reduced-motion: reduce) {
  .live-dot, .dot--running, .shimmer { animation: none; }
}

/* ---- Toasts: what an action did, or why it was refused ------------------- */

@keyframes stToastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.toasts {
  position: fixed; top: 16px; right: 16px; z-index: 10; display: flex; flex-direction: column; gap: 8px;
  width: min(380px, calc(100vw - 32px));
}
.toast {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 12px 14px;
  border: 1px solid var(--accent); border-left-width: 3px; border-radius: 10px; background: var(--surface);
  color: var(--text); font-size: 14px; line-height: 1.45; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  animation: stToastIn 0.25s ease-out;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.is-error { border-color: var(--error); }
.toast.is-leaving { opacity: 0; transform: translateY(-8px); }
button.toast-close {
  flex: none; height: auto; padding: 0 2px; border: none; background: none; color: var(--faint);
  font: 400 16px/1 var(--sans); cursor: pointer;
}
button.toast-close:hover { background: none; color: var(--text); }
@media (prefers-reduced-motion: reduce) {
  .toast { animation: none; transition: none; }
}
iframe.template-preview { width: 100%; height: 420px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }

/* ---- Export and import (redesign v2, ADR-078) ----------------------------- */

.dialog-backdrop {
  position: fixed; inset: 0; z-index: 30; display: flex; align-items: flex-start; justify-content: center;
  padding: 10vh 16px 16px; background: rgba(0, 0, 0, 0.6); overflow-y: auto;
}
.dialog {
  width: min(560px, 100%); padding: 20px; display: flex; flex-direction: column; gap: 14px;
  background: var(--surface); border: 1px solid var(--control); border-radius: 12px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}
dialog.dialog:not([open]) { display: none; }   /* `.dialog`'s display beats the browser's own */
.dialog:focus { outline: none; }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.dialog-head h2 { font-size: 18px; }
.dialog-close {
  width: 32px; height: 32px; flex: none; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--control); border-radius: 8px; color: var(--text-2); font-size: 18px; text-decoration: none;
}
.dialog-close:hover { background: var(--hover); color: var(--text); }
.dialog-text { color: var(--text-2); font-size: 14px; line-height: 1.5; }
.dialog-lines {
  list-style: none; margin: 0; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px;
  border: 1px solid var(--line); border-radius: 8px;
}
.dialog-lines li { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 8px; font-size: 14px; line-height: 1.45; }
.line-mark { color: var(--accent); font-weight: 600; }
.dialog-lines .is-out .line-mark { color: var(--muted); }
.dialog-lines .is-replaced .line-mark { color: var(--amber); }
.line-detail { color: var(--muted); font-size: 13px; }
.dialog-note { color: var(--muted); font-size: 13px; line-height: 1.5; }
.dialog-status { color: var(--accent); font-size: 14px; }
.dialog-actions { margin: 0; display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.dialog-actions .button-secondary, .page-actions .button-secondary {
  height: 40px; padding: 0 14px; display: inline-flex; align-items: center; gap: 6px; font-size: 14px;
}
.dialog-form { margin: 0; display: flex; flex-direction: column; gap: 14px; }
.button-danger.is-filled, button.button-danger.is-filled {
  border: 1px solid var(--error); background: var(--error); color: var(--bg);
}
button.button-danger.is-filled:hover { border-color: var(--error); background: var(--error); color: var(--bg); opacity: 0.9; }
.import-drop { padding: 20px; }
.import-drop label { height: 44px; padding: 0 16px; display: inline-flex; align-items: center; font-size: 14px; }
.drop-zone.is-invalid { border-color: var(--error); }
.drop-zone:focus-within label { outline: 2px solid var(--accent); outline-offset: 2px; }
.import-steps { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.import-steps li { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 14px; }
.import-steps li + li::before { content: "›"; color: var(--muted); }
.import-steps .step-number { width: 26px; height: 26px; font-size: 13px; }
.import-steps .is-current { color: var(--text); }
.import-steps .is-current .step-number { border-color: var(--accent); color: var(--accent); }
.import-steps .is-done .step-number { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.import-card { max-width: 760px; gap: 16px; }
.import-card p { font-size: 14px; line-height: 1.5; }
.import-actions { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.import-actions.is-start { justify-content: flex-start; }
.import-actions .button-secondary { height: 44px; padding: 0 16px; display: inline-flex; align-items: center; font-size: 14px; }
.import-actions .button { height: 44px; }
.import-renamed ul { margin: 6px 0 0; padding-left: 18px; font-size: 13px; }
.check-top { align-items: flex-start; }
.check-top input { margin-top: 3px; }
.import-done { flex-direction: row; gap: 14px; align-items: flex-start; }
.done-mark {
  width: 28px; height: 28px; flex: none; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--accent); color: var(--on-accent); font-weight: 700;
}
.import-done-text { display: flex; flex-direction: column; gap: 10px; }

/* ---- A contradiction to settle (redesign v2, ADR-079) --------------------- */

.choice { gap: 12px; }
.choice-ask { color: var(--text-2); font-size: 13px; font-weight: 600; }
.choice-cards { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.choice-card {
  padding: 12px 14px; display: flex; gap: 10px; align-items: flex-start; cursor: pointer;
  border: 1px solid var(--control); border-radius: 10px; background: var(--bg);
}
.choice-card:has(input:checked) { border-color: var(--accent); }
.choice-card input { margin-top: 3px; flex: none; }
.choice-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.choice-source { color: var(--muted); font-size: 12px; }
.choice-text { font-size: 14px; line-height: 1.45; }
.kb-origin { color: var(--amber); }
.kb-origin-line {
  margin: 14px 16px 0; padding: 8px 12px; border: 1px solid var(--amber); border-radius: 8px; color: var(--text-2);
  font-size: 13px; line-height: 1.45;
}

/* ---- The dashboard's calendar (ADR-080) ----------------------------------- */

.calendar { display: flex; flex-direction: column; gap: 12px; }
.calendar-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.calendar-head h2 { font-size: 18px; }
.calendar-nav { display: flex; gap: 8px; flex-wrap: wrap; }
.calendar-nav .button-secondary { display: inline-flex; align-items: center; gap: 6px; }
.cal { width: 100%; table-layout: fixed; border-collapse: collapse; background: var(--surface); }
.cal th {
  padding: 8px; color: var(--muted); font: 600 12px var(--sans); text-align: left; text-transform: uppercase;
  letter-spacing: 0.04em; border-bottom: 1px solid var(--line);
}
.cal th abbr { text-decoration: none; }
.cal td { height: 104px; padding: 6px; vertical-align: top; border: 1px solid var(--line); }
.cal td.is-out { background: var(--bg); }
.cal td.is-out .cal-number { color: var(--faint); }
.cal td.is-today { box-shadow: inset 0 0 0 1px var(--accent); }
.cal td.is-today .cal-number { color: var(--accent); font-weight: 700; }
.cal-number { display: block; margin-bottom: 4px; color: var(--text-2); font-size: 13px; }
.cal-label {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}
.cal-entries { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.cal-entry {
  min-height: 24px; padding: 2px 6px; display: flex; align-items: center; gap: 5px; min-width: 0;
  border: 1px solid transparent; border-radius: 6px; background: var(--hover); color: var(--text);
  font-size: 12px; text-decoration: none;
}
.cal-entry:hover { border-color: var(--control); color: var(--text); }
.cal-entry.is-planned { border: 1px dashed var(--control); background: none; color: var(--text-2); }
.cal-entry.is-missed { border-color: var(--amber); background: none; color: var(--text-2); }
.cal-mark { flex: none; color: var(--text-2); font-size: 11px; }
.cal-entry.tone-done .cal-mark { color: var(--accent); }
.cal-entry.tone-waiting .cal-mark, .cal-mark.is-missed, .cal-entry.is-missed .cal-mark { color: var(--amber); }
.cal-entry.tone-error .cal-mark { color: var(--error); }
.cal-time { flex: none; color: var(--muted); }
.cal-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-legend { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.cal-none { display: none; color: var(--muted); font-size: 14px; }

@media (max-width: 640px) {
  .cal, .cal tbody, .cal tr, .cal td { display: block; width: auto; }
  .cal { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
  .cal thead { display: none; }
  .cal td { height: auto; padding: 10px 12px; border: none; border-bottom: 1px solid var(--line); }
  .cal td.is-empty, .cal td.is-out { display: none; }
  .cal-number { display: none; }
  .cal-label { position: static; width: auto; height: auto; margin: 0 0 6px; overflow: visible; clip: auto;
    display: block; color: var(--text-2); font-size: 13px; font-weight: 600; white-space: normal; }
  .cal-entry { min-height: 32px; font-size: 13px; }
  .cal-none { display: block; }
}

/* ---- Deleting an automation (ADR-081) ------------------------------------- */

.menu-item.is-danger > span:first-child { color: var(--error); }
button.button-danger.is-filled[disabled] { opacity: 0.45; cursor: not-allowed; }
