/* Bot Hub theme on top of Pico: tokens (light-dark), app shell, cards, live bot view, motion. */

/* Same specificity as Pico's theme selectors and loaded later, so these win in light and dark alike.
   light-dark() follows Pico's color-scheme, which follows data-theme (set from the toggle) or the OS. */
:root:not([data-theme=dark]), [data-theme=dark] {
  --bh-bg: light-dark(#f4f6fb, #0a0d16);
  --bh-surface: light-dark(#ffffff, #11151f);
  --bh-surface-2: light-dark(#f8f9fd, #161b28);
  --bh-hover: light-dark(#eef0f8, #1c2233);
  --bh-border: light-dark(#e3e6ef, #242b3d);
  --bh-text: light-dark(#141a2e, #e7eaf3);
  --bh-muted: light-dark(#5d6679, #8e97ab);
  --bh-primary: light-dark(#5650e6, #8b87ff);
  --bh-primary-2: light-dark(#0891b2, #22d3ee);
  --bh-ok: light-dark(#15803d, #4ade80);
  --bh-warn: light-dark(#b45309, #fbbf24);
  --bh-bad: light-dark(#dc2626, #f87171);
  --bh-run: light-dark(#2563eb, #60a5fa);
  --bh-off: light-dark(#9aa1b1, #5b6478);
  --bh-shadow-color: light-dark(rgb(16 24 40 / .07), rgb(0 0 0 / .35));
  --bh-shadow: 0 1px 2px var(--bh-shadow-color), 0 6px 20px var(--bh-shadow-color);
  --bh-grad: linear-gradient(135deg, var(--bh-primary), var(--bh-primary-2));
  --bh-radius: 14px;

  --pico-font-family-sans-serif: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --pico-font-size: 93.75%;
  --pico-line-height: 1.55;
  --pico-border-radius: 10px;
  --pico-block-spacing-vertical: 1.25rem;
  --pico-block-spacing-horizontal: 1.4rem;
  --pico-form-element-spacing-vertical: .6rem;
  --pico-form-element-spacing-horizontal: .8rem;
  --pico-background-color: var(--bh-bg);
  --pico-color: var(--bh-text);
  --pico-muted-color: var(--bh-muted);
  --pico-muted-border-color: var(--bh-border);
  --pico-primary: var(--bh-primary);
  --pico-primary-background: var(--bh-primary);
  --pico-primary-border: var(--bh-primary);
  --pico-primary-underline: color-mix(in srgb, var(--bh-primary) 40%, transparent);
  --pico-primary-hover: color-mix(in srgb, var(--bh-primary) 82%, var(--bh-text));
  --pico-primary-hover-background: var(--pico-primary-hover);
  --pico-primary-hover-border: var(--pico-primary-hover);
  --pico-primary-hover-underline: var(--pico-primary-hover);
  --pico-primary-focus: color-mix(in srgb, var(--bh-primary) 28%, transparent);
  --pico-primary-inverse: #fff;
  --pico-card-background-color: var(--bh-surface);
  --pico-card-sectioning-background-color: var(--bh-surface-2);
  --pico-card-border-color: var(--bh-border);
  --pico-card-box-shadow: var(--bh-shadow);
  --pico-form-element-background-color: var(--bh-surface);
  --pico-form-element-selected-background-color: var(--bh-hover);
  --pico-form-element-border-color: var(--bh-border);
  --pico-form-element-active-background-color: var(--bh-surface);
  --pico-form-element-active-border-color: var(--bh-primary);
  --pico-form-element-focus-color: var(--pico-primary-focus);
  --pico-table-border-color: var(--bh-border);
  --pico-code-background-color: var(--bh-hover);
  --pico-code-color: var(--bh-text);
  --pico-h1-color: var(--bh-text); --pico-h2-color: var(--bh-text); --pico-h3-color: var(--bh-text);
  --pico-h4-color: var(--bh-text); --pico-h5-color: var(--bh-text); --pico-h6-color: var(--bh-text);
}

@media (prefers-reduced-motion: no-preference) { @view-transition { navigation: auto; } }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .22s; }

html { scroll-behavior: smooth; scroll-padding-top: 1rem; }
body { background: var(--bh-bg); }
h1 { font-size: 1.7rem; letter-spacing: -.025em; margin-bottom: .2rem; }
h2, h3, h4 { letter-spacing: -.01em; }
h4 { font-size: .95rem; margin: 1.2rem 0 .6rem; }
a { --pico-text-decoration: none; }  /* Pico underlines every link */
a:not([role=button]):hover { text-decoration: underline; text-underline-offset: 3px; }
:is(.nav, .tabs) a, a.pcard, a.brand { text-decoration: none !important; }  /* beats Pico's aria-current/hover underline */
code { border-radius: 6px; font-size: .82em; padding: .1rem .35rem; }
pre { border-radius: 10px; }
.ico { width: 1.1em; height: 1.1em; flex: none; vertical-align: -.18em; fill: none; stroke: currentColor;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--bh-muted); font-size: .9rem; }
.error { color: var(--bh-bad); }
.masked { font-family: ui-monospace, monospace; letter-spacing: .1rem; }
form.inline { display: inline; margin: 0; }
textarea { min-height: 6rem; }
label { font-weight: 500; font-size: .9rem; }
label small, label .muted { font-weight: 400; }
fieldset { margin-bottom: 0; }
code.copy { cursor: pointer; }
.steps .locked { opacity: .5; pointer-events: none; }

/* ---------- app shell ---------- */
body.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
body > main.content { width: 100%; max-width: 1280px; margin: 0 auto; padding: 2rem clamp(1rem, 3vw, 2.5rem) 4rem; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 1rem; overflow-y: auto;
  padding: 1.1rem .85rem; background: var(--bh-surface); border-right: 1px solid var(--bh-border);
  view-transition-name: sidebar; }
.side-top { display: flex; align-items: center; justify-content: space-between; }
.side-body { display: flex; flex-direction: column; gap: 1.1rem; flex: 1; }
.brand { display: flex; align-items: center; gap: .65rem; padding: .2rem .45rem; font-weight: 700; font-size: 1.08rem;
  color: var(--bh-text); letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.logo { display: grid; place-items: center; width: 2.15rem; height: 2.15rem; border-radius: 10px; color: #fff;
  background: var(--bh-grad); box-shadow: 0 6px 16px color-mix(in srgb, var(--bh-primary) 35%, transparent); }
.brand:hover .logo .ico { animation: wiggle .6s ease; }
.side-label { margin: 0 .6rem .4rem; font-size: .68rem; font-weight: 650; letter-spacing: .09em; text-transform: uppercase;
  color: var(--bh-muted); }
.product-switch { margin: 0; font-size: .9rem; }
.nav { display: flex; flex-direction: column; justify-content: flex-start; gap: 2px; }
.nav a { position: relative; display: flex; align-items: center; gap: .65rem; padding: .5rem .65rem; border-radius: 9px;
  color: var(--bh-muted); font-weight: 500; font-size: .92rem; transition: background .15s, color .15s; }
.nav a:hover { background: var(--bh-hover); color: var(--bh-text); text-decoration: none; }
.nav a[aria-current=page] { background: color-mix(in srgb, var(--bh-primary) 12%, transparent); color: var(--bh-primary); }
.nav a[aria-current=page]::before { content: ""; position: absolute; left: -.85rem; top: .45rem; bottom: .45rem; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--bh-grad); }
.nav-product { padding: .55rem; border-radius: 12px; background: var(--bh-surface-2); border: 1px solid var(--bh-border); }
.nav-product .nav a[aria-current=page]::before { left: -.55rem; }
.nav-product-name { display: flex; align-items: center; gap: .55rem; margin: .1rem .25rem .45rem; font-weight: 600;
  font-size: .9rem; min-width: 0; }
.nav-product-name span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot { margin-top: auto; display: flex; align-items: center; gap: .6rem; padding: .9rem .35rem 0;
  border-top: 1px solid var(--bh-border); }
.me { display: flex; align-items: center; gap: .6rem; min-width: 0; flex: 1; }
.me .who { min-width: 0; line-height: 1.25; }
.me .who span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .82rem; font-weight: 600; }
.me .who small { color: var(--bh-muted); font-size: .74rem; text-transform: capitalize; }
.avatar { display: grid; place-items: center; flex: none; width: 2rem; height: 2rem; border-radius: 50%; color: #fff;
  background: var(--bh-grad); font-weight: 700; font-size: .85rem; text-transform: uppercase; }
.avatar.sm { width: 1.6rem; height: 1.6rem; font-size: .72rem; border-radius: 8px; }
.avatar.lg { width: 3.1rem; height: 3.1rem; border-radius: 15px; font-size: 1.35rem;
  box-shadow: 0 10px 24px color-mix(in srgb, var(--bh-primary) 30%, transparent); }
.icon-btn { display: inline-grid; place-items: center; flex: none; width: 2.1rem; height: 2.1rem; margin: 0; padding: 0;
  border-radius: 9px; border: 1px solid var(--bh-border); background: transparent; color: var(--bh-muted); box-shadow: none; }
.icon-btn:hover { background: var(--bh-hover); color: var(--bh-text); border-color: var(--bh-border); }
.theme-toggle .ico { transition: transform .5s cubic-bezier(.3, 1.6, .5, 1); }
.theme-toggle:hover .ico { transform: rotate(-30deg) scale(1.1); }
.theme-toggle .sun, [data-theme=dark] .theme-toggle .moon { display: none; }
[data-theme=dark] .theme-toggle .sun { display: block; }
.theme-float { position: fixed; top: 1rem; right: 1rem; z-index: 10; }
.menu-btn { display: none; }

@media (max-width: 960px) {
  body.shell { display: block; }
  .sidebar { z-index: 50; height: auto; max-height: 100vh; padding: .6rem 1rem; gap: 0; border-right: 0;
    border-bottom: 1px solid var(--bh-border); background: color-mix(in srgb, var(--bh-surface) 88%, transparent);
    backdrop-filter: blur(12px); }
  .menu-btn { display: inline-grid; }
  .side-body { display: none; padding: 1rem 0 .4rem; }
  .sidebar.open .side-body { display: flex; animation: fade-down .2s ease backwards; }
  body > main.content { padding-top: 1.4rem; }
}

/* ---------- page structure ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.page-head p { margin: 0; color: var(--bh-muted); }
.page-head h1 { margin: 0 0 .2rem; }
.eyebrow { margin-bottom: .3rem !important; font-size: .72rem; font-weight: 650; letter-spacing: .09em; text-transform: uppercase;
  color: var(--bh-primary) !important; }
.product-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem; margin-bottom: 1rem; }
.product-id { display: flex; align-items: center; gap: .95rem; min-width: 0; }
.product-id h1 { margin: 0; }
.product-id p { margin: .15rem 0 0; display: flex; align-items: center; flex-wrap: wrap; gap: .45rem; }
.tabs { display: flex; justify-content: flex-start; gap: .2rem; margin-bottom: 1.5rem; border-bottom: 1px solid var(--bh-border); overflow-x: auto; scrollbar-width: none; }
.tabs a { display: flex; align-items: center; gap: .45rem; margin-bottom: -1px; padding: .65rem .9rem; white-space: nowrap;
  color: var(--bh-muted); font-weight: 500; font-size: .92rem; border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s, background .15s; border-radius: 8px 8px 0 0; }
.tabs a:hover { color: var(--bh-text); background: var(--bh-hover); text-decoration: none; }
.tabs a[aria-current=page] { color: var(--bh-primary); border-bottom-color: var(--bh-primary); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(20rem, 100%), 1fr)); gap: 1.25rem; }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(18rem, 1fr); gap: 1.25rem; align-items: start; }
@media (max-width: 1100px) { .split { grid-template-columns: minmax(0, 1fr); } }

/* entrance: content rises in, staggered (backwards fill: no transform left behind afterwards) */
main.content > *, .kpis > *, .bot-actions > *, .cards > *, .split > * { animation: rise .5s cubic-bezier(.2, .7, .2, 1) backwards; }
main.content > :nth-child(2), .kpis > :nth-child(2), .bot-actions > :nth-child(2), .cards > :nth-child(2), .split > :nth-child(2) { animation-delay: .05s; }
main.content > :nth-child(3), .kpis > :nth-child(3), .bot-actions > :nth-child(3), .cards > :nth-child(3) { animation-delay: .1s; }
main.content > :nth-child(4), .kpis > :nth-child(4), .cards > :nth-child(4) { animation-delay: .15s; }
main.content > :nth-child(5), .cards > :nth-child(5) { animation-delay: .2s; }
main.content > :nth-child(n+6), .cards > :nth-child(n+6) { animation-delay: .25s; }

/* ---------- cards ---------- */
article { border: 1px solid var(--bh-border); border-radius: var(--bh-radius); }
article > header { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem .6rem; padding-top: .85rem; padding-bottom: .85rem; }
article > header strong { display: inline-flex; align-items: center; gap: .5rem; }
article > header strong .ico { color: var(--bh-primary); }
article > header .muted { font-size: .85rem; }
.head-link { margin-left: auto; font-size: .85rem; font-weight: 500; }
.step { display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; border-radius: 50%; color: #fff;
  background: var(--bh-grad); font-size: .78rem; font-weight: 700; }
article.danger-zone { border-color: color-mix(in srgb, var(--bh-bad) 35%, var(--bh-border)); }
article.danger-zone > header strong .ico { color: var(--bh-bad); }
.empty { display: flex; flex-direction: column; align-items: center; gap: .5rem; padding: 1.5rem 1rem; text-align: center;
  color: var(--bh-muted); }
.empty > .ico { width: 2rem; height: 2rem; color: var(--bh-primary); opacity: .7; }
.empty p { margin: 0; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.kpi { position: relative; overflow: hidden; padding: 1.1rem 1.2rem; border: 1px solid var(--bh-border); border-radius: var(--bh-radius);
  background: var(--bh-surface); box-shadow: var(--bh-shadow); transition: transform .2s, box-shadow .2s; }
.kpi:hover { transform: translateY(-2px); box-shadow: 0 12px 32px var(--bh-shadow-color); }
.kpi::after { content: ""; position: absolute; right: -2.2rem; top: -2.2rem; width: 6.5rem; height: 6.5rem; border-radius: 50%;
  background: var(--bh-grad); opacity: .09; }
.kpi .label { display: flex; align-items: center; gap: .45rem; color: var(--bh-muted); font-size: .8rem; font-weight: 550; }
.kpi .value { margin-top: .3rem; font-size: 1.95rem; font-weight: 750; letter-spacing: -.03em; line-height: 1.15;
  font-variant-numeric: tabular-nums; }
.kpi .value small { font-size: .9rem; font-weight: 500; color: var(--bh-muted); }
.kpi .sub { color: var(--bh-muted); font-size: .8rem; }
.kpi.live .value { color: var(--bh-run); }
.kpi.live .label .ico { color: var(--bh-run); animation: blink 1.4s ease-in-out infinite; }
.meter { height: 6px; margin: .55rem 0 .35rem; border-radius: 99px; background: var(--bh-hover); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: inherit; background: var(--bh-grad); transform-origin: left;
  animation: grow 1.1s cubic-bezier(.2, .7, .2, 1) .2s backwards; }
.meter.bad > span { background: var(--bh-bad); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(16rem, 100%), 1fr)); gap: 1rem; }
.pcard { display: flex; flex-direction: column; gap: .65rem; padding: 1.05rem 1.15rem; color: var(--bh-text);
  border: 1px solid var(--bh-border); border-radius: var(--bh-radius); background: var(--bh-surface);
  transition: transform .2s, box-shadow .2s, border-color .2s; }
a.pcard:hover { transform: translateY(-3px); text-decoration: none; box-shadow: 0 14px 34px var(--bh-shadow-color);
  border-color: color-mix(in srgb, var(--bh-primary) 45%, var(--bh-border)); }
.pcard-top { display: flex; align-items: center; gap: .7rem; min-width: 0; }
.pcard-top > div { min-width: 0; line-height: 1.3; }
.pcard-top strong { display: block; }
.pcard-top small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--bh-muted); }
.pcard-top .pill { margin-left: auto; }
.kv { display: flex; justify-content: space-between; gap: 1rem; font-size: .84rem; color: var(--bh-muted); }
.kv b { color: var(--bh-text); font-weight: 600; text-align: right; }
.pcard.add { border-style: dashed; background: transparent; box-shadow: none; }

/* ---------- status ---------- */
.pill { --c: var(--bh-off); display: inline-flex; align-items: center; gap: .4rem; padding: .14rem .6rem; border-radius: 99px;
  font-size: .76rem; font-weight: 600; line-height: 1.5; white-space: nowrap; text-transform: capitalize;
  color: var(--c); background: color-mix(in srgb, var(--c) 13%, transparent); }
.pill::before { content: ""; width: .45rem; height: .45rem; border-radius: 50%; background: currentColor; }
.pill.ok, .pill.completed { --c: var(--bh-ok); }
.pill.bad, .pill.failed { --c: var(--bh-bad); }
.pill.warn, .pill.paused { --c: var(--bh-warn); }
.pill.run, .pill.running { --c: var(--bh-run); }
.pill.queued { --c: var(--bh-muted); }
.pill.running::before, .pill.paused::before { animation: ping 1.5s ease-out infinite; }
.chip { display: inline-flex; align-items: center; gap: .3rem; padding: .08rem .5rem; border-radius: 7px; font-size: .78rem;
  background: var(--bh-hover); border: 1px solid var(--bh-border); color: var(--bh-text); white-space: nowrap;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.chip em { font-style: normal; color: var(--bh-warn); font-size: .7rem; }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.ok-dot::before, .bad-dot::before, .off-dot::before { content: ""; display: inline-block; width: .55rem; height: .55rem;
  margin-right: .5rem; border-radius: 50%; vertical-align: .05em; background: var(--bh-off); }
.ok-dot::before { background: var(--bh-ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bh-ok) 20%, transparent); }
.bad-dot::before { background: var(--bh-bad); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bh-bad) 20%, transparent); }

.flash { --c: var(--bh-primary); display: flex; align-items: flex-start; gap: .7rem; margin-bottom: 1.25rem; padding: .85rem 1rem;
  border-radius: 12px; border: 1px solid color-mix(in srgb, var(--c) 30%, transparent);
  background: color-mix(in srgb, var(--c) 8%, var(--bh-surface)); box-shadow: none; }
.flash > .ico { color: var(--c); margin-top: .15rem; }
.flash.ok { --c: var(--bh-ok); }
.flash.error { --c: var(--bh-bad); }
.flash.warn { --c: var(--bh-warn); }

.toasts { position: fixed; top: 1rem; right: 1rem; z-index: 100; display: flex; flex-direction: column; gap: .6rem;
  width: min(26rem, calc(100vw - 2rem)); pointer-events: none; }
.toast { --c: var(--bh-ok); display: flex; align-items: flex-start; gap: .65rem; padding: .8rem .9rem; pointer-events: auto;
  font-size: .9rem; border-radius: 12px; border: 1px solid var(--bh-border); border-left: 4px solid var(--c);
  background: var(--bh-surface); box-shadow: 0 14px 36px var(--bh-shadow-color);
  animation: toast-in .45s cubic-bezier(.2, .8, .2, 1) backwards, toast-out .5s ease-in 7s forwards; }
.toast > .ico { color: var(--c); margin-top: .15rem; }
.toast.warn { --c: var(--bh-warn); }
.toast.error { --c: var(--bh-bad); animation: toast-in .45s cubic-bezier(.2, .8, .2, 1) backwards; }
.toast button { margin: -.2rem -.3rem 0 auto; padding: 0 .35rem; border: 0; background: none; box-shadow: none;
  color: var(--bh-muted); font-size: 1.2rem; line-height: 1.2; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 calc(var(--pico-block-spacing-horizontal) * -1); }
.table-wrap:last-child { margin-bottom: calc(var(--pico-block-spacing-vertical) * -1); }
.table-wrap table { margin: 0; }
th, td { background-color: transparent; font-size: .9rem; }
thead th { background: var(--bh-surface-2); color: var(--bh-muted); font-size: .72rem; font-weight: 650; letter-spacing: .07em;
  text-transform: uppercase; }
.table-wrap :is(th, td):first-child { padding-left: var(--pico-block-spacing-horizontal); }
.table-wrap :is(th, td):last-child { padding-right: var(--pico-block-spacing-horizontal); }
tbody tr { transition: background-color .15s; }
tbody tr:hover { background: var(--bh-hover); }
tr:last-child td { border-bottom: 0; }
td small.error { display: block; margin-top: .25rem; font-size: .8rem; }
.row-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem; }

/* ---------- buttons & forms ---------- */
button, [role=button], [type=submit], button[type=submit] { width: auto; font-weight: 600; font-size: .9rem; border-radius: 10px;
  transition: transform .12s, box-shadow .2s, background-color .2s, filter .2s; }
:is(button, [role=button], [type=submit]):not(.outline, .secondary, .contrast, .icon-btn, .danger, .ghost) {
  background: var(--bh-grad); border-color: transparent; color: #fff;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--bh-primary) 28%, transparent); }
:is(button, [role=button], [type=submit]):not(.outline, .secondary, .contrast, .icon-btn, .danger, .ghost):hover { filter: brightness(1.08); }
:is(button, [role=button]):not(:disabled):hover { transform: translateY(-1px); }
:is(button, [role=button]):not(:disabled):active { transform: translateY(0) scale(.98); }
:is(button, [role=button]) .ico { margin-right: .15rem; }
.outline { background: var(--bh-surface); }
button.small, [role=button].small, .small { width: auto; margin: 0; padding: .32rem .72rem; font-size: .82rem; }
button.danger, .danger { background: transparent; border: 1px solid color-mix(in srgb, var(--bh-bad) 45%, transparent); color: var(--bh-bad); }
button.danger:hover { background: color-mix(in srgb, var(--bh-bad) 10%, transparent); border-color: var(--bh-bad); }
button.block { width: 100%; }
input:not([type=checkbox], [type=radio], [type=range]), select, textarea { font-size: .92rem; }
details summary { font-size: .9rem; }
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline-flex; align-items: center; gap: .5rem; }
.htmx-request .htmx-indicator::before, .htmx-request.htmx-indicator::before, .spinner {
  content: ""; display: inline-block; width: .9rem; height: .9rem; flex: none; border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--bh-primary) 25%, transparent); border-top-color: var(--bh-primary);
  animation: spin .75s linear infinite; }
:is(button, [role=button]).htmx-request { opacity: .75; pointer-events: none; }

/* ---------- product overview ---------- */
.bot-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(16rem, 100%), 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.bot-action { --c: var(--bh-primary); display: flex; flex-direction: column; gap: .45rem; margin: 0; padding: 1.1rem 1.2rem;
  border: 1px solid var(--bh-border); border-radius: var(--bh-radius); background: var(--bh-surface); box-shadow: var(--bh-shadow);
  transition: transform .2s, box-shadow .2s, border-color .2s; }
.bot-action:hover { transform: translateY(-3px); box-shadow: 0 14px 34px var(--bh-shadow-color);
  border-color: color-mix(in srgb, var(--c) 45%, var(--bh-border)); }
.bot-action.featured { border: 1.5px solid transparent;
  background: linear-gradient(var(--bh-surface), var(--bh-surface)) padding-box, var(--bh-grad) border-box; }
.bot-action h3 { margin: .25rem 0 0; font-size: 1rem; }
.bot-action p { flex: 1; margin: 0; color: var(--bh-muted); font-size: .85rem; }
.bot-action button { align-self: flex-start; margin-top: .35rem; }
.ico-bubble { --c: var(--bh-primary); display: grid; place-items: center; flex: none; width: 2.4rem; height: 2.4rem; border-radius: 11px;
  color: var(--c); background: color-mix(in srgb, var(--c) 13%, transparent); }
.bot-action .ico-bubble { transition: transform .3s cubic-bezier(.3, 1.6, .5, 1); }
.bot-action:hover .ico-bubble { transform: rotate(-8deg) scale(1.08); }
.ico-bubble.sm { width: 2rem; height: 2rem; border-radius: 9px; }

.live-badge { display: inline-flex; align-items: center; gap: .35rem; padding: .05rem .5rem; border-radius: 99px; font-size: .68rem;
  font-weight: 700; letter-spacing: .08em; color: var(--bh-bad); background: color-mix(in srgb, var(--bh-bad) 12%, transparent); }
.live-badge::before { content: ""; width: .42rem; height: .42rem; border-radius: 50%; background: currentColor; animation: blink 1.2s ease-in-out infinite; }

.run-card { --c: var(--bh-run); position: relative; overflow: hidden; margin-bottom: .9rem; padding: 1rem 1.1rem;
  border: 1px solid color-mix(in srgb, var(--c) 30%, var(--bh-border)); border-radius: 12px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--c) 8%, var(--bh-surface)), var(--bh-surface) 70%);
  animation: rise .4s ease backwards; }
.run-card.paused { --c: var(--bh-warn); }
.run-card::before { content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 2px;
  background: linear-gradient(90deg, transparent, var(--c), transparent); animation: scan 2s linear infinite; }
.run-top { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem .9rem; }
.run-what { flex: 1; min-width: 12rem; }
.run-top .doing { margin-top: .1rem; font-size: .92rem; }
.run-meta { color: var(--bh-muted); font-size: .8rem; }
.bot-orb { position: relative; display: grid; place-items: center; flex: none; width: 2.6rem; height: 2.6rem; border-radius: 50%;
  color: #fff; background: var(--bh-grad); }
.bot-orb::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--c);
  animation: halo 1.8s ease-out infinite; }
.bot-orb .ico { animation: bob 2.4s ease-in-out infinite; }
.dots::after { content: "..."; display: inline-block; width: 0; overflow: hidden; white-space: nowrap; vertical-align: bottom;
  animation: dots 1.4s steps(4, end) infinite; }
.stepper { display: flex; gap: .4rem; margin: 1rem 0 .2rem; padding: 0; list-style: none; }
.stepper li { position: relative; flex: 1; min-width: 0; margin: 0; padding-top: .8rem; list-style: none; font-size: .74rem;
  color: var(--bh-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stepper li::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 5px; border-radius: 99px; background: var(--bh-hover); }
.stepper li.done { color: var(--bh-text); }
.stepper li.done::before { background: var(--bh-ok); }
.stepper li.now { color: var(--c); font-weight: 650; }
.stepper li.now::before { background: linear-gradient(90deg, var(--c), color-mix(in srgb, var(--c) 30%, transparent), var(--c));
  background-size: 200% 100%; animation: flow 1.1s linear infinite; }
.run-card [role=button] { margin-top: .8rem; }
.thinking { display: inline-flex; align-items: center; gap: .55rem; margin: 0 0 .7rem; color: var(--bh-muted); font-size: .82rem; }
.idle { display: flex; align-items: center; gap: .8rem; margin-bottom: .6rem; padding: .85rem 1rem; border-radius: 12px;
  border: 1px dashed var(--bh-border); background: var(--bh-surface-2); color: var(--bh-muted); font-size: .9rem; }
.idle .ico-bubble .ico { animation: bob 3s ease-in-out infinite; }
.feed { margin: .3rem 0 0; padding: 0; list-style: none; }
.feed li { display: grid; grid-template-columns: 5.2rem minmax(0, 1fr); gap: .8rem; margin: 0; padding: .55rem 0; list-style: none;
  font-size: .88rem; border-bottom: 1px dashed var(--bh-border); }
.feed li:last-child { border-bottom: 0; }
.feed time { padding-top: .08rem; white-space: nowrap; color: var(--bh-muted); font-size: .76rem; text-align: right; font-variant-numeric: tabular-nums; }
.feed li > div { position: relative; padding-left: 1.05rem; }
.feed li > div::before { content: ""; position: absolute; left: 0; top: .5rem; width: .45rem; height: .45rem; border-radius: 50%;
  background: var(--bh-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bh-primary) 18%, transparent); }
.feed .chips { margin-top: .35rem; }
.feed li.fresh { animation: slide-in .6s cubic-bezier(.2, .8, .2, 1) backwards; }
.feed li.fresh > div::before { animation: ping 1.2s ease-out 2; }
.skeleton { height: .85rem; margin: .6rem 0; border-radius: 6px; background-size: 200% 100%;
  background-image: linear-gradient(90deg, var(--bh-hover) 25%, var(--bh-surface-2) 50%, var(--bh-hover) 75%);
  animation: shimmer 1.3s linear infinite; }
.skeleton.w40 { width: 40%; } .skeleton.w60 { width: 60%; } .skeleton.w80 { width: 80%; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); gap: .75rem; margin-bottom: .4rem; }
.stat { --c: var(--bh-text); padding: .8rem 1rem; border-radius: 12px; border: 1px solid var(--bh-border); background: var(--bh-surface-2); }
.stat b { display: block; color: var(--c); font-size: 1.65rem; font-weight: 750; letter-spacing: -.03em; line-height: 1.2;
  font-variant-numeric: tabular-nums; animation: pop .5s cubic-bezier(.3, 1.5, .5, 1) backwards; }
.stat b small { color: var(--bh-muted); font-size: .9rem; font-weight: 500; }
.stat span { color: var(--bh-muted); font-size: .78rem; }
.module { margin-bottom: .7rem; }
.module > small { display: block; margin-bottom: .3rem; color: var(--bh-muted); font-size: .72rem; font-weight: 650;
  letter-spacing: .06em; text-transform: uppercase; }
.feature-scroll { max-height: 22rem; overflow-y: auto; padding-right: .3rem; }
.list { margin: 0; padding: 0; list-style: none; }
.list li { display: flex; align-items: center; gap: .75rem; margin: 0; padding: .6rem 0; list-style: none;
  border-bottom: 1px solid var(--bh-border); }
.list li:last-child { border-bottom: 0; }
.list .meta { flex: 1; min-width: 0; line-height: 1.3; }
.list .meta strong { display: block; font-size: .9rem; font-weight: 600; }
.list .meta small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--bh-muted); font-size: .8rem; }
.list .meta small a { color: inherit; }

/* ---------- sign-in ---------- */
body.auth { position: relative; display: grid; place-items: center; min-height: 100vh; overflow-x: hidden; }
body.auth > main.content { max-width: 30rem; }
body.auth::before, body.auth::after { content: ""; position: fixed; z-index: -1; width: 42vmax; height: 42vmax; border-radius: 50%;
  filter: blur(90px); opacity: .3; animation: float 16s ease-in-out infinite alternate; }
body.auth::before { top: -16vmax; left: -12vmax; background: var(--bh-primary); }
body.auth::after { right: -12vmax; bottom: -16vmax; background: var(--bh-primary-2); animation-delay: -8s; }
.auth-card { width: min(26rem, 100%); margin: 0 auto; padding: 2.2rem 2rem; border-radius: 20px; border: 1px solid var(--bh-border);
  background: color-mix(in srgb, var(--bh-surface) 82%, transparent); backdrop-filter: blur(18px);
  box-shadow: 0 30px 80px var(--bh-shadow-color); }
.auth-card .logo { width: 3rem; height: 3rem; margin-bottom: 1.1rem; border-radius: 14px; }
.auth-card .logo .ico { width: 1.5rem; height: 1.5rem; }
.auth-card h1 { margin-bottom: .3rem; }

.report { line-height: 1.7; }
.report table { display: block; overflow-x: auto; }

/* ---------- motion ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
@keyframes fade-down { from { opacity: 0; transform: translateY(-6px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes flow { to { background-position: -200% 0; } }
@keyframes grow { from { transform: scaleX(0); } }
@keyframes pop { from { opacity: 0; transform: scale(.8); } }
@keyframes scan { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
@keyframes halo { from { transform: scale(.92); opacity: .75; } to { transform: scale(1.4); opacity: 0; } }
@keyframes bob { 50% { transform: translateY(-2px); } }
@keyframes blink { 50% { opacity: .35; } }
@keyframes dots { to { width: 1.2em; } }
@keyframes wiggle { 25% { transform: rotate(-12deg); } 75% { transform: rotate(10deg); } }
@keyframes ping { from { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 55%, transparent); } to { box-shadow: 0 0 0 7px transparent; } }
@keyframes slide-in { from { opacity: 0; transform: translateX(-10px); background: color-mix(in srgb, var(--bh-primary) 12%, transparent); } }
@keyframes toast-in { from { opacity: 0; transform: translateX(28px) scale(.97); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(28px); visibility: hidden; } }
@keyframes float { to { transform: translate(7vmax, 5vmax) scale(1.12); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* gap approval */
.gaps li { align-items: flex-start; }
.gaps .meta small { display: block; color: var(--bh-muted); }
.gaps details { margin: .3rem 0 0; }
.decide { display: flex; flex-direction: column; gap: .25rem; flex-shrink: 0; margin: 0; padding: 0; border: 0; }
.decide label { margin: 0; font-size: .85rem; white-space: nowrap; }
.review-tools { display: flex; flex-wrap: wrap; gap: .5rem; align-items: end; margin-bottom: .75rem; }
.review-tools label { margin: 0; font-size: .85rem; }
.review-tools select { margin: 0; padding-block: .3rem; }
.review-group > summary { font-weight: 600; margin-bottom: .5rem; }

/* review page: one card per finding */
.findings { margin: 0 0 1rem; padding: 0; list-style: none; display: grid; gap: .75rem; }
.finding { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .75rem 1.5rem; margin: 0; padding: 1rem 1.1rem;
  border: 1px solid var(--bh-border); border-radius: var(--bh-radius); background: var(--bh-surface-2); list-style: none; }
.finding-body { min-width: 0; display: grid; gap: .55rem; }
.finding-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .35rem .75rem; }
.finding-head strong { font-size: 1.02rem; }
.finding-head .site { font-size: .85rem; color: var(--bh-muted); }
.finding .chips small { color: var(--bh-muted); }
.finding .chip.warn { color: var(--bh-warn); }
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .3rem 1rem; margin: 0; font-size: .88rem; }
.facts dt { margin: 0; color: var(--bh-muted); font-weight: 500; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.finding .quote { margin: 0; padding: .45rem .8rem; border-left: 3px solid var(--bh-primary); background: var(--bh-surface);
  border-radius: 0 8px 8px 0; font-size: .86rem; overflow-wrap: anywhere; }
.ticket-preview { margin: 0; font-size: .86rem; }
.ticket-preview summary { color: var(--bh-primary); cursor: pointer; }
.ticket-preview p { margin: .35rem 0; }
.ticket-body { padding: .7rem .9rem; overflow-wrap: anywhere; font-size: .85rem; line-height: 1.5; max-height: 22rem;
  overflow: auto; background: var(--bh-surface); border: 1px solid var(--bh-border); border-radius: 8px; }
.finding .decide { width: auto; align-self: start; padding-left: 1.25rem; border-left: 1px solid var(--bh-border); }
@media (max-width: 760px) {
  .finding { grid-template-columns: minmax(0, 1fr); }
  .facts { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .facts dd { margin-bottom: .45rem; }
  .finding .decide { flex-direction: row; flex-wrap: wrap; gap: .4rem 1rem; padding: .6rem 0 0; border-left: 0;
    border-top: 1px solid var(--bh-border); }
}
