/* Canonical authenticated RTCH shell. Mirrored to STS by scripts/sync-shell-assets.cjs. */
.rtch-shell {
  --shell-bg: #f7f7f5; --shell-surface: #fff; --shell-soft: #ededeb;
  --shell-ink: #20211f; --shell-muted: #6c6e68; --shell-line: #ddded9;
  --shell-accent: #24634d; --shell-wash: #e5eee8; --shell-sidebar-width: 194px;
  --bg: var(--shell-bg); --bg-elevated: var(--shell-surface); --bg-subtle: var(--shell-soft);
  --fg: var(--shell-ink); --fg-muted: var(--shell-muted); --border: var(--shell-line);
  --accent: var(--shell-accent); --accent-soft: var(--shell-wash);
  --font-sans: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  display: grid; grid-template-columns: var(--shell-sidebar-width) minmax(0, 1fr);
  align-items: start; min-height: 100dvh; min-width: 0; color: var(--shell-ink);
  background: var(--shell-bg); color-scheme: light; font: 14px/1.5 var(--font-sans); isolation: isolate;
}
[data-theme="dark"] .rtch-shell, .rtch-shell[data-theme="dark"] {
  --shell-bg: #141614; --shell-surface: #1d201d; --shell-soft: #292d29;
  --shell-ink: #f1f2ed; --shell-muted: #a6ada5; --shell-line: #383f38;
  --shell-accent: #a8d8bc; --shell-wash: #293d32; color-scheme: dark;
}
.rtch-shell *, .rtch-shell *::before, .rtch-shell *::after { box-sizing: border-box; }
.rtch-shell [hidden] { display: none !important; }
.rtch-shell :focus-visible { outline: 3px solid var(--shell-accent); outline-offset: 3px; }
.rtch-shell__sidebar-host { grid-column: 1; grid-row: 1; position: sticky; top: 0; height: 100dvh; min-width: 0; z-index: 60; }
.rtch-shell__sidebar {
  grid-column: 1; grid-row: 1; position: sticky; top: 0; height: 100dvh; min-width: 0;
  display: flex; flex-direction: column; gap: 28px; padding: 28px 20px 20px;
  border-right: 1px solid var(--shell-line); background: var(--shell-bg); z-index: 60;
}
.rtch-shell__brand-row { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.rtch-shell .rtch-shell__brand {
  display: inline-flex; align-items: center; gap: 10px; min-height: 44px; min-width: 0;
  color: var(--shell-ink); text-decoration: none; font-size: 24px; font-weight: 700; letter-spacing: -1.4px;
}
.rtch-shell__brand > span:last-child { display: flex; align-items: baseline; min-width: 0; }
.rtch-shell__brand small { color: var(--shell-muted); margin-left: 10px; font-size: 10px; font-weight: 500; letter-spacing: 1px; }
.rtch-shell__brand-mark {
  display: block; width: 30px; height: 30px; flex: 0 0 30px; background: var(--shell-accent);
  -webkit-mask: url('/assets/brand/rtch-mark-light.svg') center / contain no-repeat;
  mask: url('/assets/brand/rtch-mark-light.svg') center / contain no-repeat;
}
.rtch-shell__nav { flex: 1 1 auto; min-height: 0; min-width: 0; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; }
.rtch-shell__nav nav { display: grid; gap: 5px; }
.rtch-shell__nav :is(a, button) {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px;
  margin: 0; padding: 10px 14px; border: 1px solid transparent; border-radius: 10px;
  background: transparent; color: var(--shell-ink); font: 500 14px/1.25 var(--font-sans);
  text-decoration: none; text-align: left; cursor: pointer;
}
.rtch-shell__nav :is(a, button):hover { background: var(--shell-soft); filter: none; }
.rtch-shell__nav :is(a, button).active, .rtch-shell__nav [aria-current="page"],
.rtch-shell__nav .app-shell__nav-item--active { background: var(--shell-wash); color: var(--shell-accent); }
.rtch-shell__nav-text { overflow: hidden; text-overflow: ellipsis; }
.rtch-shell__nav-children { display: grid; gap: 2px; margin: 2px 0 6px; }
.rtch-shell__group-label { color: var(--shell-muted); font-size: 11px; margin: 0 14px 10px; }
.rtch-shell__empty { padding: 10px 14px; color: var(--shell-muted); }
.rtch-shell__footer { position: relative; flex: 0 0 auto; padding-top: 12px; border-top: 1px solid var(--shell-line); min-width: 0; }
.rtch-shell__account { position: relative; display: block; min-width: 0; }
.rtch-shell .rtch-shell__account-trigger {
  display: grid; grid-template-columns: 36px minmax(0, 1fr) 14px; align-items: center; gap: 8px;
  width: 100%; min-height: 52px; padding: 6px 4px; border: 1px solid transparent; border-radius: 10px;
  color: var(--shell-ink); background: transparent; text-align: left; cursor: pointer; font: inherit;
}
.rtch-shell .rtch-shell__account-trigger:hover, .rtch-shell .rtch-shell__account-trigger[aria-expanded="true"] { background: var(--shell-wash); filter: none; }
.rtch-shell__avatar { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 36px; border-radius: 50%; background: var(--shell-soft); color: var(--shell-ink); font-size: 12px; font-weight: 750; overflow: hidden; }
.rtch-shell__avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
.rtch-shell__account-trigger app-shell-icon, .rtch-shell__account-trigger > svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.rtch-shell__account-copy { display: grid; gap: 1px; min-width: 0; }
.rtch-shell__account-copy :is(strong, small) { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rtch-shell__account-copy strong { font-size: 13px; font-weight: 650; }
.rtch-shell__account-copy small { color: var(--shell-muted); font-size: 11px; }
.rtch-shell .rtch-shell__account-panel {
  position: absolute; bottom: calc(100% + 10px); left: 0; right: auto; z-index: 90;
  width: min(290px, calc(100vw - 40px)); max-height: calc(100dvh - 110px); overflow-y: auto;
  display: grid; gap: 4px; padding: 8px; border: 1px solid var(--shell-line); border-radius: 14px;
  color: var(--shell-ink); background: var(--shell-surface); box-shadow: 0 14px 40px rgb(0 0 0 / .16);
  backdrop-filter: none;
}
.rtch-shell__account-panel :is(a, button), .rtch-shell__menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px;
  border: 0; border-radius: 9px; padding: 10px 12px; color: var(--shell-ink);
  background: transparent; text-align: left; text-decoration: none; cursor: pointer; font: inherit;
}
.rtch-shell__account-panel :is(a, button):hover { background: var(--shell-wash); filter: none; }
.rtch-shell__account-panel form { margin: 0; }
.rtch-shell__account-panel app-shell-icon, .rtch-shell__account-panel svg { width: 18px; height: 18px; flex: 0 0 18px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.rtch-shell__account-panel .rtch-shell__trailing { margin-left: auto; color: var(--shell-muted); }
.rtch-shell__account-panel select { min-height: 44px; color: var(--shell-ink); background: var(--shell-surface); border: 1px solid var(--shell-line); border-radius: 10px; }
.rtch-shell__workspace { grid-column: 2; grid-row: 1; min-width: 0; min-height: 100dvh; }
.rtch-shell__tools { display: flex; align-items: center; justify-content: flex-end; padding: 16px 48px; min-height: 76px; gap: 12px; }
.rtch-shell .rtch-shell__search {
  display: flex; align-items: center; gap: 10px; width: min(360px, 100%); min-width: 0;
  height: 44px; padding: 0 12px; font: inherit; color: var(--shell-muted); border: 1px solid var(--shell-line);
  border-radius: 10px; background: var(--shell-surface);
}
.rtch-shell__search:focus-within { outline: 2px solid var(--shell-accent); outline-offset: 2px; }
.rtch-shell .rtch-shell__search input { min-width: 0; width: 100%; height: 100%; min-height: 0; margin: 0; padding: 0; border: 0; outline: 0; background: transparent; color: var(--shell-ink); font: inherit; }
.rtch-shell .rtch-shell__search input:disabled { color: var(--shell-muted); opacity: 1; cursor: default; }
.rtch-shell .rtch-shell__search input::placeholder { color: var(--shell-muted); opacity: 1; }
.rtch-shell__search svg { width: 18px; height: 18px; flex: 0 0 18px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.rtch-shell .rtch-shell__icon-button {
  display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px;
  min-height: 44px; padding: 0; border: 1px solid var(--shell-line); border-radius: 10px;
  background: var(--shell-surface); color: var(--shell-ink); cursor: pointer; font: inherit;
}
.rtch-shell__icon-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.rtch-shell :is(.rtch-shell__open, .rtch-shell__close, .rtch-shell__scrim) { display: none; }
.rtch-shell .app-main { grid-area: auto; grid-column: 2; grid-row: 1; padding: 36px 48px; border: 0; border-radius: 0; background: var(--shell-bg); box-shadow: none; backdrop-filter: none; overflow: visible; }
body:has(.rtch-shell) .identity-appearance { display: none; }
.rtch-shell__workspace:has(app-product-studio) { display: flex; flex-direction: column; height: 100dvh; min-height: 0; }
.rtch-shell__workspace:has(app-product-studio) > .content { flex: 1; min-height: 0; height: auto; padding: 12px 20px; overflow: hidden; }
.rtch-shell .content:has(app-product-studio) app-product-studio, .rtch-shell .content:has(app-product-studio) .studio { height: 100%; }
.rtch-shell .content:has(app-product-studio) .generation-stage .studio-canvas app-private-image { max-height: 100%; }
@media (max-width: 1100px) and (min-width: 761px) {
  .rtch-shell { --shell-sidebar-width: 160px; }
  .rtch-shell__sidebar { padding: 24px 12px 20px; }
  .rtch-shell .rtch-shell__brand { gap: 7px; }
  .rtch-shell__brand small { color: var(--shell-muted); margin-left: 7px; letter-spacing: .5px; }
}
@media (max-width: 1100px) {
  .rtch-shell__tools { padding-inline: 24px; }
  .rtch-shell .app-main { padding: 26px 24px; }
}
@media (max-width: 760px) {
  .rtch-shell { display: block; }
  .rtch-shell__sidebar-host { position: static; height: 0; }
  .rtch-shell__sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; width: min(288px, calc(100vw - 48px)); height: 100dvh;
    padding: 16px 20px max(16px, env(safe-area-inset-bottom)); border-right: 1px solid var(--shell-line);
    transform: translateX(-100%); visibility: hidden; transition: transform 160ms ease, visibility 160ms ease; z-index: 80;
  }
  .rtch-shell__sidebar--open { transform: translateX(0); visibility: visible; }
  .rtch-shell__brand-row { justify-content: space-between; }
  .rtch-shell .rtch-shell__open { display: inline-flex; position: fixed; top: 16px; left: 20px; z-index: 65; }
  .rtch-shell .rtch-shell__close { display: inline-flex; }
  .rtch-shell .rtch-shell__scrim { display: block; position: fixed; inset: 0; z-index: 70; width: 100%; height: 100%; padding: 0; border: 0; border-radius: 0; background: rgb(0 0 0 / .32); cursor: pointer; }
  .rtch-shell__tools { padding: 16px 20px 16px 76px; }
  .rtch-shell__workspace { min-height: 100dvh; }
  .rtch-shell .app-main { padding: 76px 20px 30px; }
  .rtch-shell .rtch-shell__account-panel { left: 0; width: min(290px, calc(100vw - 88px)); max-height: calc(100dvh - 120px); }
  .rtch-shell__workspace:has(app-product-studio) > .content { padding: 8px; }
}
@media (prefers-reduced-motion: reduce) { .rtch-shell__sidebar { transition: none; } }
