/* admin-ui.css — the admin page pattern (03-Design/admin-ui-foundation.md): row action menus, SweetAlert2 dialogs on
   the theme tokens, grouped choice lists, and grids that become cards on small screens. Plain CSS on the tokens of
   theme.css, so light and dark follow the theme without rules of their own. */

/* ---------- row action menu ---------- */
.action-menu { position: relative; display: inline-flex; }
.action-menu .menu { min-width: 264px; }
.menu-item .menu-item-text { display: flex; min-width: 0; flex-direction: column; align-items: flex-start; text-align: left; }
.menu-item .menu-item-hint { font-size: 12px; font-weight: 500; line-height: 1.35; white-space: normal; color: rgb(var(--s-muted)); }
.menu-item[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.menu-item[aria-disabled="true"]:hover { background: transparent; }
.menu-item:focus-visible { outline: 2px solid rgb(var(--s-brand)); outline-offset: -2px; }

/* ---------- dialogs (SweetAlert2) ---------- */
.swal2-container.swal-sophia-backdrop { background: rgb(9 11 18 / .55); backdrop-filter: blur(2px); }
.swal2-popup.swal-sophia {
  width: min(34rem, calc(100vw - 2rem)); padding: 1.5rem;
  border: 1px solid rgb(var(--s-line)); border-radius: var(--r-lg);
  background: rgb(var(--s-surface)); color: rgb(var(--s-fg)); box-shadow: var(--shadow-pop);
  font-family: inherit; text-align: left;
}
.swal-sophia .swal-sophia-title { margin: 0; padding: 0; font-size: 18px; font-weight: 800; letter-spacing: -.01em; text-align: left; color: rgb(var(--s-fg)); }
.swal-sophia .swal-sophia-body { margin: .5rem 0 0; padding: 0; overflow: visible; font-size: 14px; line-height: 1.55; text-align: left; color: rgb(var(--s-muted)); }
.swal-sophia .swal-sophia-body form { margin-top: .75rem; color: rgb(var(--s-fg)); }
.swal-sophia .swal-sophia-actions { width: 100%; margin: 1.25rem 0 0; padding: 0; justify-content: flex-end; gap: .5rem; }
.swal-sophia .swal-sophia-validation {
  margin: 1rem 0 0; padding: .6rem .8rem; justify-content: flex-start;
  border-radius: var(--r-sm); background: rgb(var(--s-err) / .1); color: rgb(var(--s-err));
  font-size: 13px; font-weight: 600;
}
.swal-sophia .swal-sophia-validation::before { display: none; }
/* A one-line prompt (dialogs.prompt): SweetAlert2 gives its own input side margins on top of a full width, which pushed the
   box past the dialog's edge (owner's test); the box and its label line up with the title instead. */
.swal-sophia .swal2-input { box-sizing: border-box; width: 100%; max-width: 100%; margin: .4rem 0 0; }
.swal-sophia .swal2-input-label { justify-content: flex-start; margin: 1rem 0 0; text-align: left; }
.swal-sophia .swal2-loader { border-color: rgb(var(--s-brand)) transparent rgb(var(--s-brand)) transparent; }

/* SweetAlert2's animated icons on the tokens (decision D52): the dialog centres around its icon. */
.swal-sophia { --swal2-icon-zoom: .85; }
.swal-sophia.swal-sophia-with-icon .swal-sophia-title,
.swal-sophia.swal-sophia-with-icon .swal-sophia-body { text-align: center; }
.swal-sophia.swal-sophia-with-icon .swal-sophia-actions { justify-content: center; }
.swal-sophia .swal2-icon { margin: .25rem auto 1.1rem; }
.swal-sophia .swal2-icon.swal2-question { border-color: rgb(var(--s-brand) / .4); color: rgb(var(--s-brand)); }
.swal-sophia .swal2-icon.swal2-info { border-color: rgb(var(--s-accent) / .45); color: rgb(var(--s-accent)); }
.swal-sophia .swal2-icon.swal2-warning { border-color: rgb(var(--s-warn) / .5); color: rgb(var(--s-warn)); }
.swal-sophia .swal2-icon.swal2-error { border-color: rgb(var(--s-err) / .45); color: rgb(var(--s-err)); }
.swal-sophia .swal2-icon.swal2-error [class^=swal2-x-mark-line] { background-color: rgb(var(--s-err)); }
.swal-sophia .swal2-icon.swal2-success { border-color: rgb(var(--s-ok) / .45); color: rgb(var(--s-ok)); }
.swal-sophia .swal2-icon.swal2-success [class^=swal2-success-line] { background-color: rgb(var(--s-ok)); }
.swal-sophia .swal2-icon.swal2-success .swal2-success-ring { border-color: rgb(var(--s-ok) / .3); }
@media (prefers-reduced-motion: reduce) {
  .swal2-container.swal-sophia-backdrop, .swal2-popup.swal-sophia, .swal-sophia .swal2-icon, .swal-sophia .swal2-icon * { animation: none !important; transition: none !important; }
}

/* ---------- settings page (story #84) ---------- */
.cell-value { max-width: 26rem; overflow-wrap: anywhere; }
.settings-radios { display: flex; flex-wrap: wrap; gap: 1.25rem; padding: .4rem 0; }
.swal2-popup.swal-sophia.settings-import-popup { width: min(60rem, calc(100vw - 2rem)); }
.settings-import-lines { max-height: 50vh; overflow: auto; border: 1px solid rgb(var(--s-line)); border-radius: .5rem; }
.settings-import-table th, .settings-import-table td { vertical-align: top; }
.settings-import-table .cell-value { max-width: 16rem; overflow-wrap: anywhere; }

/* ---------- audit trail: the grid loaded after the filters (story #85, D61) ---------- */
.audit-loading { display: flex; align-items: center; justify-content: center; gap: .6rem; padding: 3rem 1rem; color: rgb(var(--s-muted)); }
.spinner { display: inline-block; width: 1.25rem; height: 1.25rem; border-radius: 999px; border: 2px solid rgb(var(--s-line)); border-top-color: rgb(var(--s-brand)); animation: sophia-spin .8s linear infinite; }
@keyframes sophia-spin { to { transform: rotate(360deg); } }
[data-audit-entries].is-loading > * { opacity: .55; pointer-events: none; transition: opacity .15s; }
[data-audit-entries].is-loading > .audit-loading { opacity: 1; }
.audit-source.is-database { background: rgb(var(--s-surface-2)); color: rgb(var(--s-fg)); border-color: rgb(var(--s-line)); }
.audit-source.is-elasticsearch { background: rgb(var(--s-accent) / .14); color: rgb(var(--s-fg)); border-color: rgb(var(--s-accent) / .3); }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } [data-audit-entries].is-loading > * { transition: none; } }

/* ---------- audit mirror: the live panel (story #85, D63) ---------- */
.mirror-topology { display: grid; gap: 1rem; align-items: stretch; }
@media (min-width: 48rem) { .mirror-topology { grid-template-columns: minmax(0, 1fr) minmax(9rem, .7fr) minmax(0, 1fr); } }
.mirror-node { display: flex; flex-direction: column; gap: .2rem; min-width: 0; min-height: 7rem; padding: 1rem 1.1rem; border: 1px solid rgb(var(--s-line)); border-radius: .75rem; background: rgb(var(--s-surface-2)); }
.mirror-node-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .25rem; }
.mirror-node-head .label, .mirror-link .label { margin: 0; }
.mirror-node-name { font-weight: 700; overflow-wrap: anywhere; }
.mirror-node-health { font-size: .875rem; font-weight: 600; }
.mirror-node-where { font-size: .8125rem; color: rgb(var(--s-muted)); overflow-wrap: anywhere; }
.mirror-dot { --pulse: var(--s-muted); display: inline-block; flex: none; width: .65rem; height: .65rem; border-radius: 999px; background: rgb(var(--s-line)); }
.mirror-dot.is-green { --pulse: var(--s-ok); background: rgb(var(--s-ok)); box-shadow: 0 0 0 3px rgb(var(--s-ok) / .2); }
.mirror-dot.is-yellow { --pulse: var(--s-warn); background: rgb(var(--s-warn)); box-shadow: 0 0 0 3px rgb(var(--s-warn) / .22); }
.mirror-dot.is-red { --pulse: var(--s-err); background: rgb(var(--s-err)); box-shadow: 0 0 0 3px rgb(var(--s-err) / .2); }
.mirror-dot.is-unknown { background: rgb(var(--s-muted)); }
.mirror-dot.is-live { animation: mirror-live 1.6s ease-in-out infinite; }
@keyframes mirror-live { 0%, 100% { opacity: 1; box-shadow: 0 0 0 3px rgb(var(--pulse) / .3); } 50% { opacity: .55; box-shadow: 0 0 0 7px rgb(var(--pulse) / 0); } }
.mirror-link { --flow: var(--s-ok); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem; padding: .25rem .5rem; text-align: center; }
.mirror-link-line { position: relative; display: block; width: 100%; min-width: 6rem; height: 3px; overflow: hidden; border-radius: 3px; background: rgb(var(--s-line)); }
/* The flow (decision D80): a highlight that travels the whole line and leaves it before the next pass begins. A background
   loop instead ended each pass with the highlight still on screen, so every restart looked like a stutter. */
.mirror-link-line::after { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 35%; border-radius: inherit; background: linear-gradient(90deg, transparent, rgb(var(--flow)), transparent); opacity: 0; transform: translateX(-100%); }
.mirror-link.is-flowing .mirror-link-line::after { opacity: 1; animation: line-flow 2.4s linear infinite; }
.mirror-link.is-warn { --flow: var(--s-warn); }
.mirror-link.is-idle .mirror-link-line::after { opacity: 0; animation: none; }
.mirror-link.is-broken .mirror-link-line { background: repeating-linear-gradient(90deg, rgb(var(--s-err) / .8) 0 .5rem, transparent .5rem .9rem); }
@keyframes line-flow { from { transform: translateX(-100%); } to { transform: translateX(286%); } }
@media (prefers-reduced-motion: reduce) { .mirror-dot.is-live, .mirror-link.is-flowing .mirror-link-line::after, .storage-link-line::after { animation: none; } }

/* ---------- audit mirror page (story #85, D60) ---------- */
.mirror-layout { display: grid; gap: 1rem; align-items: start; }
@media (min-width: 64rem) { .mirror-layout { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); } }
.mirror-fields { display: grid; gap: 1rem; min-width: 0; border: 0; padding: 0; margin: 0; }
.mirror-inline { display: flex; flex-wrap: wrap; gap: .5rem; }
.mirror-inline .input { flex: 1 1 16rem; min-width: 0; }
.mirror-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem; }
.mirror-results { display: grid; gap: .6rem; padding: .75rem .9rem; border: 1px solid rgb(var(--s-line)); border-radius: .6rem; background: rgb(var(--s-surface-2)); }
.mirror-step { display: grid; grid-template-columns: 1.5rem minmax(0, 1fr); column-gap: .5rem; overflow-wrap: anywhere; }
.mirror-step-mark { grid-row: span 2; display: grid; place-items: center; width: 1.3rem; height: 1.3rem; border-radius: 999px; font-size: .75rem; font-weight: 800; }
.mirror-step.is-ok .mirror-step-mark { background: rgb(var(--s-ok) / .15); color: rgb(var(--s-ok)); }
.mirror-step.is-warning .mirror-step-mark { background: rgb(var(--s-warn) / .18); color: rgb(var(--s-warn)); }
.mirror-step.is-failed .mirror-step-mark { background: rgb(var(--s-err) / .15); color: rgb(var(--s-err)); }
.mirror-notice { padding: .6rem .75rem; border: 1px solid; border-radius: .6rem; font-size: .875rem; overflow-wrap: anywhere; }
.mirror-notice.is-warn { background: rgb(var(--s-warn) / .1); border-color: rgb(var(--s-warn) / .3); }
.mirror-notice.is-err { background: rgb(var(--s-err) / .08); border-color: rgb(var(--s-err) / .3); }
.mirror-status-list { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .45rem 1rem; font-size: .875rem; }
.mirror-status-list dt { color: rgb(var(--s-muted)); }
.mirror-status-list dd { margin: 0; overflow-wrap: anywhere; }
.mirror-cert { display: grid; gap: .3rem; justify-items: start; padding: .75rem 0; border-bottom: 1px solid rgb(var(--s-line)); }
.mirror-cert:last-child { border-bottom: 0; }
.mirror-cert-print { overflow-wrap: anywhere; }

/* ---------- a switch: every on/off field of the portal (owner, 2026-09-24). A checkbox with role="switch" inside a
   .switch label, or a .switch span in a row; a choice among items (rows, roles, permissions, days) stays a checkbox. ---------- */
.switch { display: inline-flex; align-items: center; gap: .6rem; font-weight: 600; cursor: pointer; }
.switch input { appearance: none; position: relative; width: 2.4rem; height: 1.35rem; margin: 0; border-radius: 999px; background: rgb(var(--s-line)); cursor: pointer; transition: background-color .15s; }
.switch input::after { content: ""; position: absolute; top: .15rem; left: .15rem; width: 1.05rem; height: 1.05rem; border-radius: 999px; background: rgb(var(--s-surface)); box-shadow: 0 1px 2px rgb(0 0 0 / .25); transition: transform .15s; }
.switch input:checked { background: rgb(var(--s-brand)); }
.switch input:checked::after { transform: translateX(1.05rem); }
.switch input:focus-visible { outline: 2px solid rgb(var(--s-brand)); outline-offset: 2px; }
.switch input:disabled { opacity: .6; cursor: not-allowed; }
@media (prefers-reduced-motion: reduce) { .switch input, .switch input::after { transition: none; } }

/* ---------- a file field in the page's look and language (partial _FilePick, file-pick.js) ---------- */
.file-pick { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; padding: .55rem .7rem; border: 1px dashed rgb(var(--s-line)); border-radius: .6rem; background: rgb(var(--s-surface-2)); transition: border-color .15s, background-color .15s; }
.file-pick-input { position: absolute; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.file-pick-input:focus-visible + .file-pick-button { outline: 2px solid rgb(var(--s-brand)); outline-offset: 2px; }
.file-pick-button { cursor: pointer; }
.file-pick-name { min-width: 0; overflow-wrap: anywhere; color: rgb(var(--s-muted)); }
.file-pick.has-file .file-pick-name { color: rgb(var(--s-fg)); font-weight: 600; }
.file-pick-drop { color: rgb(var(--s-muted)); font-size: .8125rem; }
.file-pick.has-file .file-pick-drop { display: none; }
.file-pick.is-dragging { border-color: rgb(var(--s-brand)); background: rgb(var(--s-brand) / .06); }
.file-pick:has(.input-validation-error) { border-color: rgb(var(--s-err)); }
@media (prefers-reduced-motion: reduce) { .file-pick { transition: none; } }

/* ---------- a field's note behind an info icon (decision D51) ---------- */
.label-row { display: flex; align-items: center; gap: .35rem; margin-bottom: .35rem; }
.label-row .label { margin-bottom: 0; }
.label-row.is-inline { display: inline-flex; margin-bottom: 0; }
.info-tip { position: relative; display: inline-flex; }
.info-tip-button {
  display: inline-grid; place-items: center; width: 1rem; height: 1rem; margin: -2px 0; padding: 0;
  border: 0; border-radius: 999px; background: transparent; color: rgb(var(--s-muted)); cursor: help;
}
.info-tip-button svg { width: .95rem; height: .95rem; }
.info-tip-button:hover, .info-tip-button[aria-expanded="true"] { color: rgb(var(--s-brand)); }
.info-tip-button:focus-visible { outline: 2px solid rgb(var(--s-brand)); outline-offset: 1px; }
.info-tip-text {
  position: absolute; z-index: 70; top: calc(100% + .5rem); left: 50%; transform: translateX(-50%);
  width: max-content; max-width: min(18rem, calc(100vw - 2rem)); padding: .5rem .7rem;
  border-radius: var(--r-sm); background: rgb(var(--s-fg)); color: rgb(var(--s-bg)); box-shadow: var(--shadow-pop);
  font-size: 12px; font-weight: 500; line-height: 1.45; letter-spacing: normal; text-align: left; text-transform: none; white-space: normal;
}
.info-tip-text::before {
  content: ""; position: absolute; bottom: 100%; left: 50%; margin-left: -5px;
  border: 5px solid transparent; border-bottom-color: rgb(var(--s-fg));
}
/* In a dialog a note may be longer (what a field does and how to fill it), so it is wider there and stays readable. */
.swal2-popup .info-tip-text { max-width: min(26rem, calc(100vw - 2rem)); }
.info-tip.is-above .info-tip-text { top: auto; bottom: calc(100% + .5rem); }
.info-tip.is-above .info-tip-text::before { top: 100%; bottom: auto; border-bottom-color: transparent; border-top-color: rgb(var(--s-fg)); }
.info-tip.is-start .info-tip-text { left: -.5rem; transform: none; }
.info-tip.is-start .info-tip-text::before { left: 1rem; }
.info-tip.is-end .info-tip-text { right: -.5rem; left: auto; transform: none; }
.info-tip.is-end .info-tip-text::before { right: 1rem; left: auto; margin-left: 0; margin-right: -5px; }

/* ---------- grouped choice lists (permissions) ---------- */
.choice-scroll { max-height: min(60vh, 30rem); overflow-y: auto; padding-right: .25rem; }
.choice-group { border-bottom: 1px solid rgb(var(--s-line) / .7); }
.choice-group:last-child { border-bottom: 0; }
.choice-group > summary {
  display: flex; align-items: center; gap: .75rem; padding: .7rem 0;
  list-style: none; cursor: pointer; font-size: 13px; font-weight: 700; color: rgb(var(--s-fg));
}
.choice-group > summary::-webkit-details-marker { display: none; }
.choice-group > summary::after {
  content: ""; flex: none; width: .45rem; height: .45rem; margin-right: .3rem;
  border-right: 2px solid rgb(var(--s-muted)); border-bottom: 2px solid rgb(var(--s-muted));
  transform: rotate(45deg); transition: transform .15s var(--ease);
}
.choice-group[open] > summary::after { transform: rotate(-135deg); }
.choice-group > summary:focus-visible { outline: 2px solid rgb(var(--s-brand)); outline-offset: 2px; border-radius: var(--r-sm); }
.choice-group .choice-count { margin-left: auto; font-size: 12px; font-weight: 600; color: rgb(var(--s-muted)); }
.choice-group .choice-list { padding-bottom: .5rem; }

/* ---------- admin sidebar (decision D50): a group's items indented under it ---------- */
.nav-group-items .nav-link { padding-left: 2.4rem; }
.nav-link.has-active { color: rgb(var(--s-fg)); }
@media (min-width: 1024px) { .app.is-collapsed .nav-group-items .nav-link { padding-left: 0; } }
@media (max-width: 1023px) { .app.is-collapsed .nav-group-items .nav-link { padding-left: 2.4rem; } }

/* ---------- event details window (audit trail, and the log page later) ---------- */
.swal2-popup.swal-sophia.event-details-popup { width: min(54rem, calc(100vw - 2rem)); }
.event-details { display: grid; gap: .9rem; color: rgb(var(--s-fg)); }
.event-details-head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; }
.event-details-head .event-details-copy { margin-left: auto; }
.event-details-tabs { display: flex; gap: .25rem; border-bottom: 1px solid rgb(var(--s-line)); }
.event-details-tab {
  margin-bottom: -1px; padding: .5rem .85rem;
  border: 1px solid transparent; border-radius: var(--r-sm) var(--r-sm) 0 0; background: transparent;
  font-size: 13px; font-weight: 700; color: rgb(var(--s-muted)); cursor: pointer;
}
.event-details-tab:hover { color: rgb(var(--s-fg)); }
.event-details-tab[aria-selected="true"] { color: rgb(var(--s-fg)); background: rgb(var(--s-surface)); border-color: rgb(var(--s-line)); border-bottom-color: rgb(var(--s-surface)); }
.event-details-tab:focus-visible { outline: 2px solid rgb(var(--s-brand)); outline-offset: -2px; }
.event-details-count { margin-left: .4rem; font-weight: 600; color: rgb(var(--s-muted)); }
.event-details-panel { max-height: min(60vh, 34rem); overflow: auto; }
.event-details-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); column-gap: 1.5rem; margin: 0; }
.event-details-field { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); gap: .75rem; padding: .5rem 0; border-bottom: 1px solid rgb(var(--s-line) / .6); font-size: 13px; }
.event-details-field dt { padding-top: .1rem; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: rgb(var(--s-muted)); }
.event-details-field dd { margin: 0; overflow-wrap: anywhere; }
.event-details-changes { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 13px; }
.event-details-changes th {
  padding: .5rem .65rem; text-align: left; white-space: nowrap; background: rgb(var(--s-surface-2));
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: rgb(var(--s-muted));
}
.event-details-changes th:first-child { width: 26%; }
.event-details-changes td { padding: .5rem .65rem; vertical-align: top; border-bottom: 1px solid rgb(var(--s-line) / .6); overflow-wrap: anywhere; }
.event-details-changes td.is-old { background: rgb(var(--s-err) / .08); }
.event-details-changes td.is-new { background: rgb(var(--s-ok) / .1); }
.event-details-changes td.is-empty { color: rgb(var(--s-muted)); }
.event-details-changes td.is-sensitive { font-style: italic; color: rgb(var(--s-muted)); }
.event-details-json {
  margin: 0; padding: .75rem .9rem; border-radius: var(--r-sm); background: rgb(var(--s-surface-2));
  font-size: 12px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere;
  /* A stack trace or a large properties object scrolls inside the window instead of pushing it off the screen (#87). */
  max-height: 24rem; overflow: auto;
}

/* A value in the details window that leads somewhere: the log event's trace id, which filters the page by that trace. */
.event-details-field a { color: rgb(var(--s-accent)); text-decoration: underline; text-underline-offset: 2px; }

/* ---------- log page (story #87, decisions D70, D71) ---------- */

/* A card per level with its count, above the grid: the filter most people want, and the quickest count to read. */
.level-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr)); gap: .6rem; }
.level-card {
  display: flex; flex-direction: column; gap: .15rem; padding: .7rem .9rem; border-radius: .75rem;
  border: 1px solid rgb(var(--s-line)); background: rgb(var(--s-surface)); color: inherit; text-decoration: none;
  transition: border-color .12s, background .12s;
}
.level-card:hover { border-color: rgb(var(--s-brand) / .5); background: rgb(var(--s-surface-2)); }
.level-card:focus-visible { outline: 2px solid rgb(var(--s-brand)); outline-offset: 2px; }
.level-card.is-active { border-color: rgb(var(--s-brand)); background: rgb(var(--s-brand) / .08); }
.level-card-count { font-size: 20px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.level-card-label { display: flex; align-items: center; gap: .4rem; font-size: 12px; color: rgb(var(--s-muted)); }
.level-card-label .dot { width: .5rem; height: .5rem; border-radius: 50%; background: rgb(var(--s-muted)); }
.level-card.level-warning .level-card-label .dot { background: rgb(var(--s-warn)); }
.level-card.level-error .level-card-label .dot,
.level-card.level-fatal .level-card-label .dot { background: rgb(var(--s-err)); }
.level-card.level-information .level-card-label .dot { background: rgb(var(--s-brand)); }

/* One line per event. A log that wraps cannot be scanned, and the cell absorbs the width left over so the table
   never grows wider than the page: max-width 0 with width 100% is what makes a cell shrink to its column. */
.log-message-cell { max-width: 0; width: 100%; }
.log-message { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-row-actions { display: inline-flex; align-items: center; gap: .3rem; justify-content: flex-end; }
.log-threw { padding-inline: .45rem; font-weight: 800; }

@media (max-width: 767px) {
  /* As a card, the message may use the room it has. */
  .log-message-cell { max-width: none; }
  .log-message { white-space: normal; }
}

/* ---------- the advisor's findings (stories #55 and #62, decision D76) ---------- */

/* Grouped by severity and collapsible: twenty-three notes in one list is a page nobody scrolls twice. */
.finding-group + .finding-group { margin-top: .75rem; }
.finding-group > summary {
  display: flex; align-items: center; gap: .6rem; padding: .5rem .25rem; border-radius: var(--r-sm);
  cursor: pointer; list-style: none; font-size: 14px;
}
.finding-group > summary::-webkit-details-marker { display: none; }
.finding-group > summary::after {
  content: ""; width: .5rem; height: .5rem; margin-left: .1rem;
  border-right: 2px solid rgb(var(--s-muted)); border-bottom: 2px solid rgb(var(--s-muted));
  transform: rotate(-45deg); transition: transform .15s;
}
.finding-group[open] > summary::after { transform: rotate(45deg); }
.finding-group > summary:hover { background: rgb(var(--s-surface-2)); }
.finding-group > summary:focus-visible { outline: 2px solid rgb(var(--s-brand)); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .finding-group > summary::after { transition: none; } }


/* ---------- storage (story #52, D78) ----------
   The cluster as three tiles in the audit mirror page's own node style: primary, secondary, and the fallback that is
   always there. The node that serves is outlined; an empty role is dashed, so a missing secondary reads as a gap. */
.storage-topology { display: grid; gap: 1rem; align-items: stretch; }
/* Flex on the wide layout: the row holds node, line, node, line, node, and only the tiles should share the width. */
@media (min-width: 56rem) { .storage-topology { display: flex; } .storage-topology > .storage-node { flex: 1 1 0; min-width: 0; } .storage-topology > .storage-link { flex: 0 0 auto; } }
.storage-node { min-height: 8rem; }
.storage-node.is-serving { border-color: rgb(var(--s-ok) / .7); box-shadow: 0 0 0 1px rgb(var(--s-ok) / .3); }
.storage-node.is-fallback { border-color: rgb(var(--s-warn) / .35); background: rgb(var(--s-warn) / .05); }
.storage-node.is-empty { border-style: dashed; background: transparent; align-items: center; justify-content: center; text-align: center; }
.storage-node > .badge { align-self: flex-start; }
.storage-link { --flow: var(--s-warn); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem; padding: 0 .5rem; }
.storage-link-line { position: relative; display: block; width: 100%; min-width: 5rem; height: 2px; overflow: hidden; border-radius: 2px; background: rgb(var(--s-line)); }
.storage-link-line::after { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 35%; border-radius: inherit; background: linear-gradient(90deg, transparent, rgb(var(--flow)), transparent); animation: line-flow 2.4s linear infinite; }
/* While failed over the copying runs the other way, standby back towards the primary, and the line says so. */
.storage-link.is-reversed .storage-link-line::after { animation-direction: reverse; }
.storage-link.is-idle .storage-link-line::after { animation: none; opacity: 0; }
/* ---------- feedback (story #118) ----------
   The page's two tabs are links in the event-details tab style. The rated answer's dialog fits the screen: its head stays,
   and only the open tab scrolls — one scroll area, never the dialog and a box inside it. */
.feedback-tabs .event-details-tab { text-decoration: none; }
.feedback-tabs .event-details-tab[aria-current="page"] { color: rgb(var(--s-fg)); background: rgb(var(--s-surface)); border-color: rgb(var(--s-line)); border-bottom-color: rgb(var(--s-surface)); }
.feedback-dialog { display: flex; flex-direction: column; gap: .6rem; max-height: calc(100vh - 13rem); min-height: 0; }
.feedback-dialog-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding-right: .25rem; }
.feedback-answer { padding: .75rem 1rem; border: 1px solid rgb(var(--s-line)); border-radius: .5rem; background: rgb(var(--s-surface-2)); font-size: .9rem; line-height: 1.55; }
.feedback-answer > * + * { margin-top: .6rem; }
.feedback-answer ul, .feedback-answer ol { padding-left: 1.25rem; list-style: revert; }
.feedback-answer table { border-collapse: collapse; } .feedback-answer th, .feedback-answer td { border: 1px solid rgb(var(--s-line)); padding: .25rem .5rem; }
.feedback-sources { padding-left: 1.75rem; list-style: decimal; font-size: .85rem; } .feedback-sources li + li { margin-top: .2rem; }
.feedback-sources .badge { margin-left: .35rem; }

/* ---------- cache (story #113, D155, D156) ----------
   The two tiers drawn as storage draws its cluster: memory in every host, a link, and Redis or a dashed gap. While the
   hosts switch, the link's sync icon turns and each host still on the old tier turns its own; once all have switched it
   stands still and the line flows (Redis) or rests (memory only). */
.cache-link-icon { display: inline-flex; width: 1.25rem; height: 1.25rem; color: rgb(var(--s-muted)); }
.cache-link-icon svg { width: 100%; height: 100%; }
.storage-link.is-switching .cache-link-icon { color: rgb(var(--s-brand)); animation: sophia-spin 1.2s linear infinite; }
.storage-link.is-switching .storage-link-line::after { animation-duration: 1.2s; }
.cache-host-switching { display: inline-flex; width: 1rem; height: 1rem; margin-left: .35rem; vertical-align: -.15rem; color: rgb(var(--s-brand)); animation: sophia-spin 1.2s linear infinite; }
.cache-host-switching svg { width: 100%; height: 100%; }
@media (prefers-reduced-motion: reduce) { .storage-link.is-switching .cache-link-icon, .cache-host-switching { animation-duration: 3.6s; } }
.storage-cluster-actions { margin-top: 1.25rem; padding-top: 1.1rem; border-top: 1px solid rgb(var(--s-line)); }
.storage-alert { display: flex; flex-direction: column; gap: .85rem; padding: .9rem 1rem; border: 1px solid rgb(var(--s-warn) / .45); border-radius: .65rem; background: rgb(var(--s-warn) / .09); font-size: 13px; }
.storage-alert.is-quiet { border-color: rgb(var(--s-line)); background: transparent; color: rgb(var(--s-muted)); }
@media (min-width: 45rem) { .storage-alert { flex-direction: row; align-items: center; justify-content: space-between; } }
.storage-name { min-width: 12rem; }
.storage-health { display: inline-flex; align-items: center; gap: .55rem; white-space: nowrap; }
.storage-sync-error { color: rgb(var(--s-err)); }
.storage-where { font-size: 12.5px; min-width: 14rem; overflow-wrap: anywhere; }
.storage-pair { display: grid; gap: 1rem; }
@media (min-width: 40rem) { .storage-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.storage-number { max-width: 20rem; }
.storage-hint-tight { margin-top: -.5rem; }
.storage-check { display: inline-flex; align-items: center; gap: .6rem; font-weight: 600; cursor: pointer; }

/* ---------- one request's steps (story #55, D77) ----------
   A row per step: name (indented under the step that started it), a bar drawn against the longest step, the
   duration, where it came from, and the magnifier. The bar's colour is the share of the whole request the step
   held - the indicator that makes the slow one findable without reading every number in the column. */
.span-tree { list-style: none; margin: 1rem 0 0; padding: 0; display: flex; flex-direction: column; }
.span-row {
  display: grid;
  grid-template-columns: minmax(12rem, 2fr) minmax(6rem, 1fr) auto minmax(5rem, auto) auto;
  align-items: center; gap: .35rem 1rem;
  padding: .45rem .25rem;
  border-bottom: 1px solid rgb(var(--s-line) / .6);
}
.span-row:last-child { border-bottom: 0; }
.span-label { display: flex; align-items: center; min-width: 0; }
.span-name { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.span-row.is-failed .span-name { color: rgb(var(--s-err)); font-weight: 700; }
.span-indent { flex-shrink: 0; align-self: stretch; border-left: 1px solid rgb(var(--s-line)); }
.span-indent-0 { width: 0; border-left: 0; }
.span-indent-1 { width: .9rem; }
.span-indent-2 { width: 1.8rem; }
.span-indent-3 { width: 2.7rem; }
.span-indent-4 { width: 3.6rem; }
.span-indent-5 { width: 4.5rem; }
.span-indent-6 { width: 5.4rem; }
.span-indent-7 { width: 6.3rem; }
.span-indent-8 { width: 7.2rem; }
.span-bar-track { height: 8px; border-radius: 999px; background: rgb(var(--s-surface-2)); overflow: hidden; }
.span-bar { display: block; height: 100%; border-radius: 999px; background: rgb(var(--s-accent)); }
.span-bar.span-warm { background: rgb(var(--s-warn)); }
.span-bar.span-hot { background: rgb(var(--s-err)); }
.span-row.is-failed .span-bar { background: rgb(var(--s-err)); }
.span-bar-0 { width: 1%; }
.span-bar-1 { width: 5%; }
.span-bar-2 { width: 10%; }
.span-bar-3 { width: 15%; }
.span-bar-4 { width: 20%; }
.span-bar-5 { width: 25%; }
.span-bar-6 { width: 30%; }
.span-bar-7 { width: 35%; }
.span-bar-8 { width: 40%; }
.span-bar-9 { width: 45%; }
.span-bar-10 { width: 50%; }
.span-bar-11 { width: 55%; }
.span-bar-12 { width: 60%; }
.span-bar-13 { width: 65%; }
.span-bar-14 { width: 70%; }
.span-bar-15 { width: 75%; }
.span-bar-16 { width: 80%; }
.span-bar-17 { width: 85%; }
.span-bar-18 { width: 90%; }
.span-bar-19 { width: 95%; }
.span-bar-20 { width: 100%; }
.span-duration { font-size: 12.5px; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.span-source { font-size: 12px; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.span-actions { display: flex; align-items: center; justify-content: flex-end; gap: .35rem; }

/* The tags take the whole width beneath the row: they are the long field, and squeezing them into a column would
   truncate exactly the statement that is the reason to open the request. */
.span-attributes { grid-column: 1 / -1; padding-left: .25rem; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 767px) {
  .span-row { grid-template-columns: 1fr auto auto; }
  .span-bar-track, .span-source { display: none; }
}

/* ---------- grids that become cards on small screens ---------- */
@media (max-width: 767px) {
  .grid-table thead { display: none; }
  .grid-table tbody tr { display: block; padding: .75rem 1rem; border-bottom: 1px solid rgb(var(--s-line) / .7); }
  .grid-table tbody td { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: .3rem 0; border-bottom: 0; }
  .grid-table tbody td::before {
    content: attr(data-label); flex: none;
    font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: rgb(var(--s-muted));
  }
  .grid-table tbody td[data-label=""]::before { content: none; }
}

/* ---------- mail page (story #53, D82) ---------- */
.mail-banners { display: grid; gap: .75rem; margin-bottom: 1.25rem; }
.mail-banners:empty { display: none; }
.mail-status { display: grid; gap: 1.25rem; }
@media (min-width: 40rem) { .mail-status { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 72rem) { .mail-status { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.mail-status-item { display: flex; flex-direction: column; align-items: flex-start; gap: .3rem; min-width: 0; }
.mail-status-item .label { margin: 0; }
.mail-status-value { font-size: 1.05rem; font-weight: 700; overflow-wrap: anywhere; }
.mail-card-head { padding: 1.25rem 1.25rem .75rem; }
.mail-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem 1rem; padding: 0 1.25rem 1rem; }
.mail-filters .field { flex: 1 1 11rem; max-width: 16rem; }
.mail-empty { padding: 0 1.25rem 1.25rem; }
.mail-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; border-top: 1px solid rgb(var(--s-line) / .7); }
.mail-recipient, .mail-reason, .mail-placeholders { overflow-wrap: anywhere; }
.mail-reason { max-width: 28rem; color: rgb(var(--s-err)); }
.mail-providers, .mail-modes { display: grid; gap: .6rem; min-width: 0; margin: 0; padding: 0; border: 0; }
@media (min-width: 36rem) { .mail-providers { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.mail-providers legend, .mail-modes legend { grid-column: 1 / -1; margin-bottom: .1rem; }
.mail-provider { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: .6rem; row-gap: .15rem; align-items: start; padding: .7rem .85rem; border: 1px solid rgb(var(--s-line)); border-radius: .65rem; background: rgb(var(--s-surface-2)); cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.mail-provider input { grid-row: span 2; margin-top: .2rem; }
.mail-provider-name { font-weight: 700; }
.mail-provider-hint { font-size: .8125rem; color: rgb(var(--s-muted)); }
.mail-provider:has(input:checked) { border-color: rgb(var(--s-brand)); box-shadow: 0 0 0 3px rgb(var(--s-brand) / .15); }
.mail-provider:has(input:focus-visible) { outline: 2px solid rgb(var(--s-brand)); outline-offset: 2px; }
.mail-preview-html { max-height: 26rem; overflow: auto; border: 1px solid rgb(var(--s-line)); border-radius: .65rem; background: #fff; }
.mail-preview-text { max-height: 14rem; overflow: auto; margin: 0; padding: .75rem .9rem; border: 1px solid rgb(var(--s-line)); border-radius: .65rem; background: rgb(var(--s-surface-2)); font-size: .8125rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.swal2-popup.swal-sophia.mail-preview-popup { width: min(46rem, calc(100vw - 2rem)); }

/* ---------- sign-in page (story #77) ---------- */
/* ---------- sign-in page (#77, #78): a tab per provider, the configuration card and a smaller guide beside it ---------- */
.sign-in-tabs { display: flex; flex-wrap: wrap; gap: .25rem 1rem; margin-bottom: 1.25rem; border-bottom: 1px solid rgb(var(--s-line)); }
.sign-in-tab {
  display: flex; align-items: center; gap: .7rem; margin-bottom: -1px; padding: .6rem .4rem .8rem;
  border: 0; border-bottom: 2px solid transparent; background: transparent; color: rgb(var(--s-muted)); text-align: left; cursor: pointer;
}
.sign-in-tab:hover { color: rgb(var(--s-fg)); }
.sign-in-tab[aria-selected="true"] { color: rgb(var(--s-fg)); border-bottom-color: rgb(var(--s-brand)); }
.sign-in-tab:focus-visible { outline: 2px solid rgb(var(--s-brand)); outline-offset: 2px; border-radius: var(--r-sm); }
.sign-in-tab-text { display: grid; gap: .1rem; line-height: 1.2; }
.sign-in-tab-text b { font-size: .95rem; font-weight: 800; }
.sign-in-tab-text small { font-size: 12px; font-weight: 600; color: rgb(var(--s-muted)); }
.sign-in-tab-text small.is-ok { color: rgb(var(--s-ok)); }
.sign-in-tab-text small.is-err { color: rgb(var(--s-err)); }
.sign-in-logo { display: grid; place-items: center; flex: none; width: 2.4rem; height: 2.4rem; border: 1px solid rgb(var(--s-line)); border-radius: .7rem; background: rgb(var(--s-surface)); }
.sign-in-tab[aria-selected="true"] .sign-in-logo { border-color: rgb(var(--s-brand) / .45); }
.sign-in-logo.is-microsoft { color: #0a7ad4; }
.sign-in-logo.is-google { color: #4285f4; }
.sign-in-layout { display: grid; gap: 1.25rem; align-items: start; }
@media (min-width: 1280px) { .sign-in-layout { grid-template-columns: minmax(0, 1fr) minmax(18rem, 24rem); } }
.sign-in-main { display: grid; gap: 1.25rem; min-width: 0; }
.sign-in-card-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: .75rem; margin-bottom: 1.1rem; }
.sign-in-fields { display: grid; grid-template-columns: minmax(9rem, max-content) minmax(0, 1fr); gap: 0 1.25rem; margin: 0; }
.sign-in-fields dt, .sign-in-fields dd { padding: .6rem 0; border-top: 1px solid rgb(var(--s-line) / .7); }
.sign-in-fields dt:first-of-type, .sign-in-fields dd:first-of-type { border-top: 0; }
.sign-in-fields dt { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: rgb(var(--s-muted)); padding-top: .75rem; }
.sign-in-fields dd { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .6rem; font-size: .95rem; overflow-wrap: anywhere; }
.select option { background-color: rgb(var(--s-surface)); color: rgb(var(--s-fg)); }

/* ---------- groups page (#79): directory search results, the members dialog, who to assign by hand ---------- */
.groups-results { display: grid; gap: .35rem; max-height: 16rem; overflow-y: auto; }
.groups-result { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .6rem; width: 100%; padding: .5rem .7rem; border: 1px solid rgb(var(--s-line)); border-radius: .6rem; background: rgb(var(--s-surface)); text-align: left; }
button.groups-result { cursor: pointer; }
button.groups-result:hover:not(:disabled) { border-color: rgb(var(--s-brand) / .45); }
button.groups-result:disabled { opacity: .6; cursor: default; }
.groups-result[aria-pressed="true"] { border-color: rgb(var(--s-brand)); box-shadow: 0 0 0 2px rgb(var(--s-brand) / .18); }
.groups-result .btn { margin-left: auto; }
.groups-member-who { display: grid; min-width: 0; overflow-wrap: anywhere; }
/* An account's sign-ins on People (story #79, D95). */
.people-sign-ins { display: grid; gap: .35rem; margin: 0; padding: 0; list-style: none; }
.people-sign-in { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; padding: .5rem .1rem; border-bottom: 1px solid rgb(var(--s-line) / .7); }
.people-sign-in:last-child { border-bottom: 0; }
.people-sign-in .btn { margin-left: auto; }
.people-sign-in-who { display: grid; min-width: 0; overflow-wrap: anywhere; }
.groups-count-link { color: rgb(var(--s-brand)); font-weight: 700; text-decoration: none; }
.groups-count-link:hover { text-decoration: underline; }
.groups-pending { display: grid; gap: .25rem; margin: 0; padding-left: 1.1rem; list-style: disc; font-size: 13px; }
/* A group's members on their own page (story #79, D93). */
.page-back { display: inline-flex; align-items: center; gap: .3rem; margin-bottom: .9rem; font-size: 13px; font-weight: 600; color: rgb(var(--s-muted)); text-decoration: none; }
.page-back:hover { color: rgb(var(--s-brand)); }
.page-back svg { width: 1rem; height: 1rem; }
.members-eyebrow { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: rgb(var(--s-muted)); }
.members-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: .9rem 1.5rem; margin: 0; padding: 1rem 1.25rem; }
.members-facts dt { font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: rgb(var(--s-muted)); }
.members-facts dd { margin: .3rem 0 0; font-size: 14px; }
.members-facts dd.mono { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.members-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; }
.members-status { display: inline-flex; flex-wrap: wrap; gap: .25rem; padding: .2rem; border: 1px solid rgb(var(--s-line)); border-radius: .7rem; background: rgb(var(--s-surface)); }
.members-status-link { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .75rem; border-radius: .5rem; font-size: 13px; font-weight: 600; color: rgb(var(--s-muted)); text-decoration: none; }
.members-status-link .mono { font-size: 12px; font-variant-numeric: tabular-nums; }
.members-status-link:hover { color: rgb(var(--s-fg)); }
.members-status-link[aria-current="true"] { background: rgb(var(--s-brand) / .12); color: rgb(var(--s-brand)); }
/* The search keeps one row beside the filter while there is room: as a flex item it takes the free width instead of
   shrinking to its content, and only wraps, to the right, when the page is too narrow. */
.members-find { display: flex; flex: 1 1 24rem; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .5rem; }
.members-search { flex: 0 1 18rem; min-width: 10rem; }
@media (max-width: 640px) { .members-find { justify-content: stretch; } .members-search { flex: 1 1 100%; } }
.members-size { width: auto; }
.members-bulk { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; padding: .6rem 1rem; border-bottom: 1px solid rgb(var(--s-line)); background: rgb(var(--s-surface-2) / .5); }
.members-check-col { width: 2.75rem; }
.members-chosen-head { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; }
.members-chosen { display: flex; flex-wrap: wrap; gap: .35rem; max-height: 9rem; overflow-y: auto; margin: 0; padding: 0; list-style: none; }
.members-chip { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .1rem .45rem; max-width: 100%; padding: .25rem .3rem .25rem .65rem; border: 1px solid rgb(var(--s-brand) / .35); border-radius: 999px; background: rgb(var(--s-brand) / .08); font-size: 12.5px; overflow-wrap: anywhere; }
.members-chip-remove { display: inline-grid; place-items: center; width: 1.4rem; height: 1.4rem; border: 0; border-radius: 999px; background: transparent; color: rgb(var(--s-muted)); font-size: 15px; line-height: 1; cursor: pointer; }
.members-chip-remove:hover { background: rgb(var(--s-err) / .12); color: rgb(var(--s-err)); }
.sign-in-domain { display: inline-flex; padding: .1rem .5rem; border: 1px solid rgb(var(--s-line)); border-radius: 999px; background: rgb(var(--s-surface-2)); font-size: 13px; }
.sign-in-actions { margin-top: 1.1rem; padding-top: 1rem; border-top: 1px solid rgb(var(--s-line)); }
.sign-in-guide { padding: 1rem 1.1rem 1.1rem; border: 1px solid rgb(var(--s-brand) / .22); border-radius: .75rem; background: rgb(var(--s-brand) / .05); font-size: 13px; }
.sign-in-guide-head { display: flex; align-items: center; gap: .7rem; }
.sign-in-guide-icon { display: grid; place-items: center; flex: none; width: 2.1rem; height: 2.1rem; border-radius: 999px; background: rgb(var(--s-brand) / .14); color: rgb(var(--s-brand)); }
.sign-in-guide-eyebrow { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: rgb(var(--s-brand)); }
.sign-in-guide h2 { font-size: .9rem; font-weight: 800; line-height: 1.3; text-wrap: balance; }
.sign-in-guide-subhead { margin: 1.1rem 0 .55rem; font-size: .82rem; font-weight: 800; line-height: 1.3; }
.sign-in-scopes { display: grid; gap: .25rem; margin: .6rem 0 0; padding: .55rem .7rem; list-style: none; border: 1px solid rgb(var(--s-line)); border-radius: .6rem; background: rgb(var(--s-surface)); font-size: 11px; overflow-wrap: anywhere; }
.sign-in-guide-note { margin: .7rem 0 .8rem; font-size: 12px; line-height: 1.45; color: rgb(var(--s-muted)); }
.sign-in-steps { display: grid; gap: .55rem; margin: 0; padding-left: 1.2rem; list-style: decimal; font-size: 13px; line-height: 1.45; }
.sign-in-steps li { overflow-wrap: anywhere; padding-left: .15rem; }
.sign-in-steps li::marker { color: rgb(var(--s-brand)); font-weight: 800; }

/* AI › Providers (story #93): the providers grid, a provider's models, the import dialog, one model's page and its test console. */
.ai-link { color: rgb(var(--s-fg)); text-decoration: none; }
.ai-link:hover { color: rgb(var(--s-brand)); text-decoration: underline; }
.ai-check-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; }
.ai-check-ok { font-size: 12.5px; font-weight: 600; color: rgb(var(--s-ok)); }
.ai-more { border: 1px solid rgb(var(--s-line)); border-radius: .7rem; padding: .6rem .8rem; }
.ai-more > summary { cursor: pointer; font-size: 13px; font-weight: 700; }
.ai-more[open] > summary { margin-bottom: .5rem; }
.ai-filters { display: flex; flex-wrap: wrap; gap: .4rem; }
.ai-filters .select { width: auto; min-width: 9rem; }
.swal2-popup.swal-sophia.swal-sophia-wide { width: min(52rem, calc(100vw - 2rem)); }

/* Story #111: writing or reading a prompt takes most of the window; the text fills it and scrolls inside (owner's test). */
.swal2-popup.swal-sophia.swal-sophia-editor {
  width: min(72rem, calc(100vw - 2rem)); height: calc(100vh - 3rem); height: calc(100dvh - 3rem);
  /* SweetAlert2 writes display: grid on the dialog itself; the editor's column layout has to win over it. */
  display: flex !important; flex-direction: column;
}
.swal-sophia-editor .swal-sophia-body,
.swal-sophia-editor .swal-sophia-body > div,
.swal-sophia-editor .swal-sophia-body form,
.swal-sophia-editor .swal-sophia-body form > .grid,
.swal-sophia-editor .editor-field { flex: 1 1 auto; min-height: 0; display: flex !important; flex-direction: column; }
.swal-sophia-editor .swal-sophia-body form > .grid { gap: .75rem; }
.swal-sophia-editor .editor-text {
  flex: 1 1 auto; min-height: 12rem; height: auto; resize: none; overflow-y: auto;
  font-family: ui-monospace, "JetBrains Mono", Consolas, monospace; font-size: 13px; line-height: 1.6; white-space: pre-wrap;
}
.swal-sophia-editor .persona-prompt-text { flex: 1 1 auto; max-height: none; min-height: 0; }

/* AI › Prompts (D123): what is being edited, the placeholders to insert, the count and an unknown placeholder. */
.prompt-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .75rem; padding-bottom: .6rem; border-bottom: 1px solid rgb(var(--s-line)); }
.prompt-chips { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.prompt-chip { cursor: pointer; }
.prompt-chip:hover { border-color: rgb(var(--s-brand) / .6); color: rgb(var(--s-brand)); }
.prompt-chip:focus-visible { outline: 2px solid rgb(var(--s-brand)); outline-offset: 2px; }
.prompt-editor-foot { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: .35rem; }
.prompt-editor-warning { font-size: 13px; font-weight: 600; color: rgb(var(--s-err)); }
.swal-sophia-editor .prompt-view { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.prompt-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: .5rem .75rem; margin: 0; }
.prompt-facts dt { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: rgb(var(--s-muted)); }
.prompt-facts dd { margin: .15rem 0 0; font-size: 14px; color: rgb(var(--s-fg)); overflow-wrap: anywhere; }

/* Configuration › Plugins (story #112): a plugin's facts in the View dialog, a label beside each value. */
.plugin-facts { display: grid; grid-template-columns: minmax(7rem, auto) 1fr; gap: .45rem 1rem; margin: 0; }
.plugin-facts dt { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: rgb(var(--s-muted)); padding-top: .15rem; }
.plugin-facts dd { margin: 0; font-size: 14px; color: rgb(var(--s-fg)); overflow-wrap: anywhere; }
.plugin-facts ul { margin: 0; padding-left: 1rem; }
[data-plugins] .badge { white-space: nowrap; }

/* AI › Skills and a persona's Skills (story #115). */
.skill-plugins { display: flex; flex-wrap: wrap; gap: .35rem; margin: 0; padding: 0; list-style: none; counter-reset: skill-plugin; }
.skill-plugins li { counter-increment: skill-plugin; display: inline-flex; align-items: center; gap: .25rem; font-size: 12px; color: rgb(var(--s-muted)); }
.skill-plugins li::before { content: counter(skill-plugin) "."; }
/* AI › MCP servers' Tools dialog (#117, D222): one row per tool, its badges, and its two switches. */
.mcp-tools { display: grid; gap: .6rem; margin: 0; padding: 0; list-style: none; max-height: 55vh; overflow-y: auto; }
.mcp-tool { display: grid; gap: .3rem; padding: .65rem .8rem; border: 1px solid rgb(var(--s-line)); border-radius: var(--r-sm); }
.mcp-tool-head { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; overflow-wrap: anywhere; }
.mcp-tool-switches { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; }
/* The redirect URI beside its Copy button (#215): read, never typed. */
.mcp-copy { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .5rem; align-items: center; }
/* A persona's skills in order (#117, D226): a grip to drag by and arrows for the keyboard; the row being dragged dims. */
.persona-skill-move { width: 1%; white-space: nowrap; }
.persona-skill-grip { cursor: grab; padding-inline: .25rem; color: rgb(var(--s-muted)); letter-spacing: -.2em; user-select: none; }
[data-persona-skill-order] tr.is-dragging { opacity: .45; }
/* AI › API connections' dialog (#127, D229, D230): the method beside the address, parameter rows, Test beside its question,
   the four picks in a grid, and the results as the model would read them. */
.api-request { display: grid; grid-template-columns: 7rem 1fr; gap: .5rem; }
.api-params { display: grid; gap: .4rem; margin: .35rem 0; padding: 0; list-style: none; }
.api-param { display: grid; grid-template-columns: minmax(6rem, 1fr) minmax(8rem, 2fr) auto auto; align-items: center; gap: .4rem; }
.api-test { display: grid; grid-template-columns: 1fr auto; gap: .5rem; }
.api-fields { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
.api-preview { display: grid; gap: .5rem; margin: 0; padding-left: 1.25rem; max-height: 16rem; overflow-y: auto; overflow-wrap: anywhere; }
@media (max-width: 639px) { .api-param { grid-template-columns: 1fr 1fr; } .api-request { grid-template-columns: 1fr; } }
/* The dialog's four steps (#127): numbered tabs, one step shown, Back and Next at its foot. */
.api-steps { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: 1rem; border-bottom: 1px solid rgb(var(--s-line)); }
.api-step-tab { display: inline-flex; align-items: center; gap: .45rem; padding: .5rem .75rem; margin-bottom: -1px; border: 0; border-bottom: 2px solid transparent; background: none; color: rgb(var(--s-muted)); font-size: 13.5px; font-weight: 600; cursor: pointer; }
.api-step-tab[aria-selected="true"] { color: rgb(var(--s-fg)); border-bottom-color: rgb(var(--s-brand)); }
.api-step-tab:focus-visible { outline: 2px solid rgb(var(--s-brand)); outline-offset: 2px; }
.api-step-number { display: inline-grid; place-items: center; width: 1.35rem; height: 1.35rem; border-radius: 999px; background: rgb(var(--s-line)); font-size: 11.5px; }
.api-step-tab[aria-selected="true"] .api-step-number { background: rgb(var(--s-brand)); color: rgb(var(--s-on-brand, 255 255 255)); }
.api-step { display: none; }
.api-step.is-current { display: grid; gap: 1rem; }
/* The same height on every step, so the dialog does not grow or shrink; a long step scrolls inside it. */
.api-step-body { height: min(58vh, 34rem); overflow-y: auto; padding-right: .25rem; }
.api-step-nav { display: flex; justify-content: flex-end; gap: .5rem; margin-top: .75rem; padding-top: .75rem; border-top: 1px solid rgb(var(--s-line)); }
/* A step that does not apply (a live source's steps for an uploads library, #131): shown, dimmed, not chosen. */
.api-step-tab[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
/* A fieldset is as wide as its widest line by default: one long value (a hash) widened the whole dialog (#131, the owner's walk). */
.swal2-popup fieldset { min-width: 0; }
.swal2-popup .select { min-width: 0; max-width: 100%; }
/* A live index's field to search: its path, and a value it holds on one line, cut with an ellipsis (the whole in its title). */
.live-field { align-items: flex-start; min-width: 0; }
.live-field input { width: 16px; height: 16px; margin-top: .15rem; flex: none; }
.live-field-text { display: grid; min-width: 0; }
.live-field-match { padding: 0 .4rem; font-size: 11px; font-weight: 600; vertical-align: middle; }
.live-field-sample { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; font-weight: 400; color: rgb(var(--s-muted)); }
.skill-plugins .badge, [data-ai-skills] .badge { white-space: nowrap; }
.skill-persona-list { display: grid; gap: .35rem; margin: 0; padding-left: 1.1rem; list-style: disc; }
[data-persona-skills] .badge { white-space: nowrap; }
.prompt-versions td { vertical-align: middle; }
.prompt-versions th, .prompt-versions .badge, .prompt-versions td:first-child { white-space: nowrap; }
.swal2-popup.swal-sophia.swal-sophia-versions { width: min(60rem, calc(100vw - 2rem)); }
.ai-import-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; }
.ai-import-tools { display: flex; flex-wrap: wrap; gap: .5rem; }
.ai-import-tools .input { flex: 1 1 14rem; }
.ai-import-tools .select { flex: 0 1 12rem; }
.ai-import-list { display: grid; gap: .25rem; max-height: min(24rem, 50vh); overflow-y: auto; padding: .25rem; border: 1px solid rgb(var(--s-line)); border-radius: .7rem; background: rgb(var(--s-surface-2) / .4); }
.ai-import-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: .6rem; padding: .5rem .6rem; border-radius: .55rem; cursor: pointer; }
.ai-import-row:hover { background: rgb(var(--s-surface)); }
.ai-import-row .check { margin-top: .2rem; }
.ai-validation-facts { display: grid; gap: .35rem; margin: 0; }
.ai-validation-facts > div { display: grid; grid-template-columns: minmax(8rem, auto) minmax(0, 1fr); gap: .75rem; font-size: 13px; }
.ai-validation-facts dt { color: rgb(var(--s-muted)); }
.ai-validation-facts dd { margin: 0; }
.ai-validation-detail { margin: .25rem 0 0; padding: .6rem .75rem; max-height: 14rem; overflow: auto; white-space: pre-wrap; word-break: break-word; font-size: 12.5px; border-radius: .55rem; background: rgb(var(--s-surface)); border: 1px solid rgb(var(--s-line)); }
.ai-import-who { display: grid; gap: .1rem; min-width: 0; overflow-wrap: anywhere; }
.ai-import-badges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .25rem; }
.ai-model-layout { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1100px) { .ai-model-layout { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); } }
.ai-capabilities { display: grid; gap: .6rem 1rem; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
.ai-capability { display: grid; gap: .3rem; padding: .6rem .7rem; border: 1px solid rgb(var(--s-line)); border-radius: .65rem; }
.ai-capability-source { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .6rem; min-height: 1.5rem; }
.ai-prices { display: grid; gap: .35rem; margin: 0; padding: 0; list-style: none; }
.ai-price { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .6rem; padding: .45rem .6rem; border: 1px solid rgb(var(--s-line)); border-radius: .55rem; font-size: 13px; }
.ai-price .badge { margin-left: auto; }
.ai-test-answer { min-height: 3rem; max-height: 22rem; overflow-y: auto; padding: .7rem .8rem; border: 1px solid rgb(var(--s-line)); border-radius: .65rem; background: rgb(var(--s-surface-2) / .5); font-size: 14px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.ai-test-answer.is-streaming::after { content: ""; display: inline-block; width: .5ch; height: 1em; margin-left: 1px; vertical-align: text-bottom; background: rgb(var(--s-brand)); animation: ai-caret 1s steps(2) infinite; }
@keyframes ai-caret { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .ai-test-answer.is-streaming::after { animation: none; } }

/* AI › Personas and Task models (story #110): a persona's avatar in its colour, ordered model lists, the prompt, Try this persona. */
.persona-identity { display: flex; align-items: center; gap: .65rem; min-width: 0; }
.persona-avatar { --persona-color: rgb(var(--s-brand)); display: inline-grid; place-items: center; flex: none; width: 2.1rem; height: 2.1rem; border-radius: 999px; color: #fff; background: var(--persona-color); }
.persona-avatar svg { width: 1.15rem; height: 1.15rem; }
.persona-avatar-lg { width: 2.8rem; height: 2.8rem; }
.persona-avatar-lg svg { width: 1.5rem; height: 1.5rem; }
.persona-color { height: 2.5rem; padding: .2rem; }
.persona-starters { display: grid; gap: .4rem; margin: 0; padding: 0; border: 0; min-width: 0; }
.persona-order { display: grid; gap: .3rem; margin: 0; padding: 0; list-style: none; counter-reset: persona-order; }
.persona-order:empty { display: none; }
.persona-order-item { counter-increment: persona-order; display: flex; align-items: center; gap: .5rem; padding: .35rem .5rem; border: 1px solid rgb(var(--s-line)); border-radius: .6rem; background: rgb(var(--s-surface-2) / .4); overflow-wrap: anywhere; }
.persona-order-item::before { content: counter(persona-order); flex: none; min-width: 1.2rem; font-size: 12px; font-weight: 700; color: rgb(var(--s-muted)); text-align: center; }
.persona-order-item > .min-w-0 { flex: 1 1 auto; }
.persona-order-tools { display: flex; flex: none; gap: .1rem; }
.persona-order-add { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.persona-order-add .select { flex: 1 1 14rem; }
/* The add button stands as tall as the list it adds from (owner's walk, #210). */
.persona-order-add > .btn { align-self: stretch; height: auto; }
.persona-prompt-text { margin: 0; max-height: 18rem; overflow: auto; padding: .7rem .8rem; border: 1px solid rgb(var(--s-line)); border-radius: .65rem; background: rgb(var(--s-surface-2) / .5); font-family: inherit; font-size: 13.5px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.persona-versions { display: grid; gap: .4rem; margin: 0; padding: 0; list-style: none; }
.persona-version { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem; padding: .4rem 0; border-top: 1px solid rgb(var(--s-line)); }
.persona-try-log { display: grid; gap: .5rem; margin: 0; padding: 0; list-style: none; max-height: 26rem; overflow-y: auto; }
.persona-try-log:empty { display: none; }
.persona-try-message { display: grid; gap: .3rem; max-width: 92%; padding: .55rem .75rem; border-radius: .8rem; font-size: 14px; line-height: 1.55; }
.persona-try-message.is-user { justify-self: end; background: rgb(var(--s-brand) / .12); }
.persona-try-message.is-answer { justify-self: start; border: 1px solid rgb(var(--s-line)); background: rgb(var(--s-surface-2) / .5); }
.persona-try-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.persona-try-message.is-streaming .persona-try-text::after { content: ""; display: inline-block; width: .5ch; height: 1em; margin-left: 1px; vertical-align: text-bottom; background: rgb(var(--s-brand)); animation: ai-caret 1s steps(2) infinite; }
.persona-try-note { font-size: 12px; color: rgb(var(--s-muted)); }
.persona-try-note.is-warn { color: rgb(var(--s-warn)); }
.persona-try-note.is-error { color: rgb(var(--s-err)); }
@media (prefers-reduced-motion: reduce) { .persona-try-message.is-streaming .persona-try-text::after { animation: none; } }
.task-suggestions { display: grid; gap: .35rem; padding-top: .6rem; border-top: 1px dashed rgb(var(--s-line)); }
.task-suggestion-list { display: grid; gap: .3rem; margin: 0; padding: 0; list-style: none; }
.task-suggestion { display: flex; align-items: center; justify-content: space-between; gap: .5rem; overflow-wrap: anywhere; }

/* Knowledge › Libraries (story #124): a library's states, the place files are dropped, the files on their way, a document's
   failure, and the passages dialog (D183). */
.mirror-notice.is-info { background: rgb(var(--s-brand) / .07); border-color: rgb(var(--s-brand) / .3); }
.knowledge-states { display: flex; flex-wrap: wrap; gap: .3rem; }
.knowledge-drop { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; padding: 1.1rem 1rem; border: 1.5px dashed rgb(var(--s-line)); border-radius: .75rem; background: rgb(var(--s-surface-2)); transition: border-color .15s, background-color .15s; }
.knowledge-drop.is-dragging { border-color: rgb(var(--s-brand)); background: rgb(var(--s-brand) / .06); }
.knowledge-drop-text { color: rgb(var(--s-muted)); font-size: .875rem; }
.knowledge-uploads { display: grid; gap: .3rem; margin-top: .6rem; font-size: .8125rem; }
.knowledge-uploads:empty { display: none; }
.knowledge-upload { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem .6rem; overflow-wrap: anywhere; }
.knowledge-upload-name { font-weight: 600; }
.knowledge-upload.is-err .knowledge-upload-state { color: rgb(var(--s-err)); font-weight: 600; }
.knowledge-upload.is-ok .knowledge-upload-state { color: rgb(var(--s-ok)); font-weight: 600; }
.knowledge-upload-state { color: rgb(var(--s-muted)); }
.knowledge-reason { max-width: 28rem; color: rgb(var(--s-err)); overflow-wrap: anywhere; }
.knowledge-passages { max-height: min(65vh, 44rem); overflow-y: auto; }
.knowledge-passage-list { display: grid; gap: .6rem; margin-top: .5rem; }
.knowledge-passage { padding: .6rem .75rem; border: 1px solid rgb(var(--s-line)); border-radius: .6rem; background: rgb(var(--s-surface-2)); }
.knowledge-passage-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .6rem; margin-bottom: .3rem; font-size: 12px; color: rgb(var(--s-muted)); }
.knowledge-passage-heading { font-weight: 700; color: rgb(var(--s-fg)); }
.knowledge-passage-text { font-size: 13.5px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
/* #125, D191: the personas that read a library, and the libraries a persona reads. */
.knowledge-personas { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .6rem; }
.persona-libraries { border: 0; padding: 0; margin: 0; }
.persona-library-list { display: grid; gap: .4rem; margin-top: .35rem; }

/* #80 (D277): the roles of a persona for specific roles, a grouped picker with a search over it (choice-picker.js); the
   personas a role grants, read-only, in the Roles page's dialog. */
.persona-roles-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin: .35rem 0 .25rem; }
.persona-roles-tools .input { flex: 1 1 14rem; min-width: 0; }
.persona-roles .choice-scroll { max-height: min(45vh, 24rem); }
.role-personas { display: grid; gap: .45rem; margin: 0; padding: 0; list-style: none; }
.role-personas li { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem .4rem; overflow-wrap: anywhere; }

/* D188: the reading shown as it goes: a spinner in a badge, the library's documents read, a document's step and its bar. */
.badge .spinner { width: .7rem; height: .7rem; border-width: 2px; }
.knowledge-overall { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; font-size: .875rem; }
.knowledge-overall .knowledge-progress { flex: 1 1 12rem; max-width: 28rem; }
.knowledge-step { display: grid; gap: .25rem; margin-top: .35rem; max-width: 16rem; }
/* #129: the web page a run is on; a long address wraps rather than widening the card. */
.knowledge-current-page { overflow-wrap: anywhere; }
.knowledge-progress { appearance: none; width: 100%; height: .4rem; border: 0; border-radius: 999px; overflow: hidden; background: rgb(var(--s-line)); color: rgb(var(--s-brand)); }
.knowledge-progress::-webkit-progress-bar { background: rgb(var(--s-line)); border-radius: 999px; }
.knowledge-progress::-webkit-progress-value { background: rgb(var(--s-brand)); border-radius: 999px; transition: width .4s; }
.knowledge-progress::-moz-progress-bar { background: rgb(var(--s-brand)); border-radius: 999px; }
.knowledge-progress:indeterminate { background: linear-gradient(90deg, rgb(var(--s-line)) 0 35%, rgb(var(--s-brand)) 35% 65%, rgb(var(--s-line)) 65%) 0 0 / 300% 100%; animation: knowledge-sweep 1.4s linear infinite; }
.knowledge-progress:indeterminate::-webkit-progress-bar { background: transparent; }
.knowledge-progress:indeterminate::-moz-progress-bar { background: transparent; }
@keyframes knowledge-sweep { from { background-position: 100% 0; } to { background-position: 0 0; } }
.knowledge-detail { margin-top: .25rem; max-width: 28rem; font-size: 12px; color: rgb(var(--s-muted)); }
.knowledge-detail > summary { cursor: pointer; }
.knowledge-detail .mono { display: block; margin-top: .2rem; overflow-wrap: anywhere; }
.knowledge-tree-status:empty { display: none; }
.knowledge-tree-status.is-err { color: rgb(var(--s-err)); }
/* #208: a check's own words behind Details, on every Check card: open when the step failed. */
.check-details { margin-top: .25rem; max-width: 36rem; font-size: 12px; color: rgb(var(--s-muted)); }
.check-details > summary { cursor: pointer; }
.check-details .mono { display: block; margin-top: .2rem; overflow-wrap: anywhere; }

/* #128: a connection's facts, a connected library's source with its history, and the folder picker. */
.knowledge-facts { display: grid; grid-template-columns: minmax(8rem, max-content) 1fr; gap: .4rem 1rem; margin: 0; font-size: .9rem; }
.knowledge-facts dt { color: rgb(var(--s-muted)); }
.knowledge-facts dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 480px) { .knowledge-facts { grid-template-columns: 1fr; gap: .1rem; } .knowledge-facts dd { margin-bottom: .5rem; } }
.knowledge-source-folders { display: grid; gap: .25rem; margin: .4rem 0 0; padding: 0; list-style: none; font-size: .875rem; overflow-wrap: anywhere; }
.knowledge-source-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .75rem; }
/* D206, the owner's test of #128: a section's title with its filters, a pager, the run's progress, a library as a row. */
.knowledge-section-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .75rem 1.25rem; padding: 1rem 1.25rem .9rem; }
.knowledge-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .6rem .75rem; }
.knowledge-filters .field { min-width: 10rem; }
.knowledge-filters .date-range-input { min-width: 14rem; }
.knowledge-filter-switch { align-self: center; }
.knowledge-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem; padding: .75rem 1.25rem; border-top: 1px solid rgb(var(--s-line)); font-size: .875rem; }
.knowledge-sync-progress { display: grid; gap: .45rem; max-width: 36rem; }
.knowledge-sync-progress .knowledge-progress { max-width: 36rem; }
.knowledge-folder-path { display: flex; align-items: center; gap: .4rem; }
.knowledge-folder-path svg { flex: none; width: 1rem; height: 1rem; color: rgb(var(--s-muted)); }
.knowledge-library-name { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.knowledge-library-icon { flex: none; display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: .55rem; background: rgb(var(--s-brand) / .1); color: rgb(var(--s-brand)); }
.knowledge-library-icon svg { width: 1.05rem; height: 1.05rem; }
@media (prefers-reduced-motion: reduce) { .knowledge-drop { transition: none; } .knowledge-progress:indeterminate { animation: none; } .knowledge-progress::-webkit-progress-value { transition: none; } }
/* ---------- the shared grid (D290, #220, grid.js): search, filter chips, the grouped picker, sort, the pager ---------- */
[data-grid-out] { display: none !important; }
/* Before grid.js has drawn the first page, a long list shows no more than a page. */
[data-grid-view]:not([data-grid-ready]) .grid-table tbody > tr:nth-child(n+26) { display: none; }
.grid-tools { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .6rem; padding: .85rem 1.25rem; border-bottom: 1px solid rgb(var(--s-line) / .7); }
.grid-search { flex: 1 1 16rem; min-width: 0; max-width: 26rem; }
.grid-search .input { width: 100%; }
.grid-filter { position: relative; }
.grid-filter-button { gap: .4rem; }
.grid-filter-count { padding: 0 .4rem; min-width: 1.25rem; justify-content: center; }
.grid-picker {
  position: absolute; z-index: 30; top: calc(100% + .4rem); left: 0; width: min(22rem, calc(100vw - 2rem));
  display: grid; gap: .5rem; padding: .75rem 1rem; border: 1px solid rgb(var(--s-line)); border-radius: var(--r-md, .75rem);
  background: rgb(var(--s-surface)); box-shadow: 0 12px 32px rgb(0 0 0 / .14);
}
.grid-picker .choice-scroll { max-height: min(55vh, 26rem); }
.grid-picker .check-row { padding: .45rem 0; }
.grid-picker-heading { margin: .5rem 0 .1rem; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: rgb(var(--s-muted)); }
.grid-picker-count { color: rgb(var(--s-muted)); font-variant-numeric: tabular-nums; }
.grid-chips { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; }
.grid-chips:empty { display: none; }
.grid-chip {
  display: inline-flex; align-items: center; gap: .35rem; height: 28px; padding: 0 .45rem 0 .7rem; border: 1px solid rgb(var(--s-brand) / .35);
  border-radius: 999px; background: rgb(var(--s-brand) / .08); color: rgb(var(--s-fg)); font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.grid-chip:hover { background: rgb(var(--s-brand) / .16); }
.grid-chip:focus-visible, .grid-sort:focus-visible { outline: 2px solid rgb(var(--s-brand)); outline-offset: 2px; }
.grid-chip-x { font-size: 15px; line-height: 1; color: rgb(var(--s-muted)); }
.grid-sort { display: inline-flex; align-items: center; gap: .35rem; padding: 0; border: 0; background: none; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; cursor: pointer; }
.grid-sort-mark { width: .5rem; height: .5rem; opacity: .35; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translate(-2px, -2px); }
th[aria-sort="ascending"] .grid-sort-mark { opacity: 1; transform: rotate(-135deg) translate(-2px, -2px); }
th[aria-sort="descending"] .grid-sort-mark { opacity: 1; }
.grid-none { display: grid; justify-items: center; gap: .6rem; padding: 2.5rem 1rem; text-align: center; color: rgb(var(--s-muted)); }
.grid-pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem 1rem; padding: .75rem 1.25rem; border-top: 1px solid rgb(var(--s-line) / .7); font-size: 13px; }
.grid-count { color: rgb(var(--s-muted)); font-variant-numeric: tabular-nums; }
.grid-size { display: inline-flex; align-items: center; gap: .45rem; color: rgb(var(--s-muted)); }
.grid-size .select { height: 30px; width: auto; padding-top: 0; padding-bottom: 0; font-size: 12.5px; }
.grid-moves { display: inline-flex; align-items: center; gap: .25rem; margin-left: auto; }
.grid-move { min-width: 30px; justify-content: center; font-size: 15px; }
.grid-where { padding: 0 .4rem; color: rgb(var(--s-muted)); font-variant-numeric: tabular-nums; white-space: nowrap; }
.grid-stale { margin-left: .4rem; background: rgb(var(--s-warn) / .14); color: rgb(var(--s-warn)); }
tr[data-grid-stale-row] > td { background: rgb(var(--s-warn) / .05); }
@media (max-width: 767px) {
  .grid-tools, .grid-pager { padding-left: 1rem; padding-right: 1rem; }
  .grid-moves { margin-left: 0; }
}
/* Knowledge › Tests (story #126, D292–D294): a run's three scores as small bars, the notice after a change, a set's
   questions and runs, a run's headline and configuration, a result's drawer, the document picker and the comparison. */
tr.is-clickable { cursor: pointer; }
tr.is-clickable:focus-visible { outline: 2px solid rgb(var(--s-brand)); outline-offset: -2px; }
.test-scores { display: grid; gap: .2rem; min-width: 12rem; }
.test-score { display: grid; grid-template-columns: 5.5rem minmax(4rem, 1fr) 2.75rem; align-items: center; gap: .45rem; font-size: 12px; }
.test-score-label { color: rgb(var(--s-muted)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.test-score-value { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.test-score-bar { appearance: none; width: 100%; height: .4rem; border: 0; border-radius: 999px; overflow: hidden; background: rgb(var(--s-line)); }
.test-score-bar::-webkit-progress-bar { background: rgb(var(--s-line)); border-radius: 999px; }
.test-score-bar.is-found::-webkit-progress-value { background: var(--chart-1); border-radius: 999px; }
.test-score-bar.is-found::-moz-progress-bar { background: var(--chart-1); border-radius: 999px; }
.test-score-bar.is-answered::-webkit-progress-value { background: var(--chart-2); border-radius: 999px; }
.test-score-bar.is-answered::-moz-progress-bar { background: var(--chart-2); border-radius: 999px; }
.test-score-bar.is-refused::-webkit-progress-value { background: var(--chart-3); border-radius: 999px; }
.test-score-bar.is-refused::-moz-progress-bar { background: var(--chart-3); border-radius: 999px; }
.test-notice { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: .75rem 1rem; padding: .85rem 1rem; border: 1px solid rgb(var(--s-warn) / .45); border-radius: .75rem; background: rgb(var(--s-warn) / .08); }
.test-changes { display: grid; gap: .2rem; margin: .4rem 0 0; padding: 0; list-style: none; font-size: 13px; }
.test-change-key { font-weight: 600; overflow-wrap: anywhere; }
.test-question-text { font-weight: 600; overflow-wrap: anywhere; margin-right: .35rem; }
.test-expected { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 36rem; }
.test-documents { display: grid; gap: .15rem; margin: 0; padding: 0; list-style: none; font-size: 13px; }
.test-documents li { overflow-wrap: anywhere; }
.test-documents li.is-gone { color: rgb(var(--s-err)); text-decoration: line-through; }
.test-summary { overflow-wrap: anywhere; }
.test-progress { display: grid; gap: .25rem; min-width: 10rem; max-width: 16rem; }
.test-progress.is-wide { max-width: 32rem; }
.test-headline { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1024px) { .test-headline { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.test-figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 1rem; margin: 0; }
.test-figures dt { font-size: 12px; font-weight: 700; color: rgb(var(--s-muted)); }
.test-figures dd { margin: 0; }
.test-figures dd:nth-of-type(1) { font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.test-chart { position: relative; width: 100%; min-width: 0; height: 16rem; }
.test-chart > canvas { display: block; }
.test-configuration summary { cursor: pointer; }
.test-configuration-groups { display: grid; gap: 1rem; margin-top: .85rem; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); }
.test-configuration-group { margin-bottom: .35rem; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: rgb(var(--s-muted)); }
.test-drawer-backdrop { position: fixed; inset: 0; z-index: 70; background: rgb(0 0 0 / .35); }
.test-drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 71; display: flex; flex-direction: column; width: min(40rem, 100vw); background: rgb(var(--s-surface)); border-left: 1px solid rgb(var(--s-line)); box-shadow: -8px 0 28px rgb(0 0 0 / .18); }
.test-drawer:has(.is-pair) { width: min(76rem, 100vw); }
.test-drawer-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .85rem 1rem; border-bottom: 1px solid rgb(var(--s-line)); }
.test-drawer-body { flex: 1 1 auto; overflow-y: auto; padding: 1rem; }
.test-drawer-body.is-pair { display: grid; gap: 1.25rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .test-drawer-body.is-pair { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
html.has-drawer { overflow: hidden; }
.test-result { display: grid; gap: .45rem; align-content: start; min-width: 0; }
.test-result-heading { margin-top: .6rem; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: rgb(var(--s-muted)); }
.test-result-question { font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.test-result-text { font-size: 14px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.test-result-answer { padding: .65rem .8rem; border: 1px solid rgb(var(--s-line)); border-radius: .65rem; background: rgb(var(--s-surface-2) / .5); font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }
.test-overrule { display: grid; gap: .5rem; padding: .65rem .8rem; border: 1px dashed rgb(var(--s-line)); border-radius: .65rem; }
.test-passages { display: grid; gap: .45rem; margin: 0; padding: 0; list-style: none; }
.test-passage { padding: .5rem .65rem; border: 1px solid rgb(var(--s-line)); border-radius: .6rem; }
.test-passage.is-below { opacity: .7; border-style: dashed; }
.test-passage-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .6rem; font-size: 12.5px; }
.test-passage-rank { font-weight: 800; font-variant-numeric: tabular-nums; }
.test-picker { display: grid; gap: .5rem; padding: 0; margin: 0; border: 0; }
.test-chosen { display: grid; gap: .35rem; margin: 0; padding: 0; list-style: none; }
.test-chosen-item { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; padding: .4rem .55rem; border: 1px solid rgb(var(--s-line)); border-radius: .6rem; }
.test-chosen-title { flex: 1 1 12rem; min-width: 0; font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
.test-page { width: 5.5rem; }
.test-picker-search { display: flex; gap: .4rem; }
.test-picker-search .input { flex: 1 1 auto; min-width: 0; }
.test-picker-results { display: grid; gap: .35rem; max-height: 16rem; overflow-y: auto; }
.test-pick, .test-feedback-item { display: flex; align-items: flex-start; justify-content: space-between; gap: .6rem; padding: .45rem .55rem; border: 1px solid rgb(var(--s-line)); border-radius: .6rem; text-align: left; }
.test-pick-text { display: grid; gap: .15rem; min-width: 0; }
.test-pick-title { font-size: 13.5px; font-weight: 600; overflow-wrap: anywhere; }
.test-pick-snippet { font-size: 12.5px; line-height: 1.5; color: rgb(var(--s-muted)); overflow-wrap: anywhere; }
.test-feedback-list { display: grid; gap: .4rem; margin: .5rem 0 0; padding: 0; list-style: none; max-height: min(55vh, 30rem); overflow-y: auto; }
.test-format { margin: .35rem 0 0; padding: .45rem .6rem; border-radius: .5rem; background: rgb(var(--s-surface-2)); font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.test-estimate { display: grid; gap: .4rem; }
.test-estimate-warn { color: rgb(var(--s-warn)); font-weight: 600; }
.test-compare-table th[scope="row"] { font-weight: 600; }
.test-trend.is-better { color: rgb(var(--s-ok)); font-weight: 700; }
.test-trend.is-worse { color: rgb(var(--s-err)); font-weight: 700; }

/* The header's bell (#228, Q7): the unread count on the icon, the latest notifications under it. */
.notifications { position: relative; }
.notifications-bell { position: relative; }
.notifications-count { position: absolute; top: .1rem; right: .05rem; min-width: 1.05rem; height: 1.05rem; padding: 0 .25rem; border-radius: 999px; background: rgb(var(--s-brand)); color: #fff; font-size: 10.5px; font-weight: 800; line-height: 1.05rem; text-align: center; font-variant-numeric: tabular-nums; }
.notifications-panel { position: absolute; right: 0; top: calc(100% + .4rem); z-index: 60; width: min(24rem, calc(100vw - 2rem)); max-height: 70vh; overflow: auto; border: 1px solid rgb(var(--s-line)); border-radius: var(--r-md, .9rem); background: rgb(var(--s-surface)); box-shadow: var(--shadow-card); }
.notifications-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .6rem .8rem; border-bottom: 1px solid rgb(var(--s-line)); }
.notifications-title { font-weight: 800; font-size: 14px; }
.notifications-empty { padding: 1rem .8rem; font-size: 13px; color: rgb(var(--s-muted)); }
.notifications-list { margin: 0; padding: 0; list-style: none; }
.notifications-item + .notifications-item { border-top: 1px solid rgb(var(--s-line)); }
.notifications-link { display: flex; flex-direction: column; gap: .15rem; padding: .6rem .8rem; color: inherit; text-decoration: none; }
a.notifications-link:hover, a.notifications-link:focus-visible { background: rgb(var(--s-brand) / .06); outline: none; }
.notifications-item.is-unread .notifications-link { box-shadow: inset 3px 0 0 rgb(var(--s-brand)); }
.notifications-item-title { font-weight: 700; font-size: 13.5px; }
.notifications-item-message { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; font-size: 12.5px; color: rgb(var(--s-muted)); }
.notifications-item-when { font-size: 11.5px; color: rgb(var(--s-muted)); }
.notifications-foot { display: block; padding: .55rem .8rem; border-top: 1px solid rgb(var(--s-line)); font-size: 13px; font-weight: 700; text-align: center; color: rgb(var(--s-brand)); }
tr.is-unread td:first-child { box-shadow: inset 3px 0 0 rgb(var(--s-brand)); }
