/* ============================================================================
   PLATFORM CHROME OVERRIDES (load after kit styles.css)
   ----------------------------------------------------------------------------
   Kit styles.css is not edited. This file restores:
   1. Dark doublemenu OUTER-RAIL selected/hover chip: kit --primary01 +
      primary icon (styles.css 20356-20367 / 18929-18932). The dark-menu
      cascade (styles.css 712-742) paints a gray wash + white icon; that
      rule is (attr+classes)+!important on the icon, so the icon override
      must carry !important. Inner-panel purple pill (18860)
      is already correct — do not restyle it here. Do not change --menu-bg.
   2. Header-to-card gutter: kit .app-content at 992+ uses
      margin-block-start: 5.25rem against a 4.25rem header (1rem body
      band). Collapse to 4.25rem globally at 992+. Kit .page is a
      column flex with justify-content:center (styles.css 9744-9748),
      so leftover footer room (min-height 100vh-7rem vs 4.25rem
      offset) is split above the card as a second body band. Pin
      .page to flex-start at 992+ so that leftover stays below the
      card. Do not change kit min-height.
   3. Scrollable modal body: kit hides vertical bars
      (styles.css body ::-webkit-scrollbar { width: 0 }). Restore a
      thin grabbable bar on .modal-dialog-scrollable .modal-body so
      overflow is visible, matching docs/chat/exec PLATFORM bars.
   4. Doublemenu inner panel height: kit reserves calc(100% - 216px)
      for an upgrade-promo card this platform does not render
      (styles.css 20437-20447, inside min-width 992px). Full height
      is kit-sanctioned for boxed width (styles.css 1878-1881). Beat
      the kit !important with the same flag. Dark doublemenu is
      untouched. Do not restyle the inner-panel purple pill here.
   5. Light + transparent doublemenu panel and bottom strip: kit
      re-points --menu-bg at lavender --default-body-bg-color
      (styles.css 1052-1054) and paints both surfaces with
      var(--menu-bg). Scope #fff to this combo only so dark and
      wallpaper [data-bg-img] paths keep their own cascade.
   ============================================================================ */

[data-menu-styles=dark][data-vertical-style=doublemenu] .app-sidebar .main-menu > .slide > .side-menu__item.active,
[data-menu-styles=dark][data-vertical-style=doublemenu] .app-sidebar .main-menu > .slide > .side-menu__item:hover {
  background-color: var(--primary01);
}
[data-menu-styles=dark][data-vertical-style=doublemenu] .app-sidebar .main-menu > .slide > .side-menu__item.active .side-menu__icon,
[data-menu-styles=dark][data-vertical-style=doublemenu] .app-sidebar .main-menu > .slide > .side-menu__item:hover .side-menu__icon {
  color: var(--primary-color) !important;
  fill: var(--primary-color) !important;
}

@media (min-width: 992px) {
  .app-content {
    margin-block-start: 4.25rem;
  }
  .page {
    justify-content: flex-start;
  }
}

.modal-dialog-scrollable .modal-body {
  scrollbar-width: thin;
  min-height: 0;
}

/* A form or pane between .modal-content and .modal-body keeps the kit
   scrollable modal from bounding the body, so the footer is clipped. */
.modal-dialog-scrollable .modal-content > :is(form, div):has(> .modal-body) {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.modal-dialog-scrollable .modal-body::-webkit-scrollbar {
  width: 0.375rem;
}

.modal-dialog-scrollable .modal-body::-webkit-scrollbar-thumb {
  background: var(--default-border);
  border-radius: 10px;
}

@media (min-width: 992px) {
  [data-vertical-style=doublemenu] .slide.has-sub .slide-menu {
    height: 100% !important;
    scroll-padding-top: var(--app-header-height);
    scroll-padding-bottom: 5rem;
    /* The kit bounds the flyout to 100% of the fixed sidebar and leaves
       overflow visible, so a long child1/child2 list runs past the window
       bottom and its last items cannot be reached. Make the flyout its own
       scroll container and keep room at the end. */
    overflow-y: auto;
    padding-bottom: 6rem;
  }

  [data-vertical-style=doublemenu] .app-sidebar .main-sidebar {
    scroll-padding-bottom: 15rem;
  }
}

/* A nested dropdown inside an open flyout must flow in place; absolutely
   positioned it escapes the flyout's scroll box. */
.slide-menu .dropdown-menu.show {
  position: static !important;
}

[data-theme-mode=light][data-menu-styles=transparent][data-vertical-style=doublemenu] .app-sidebar .slide.has-sub .slide-menu {
  background-color: #fff;
}

[data-theme-mode=light][data-menu-styles=transparent][data-vertical-style=doublemenu] .app-sidebar .doublemenu_bottom-menu.main-menu {
  background-color: #fff;
}

/* KAN-175 A1: skip link is visually hidden until focused, then pinned above chrome. */
.skip-link.visually-hidden-focusable:focus,
.skip-link.visually-hidden-focusable:focus-visible {
  position: fixed;
  z-index: 11050;
  top: 0.5rem;
  left: 0.5rem;
  width: auto;
  height: auto;
  padding: 0.5rem 0.75rem;
  overflow: visible;
  clip: auto;
  white-space: nowrap;
  background-color: var(--custom-white);
  color: var(--default-text-color);
  border: 1px solid var(--default-border);
  border-radius: 0.25rem;
}

/* KAN-176 A2: kit :focus-visible { outline: none } and a, button { outline: 0 !important }. */
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
.header-link:focus-visible,
.side-menu__item:focus-visible {
  outline: 2px solid var(--focus-ring-color, var(--primary-color)) !important;
  outline-offset: 2px;
}

/* Form fields: kit uses a blurry outset bloom (0 2px 6px primary03) and
   Bootstrap adds a 0.25rem ring on invalid:focus — both paint over adjacent
   borders (e.g. input-group Show). Soft primary border + thin inset ring
   stays noticeable without covering neighbors. */
.form-control:focus,
.form-control:focus-visible,
.form-select:focus,
.form-select:focus-visible {
  border-color: color-mix(in srgb, var(--primary-color) 65%, var(--input-border, var(--default-border)));
  box-shadow: inset 0 0 0 1px rgba(var(--primary-rgb), 0.4);
  outline: 0;
}

.form-control.is-invalid,
.was-validated .form-control:invalid,
.form-select.is-invalid,
.was-validated .form-select:invalid {
  border-color: color-mix(in srgb, var(--bs-form-invalid-border-color, #dc3545) 75%, var(--input-border, var(--default-border)));
  box-shadow: none;
}

.form-control.is-invalid:focus,
.form-control.is-invalid:focus-visible,
.was-validated .form-control:invalid:focus,
.was-validated .form-control:invalid:focus-visible,
.form-select.is-invalid:focus,
.form-select.is-invalid:focus-visible,
.was-validated .form-select:invalid:focus,
.was-validated .form-select:invalid:focus-visible {
  border-color: color-mix(in srgb, var(--bs-form-invalid-border-color, #dc3545) 85%, var(--input-border, var(--default-border)));
  box-shadow: inset 0 0 0 1px rgba(var(--bs-danger-rgb, 220, 53, 69), 0.35);
  outline: 0;
}

/* Input-group: keep the shared edge with sibling addons (Show, etc.).
   Focus is signaled by the inset ring only — no colored border takeover. */
.input-group > .form-control:focus,
.input-group > .form-control:focus-visible,
.input-group > .form-select:focus,
.input-group > .form-select:focus-visible {
  border-color: var(--input-border, var(--default-border));
  box-shadow: inset 0 0 0 1px rgba(var(--primary-rgb), 0.55);
  z-index: 3;
}

.input-group > .form-control.is-invalid:focus,
.input-group > .form-control.is-invalid:focus-visible {
  border-color: var(--input-border, var(--default-border));
  box-shadow: inset 0 0 0 1px rgba(var(--bs-danger-rgb, 220, 53, 69), 0.45);
}

/* KAN-190 A16: action voids became <button>; keep kit chrome, drop native button paint. */
/* Header sidebar toggle only (sidebar no longer has its own collapse control).
   Open → fold icon; collapsed (oa-sidebar-collapsed) → unfold icon. */
.app-header .sidemenu-toggle.animated-arrow span,
.app-header .sidemenu-toggle.animated-arrow span::before,
.app-header .sidemenu-toggle.animated-arrow span::after {
  display: none !important;
  background: none !important;
  box-shadow: none !important;
}
.app-header .sidemenu-toggle.animated-arrow::before {
  font-family: remixicon !important;
  content: "\ef3d"; /* ri-menu-fold-line — menu is open */
  font-size: 1.25rem;
  line-height: 1;
  color: var(--header-icon-color);
}
/* Icon follows oa-sidebar-collapsed only. data-toggled=double-menu-close is the
   kit's permanent doublemenu seed, not live open/closed — using it here stuck
   the desktop (side-by-side) toggle on unfold even while the panel was open. */
html.oa-sidebar-collapsed .app-header .sidemenu-toggle.animated-arrow::before {
  content: "\ef40"; /* ri-menu-unfold-line — menu is closed */
}

button.header-link,
button.sidemenu-toggle {
  appearance: none;
  background: transparent;
  border: 0;
  color: inherit;
  font: inherit;
  line-height: inherit;
  cursor: pointer;
}
button.side-menu__item {
  appearance: none;
  background: transparent;
  border: 0;
  color: inherit;
  font: inherit;
  line-height: inherit;
  width: 100%;
  text-align: inherit;
  cursor: pointer;
}
.side-menu__label1 > span {
  color: var(--primary-color);
  font-weight: 500;
}

/* KAN-178 A4: icon-only shortcuts is btn-sm without btn-icon; keep a 24px target. */
#open-shortcuts-help-btn {
  min-width: 24px;
  min-height: 24px;
}

button.palette-item {
  appearance: none;
  background: transparent;
  border: 0;
  color: inherit;
  font: inherit;
  text-align: inherit;
  width: 100%;
  cursor: grab;
}

:root {
  --input-border: #8a93a3;
  --app-header-height: 4.25rem;
  --builder-chrome-sticky-offset: 0px;
}

html {
  scroll-padding-top: var(--app-header-height);
}

.main-sidebar {
  scroll-padding-top: 0.5rem;
  scroll-padding-bottom: 5rem;
}

[data-theme-mode="dark"] {
  --input-border: #6b7380;
  --header-prime-color: rgba(255, 255, 255, 0.75);
  --menu-icon-color: rgba(255, 255, 255, 0.8);
  --focus-ring-color: color-mix(in srgb, rgb(var(--primary-rgb)) 50%, #fff);
}

[data-theme-mode="dark"] .modal .ts-dropdown {
  background-color: #1e2024;
  border-color: #3d4350;
  color: #c8ccd4;
}

@media (prefers-reduced-motion: reduce) {
  #loader,
  .offcanvas,
  .settings-panel,
  .toast {
    animation: none !important;
    transition: none !important;
  }
}

@media (max-width: 320px) {
  .row-cols-2 > * {
    flex: 0 0 100%;
    width: 100%;
    max-width: 100%;
  }
}

/* KAN-247: authenticator enrolment — QR stays black-on-white in every theme.
   Quiet zone lives on .totp-qr-pad so dark chrome cannot invert the modules. */
.totp-qr-pad {
  width: 13.5rem;
  padding: 0.75rem;
  background: #fff;
  border-radius: 0.5rem;
}

.totp-qr {
  width: 12rem;
  height: 12rem;
}

.totp-qr img,
.totp-qr canvas,
.totp-qr svg {
  display: block;
  width: 12rem;
  height: 12rem;
}

.totp-code-input {
  font-family: var(--font-family-monospace, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);
  font-size: 1.5rem;
  letter-spacing: 0.4em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* Theme toggle lives in the navbar (before fullscreen / account / settings).
   Kit hides .header-theme-mode under doublemenu (styles.css:20249) because the
   moon used to sit in .doublemenu_bottom-menu — keep it visible in the header.
   Use flex (same as .header-element) — list-item paints a disc marker ("dot")
   beside the moon. */
[data-vertical-style=doublemenu] .app-header .header-theme-mode {
  display: flex !important;
  list-style: none;
}

/* Keep moon/sun upright — never inherit spin/rotate from kit animations. */
.app-header .header-theme-mode .header-link-icon,
.app-header .header-theme-mode .header-link {
  transform: none !important;
  animation: none !important;
}

/* Kit spins .switcher-icon forever (styles.css:15856). Kill spin on the
   trigger icon only — never on .dropdown-menu (Popper needs transform). */
.switcher-icon svg,
.switcher-icon i,
.app-header .header-theme-primary > .header-link,
.app-header .header-theme-primary > .header-link .header-link-icon {
  animation: none !important;
  animation-name: none !important;
  transform: none !important;
}

.app-header .header-theme-primary .dropdown-toggle::after {
  content: none;
}

/* The circle is the button. Kit padding (1rem 0.5rem) made a tall rectangle
   around the icon, so clicks landed outside the disc and the corners of
   that rectangle were dead space. Fixed size + border-radius clips the hit
   target to the circle; children do not take their own hits. */
.app-header .header-content-right > .header-element:not(.header-search) {
  align-items: center;
}

/* The responsive search circle only appears once the viewport is narrow
   (zoom or a small window). d-block used to force display:block, which
   dropped it off the shared vertical center of the other circles. */
.app-header .header-content-right > .header-element.d-md-none {
  display: flex;
  align-items: center;
}

.app-header .header-content-right > .header-element:not(.header-search) .header-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  flex: 0 0 auto;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0 !important;
  margin-inline: 0.375rem;
  border: 0 !important;
  border-radius: 50%;
  background-color: var(--custom-white);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--avatar-ring, #111111) 55%, transparent);
  box-sizing: border-box;
  overflow: visible;
  touch-action: manipulation;
  transition: background-color 80ms ease, box-shadow 80ms ease;
}

.app-header .header-content-right > .header-element:not(.header-search) .header-link:hover,
.app-header .header-content-right > .header-element:not(.header-search) .header-link.show {
  box-shadow: 0 0 0 2px var(--primary-color);
}

.app-header .header-content-right > .header-element:not(.header-search) .header-link:active {
  background-color: color-mix(in srgb, var(--primary-color) 16%, var(--custom-white));
}

.app-header .header-content-right > .header-element:not(.header-search) .header-link * {
  pointer-events: none;
}

/* Header icon circles: box-shadow ring (not border) — CSS borders on
   border-radius:50% alias hard at 100% zoom; shadows AA cleanly.
   The ring lives on the button; the icon only draws the glyph. */
.app-header .header-content-right > .header-element:not(.header-search) .header-link-icon {
  width: 2.25rem;
  height: 2.25rem;
  padding: 6px;
  border-radius: 50%;
  border: 0 !important;
  background-color: transparent;
  box-sizing: border-box;
  box-shadow: none;
  -webkit-font-smoothing: antialiased;
  overflow: visible;
  shape-rendering: geometricPrecision;
}

/* Filled palette glyph reaches the SVG viewBox edges — inset so the circular
   chrome does not clip the top/bottom of the icon. */
.app-header .header-theme-primary > .header-link .header-link-icon {
  padding: 7px;
}

/* Compact color-palette panel — same chrome footprint as profile dropdown. */
.header-theme-primary-dropdown {
  min-width: 16rem;
  max-width: 18rem;
  padding-block: 0;
  z-index: 1080;
}

.header-theme-primary-dropdown .theme-primary-section-label {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.header-theme-primary-dropdown .theme-primary-swatches {
  padding: 0 !important;
}

.header-theme-primary-dropdown .form-check.switch-select {
  padding-inline-start: 0;
  margin: 0;
  min-height: 0;
}

/* Base + custom swatches: same size, no stroke. */
.header-theme-primary-dropdown .color-input,
.header-theme-primary-dropdown .pickr-container-primary .pickr .pcr-button {
  width: 1.875rem;
  height: 1.875rem;
  margin: 0;
  border: 0 !important;
  border-radius: 50%;
  box-shadow: none !important;
  outline: none;
  cursor: pointer;
}

/* Custom swatch: solid current primary under the palette glyph.
   Pickr's ::before is a transparency checkerboard and ::after normally
   shows --pcr-color — we replace ::after with a Phosphor mask, so without
   this the button looks empty/transparent. Soft ring keeps dark primaries
   visible on the dark dropdown surface. */
.header-theme-primary-dropdown .pickr-container-primary .pickr .pcr-button {
  background-color: var(--pcr-color, rgb(var(--primary-rgb))) !important;
  background-image: none !important;
  box-shadow: 0 0 0 1px color-mix(in srgb, #fff 28%, transparent) !important;
}

.header-theme-primary-dropdown .color-input.color-primary-1 {
  background-color: rgb(42, 16, 164);
}

.header-theme-primary-dropdown .color-input.color-primary-2 {
  background-color: rgb(125, 0, 189);
}

.header-theme-primary-dropdown .color-input.color-primary-3 {
  background-color: rgb(4, 118, 141);
}

.header-theme-primary-dropdown .color-input.color-primary-4 {
  background-color: rgb(138, 0, 32);
}

.header-theme-primary-dropdown .color-input.color-primary-5 {
  background-color: rgb(9, 124, 103);
}

.header-theme-primary-dropdown .color-input.form-check-input:checked[type=radio] {
  background-image: none;
  border: 0 !important;
}

.header-theme-primary-dropdown .pickr-container-primary .pickr .pcr-button {
  position: relative;
  overflow: hidden;
}

.header-theme-primary-dropdown .pickr-container-primary .pickr .pcr-button::before {
  border: 0 !important;
  box-shadow: none !important;
  /* Kill Pickr's transparency checkerboard — color comes from the button bg. */
  background: none !important;
  background-image: none !important;
  opacity: 0 !important;
}

/* Kit paints a remixicon glyph here (styles.css) — font icons stair-step at
   ~30px. Mask the official Phosphor palette instead. */
.header-theme-primary-dropdown .pickr-container-primary .pickr .pcr-button::after {
  content: "" !important;
  font-family: none !important;
  font-size: 0 !important;
  line-height: 0 !important;
  color: transparent !important;
  position: absolute;
  inset: 0;
  background-color: rgba(255, 255, 255, 0.92);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath fill='black' d='M200.77,53.89A103.27,103.27,0,0,0,128,24h-1.07A104,104,0,0,0,24,128c0,43,26.58,79.06,69.36,94.17A32,32,0,0,0,136,192a16,16,0,0,1,16-16h46.21a31.81,31.81,0,0,0,31.2-24.88,104.43,104.43,0,0,0,2.59-24A103.28,103.28,0,0,0,200.77,53.89Zm13,93.71A15.89,15.89,0,0,1,198.21,160H152a32,32,0,0,0-32,32,16,16,0,0,1-21.31,15.07C62.49,194.3,40,164,40,128a88,88,0,0,1,87.09-88h.9a88.35,88.35,0,0,1,88,87.25A88.86,88.86,0,0,1,213.81,147.6ZM140,76a12,12,0,1,1-12-12A12,12,0,0,1,140,76ZM96,100A12,12,0,1,1,84,88,12,12,0,0,1,96,100Zm0,56a12,12,0,1,1-12-12A12,12,0,0,1,96,156Zm88-56a12,12,0,1,1-12-12A12,12,0,0,1,184,100Z'/%3E%3C/svg%3E") center / 62% 62% no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cpath fill='black' d='M200.77,53.89A103.27,103.27,0,0,0,128,24h-1.07A104,104,0,0,0,24,128c0,43,26.58,79.06,69.36,94.17A32,32,0,0,0,136,192a16,16,0,0,1,16-16h46.21a31.81,31.81,0,0,0,31.2-24.88,104.43,104.43,0,0,0,2.59-24A103.28,103.28,0,0,0,200.77,53.89Zm13,93.71A15.89,15.89,0,0,1,198.21,160H152a32,32,0,0,0-32,32,16,16,0,0,1-21.31,15.07C62.49,194.3,40,164,40,128a88,88,0,0,1,87.09-88h.9a88.35,88.35,0,0,1,88,87.25A88.86,88.86,0,0,1,213.81,147.6ZM140,76a12,12,0,1,1-12-12A12,12,0,0,1,140,76ZM96,100A12,12,0,1,1,84,88,12,12,0,0,1,96,100Zm0,56a12,12,0,1,1-12-12A12,12,0,0,1,96,156Zm88-56a12,12,0,1,1-12-12A12,12,0,0,1,184,100Z'/%3E%3C/svg%3E") center / 62% 62% no-repeat;
}

/* Profile avatar: same 2.25rem circle as sun/palette/bell. Fill edge-to-edge
   (no padding / background-clip gap). Ring is the shared outset box-shadow.
   Solid discs use a full-bleed SVG (crisp at small sizes / high DPR). */
.app-header .header-content-right {
  padding-inline-end: 0.625rem;
}

.app-header .header-content-right > .header-element:not(.header-search) .header-link:has(.header-profile-avatar) {
  z-index: 3;
  overflow: hidden;
}

.app-header .header-content-right > .header-element:not(.header-search) .header-link:has(.avatar--solid) {
  background-color: var(--avatar-solid);
}

.app-header .header-content-right > .header-element:not(.header-search) .header-link:has(.avatar--solid) .avatar-solid-disc {
  display: block;
  width: 100%;
  height: 100%;
  shape-rendering: geometricPrecision;
}

.app-header .header-content-right > .header-element:not(.header-search) .header-link:has(.header-profile-avatar) .header-profile-avatar {
  box-shadow: none;
  width: 100%;
  height: 100%;
  margin: 0;
}

.app-header .header-content-right > .header-element:not(.header-search) .header-link > div {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  overflow: hidden;
}

/* Account cluster. Kit hides .doublemenu_bottom-menu (styles.css:21763)
   except doublemenu at min-width 992px (styles.css:20258-20264) and forces
   display:none on horizontal (styles.css:20849-20851). Same list, other layouts.
   Opaque strip uses the kit token var(--menu-bg) from styles.css:20262. */

html:not([data-vertical-style=doublemenu]):not([data-nav-layout=horizontal]) .app-sidebar .main-sidebar {
  padding-block-end: 12rem;
  scroll-padding-bottom: 12rem;
}

html:not([data-vertical-style=doublemenu]):not([data-nav-layout=horizontal]) .app-sidebar .simplebar-content-wrapper {
  scroll-padding-bottom: 12rem;
}

html:not([data-vertical-style=doublemenu]):not([data-nav-layout=horizontal]) .app-sidebar .main-menu-container > .main-menu:not(.doublemenu_bottom-menu) {
  margin-block-end: 12rem;
}

html:not([data-vertical-style=doublemenu]):not([data-nav-layout=horizontal]) .app-sidebar .doublemenu_bottom-menu.main-menu {
  display: block !important;
  position: fixed;
  bottom: 0;
  inset-inline-start: 0;
  z-index: 2;
  width: 16rem;
  padding-block: 0.5rem;
  background-color: var(--menu-bg);
}

@media (min-width: 992px) {
  html[data-vertical-style=overlay][data-toggled=icon-overlay-close]:not([data-icon-overlay=open]) .app-sidebar .doublemenu_bottom-menu.main-menu {
    width: 5rem;
  }

  html[data-vertical-style=icontext][data-toggled=icon-text-close]:not([data-icon-text=open]) .app-sidebar .doublemenu_bottom-menu.main-menu {
    width: 9rem;
  }

  html[data-vertical-style=detached]:not([data-nav-layout=horizontal]) .app-sidebar .doublemenu_bottom-menu.main-menu {
    bottom: 1.5rem;
    inset-inline-start: auto;
  }

  html[data-vertical-style=detached][data-toggled=detached-close]:not([data-icon-overlay=open]) .app-sidebar .doublemenu_bottom-menu.main-menu {
    width: 5rem;
  }

  html[data-nav-style=menu-click][data-toggled=menu-click-closed]:not([data-nav-layout=horizontal]) .app-sidebar .doublemenu_bottom-menu.main-menu {
    width: 9.5rem;
  }

  html[data-nav-style=menu-hover][data-toggled=menu-hover-closed]:not([data-nav-layout=horizontal]) .app-sidebar .doublemenu_bottom-menu.main-menu {
    width: 9.5rem;
  }

  html[data-nav-style=icon-click][data-toggled=icon-click-closed]:not([data-nav-layout=horizontal]) .app-sidebar .doublemenu_bottom-menu.main-menu {
    width: 5rem;
  }

  html[data-nav-style=icon-hover][data-toggled=icon-hover-closed]:not([data-nav-layout=horizontal]) .app-sidebar .doublemenu_bottom-menu.main-menu {
    width: 5rem;
  }
}

[data-nav-layout=horizontal] .app-sidebar .doublemenu_bottom-menu.main-menu {
  display: flex !important;
  position: absolute;
  bottom: 0;
  inset-inline-end: 0;
  inset-inline-start: auto;
  z-index: 2;
  width: auto;
  padding-block: 0.25rem;
  background-color: var(--menu-bg);
}

[data-nav-layout=horizontal] .app-sidebar .doublemenu_bottom-menu.main-menu .side-menu__item {
  width: auto;
}

/* ============================================================================
   Agent Builder settings card (KAN-315 / KAN-316)
   ----------------------------------------------------------------------------
   The kit has no component for these two card details, so the exact geometry
   from the tickets lives here (kit styles.css is not edited).

   1. Note card footer (KAN-315): the shared footer Delete control is an
      icon-only .btn-icon.btn-outline-danger. On a Note it becomes the labeled
      "Delete note" control: height 2.125rem, white, border #F6C9C4, text
      #C2382B.
   2. MCP no-config banner (KAN-316): .mcp-no-config-banner scopes the amber
      dot, border rgba(253,175,34,0.5), background rgba(253,175,34,0.08) and
      the "Connect one" link (weight 600, #6B33D6, underlined, offset 2px).
      Every other createSettingsAlert() consumer (e.g. the Agent empty
      catalog) keeps the kit default .alert-warning.
   ============================================================================ */

.settings-footer-delete--note {
  height: 2.125rem;
  padding: 0 0.75rem;
  background-color: #fff;
  border: 1px solid #F6C9C4;
  color: #C2382B;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
}

.settings-footer-delete--note:hover,
.settings-footer-delete--note:focus,
.settings-footer-delete--note:active {
  background-color: #FEF3F1;
  border-color: #F6C9C4;
  color: #C2382B;
}

.alert.mcp-no-config-banner {
  background-color: rgba(253, 175, 34, 0.08);
  border-color: rgba(253, 175, 34, 0.5);
  color: var(--default-text-color, #011a42);
}

.mcp-no-config-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #FDAF22;
  flex-shrink: 0;
  display: inline-block;
}

.mcp-no-config-banner .mcp-no-config-link {
  font-weight: 600;
  color: #6B33D6;
  text-decoration: underline;
  text-underline-offset: 2px;
}

[data-theme-mode="dark"] .alert.mcp-no-config-banner {
  color: var(--default-text-color, rgba(255, 255, 255, 0.8));
}

[data-theme-mode="dark"] .mcp-no-config-banner .mcp-no-config-link {
  color: #C9B8FF;
}

/* ============================================================================
   Agent Builder settings card — KAN-311 / KAN-322 contrast details
   ----------------------------------------------------------------------------
   The kit styles.css is not edited. These scoped rules sit after it.

   1. KAN-311 — the "Turn on history in the Start node first" line on the
      settings card (ui/forms/common.js:338 renders it as
      .text-warning.fs-11.mb-3.mt-n2). The ticket specifies #B07A00; the kit
      .text-warning (#fdaf22) is only 1.85:1 on the white card. Dark keeps the
      kit amber, which already passes on the dark surface (7.98:1).
   2. KAN-322 — the Output mode segmented control on the Transform card
      (features/transform.js: role="radiogroup" / aria-label="Output mode").
      Ticket colours: track #F2F4F5, idle #5D6576, hover #011A42, selected
      white / #011A42. The kit .btn-outline-secondary default
      (--secondary-rgb #ff49cd) is 2.96:1 idle and selected in both themes;
      dark reuses the kit dark surfaces so the control stays dark-native.
   ============================================================================ */

/* 1. KAN-311 — history hint on the settings card */
#settings-panel .text-warning.mb-3.mt-n2 {
  color: #B07A00 !important;
}

[data-theme-mode="dark"] #settings-panel .text-warning.mb-3.mt-n2 {
  color: rgb(var(--warning-rgb)) !important;
}

/* Agent option sections. The four items share one accordion; a gap and a
   radius on each item is what separates them. Scoped to this accordion so
   other node panels keep their own layout. overflow stays visible so the
   provider, model, and API-key menus are not clipped. */
#settings-panel #agentSettingsAccordion {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
#settings-panel #agentSettingsAccordion > .accordion-item {
  border: 1px solid var(--default-border);
  border-radius: 0.35rem;
  background-color: var(--custom-white);
}
#settings-panel #agentSettingsAccordion > .accordion-item > .accordion-header .accordion-button {
  border-radius: 0.35rem;
}
#settings-panel #agentSettingsAccordion > .accordion-item > .accordion-header .accordion-button:not(.collapsed) {
  border-radius: 0.35rem 0.35rem 0 0;
}
[data-theme-mode="dark"] #settings-panel #agentSettingsAccordion > .accordion-item,
[data-theme-mode="dark"] #settings-panel #agentSettingsAccordion > .accordion-item > .accordion-header .accordion-button {
  background-color: var(--custom-white);
  color: var(--default-text-color);
  border-color: var(--default-border);
}
[data-theme-mode="dark"] #settings-panel #agentSettingsAccordion > .accordion-item > .accordion-header .accordion-button:not(.collapsed) {
  background-color: var(--default-background);
  color: var(--default-text-color);
}

/* 2. KAN-322 — Output mode segmented control (ticket colours) */
#settings-panel [aria-label="Output mode"] {
  --transform-mode-track: #F2F4F5;
  --transform-mode-idle: #5D6576;
  --transform-mode-hover: #011A42;
  --transform-mode-selected-bg: #fff;
  --transform-mode-selected-fg: #011A42;
  background-color: var(--transform-mode-track);
  border-radius: 0.4rem;
  padding: 0.1875rem;
}

[data-theme-mode="dark"] #settings-panel [aria-label="Output mode"] {
  --transform-mode-track: #1e2024;
  --transform-mode-idle: #c8ccd4;
  --transform-mode-hover: #fff;
  --transform-mode-selected-bg: #3d4350;
  --transform-mode-selected-fg: #fff;
}

#settings-panel [aria-label="Output mode"] .btn {
  height: 1.875rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background-color: transparent !important;
  color: var(--transform-mode-idle) !important;
  box-shadow: none;
}

#settings-panel [aria-label="Output mode"] .btn:hover,
#settings-panel [aria-label="Output mode"] .btn:focus,
#settings-panel [aria-label="Output mode"] .btn:active {
  color: var(--transform-mode-hover) !important;
  background-color: transparent !important;
  border-color: transparent !important;
  box-shadow: none;
}

#settings-panel [aria-label="Output mode"] .btn-check:checked + .btn,
#settings-panel [aria-label="Output mode"] .btn-check:active + .btn {
  background-color: var(--transform-mode-selected-bg) !important;
  color: var(--transform-mode-selected-fg) !important;
  border-color: transparent !important;
  font-weight: 600;
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.08) !important;
}

/* ============================================================================
   APP SHELL FLAT SIDEBAR (KAN-289)
   ----------------------------------------------------------------------------
   The ticket mockup (evidence/_ticket_html/KAN-289/Dashboard.dc.html) draws one
   panel: `grid-template-columns: 15rem minmax(0,1fr)`, a single
   `<aside class="side">` with `padding: 1rem 0.75rem`, `gap: 1.25rem` and flat
   `.nv` rows. The component is Ivelin's org-shell sidebar from PR #17
   (templates/org_admin/partials/org_shell_sidebar.html +
   static/assets/css/theme-org-admin-overrides.css), which already ships these
   `.oa-*` class names, the `.oa-org-mark` 135deg gradient and `.oa-nav__link`
   rows — so the markup below reuses that kit rather than inventing one.

   What the kit paints instead, and what made the shell read as two menus, is
   the doublemenu rail:
     styles.css:20371  [data-vertical-style=doublemenu] .app-sidebar { width: 4rem }
     styles.css:20431  [data-vertical-style=doublemenu] .app-header { padding-inline-start: 18rem }
     styles.css:20435  [data-vertical-style=doublemenu] .app-content { margin-inline-start: 18rem }
     styles.css:20436  [data-vertical-style=doublemenu] .slide.has-sub .slide-menu {
                         position: absolute !important; inset-inline-start: 4rem !important }
   plus markup that wrapped the entire menu in `li.slide.has-sub > ul.slide-menu
   .child1` (templates/components/layouts/main-sidebar.html at 2530d4757). The
   menu is now a flat nav with no child1, so nothing can fly out; the rail width
   and the 18rem offsets are answered here for the app shell only. styles.css is
   not edited.
   ============================================================================ */

:root {
  --oa-text: #011A42;
  --oa-muted: #5D6576;
  --oa-border: #E2E8EE;
  --oa-icon: #6C7E96;
  --oa-row-hover: #F5F6F7;
  --oa-accent: #985FFD;
  --oa-accent-soft: rgba(152, 95, 253, 0.1);
  --oa-accent-soft-12: rgba(152, 95, 253, 0.12);
  --oa-sidebar-width: 15rem;
}

[data-theme-mode=dark] {
  --oa-text: #e8eef7;
  --oa-muted: #9aa6b8;
  --oa-border: #2a3441;
  --oa-icon: #9aa6b8;
  --oa-row-hover: #1d2530;
}

@media (min-width: 992px) {
  /* one 15rem panel in every toggled state — never the 4rem rail */
  html[data-vertical-style=doublemenu] .app-sidebar {
    width: var(--oa-sidebar-width) !important;
  }

  html[data-vertical-style=doublemenu] .app-content,
  html[data-vertical-style=doublemenu][data-toggled=double-menu-close] .app-content {
    margin-inline-start: var(--oa-sidebar-width) !important;
  }

  html[data-vertical-style=doublemenu] .app-header,
  html[data-vertical-style=doublemenu][data-toggled=double-menu-close] .app-header {
    padding-inline-start: var(--oa-sidebar-width) !important;
  }

  /* Collapsing hides the panel, so the content and the header must reclaim the
     gutter. Overriding those two declarations directly does NOT work: the
     offset rules above are grouped with a ``[data-toggled=double-menu-close]``
     twin, and both the server and the builder leave that attribute on
     ``<html>``, so that twin outscores any fresh ``html.oa-sidebar-collapsed
     ...`` selector and keeps its ``!important`` win — the panel disappeared
     while its 15rem gutter stayed behind. Zeroing the token those offsets are
     built from sidesteps the specificity fight entirely. */
  html.oa-sidebar-collapsed {
    --oa-sidebar-width: 0rem;
  }

  /* Dashboard header keeps the toggle as ``d-lg-none``; reveal it on desktop
     once the panel is collapsed so the menu can be reopened. */
  html.oa-sidebar-collapsed .app-header .header-element.d-lg-none:has(.sidemenu-toggle) {
    display: block !important;
  }
}

/* Hide for every viewport (not only ≥992). The panel is pinned with
   ``#sidebar.oa-sidebar``, so an id-less ``.app-sidebar`` selector loses the
   ``display`` fight and the panel stayed visible over content. */
html.oa-sidebar-collapsed #sidebar.oa-sidebar {
  display: none;
}

/* Overlaying open panel (<992): keep the kit dim layer visible so outside
   clicks hit #responsive-overlay (z-index 101 under #sidebar at 103). Desktop
   push layout leaves the overlay inactive via syncOverlay(). */
@media (max-width: 991.98px) {
  html:not(.oa-sidebar-collapsed) #responsive-overlay.active {
    visibility: visible;
  }
}

/* --- the panel (Ivelin's .oa-sidebar, pinned into the kit's sidebar box) --- */
#sidebar.oa-sidebar {
  position: fixed;
  inset-block-start: 0;
  inset-inline-start: 0;
  z-index: 103;
  box-sizing: border-box;
  width: var(--oa-sidebar-width);
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1rem 0.75rem;
  background: #fff;
  border-inline-end: 1px solid var(--oa-border);
  overflow-y: auto;
  color: var(--oa-text);
}

[data-theme-mode=dark] #sidebar.oa-sidebar {
  background: #151b24;
}

/* The custom-menu-background veil. `[data-bg-img] .app-sidebar:before`
   (theme-menu-bg-overrides.css:48,67,72) lays a 0.6 black wash over the whole
   panel; it exists to dim a menu *image*, which this panel never paints (the
   `background: #fff` above already drops `--menu-bg`). Left alone it dims the
   white panel to #666 in light mode, so the shell reads grey instead of the
   KAN-289 white. Nothing to dim here — neutralise it for this panel only. */
[data-bg-img] #sidebar.oa-sidebar:before {
  background-color: transparent;
  background-image: none;
}

#sidebar.oa-sidebar :is(a, button):focus-visible {
  outline: 2px solid var(--oa-accent);
  outline-offset: 2px;
}

/* --- brand ---------------------------------------------------------------- */
/* Scoped to #sidebar. Org-admin reuses these class names on its own aside,
   which has no id="sidebar", and must keep the stacked shell. */
#sidebar.oa-sidebar .oa-sidebar__brand {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0.25rem 0.5rem;
}

#sidebar.oa-sidebar .oa-sidebar__wordmark {
  display: inline-flex;
  align-items: center;
  line-height: 0;
  text-decoration: none;
}

#sidebar.oa-sidebar .oa-sidebar__logo {
  display: block;
  height: 2.25rem;
  width: auto;
}

#sidebar.oa-sidebar .oa-sidebar__logo--dark {
  display: none;
}

[data-theme-mode=dark] #sidebar.oa-sidebar .oa-sidebar__logo--light {
  display: none;
}

[data-theme-mode=dark] #sidebar.oa-sidebar .oa-sidebar__logo--dark {
  display: block;
}

/* --- organization --------------------------------------------------------- */
#sidebar.oa-sidebar .oa-sidebar__org {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--oa-border);
  border-radius: 0.3rem;
  background: #fff;
  color: var(--oa-text);
  font-family: inherit;
  text-align: left;
}

[data-theme-mode=dark] #sidebar.oa-sidebar .oa-sidebar__org {
  background: #151b24;
}

#sidebar.oa-sidebar .oa-org-mark {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 0.3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: linear-gradient(to bottom right, #985FFD 0%, #FF49CD 100%);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  overflow: hidden;
  position: relative;
  isolation: isolate;
}

#sidebar.oa-sidebar .oa-org-mark__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: cover;
  display: block;
}

#sidebar.oa-sidebar .oa-org-mark:has(.oa-org-mark__img.is-loaded) {
  background: transparent;
}

#sidebar.oa-sidebar .oa-org-mark__letter {
  position: relative;
  z-index: 0;
}

#sidebar.oa-sidebar .oa-sidebar__org-meta {
  flex-grow: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

#sidebar.oa-sidebar .oa-sidebar__org-name {
  font-size: 0.8125rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#sidebar.oa-sidebar .oa-sidebar__org-label {
  font-size: 0.6875rem;
  color: var(--oa-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- flat nav (KAN-289 .nv) ----------------------------------------------- */
#sidebar.oa-sidebar .oa-nav {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

#sidebar.oa-sidebar .oa-nav__link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  height: 2.5rem;
  padding: 0 0.75rem;
  border: 0;
  border-radius: 0.3rem;
  background: transparent;
  color: var(--oa-text);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 400;
  text-align: left;
  text-decoration: none;
}

#sidebar.oa-sidebar .oa-nav__link:hover {
  background: var(--oa-row-hover);
  color: var(--oa-text);
}

#sidebar.oa-sidebar .oa-nav__link.is-active {
  background: var(--oa-accent-soft);
  color: var(--oa-text);
  font-weight: 600;
}

#sidebar.oa-sidebar .oa-nav__icon {
  width: 1.125rem;
  height: 1.125rem;
  flex-shrink: 0;
  font-size: 1.125rem;
  line-height: 1;
  color: var(--oa-icon);
  display: inline-block;
  overflow: visible;
  shape-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
}

#sidebar.oa-sidebar svg.oa-nav__icon {
  fill: none;
  flex-shrink: 0;
}

#sidebar.oa-sidebar .oa-nav__link.is-active .oa-nav__icon {
  color: var(--oa-accent);
}

#sidebar.oa-sidebar .oa-nav__count {
  margin-inline-start: auto;
  flex-shrink: 0;
  color: var(--oa-muted);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

#sidebar.oa-sidebar .oa-nav__angle {
  margin-inline-start: auto;
  flex-shrink: 0;
  color: var(--oa-icon);
}

#sidebar.oa-sidebar .oa-nav__link[aria-expanded=true] .oa-nav__angle,
#sidebar.oa-sidebar .oa-nav__link.is-active .oa-nav__angle {
  transform: rotate(90deg);
}

/* Organization admin / Admin Panel children stay inside the same panel */
#sidebar.oa-sidebar .oa-nav__sublist {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

#sidebar.oa-sidebar .oa-nav__sublist .oa-nav__link {
  padding-inline-start: 1.875rem;
}

/* One extra step of indent per nesting level (Registry lives inside the
   Admin Panel sublist), so a child is never flush with its own parent row. */
#sidebar.oa-sidebar .oa-nav__sublist .oa-nav__sublist .oa-nav__link {
  padding-inline-start: 3rem;
}

/* A long dropdown — Integrations is three sections (MCP, API keys,
   Models) — must stay reachable when the page is zoomed. A fixed
   `100vh - 26rem` cap goes to zero once the zoomed viewport is shorter
   than 26rem, and the panel's overflow then hides the menu entirely.
   Cap against the viewport itself and scroll inside the menu. */
#sidebar.oa-sidebar .oa-nav .dropdown-menu {
  max-height: min(32rem, calc(100vh - 4rem));
  overflow-y: auto;
  overscroll-behavior: contain;
  z-index: 1080;
}

#sidebar.oa-sidebar .integrations-menu__section {
  padding: 0.625rem 0.9375rem 0.125rem;
  margin-bottom: 0;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

#sidebar.oa-sidebar .dropdown-item.integrations-menu__item {
  padding-inline-start: 1.5rem;
}

/* --- bottom-anchored group + scroll safety (KAN-289) ---------------------- */
/* The panel is a 100vh flex column that scrolls as a whole, exactly like the
   reference shell (org-shell PR #17 `.oa-sidebar`, and the mockup's
   `<aside class="side" style="overflow-y:auto; flex-direction:column">`).
   Every direct child keeps its own height, and the spacer below takes the
   slack, so the Workspace group + user row sit on the bottom edge where the
   reference draws them (Organization admin y=927, user row y=1034 of 1080).
   When the content is taller than the viewport the spacer collapses to 0 and
   the panel scrolls — no group can be squeezed to nothing or stranded. */
#sidebar.oa-sidebar > *,
#sidebar.oa-sidebar .oa-nav > * {
  flex-shrink: 0;
}

#sidebar.oa-sidebar > .oa-nav__spacer {
  flex-grow: 1;
  min-height: 0;
}

/* --- footer --------------------------------------------------------------- */
#sidebar.oa-sidebar .oa-sidebar__footer {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.75rem 0.5rem 0;
  border-block-start: 1px solid var(--oa-border);
}

#sidebar.oa-sidebar .oa-user-initials {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--oa-accent-soft-12);
  color: var(--oa-text);
  font-size: 0.75rem;
  font-weight: 600;
}

#sidebar.oa-sidebar .oa-sidebar__user-meta {
  flex-grow: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

#sidebar.oa-sidebar .oa-sidebar__user-name {
  font-size: 0.8125rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#sidebar.oa-sidebar .oa-sidebar__user-email {
  font-size: 0.6875rem;
  color: var(--oa-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- icon button (KAN-289 .ib) -------------------------------------------- */
#sidebar.oa-sidebar .oa-icon-btn {
  width: 2.275rem;
  height: 2.275rem;
  padding: 0;
  border: 0;
  border-radius: 0.3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: transparent;
  color: var(--oa-icon);
  font-size: 1.125rem;
  text-decoration: none;
}

#sidebar.oa-sidebar .oa-icon-btn:hover {
  background: var(--oa-row-hover);
  color: var(--oa-text);
}

#sidebar.oa-sidebar .layout-setting-doublemenu .light-layout,
#sidebar.oa-sidebar .layout-setting-doublemenu .dark-layout {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

#sidebar.oa-sidebar .layout-setting-doublemenu .dark-layout,
[data-theme-mode=light] #sidebar.oa-sidebar .layout-setting-doublemenu .dark-layout,
[data-theme-mode=dark] #sidebar.oa-sidebar .layout-setting-doublemenu .light-layout {
  display: none;
}

[data-theme-mode=dark] #sidebar.oa-sidebar .layout-setting-doublemenu .dark-layout {
  display: inline-flex;
}

/* Docs help is a Bootstrap glyph in the kit's circular header badge, which
   is sized for SVG icons. Width and height do not apply to an inline <i>,
   and the glyph is shifted by vertical-align: -0.125em, so the question
   mark sits off-center in a smaller circle. Keep the kit's content-box
   size and center a glyph that fills that content box. */
.main-header-container .header-link-icon.bi-question-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-size: 1.5rem;
}

.main-header-container .header-link-icon.bi-question-circle::before {
  vertical-align: 0;
  line-height: 1;
}

/* Split pages (Conversations, Execution Logs, Vector DBs). Right pane is a
   12% white wash over --custom-white so the empty/detail block (e.g.
   "Every chat lands here") reads clearly lighter than the list surface. */
[data-theme-mode="dark"] #cv-thread,
[data-theme-mode="dark"] .exec-logs-main,
[data-theme-mode="dark"] .vdb-logs-main {
    background-color: color-mix(in srgb, #fff 12%, var(--custom-white)) !important;
}

/* Profile header without a cover banner: kit .profile-card .avatar-xxl is
   absolutely pulled up (-2.5rem) to overlap a banner image. Keep the avatar
   in normal flow and vertically center it with the name/email block. */
.profile-card.profile-card--avatar-only .avatar.avatar-xxl {
  position: relative;
  inset-block-start: 0;
}

.profile-card.profile-card--avatar-only .avatar.avatar-xxl img {
  /* Kit puts a 4px border on the <img>; that stair-steps on circles. */
  border: 0;
  border-radius: 50%;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Avatar ring: black in light theme, white in dark. */
:root,
[data-theme-mode="light"] {
  --avatar-ring: #111111;
}
[data-theme-mode="dark"] {
  --avatar-ring: #ffffff;
}

/* Seeded solid-color avatars: SVG disc + stroke (crisp at any DPR).
   Keep any <img> invisible so upload JS can still swap src later. */
.avatar.avatar--solid {
  background-color: transparent;
  border: 0;
}
.avatar.avatar--solid > .avatar-solid-disc {
  position: absolute;
  inset: 0;
  /* Override kit `.avatar svg { width/height: 1.5rem }` so the disc fills. */
  width: 100% !important;
  height: 100% !important;
  display: block;
  z-index: 0;
  overflow: visible;
}
.avatar.avatar--solid > .avatar-solid-disc circle {
  stroke: var(--avatar-ring);
}

/* Same 2px ring as the header profile button. The menu disc is smaller, and
   its SVG stroke sits on the viewBox edge so it clips to a hairline. */
.header-profile-dropdown .avatar.avatar-rounded {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--avatar-ring, #111111) 55%, transparent);
}
.avatar.avatar--solid > img {
  opacity: 0;
  pointer-events: none;
  position: relative;
  z-index: 1;
}
.avatar.avatar--solid > .btn {
  z-index: 2;
}

/* Photo avatars (non-solid): solid ring on the container, not the img.
   Profile + Account Settings summary card. */
.profile-card.profile-card--avatar-only .avatar.avatar-xxl:not(.avatar--solid),
#settings-avatar-wrap.avatar.avatar-xxl:not(.avatar--solid) {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--avatar-ring) 92%, transparent);
}
#settings-avatar-wrap.avatar.avatar-xxl img {
  border: 0;
  border-radius: 50%;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Header profile chip: photos/solids fill the button circle. Ring lives on
   .header-link (shared with other chrome icons) — no second ring here. */
.main-header-container .header-profile-avatar {
  width: 100%;
  height: 100%;
  padding: 0;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  border: 0;
  box-shadow: none;
  background-color: transparent;
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
}
.main-header-container .header-profile-avatar.avatar--solid {
  background-color: transparent;
  border: 0;
  box-shadow: none;
  overflow: hidden;
}
.main-header-container .header-profile-avatar > .avatar-solid-disc {
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  shape-rendering: geometricPrecision;
}
.main-header-container .header-profile-avatar > .avatar-solid-disc circle {
  /* Full-bleed disc; ring is the button box-shadow. */
  stroke: none;
}

/* Back-to-top: kit uses z-index 10000 but same primary fill as Save/footer
   actions, so it blends when they overlap. Keep it above page chrome (below
   toasts 11000 / skip-link 11050) and ring it so the control stays distinct. */
.scrollToTop {
  z-index: 10900;
  isolation: isolate;
  box-shadow:
    0 0 0 2px var(--custom-white),
    0 4px 14px rgba(0, 0, 0, 0.28);
}
[data-theme-mode="dark"] .scrollToTop {
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.9),
    0 4px 16px rgba(0, 0, 0, 0.55);
}

/* Storage "My Uploads": circular solid-avatar SVGs have transparent corners.
   Fill the preview frame with the seed color and zoom the disc so the color
   covers the rectangle (user photos keep normal object-fit: cover). */
.my-upload-preview--avatar {
  height: 140px;
  overflow: hidden;
  background-color: var(--upload-preview-fill, var(--custom-white));
  border-top-left-radius: var(--bs-card-inner-border-radius, 0.3125rem);
  border-top-right-radius: var(--bs-card-inner-border-radius, 0.3125rem);
}
.my-upload-preview--avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}
.my-upload-preview--avatar img.my-upload-preview__img--solid {
  /* Circle inscribed in a square → scale by √2 so the fill covers the frame. */
  transform: scale(1.42);
  transform-origin: center center;
}

/* Models page header: search + action buttons stay on one row. */
.models-header-toolbar {
  flex-shrink: 0;
}
.models-header-search {
  flex: 0 1 10rem;
  width: 10rem;
  max-width: 10rem;
  min-width: 8rem;
}
.models-header-search .form-control {
  width: 100%;
}

/* Kit table hover uses --default-background, which in dark equals the page
   surface (body-bg-rgb2) so hovered rows look unchanged. Lift with a light
   wash so dark hover is distinct from both card and page (light theme
   already gets a third color via #f9f7fc). */
[data-theme-mode="dark"] .table.table-hover > tbody > tr:hover > * {
  --bs-table-accent-bg: rgba(255, 255, 255, 0.06);
  --bs-table-bg-state: rgba(255, 255, 255, 0.06);
  background-color: rgba(255, 255, 255, 0.06);
}

/* Header Notifications bell: count badge + scrollable issue list
   (builderHeaderNotifications.js fills the list on agent-builder pages). */
.header-notifications-badge {
  position: absolute;
  top: -0.15rem;
  right: -0.1rem;
  min-width: 1rem;
  height: 1rem;
  padding: 0 0.25rem;
  font-size: 0.625rem;
  line-height: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 1;
}
.oa-shell__notifications .header-notifications-badge {
  top: 0;
  right: 0;
}
.header-notifications-dropdown {
  min-width: min(22rem, 92vw);
  max-width: min(24rem, 92vw);
}
.header-notifications-list {
  max-height: min(55vh, 22rem);
  overflow-y: auto;
  padding-bottom: 0.5rem;
}
.header-notifications-section {
  letter-spacing: 0.04em;
}
.header-notifications-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  white-space: normal;
  font-size: 0.8125rem;
  line-height: 1.4;
  padding-top: 0.55rem;
  padding-bottom: 0.55rem;
}
.header-notifications-icon {
  flex: 0 0 auto;
  font-size: 1rem;
  line-height: 1;
  opacity: 0.9;
}
.header-notifications-body {
  flex: 1 1 auto;
  min-width: 0;
  text-align: start;
  white-space: normal;
  color: inherit;
  background: transparent;
  border: 0;
  padding: 0;
  text-decoration: none;
}
button.header-notifications-body {
  cursor: pointer;
}
a.header-notifications-body:hover {
  text-decoration: underline;
}
.header-notifications-clear {
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 0.35rem 0.75rem;
  min-height: 2rem;
}
.header-notifications-dismiss {
  flex: 0 0 auto;
  width: 1.25rem;
  height: 1.25rem;
  padding: 0.2rem;
  background-size: 0.85rem;
  opacity: 0.7;
}
.header-notifications-dismiss:hover {
  opacity: 1;
}
.header-notifications-row.header-notifications-item--error .header-notifications-icon,
.header-notifications-row.header-notifications-item--error .header-notifications-body {
  color: var(--danger, #dc3545);
}
.header-notifications-row.header-notifications-item--success .header-notifications-icon,
.header-notifications-row.header-notifications-item--success .header-notifications-body {
  color: var(--success, #198754);
}
.header-notifications-row.header-notifications-item--warning .header-notifications-icon {
  color: var(--warning, #ffc107);
}

/* Outer page box: product page_style is locked to Regular, which strips the
   kit's .main-body-container class. Re-apply the flat outer card (white /
   bordered / rounded) on every page that has not opted out — builder canvas
   keeps data-no-main-body-container; org-admin uses its own .oa-page-box. */
.app-content > .page-container:not([data-no-main-body-container]):not([data-page-container="org-admin"]) {
  background-color: var(--custom-white);
  padding: 1rem;
  border-radius: 1rem;
  border: 1px solid var(--default-border);
  padding-block-end: 0;
}
