/* Wiga Agents Platform — construido con el sistema de diseño de Wiga.
   Color: solo la paleta del sistema (Primary, Secondary, Tertiary, Neutrals y los semánticos de estado).
   Primary lleva las acciones, lo activo y el foco. Secondary y Tertiary son acentos: Secondary marca lo que
   pide atención y Tertiary los datos. Los neutros hacen la estructura. Los estados (bien, advertencia, error)
   van siempre con un icono o un texto al lado.
   Tipografía: Poppins. Radios: 4 (etiquetas), 12 (tarjetas, campos, botones), 16 (diálogos), completo (avatares, selectores). */
:root {
  color-scheme: light;

  /* ---- Paleta. Son los únicos colores del sistema; los roles de abajo solo los referencian. */
  --p: #1B1451;
  --p-100: #3D30A0;
  --p-200: #2B2277;
  --p-400: #140E40;
  --p-500: #0E0A34;
  --p-50: rgba(27, 20, 81, 0.5);
  --s: #FD5E53;
  --s-100: #FEAEAB;
  --s-200: #FD8883;
  --s-400: #D64545;
  --s-500: #B83434;
  --s-50: rgba(253, 94, 83, 0.5);
  --t: #29ABE2;
  --t-100: #BAE0FD;
  --t-200: #63C6FC;
  --t-400: #2294C5;
  --t-500: #0F5573;
  --t-50: rgba(41, 171, 226, 0.5);
  --white: #FFFFFF;
  --n-200: #F2F2F2;
  --n-300: #E3E3E3;
  --n-400: #CECECE;
  --n-500: #B3B3B3;
  --black: #000000;
  --success: #1DB954;
  --warning: #F59B23;
  --error: #E22134;

  /* ---- Roles, modo claro: fondo claro, texto negro. */
  --bg: var(--n-200);
  --surface: var(--white);
  --surface-2: var(--n-200);
  --surface-3: var(--n-300);
  --line: var(--n-300);
  --line-strong: var(--n-400);
  --card-line: transparent;
  --ink: var(--black);
  /* Texto secundario: negro con opacidad. Neutral 500 sobre blanco no alcanza el contraste para leerse. */
  --ink-2: rgba(0, 0, 0, 0.68);
  --ink-3: rgba(0, 0, 0, 0.58);
  --ink-off: var(--n-500);
  --action: var(--p);
  --on-action: var(--white);
  --focus: var(--p);
  --link: var(--p);
  --accent: var(--s);
  --on-accent: var(--black);
  --data: var(--t-400);
  --data-soft: var(--t-50);
  --data-track: var(--n-300);
  --good: var(--success);
  --warn: var(--warning);
  --crit: var(--error);
  --info: var(--t-400);
  --idea: var(--p-100);
  --logo-ink: var(--p);
  --switch-off: var(--n-400);
  --switch-off-line: transparent;
  --knob-off: var(--white);
  /* Al pasar sobre un relleno Primary el brillo sube; en claro equivale a Primary 200. */
  --hover-bright: 1.5;
  --scrim: rgba(0, 0, 0, 0.5);
  --shadow-pop: 0 12px 40px rgba(0, 0, 0, 0.18);
  --font: "Poppins", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Code", "Cascadia Mono", Consolas, ui-monospace, "SF Mono", Menlo, monospace;
}

/* ---- Roles, modo oscuro: fondo Primary 500, texto blanco, acentos sobre oscuro. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: var(--p-500);
    --surface: var(--p-400);
    --surface-2: var(--p);
    --surface-3: var(--p-200);
    --line: var(--p-200);
    --line-strong: var(--p-100);
    --card-line: var(--p-200);
    --ink: var(--white);
    --ink-2: var(--n-400);
    --ink-3: var(--n-500);
    --ink-off: var(--n-500);
    --action: var(--p-100);
    --on-action: var(--white);
    --focus: var(--t-200);
    --link: var(--t-200);
    --data: var(--t);
    --data-soft: var(--t-50);
    --data-track: var(--p-200);
    --info: var(--t);
    --idea: var(--t-100);
    --logo-ink: var(--white);
    --switch-off: transparent;
    --switch-off-line: var(--n-500);
    --knob-off: var(--n-500);
    --hover-bright: 1.2;
    --scrim: rgba(0, 0, 0, 0.5);
    --shadow-pop: 0 12px 40px rgba(0, 0, 0, 0.5);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: var(--p-500);
  --surface: var(--p-400);
  --surface-2: var(--p);
  --surface-3: var(--p-200);
  --line: var(--p-200);
  --line-strong: var(--p-100);
  --card-line: var(--p-200);
  --ink: var(--white);
  --ink-2: var(--n-400);
  --ink-3: var(--n-500);
  --ink-off: var(--n-500);
  --action: var(--p-100);
  --on-action: var(--white);
  --focus: var(--t-200);
  --link: var(--t-200);
  --data: var(--t);
  --data-soft: var(--t-50);
  --data-track: var(--p-200);
  --info: var(--t);
  --idea: var(--t-100);
  --logo-ink: var(--white);
  --switch-off: transparent;
  --switch-off-line: var(--n-500);
  --knob-off: var(--n-500);
  --hover-bright: 1.2;
  --scrim: rgba(0, 0, 0, 0.5);
  --shadow-pop: 0 12px 40px rgba(0, 0, 0, 0.5);
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3, h4 { font-family: var(--font); text-wrap: balance; }
h1 { font-size: 36px; line-height: 51px; font-weight: 700; }
h2 { font-size: 20px; line-height: 1.35; font-weight: 600; }
h3 { font-size: 16px; line-height: 1.4; font-weight: 600; }
a { color: var(--link); text-decoration: none; font-weight: 500; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
img { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
::placeholder { color: var(--ink-off); opacity: 1; }
.mono { font-family: var(--mono); font-size: 0.9em; }
.muted { color: var(--ink-3); }
.soft { color: var(--ink-2); }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.ic { flex: none; display: block; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.grow { flex: 1; min-width: 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ------------------------------------------------------------------ shell */
.shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100%; }
.side {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--surface); color: var(--ink);
  border-right: 1px solid var(--line);
}
.logo { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 24px 24px 16px; color: var(--ink); }
.logo:hover { text-decoration: none; }
.lockup { display: inline-flex; align-items: center; gap: 8px; }
.lockup .mark { color: var(--accent); }
.lockup .word { color: var(--logo-ink); }
.logo .product { font-size: 12px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); }
.side-org { margin: 0 16px 8px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; display: flex; gap: 12px; align-items: center; }
.side-org .name { font-weight: 600; line-height: 1.3; }
.side-org .meta { color: var(--ink-3); font-size: 12px; display: flex; align-items: center; gap: 4px; }
.nav { flex: 1; overflow: auto; padding: 4px 12px 12px; display: flex; flex-direction: column; gap: 4px; }
.nav-label { padding: 16px 12px 4px; color: var(--ink-3); font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 12px; color: var(--ink); font-weight: 500; }
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.on { background: var(--action); color: var(--on-action); }
.nav .count { margin-left: auto; min-width: 22px; padding: 0 6px; border-radius: 9999px; background: var(--accent); color: var(--on-accent); font-size: 12px; font-weight: 600; text-align: center; }
.side-foot { padding: 16px; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.side-foot .who { min-width: 0; flex: 1; line-height: 1.3; }
.side-foot .who b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot .who span { display: block; color: var(--ink-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { display: grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 12px; background: transparent; cursor: pointer; color: inherit; flex: none; }
.icon-btn:hover { background: var(--surface-2); }
.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; display: flex; align-items: center; gap: 12px; height: 64px; padding: 0 32px; background: var(--bg); border-bottom: 1px solid var(--line); }
.top .crumbs { display: flex; align-items: center; gap: 8px; color: var(--ink-3); min-width: 0; white-space: nowrap; }
.top .crumbs b { color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.top .right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.top .icon-btn:hover { background: var(--surface-3); }
.top .select { min-height: 36px; font-weight: 500; }
.select.by-company { max-width: 44vw; }
.menu-btn { display: none; }
.view { padding: 32px 32px 64px; width: 100%; max-width: 1440px; outline: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head p { color: var(--ink-2); font-size: 16px; margin-top: 4px; max-width: 72ch; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.head-meta { margin-top: 12px; gap: 8px; }
/* The publishing host can put a system bar over the top of the page on phones. */
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--bg); }

/* ------------------------------------------------------------------ controls */
/* Botón por defecto: contorno en Primary que se rellena al pasar. Principal: relleno Primary.
   Al pasar sube el brillo y al presionar baja, como pide el sistema; deshabilitado al 40 %. */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 20px; border: 1px solid var(--action); border-radius: 12px; background: transparent; color: var(--ink); font-weight: 500; font-size: 14px; line-height: 1.4; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--action); color: var(--on-action); text-decoration: none; }
.btn:active { filter: brightness(0.9); }
.btn.primary { background: var(--action); color: var(--on-action); }
.btn.primary:hover { filter: brightness(var(--hover-bright)); }
.btn.primary:active { filter: brightness(0.9); }
.btn.danger { border-color: var(--crit); }
.btn.danger:hover { background: var(--crit); color: var(--white); }
.btn.ghost { border-color: transparent; }
.btn.ghost:hover { background: var(--surface-3); color: var(--ink); }
.btn.sm { min-height: 32px; padding: 4px 16px; }
.btn[disabled] { opacity: 0.4; cursor: not-allowed; }
.btn[disabled]:hover { background: transparent; color: var(--ink); filter: none; }
.btn.primary[disabled]:hover { background: var(--action); color: var(--on-action); }
.field { display: flex; flex-direction: column; gap: 8px; }
.field label, .field .label { font-weight: 500; font-size: 14px; }
.help { color: var(--ink-3); font-size: 13px; }
.input, .select, .textarea { width: 100%; min-height: 40px; padding: 8px 16px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); color: var(--ink); font: inherit; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--focus); }
.select { padding: 0 12px; width: auto; }
.select.full { width: 100%; }
.input.narrow { width: 300px; max-width: 100%; }
.textarea { min-height: 88px; resize: vertical; }
.switch { position: relative; width: 40px; height: 24px; border: 0; border-radius: 9999px; background: var(--switch-off); box-shadow: inset 0 0 0 1px var(--switch-off-line); cursor: pointer; flex: none; vertical-align: middle; }
.switch::after { content: ""; position: absolute; top: 4px; left: 4px; width: 16px; height: 16px; border-radius: 50%; background: var(--knob-off); transition: transform 0.15s; }
.switch[aria-checked="true"] { background: var(--action); box-shadow: none; }
.switch[aria-checked="true"]::after { transform: translateX(16px); background: var(--white); }
.switch[disabled] { opacity: 0.4; cursor: not-allowed; }
/* Selector segmentado: la opción activa en Primary. */
.seg { display: inline-flex; padding: 4px; border-radius: 9999px; background: var(--surface-2); flex: none; }
.seg button { border: 0; background: transparent; min-height: 32px; padding: 4px 16px; border-radius: 9999px; font-weight: 600; font-size: 14px; color: var(--ink); cursor: pointer; white-space: nowrap; }
.seg button:hover { background: var(--surface-3); }
.seg button[aria-pressed="true"] { background: var(--action); color: var(--on-action); }

/* ------------------------------------------------------------------ small marks */
/* Etiquetas: fondo neutro y texto en color de texto. El estado lo lleva el icono o el punto, nunca solo el color. */
.pill { display: inline-flex; align-items: center; gap: 6px; min-height: 24px; padding: 2px 8px; border-radius: 4px; font-size: 13px; font-weight: 500; line-height: 1.4; white-space: nowrap; background: var(--surface-2); color: var(--ink); }
.pill .ic { width: 14px; height: 14px; color: var(--tone, currentColor); }
.pill.good { --tone: var(--good); }
.pill.warn { --tone: var(--warn); }
.pill.crit { --tone: var(--crit); }
.pill.info { --tone: var(--info); }
.pill.violet { --tone: var(--idea); }
.pill.brand { --tone: var(--link); }
.pill.good::before, .pill.warn::before, .pill.crit::before, .pill.info::before, .pill.violet::before, .pill.brand::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--tone); flex: none; }
.pill:has(.ic)::before { display: none; }
.pill.live .ic { animation: pulse 1.2s ease-in-out infinite; }
.chip { display: inline-flex; align-items: center; gap: 4px; min-height: 24px; padding: 2px 8px; border: 1px solid var(--line); border-radius: 4px; font-size: 12px; font-weight: 500; color: var(--ink-2); background: var(--surface); white-space: nowrap; }
.chip .ic { width: 12px; height: 12px; }
.chip.warn .ic { color: var(--warn); }
.tag { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 2px 12px; border-radius: 4px; border: 1px dashed var(--line-strong); color: var(--ink-3); font-size: 12px; font-weight: 500; white-space: nowrap; }
.cos { display: inline-flex; flex-wrap: wrap; gap: 4px; vertical-align: middle; }
/* Compañías: todas con la misma etiqueta neutra; las distingue el nombre. */
.co, .person .co { display: inline-flex; align-items: center; min-height: 22px; padding: 1px 8px; border-radius: 4px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); font-size: 12px; font-weight: 500; white-space: nowrap; }
.cos.lg .co { min-height: 28px; font-size: 14px; padding: 2px 12px; }
.avatar { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 9999px; background: var(--action); color: var(--on-action); font-weight: 600; font-size: 13px; }
.avatar.sm { width: 32px; height: 32px; font-size: 12px; }
.avatar.round { background: var(--surface-3); color: var(--ink); }
.kbd { font-family: var(--mono); font-size: 12px; padding: 1px 6px; border-radius: 4px; background: var(--surface-3); color: var(--ink-2); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes enter { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------------ surfaces */
.card { background: var(--surface); border: 1px solid var(--card-line); border-radius: 12px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; padding: 24px 24px 0; }
.card-head p { color: var(--ink-3); font-size: 14px; }
.card-body { padding: 16px 24px 24px; }
.card-body.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.card-foot { padding: 16px 24px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; }
.card-foot .row { white-space: nowrap; }
.card-foot .row:last-child, .card-foot > .btn { margin-left: auto; }
.grid { display: grid; gap: 16px; }
.grid + .grid, .kpis + .grid, .grid + .card { margin-top: 16px; }
.grid.two { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); align-items: start; }
.grid.two.wide-right { grid-template-columns: minmax(0, 1fr) minmax(0, 1.55fr); }
.grid.two.usage { align-items: stretch; }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(min(360px, 100%), 1fr)); }
.grid.cards.wide { grid-template-columns: repeat(auto-fill, minmax(min(440px, 100%), 1fr)); }
.grid.halves { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.empty { padding: 32px 24px; text-align: center; color: var(--ink-3); }
.empty b { display: block; color: var(--ink); font-weight: 600; margin-bottom: 4px; }
.note { display: flex; gap: 12px; padding: 12px 16px; border-radius: 12px; background: var(--surface-2); color: var(--ink-2); font-size: 14px; }
.note .ic { margin-top: 2px; color: var(--ink-3); }
.note b { color: var(--ink); }
.note a { text-decoration: underline; }
.note.warn-note, .note.crit-note { margin-top: 16px; color: var(--ink); border-left: 4px solid var(--warn); }
.note.crit-note { border-left-color: var(--crit); }
.note.warn-note .ic { color: var(--warn); }
.note.crit-note .ic { color: var(--crit); }
.note.demo-note { margin: 0 0 24px; max-width: 640px; }
.mini-title { font-size: 12px; color: var(--ink-3); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; margin: 0; }

/* ------------------------------------------------------------------ stat tiles */
.kpis { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; background: var(--surface); border: 1px solid var(--card-line); border-radius: 12px; }
.kpi { padding: 20px 24px; border-left: 1px solid var(--line); min-width: 0; }
.kpi:first-child { border-left: 0; }
.kpi .label { color: var(--ink-2); font-size: 14px; font-weight: 500; }
.kpi .value { font-size: 30px; line-height: 1.25; font-weight: 700; margin-top: 4px; }
.kpi .value small { font-size: 14px; font-weight: 500; color: var(--ink-3); }
.kpi .value.sm { font-size: 20px; font-weight: 600; line-height: 1.35; }
.kpi .hint { color: var(--ink-3); font-size: 13px; margin-top: 4px; }
/* Lo que pide atención lleva el acento Secondary al lado del rótulo. */
.kpi.attn .label::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 8px; }
.kpis.fit { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1px; background: var(--line); border-color: var(--line); overflow: hidden; margin: 16px 0; }
.kpis.fit .kpi { border: 0; background: var(--surface); }

/* ------------------------------------------------------------------ tables */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
.t th { text-align: left; font-weight: 500; font-size: 13px; color: var(--ink-3); padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.t td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr.link { cursor: pointer; }
.t tbody tr.link:hover { background: var(--surface-2); }
.t td.r, .t th.r { text-align: right; font-variant-numeric: tabular-nums; }
.t td.c, .t th.c { text-align: center; }
.t .sub { color: var(--ink-3); font-size: 13px; }
.t b { font-weight: 600; }

/* ------------------------------------------------------------------ charts */
/* Datos en Tertiary; estados en los colores semánticos. Rejilla y ejes en neutros, texto en color de texto. */
.chart { width: 100%; height: auto; display: block; }
.chart text { font: 500 12px var(--font); fill: var(--ink-3); }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .base-line { stroke: var(--line-strong); stroke-width: 1; }
.chart .bar { fill: var(--data-soft); }
.chart .bar.on { fill: var(--data); }
.chart .seg-completed { fill: var(--good); }
.chart .seg-failed { fill: var(--crit); }
.chart .seg-waiting { fill: var(--warn); }
.chart .seg-active { fill: var(--info); }
.chart .hit { fill: var(--ink); fill-opacity: 0; cursor: pointer; }
.chart .hit:hover { fill-opacity: 0.05; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 16px; color: var(--ink-2); font-size: 13px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend.plain span { display: inline-flex; align-items: center; gap: 6px; }
.legend .mini { width: 24px; height: 14px; border-radius: 9999px; background: var(--switch-off); box-shadow: inset 0 0 0 1px var(--switch-off-line); margin-right: 0; }
.legend .mini.on { background: var(--action); box-shadow: none; }
.sw-completed { background: var(--good); }
.sw-failed { background: var(--crit); }
.sw-waiting { background: var(--warn); }
.sw-active { background: var(--info); }
details > summary { cursor: pointer; font-size: 13px; }
.strip { display: flex; gap: 3px; align-items: center; }
.strip i { width: 8px; height: 20px; border-radius: 4px; background: var(--surface-3); }
.strip i.completed { background: var(--good); }
.strip i.failed { background: var(--crit); }
.strip i.awaiting_approval { background: var(--warn); }
.strip i.running, .strip i.queued { background: var(--info); }
.meter { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 12px; font-size: 14px; }
.meter .bar { grid-column: 1 / -1; height: 8px; border-radius: 9999px; background: var(--data-track); overflow: hidden; }
.meter .bar i { --w: 0%; display: block; height: 100%; width: var(--w); border-radius: 9999px; background: var(--data); }
.meter .v { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.meters { display: flex; flex-direction: column; gap: 16px; }
/* Consumo diario y reparto por agente */
.usage-head { align-items: flex-start; flex-wrap: wrap; }
.readout { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.readout b { font-size: 30px; line-height: 1.25; font-weight: 700; }
.readout span { color: var(--ink-2); font-size: 14px; }
#usage-body .legend { margin-top: 8px; }
#usage-body details { margin-top: 8px; }
.share { display: flex; flex-direction: column; gap: 20px; }
.share-row .line { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 16px; }
.share-row .line a { color: var(--ink); font-weight: 500; min-width: 0; }
.share-row .line b { font-weight: 500; white-space: nowrap; }
.share-row .bar { height: 8px; border-radius: 9999px; background: var(--data-track); margin: 8px 0; overflow: hidden; }
.share-row .bar i { --w: 0%; display: block; height: 100%; width: var(--w); border-radius: 9999px; background: var(--data); }
.share-row .sub { color: var(--ink-3); font-size: 13px; }

/* ------------------------------------------------------------------ lists */
.list { display: flex; flex-direction: column; }
.card-head + .list, .card-head + .controls { margin-top: 12px; }
.list > * { padding: 12px 24px; border-top: 1px solid var(--line); }
.list > *:first-child { border-top: 0; }
.list.flush > * { padding-left: 0; padding-right: 0; }
.item { display: flex; gap: 12px; align-items: flex-start; color: inherit; font-weight: 400; }
.item .grow { display: flex; flex-direction: column; }
a.item:hover { background: var(--surface-2); text-decoration: none; }
.item .t1 { font-weight: 600; }
.item .t2 { color: var(--ink-2); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* Marca de un elemento: fondo neutro; el color va en el icono. */
.dot { flex: none; width: 32px; height: 32px; border-radius: 9999px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); }
.dot .ic { width: 16px; height: 16px; }
.dot.good .ic { color: var(--good); }
.dot.warn .ic { color: var(--warn); }
.dot.crit .ic { color: var(--crit); }
.dot.info .ic { color: var(--info); }
.dot.violet .ic { color: var(--idea); }
.dot.brand .ic { color: var(--link); }
dl.kv { display: grid; grid-template-columns: minmax(110px, 34%) minmax(0, 1fr); gap: 8px 16px; margin: 0; font-size: 14px; }
dl.kv dt { color: var(--ink-3); }
dl.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* ------------------------------------------------------------------ agents */
.agent { display: flex; flex-direction: column; }
.agent .head { display: flex; gap: 12px; padding: 24px 24px 0; align-items: flex-start; }
.agent .glyph, .glyph.sm { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--link); flex: none; }
.glyph.sm { width: 36px; height: 36px; }
.agent.off .glyph { color: var(--ink-3); }
.agent h3 { font-size: 18px; line-height: 1.35; }
.agent h3 a { color: var(--ink); font-weight: 600; }
.agent .cat { color: var(--ink-3); font-size: 13px; }
.agent .scope { padding: 12px 24px 0; }
.agent .sum { padding: 12px 24px 0; color: var(--ink-2); font-size: 14px; min-height: 56px; }
.agent .chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 24px 0; }
.agent dl.kv { padding: 16px 24px 0; }
.agent .runs { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 24px; }
.agent .mini-title { padding: 16px 24px 0; }
.agent .card-foot { margin-top: auto; }
.chips.tools, .grid.cards.wide .chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.tools { margin-top: 8px; }

/* ------------------------------------------------------------------ run */
.run-head { padding: 24px; margin-bottom: 16px; }
.run-head h1 { font-size: 24px; line-height: 1.3; font-weight: 600; }
.run-head .title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.run-head .mono { margin-top: 4px; }
.run-head .facts { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 16px; color: var(--ink-2); font-size: 14px; }
.run-head .facts b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.seal { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; padding: 4px 16px 4px 12px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface); font-size: 13px; font-weight: 500; cursor: pointer; color: var(--ink); }
.seal:hover { background: var(--surface-2); }
.seal.ok .ic { color: var(--good); }
.seal.bad { border-color: var(--crit); }
.seal.bad .ic { color: var(--crit); }
.seal.static { cursor: default; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border: 0; border-bottom: 3px solid transparent; background: none; cursor: pointer; font-weight: 500; color: var(--ink-3); white-space: nowrap; }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--action); }
.tabs .n { font-size: 12px; padding: 0 8px; border-radius: 9999px; background: var(--surface-3); color: var(--ink); font-variant-numeric: tabular-nums; }
.trace-layout { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(300px, 1fr); gap: 16px; align-items: start; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; padding: 16px 16px 12px; border-bottom: 1px solid var(--line); }
.filters button { min-height: 28px; padding: 2px 12px; border-radius: 9999px; border: 1px solid var(--line-strong); background: transparent; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.filters button[aria-pressed="true"] { background: var(--action); border-color: var(--action); color: var(--on-action); }
.trace { padding: 8px; }
.ev { display: grid; grid-template-columns: 64px 32px minmax(0, 1fr); gap: 0 12px; padding: 8px; border-radius: 12px; cursor: pointer; border: 1px solid transparent; width: 100%; background: none; text-align: left; }
.ev:hover { background: var(--surface-2); }
.ev.sel { background: var(--surface-2); border-color: var(--focus); }
.ev.new { animation: enter 0.25s ease-out; }
.ev .time { font-family: var(--mono); font-size: 12px; color: var(--ink-3); text-align: right; padding-top: 8px; font-variant-numeric: tabular-nums; }
.ev .node { position: relative; display: flex; justify-content: center; }
.ev .node::before { content: ""; position: absolute; top: -9px; bottom: -9px; left: 50%; width: 1px; background: var(--line-strong); }
.ev:first-child .node::before { top: 16px; }
.ev:last-child .node::before { bottom: calc(100% - 16px); }
.ev .dot { position: relative; background: var(--surface-3); }
.ev .what { min-width: 0; padding-top: 4px; }
.ev .what b { font-weight: 600; }
.ev .what .d { color: var(--ink-2); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.ev .meta { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.live-row { display: flex; align-items: center; gap: 12px; padding: 12px 24px; color: var(--ink-3); font-size: 13px; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--action); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.inspector { position: sticky; top: 80px; }
.inspector .kind { display: flex; align-items: center; gap: 12px; }
.inspector .detail { margin-top: 12px; color: var(--ink-2); font-size: 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.inspector h4 { margin: 16px 0 8px; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.insp-title { margin-top: 16px; font-size: 18px; }
/* Las capturas son la pantalla de otra aplicación: se muestran sobre blanco en los dos temas. */
.inspector .shot { display: block; width: 100%; border: 1px solid var(--line); border-radius: 12px; background: var(--white); cursor: zoom-in; padding: 0; overflow: hidden; }
.inspector .shot img { display: block; width: 100%; }
.hash { font-family: var(--mono); font-size: 12px; color: var(--ink-3); overflow-wrap: anywhere; }
.chain-row { display: grid; grid-template-columns: 80px minmax(0, 1fr); gap: 4px 12px; align-items: baseline; font-size: 13px; }
.chain-row span:nth-child(odd) { color: var(--ink-3); }

/* reproducción de la navegación */
.replay { display: grid; grid-template-columns: minmax(0, 1.9fr) minmax(250px, 1fr); gap: 16px; align-items: start; }
.browser { border: 1px solid var(--line-strong); border-radius: 12px; overflow: hidden; background: var(--surface); }
.browser .bar { display: flex; align-items: center; gap: 12px; padding: 8px 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.browser .lights { display: flex; gap: 6px; }
.browser .lights i { width: 10px; height: 10px; border-radius: 50%; background: var(--line-strong); }
.browser .url { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; min-height: 28px; padding: 0 12px; border-radius: 9999px; background: var(--surface); border: 1px solid var(--line); font-family: var(--mono); font-size: 12px; color: var(--ink-2); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.browser .url.blocked { border-color: var(--crit); }
.browser .url.blocked .ic { color: var(--crit); }
.browser .screen { display: block; width: 100%; aspect-ratio: 960 / 560; background: var(--white); }
.browser .caption { display: flex; align-items: center; gap: 12px; padding: 12px; border-top: 1px solid var(--line); }
.browser .caption b { font-weight: 600; }
.replay-controls { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.replay-controls .progress { flex: 1; height: 4px; border-radius: 9999px; background: var(--data-track); overflow: hidden; }
.replay-controls .progress i { --w: 0%; display: block; height: 100%; width: var(--w); background: var(--action); transition: width 0.2s; }
.steps { max-height: 560px; overflow: auto; padding: 8px; }
.steps button { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 12px; width: 100%; padding: 8px; border: 1px solid transparent; border-radius: 12px; background: none; text-align: left; cursor: pointer; }
.steps button:hover { background: var(--surface-2); }
.steps button.on { background: var(--surface-2); border-color: var(--focus); }
.steps .i { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-3); font-size: 12px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.steps button.on .i { background: var(--action); color: var(--on-action); }
.steps button.blocked .i { box-shadow: inset 0 0 0 2px var(--crit); }
.steps b { display: block; font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.steps .u { display: block; color: var(--ink-3); font-size: 12px; font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* informe */
.report h2 { font-size: 24px; line-height: 1.3; font-weight: 600; }
.report h2 + p { font-size: 16px; margin-top: 4px; }
.report h3 { margin: 24px 0 4px; font-size: 18px; line-height: 1.6; }
.report .sec-note { color: var(--ink-3); font-size: 14px; margin-bottom: 8px; }
.report p.soft { font-size: 16px; }
.prio { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.prio > div { padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); font-size: 16px; }
.prio b { display: block; font-weight: 600; margin-bottom: 4px; }
.finding { display: flex; gap: 12px; align-items: flex-start; }
.sev { flex: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 72px; min-height: 24px; padding: 2px 8px; border-radius: 4px; background: var(--surface-2); color: var(--ink); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.sev::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-off); }
.sev.alta::before { background: var(--crit); }
.sev.media::before { background: var(--warn); }

/* ------------------------------------------------------------------ approvals */
.approval { padding: 24px; }
.approval .summary { margin-top: 12px; font-size: 16px; }
.approval .drafts { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.approval details { border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.approval summary { padding: 12px 16px; cursor: pointer; font-weight: 500; font-size: 14px; }
.approval details div { padding: 0 16px 12px; color: var(--ink-2); font-size: 14px; white-space: pre-wrap; }
.approval .decide { display: flex; gap: 8px; align-items: center; margin-top: 16px; flex-wrap: wrap; }
.approval .decide .input { flex: 1; min-width: 200px; }

/* ------------------------------------------------------------------ security */
.probe { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 12px; }
.probe b { font-weight: 600; }
.probe .ev-text { font-size: 14px; color: var(--ink-2); }
.controls { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 0; }
.control { display: flex; gap: 12px; padding: 16px 24px; border-top: 1px solid var(--line); }
.control b { font-weight: 600; }
.control p { color: var(--ink-2); font-size: 14px; }
.perm td.c, .perm th.c { text-align: center; }
/* La máquina de la organización */
.machine { display: grid; grid-template-columns: minmax(0, 2.4fr) minmax(0, 1fr); gap: 16px; align-items: stretch; }
.vm { border: 2px solid var(--action); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.vm h3, .edge h3 { display: flex; align-items: center; gap: 8px; }
.vm .companies { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.company { border-radius: 12px; padding: 12px; background: var(--surface-2); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.company.dim { opacity: 0.6; }
.company > b { font-weight: 600; }
.company > .muted { font-size: 13px; margin-top: -8px; }
.machine .box { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; font-weight: 500; }
.machine .box .ic { color: var(--link); }
.vm .shared { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px; }
.edge { display: flex; flex-direction: column; gap: 16px; }
.edge .zone { border-radius: 12px; padding: 16px; border: 1px dashed var(--line-strong); background: var(--surface-2); display: flex; flex-direction: column; gap: 8px; flex: 1; }
.edge .zone p { color: var(--ink-3); font-size: 13px; }

/* ------------------------------------------------------------------ sign-in */
.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); }
.login .pitch { background: var(--surface); padding: 48px; display: flex; flex-direction: column; border-right: 1px solid var(--line); }
.login .logo { padding: 0; }
.login .pitch h1 { margin-top: auto; max-width: 18ch; }
.login .pitch .lede { color: var(--ink-2); font-size: 18px; line-height: 1.6; margin-top: 16px; max-width: 44ch; }
.login .points { display: flex; flex-direction: column; gap: 16px; margin: 32px 0 auto; }
.login .points div { display: flex; gap: 12px; align-items: flex-start; max-width: 50ch; }
.login .points .ic { color: var(--link); margin-top: 2px; }
.login .points b { display: block; font-weight: 600; font-size: 16px; }
.login .points span span { color: var(--ink-2); font-size: 14px; }
.login .choose { padding: 48px; overflow: auto; }
.login .choose h2 { font-size: 30px; line-height: 1.25; font-weight: 700; }
.login .choose > p { color: var(--ink-2); font-size: 16px; margin: 8px 0 24px; max-width: 60ch; }
.login .choose > p.muted { font-size: 14px; margin: 16px 0 0; }
.login .orgs { display: flex; flex-direction: column; gap: 12px; max-width: 680px; }
.login .org { padding: 24px; }
.login .org .who { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.login .org .who b { font-size: 18px; font-weight: 600; }
.login .cos.lg { margin-bottom: 16px; }
.login .people { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.login .people.one { grid-template-columns: minmax(0, 1fr); }
.person { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px 16px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); cursor: pointer; text-align: left; }
.person:hover { border-color: var(--focus); background: var(--surface-2); }
.person.wide { flex-direction: row; align-items: center; gap: 16px; width: 100%; }
.person b { font-weight: 600; color: var(--ink); font-size: 14px; }
.person span { color: var(--ink-3); font-size: 13px; }
.person .grow { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.person .can { color: var(--ink-2); }
.person .side-info { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex: none; }
.person em { font-style: normal; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink); }

/* ------------------------------------------------------------------ agent configuration form */
.form { display: flex; flex-direction: column; gap: 24px; }
.form fieldset { border: 0; padding: 0; margin: 0; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.form fieldset + fieldset { padding-top: 24px; border-top: 1px solid var(--line); }
.form legend { font-weight: 600; font-size: 16px; padding: 0; margin-bottom: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.check { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line-strong); border-radius: 12px; cursor: pointer; }
.check:has(input:checked) { border-color: var(--focus); background: var(--surface-2); }
.check.disabled { opacity: 0.4; cursor: not-allowed; }
.check input { accent-color: var(--action); flex: none; width: 16px; height: 16px; }
.check .grow { display: flex; flex-direction: column; font-weight: 500; font-size: 14px; min-width: 0; }
.check small { font-weight: 400; font-size: 13px; color: var(--ink-3); }
.tokens { display: flex; flex-wrap: wrap; gap: 8px; min-height: 28px; align-items: center; }
.token { display: inline-flex; align-items: center; gap: 4px; min-height: 28px; padding: 2px 4px 2px 12px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; max-width: 100%; }
.token .mono { overflow-wrap: anywhere; }
.token button { border: 0; background: transparent; color: var(--ink-3); cursor: pointer; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 4px; flex: none; }
.token button:hover { background: var(--surface-3); color: var(--ink); }
.add-row { display: flex; gap: 8px; }
.add-row .input { flex: 1; min-width: 0; }
.switch-row { display: flex; gap: 12px; align-items: flex-start; }
.switch-row .switch { margin-top: 2px; }
.switch-row b { font-weight: 600; }
.pick { display: flex; flex-direction: column; gap: 8px; }
.pick label { display: flex; gap: 12px; padding: 12px; border: 1px solid var(--line-strong); border-radius: 12px; cursor: pointer; }
.pick label:has(input:checked) { border-color: var(--focus); background: var(--surface-2); }
.pick input { margin-top: 4px; accent-color: var(--action); flex: none; }
.pick b { font-weight: 600; }
.pick small { display: block; color: var(--ink-2); font-size: 13px; }

/* ------------------------------------------------------------------ tools */
.tool-list { display: flex; flex-direction: column; }
.card-head + .tool-list { margin-top: 16px; }
.tool-row { display: flex; gap: 16px; padding: 16px 24px; border-top: 1px solid var(--line); align-items: flex-start; }
.tool-row .grow { min-width: 0; }
.tool-row b { font-weight: 600; }
.tool-row .soft { font-size: 14px; }
.tool-row .why { display: flex; gap: 6px; align-items: flex-start; font-size: 13px; margin-top: 4px; }
.tool-row .why .ic { flex: none; margin-top: 3px; }
.tool-row.denied { background: var(--surface-2); }
.tool-row.denied b { text-decoration: line-through; text-decoration-color: var(--ink-off); }
.tool-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex: none; }
.form .tool-list { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.form .tool-row { padding: 16px; }
.form .tool-row:first-child { border-top: 0; }
.matrix { border-collapse: separate; border-spacing: 0; width: 100%; }
.matrix th.tool-col { position: sticky; left: 0; z-index: 2; background: var(--surface); min-width: 300px; max-width: 380px; text-align: left; white-space: normal; font-weight: 400; color: var(--ink); font-size: 14px; padding: 12px 16px 12px 24px; border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); vertical-align: top; }
.matrix thead th { vertical-align: bottom; }
.matrix thead th.tool-col { font-weight: 500; font-size: 13px; color: var(--ink-3); }
.matrix th.agent-col { min-width: 124px; max-width: 148px; white-space: normal; text-align: center; padding: 12px 8px; }
.matrix th.agent-col a { display: block; color: var(--ink); font-weight: 600; font-size: 13px; line-height: 1.3; margin-bottom: 8px; }
.matrix th.agent-col .cos { justify-content: center; }
.matrix td.c { text-align: center; vertical-align: middle; white-space: nowrap; }
.matrix td.c.na { color: var(--ink-off); }
.matrix td.c.off { background: var(--surface-2); }
.matrix tr.group th { text-align: left; background: var(--surface-2); color: var(--ink); font-size: 14px; font-weight: 600; padding: 8px 24px; border-bottom: 1px solid var(--line); }
.matrix tr.group th .ic { display: inline-block; vertical-align: -2px; margin-right: 8px; }
.matrix tr.group th .muted { font-weight: 400; margin-left: 12px; }
.matrix .desc { font-size: 13px; margin-top: 2px; }
.matrix tbody tr:last-child th.tool-col { border-bottom: 0; }
.denied-for { display: flex; gap: 6px; align-items: flex-start; margin-top: 6px; font-size: 13px; color: var(--ink-2); }
.denied-for .ic { flex: none; margin-top: 3px; color: var(--crit); }
.denied-for b { color: var(--ink); font-weight: 600; }
/* Los totales de la página son también su filtro: el elegido va en Primary, como todo estado activo. */
.filters-title { margin-top: 16px; }
.kpis.fit.tool-filters { grid-template-columns: repeat(6, minmax(0, 1fr)); margin-top: 8px; }
.tool-filters .kpi { display: block; width: 100%; text-align: left; border-radius: 0; cursor: pointer; }
.tool-filters .kpi > span { display: block; }
.tool-filters .kpi:hover { background: var(--surface-2); }
.tool-filters .kpi[aria-pressed="true"] { background: var(--action); color: var(--on-action); }
.tool-filters .kpi[aria-pressed="true"] .label, .tool-filters .kpi[aria-pressed="true"] .hint { color: var(--on-action); }
.tool-filters .kpi[aria-pressed="true"] .hint { opacity: 0.85; }
.tool-filters .kpi:focus-visible { outline-offset: -3px; border-radius: 0; }
.tool-filters .kpi[aria-pressed="true"]:focus-visible { outline-color: var(--on-action); }
.card-head .showing { margin-top: 4px; color: var(--ink-2); }
.card-head .showing b { color: var(--ink); font-weight: 600; }
.explain { display: flex; flex-direction: column; gap: 8px; margin: 16px 24px 0; padding: 16px; border-radius: 12px; background: var(--surface-2); color: var(--ink-2); font-size: 14px; }
.explain p { max-width: 84ch; }
.explain b { color: var(--ink); font-weight: 600; }
.explain ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.explain li { display: flex; gap: 8px; align-items: flex-start; max-width: 84ch; }
.explain li .ic { flex: none; margin-top: 3px; color: var(--ink-3); }
.explain + .table-wrap, .explain + .empty { margin-top: 8px; }
.req { display: inline-grid; place-items: center; margin-left: 6px; color: var(--ink-3); vertical-align: middle; }
.state { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--surface-2); vertical-align: middle; }
.state.on { color: var(--good); }
.state.off { color: var(--crit); }
.state.none { color: var(--ink-off); background: transparent; }

/* ------------------------------------------------------------------ overlays */
.modal-back { position: fixed; inset: 0; z-index: 60; background: var(--scrim); display: grid; place-items: center; padding: 24px; }
.modal { width: min(560px, 100%); max-height: calc(100vh - 48px); overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-pop); }
.modal.wide { width: min(1040px, 100%); }
.modal header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 24px 24px 0; }
.modal .body { padding: 16px 24px; display: flex; flex-direction: column; gap: 12px; font-size: 16px; }
.modal footer { display: flex; justify-content: flex-end; gap: 8px; padding: 0 24px 24px; }
#toasts { position: fixed; right: 24px; bottom: 24px; z-index: 80; display: flex; flex-direction: column; gap: 8px; }
.toast { display: flex; align-items: center; gap: 12px; max-width: 440px; padding: 12px 16px; border-radius: 12px; background: var(--ink); color: var(--bg); box-shadow: var(--shadow-pop); font-weight: 500; animation: enter 0.2s ease-out; }
.toast.crit { background: var(--crit); color: var(--white); }
.tip { position: fixed; z-index: 90; pointer-events: none; max-width: 300px; padding: 8px 12px; border-radius: 4px; background: var(--ink); color: var(--bg); font-size: 13px; line-height: 1.4; white-space: pre-line; box-shadow: var(--shadow-pop); }
.skeleton { padding: 64px 0; display: flex; justify-content: center; }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi:nth-child(4) { border-left: 0; }
  .kpi:nth-child(n + 4) { border-top: 1px solid var(--line); }
  .grid.two, .grid.two.wide-right, .trace-layout, .replay, .grid.halves, .machine { grid-template-columns: minmax(0, 1fr); }
  .inspector { position: static; }
  .kpis.fit.tool-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tool-filters .kpi:first-child { grid-column: 1 / -1; display: flex; align-items: baseline; gap: 12px; padding-top: 12px; padding-bottom: 12px; }
  .tool-filters .kpi:first-child > span { margin-top: 0; }
  .tool-filters .kpi:first-child .value { font-size: 20px; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; z-index: 50; left: 0; width: 280px; transform: translateX(-100%); transition: transform 0.2s; }
  .shell.menu-open .side { transform: none; box-shadow: var(--shadow-pop); }
  .menu-btn { display: grid; }
  .top { padding-left: 16px; padding-right: 16px; }
  .view { padding: 24px 16px 48px; }
  .login { grid-template-columns: minmax(0, 1fr); }
  .login .pitch { padding: 32px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .login .pitch h1 { margin-top: 32px; }
  .login .points { margin: 24px 0 0; }
  .login .choose { padding: 32px 16px; }
  .top .tag { display: none; }
}
@media (max-width: 620px) {
  h1 { font-size: 28px; line-height: 1.3; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { border-left: 0; border-top: 1px solid var(--line); padding: 16px; }
  .kpi:nth-child(-n + 2) { border-top: 0; }
  .kpi:nth-child(even) { border-left: 1px solid var(--line); }
  .kpi .value { font-size: 24px; }
  .grid.cards { grid-template-columns: minmax(0, 1fr); }
  .card-head { padding: 16px 16px 0; flex-wrap: wrap; }
  .card-body { padding: 12px 16px 16px; }
  .card-foot, .list > *, .tool-row, .control { padding-left: 16px; padding-right: 16px; }
  .ev { grid-template-columns: 32px minmax(0, 1fr); }
  .ev .time { display: none; }
  .top .crumbs > span, .top .crumbs > .ic { display: none; }
  .select.by-company { max-width: 38vw; }
  .form-grid, .form-grid.three { grid-template-columns: minmax(0, 1fr); }
  .person.wide { flex-direction: column; align-items: flex-start; }
  .person .side-info { flex-direction: row; align-items: center; }
  .tool-row { flex-direction: column; gap: 12px; }
  .tool-side { flex-direction: row; align-items: center; }
  .add-row { flex-wrap: wrap; }
  .matrix th.tool-col { min-width: 200px; padding-left: 16px; }
  .kpis.fit.tool-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .explain { margin: 16px 16px 0; }
  .readout b { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
/* On the page background (not inside a card) neutral marks sit on the surface colour so they stay visible. */
.page-head .glyph, .page-head .pill { background: var(--surface); }
.page-head > .row { align-items: flex-start; }

/* directories */
.select.grant { width: 100%; min-width: 136px; min-height: 36px; font-size: 13px; padding: 0 8px; }
.matrix td.c .denied-for { justify-content: center; }
.path { gap: 4px; margin-bottom: 12px; }
.path .btn { padding: 4px 8px; }
.path .ic { color: var(--ink-3); }

/* real agents: markdown report, the request for a person, long step results */
.md { font-size: 15px; line-height: 1.6; }
.md h2 { font-size: 22px; margin: 0 0 8px; }
.md h3 { font-size: 18px; margin: 24px 0 8px; }
.md h4 { font-size: 16px; margin: 16px 0 4px; }
.md p { margin: 8px 0; color: var(--ink-2); }
.md ul, .md ol { margin: 8px 0 8px 24px; padding: 0; color: var(--ink-2); }
.md li { margin: 4px 0; }
.md strong { color: var(--ink); font-weight: 600; }
.md code { font-family: var(--mono); font-size: 0.9em; background: var(--surface-2); padding: 1px 6px; border-radius: 4px; }
.md .table-wrap { margin: 12px 0; }
.md table.t th, .md table.t td { white-space: normal; vertical-align: top; }
.input-note .grow { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.input-note form { gap: 8px; }

/* A person operating the agent's browser: the live view keeps the page's own colors in both themes. */
.control { display: grid; gap: 10px; min-width: 0; }
.control-screen { position: relative; width: 100%; max-width: 960px; aspect-ratio: 16 / 10; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; background: #fff; color: #333; }
.control-screen:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.control-screen img { display: block; width: 100%; height: 100%; object-fit: fill; cursor: crosshair; user-select: none; -webkit-user-drag: none; }
.control-screen:not(.live) img { visibility: hidden; }
.control-wait { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; text-align: center; }
.control-screen.live .control-wait { display: none; }
.inspector .detail { max-height: 420px; overflow: auto; }

/* assistant */
.chat { display: flex; flex-direction: column; min-height: calc(100vh - 260px); }
.chat .thread { flex: 1; display: flex; flex-direction: column; gap: 16px; padding: 24px; }
.chat .msg { max-width: min(760px, 92%); display: flex; flex-direction: column; gap: 8px; }
.chat .msg.user { align-self: flex-end; background: var(--surface-2); border-radius: 16px 16px 4px 16px; padding: 12px 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat .msg.assistant { align-self: flex-start; }
.chat .msg .meta { font-size: 12px; color: var(--ink-3); }
.chat .msg .md h2, .chat .msg .md h3 { font-size: 16px; margin: 12px 0 4px; }
.chat .consulted { display: flex; flex-wrap: wrap; gap: 6px; }
.chat .proposal { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); }
.chat .proposal .grow { min-width: 0; }
.chat .composer { display: flex; gap: 12px; align-items: flex-end; padding: 16px 24px; border-top: 1px solid var(--line); }
.chat .composer .textarea { min-height: 48px; max-height: 200px; }
.chat .starters { display: flex; flex-wrap: wrap; gap: 8px; }
.chat .typing { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-3); font-size: 14px; }

/* tool services */
.matrix tr.group th .pill { margin-left: 12px; vertical-align: middle; }

/* an agent's instructions */
.textarea.tall { min-height: 200px; line-height: 1.5; }

/* Sign-in with Microsoft: one clear action. */
.login .choose .btn.sso { padding: 12px 20px; font-size: 16px; margin-bottom: 16px; }
