/* [190-219] app-shell background + is-mac drag region */
.app-shell {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  color: var(--yb-text);
  background:
    radial-gradient(circle at 82% 6%, rgba(33, 116, 253, 0.13), transparent 30%),
    radial-gradient(circle at 18% 16%, rgba(91, 84, 211, 0.1), transparent 32%),
    linear-gradient(180deg, #ffffff 0%, var(--yb-bg) 48%, #f1f6ff 100%);
}

.app-shell.is-mac::before {
  content: '';
  position: fixed;
  top: 0;
  right: 0;
  left: 84px;
  z-index: 15;
  height: 28px;
  -webkit-app-region: drag;
}

.app-shell.is-mac button,
.app-shell.is-mac input,
.app-shell.is-mac select,
.app-shell.is-mac textarea,
.app-shell.is-mac a {
  -webkit-app-region: no-drag;
}

/* [221-344] sidebar + brand-block/mark/copy + collapse-button + is-collapsed + sidebar-nav start */
.sidebar {
  position: relative;
  z-index: 2;
  display: flex;
  width: 286px;
  min-width: 286px;
  height: 100vh;
  flex-direction: column;
  overflow: visible;
  padding: 26px 16px;
  color: var(--yb-text);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 253, 0.98) 100%);
  border-right: 1px solid rgba(228, 233, 240, 0.9);
  box-shadow: 24px 0 60px rgba(33, 116, 253, 0.07);
  transition: width var(--yb-duration) var(--yb-ease), min-width var(--yb-duration) var(--yb-ease);
}

.sidebar.is-collapsed {
  width: 88px;
  min-width: 88px;
  padding-right: 14px;
  padding-left: 14px;
}

.sidebar-surface {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(145deg, rgba(33, 116, 253, 0.07), transparent 34%),
    radial-gradient(circle at 50% 0%, rgba(91, 84, 211, 0.09), transparent 26%);
}

.brand-block,
.sidebar-nav,
.sidebar-footer,
.collapse-button {
  position: relative;
  z-index: 1;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 2px 8px 22px;
  border-bottom: 1px solid var(--yb-border-soft);
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  place-items: center;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
  white-space: nowrap;
}

.brand-copy span {
  color: var(--yb-text-muted);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.2em;
}

.brand-copy strong {
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.is-collapsed .brand-copy,
.is-collapsed .nav-copy,
.is-collapsed .settings-copy {
  display: none;
}

.collapse-button {
  display: grid;
  position: absolute;
  top: 84px;
  right: -17px;
  width: 32px;
  height: 32px;
  place-items: center;
  color: #364153;
  background: #ffffff;
  border: 1px solid var(--yb-border-soft);
  border-radius: 999px;
  box-shadow: 0 10px 24px rgba(33, 116, 253, 0.14), 0 0 0 4px rgba(248, 250, 253, 0.85);
  transition: box-shadow var(--yb-duration-fast) ease, transform var(--yb-duration-fast) ease;
}

.collapse-button:hover {
  box-shadow: 0 14px 30px rgba(33, 116, 253, 0.2), 0 0 0 4px rgba(248, 250, 253, 0.9);
  transform: scale(1.06);
}

.collapse-button svg {
  width: 18px;
  height: 18px;
  transition: transform 160ms ease;
}

.rotate-180 {
  transform: rotate(180deg);
}

.sidebar-nav {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 5px;
  margin-top: 20px;
}

/* [346-432] nav-item/settings-trigger + nav-icon + nav-copy + sidebar-footer */
.nav-item,
.settings-trigger {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 13px;
  padding: 11px 13px;
  color: var(--yb-text-soft);
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 16px;
  transition: background var(--yb-duration-fast) ease, color var(--yb-duration-fast) ease,
    border-color var(--yb-duration-fast) ease, transform var(--yb-duration-fast) ease;
}

.nav-item:hover,
.settings-trigger:hover {
  color: var(--yb-primary);
  background: rgba(33, 116, 253, 0.06);
  border-color: rgba(33, 116, 253, 0.12);
  transform: translateX(2px);
}

.nav-item.is-active,
.settings-trigger.is-active {
  color: #ffffff;
  background: linear-gradient(135deg, var(--yb-primary) 0%, var(--yb-violet) 100%);
  border-color: rgba(33, 116, 253, 0.2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24), 0 14px 30px rgba(33, 116, 253, 0.22);
}

.nav-item.is-active:hover,
.settings-trigger.is-active:hover {
  transform: none;
}

.nav-item.is-active .nav-icon,
.settings-trigger.is-active .nav-icon {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.24);
}

.nav-item.is-active .nav-copy small,
.settings-trigger.is-active .settings-copy small {
  color: rgba(255, 255, 255, 0.8);
}

.nav-icon {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  color: inherit;
  background: linear-gradient(150deg, rgba(33, 116, 253, 0.1), rgba(91, 84, 211, 0.07));
  border: 1px solid rgba(33, 116, 253, 0.1);
  border-radius: 12px;
  transition: background var(--yb-duration-fast) ease, border-color var(--yb-duration-fast) ease;
}

.nav-icon svg {
  width: 19px;
  height: 19px;
}

.nav-copy,
.settings-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.nav-copy strong,
.settings-copy strong {
  font-size: 14.5px;
  font-weight: 600;
}

.nav-copy small,
.settings-copy small {
  overflow: hidden;
  color: var(--yb-text-muted);
  font-size: 11.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--yb-border-soft);
}

/* [434-537] main-area + agent-runtime-status-bar/dot/copy/meta + keyframes + section-kicker */
.main-area {
  position: relative;
  display: flex;
  min-width: 0;
  height: 100vh;
  flex: 1;
  flex-direction: column;
}

.agent-runtime-status-bar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin: 18px 42px 0;
  padding: 12px 16px;
  color: #243047;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(228, 233, 240, 0.92);
  border-radius: 18px;
  box-shadow: 0 16px 34px rgba(36, 48, 72, 0.08);
}

.agent-runtime-status-dot {
  width: 10px;
  height: 10px;
  background: var(--yb-primary);
  border-radius: 999px;
  box-shadow: 0 0 0 6px rgba(33, 116, 253, 0.12);
}

.agent-runtime-status-bar.is-running .agent-runtime-status-dot {
  animation: agent-runtime-pulse 1.2s ease-in-out infinite;
}

.agent-runtime-status-bar.is-warning .agent-runtime-status-dot {
  background: #f59e0b;
  box-shadow: 0 0 0 6px rgba(245, 158, 11, 0.14);
}

.agent-runtime-status-bar.is-error .agent-runtime-status-dot {
  background: #c83220;
  box-shadow: 0 0 0 6px rgba(200, 50, 32, 0.12);
}

.agent-runtime-status-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.agent-runtime-status-copy strong {
  overflow: hidden;
  color: var(--yb-text);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-runtime-status-copy span {
  overflow: hidden;
  color: var(--yb-text-soft);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-runtime-status-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.agent-runtime-status-meta em {
  padding: 5px 8px;
  color: #536176;
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
  background: #f2f5f9;
  border-radius: 999px;
}

@keyframes agent-runtime-pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(0.72);
    opacity: 0.65;
  }
}

.section-kicker {
  display: inline-flex;
  align-items: center;
  color: var(--yb-primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

/* [539-557] content-shell + :has() overflow rules */
.content-shell {
  position: relative;
  display: flex;
  min-height: 0;
  flex: 1;
  overflow: hidden;
  padding: 36px 44px;
}

.content-shell:has(.technical-workbench) {
  overflow: hidden;
}

.content-shell:has(.settings-page) {
  align-items: flex-start;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

/* [730-739] page-stack */
.page-stack {
  position: relative;
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 0;
  flex-direction: column;
  gap: 26px;
  overflow: auto;
}
