/* App composition. Component layouts live in swipe.css and agent-workspace.css. */
body.app-studio {
  --studio-mint: #4FFFE2;
  --studio-navy: #0D1722;
  --ui-bg: #F3F7F6;
  --ui-surface: #FFFFFF;
  --ui-soft: #EAF2F0;
  --ui-text: #0D1722;
  --ui-muted: #536B70;
  --ui-line: #CDDDDA;
  --ui-accent: #007567;
  color-scheme: light;
  scrollbar-color: var(--ui-line) var(--ui-bg);
}
body.app-studio[data-theme="dark"] {
  --ui-bg: #0D1722;
  --ui-surface: #18262F;
  --ui-soft: #203039;
  --ui-text: #F4FAF9;
  --ui-muted: #A2B6BB;
  --ui-line: #2A4048;
  --ui-accent: #4FFFE2;
  color-scheme: dark;
}
.app-studio ::selection { background: #4FFFE2; color: #0D1722; }
.app-studio > .background-grid { display: none; }
#appShell {
  --studio-nav-width: 216px;
  --studio-gutter: 28px;
  --finish-text: var(--ui-text);
  --finish-muted: var(--ui-muted);
  --finish-surface: var(--ui-surface);
  --finish-raised: var(--ui-soft);
  --finish-line: var(--ui-line);
  --finish-accent: var(--ui-accent);
  grid-template-columns: var(--studio-nav-width) minmax(0,1fr);
  min-height: 100dvh;
  background: var(--ui-bg);
}
#appShell :is(h1,h2,h3,h4,button,input,select,textarea) { letter-spacing: 0; }
#appShell :is(button,a,input,select,textarea):focus-visible { outline: 2px solid var(--ui-accent); outline-offset: 3px; }
#appShell :is(input,textarea) { caret-color: var(--ui-accent); }
#appShell .workspace { min-width: 0; padding: 0; background: var(--ui-bg); }
#appShell .view-mount { min-width: 0; padding: 24px var(--studio-gutter) 40px; }
#appShell .sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: var(--studio-nav-width);
  height: 100dvh;
  min-height: 0;
  padding: 16px 12px;
  border-right: 1px solid #2A4048;
  border-radius: 0;
  background: #0A131C;
  box-shadow: none;
  backdrop-filter: none;
}
#appShell .sidebar-brand { display: flex; align-items: center; min-height: 56px; padding: 0; flex: 0 0 auto; }
#appShell .sidebar-logo-full { display: block; width: 170px; max-width: 100%; height: 44px; opacity: 1; transform: none; }
#appShell .sidebar-logo-icon { display: none; position: static; width: 44px; height: 44px; max-width: 44px; opacity: 1; transform: none; }
#appShell .sidebar-toggle { top: 14px; right: -24px; width: 28px; height: 28px; border-radius: 6px; box-shadow: none; }
#appShell .side-nav { display: grid; grid-template-columns: minmax(0,1fr); align-content: start; gap: 5px; flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; }
#appShell .nav-item { width: 100%; min-height: 44px; display: grid; grid-template-columns: 44px minmax(0,1fr) auto; padding: 0; margin: 0; border-radius: 6px; font-size: 13px; font-weight: 500; transform: none; }
#appShell .nav-item.active { color: #0D1722; background: #4FFFE2; border-color: #4FFFE2; box-shadow: 0 3px 16px #4fffe212; font-weight: 650; }
#appShell .nav-item:is([data-view="agents"],[data-view="plans"]) { margin-top: 14px; }
#appShell .nav-icon { width: 44px; height: 44px; color: #B7C9CD; transform: none; filter: none; }
#appShell .nav-icon.sw-icon { width: 20px; height: 20px; justify-self: center; }
#appShell .nav-item.active :is(.nav-icon,.nav-label) { color: #0D1722; }
#appShell .nav-label { max-width: none; opacity: 1; white-space: normal; overflow-wrap: anywhere; line-height: 1.4; transform: none; pointer-events: auto; }
#appShell .sidebar-panel { flex: 0 0 auto; max-height: none; margin: 0; padding: 16px 8px 0; border: 0; border-top: 1px solid #2A4048; border-radius: 0; background: none; opacity: 1; transform: none; pointer-events: auto; }
#appShell .sidebar-panel strong { font-size: 16px; }
#appShell .sidebar-panel small { font-size: 12px; }
#appShell .sidebar :focus-visible { outline-color: #4FFFE2; outline-offset: -3px; }

/* Preserve the existing collapsed and hover-peek states. */
#appShell.sidebar-collapsed { --studio-nav-width: 72px; }
#appShell.sidebar-collapsed .sidebar { padding-inline: 13px; }
#appShell.sidebar-collapsed:not(.sidebar-peek) .sidebar-brand { justify-content: center; }
#appShell.sidebar-collapsed:not(.sidebar-peek) :is(.sidebar-logo-full,.nav-label,.sidebar-panel) { display: none; }
#appShell.sidebar-collapsed:not(.sidebar-peek) .sidebar-logo-icon { display: block; }
#appShell.sidebar-collapsed:not(.sidebar-peek) .nav-item { grid-template-columns: 44px; width: 44px; overflow: hidden; }
#appShell.sidebar-collapsed.sidebar-peek:not(.sidebar-suppress-peek) .sidebar { width: 216px; }

#appShell .topbar { position: sticky; top: 0; z-index: 5; min-height: 64px; margin: 0; padding: 12px var(--studio-gutter); gap: 16px; background: var(--ui-bg); border-bottom: 1px solid var(--ui-line); box-shadow: none; backdrop-filter: none; }
#appShell .topbar h2 { margin: 0; font-size: 19px; font-weight: 600; line-height: 1.4; overflow-wrap: anywhere; }
#appShell .topbar-left { gap: 16px; }
#appShell .topbar-tools { gap: 8px; }
#appShell :is(.theme-toggle,.privacy-toggle,.profile-button) { width: 36px; min-width: 36px; height: 36px; border-radius: 6px; }
#appShell .profile-name { max-width: 150px; font-size: 12px; font-weight: 500; }
#appShell .user-menu { min-width: 0; gap: 12px; }
#appShell .top-usage { min-width: 130px; }
#appShell .top-usage :is(span,strong) { font-size: 11px; font-weight: 600; }

/* Fine interaction detail; controls never move away from their pointer target. */
#appShell .nav-item { transition: background-color .2s, border-color .2s; }
#appShell .nav-item:not(.active):hover { background: #172c33; border-color: #2c4e53; }
#appShell .nav-icon { transition: color .2s, transform .25s; }
#appShell .nav-item:hover .nav-icon { color: #4fffe2; transform: translateX(2px); }
#appShell .nav-item.active:hover .nav-icon { color: #0d1722; }
#appShell :is(.sw-tabs button,.plugin-output-tabs button) { transition: color .2s, background-color .2s, border-color .2s; }
#appShell :is(.sw-search,.plugin-input-box) { transition: border-color .2s, box-shadow .2s; }
#appShell .sw-search:focus-within { border-color: var(--ui-accent); box-shadow: 0 0 0 2px color-mix(in srgb,var(--ui-accent) 10%,transparent); }

/* App plans use the shared purchase markup and restrained emphasis. */
#appShell .plans-intro { max-width: 760px; margin-bottom: 28px; }
#appShell .plans-intro h3 { font-size: 28px; font-weight: 600; }
#appShell .landing-plan-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 20px; align-items: stretch; }
#appShell .landing-plan-card {
  --plan-bg: var(--ui-surface);
  --plan-text: var(--ui-text);
  --plan-muted: var(--ui-muted);
  --plan-line: var(--ui-line);
  --plan-accent: var(--ui-accent);
  --plan-soft: var(--ui-soft);
  grid-column: auto;
  min-width: 0;
  justify-items: stretch;
  padding: 52px 24px 24px;
  border: 1px solid var(--ui-line);
  border-radius: 8px;
  background: var(--ui-surface);
  box-shadow: inset 0 2px var(--ui-line);
  text-align: center;
  transform: none;
}
#appShell .landing-plan-card::before, #appShell .landing-plan-card::after { display: none; }
#appShell .landing-plan-card:is(.featured,.current) { border-color: var(--ui-accent); background: var(--ui-surface); box-shadow: inset 0 2px var(--ui-accent); }
#appShell .landing-plan-card.featured { box-shadow: inset 0 2px var(--ui-accent),0 0 18px color-mix(in srgb,var(--ui-accent) 12%,transparent); }
#appShell .landing-plan-card > :is(span,p,.plan-anchor,.plan-objection) { text-align: center; }
#appShell .landing-plan-card > span { font-size: 20px; font-weight: 600; color: var(--ui-text); }
#appShell .landing-plan-card > em { top: 14px; left: 50%; right: auto; max-width: calc(100% - 48px); transform: translateX(-50%); white-space: normal; background: var(--ui-soft); color: var(--ui-accent); border-color: var(--ui-line); }
#appShell .landing-plan-card h3 { justify-content: center; gap: 6px; margin: 20px 0; font-size: 34px; font-weight: 600; color: var(--ui-text); overflow-wrap: anywhere; }
#appShell .landing-plan-card h3 small { color: var(--ui-muted); font-size: 12px; }
#appShell .landing-plan-card > p { min-height: 0; margin-bottom: 20px; font-size: 13px; line-height: 1.7; }
#appShell .landing-plan-card .plan-anchor { font-size: 12px; color: var(--ui-accent); }
#appShell .landing-plan-card .plan-benefits { gap: 14px; margin: 22px 0; text-align: left; }
#appShell .landing-plan-card .plan-benefits li strong { font-weight: 500; }
#appShell .landing-plan-card .plan-benefits li:nth-child(2) strong { color: var(--ui-accent); font-weight: 650; }
#appShell .landing-plan-card .plan-objection { min-height: 0; margin-bottom: 20px; }
#appShell .landing-plan-card .plan-choice-button { min-height: 48px; white-space: normal; }
#appShell .landing-plan-card .plan-choice-button:not(:disabled) { color: var(--ui-text); background: var(--ui-soft); border-color: var(--ui-line); box-shadow: none; }
#appShell .landing-plan-card .plan-choice-button:not(:disabled):hover { border-color: var(--ui-accent); }
#appShell .landing-plan-card.featured .plan-choice-button:not(:disabled) { background: #4FFFE2; border-color: #4FFFE2; color: #0D1722; }
#appShell .landing-plan-card.featured .plan-choice-button:not(:disabled):hover { background: #8CFFEB; }
#appShell .landing-plan-card .plan-choice-button:disabled { color: var(--ui-muted); background: transparent; border-color: var(--ui-line); box-shadow: none; }
#appShell .landing-plan-card { transition: transform .3s, border-color .3s; }
#appShell .landing-plan-card.featured::after { content: ''; display: block; position: absolute; top: -1px; left: 12%; width: 25%; height: 2px; background: var(--ui-accent); box-shadow: 0 0 12px var(--ui-accent); pointer-events: none; }
@media (hover:hover) and (pointer:fine) {
  #appShell .landing-plan-card:hover { transform: translateY(-4px); border-color: var(--ui-accent); }
  #appShell .landing-plan-card.featured:hover::after { transform: translateX(200%); transition: transform 1.2s; }
}

@media (max-width: 1200px) {
  #appShell { --studio-gutter: 24px; }
  #appShell .landing-plan-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 1000px) {
  #appShell { --studio-nav-width: 72px; }
  #appShell .sidebar { padding-inline: 13px; }
  #appShell .sidebar-brand { justify-content: center; }
  #appShell :is(.sidebar-logo-full,.nav-label,.sidebar-panel,.sidebar-toggle) { display: none; }
  #appShell .sidebar-logo-icon { display: block; }
  #appShell .nav-item { grid-template-columns: 44px; width: 44px; overflow: hidden; }
  #appShell.sidebar-collapsed.sidebar-peek:not(.sidebar-suppress-peek) .sidebar { width: 72px; }
  #appShell .profile-name { display: none; }
}
@media (max-width: 760px) {
  #appShell, #appShell.sidebar-collapsed { --studio-nav-width: 60px; --studio-gutter: 16px; }
  #appShell .sidebar, #appShell.sidebar-collapsed .sidebar { width: 60px; padding: 12px 7px; gap: 12px; }
  #appShell.sidebar-collapsed.sidebar-peek:not(.sidebar-suppress-peek) .sidebar { width: 60px; }
  #appShell .side-nav { gap: 6px; }
  #appShell .nav-item:is([data-view="agents"],[data-view="plans"]) { margin-top: 6px; }
  #appShell .sidebar-brand { min-height: 44px; }
  #appShell .view-mount { padding-block: 20px 32px; }
  #appShell .topbar { position: relative; display: grid; grid-template-columns: minmax(0,1fr) auto; grid-template-rows: auto; align-items: center; align-content: start; justify-content: normal; flex-direction: row; height: auto; min-height: 68px; padding-block: 10px; gap: 12px; border-radius: 0; }
  #appShell .topbar-left { display: grid; grid-template-columns: minmax(0,1fr) auto; width: auto; min-width: 0; flex: none; gap: 12px; }
  #appShell .user-menu { width: auto; min-width: 0; justify-content: flex-end; }
  #appShell .topbar h2 { font-size: 18px; }
  #appShell .topbar-tools { gap: 6px; }
  #appShell :is(.theme-toggle,.privacy-toggle,.profile-button) { width: 44px; height: 44px; min-width: 44px; }
  #appShell .landing-plan-grid { grid-template-columns: minmax(0,1fr); }
  #appShell .plans-intro h3 { font-size: 24px; }
  #appShell .landing-plan-card { padding-inline: 20px; }
  #appShell .landing-plan-card h3 { font-size: 30px; }
}
@media (max-width: 480px) {
  #appShell .topbar { grid-template-rows: auto 44px; min-height: 0; padding-block: 8px; gap: 6px 12px; }
  #appShell .topbar-left { display: contents; }
  #appShell .topbar-title { grid-column: 1 / -1; grid-row: 1; }
  #appShell .topbar h2 { font-size: 16px; }
  #appShell .topbar-tools { grid-column: 1; grid-row: 2; }
  #appShell .user-menu { grid-column: 2; grid-row: 2; }
}
@media (prefers-reduced-motion: reduce) {
  #appShell, #appShell :is(.sidebar,.nav-item,.nav-label,.nav-icon,.sidebar-toggle) { transition: none; }
  #appShell *, #appShell *::before, #appShell *::after { animation: none !important; transition: none !important; }
  #appShell .landing-plan-card:hover, #appShell .sw-card:hover { transform: none; }
}
