/* ================= AI in STRIDE: the capabilities explorer's rules =================
   Surface: JS/components/ai-capabilities-dialog.js. Frame is `.settings-modal` (CSS/components.css, alt-shared-dialogs.css);
   reuses `.a-search`/`.a-input`/`.a-chip`. Tokens from alt-tokens.css, scoped to `body.alt-app`.
   Four accents cover six categories; icon and heading carry the rest, colour is only a scanning aid (§18). */

/* ---------- the card shell ---------- */

/* Fluid width: sizeSettingsDialog() (aiCapSizeToViewport) sets width and height from the
   window (about 94%, capped at 1600px); this is the fallback before the sizer runs. The card
   grid spends extra room on more columns, never wider cards. */
body.alt-app .settings-modal.aic-modal{ width:min(1600px, 100%); }

/* Keeps the header's two-child contract (title, close). The status pill is grouped under this
   wrapper as a sibling of the title, not a third flex child. */
body.alt-app .aic-head-left{ display:flex; align-items:center; gap:8px; min-width:0; }

/* The header pill shows provider and readiness, never a model name. `:empty` hides it when a
   host without ai-status.js leaves no text. */
body.alt-app .aic-head-pill{
  display:inline-flex; align-items:center; gap:5px;
  min-height:24px; padding:0 9px; border-radius:var(--a-r-pill);
  font-size:var(--a-fs-11); font-weight:600; line-height:var(--a-lh-tight); white-space:nowrap;
  border:1px solid var(--a-line-soft); color:var(--a-dim); background:var(--a-raised);
}
body.alt-app .aic-head-pill:empty{ display:none; }
body.alt-app .aic-head-pill.on{
  color:var(--a-green); border-color:var(--a-green); background:var(--a-green-soft);
}
body.alt-app .aic-head-pill.warn{
  color:var(--a-amber); border-color:var(--a-amber); background:var(--a-amber-soft);
}

/* The scroller is the inner box, not the body — one scrolling region, never nested scrollbars. */
body.alt-app .aic-body{ overflow:hidden; min-height:0; gap:0; }
body.alt-app .aic-body > *{ flex:0 0 auto; }
body.alt-app .aic-body > .aic-scroll{ flex:1 1 auto; min-height:0; }

body.alt-app .aic-scroll{
  overflow:auto;
  display:flex; flex-direction:column; gap:var(--a-4);
  padding-right:var(--a-1);
}
body.alt-app .aic-scroll:focus-visible{ outline:var(--a-focus); outline-offset:var(--a-focus-inset); }
body.alt-app .aic-scroll > .aic-sub{ margin:0; }

/* ---------- the reader's own status ---------- */

/* `.a-callout`, never `.a-err` — no red, no error affordance: a reader with no key configured
   has nothing wrong with their account (see the component's own comment). */
body.alt-app .aic-scroll .a-callout{ margin-bottom:0; }
body.alt-app .aic-status-host:empty{ display:none; }
body.alt-app .aic-status-act{ display:flex; margin-top:var(--a-2); }
body.alt-app .aic-status-btn{ flex:0 0 auto; }

/* ---------- the intro / trust row ---------- */

/* The wide column goes to the panel with the most to say (the trust panel's copy), so the
   shorter intro panel isn't stretched to look unloaded. `.9fr`/`1.5fr` was the pairing where
   neither pads out the other. The floor belongs on the intro column so its headline isn't
   squeezed before the stacking breakpoint. */
body.alt-app .aic-intro-grid{
  display:grid; grid-template-columns:minmax(260px, .9fr) minmax(0, 1.5fr); gap:var(--a-3);
}
body.alt-app .aic-intro-panel,
body.alt-app .aic-trust-panel{
  border:1px solid var(--a-line-soft); border-radius:var(--a-r-lg); background:var(--a-raised);
  padding:var(--a-4);
}
body.alt-app .aic-intro-eyebrow{
  display:flex; align-items:center; gap:7px;
  color:var(--a-dim); font-size:var(--a-fs-11); font-weight:700; line-height:var(--a-lh-tight); letter-spacing:.08em; text-transform:uppercase;
}
body.alt-app .aic-intro-eyebrow-ic{ display:flex; width:14px; height:14px; }
body.alt-app .aic-intro-eyebrow-ic svg{ width:14px; height:14px; }
body.alt-app .aic-intro-h{ margin:var(--a-2) 0 var(--a-2); font:700 var(--a-fs-18)/var(--a-lh-tight) var(--a-display); color:var(--a-text); }
body.alt-app .aic-intro-p{ margin:0; color:var(--a-dim); font-size:var(--a-fs-ctl-sm); line-height:var(--a-lh-body); max-width:62ch; }

body.alt-app .aic-stats{ display:flex; flex-wrap:wrap; gap:var(--a-4); margin-top:var(--a-3); }
body.alt-app .aic-stat{ display:flex; align-items:baseline; gap:6px; }
body.alt-app .aic-stat-n{ font-size:var(--a-fs-18); font-weight:700; color:var(--a-blue-text); font-variant-numeric:tabular-nums; }
body.alt-app .aic-stat-l{ color:var(--a-faint); font-size:var(--a-fs-11); }

body.alt-app .aic-trust-title{ display:flex; align-items:center; gap:8px; color:var(--a-text); font-weight:700; font-size:var(--a-fs-ctl); }
body.alt-app .aic-trust-title-ic{ display:flex; width:15px; height:15px; color:var(--a-blue-text); }
body.alt-app .aic-trust-title-ic svg{ width:15px; height:15px; }
body.alt-app .aic-trust-p{ margin:var(--a-sp-6) 0 var(--a-3); color:var(--a-dim); font-size:var(--a-fs-ctl-sm); line-height:var(--a-lh-body); }
body.alt-app .aic-trust-list{ list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:var(--a-2); }
body.alt-app .aic-trust-li{ display:flex; align-items:flex-start; gap:8px; color:var(--a-dim); font-size:var(--a-fs-ctl-sm); line-height:var(--a-lh-ui); }
body.alt-app .aic-trust-li-ic{ flex:0 0 auto; display:flex; width:14px; height:14px; margin-top:2px; color:var(--a-green); }
body.alt-app .aic-trust-li-ic svg{ width:14px; height:14px; }

/* ---------- the explorer ---------- */

body.alt-app .aic-explorer{ display:flex; flex-direction:column; gap:var(--a-2); }
body.alt-app .aic-explorer-head{
  display:flex; align-items:flex-end; gap:var(--a-3); flex-wrap:wrap;
}
body.alt-app .aic-explorer-title{ min-width:0; }
body.alt-app .aic-explorer-title h2{ margin:0; font:600 var(--a-fs-14)/var(--a-lh-tight) var(--a-body); color:var(--a-text); }
body.alt-app .aic-explorer-title p{ margin:var(--a-sp-4) 0 0; color:var(--a-faint); font-size:var(--a-fs-ctl-sm); font-weight:400; line-height:var(--a-lh-ui); }

/* `.a-search` already centres its icon and pads the input (alt-components.css); this only
   sizes the box in the flex header and pins it to the trailing edge, opposite the title. */
body.alt-app .aic-search{ width:min(320px, 100%); margin-left:auto; }

body.alt-app .aic-filters{ display:flex; flex-wrap:wrap; gap:6px; }
/* `.a-chip` supplies the geometry, `.on` wash and focus ring; this adds only what a FILTER use
   needs — no clamp to the chip's default 170px max-width, and a fixed icon slot. */
body.alt-app .aic-filter{ max-width:none; }
body.alt-app .aic-filter-ic{ display:flex; width:13px; height:13px; flex:0 0 auto; }
body.alt-app .aic-filter-ic svg{ width:13px; height:13px; }

body.alt-app .aic-results-meta{ margin:0; color:var(--a-faint); font-size:var(--a-fs-ctl-sm); font-weight:400; line-height:var(--a-lh-ui); }

body.alt-app .aic-grid{
  display:grid; grid-template-columns:repeat(auto-fill, minmax(min(320px, 100%), 1fr)); gap:var(--a-3);
}
body.alt-app .aic-grid[hidden]{ display:none; }

/* ---------- one capability card ---------- */

body.alt-app .aic-card{
  display:grid; grid-template-columns:36px minmax(0, 1fr); gap:10px;
  padding:var(--a-3); border:1px solid var(--a-line-soft); border-radius:var(--a-r);
  background:var(--a-raised);
}
body.alt-app .aic-card-icon{
  width:36px; height:36px; display:flex; align-items:center; justify-content:center;
  border-radius:var(--a-r-sm);
}
body.alt-app .aic-card-icon svg{ width:17px; height:17px; }
/* The four-token pairing this file's own header explains. */
body.alt-app .aic-card-icon-write,
body.alt-app .aic-card-icon-okrs,
body.alt-app .aic-card-icon-help{ color:var(--a-blue-text); background:var(--a-blue-soft); }
body.alt-app .aic-card-icon-tasks,
body.alt-app .aic-card-icon-imports{ color:var(--a-green); background:var(--a-green-soft); }
body.alt-app .aic-card-icon-email{ color:var(--a-purple); background:var(--a-purple-soft); }
body.alt-app .aic-card-icon-summaries{ color:var(--a-amber); background:var(--a-amber-soft); }

body.alt-app .aic-card-body{ min-width:0; }
body.alt-app .aic-card-top{ display:flex; align-items:flex-start; flex-wrap:wrap; gap:8px; }
body.alt-app .aic-card-title{ margin:0; min-width:0; font:600 var(--a-fs-ctl)/var(--a-lh-ui) var(--a-body); color:var(--a-text); }

/* "Automatic" — a word first, a chip second: meaning is never carried by colour alone, so the
   marker is a WORD and `.a-chip` merely frames it. */
body.alt-app .aic-auto{ flex:0 0 auto; margin-left:auto; color:var(--a-dim); cursor:default; }

body.alt-app .aic-card-desc{ margin:var(--a-sp-6) 0 0; color:var(--a-dim); font-size:var(--a-fs-ctl-sm); line-height:var(--a-lh-ui); }

body.alt-app .aic-card-find{
  display:flex; align-items:flex-start; gap:6px;
  margin-top:var(--a-2); padding-top:var(--a-2); border-top:1px solid var(--a-line-soft);
  color:var(--a-faint); font-size:var(--a-fs-ctl-sm); font-weight:400; line-height:var(--a-lh-ui);
}
body.alt-app .aic-find-ic{ flex:0 0 auto; display:flex; width:12px; height:12px; margin-top:2px; color:var(--a-faint); }
body.alt-app .aic-find-ic svg{ width:12px; height:12px; }
body.alt-app .aic-find-label{ flex:0 0 auto; color:var(--a-dim); font-weight:600; white-space:nowrap; }

/* A routing-table job with no description still renders (see aiCapabilityRows()) and says so,
   amber not red. ai-capabilities-dialog.test.js's generation guard keeps it unreachable. */
body.alt-app .aic-card-undescribed .aic-find-text{ color:var(--a-amber); font-style:italic; }

/* ---------- the two empty states the explorer can show ---------- */

/* `.a-empty*` is alt-components.css's three-states primitive; this only narrows the padding
   because the panel already has its own gutter. */
body.alt-app .aic-empty{ padding:var(--a-5) var(--a-3); }

/* ---------- the footer note ---------- */

body.alt-app .aic-foot-note{ display:flex; align-items:center; gap:var(--a-sp-8); color:var(--a-faint); font-size:var(--a-fs-ctl-sm); font-weight:400; line-height:var(--a-lh-ui); }
body.alt-app .aic-foot-ic{ display:flex; width:13px; height:13px; color:var(--a-blue-text); }
body.alt-app .aic-foot-ic svg{ width:13px; height:13px; }

/* ---------- the toolbar trigger ----------
   Nothing calls aiCapabilitiesTrigger() today (the live entry is the menu row, `.a-menu-item`);
   kept so a second host doesn't invent its own treatment. */
body.alt-app .aic-trigger{ display:inline-flex; align-items:center; gap:6px; }
body.alt-app .aic-trigger-ic{ flex:0 0 auto; display:flex; width:14px; height:14px; color:var(--a-blue-text); }
body.alt-app .aic-trigger-ic svg{ width:14px; height:14px; display:block; }
body.alt-app .aic-trigger-t{ white-space:nowrap; }

/* ================= NARROW ================= */

/* The intro row stacks earlier (820px) than the card grid (720px): the grid stacks when a card
   gets unreadable, the intro row when the shorter panel starts being padded out. Re-measure
   both if the trust copy's length changes. */
@media (max-width: 820px){
  body.alt-app .aic-intro-grid{ grid-template-columns:1fr; }
}

/* No card-grid breakpoint: auto-fill with a min(320px, 100%) floor gives 1 column on a phone,
   2 around 1024px, 3 around 1440px and 4 at 2000px by itself. */

@media (max-width: 520px){
  /* The provider pill drops BELOW the title instead of squeezing it to three lines beside it. */
  body.alt-app .aic-head-left{ flex-wrap:wrap; row-gap:4px; }
  body.alt-app .aic-head-left .settings-modal-title{ flex:1 1 100%; }
  body.alt-app .aic-scroll{ gap:var(--a-3); padding-right:0; }
  body.alt-app .aic-intro-panel,
  body.alt-app .aic-trust-panel{ padding:var(--a-3); }
  body.alt-app .aic-explorer-head{ align-items:stretch; }
  body.alt-app .aic-search{ width:100%; margin-left:0; }
  body.alt-app .aic-card{ grid-template-columns:30px minmax(0, 1fr); padding:var(--a-2); }
  body.alt-app .aic-card-icon{ width:30px; height:30px; }
  body.alt-app .aic-card-icon svg{ width:15px; height:15px; }
  body.alt-app .aic-auto{ margin-left:0; }
}
