/* Agentlab — AI-agent & LLM workbench. All rules are scoped under .al-app (the mount's child), never the bare
   .uwapp-agentlab class (it is on <body> too). Fuchsia + indigo; light and dark themes via [data-theme] on .al-app. */
.uwapp-root.uwapp-agentlab { background: #f7f4fa; }
.al-app {
  --al-accent: #a21caf;
  --al-accent-hover: #86198f;
  --al-accent-soft: #fae8ff;
  --al-accent-text: #86198f;
  --al-on-accent: #ffffff;
  --al-indigo: #4338ca;
  --al-bg: #f7f4fa;
  --al-panel: #ffffff;
  --al-panel-2: #faf7fc;
  --al-ink: #1f1a2e;
  --al-muted: #5b5670;
  --al-line: #e7e1ee;
  --al-line-2: #cdc4d9;
  --al-control: #7a7290;
  --al-focus: #b45309;
  --al-crit: #b91c1c; --al-crit-bg: #fee2e2;
  --al-high: #b91c1c; --al-high-bg: #fee2e2;
  --al-med: #a16207;  --al-med-bg: #fef3c7;
  --al-low: #1d4ed8;  --al-low-bg: #dbeafe;
  --al-info: #475569; --al-info-bg: #eef2f7;
  --al-pass: #15803d; --al-pass-bg: #dcfce7;
  --al-shadow: 0 10px 30px rgba(30, 27, 58, .16);
  --al-radius: 12px;
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-columns: minmax(0, 1fr);
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  background: var(--al-bg);
  color: var(--al-ink);
  font: 14px/1.45 system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', 'Noto Sans Arabic', sans-serif;
}
.al-app[data-theme='dark'] {
  --al-accent: #e879f9;
  --al-accent-hover: #f0abfc;
  --al-accent-soft: #3b1640;
  --al-accent-text: #f0abfc;
  --al-on-accent: #2a0a2e;
  --al-indigo: #a5b4fc;
  --al-bg: #110d18;
  --al-panel: #1a1524;
  --al-panel-2: #221b2e;
  --al-ink: #f1ecf6;
  --al-muted: #b5abc4;
  --al-line: #372d45;
  --al-line-2: #4a3d5c;
  --al-control: #9a8fb0;
  --al-focus: #fbbf24;
  --al-crit: #fca5a5; --al-crit-bg: #3b1219;
  --al-high: #fca5a5; --al-high-bg: #3b1219;
  --al-med: #fcd34d;  --al-med-bg: #33260a;
  --al-low: #93c5fd;  --al-low-bg: #10223f;
  --al-info: #cbd5e1; --al-info-bg: #1f2638;
  --al-pass: #86efac; --al-pass-bg: #0f2c1b;
  --al-shadow: 0 10px 30px rgba(0, 0, 0, .5);
  color-scheme: dark;
}
.uwapp-root.uwapp-agentlab:has(.al-app[data-theme='dark']) { background: #110d18; }

/* resets against platform element styles (zero specificity on the scope, so .al-* classes win) */
:where(.al-app) button, :where(.al-print-root) button { font: inherit; font-size: inherit; font-weight: inherit; width: auto; min-height: 0; padding: 0; margin: 0; border: 0; border-radius: 0; background: none; color: inherit; cursor: pointer; text-align: start; }
:where(.al-app) button:hover { background: none; }
:where(.al-app) input, :where(.al-app) select, :where(.al-app) textarea { font: inherit; color: inherit; }
:where(.al-app) h2, :where(.al-app) h3, :where(.al-app) h4 { margin: 0; letter-spacing: 0; }
:where(.al-app) p { margin: 0; }
:where(.al-app) code, :where(.al-app) kbd, :where(.al-app) pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: none; color: inherit; }
:where(.al-app) table { border-collapse: collapse; }
:where(.al-app) th, :where(.al-app) td { background: none; color: inherit; }
.al-app [hidden] { display: none !important; }
.al-app a { color: var(--al-accent-text); text-underline-offset: 2px; }
.al-app a:hover { color: var(--al-accent-hover); }
.al-app :focus-visible { outline: 3px solid var(--al-focus); outline-offset: 2px; }
.al-app .al-input:focus-visible { outline-offset: 0; }
.al-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.al-ico { flex: none; }
.al-muted { color: var(--al-muted); }
.al-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }

/* ---------------------------------------------------------------- toolbar */
.al-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; padding: 6px 10px; background: var(--al-panel); border-bottom: 1px solid var(--al-line); }
.al-toolbar-start, .al-toolbar-end { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.al-toolbar-start { flex: 1 1 420px; }
.al-menus { display: flex; flex-wrap: wrap; gap: 2px; }
.al-menubtn { display: inline-flex; align-items: center; gap: 4px; min-height: 34px; padding: 4px 9px; border-radius: 8px; font-weight: 600; }
.al-menubtn:hover, .al-menubtn[aria-expanded='true'] { background: var(--al-accent-soft); color: var(--al-accent-text); }
.al-projname { flex: 1 1 200px; max-width: 360px; min-width: 160px; font-weight: 600; }
.al-chipbtn { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 4px 10px; border: 1px solid var(--al-line-2); border-radius: 999px; color: var(--al-ink); font-size: 13px; }
.al-chipbtn:hover { border-color: var(--al-accent); color: var(--al-accent-text); }

/* ---------------------------------------------------------------- buttons & inputs */
.al-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 6px 14px; border: 1px solid var(--al-line-2); border-radius: 9px; background: var(--al-panel); color: var(--al-ink); font-weight: 600; line-height: 1.2; text-align: center; }
.al-btn:hover { border-color: var(--al-accent); color: var(--al-accent-text); background: var(--al-panel); }
.al-btn:disabled, .al-ibtn:disabled, .al-btn[aria-disabled='true'] { opacity: .55; cursor: not-allowed; }
.al-btn-primary { background: var(--al-accent); border-color: var(--al-accent); color: var(--al-on-accent); }
.al-btn-primary:hover { background: var(--al-accent-hover); border-color: var(--al-accent-hover); color: var(--al-on-accent); }
.al-btn-danger { background: var(--al-crit); border-color: var(--al-crit); color: var(--al-panel); }
.al-btn-danger:hover { background: var(--al-crit); color: var(--al-panel); filter: brightness(1.08); }
.al-btn-quiet { border-color: transparent; background: transparent; color: var(--al-accent-text); }
.al-btn-quiet:hover { background: var(--al-accent-soft); border-color: transparent; }
.al-btn-tile { flex-direction: column; justify-content: flex-start; min-height: 74px; padding: 10px; font-weight: 600; font-size: 13px; }
.al-ibtn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; color: var(--al-ink); flex: none; }
.al-ibtn:hover { background: var(--al-accent-soft); color: var(--al-accent-text); }
.al-ibtn[aria-pressed='true'] { background: var(--al-accent-soft); color: var(--al-accent-text); }
.al-linkbtn { color: var(--al-accent-text); text-decoration: underline; text-underline-offset: 2px; font-weight: 600; }
.al-input { width: 100%; min-width: 0; min-height: 36px; padding: 6px 9px; border: 1px solid var(--al-control); border-radius: 8px; background: var(--al-panel); color: var(--al-ink); }
textarea.al-input { resize: vertical; line-height: 1.4; }
.al-input[aria-invalid='true'] { border-color: var(--al-crit); box-shadow: 0 0 0 1px var(--al-crit); }
.al-num { max-width: 12rem; }
.al-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.al-row > .al-field { flex: 1 1 200px; }
.al-field > label { font-weight: 600; font-size: 13px; }
.al-field-inline { flex-direction: row; align-items: center; flex: 0 1 auto; gap: 8px; }
.al-field-inline .al-input { width: auto; }
.al-help { color: var(--al-muted); font-size: 12.5px; }
.al-row { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-start; }
.al-form > .al-btn, .al-card > .al-btn, .al-files > .al-btn { align-self: flex-start; }
.al-check { display: inline-flex; align-items: center; gap: 8px; min-height: 28px; cursor: pointer; }
.al-check input { width: 18px; height: 18px; accent-color: var(--al-accent); flex: none; margin: 0; }
.al-fieldset { border: 1px solid var(--al-line); border-radius: 10px; padding: 8px 12px 10px; margin: 0; min-width: 0; }
.al-fieldset legend { font-weight: 600; font-size: 13px; padding: 0 4px; }
.al-fieldset.al-inline { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.al-checkgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 2px 14px; }
.al-secretrow { display: flex; gap: 6px; align-items: center; }
.al-more > summary { cursor: pointer; font-weight: 600; color: var(--al-accent-text); min-height: 28px; display: flex; align-items: center; }
.al-more[open] > summary { margin-bottom: 8px; }

/* ---------------------------------------------------------------- body layout */
.al-body { display: grid; grid-template-columns: minmax(220px, 280px) minmax(0, 1fr); min-height: 0; }
.al-side { display: flex; flex-direction: column; gap: 8px; min-height: 0; padding: 10px; background: var(--al-panel); border-inline-end: 1px solid var(--al-line); overflow: hidden; }
.al-side-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.al-side-head h2 { font-size: 15px; min-width: 0; overflow-wrap: normal; word-break: keep-all; hyphens: auto; }
.al-side-head { flex-wrap: wrap; }
.al-addbtn { white-space: nowrap; flex: none; }
.al-addbtn { background: var(--al-accent); color: var(--al-on-accent); padding: 4px 10px; }
.al-addbtn:hover, .al-addbtn[aria-expanded='true'] { background: var(--al-accent-hover); color: var(--al-on-accent); }
.al-list { position: relative; overflow-y: auto; min-height: 0; flex: 1; padding-bottom: 8px; }
.al-group { display: flex; align-items: center; gap: 6px; margin: 12px 4px 4px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--al-muted); }
.al-group:first-child { margin-top: 2px; }
.al-items { list-style: none; margin: 0; padding: 0; }
.al-item { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 34px; padding: 5px 8px; border-radius: 8px; }
.al-item:hover { background: var(--al-panel-2); }
.al-item[aria-current='true'] { background: var(--al-accent-soft); color: var(--al-ink); font-weight: 600; box-shadow: inset 3px 0 0 var(--al-accent); }
[dir='rtl'] .al-item[aria-current='true'] { box-shadow: inset -3px 0 0 var(--al-accent); }
.al-itemname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.al-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; border: 2px solid var(--al-line-2); }
.al-dot-critical { background: var(--al-crit); border-color: var(--al-crit); }
.al-dot-high { background: var(--al-high); border-color: var(--al-high); }
.al-dot-medium { background: var(--al-med); border-color: var(--al-med); }
.al-dot-low { background: var(--al-low); border-color: var(--al-low); }
.al-dot-info { background: var(--al-info); border-color: var(--al-info); }
.al-dot-pass { background: var(--al-pass); border-color: var(--al-pass); }
.al-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.al-tabrow { display: flex; align-items: center; gap: 8px; padding: 6px 12px 0; border-bottom: 1px solid var(--al-line); background: var(--al-bg); }
.al-listtoggle { display: none; align-items: center; gap: 6px; min-height: 36px; padding: 4px 10px; border: 1px solid var(--al-line-2); border-radius: 9px; font-weight: 600; flex: none; }
.al-tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: thin; min-width: 0; }
.al-tab { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 6px 12px; border-bottom: 3px solid transparent; color: var(--al-muted); font-weight: 600; white-space: nowrap; }
.al-tab:hover { color: var(--al-ink); }
.al-tab:focus-visible { outline-offset: -3px; }
.al-tab[aria-selected='true'] { color: var(--al-accent-text); border-bottom-color: var(--al-accent); }
.al-hint { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 10px 14px 0; padding: 8px 12px; border-radius: 10px; background: var(--al-accent-soft); color: var(--al-ink); font-size: 13px; }
.al-hint > span { flex: 1 1 280px; }
.al-panel { position: relative; flex: 1; min-height: 0; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 14px; outline: none; }
.al-panel:focus-visible { outline: 3px solid var(--al-focus); outline-offset: -3px; }

/* ---------------------------------------------------------------- cards */
.al-card { background: var(--al-panel); border: 1px solid var(--al-line); border-radius: var(--al-radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.al-card > h2, .al-cardhead h2 { font-size: 16px; }
.al-card h3 { font-size: 14px; }
.al-cardhead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; }
.al-bench-head { display: flex; align-items: center; gap: 12px; }
.al-kindbadge { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--al-accent-soft); color: var(--al-accent-text); flex: none; }
.al-bench-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.al-title-input { font-size: 17px; font-weight: 700; border-color: transparent; padding-inline: 6px; }
.al-title-input:hover { border-color: var(--al-line-2); }
.al-bench-tools { display: flex; gap: 2px; }
.al-form { display: flex; flex-direction: column; gap: 12px; }
.al-secrets { display: flex; flex-direction: column; gap: 10px; padding: 12px; border: 1px dashed var(--al-indigo); border-radius: 10px; background: color-mix(in srgb, var(--al-indigo) 7%, var(--al-panel)); }
.al-secrets h3 { display: flex; align-items: center; gap: 6px; color: var(--al-ink); }
.al-files { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.al-filelist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.al-filelist li { display: flex; gap: 6px; align-items: center; }
.al-custodians { margin: 0; padding-inline-start: 22px; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px 14px; }
.al-steps > .al-field { flex-basis: 140px; }

/* actions */
.al-actionbar { display: flex; flex-wrap: wrap; gap: 10px 18px; }
.al-action { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.al-where { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--al-muted); }
.al-where-local { color: var(--al-indigo); }
.al-busy { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--al-panel-2); }
.al-busy progress { width: 160px; accent-color: var(--al-accent); }
.al-spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--al-line-2); border-top-color: var(--al-accent); flex: none; }
.al-spinner-sm { width: 12px; height: 12px; }
@media (prefers-reduced-motion: no-preference) { .al-spinner { animation: al-spin .8s linear infinite; } }
@keyframes al-spin { to { transform: rotate(360deg); } }
.al-error { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; background: var(--al-crit-bg); color: var(--al-ink); border: 1px solid var(--al-crit); }
.al-error > span { flex: 1 1 260px; }
.al-error-text { color: var(--al-crit); }
.al-recovery { display: flex; flex-direction: column; gap: 8px; padding-top: 10px; border-top: 1px solid var(--al-line); }

/* results */
.al-run { border: 1px solid var(--al-line); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 10px; background: var(--al-panel-2); }
.al-run-failed { border-color: var(--al-crit); }
.al-run-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.al-run-head h3 { font-size: 14px; }
.al-run-summary { font-weight: 600; overflow-wrap: anywhere; }
.al-metrics { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.al-metrics > div { padding: 6px 10px; border-radius: 8px; background: var(--al-panel); border: 1px solid var(--al-line); min-width: 0; max-width: 100%; }
.al-metrics dt { font-size: 11.5px; color: var(--al-muted); }
.al-metrics dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.al-findings { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.al-finding { display: flex; align-items: flex-start; gap: 10px; }
.al-finding-text { flex: 1; min-width: 0; overflow-wrap: anywhere; padding-top: 2px; }
.al-findings-wide .al-finding { padding: 8px 10px; border-radius: 9px; background: var(--al-panel-2); }
.al-sev { display: inline-flex; align-items: center; gap: 4px; flex: none; min-width: 82px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.al-sev-critical { background: var(--al-crit-bg); color: var(--al-crit); }
.al-sev-high { background: var(--al-high-bg); color: var(--al-high); }
.al-sev-medium { background: var(--al-med-bg); color: var(--al-med); }
.al-sev-low { background: var(--al-low-bg); color: var(--al-low); }
.al-sev-info { background: var(--al-info-bg); color: var(--al-info); }
.al-sev-pass { background: var(--al-pass-bg); color: var(--al-pass); }
.al-app:not([data-theme='dark']) .al-sev-critical { color: #991b1b; }
.al-app:not([data-theme='dark']) .al-sev-high { color: #991b1b; }
.al-app:not([data-theme='dark']) .al-sev-medium { color: #854d0e; }
.al-app:not([data-theme='dark']) .al-sev-pass { color: #166534; }
.al-outputs { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 10px; border: 1px solid var(--al-indigo); }
.al-outputs > .al-help { display: flex; align-items: center; gap: 4px; }
.al-outputs > .al-btn { align-self: flex-start; }
.al-codelist { margin: 0; padding-inline-start: 20px; display: flex; flex-direction: column; gap: 4px; }
.al-codelist li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.al-codelist code { overflow-wrap: anywhere; word-break: break-all; padding: 2px 6px; border-radius: 6px; background: var(--al-panel-2); border: 1px solid var(--al-line); }
.al-pre { margin: 0; padding: 10px; max-height: 320px; overflow: auto; border-radius: 8px; background: var(--al-panel-2); border: 1px solid var(--al-line); font-size: 12.5px; white-space: pre-wrap; word-break: break-all; }
.al-present { display: flex; flex-direction: column; gap: 10px; }
.al-codeblock { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.al-codeblock .al-pre { align-self: stretch; }
.al-callout { padding: 8px 12px; border-radius: 9px; background: var(--al-info-bg); border-inline-start: 4px solid var(--al-info); }
.al-callout-warning { background: var(--al-med-bg); border-color: var(--al-med); }
.al-callout-good { background: var(--al-pass-bg); border-color: var(--al-pass); }
.al-notes { margin: 0; padding-inline-start: 20px; color: var(--al-muted); }
.al-figure { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.al-figure img, .al-figure svg { max-width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--al-line); background: #fff; }
.al-figure figcaption { color: var(--al-muted); font-size: 12.5px; }
.al-tablewrap { overflow-x: auto; max-width: 100%; border: 1px solid var(--al-line); border-radius: 9px; }
.al-table { width: 100%; font-size: 13px; }
.al-table th { text-align: start; font-weight: 700; padding: 7px 10px; background: var(--al-panel-2); border-bottom: 1px solid var(--al-line); white-space: nowrap; }
.al-table td { padding: 6px 10px; border-bottom: 1px solid var(--al-line); vertical-align: top; overflow-wrap: anywhere; }
.al-table tr:last-child td { border-bottom: 0; }
.al-table code { word-break: break-all; font-size: 12px; }
.al-table kbd, .al-app kbd { display: inline-block; padding: 1px 6px; border: 1px solid var(--al-line-2); border-bottom-width: 2px; border-radius: 6px; font-size: 12px; background: var(--al-panel-2); }

/* welcome */
.al-welcome > p { max-width: 70ch; }
.al-templates { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }
.al-template { display: flex; flex-direction: column; gap: 4px; width: 100%; height: 100%; padding: 12px; border: 1px solid var(--al-line); border-radius: 10px; background: var(--al-panel-2); }
.al-template:hover { border-color: var(--al-accent); }
.al-template strong { color: var(--al-accent-text); }
.al-template span { color: var(--al-muted); font-size: 13px; }
.al-addgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.al-recent { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.al-recent li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }

/* dashboard */
.al-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.al-kpi { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--al-line); background: var(--al-panel-2); }
.al-kpi[aria-pressed='true'] { box-shadow: 0 0 0 2px var(--al-accent); }
.al-kpi-n { font-size: 24px; font-weight: 800; line-height: 1.1; }
.al-kpi-l { font-size: 12.5px; font-weight: 600; color: var(--al-muted); }
.al-kpi-critical .al-kpi-n { color: var(--al-crit); }
.al-kpi-high .al-kpi-n { color: var(--al-high); }
.al-kpi-medium .al-kpi-n { color: var(--al-med); }
.al-kpi-low .al-kpi-n { color: var(--al-low); }
.al-kpi-info .al-kpi-n { color: var(--al-info); }
.al-kpi-pass .al-kpi-n { color: var(--al-pass); }
.al-app:not([data-theme='dark']) .al-kpi-medium .al-kpi-n { color: #854d0e; }
.al-timeline svg { width: 100%; }
.al-pairs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.al-pairs li { display: flex; gap: 8px; align-items: center; }

/* compare + history */
.al-summary { margin: 0; padding-inline-start: 20px; display: flex; flex-direction: column; gap: 4px; font-weight: 600; }
.al-change { display: inline-block; white-space: nowrap; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--al-info-bg); color: var(--al-info); }
.al-change-gained { background: var(--al-pass-bg); color: var(--al-pass); }
.al-change-lost { background: var(--al-crit-bg); color: var(--al-crit); }
.al-change-changed { background: var(--al-med-bg); color: var(--al-med); }
.al-app:not([data-theme='dark']) .al-change-gained { color: #166534; }
.al-app:not([data-theme='dark']) .al-change-lost { color: #991b1b; }
.al-app:not([data-theme='dark']) .al-change-changed { color: #854d0e; }
.al-diff { font-weight: 700; color: var(--al-accent-text); }
.al-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.al-timeline-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.al-hist { padding: 10px 12px; border-inline-start: 3px solid var(--al-accent); background: var(--al-panel-2); border-radius: 0 9px 9px 0; display: flex; flex-direction: column; gap: 6px; }
[dir='rtl'] .al-hist { border-radius: 9px 0 0 9px; }
.al-hist-head { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.al-changes { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 3px; }
.al-chg-tag { display: inline-block; min-width: 72px; padding: 0 6px; border-radius: 6px; font-size: 12px; font-weight: 700; background: var(--al-info-bg); color: var(--al-info); }
.al-chg-new .al-chg-tag { background: var(--al-crit-bg); color: var(--al-crit); }
.al-chg-resolved .al-chg-tag { background: var(--al-pass-bg); color: var(--al-pass); }
.al-app:not([data-theme='dark']) .al-chg-new .al-chg-tag { color: #991b1b; }
.al-app:not([data-theme='dark']) .al-chg-resolved .al-chg-tag { color: #166534; }

/* report */
.al-report { display: flex; flex-direction: column; gap: 10px; max-width: 980px; }
.al-report-head { display: flex; gap: 12px; align-items: center; }
.al-report h2 { font-size: 19px; }
.al-report h3 { font-size: 15px; margin-top: 8px; }
.al-report-sum { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.al-report-sum strong { font-size: 18px; }

/* ---------------------------------------------------------------- status bar, menus, toasts, dialogs */
.al-status { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; min-height: 30px; padding: 3px 12px; background: var(--al-panel); border-top: 1px solid var(--al-line); font-size: 12.5px; color: var(--al-muted); }
.al-status-msg { flex: 1 1 300px; min-width: 0; color: var(--al-ink); }
.al-status-error { color: var(--al-crit); font-weight: 600; }
.al-status-right { margin-inline-start: auto; }
.al-menu { z-index: 50; min-width: 220px; max-height: min(70vh, 520px); overflow-y: auto; padding: 6px; border-radius: 10px; border: 1px solid var(--al-line-2); background: var(--al-panel); color: var(--al-ink); box-shadow: var(--al-shadow); }
.al-menu-item { display: flex; align-items: center; justify-content: space-between; gap: 18px; width: 100%; min-height: 34px; padding: 6px 10px; border-radius: 7px; }
.al-menu-item:hover, .al-menu-item:focus { background: var(--al-accent-soft); color: var(--al-ink); outline: none; }
.al-menu-item:focus-visible { outline: 2px solid var(--al-focus); outline-offset: -2px; }
.al-menu-item:disabled { opacity: .55; cursor: default; }
.al-menu-item[aria-checked='true']::before { content: '✓'; margin-inline-end: -10px; font-weight: 700; color: var(--al-accent-text); }
.al-menu-hint { color: var(--al-muted); font-size: 12px; }
.al-menu-sep { height: 1px; margin: 5px 4px; background: var(--al-line); }
.al-menu-heading { padding: 6px 10px 2px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; color: var(--al-muted); }
.al-toasts { position: fixed; inset-block-end: 40px; inset-inline-end: 16px; z-index: 80; display: flex; flex-direction: column; gap: 6px; max-width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.al-toast { display: flex; gap: 8px; align-items: center; padding: 9px 12px; border-radius: 10px; background: var(--al-ink); color: var(--al-panel); box-shadow: var(--al-shadow); font-size: 13px; }
.al-dialog { width: min(640px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); padding: 0; border: 1px solid var(--al-line-2); border-radius: 14px; background: var(--al-panel); color: var(--al-ink); box-shadow: var(--al-shadow); }
.al-dialog-wide { width: min(900px, calc(100vw - 24px)); }
.al-dialog-narrow { width: min(520px, calc(100vw - 24px)); }
.al-dialog::backdrop { background: rgba(15, 12, 35, .55); }
.al-dialog[open] { display: flex; flex-direction: column; }
.al-dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px 10px 18px; border-bottom: 1px solid var(--al-line); }
.al-dialog-head h2 { font-size: 17px; }
.al-dialog-body { padding: 14px 18px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.al-dialog-body ul { margin: 0; padding-inline-start: 20px; display: flex; flex-direction: column; gap: 4px; }
.al-dialog-body ul.al-templates, .al-dialog-body ul.al-recent { padding: 0; }
.al-dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.al-drop { box-shadow: inset 0 0 0 4px var(--al-accent); }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1100px) {
  .al-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .al-body { grid-template-columns: minmax(0, 1fr); position: relative; }
  .al-listtoggle { display: inline-flex; }
  .al-side { position: absolute; inset-block: 0; inset-inline-start: 0; z-index: 30; width: min(320px, 88vw); box-shadow: var(--al-shadow); visibility: hidden; transform: translateX(-102%); }
  [dir='rtl'] .al-side { transform: translateX(102%); }
  .al-list-open .al-side { visibility: visible; transform: none; }
  @media (prefers-reduced-motion: no-preference) { .al-side { transition: transform .18s ease, visibility .18s; } }
  .al-projname { max-width: none; }
}
@media (max-width: 560px) {
  .al-toolbar { padding: 6px; }
  .al-toolbar-start { flex-basis: 100%; }
  .al-menus { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; scrollbar-width: thin; }
  .al-menubtn { padding: 4px 6px; flex: none; }
  .al-hint { margin: 8px 10px 0; padding: 6px 10px; }
  .al-runall-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .al-runall { padding: 6px 10px; }
  .al-chipbtn span { max-width: 9.5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .al-panel { padding: 10px; }
  .al-card { padding: 12px; }
  .al-tab span { font-size: 13px; }
  .al-tab { padding: 6px 8px; }
  .al-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .al-status-right { margin-inline-start: 0; }
  .al-sev { min-width: 0; }
  .al-finding { flex-direction: column; gap: 4px; }
}

/* ---------------------------------------------------------------- print (report, share cards) */
.al-print-root { display: none; }
@media print {
  html.al-printing, html.al-printing body { display: block !important; height: auto !important; min-height: 0 !important; overflow: visible !important; background: #fff !important; }
  html.al-printing body > :not(.al-print-root) { display: none !important; }
  .al-print-root .al-report { max-width: none; }
  html.al-printing .al-print-root { padding: 0 6px; }
  html.al-printing .al-print-root { display: block; color: #111; background: #fff; font: 12px/1.45 system-ui, sans-serif; --al-ink: #111; --al-muted: #444; --al-line: #ccc; --al-panel: #fff; --al-panel-2: #f6f6f6; --al-crit: #991b1b; --al-pass: #166534; --al-med: #854d0e; --al-high: #9a3412; --al-low: #1d4ed8; --al-info: #333; }
  .al-print-root .al-tablewrap { overflow: visible; border: 0; }
  .al-print-root .al-table { border-collapse: collapse; width: 100%; }
  .al-print-root .al-table th, .al-print-root .al-table td { border: 1px solid #bbb; padding: 4px 6px; text-align: start; vertical-align: top; }
  .al-print-root h2 { font-size: 18px; margin: 0 0 4px; }
  .al-print-root h3 { font-size: 14px; margin: 14px 0 6px; }
  .al-print-root .al-report-head { display: flex; gap: 10px; align-items: center; }
  .al-print-root .al-report-sum { list-style: none; padding: 0; display: flex; gap: 16px; }
  .al-print-root figure { margin: 0; break-inside: avoid; }
  .al-print-root svg { max-width: 100%; height: auto; }
  .al-print-root .al-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .al-sharecard { break-after: page; border: 2px dashed #555; border-radius: 10px; padding: 16px 20px; margin: 0 0 12px; }
  .al-sharecard pre { font: 14px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap; word-break: break-all; border: 1px solid #999; padding: 10px; }
  .al-sharecard:last-child { break-after: auto; }
}
.al-report-bar { flex-direction: row; flex-wrap: wrap; align-items: center; }


/* ---------------------------------------------------------------- Agentlab additions */
.al-field-wide { flex-basis: 100%; }
.al-date { max-width: 14rem; }
.al-pad { padding: 4px 4px 12px; }
.al-ext { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 600; }
.al-caption { caption-side: top; text-align: start; font-weight: 700; padding: 8px 10px 6px; }
.al-cell-list { margin: 0; padding-inline-start: 18px; display: flex; flex-direction: column; gap: 2px; }
ul.al-cell-list { list-style: disc; }
.al-edit-table td { padding: 4px 6px; }
.al-edit-table .al-input { min-width: 6rem; }
.al-edit-table td:first-child .al-input { min-width: 12rem; }
.al-jump { flex: none; max-width: 14rem; font-size: 12.5px; padding: 2px 8px; min-height: 28px; }
.al-jump span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.al-callout p { margin: 0 0 6px; }
.al-callout { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.al-pill { display: inline-block; white-space: nowrap; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--al-info-bg); color: var(--al-info); }
.al-pill-high, .al-pill-fail, .al-pill-error, .al-pill-number-mismatch, .al-pill-unsupported-citation, .al-pill-contradicted-number { background: var(--al-high-bg); color: var(--al-high); }
.al-pill-medium, .al-pill-warn, .al-pill-uncited-claim, .al-pill-not-found, .al-pill-no-result { background: var(--al-med-bg); color: var(--al-med); }
.al-pill-low, .al-pill-weak-support, .al-pill-partially-supported, .al-pill-unused { background: var(--al-low-bg); color: var(--al-low); }
.al-pill-pass, .al-pill-ok, .al-pill-supported, .al-pill-used { background: var(--al-pass-bg); color: var(--al-pass); }
.al-app:not([data-theme='dark']) :is(.al-pill-high, .al-pill-fail, .al-pill-error, .al-pill-number-mismatch, .al-pill-unsupported-citation, .al-pill-contradicted-number) { color: #991b1b; }
.al-app:not([data-theme='dark']) :is(.al-pill-medium, .al-pill-warn, .al-pill-uncited-claim, .al-pill-not-found, .al-pill-no-result) { color: #854d0e; }
.al-app:not([data-theme='dark']) :is(.al-pill-pass, .al-pill-ok, .al-pill-supported, .al-pill-used) { color: #166534; }

/* toolbar verdict chip */
.al-chip-pass { border-color: var(--al-pass); color: var(--al-pass); }
.al-chip-fail { border-color: var(--al-high); color: var(--al-high); }
.al-app:not([data-theme='dark']) .al-chip-pass { color: #166534; }
.al-app:not([data-theme='dark']) .al-chip-fail { color: #991b1b; }

/* verdict banner */
.al-verdict { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 16px; border-radius: var(--al-radius); border: 1px solid var(--al-line); background: var(--al-panel); border-inline-start: 6px solid var(--al-info); }
.al-verdict-text { flex: 1 1 260px; display: flex; flex-direction: column; gap: 2px; }
.al-verdict-text strong { font-size: 15.5px; }
.al-verdict-pass { border-inline-start-color: var(--al-pass); }
.al-verdict-pass > .al-ico { color: var(--al-pass); }
.al-verdict-fail { border-inline-start-color: var(--al-high); }
.al-verdict-fail > .al-ico { color: var(--al-high); }
.al-verdict-open > .al-ico { color: var(--al-accent-text); }

/* KPIs and areas */
.al-kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.al-kpi-static { cursor: default; }
.al-areas { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 1180px) { .al-areas { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .al-areas { grid-template-columns: minmax(0, 1fr); } }
.al-area { display: flex; flex-direction: column; gap: 4px; width: 100%; height: 100%; padding: 10px 12px; border: 1px solid var(--al-line); border-radius: 10px; background: var(--al-panel-2); border-top: 4px solid var(--al-line-2); }
.al-area:hover { border-color: var(--al-accent); }
.al-area[aria-pressed='true'] { box-shadow: 0 0 0 2px var(--al-accent); }
.al-area-high { border-top-color: var(--al-high); }
.al-area-medium { border-top-color: var(--al-med); }
.al-area-ok { border-top-color: var(--al-pass); }
.al-area-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.al-area-help { color: var(--al-muted); font-size: 12.5px; }
.al-area-count { font-size: 12.5px; font-weight: 600; }
.al-area-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--al-line-2); flex: none; }
.al-area-dot-high { background: var(--al-high); }
.al-area-dot-medium { background: var(--al-med); }
.al-area-dot-ok { background: var(--al-pass); }
.al-reviews { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.al-reviews li { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.al-reviews strong { min-width: 8.5rem; }

/* gates */
.al-gates-table td { vertical-align: middle; }
.al-gates-table td:nth-child(2) { min-width: 19rem; }
.al-gates-table td:nth-child(5) { min-width: 9rem; }
.al-gate-thr { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.al-gate-thr .al-op { width: 4.4rem; flex: none; }
.al-gate-thr .al-num { width: 6.5rem; flex: none; }

/* welcome */
.al-addgrid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.al-addtile { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; width: 100%; height: 100%; padding: 10px 12px; border: 1px solid var(--al-line); border-radius: 10px; background: var(--al-panel-2); }
.al-addtile:hover { border-color: var(--al-accent); }
.al-addtile span:last-child { color: var(--al-muted); font-size: 12.5px; }
.al-addtile-ico { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--al-accent-soft); color: var(--al-accent-text); margin-bottom: 2px; }

/* report */
.al-report-verdict { font-weight: 700; padding: 8px 12px; border-radius: 9px; background: var(--al-info-bg); }
.al-report-verdict-pass { background: var(--al-pass-bg); }
.al-report-verdict-fail { background: var(--al-high-bg); }
.al-run h4 { font-size: 13px; color: var(--al-muted); text-transform: uppercase; letter-spacing: .04em; }
.al-app[data-theme='dark'] .al-figure svg { border-color: var(--al-line); }
@media (max-width: 1100px) { .al-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 560px) {
  .al-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .al-gates-table td:nth-child(2) { min-width: 11rem; }
  .al-addgrid { grid-template-columns: minmax(0, 1fr); }
  .al-verdict { padding: 10px 12px; }
}
@media print {
  html.al-printing .al-print-root .al-pill, html.al-printing .al-print-root .al-sev { border: 1px solid #999; }
  html.al-printing .al-print-root .al-report-verdict { border: 1px solid #999; }
}

.al-run > .al-btn, .al-callout > .al-btn { align-self: flex-start; }
.al-nowrap-first td:first-child { white-space: nowrap; overflow-wrap: normal; }
