/* OpenIA · administration, novembre 2026.
   Product shell in the familiar admin idiom: dark top bar, grey navigation,
   white cards on a light grey canvas, tinted status badges. */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/assets/openia/inter-latin.woff2") format("woff2");
}

:root {
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --canvas: #f1f1f1;
  --surface: #ffffff;
  --surface-soft: #f7f7f7;
  --surface-nav: #ebebeb;
  --surface-hover: #e3e3e3;

  --bar: #1a1a1a;
  --bar-field: #303030;
  --bar-line: #4a4a4a;
  --bar-text: #e3e3e3;
  --bar-muted: #b5b5b5;

  --ink: #303030;
  --ink-2: #616161;
  --ink-3: #6b6b6b;
  --line: #e3e3e3;
  --field-line: #8a8a8a;

  --brand: #314e3e;
  --link: #005bd3;
  --focus: #005bd3;

  --success-bg: #cdfee1; --success: #0c5132; --success-dot: #29845a;
  --info-bg: #e0f0ff;    --info: #00527c;    --info-dot: #0094d5;
  --warning-bg: #ffef9d; --warning: #4f4700; --warning-dot: #b28400;
  --critical-bg: #fedad9; --critical: #8e0b21; --critical-dot: #e51c00;
  --neutral-bg: #e3e3e3; --neutral: #4a4a4a; --neutral-dot: #8a8a8a;

  --card-shadow: 0 0 0 1px rgba(26, 26, 26, 0.07), 0 1px 0 rgba(26, 26, 26, 0.07), 0 1px 2px rgba(26, 26, 26, 0.04);
  --pop-shadow: 0 0 0 1px rgba(26, 26, 26, 0.08), 0 8px 24px rgba(26, 26, 26, 0.16);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font: 400 13px/20px var(--font);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
[hidden] { display: none !important; }
h1, h2, h3, h4, p, ol, ul, dl, dd, figure { margin: 0; }
img, svg, video { display: block; max-width: 100%; }
a { color: var(--link); }
button, input, select, textarea { font: inherit; color: inherit; }
code, pre, kbd { font-family: var(--mono); }
code { font-size: 12px; background: var(--surface-soft); border-radius: 4px; padding: 1px 4px; }
pre { font-size: 12px; line-height: 18px; white-space: pre-wrap; overflow-wrap: anywhere; }
::selection { background: #cfe3ff; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
[tabindex="-1"]:focus { outline: none; }

.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icon-small { width: 14px; height: 14px; }
.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.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; }
.skip-link { position: absolute; left: 12px; top: -120px; z-index: 100; padding: 8px 12px; border-radius: 8px; background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: var(--pop-shadow); }
.skip-link:focus { top: 12px; }
.noscript { margin: 24px; padding: 16px; border-radius: 12px; background: var(--surface); box-shadow: var(--card-shadow); }

/* Brand */
.brand { display: inline-flex; align-items: center; gap: 10px; min-width: 0; color: #fff; text-decoration: none; white-space: nowrap; }
.brand-mark { display: grid; place-items: center; width: 28px; height: 28px; flex: none; border-radius: 8px; background: var(--brand); color: #fff; font-weight: 700; font-size: 14px; }
.brand-name { font-weight: 650; letter-spacing: 0.02em; }
.brand-product { color: var(--bar-muted); font-weight: 500; }
.brand-on-light { color: var(--ink); }
.brand-on-light .brand-product { color: var(--ink-2); }

/* Buttons */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 32px; padding: 0 12px; border: 0; border-radius: 8px;
  font: 600 13px/20px var(--font); text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background-color 150ms var(--ease), box-shadow 150ms var(--ease), transform 120ms var(--ease);
}
.button .icon { width: 16px; height: 16px; }
.button:active:not(:disabled) { transform: scale(0.98); }
.button-primary {
  background: var(--ink); color: #fff;
  box-shadow: inset 0 -1px 0 1px rgba(0, 0, 0, 0.8), inset 0 0 0 1px var(--ink), inset 0 0.5px 0 1.5px rgba(255, 255, 255, 0.25);
}
.button-primary:hover:not(:disabled) { background: #1a1a1a; }
.button-secondary, .quiet-button {
  background: var(--surface); color: var(--ink);
  box-shadow: inset 0 -1px 0 0 #b5b5b5, inset 0 0 0 1px rgba(0, 0, 0, 0.1), inset 0 0.5px 0 1.5px #fff;
}
.button-secondary:hover:not(:disabled), .quiet-button:hover:not(:disabled) { background: var(--surface-soft); }
.button-plain, .text-button {
  display: inline-flex; align-items: center; gap: 4px; min-height: 28px; padding: 0 4px;
  border: 0; border-radius: 6px; background: none; color: var(--link);
  font: 550 13px/20px var(--font); text-decoration: none; cursor: pointer;
}
.button-plain:hover:not(:disabled), .text-button:hover:not(:disabled) { text-decoration: underline; }
.button:disabled, .text-button:disabled, .button-plain:disabled { background: var(--surface-nav); color: #a6a6a6; box-shadow: none; cursor: not-allowed; }
.text-button:disabled, .button-plain:disabled { background: none; }
.button-full { width: 100%; }

/* Badges: one vocabulary for agent, mission and service states */
.badge, .capability-status {
  display: inline-flex; align-items: center; gap: 6px; min-height: 20px; padding: 0 8px;
  border-radius: 8px; background: var(--neutral-bg); color: var(--neutral);
  font: 550 12px/16px var(--font); white-space: nowrap; flex: none;
}
.badge::before, .capability-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--neutral-dot); }
.badge-success, .status-available, .status-on { background: var(--success-bg); color: var(--success); }
.badge-success::before, .status-available::before, .status-on::before { background: var(--success-dot); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-info::before { background: var(--info-dot); }
.badge-warning, .status-partial { background: var(--warning-bg); color: var(--warning); }
.badge-warning::before, .status-partial::before { background: var(--warning-dot); }
.badge-critical, .status-failed { background: var(--critical-bg); color: var(--critical); }
.badge-critical::before, .status-failed::before { background: var(--critical-dot); }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--neutral-dot); }
.dot-success { background: var(--success-dot); }
.dot-info { background: var(--info-dot); }
.dot-warning { background: var(--warning-dot); }

/* Login */
.login { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; padding: 48px 16px; }
.login-card { width: min(100%, 420px); padding: 32px; border-radius: 16px; background: var(--surface); box-shadow: var(--card-shadow); }
.login-card .brand { margin-bottom: 32px; }
.login-card h1 { font-size: 20px; line-height: 28px; font-weight: 700; }
.login-lead { margin-top: 4px; color: var(--ink-2); }
.login-card form { margin-top: 20px; }
.login-card .button-full { margin-top: 20px; min-height: 36px; }
.login-hint { margin-top: 16px; color: var(--ink-2); font-size: 12px; line-height: 16px; }
.login-footer { color: var(--ink-2); font-size: 12px; }

/* App shell */
.app {
  min-height: 100vh; display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  grid-template-rows: 56px 1fr;
  grid-template-areas: "top top" "side main";
}
.topbar {
  grid-area: top; position: sticky; top: 0; z-index: 40;
  display: grid; grid-template-columns: 228px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  height: 56px; padding: 0 12px 0 16px; background: var(--bar); color: var(--bar-text);
}
.topbar-menu { display: none; width: 36px; height: 36px; place-items: center; border: 0; border-radius: 8px; background: none; color: var(--bar-text); cursor: pointer; }
.topbar-menu:hover { background: var(--bar-field); }
.global-search {
  position: relative; justify-self: center; width: min(100%, 560px);
  display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 8px 0 10px;
  border-radius: 10px; background: var(--bar-field); box-shadow: inset 0 0 0 1px var(--bar-line); color: var(--bar-muted);
}
.global-search:focus-within { box-shadow: inset 0 0 0 1px var(--bar-muted); }
.global-search .icon { width: 18px; height: 18px; }
#global-search, #global-search:hover, #global-search:focus { display: block; flex: 1; min-width: 0; height: 34px; min-height: 0; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; color: #fff; outline: none; }
#global-search::placeholder { color: var(--bar-muted); }
#global-search::-webkit-search-cancel-button { display: none; }
.global-search kbd { padding: 2px 6px; border-radius: 4px; background: var(--bar-line); color: var(--bar-text); font: 500 11px/16px var(--font); }
.search-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 50;
  max-height: min(420px, 70vh); overflow-y: auto; padding: 6px;
  border-radius: 12px; background: var(--surface); box-shadow: var(--pop-shadow); color: var(--ink);
}
.search-result {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 6px 8px;
  border: 0; border-radius: 8px; background: none; color: var(--ink); text-align: left; text-decoration: none; cursor: pointer;
}
.search-result:hover, .search-result:focus-visible { background: var(--surface-soft); outline: none; }
.search-result .icon { width: 18px; height: 18px; color: var(--ink-2); }
.search-result img { width: 20px; height: 20px; border-radius: 6px; object-fit: cover; object-position: 50% 0; }
.search-result span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.search-result small { color: var(--ink-2); }
.search-empty { padding: 10px 8px; color: var(--ink-2); }
.topbar-right { display: flex; align-items: center; gap: 16px; justify-self: end; min-width: 0; }
.topbar-status { display: inline-flex; align-items: center; gap: 8px; color: var(--bar-muted); white-space: nowrap; }
.topbar-status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--neutral-dot); }
.topbar-status[data-status="ready"]::before { background: #36c07b; }
.topbar-status[data-status="offline"]::before { background: #ff7a5c; }
.topbar-link { display: inline-flex; align-items: center; gap: 4px; color: var(--bar-text); text-decoration: none; font-weight: 550; }
.topbar-link:hover { color: #fff; text-decoration: underline; }
.account { display: flex; align-items: center; gap: 8px; color: var(--bar-text); }
.account-mark { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: #c9f2d8; color: var(--success); font-weight: 650; }
.account-name { font-weight: 550; white-space: nowrap; }
.account-logout { display: grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 8px; background: none; color: var(--bar-muted); cursor: pointer; }
.account-logout:hover { background: var(--bar-field); color: #fff; }
.account-logout .icon { width: 18px; height: 18px; }

.sidebar {
  grid-area: side; position: sticky; top: 56px; height: calc(100vh - 56px); overflow-y: auto;
  display: flex; flex-direction: column; padding: 12px 8px 12px; background: var(--surface-nav);
}
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-link {
  display: flex; align-items: center; gap: 10px; min-height: 32px; padding: 0 8px 0 10px; border-radius: 8px;
  color: var(--ink); font-weight: 550; text-decoration: none;
}
.nav-link .icon { width: 18px; height: 18px; color: #4a4a4a; }
.nav-link:hover { background: var(--surface-hover); }
.nav-link.is-active { background: var(--surface); font-weight: 650; box-shadow: var(--card-shadow); }
.nav-link.is-active .icon { color: var(--ink); }
.nav-count { margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--info-bg); color: var(--info); font-size: 12px; line-height: 20px; font-weight: 600; text-align: center; }
.nav-count:empty { display: none; }
.nav-tag { margin-left: auto; color: var(--ink-2); font-size: 12px; font-weight: 500; }
.nav-section { display: flex; justify-content: space-between; align-items: center; padding: 20px 10px 6px; color: var(--ink-2); font-weight: 550; }
.nav-section h2 { font-size: 13px; font-weight: 550; }
.nav-team { display: flex; flex-direction: column; gap: 2px; }
.nav-loading { padding: 4px 10px; color: var(--ink-2); }
.nav-agent {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 32px; padding: 0 10px 0 8px;
  border: 0; border-radius: 8px; background: none; color: var(--ink); text-align: left; cursor: pointer;
}
.nav-agent:hover { background: var(--surface-hover); }
[data-view="agent"] .nav-agent.is-selected { background: var(--surface); box-shadow: var(--card-shadow); font-weight: 600; }
.nav-agent img { width: 24px; height: 24px; border-radius: 6px; }
.nav-agent-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-bottom { margin-top: auto; padding-top: 16px; }
.nav-backdrop { display: none; }

/* Portrait crops: the characters are full-body renders */
.nav-agent img, .avatar, .who img, .search-result img {
  object-fit: cover; object-position: 50% 0; background: #dedede;
  object-view-box: inset(0% 12% 58% 12%);
}
.nav-agent img[src$="agent-g.png"], .avatar[src$="agent-g.png"], .who img[src$="agent-g.png"], .search-result img[src$="agent-g.png"] { object-view-box: inset(1% 33% 70% 33%); }

.main { grid-area: main; min-width: 0; padding: 24px 32px 64px; }
.main:focus { outline: none; }
.page { max-width: 1120px; margin: 0 auto; }
.page-narrow { max-width: 720px; }
.page > * + * { margin-top: 16px; }
.page > .page-header + *, .page > .page-intro + * { margin-top: 0; }
.main > .banner { max-width: 1120px; margin: 0 auto 16px; }

.page-header { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; min-height: 32px; margin-bottom: 16px; }
.page-header h1 { font-size: 20px; line-height: 28px; font-weight: 700; letter-spacing: -0.01em; }
.page-header-sub { margin-top: 32px !important; margin-bottom: 8px; }
.page-header-sub h2 { font-size: 16px; line-height: 24px; font-weight: 650; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.page-meta { color: var(--ink-2); }
.page-intro { max-width: 76ch; margin-bottom: 16px; color: var(--ink-2); }
.page-note { color: var(--ink-2); }
.back-link { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; color: var(--ink); }
.back-link:hover { background: var(--surface-hover); }
.back-link .icon { width: 18px; height: 18px; }

.layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 16px; align-items: start; }
.layout-even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.layout-main, .layout-aside { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

/* Cards */
.card { min-width: 0; border-radius: 12px; background: var(--surface); box-shadow: var(--card-shadow); overflow: hidden; }
.card-padded { padding: 16px; }
.card-header { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 12px 16px; }
.card-header h2, .card-padded > h2, .card-title-row h2 { font-size: 14px; line-height: 20px; font-weight: 650; }
.card-header .button-plain { margin-left: auto; }
.card-link { margin-left: auto; color: var(--link); font-weight: 550; text-decoration: none; }
.card-link:hover { text-decoration: underline; }
.card-meta { margin-left: auto; color: var(--ink-2); }
.card-intro { padding: 0 16px 12px; color: var(--ink-2); }
.card-intro-flush { margin: 4px 0 12px; color: var(--ink-2); }
.card-title-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.card-title-row .text-button { margin-left: auto; }
.card-padded > h2 + * { margin-top: 8px; }
.card-padded > p + p { margin-top: 8px; }
.card-padded form { margin-top: 12px; }
.card-padded > form:first-child { margin-top: 0; }
.explainer h2 { margin-bottom: 8px; }
.explainer ol { padding-left: 20px; color: var(--ink); }
.explainer li + li { margin-top: 4px; }
.explainer p { margin-top: 12px; color: var(--ink-2); }

/* Banners */
.banner { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; border-radius: 12px; background: var(--surface); box-shadow: var(--card-shadow); }
.banner .icon { width: 18px; height: 18px; margin-top: 1px; }
.banner strong { font-weight: 650; }
.banner-warning { background: #fff8db; box-shadow: inset 0 0 0 1px #ffe58f; color: #4f4700; }
.banner-warning .icon { color: #946e00; }
.banner-critical { background: #fff0ef; box-shadow: inset 0 0 0 1px #fdc4c0; color: var(--critical); }

/* Home */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stat { padding: 12px 16px; border-left: 1px solid var(--line); min-width: 0; }
.stat:first-child { border-left: 0; }
.stat-label { color: var(--ink-2); font-weight: 550; }
.stat-value { display: block; margin-top: 4px; font-size: 20px; line-height: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.stat-value-text { font-size: 15px; font-weight: 650; }
.segmented { display: flex; gap: 4px; padding: 0 8px 8px; overflow-x: auto; }
.segmented button { min-height: 28px; padding: 0 10px; border: 0; border-radius: 8px; background: none; color: var(--ink-2); font-weight: 550; white-space: nowrap; cursor: pointer; }
.segmented button:hover { background: var(--surface-soft); color: var(--ink); }
.segmented button[aria-pressed="true"] { background: var(--surface-hover); color: var(--ink); }
.table-wrap { border-top: 1px solid var(--line); overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { padding: 8px 16px; background: var(--surface-soft); border-bottom: 1px solid var(--line); color: var(--ink-2); font-weight: 550; text-align: left; white-space: nowrap; }
.table td { padding: 8px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-soft); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table td.col-date { color: var(--ink-2); white-space: nowrap; }
.table-link { padding: 0; border: 0; background: none; font-weight: 600; text-align: left; cursor: pointer; }
.table-link:hover { text-decoration: underline; }
.who { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.who img { width: 24px; height: 24px; border-radius: 6px; }
.empty-inline { padding: 16px; color: var(--ink-2); }
.empty-inline a { font-weight: 550; }

/* Rows: team, services, mini-agents */
.rows { display: flex; flex-direction: column; padding: 0 8px 8px; }
.row {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 8px;
  border: 0; border-radius: 8px; background: none; color: var(--ink); text-align: left; text-decoration: none; cursor: pointer;
}
.row:hover { background: var(--surface-soft); }
.row.is-selected { background: var(--surface-soft); box-shadow: inset 0 0 0 1px var(--line); }
.row .badge { margin-left: auto; }
.avatar { width: 32px; height: 32px; border-radius: 8px; flex: none; }
.row-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--surface-soft); color: var(--ink-2); flex: none; box-shadow: inset 0 0 0 1px var(--line); }
.row-icon .icon { width: 18px; height: 18px; }
.row-text { display: flex; flex-direction: column; min-width: 0; }
.row-text strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-text small { color: var(--ink-2); font-size: 12px; line-height: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Agent page */
.agent-profile { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 20px; align-items: start; }
.agent-portrait { width: 120px; height: 170px; object-fit: contain; object-position: 50% 100%; border-radius: 12px; background: var(--surface-soft); box-shadow: inset 0 0 0 1px var(--line); padding: 8px; }
.agent-title-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.agent-title-row h2 { font-size: 16px; line-height: 24px; font-weight: 650; }
.agent-role { color: var(--ink-2); }
.agent-description { margin-top: 8px; max-width: 64ch; }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; margin-top: 16px; padding: 12px; border-radius: 8px; background: var(--surface-soft); }
.facts dt { color: var(--ink-2); font-size: 12px; line-height: 16px; }
.facts dd { font-weight: 550; overflow-wrap: anywhere; }
.agent-note { margin-top: 12px; color: var(--ink-2); }
.agent-note-live { color: var(--info); font-weight: 550; }
.phone-channel { margin-top: 12px; padding: 12px; border-radius: 8px; box-shadow: inset 0 0 0 1px var(--line); }
.phone-channel p { margin-top: 4px; color: var(--ink-2); }
.phone-channel ul { margin-top: 8px; padding-left: 20px; }
details > summary { cursor: pointer; font-weight: 550; }
.phone-channel details { margin-top: 8px; }

.capability-groups { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.capability-group { padding: 12px 16px 16px; border-left: 1px solid var(--line); min-width: 0; }
.capability-group:first-child { border-left: 0; }
.capability-group h3 { margin-bottom: 4px; color: var(--ink-2); font-size: 12px; line-height: 16px; font-weight: 600; }
.capability-item { border-bottom: 1px solid var(--line); }
.capability-item:last-child { border-bottom: 0; }
.capability-item summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 40px; list-style: none; font-weight: 550; }
.capability-item summary::-webkit-details-marker { display: none; }
.capability-item p { padding-bottom: 12px; color: var(--ink-2); }

/* Forms */
label { display: block; margin: 12px 0 4px; font-weight: 550; }
form > label:first-child, .media-fields label { margin-top: 0; }
input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  display: block; width: 100%; min-height: 32px; padding: 5px 12px;
  border: 1px solid var(--field-line); border-top-color: #898f94; border-radius: 8px;
  background: #fdfdfd; line-height: 20px;
  transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease);
}
textarea { resize: vertical; min-height: 80px; }
select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23616161' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
input:hover:not(:disabled):not(:focus), select:hover:not(:disabled):not(:focus), textarea:hover:not(:disabled):not(:focus) { border-color: #616161; background-color: #fafafa; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 1px var(--focus); }
input:disabled, select:disabled, textarea:disabled { background-color: var(--surface-soft); border-color: var(--line); color: #8a8a8a; cursor: not-allowed; }
::placeholder { color: #8a8a8a; }
input[type="checkbox"] { width: 16px; height: 16px; margin: 0; accent-color: var(--ink); }
fieldset { margin: 12px 0 0; padding: 8px 12px 12px; border: 1px solid var(--line); border-radius: 8px; }
legend { padding: 0 4px; font-weight: 550; }
.field-note { margin-top: 4px; color: var(--ink-2); font-size: 12px; line-height: 16px; }
.form-error { margin-top: 8px; color: var(--critical); font-weight: 550; }
.form-error:empty, .project-message:empty, .inline-message:empty { display: none; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.form-actions-start { justify-content: flex-start; }
.inline-message { color: var(--ink-2); }
.project-message { margin-top: 8px; color: var(--ink); font-weight: 550; }
.project-observation { margin-top: 6px; color: var(--ink-2); font-size: 12px; line-height: 16px; }
.project-empty { padding: 16px; color: var(--ink-2); }

/* Empty states */
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 48px 24px; text-align: center; }
.empty-state h2 { font-size: 16px; line-height: 24px; font-weight: 650; }
.empty-state p { max-width: 52ch; color: var(--ink-2); }
.empty-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px; background: var(--surface-soft); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line); }
.empty-runs { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 20px 16px; }
.empty-runs h3 { font-size: 14px; font-weight: 650; }
.empty-runs p { color: var(--ink-2); }
.empty-runs .button { margin-top: 6px; }

/* Missions */
.run-list { display: flex; flex-direction: column; padding: 8px; }
.run-row, .work-job {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 8px;
  border: 0; border-radius: 8px; background: none; color: var(--ink); text-align: left; cursor: pointer;
}
.run-row + .run-row, .work-job + .work-job { box-shadow: 0 -1px 0 var(--line); }
.run-row:hover, .work-job:hover { background: var(--surface-soft); }
.run-row.is-selected, .work-job.is-selected { background: var(--surface-soft); box-shadow: inset 0 0 0 1px #cccccc; }
.run-row .badge, .work-job .capability-status { margin-left: auto; }
.work-job > span:first-child { display: flex; flex-direction: column; min-width: 0; }
.work-job small { color: var(--ink-2); font-size: 12px; line-height: 16px; }
.result-card { position: sticky; top: 72px; }
.result-heading { margin-bottom: 12px; }
.result-heading .card-title-row { margin-bottom: 2px; }
.result-heading h2, .result-heading h3 { font-size: 16px; line-height: 24px; font-weight: 650; }
.result-heading p { color: var(--ink-2); }
.result-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.result-heading p:empty, .result-text:empty { display: none; }
.result-step { margin-top: 8px; border-radius: 8px; box-shadow: inset 0 0 0 1px var(--line); }
.result-step summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 40px; padding: 8px 12px; }
.result-step summary span { color: var(--ink-2); font-weight: 500; }
.result-step .result-text { padding: 0 12px 12px; }
.result-card > .button, .result-card > .form-error { margin-top: 12px; }

/* Projects */
.github-connection details { margin-top: 12px; }
.github-connection ul { margin-top: 8px; padding-left: 20px; }
.projects-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.projects-list > .empty-runs { grid-column: 1 / -1; border-radius: 12px; background: var(--surface); box-shadow: var(--card-shadow); }
.project-card { display: flex; flex-direction: column; border-radius: 12px; background: var(--surface); box-shadow: var(--card-shadow); overflow: hidden; }
.project-card-main { display: flex; flex-direction: column; gap: 4px; padding: 16px; border: 0; background: none; text-align: left; cursor: pointer; }
.project-card-main:hover { background: var(--surface-soft); }
.project-card-main[aria-pressed="true"] { box-shadow: inset 3px 0 0 var(--ink); }
.project-card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.project-card-top strong { font-weight: 650; overflow-wrap: anywhere; }
.project-visibility { display: inline-flex; align-items: center; min-height: 20px; padding: 0 8px; border-radius: 8px; background: var(--neutral-bg); color: var(--neutral); font-size: 12px; font-weight: 550; white-space: nowrap; }
.project-branch, .project-card-meta { color: var(--ink-2); font-size: 12px; line-height: 16px; }
.project-commit { font-family: var(--mono); font-size: 12px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-card-actions { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: auto; padding: 8px 12px; border-top: 1px solid var(--line); }
.project-detail-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.project-detail-heading h2 { font-size: 16px; line-height: 24px; font-weight: 650; overflow-wrap: anywhere; }
.project-tabs { display: flex; gap: 4px; margin: 12px 0 8px; overflow-x: auto; }
.project-tabs button { min-height: 28px; padding: 0 10px; border: 0; border-radius: 8px; background: none; color: var(--ink-2); font-weight: 550; white-space: nowrap; cursor: pointer; }
.project-tabs button[aria-selected="true"] { background: var(--surface-hover); color: var(--ink); }
.project-records { list-style: none; padding: 0; border-radius: 8px; box-shadow: inset 0 0 0 1px var(--line); }
.project-records li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.project-records li:last-child { border-bottom: 0; }
.project-records li > div { display: flex; flex-direction: column; min-width: 0; }
.project-records small { color: var(--ink-2); font-size: 12px; }
.project-detail > .text-button { margin-top: 8px; }
.project-mission-preview { margin-top: 16px; padding: 12px; border-radius: 8px; background: var(--surface-soft); }
.project-mission-preview h3 { font-size: 13px; font-weight: 650; margin-bottom: 4px; }
.work-panel #project-execute { margin-top: 16px; }
.work-history .card-header { border-bottom: 1px solid var(--line); }
.work-jobs { padding: 8px; }
.work-detail { padding: 16px; border-top: 1px solid var(--line); }
.work-detail > * + * { margin-top: 8px; }
.work-progress { display: flex; align-items: center; gap: 8px; }
.work-progress progress { flex: 1; height: 8px; accent-color: var(--ink); }
.work-issue { padding: 8px 12px; border-radius: 8px; background: var(--warning-bg); color: var(--warning); }
.work-artifacts, .work-verification { padding: 12px; border-radius: 8px; box-shadow: inset 0 0 0 1px var(--line); }
.work-artifacts h4, .work-verification h4 { font-size: 13px; font-weight: 650; margin: 8px 0 4px; }
.work-code { margin-top: 8px; padding: 12px; border-radius: 8px; background: #1a1a1a; color: #e3e3e3; overflow-x: auto; white-space: pre; }
.work-code code { background: none; padding: 0; color: inherit; }
.work-file { margin-top: 8px; }

/* Research */
.research-sources { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-top: 12px; }
.source-card { padding: 12px; border-radius: 8px; box-shadow: inset 0 0 0 1px var(--line); }
.source-card .eyebrow { color: var(--ink-2); font-size: 12px; line-height: 16px; }
.source-card h4 { margin: 2px 0 4px; font-size: 13px; font-weight: 650; overflow-wrap: anywhere; }
.source-card p { color: var(--ink); }
.source-card small { display: block; margin-top: 6px; color: var(--ink-2); font-size: 12px; }

/* Models and media */
.model-families { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.model-family { padding: 16px; border-radius: 12px; background: var(--surface); box-shadow: var(--card-shadow); }
.model-family h3 { font-size: 14px; font-weight: 650; margin-bottom: 8px; }
.model-variant { padding: 12px 0; border-top: 1px solid var(--line); }
.model-variant > div:first-child { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.model-variant h4 { font-size: 13px; font-weight: 650; }
.model-variant > code { display: inline-block; margin-top: 4px; }
.model-variant dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.model-variant dt { color: var(--ink-2); font-size: 12px; line-height: 16px; }
.model-variant dd { font-weight: 550; overflow-wrap: anywhere; }
.media-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 4px; }
.media-generations { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.media-generation { padding: 16px; border-radius: 12px; background: var(--surface); box-shadow: var(--card-shadow); }
.media-generation-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.media-generation-heading small { color: var(--ink-2); }
.media-generation-heading .text-button { margin-left: auto; }
.media-outputs { display: grid; gap: 8px; margin-top: 12px; }
.media-output { display: block; width: 100%; border-radius: 8px; overflow: hidden; background: var(--surface-soft); }
.media-output img, video.media-output { width: 100%; height: auto; }
.media-catalog { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.media-catalog:empty, .media-generations:empty, .brief-presets:empty { display: none; }
.media-card { padding: 16px; border-radius: 12px; background: var(--surface); box-shadow: var(--card-shadow); }
.media-card > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.media-card h4 { font-size: 13px; font-weight: 650; }
.media-card small { display: block; margin-top: 6px; color: var(--ink-2); font-size: 12px; }
.brief-presets { padding: 16px; border-radius: 12px; background: var(--surface); box-shadow: var(--card-shadow); }
.brief-presets h3 { font-size: 14px; font-weight: 650; }
.brief-presets p { margin-top: 4px; color: var(--ink-2); }
.brief-presets ul { margin-top: 8px; padding-left: 20px; }
.brief-presets li strong { margin-right: 8px; }
.brief-presets li span { color: var(--ink-2); }

/* Skills */
.skill-board { align-items: start; }
.skill-library .card-header { border-bottom: 1px solid var(--line); }
.skill-list { display: flex; flex-direction: column; padding: 8px; }
.skill-card { display: flex; align-items: center; gap: 12px; padding: 4px 8px 4px 0; border-radius: 8px; }
.skill-card + .skill-card { box-shadow: 0 -1px 0 var(--line); }
.skill-card:hover { background: var(--surface-soft); }
.skill-card.is-selected { background: var(--surface-soft); box-shadow: inset 0 0 0 1px #cccccc; }
.skill-card.is-off .skill-open strong, .skill-card.is-off .skill-desc { color: var(--ink-2); }
.skill-open { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; padding: 8px; border: 0; border-radius: 8px; background: none; text-align: left; cursor: pointer; }
.skill-open strong { font-weight: 650; }
.skill-desc { color: var(--ink-2); }
.skill-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.skill-chip { display: inline-flex; align-items: center; min-height: 20px; padding: 0 8px; border-radius: 8px; background: var(--neutral-bg); color: var(--neutral); font-size: 12px; font-weight: 550; }
.skill-chip.is-own { background: var(--info-bg); color: var(--info); }
.skill-switch {
  position: relative; width: 36px; height: 20px; flex: none; border: 0; border-radius: 10px;
  background: #b5b5b5; cursor: pointer; transition: background-color 150ms var(--ease);
}
.skill-switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); transition: transform 180ms var(--ease); }
.skill-switch[aria-checked="true"] { background: var(--ink); }
.skill-switch[aria-checked="true"]::after { transform: translateX(16px); }
.skill-switch:disabled { opacity: 0.5; cursor: wait; }
.skill-detail { position: sticky; top: 72px; }
.skill-detail-empty h3, .skill-detail-head h3 { font-size: 14px; font-weight: 650; }
.skill-detail-empty p { margin-top: 4px; color: var(--ink-2); }
.skill-detail-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.skill-detail dl { margin-top: 12px; }
.skill-detail dl > div { padding: 10px 0; border-top: 1px solid var(--line); }
.skill-detail dt { color: var(--ink-2); font-size: 12px; line-height: 16px; font-weight: 550; }
.skill-detail dd { margin-top: 2px; overflow-wrap: anywhere; }
.skill-detail dd ul { padding-left: 18px; }
.skill-detail pre { margin-top: 8px; padding: 12px; border-radius: 8px; background: var(--surface-soft); max-height: 360px; overflow: auto; }
.skill-card-actions { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.skill-agents #skill-agents { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 6px 12px; }
.skill-agents label { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 500; }
.skill-endpoints { display: grid; gap: 8px; margin-top: 12px; }
.skill-endpoints small { color: var(--ink-2); font-size: 12px; }
.skill-endpoints pre { margin-top: 2px; padding: 8px 12px; border-radius: 8px; background: var(--surface-soft); }
.skill-token-form { margin-top: 12px; }
.skill-token-row { display: flex; gap: 8px; }
.skill-token-row input { flex: 1; }
.skill-token-once { margin-top: 12px; padding: 12px; border-radius: 8px; background: var(--success-bg); color: var(--success); }
.skill-token-once code { display: block; margin: 8px 0; padding: 8px; background: #fff; color: var(--ink); overflow-wrap: anywhere; }
.skill-tokens { margin-top: 12px; }
.skill-tokens .project-empty { padding: 8px 0; }
.skill-token { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.skill-token small { color: var(--ink-2); }
.skill-token .text-button { margin-left: auto; }

/* WhatsApp */
#whatsapp-setup { margin-top: 12px; }
#whatsapp-setup ol { padding-left: 20px; }
.channel-help { color: var(--ink-2); }
.channel-technical { margin-top: 8px; }
.channel-technical ol { margin-top: 8px; padding-left: 20px; }
.webhook-address { margin-top: 8px; overflow-wrap: anywhere; }

/* Améliorations */
.improvement-filters { padding-top: 8px; }
.improvement-facts { margin-top: 12px; }
.improvement-facts:empty { display: none; }
.facts-block { padding: 10px 12px; border-radius: 8px; background: var(--surface-soft); }
.facts-block dt { color: var(--ink-2); font-size: 12px; line-height: 16px; font-weight: 550; }
.result-card h3 { margin-top: 16px; font-size: 13px; font-weight: 650; }
.improvement-log { margin-top: 12px; }
.improvement-log pre { margin-top: 8px; padding: 12px; border-radius: 8px; background: #1a1a1a; color: #e3e3e3; max-height: 320px; overflow: auto; white-space: pre-wrap; }
.improvement-edit label:first-child { margin-top: 0; }

/* Discussion */
.page-wide { max-width: 1280px; }
.chat-layout { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: start; }
.chat-list { position: sticky; top: 72px; max-height: calc(100vh - 96px); display: flex; flex-direction: column; }
.chat-list .card-header .button { margin-left: auto; }
.chat-list #chat-conversations { overflow-y: auto; }
.chat-new-form { padding: 0 16px 16px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.chat-conversation .badge { margin-left: auto; }
.chat-thread-card { display: flex; flex-direction: column; }
.chat-header { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.chat-header h2 { font-size: 14px; line-height: 20px; font-weight: 650; }
.chat-header p { color: var(--ink-2); font-size: 12px; line-height: 16px; }
.chat-back { display: none; }
.chat-thread { flex: none; display: flex; flex-direction: column; gap: 16px; padding: 16px; overflow-y: auto; height: calc(100vh - 430px); min-height: 260px; background: var(--surface-soft); }
.chat-empty { margin: auto; background: none; }
.bubble-row { display: flex; align-items: flex-start; gap: 10px; max-width: 760px; }
.bubble-row.is-owner { align-self: flex-end; justify-content: flex-end; }
.bubble-row .avatar { margin-top: 2px; }
.bubble { min-width: 0; padding: 10px 12px; border-radius: 12px; background: var(--surface); box-shadow: var(--card-shadow); }
.is-owner .bubble { background: #303030; color: #fff; box-shadow: none; }
.is-owner .bubble small { color: #cfcfcf; }
.bubble small { display: block; margin-top: 4px; color: var(--ink-2); font-size: 12px; line-height: 16px; }
.bubble-author { display: block; margin-bottom: 2px; font-weight: 650; }
.bubble-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-plan { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; padding: 10px 12px; border-radius: 8px; background: var(--surface-soft); list-style: none; }
.chat-plan li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 8px; }
.chat-plan li + li { padding-top: 8px; border-top: 1px solid var(--line); }
.plan-agent { font-weight: 600; }
.chat-plan .badge { grid-column: 2; grid-row: 1; }
.plan-text { grid-column: 1 / -1; color: var(--ink-2); }
.action-card { margin-top: 10px; padding: 10px 12px; border-radius: 8px; box-shadow: inset 0 0 0 1px var(--line); background: var(--surface); }
.action-card.is-refused, .action-card.is-undone { background: var(--surface-soft); }
.action-main { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.action-label { font-weight: 600; }
.action-reason { margin-top: 4px; color: var(--ink-2); }
.action-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 8px; }
.chat-status { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-top: 1px solid var(--line); color: var(--ink); }
.chat-status .button-plain { margin-left: auto; }
.dot-critical { background: var(--critical-dot); }
.chat-live { animation: chat-pulse 1.6s var(--ease) infinite; }
@keyframes chat-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.chat-form { padding: 12px 16px 16px; border-top: 1px solid var(--line); }
.chat-form-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.chat-form-row label { margin: 0; color: var(--ink-2); }
.chat-form-row select { width: auto; min-width: 240px; }
.chat-form textarea { min-height: 72px; }
.chat-form-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }

@media (max-width: 900px) {
  .chat-layout { grid-template-columns: minmax(0, 1fr); }
  .chat-list { position: static; max-height: none; }
  .chat-layout .chat-thread-card { display: none; }
  .chat-layout.is-thread .chat-thread-card { display: flex; }
  .chat-layout.is-thread .chat-list { display: none; }
  .chat-back { display: grid; }
  .chat-thread { height: auto; max-height: none; }
  .chat-form-actions { flex-direction: column; align-items: stretch; }
  .chat-form-row select { flex: 1; min-width: 0; }
}

@media (max-width: 1100px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .result-card, .skill-detail { position: static; }
  .capability-groups { grid-template-columns: minmax(0, 1fr); }
  .capability-group { border-left: 0; border-top: 1px solid var(--line); }
  .capability-group:first-child { border-top: 0; }
}

@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "main"; }
  .topbar { grid-template-columns: auto auto minmax(0, 1fr) auto; gap: 8px; padding: 0 8px; }
  .topbar-menu { display: grid; }
  .brand-product, .topbar-status, .topbar-link, .account-name, .global-search kbd { display: none; }
  .global-search { width: 100%; }
  .sidebar {
    position: fixed; top: 56px; left: 0; bottom: 0; z-index: 35; width: min(300px, 86vw); height: auto;
    transform: translateX(-100%); transition: transform 220ms var(--ease); box-shadow: var(--pop-shadow);
  }
  .nav-open .sidebar { transform: none; }
  .nav-backdrop { display: block; position: fixed; inset: 56px 0 0 0; z-index: 30; background: rgba(26, 26, 26, 0.35); }
  .main { padding: 16px 16px 48px; }
  .layout-even { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(3) { border-left: 0; }
  .stat:nth-child(n + 3) { border-top: 1px solid var(--line); }
}

@media (max-width: 600px) {
  .brand-name { display: none; }
  .page-header h1 { font-size: 18px; }
  .page-actions { width: 100%; margin-left: 0; }
  .page-actions .button { flex: 1; }
  .table .col-agent, .table .col-date { display: none; }
  .agent-profile { grid-template-columns: minmax(0, 1fr); }
  .agent-portrait { width: 96px; height: 136px; }
  .facts, .model-variant dl { grid-template-columns: minmax(0, 1fr); }
  .login-card { padding: 24px; }
  .skill-token-row { flex-direction: column; }
}

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