:root { --workspace-nav-height: calc(64px + env(safe-area-inset-top, 0px)); --workspace-tools-height: 48px; }
.rb-workspace-nav {
  box-sizing: border-box; position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; gap: 14px; flex: 0 0 auto;
  width: 100%; min-height: var(--workspace-nav-height); padding: 8px 20px;
  background: var(--surface-raised, #12243b); color: var(--text-primary, #e2e8f0);
  border-bottom: 1px solid var(--border-color, #2a4a74);
  font: 500 13px/1.4 "DM Sans", "Segoe UI", Arial, sans-serif;
}
.rb-workspace-nav *, .rb-workspace-section * { box-sizing: border-box; }
.rb-workspace-nav .rb-workspace-brand { display: flex; flex: 0 0 auto; padding: 0; margin-right: auto; background: none; border: 0; }
.rb-workspace-nav .rb-workspace-brand img { display: block; width: 116px; height: 40px; object-fit: contain; }
.rb-workspace-destinations { display: flex; align-items: center; gap: 3px; }
.rb-workspace-nav .rb-workspace-link, .rb-workspace-nav .rb-workspace-toggle,
.rb-workspace-nav .rb-workspace-dropdown > a, .rb-workspace-nav .rb-workspace-dropdown form > button {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px;
  padding: 8px 10px; margin: 0; border: 0; border-radius: 7px;
  background: transparent; color: var(--text-primary, #e2e8f0) !important;
  font: inherit; text-decoration: none !important; white-space: nowrap; cursor: pointer;
  box-shadow: none; letter-spacing: normal; text-transform: none; width: auto;
}
.rb-workspace-nav a:hover, .rb-workspace-nav button:hover,
.rb-workspace-nav .is-active, .rb-workspace-nav [aria-current], .rb-workspace-section [aria-current] {
  background: var(--surface-hover, rgba(217,119,6,.16)); color: var(--link-color, #fbbf24) !important;
}
.rb-workspace-nav :focus-visible, .rb-workspace-section a:focus-visible { outline: 2px solid var(--link-color, #d97706); outline-offset: 2px; }
.rb-workspace-disclosure { position: relative; }
.rb-workspace-nav .rb-workspace-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0; min-width: 230px; padding: 8px;
  border: 1px solid var(--border-color, #2a4a74); border-radius: 10px;
  background: var(--surface-raised, #12243b); box-shadow: var(--rs-panel-shadow);
  max-height: calc(100dvh - 84px); overflow-y: auto;
}
.rb-workspace-nav [hidden] { display: none !important; }
.rb-workspace-nav .rb-workspace-dropdown > a, .rb-workspace-nav .rb-workspace-dropdown form > button { display: flex; width: 100%; }
.rb-workspace-nav .rb-workspace-dropdown form { margin: 0; padding: 0; }
.rb-workspace-nav .rb-workspace-identity { display: block; padding: 8px 10px; color: var(--text-muted, #94a3b8); overflow-wrap: anywhere; }
.rb-workspace-nav .rb-appearance { padding: 10px; margin: 6px 0; border-top: 1px solid var(--border-color, #2a4a74); border-bottom: 1px solid var(--border-color, #2a4a74); }
.rb-workspace-nav .rb-workspace-count { padding: 1px 5px; border-radius: 20px; background: var(--rs-accent-face); color: var(--rs-accent-ink); font-size: 11px; }
.rb-workspace-nav .rb-workspace-toggle { display: none; }
.rb-workspace-section { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 20px; background: var(--surface-raised, #12243b); border-bottom: 1px solid var(--border-color, #2a4a74); }
.rb-workspace-section a { padding: 6px 10px; border-radius: 6px; color: var(--text-primary, #e2e8f0); font: 500 13px/1.4 "DM Sans", sans-serif; text-decoration: none; }
.rb-custom-agent-add { display: inline-flex; padding: 9px 14px; border-radius: 8px; border: 1px solid var(--rs-accent-edge); background: var(--rs-accent-face); color: var(--rs-accent-ink) !important; box-shadow: var(--rs-key-shadow), inset 0 1px 0 var(--rs-highlight); text-decoration: none !important; font-weight: 700; white-space: nowrap; }
body.rb-has-workspace-nav.rb-site-editor #main { height: calc(100dvh - var(--workspace-nav-height) - var(--workspace-tools-height)); }
body.rb-has-workspace-nav .chat-shell { height: calc(100dvh - var(--workspace-nav-height)); }
body.rb-has-workspace-nav .wire-shell { --wire-nav-height: var(--workspace-nav-height); --wire-sticky-top: calc(var(--workspace-nav-height) + 14px); }
body.rb-has-workspace-nav #top-bar { flex-shrink: 0; }
@media (max-width: 1200px) {
  .rb-workspace-nav { padding: 8px 14px; }
  .rb-workspace-nav .rb-workspace-toggle { display: inline-flex; }
  .rb-workspace-destinations { display: none; position: absolute; top: 100%; left: 0; right: 0; padding: 12px; background: var(--surface-raised, #12243b); border-bottom: 1px solid var(--border-color, #2a4a74); max-height: calc(100dvh - 64px); overflow-y: auto; }
  .rb-workspace-nav.is-mobile-open .rb-workspace-destinations { display: flex; flex-direction: column; align-items: stretch; }
  .rb-workspace-nav .rb-workspace-link { width: 100%; min-height: 44px; }
  .rb-workspace-nav .rb-workspace-dropdown { position: static; max-height: none; margin: 4px 0 8px 12px; box-shadow: none; }
}
@media print { .rb-workspace-nav, .rb-workspace-section { display: none !important; } }

/* Phones and tablets: hidden while mobile-redirect.mjs decides whether to open the app's layout. */
.rb-app-pending body { visibility: hidden; }
.rb-workspace-nav .rb-mobile-switch { display: inline-flex; align-items: center; min-height: 40px; margin-right: 8px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--rs-accent-edge, #d97706); background: var(--rs-accent-face, #d97706); color: var(--rs-accent-ink, #fff); font: 700 14px/1 "DM Sans", sans-serif; text-decoration: none; white-space: nowrap; }

body.rb-has-workspace-nav.rb-agent-builder #main { height: calc(100dvh - var(--workspace-nav-height) - var(--workspace-tools-height) - 110px); }
@media (max-width: 820px) { body.rb-has-workspace-nav #dashboardSideNav { top: var(--workspace-nav-height); } }
@media (max-width: 960px) { body.rb-has-workspace-nav .sessions-panel { top: calc(var(--workspace-nav-height) + 56px); height: calc(100dvh - var(--workspace-nav-height) - 56px); } }
@media (max-width: 700px) {
 body.rb-has-workspace-nav.rb-site-editor #top-bar { height: auto; min-height: 48px; flex-wrap: wrap; padding: 8px 12px; }
 body.rb-has-workspace-nav.rb-site-editor .top-actions { flex-wrap: wrap; }
}

body.rb-has-workspace-nav { margin: 0; }
.rb-workspace-nav .rb-workspace-brand .rb-workspace-logo-dark { display: none; }
html[data-theme="dark"] .rb-workspace-nav .rb-workspace-brand .rb-workspace-logo-light { display: none; }
html[data-theme="dark"] .rb-workspace-nav .rb-workspace-brand .rb-workspace-logo-dark { display: block; }

body.rb-has-workspace-nav .chat-shell > header { z-index: 20; }
body.rb-has-workspace-nav.rb-document-library > header { top: var(--workspace-nav-height); }
body.rb-has-workspace-nav.rb-document-library .left-rail { top: calc(var(--workspace-nav-height) + 74px); max-height: calc(100dvh - var(--workspace-nav-height) - 86px); }

@media (max-width: 820px) {
 body.rb-has-workspace-nav #dashboardSideNav:not(.open) { visibility: hidden; }
}

/* Quick Links span the toolbar as one shared physical key. */
.toolbar-actions .rb-quick-disclosure {
 display: block; width: 100%; min-width: 0; box-sizing: border-box;
 border: 1px solid var(--border-strong); border-radius: 10px; overflow: hidden;
 background: var(--face);
 box-shadow: var(--rs-key-shadow), inset 0 1px 0 var(--rs-highlight);
}
.toolbar-actions .rb-quick-disclosure > summary {
 display: flex; align-items: center; gap: 8px; width: 100%; box-sizing: border-box;
 /* 40px + the disclosure's 1px border = the 42px of the other quick links. */
 min-height: 40px; padding: 0 14px; cursor: pointer; list-style: none;
 border: 0; border-radius: 0; background: var(--chrome-face); color: var(--text-primary);
 font: 800 13px/1.4 "DM Sans", "Segoe UI", Arial, sans-serif;
}
.rb-quick-disclosure > summary::-webkit-details-marker { display: none; }
.toolbar-actions .rb-quick-disclosure > summary:hover { background: var(--rs-selected); color: var(--text-primary); }
.rb-quick-disclosure > summary:focus-visible { outline: 2px solid var(--focus-outline); outline-offset: -3px; }
.rb-quick-caret { margin-left: auto; }
.rb-quick-disclosure[open] .rb-quick-caret { transform: rotate(180deg); }
.rb-quick-count { background: var(--rs-accent-face); color: var(--rs-accent-ink); padding: 1px 6px; border-radius: 20px; font-size: 11px; }
.rb-quick-dropdown { display: flex; flex-direction: column; border-top: 1px solid var(--border-color); background: var(--bg-panel-hi); }
.toolbar-actions .rb-quick-dropdown a.secondary {
 display: flex; width: 100%; box-sizing: border-box; min-height: 40px; padding: 9px 14px;
 border: 0; border-radius: 0; background: transparent; color: var(--text-primary);
 box-shadow: none; transform: none; font-weight: 600;
}
.toolbar-actions .rb-quick-dropdown a.secondary + a.secondary { border-top: 1px solid var(--border-color); }
.toolbar-actions .rb-quick-dropdown a.secondary:hover { background: var(--rs-selected); color: var(--text-primary); }
.toolbar-actions .rb-quick-dropdown a.secondary:focus-visible { outline: 2px solid var(--focus-outline); outline-offset: -3px; }

/* Phones and tablets: keep content clear of notches and the home indicator,
   and keep form text at 16px so iOS does not zoom on focus. The insets are
   zero unless the page opts in with viewport-fit=cover. */
html { padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
.rb-workspace-nav { padding-top: calc(8px + env(safe-area-inset-top, 0px)); min-height: var(--workspace-nav-height); }
@media (pointer: coarse), (max-width: 768px) {
  body.rb-has-workspace-nav:not(.rb-site-editor) :is(input:not([type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"], [type="hidden"], [type="submit"], [type="button"], [type="reset"], [type="image"]), textarea, select) { font-size: 16px !important; }
}

/* Phones: the workspace menu is a full-height drawer with 44px rows. */
@media (max-width: 768px) {
  .rb-workspace-nav .rb-workspace-toggle { min-height: 44px; }
  .rb-workspace-destinations {
    position: fixed; top: var(--workspace-nav-height); bottom: 0; left: auto; right: 0;
    width: min(360px, 100%); max-height: none;
    padding: 8px 12px max(16px, env(safe-area-inset-bottom, 0px));
    padding-right: max(12px, env(safe-area-inset-right, 0px));
    border-left: 1px solid var(--border-color, #2a4a74);
    overscroll-behavior: contain;
  }
  /* Backdrop: a tap on it lands on the header, which closes the drawer. */
  .rb-workspace-nav.is-mobile-open::after {
    content: ""; position: fixed; inset: var(--workspace-nav-height) 0 0 0; z-index: -1;
    background: color-mix(in srgb, #000 45%, transparent);
  }
  .rb-workspace-nav.is-mobile-open .rb-workspace-destinations { gap: 2px; }
  .rb-workspace-nav .rb-workspace-dropdown > a, .rb-workspace-nav .rb-workspace-dropdown form > button { min-height: 44px; }
  .rb-workspace-nav .rb-workspace-dropdown { margin: 2px 0 6px 12px; }
  body.rb-workspace-drawer-open { overflow: hidden; }
  body.rb-workspace-drawer-open #support-widget-toggle { visibility: hidden; }
  .rb-workspace-section { flex-wrap: nowrap; overflow-x: auto; padding: 8px 12px; scrollbar-width: none; }
  .rb-workspace-section a { flex: 0 0 auto; display: inline-flex; align-items: center; min-height: 44px; white-space: nowrap; }

  /* Quick Links become a row of chips. */
  .rb-quick-links .toolbar-actions { flex-direction: row; flex-wrap: wrap; gap: 8px; }
  .rb-quick-links .toolbar-actions > :is(a, button) {
    flex: 0 0 auto; width: auto; min-height: 44px; padding: 0 16px; border-radius: 999px;
  }
  .toolbar-actions .rb-quick-disclosure { width: auto; flex: 0 0 auto; border-radius: 22px; }
  .toolbar-actions .rb-quick-disclosure[open] { flex-basis: 100%; border-radius: 12px; }
  .toolbar-actions .rb-quick-disclosure > summary { min-height: 42px; padding: 0 16px; }
  .toolbar-actions .rb-quick-dropdown a.secondary { min-height: 44px; }
}
