@layer legacy {
  /* Compact conversation starters and opt-in practice controls. */
  html body #app .app-shell.chat-shell .welcome-prompts {
    grid-template-columns: minmax(0, 1fr) !important;
    flex-direction: column !important;
    gap: 0 !important;
    margin: 8px 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    scroll-snap-type: none !important;
    width: 100%;
  }
  html body #app .app-shell.chat-shell .welcome-prompts-desktop { order: -1 !important; grid-row: 1 !important; }
  @media (min-width: 821px) { html body #app .app-shell.chat-shell .chat-is-empty .composer-wrap > form { grid-row: 2 !important; } }
  html body #app .app-shell.chat-shell .suggestion-card {
    display: flex !important;
    flex: 0 0 auto !important;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    width: 100% !important;
    min-height: 44px !important;
    padding: 8px 12px !important;
    border: 0 !important;
    border-radius: 8px !important;
    background: transparent !important;
    box-shadow: none !important;
    color: var(--aios-text-muted) !important;
    text-align: left;
    font-weight: 500 !important;
  }
  html body #app .app-shell.chat-shell .suggestion-card svg { flex: 0 0 18px; }
  html body #app .app-shell.chat-shell .suggestion-card:hover,
  html body #app .app-shell.chat-shell .suggestion-card:focus-visible { background: var(--aios-surface-hover) !important; color: var(--aios-text) !important; }
  html body #app .app-shell.chat-shell .claude-composer #aios-send {
    width: 44px !important;
    min-width: 44px !important;
    height: 44px !important;
    min-height: 44px !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 50% !important;
    display: grid !important;
    place-items: center !important;
    justify-self: end;
    background: var(--aios-text-muted) !important;
    color: var(--aios-bg) !important;
    box-shadow: none !important;
  }
  html body #app .app-shell.chat-shell .claude-composer #aios-send:not(:disabled) {
    background: var(--aios-text-muted) !important;
    color: var(--aios-bg) !important;
  }
  html body #app .app-shell.chat-shell .claude-composer { grid-template-columns: 44px minmax(0, 1fr) auto 44px 44px !important; grid-template-rows: auto auto !important; align-items: center !important; }
  html body #app .app-shell.chat-shell .claude-composer .attachment-tray { grid-column: 1 / -1 !important; grid-row: 1 !important; }
  html body #app .app-shell.chat-shell .claude-composer .composer-tools { grid-column: 1 !important; grid-row: 2 !important; }
  html body #app .app-shell.chat-shell .claude-composer #aios-chat-input,
  html body #app .app-shell.chat-shell .claude-composer .composer-highlight { grid-column: 2 !important; grid-row: 2 !important; }
  html body #app .app-shell.chat-shell .claude-composer #aios-mic-button { grid-column: 4 !important; grid-row: 2 !important; }
  html body #app .app-shell.chat-shell .claude-composer #aios-send,
  html body #app .app-shell.chat-shell .claude-composer [data-action="stop-aios-generation"] { grid-column: 5 !important; grid-row: 2 !important; }
  .chat-exercise-options { grid-column: 3; grid-row: 2; position: relative; font-size: 14px; min-width: 0; }
  .chat-exercise-options > summary { min-height: 44px; display: flex; align-items: center; justify-content: end; gap: 8px; cursor: pointer; padding: 0 4px; color: var(--aios-text-muted); white-space: nowrap; list-style: none; }
  .chat-exercise-options > summary::-webkit-details-marker { display: none; }
  .chat-exercise-options > summary::after { content: ""; width: 7px; height: 7px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: translateY(-2px) rotate(45deg); margin: 0 4px; }
  .chat-exercise-panel { --exercise-blue: #0a84ff; --exercise-track: #454545; box-sizing: border-box; position: absolute; bottom: calc(100% + 12px); right: 0; z-index: var(--z-popover, 100); width: min(264px, calc(100vw - 40px)); padding: 14px 16px; border: 1px solid var(--aios-border); border-radius: 22px; background: var(--aios-surface); color: var(--aios-text); box-shadow: var(--aios-shadow); }
  html body .chat-exercise-heading { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 42px; margin: 0 0 8px; font-weight: 500 !important; }
  .chat-exercise-heading > span { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
  .chat-exercise-heading output { font-size: 20px; font-weight: 600; line-height: 1.4; }
  html body .chat-exercise-enable { display: flex; align-items: center; gap: 10px; min-height: 44px; margin: 4px 0 -4px; font-size: 13px; font-weight: 400 !important; color: var(--aios-text-muted); }
  .chat-exercise-enable input { width: 16px; height: 16px; min-height: 16px; margin: 0; accent-color: var(--aios-accent); }
  .chat-exercise-track { position: relative; height: 44px; isolation: isolate; }
  .chat-exercise-track::before, .chat-exercise-track::after { content: ""; position: absolute; top: 6px; left: 0; height: 32px; border-radius: 999px; pointer-events: none; }
  .chat-exercise-track::before { z-index: var(--z-base); width: 100%; background: var(--exercise-track); }
  .chat-exercise-track::after { z-index: var(--z-raised); width: calc(var(--exercise-progress) + 18px); min-width: 36px; max-width: 100%; background: var(--exercise-blue); }
  .chat-exercise-ticks { position: absolute; z-index: calc(var(--z-raised) + 1); inset: 0 16px; display: flex; align-items: center; justify-content: space-between; pointer-events: none; }
  .chat-exercise-ticks i { width: 5px; height: 5px; border-radius: 50%; background: rgba(255, 255, 255, .38); }
  html body #app .chat-exercise-track input[type="range"] { appearance: none; position: relative; z-index: calc(var(--z-raised) + 2); width: 100%; height: 44px; min-height: 44px; padding: 0 !important; margin: 0; border: 0 !important; border-radius: 999px !important; background: transparent !important; box-shadow: none !important; cursor: pointer; }
  html body #app .chat-exercise-track input:focus-visible { outline: none !important; }
  .chat-exercise-track input::-webkit-slider-runnable-track { height: 32px; border: 0; background: transparent; }
  .chat-exercise-track input::-webkit-slider-thumb { -webkit-appearance: none !important; appearance: none; width: 36px; height: 36px; margin-top: -2px; border: 0; border-radius: 50%; background-color: #fff !important; box-shadow: 0 1px 3px #0002; }
  .chat-exercise-track input:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--exercise-blue), 0 1px 3px #0002; }
  .chat-exercise-track input::-moz-range-track { height: 32px; background: transparent; }
  .chat-exercise-track input::-moz-range-thumb { width: 34px; height: 34px; border: 0; border-radius: 50%; background: #fff !important; box-shadow: 0 1px 3px #0002; }
  .chat-exercise-track input:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 3px var(--exercise-blue), 0 1px 3px #0002; }
  @media (max-width: 820px) {
    html body #app .app-shell.chat-shell .claude-composer #aios-chat-input,
    html body #app .app-shell.chat-shell .claude-composer .composer-highlight { grid-column: 1 / -1 !important; grid-row: 2 !important; }
    html body #app .app-shell.chat-shell .claude-composer .composer-tools,
    html body #app .app-shell.chat-shell .claude-composer #aios-mic-button,
    html body #app .app-shell.chat-shell .claude-composer #aios-send,
    html body #app .app-shell.chat-shell .claude-composer [data-action="stop-aios-generation"] { grid-row: 3 !important; }
    .chat-exercise-options { grid-column: 2 / 4; grid-row: 3; }
    .chat-exercise-panel { right: -88px; }
  }
  @media (min-width: 821px) {
  html body #app .app-shell.chat-shell {
    --chat-rail-size: 76px;
    --chat-rail-expanded: clamp(252px, 19vw, 292px);
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    min-height: 0;
    display: grid;
    grid-template-columns: var(--chat-rail-size) minmax(0, 1fr);
    gap: 0;
    padding: 0;
    overflow: hidden;
    background: var(--cg-bg);
  }

  html body #app .app-shell.chat-shell:has(.chat-workspace-rail:has(.chat-rail-spaces-details[open])) {
    grid-template-columns: var(--chat-rail-expanded) minmax(0, 1fr);
  }

  html body #app .app-shell.chat-shell > .mobile-shell-header {
    display: none;
  }

  html body #app .app-shell.chat-shell > .chat-workspace-rail {
    box-sizing: border-box;
    position: relative;
    inset: auto;
    align-self: stretch;
    width: 100%;
    height: 100dvh;
    max-height: none;
    min-width: 0;
    margin: 0;
    padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    gap: 8px;
    border: 0;
    border-right: 1px solid var(--cg-line);
    border-radius: 0;
    background: var(--cg-sidebar);
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    overflow: hidden;
    z-index: var(--z-shell);
  }

  .chat-rail-home {
    box-sizing: border-box;
    width: 100%;
    min-height: 52px;
    display: flex;
    align-items: center;
    gap: 12px;
    overflow: hidden;
  }

  .chat-rail-home .brand-mark {
    width: 46px;
    min-width: 46px;
    max-width: 46px;
    height: 44px;
    display: grid;
    place-items: center;
    overflow: hidden;
  }

  .chat-rail-home .aios-logo-image {
    width: 50px;
    max-width: none;
    height: 34px;
    object-fit: contain;
    object-position: left center;
  }

  .chat-rail-logo {
    width: 32px;
    min-width: 32px;
    height: 32px;
    margin: auto;
    object-fit: contain;
  }

  .chat-rail-home > span:last-child {
    color: var(--cg-text);
    font-size: 18px;
    font-weight: 760;
    letter-spacing: -0.02em;
  }

  .chat-workspace-rail:not(:has(.chat-rail-spaces-details[open])) .chat-rail-home > span:last-child,
  .chat-workspace-rail:not(:has(.chat-rail-spaces-details[open])) .chat-rail-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .chat-workspace-rail:not(:has(.chat-rail-spaces-details[open])) .chat-rail-home .brand-mark,
  .chat-workspace-rail:has(.chat-rail-spaces-details[open]) .chat-rail-logo {
    display: none !important;
  }

  .chat-rail-primary {
    display: grid;
    gap: 6px;
  }

  .chat-rail-button {
    box-sizing: border-box;
    width: 100%;
    min-width: 44px;
    min-height: 48px;
    padding: 0 8px;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    color: var(--cg-muted);
    text-align: left;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    cursor: pointer;
  }

  .chat-workspace-rail:not(:has(.chat-rail-spaces-details[open])) .chat-rail-button {
    grid-template-columns: 1fr;
    place-items: center;
    padding: 0;
  }

  .chat-rail-button:hover,
  .chat-rail-button.is-active {
    color: var(--cg-text);
    border-color: var(--cg-line);
    background: var(--cg-surface);
  }

  .chat-rail-new {
    color: var(--cg-text);
    background: var(--cg-elevated);
    border-color: var(--cg-line);
  }

  .chat-rail-icon,
  .chat-rail-icon svg {
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
  }

  .chat-rail-icon svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .chat-rail-account-icon {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    color: var(--cg-text);
    border: 1px solid var(--cg-line);
    border-radius: 50%;
    background: var(--cg-surface);
  }

  .chat-rail-account-icon svg {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .chat-rail-label {
    min-width: 0;
    display: grid;
    gap: 2px;
    overflow: hidden;
    color: inherit;
    font-size: 14px;
    font-weight: 650;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .chat-rail-label small {
    color: var(--cg-muted);
    font-size: 11px;
    font-weight: 520;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .chat-rail-spaces[hidden] {
    display: none;
  }

  .chat-rail-spaces {
    min-height: 0;
    padding: 8px 0;
    display: grid;
    grid-auto-rows: minmax(44px, auto);
    align-content: start;
    gap: 4px;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .chat-rail-section-label {
    padding: 8px 10px 4px;
    color: var(--cg-muted);
    font-size: 11px;
    font-weight: 740;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  html body #app .app-shell.chat-shell .chat-rail-spaces .nav-item {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 8px 10px;
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    color: var(--cg-muted);
    text-align: left;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    box-shadow: none;
  }

  html body #app .app-shell.chat-shell .chat-rail-spaces .nav-item:hover,
  html body #app .app-shell.chat-shell .chat-rail-spaces .nav-item.active {
    color: var(--cg-text);
    border-color: var(--cg-line);
    background: var(--cg-surface);
  }

  html body #app .app-shell.chat-shell .chat-rail-spaces .nav-item-icon {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    color: currentColor;
    border-radius: 8px;
    background: transparent;
  }

  html body #app .app-shell.chat-shell .chat-rail-spaces .nav-item-icon svg {
    width: 19px;
    height: 19px;
  }

  .chat-rail-account {
    margin-top: auto;
  }

  .chat-rail-account .account-avatar {
    width: 36px;
    min-width: 36px;
    height: 36px;
    margin: 0 auto;
  }

  .chat-workspace-rail:not(:has(.chat-rail-spaces-details[open])) .sidebar-account .account-avatar {
    position: absolute;
    visibility: hidden;
  }

  .chat-workspace-rail:has(.chat-rail-spaces-details[open]) .chat-rail-account-icon,
  .chat-workspace-rail:has(.chat-rail-spaces-details[open]) .chat-rail-primary {
    display: none;
  }

  .chat-workspace-rail:has(.chat-rail-spaces-details[open]) .chat-rail-home > span:last-child {
    position: static;
    width: auto;
    height: auto;
    display: grid;
    overflow: visible;
    clip-path: none;
    white-space: normal;
  }

  html body #app .app-shell.chat-shell > .main,
  html body #app .app-shell.chat-shell .content,
  html body #app .app-shell.chat-shell .content:has(.aios-chat-app) {
    min-width: 0;
    width: 100%;
    max-width: 100%;
    height: 100dvh;
    min-height: 0;
    padding: 0;
    margin: 0;
    overflow: hidden;
  }

  html body #app .app-shell.chat-shell .aios-chat-app,
  html body #app .app-shell.chat-shell .aios-chat-app.chat-roomy {
    position: relative;
    width: 100%;
    max-width: 100%;
    height: 100dvh;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    border: 0;
    border-radius: 0;
    overflow: hidden;
    background: var(--cg-bg);
  }

  html body #app .app-shell.chat-shell .aios-chat-sidebar {
    box-sizing: border-box;
    position: absolute;
    inset: 0 auto 0 0;
    width: min(348px, calc(100% - 20px));
    height: 100%;
    min-height: 0;
    padding: max(14px, env(safe-area-inset-top)) 12px max(14px, env(safe-area-inset-bottom));
    display: grid;
    grid-template-rows: 48px 44px minmax(0, 1fr) !important;
    gap: 10px;
    border: 0;
    border-right: 1px solid var(--cg-line);
    border-radius: 0 16px 16px 0;
    background: var(--cg-sidebar) !important;
    box-shadow: 18px 0 48px rgba(15, 23, 42, 0.16);
    transform: translateX(0);
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    overflow: hidden;
    z-index: calc(var(--z-drawer) + 2);
    transition: transform 180ms ease, opacity 180ms ease, visibility 180ms ease;
  }

  html body #app .app-shell.chat-shell .aios-chat-app.sidebar-collapsed > .aios-chat-sidebar {
    display: grid;
    transform: translateX(calc(-100% - 24px));
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
  }

  .chat-history-head {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  .chat-history-head strong {
    color: var(--cg-text);
    font-size: 18px;
    letter-spacing: -0.02em;
  }

  .chat-history-head .icon-button {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
  }

  html body #app .app-shell.chat-shell .aios-chat-sidebar > .conversation-groups {
    align-self: stretch;
    min-height: 0;
    margin: 0;
    display: grid;
    align-content: start;
    overflow-y: auto;
  }

  html body #app .app-shell.chat-shell .chat-sidebar-backdrop {
    position: absolute;
    inset: 0;
    display: block;
    border: 0;
    background: rgba(15, 23, 42, 0.22);
    opacity: 1;
    pointer-events: auto;
    z-index: calc(var(--z-drawer) + 1);
    transition: opacity 180ms ease;
  }

  html body #app .app-shell.chat-shell .aios-chat-app.sidebar-collapsed > .chat-sidebar-backdrop {
    display: block;
    opacity: 0;
    pointer-events: none;
  }

  html body #app .app-shell.chat-shell .aios-live-workspace,
  html body #app .app-shell.chat-shell .aios-chat-main {
    min-width: 0;
    min-height: 0;
    width: 100%;
    height: 100%;
  }

  html body #app .app-shell.chat-shell .aios-chat-main {
    position: relative;
    display: grid;
    grid-template-rows: 64px minmax(0, 1fr) auto;
    background: var(--cg-bg);
  }

  html body #app .app-shell.chat-shell .aios-chat-topbar {
    box-sizing: border-box;
    min-width: 0;
    min-height: 64px;
    max-height: 64px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 0;
    border-bottom: 1px solid color-mix(in srgb, var(--cg-line) 70%, transparent);
    background: color-mix(in srgb, var(--cg-bg) 94%, transparent);
    z-index: var(--z-shell);
  }

  html body #app .app-shell.chat-shell .chat-mobile-app-menu,
  html body #app .app-shell.chat-shell .aios-chat-topbar > .chat-sidebar-toggle,
  html body #app .app-shell.chat-shell .chat-mobile-title,
  html body #app .app-shell.chat-shell .chat-mobile-new,
  html body #app .app-shell.chat-shell .chat-mobile-exit {
    display: none !important;
    visibility: hidden;
    position: absolute;
    width: 0;
    height: 0;
    pointer-events: none;
  }

  .chat-header-context {
    min-width: 96px;
    max-width: 240px;
    display: grid;
    gap: 1px;
  }

  .chat-header-context strong,
  .chat-header-context span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .chat-header-context strong {
    color: var(--cg-text);
    font-size: 14px;
    font-weight: 680;
  }

  .chat-header-context span {
    color: var(--cg-muted);
    font-size: 11px;
  }

  html body #app .app-shell.chat-shell .chat-more-actions {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    margin-left: auto;
    color: var(--cg-text);
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
  }

  html body #app .app-shell.chat-shell .chat-more-actions:hover {
    border-color: var(--cg-line);
    background: var(--cg-surface);
  }

  html body #app .app-shell.chat-shell .chat-more-actions .icon-symbol {
    font-size: 16px;
    letter-spacing: 2px;
  }

  html body #app .app-shell.chat-shell .chat-is-empty .aios-chat-messages {
    grid-row: 2;
    min-height: 0;
    padding: 24px 24px 188px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
  }

  html body #app .app-shell.chat-shell .chat-is-empty .welcome-screen {
    width: min(720px, 100%);
    max-width: 720px;
    min-height: 0;
    margin: 0 auto;
    padding: 0;
    display: grid;
    justify-items: center;
    gap: 10px;
    text-align: center;
  }

  html body #app .app-shell.chat-shell .chat-is-empty .welcome-screen h1 {
    max-width: 680px;
    margin: 0;
    color: var(--cg-text);
    font-size: clamp(26px, 3vw, 40px);
    font-weight: 560;
    letter-spacing: -0.035em;
    line-height: 1.12;
  }

  html body #app .app-shell.chat-shell .chat-is-empty .welcome-screen p {
    max-width: 600px;
    margin: 0;
    color: var(--cg-muted);
    font-size: 15px;
    line-height: 1.45;
  }

  html body #app .app-shell.chat-shell .chat-is-empty .composer-wrap {
    box-sizing: border-box;
    position: absolute;
    top: 50%;
    left: 50%;
    bottom: auto;
    width: min(780px, calc(100% - 48px));
    max-width: 780px;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 14px;
    background: transparent;
    transform: translate(-50%, 46px);
    z-index: var(--z-shell);
  }

  html body #app .app-shell.chat-shell .claude-composer {
    box-sizing: border-box;
    width: 100%;
    max-width: 780px;
    min-height: 64px;
    margin: 0 auto;
    border: 1px solid var(--cg-line);
    border-radius: 24px;
    background: var(--cg-elevated);
    box-shadow: 0 10px 32px rgba(15, 23, 42, 0.08);
  }

  html body #app .app-shell.chat-shell .chat-is-empty .welcome-prompts {
    width: 100%;
    max-width: 760px;
    margin: 0 auto;
    padding: 0 8px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    pointer-events: auto;
  }

  html body #app .app-shell.chat-shell .chat-is-empty .suggestion-card {
    min-height: 44px;
    padding: 9px 14px;
    color: var(--cg-muted);
    text-align: left;
    border: 1px solid var(--cg-line);
    border-radius: 14px;
    background: transparent;
    box-shadow: none;
  }

  html body #app .app-shell.chat-shell .chat-is-empty .suggestion-card:hover {
    color: var(--cg-text);
    background: var(--cg-surface);
  }

  html body #app .app-shell.chat-shell .chat-is-active .aios-chat-messages {
    min-height: 0;
    padding-bottom: 18px;
    overflow-y: auto;
  }

  html body #app .app-shell.chat-shell .chat-is-active .composer-wrap {
    box-sizing: border-box;
    position: relative;
    inset: auto;
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 12px 20px max(14px, env(safe-area-inset-bottom));
    display: grid;
    background: var(--cg-bg);
    transform: none;
    z-index: var(--z-shell);
  }

  html body #app .app-shell.chat-shell .chat-is-active .claude-composer {
    max-width: 780px;
  }

  html body #app .app-shell.chat-shell .chat-actions {
    display: none;
  }

  .chat-rail-button:focus-visible,
  .chat-rail-spaces .nav-item:focus-visible,
  .chat-more-actions:focus-visible,
  .chat-history-head .icon-button:focus-visible {
    outline: 2px solid var(--cg-accent);
    outline-offset: 2px;
  }

  @media (max-width: 1100px) {
    html body #app .app-shell.chat-shell .chat-selectors,
    html body #app .app-shell.chat-shell .chat-model-menu {
      display: none;
    }
  }

  @media (max-width: 820px) {
    html body #app .app-shell.chat-shell {
      --chat-mobile-rail: 60px;
      width: 100vw;
      height: 100dvh;
      display: grid;
      grid-template-columns: minmax(0, 1fr);
      grid-template-rows: var(--chat-mobile-rail) minmax(0, 1fr);
    }

    html body #app .app-shell.chat-shell:has(.chat-workspace-rail:has(.chat-rail-spaces-details[open])) {
      grid-template-columns: minmax(0, 1fr);
    }

    html body #app .app-shell.chat-shell > .chat-workspace-rail {
      position: relative;
      width: 100vw;
      height: var(--chat-mobile-rail);
      min-height: var(--chat-mobile-rail);
      padding: max(6px, env(safe-area-inset-top)) 8px 6px;
      display: flex;
      flex-direction: row;
      align-items: center;
      gap: 4px;
      border-right: 0;
      border-bottom: 1px solid var(--cg-line);
      overflow: visible;
      z-index: calc(var(--z-drawer) + 3);
    }

    html body #app .app-shell.chat-shell > .chat-workspace-rail:has(.chat-rail-spaces-details[open]) {
      --chat-mobile-rail-position: fixed;
      --chat-mobile-rail-inset: 0 auto 0 0;
      --chat-mobile-rail-width: min(360px, 100vw);
      --chat-mobile-rail-height: 100dvh;
      --chat-mobile-rail-padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
      --chat-mobile-rail-direction: column;
      align-items: stretch;
      gap: 8px;
      border-right: 1px solid var(--cg-line);
      border-bottom: 0;
      overflow: hidden;
      box-shadow: 18px 0 48px rgba(15, 23, 42, 0.18);
      z-index: calc(var(--z-drawer) + 3) !important;
    }

    html body #app .app-shell.chat-shell:has(.chat-rail-spaces-details[open]) > .main {
      visibility: hidden;
      pointer-events: none;
    }

    .chat-rail-home {
      width: 46px;
      min-width: 46px;
      min-height: 46px;
    }

    .chat-rail-home .brand-mark {
      width: 46px;
      min-width: 46px;
      height: 40px;
    }

    .chat-rail-home .aios-logo-image {
      width: 43px;
      height: 30px;
    }

    .chat-rail-home > span:last-child,
    .chat-rail-label {
      position: absolute;
      width: 1px;
      height: 1px;
      overflow: hidden;
      clip-path: inset(50%);
    }

    .chat-rail-primary {
      min-width: 0;
      display: flex;
      align-items: center;
      gap: 4px;
    }

    .chat-rail-button,
    .chat-workspace-rail:not(:has(.chat-rail-spaces-details[open])) .chat-rail-button {
      width: 44px;
      min-width: 44px;
      height: 44px;
      min-height: 44px;
      padding: 0;
      display: grid;
      grid-template-columns: 1fr;
      place-items: center;
    }

    .chat-rail-account {
      margin: 0 0 0 auto;
    }

    .chat-rail-account .account-avatar {
      width: 34px;
      min-width: 34px;
      height: 34px;
    }

    .chat-rail-spaces-details[open] > .chat-rail-spaces {
      box-sizing: border-box;
      position: relative;
      inset: auto;
      width: 100%;
      height: 100%;
      padding: 4px 0;
      display: flex;
      flex-direction: column;
      border: 0;
      overflow-y: auto;
    }

    html body #app .app-shell.chat-shell > .main,
    html body #app .app-shell.chat-shell .content,
    html body #app .app-shell.chat-shell .content:has(.aios-chat-app),
    html body #app .app-shell.chat-shell .aios-chat-app,
    html body #app .app-shell.chat-shell .aios-chat-app.chat-roomy {
      width: 100vw;
      height: calc(100dvh - var(--chat-mobile-rail));
      min-height: 0;
    }

    html body #app .app-shell.chat-shell .aios-chat-main {
      grid-template-rows: 56px minmax(0, 1fr) auto;
    }

    html body #app .app-shell.chat-shell .aios-chat-topbar {
      min-height: 56px;
      max-height: 56px;
      padding: 6px 10px;
    }

    .chat-header-context {
      max-width: calc(100vw - 92px);
    }

    html body #app .app-shell.chat-shell .chat-is-empty .aios-chat-messages {
      padding: 18px 16px 164px;
    }

    html body #app .app-shell.chat-shell .chat-is-empty .welcome-screen {
      gap: 8px;
    }

    html body #app .app-shell.chat-shell .chat-is-empty .welcome-screen h1 {
      font-size: clamp(23px, 7vw, 31px);
    }

    html body #app .app-shell.chat-shell .chat-is-empty .welcome-screen p {
      max-width: 440px;
      font-size: 14px;
    }

    html body #app .app-shell.chat-shell .chat-is-empty .composer-wrap {
      top: 48%;
      width: calc(100% - 24px);
      transform: translate(-50%, 44px);
    }

    html body #app .app-shell.chat-shell .claude-composer {
      min-height: 58px;
      border-radius: 20px;
    }

    html body #app .app-shell.chat-shell .chat-is-empty .welcome-prompts {
      padding: 0;
      display: grid;
      grid-template-columns: minmax(0, 1fr);
      gap: 6px;
    }

    html body #app .app-shell.chat-shell .chat-is-empty .suggestion-card {
      width: 100%;
      min-height: 44px;
    }

    html body #app .app-shell.chat-shell .chat-is-empty .suggestion-card:nth-child(n + 3) {
      display: none;
    }

    html body #app .app-shell.chat-shell .chat-is-active .composer-wrap {
      padding: 10px 10px max(10px, env(safe-area-inset-bottom));
    }

    html body #app .app-shell.chat-shell .aios-chat-sidebar {
      width: min(348px, calc(100% - 12px));
      border-radius: 0 18px 18px 0;
    }
  }

  @media (max-width: 380px) {
    .chat-rail-home {
      width: 40px;
      min-width: 40px;
    }

    .chat-rail-home .brand-mark {
      width: 40px;
      min-width: 40px;
    }

    .chat-rail-button,
    .chat-workspace-rail:not(:has(.chat-rail-spaces-details[open])) .chat-rail-button {
      width: 42px;
      min-width: 42px;
      height: 44px;
    }

    html body #app .app-shell.chat-shell .chat-is-empty .welcome-screen p {
      display: none;
    }

    html body #app .app-shell.chat-shell .chat-is-empty .aios-chat-messages {
      padding-bottom: 152px;
    }
  }

  @media (max-height: 650px) {
    html body #app .app-shell.chat-shell .chat-is-empty .welcome-screen p {
      display: none;
    }

    html body #app .app-shell.chat-shell .chat-is-empty .welcome-prompts {
      display: none;
    }

    html body #app .app-shell.chat-shell .chat-is-empty .composer-wrap {
      transform: translate(-50%, 30px);
    }
  }

  .chat-rail-spaces-details {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    grid-template-rows: 48px minmax(0, 1fr);
    overflow: hidden;
  }

  .chat-rail-spaces-details:not([open]) {
    flex: 0 0 48px;
    grid-template-rows: 48px;
  }

  .chat-rail-spaces-details[open] {
    grid-template-rows: minmax(0, 1fr);
    overflow: visible;
  }

  .chat-rail-spaces-details[open] > .chat-rail-spaces-toggle {
    position: fixed;
    top: max(12px, env(safe-area-inset-top));
    left: calc(var(--chat-rail-expanded) - 56px);
    width: 44px;
    min-width: 44px;
    height: 44px;
    padding: 0;
    grid-template-columns: 1fr;
    place-items: center;
    z-index: calc(var(--z-drawer) + 1);
  }

  .chat-rail-spaces-details[open] > .chat-rail-spaces-toggle .chat-rail-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .chat-rail-spaces-details > summary {
    list-style: none;
  }

  .chat-rail-spaces-details > summary::-webkit-details-marker {
    display: none;
  }

  html body #app .chat-workspace-rail:not(:has(.chat-rail-spaces-details[open])) > .school-chip,
  html body #app .chat-workspace-rail:not(:has(.chat-rail-spaces-details[open])) .sidebar-status-row {
    display: none !important;
  }

  html body #app .chat-workspace-rail:not(:has(.chat-rail-spaces-details[open])) > .sidebar-footer {
    margin-top: auto !important;
    padding: 0 !important;
    display: block !important;
    border: 0;
  }

  html body #app .chat-workspace-rail:not(:has(.chat-rail-spaces-details[open])) .sidebar-account {
    width: 100% !important;
    min-height: 48px !important;
    padding: 4px !important;
    display: grid !important;
    grid-template-columns: 1fr !important;
    border-radius: 12px !important;
  }

  html body #app .chat-workspace-rail:not(:has(.chat-rail-spaces-details[open])) .sidebar-account > div {
    display: none !important;
  }

  @media (min-width: 821px) {
    html body #app .app-shell.chat-shell {
      grid-template-columns: var(--chat-rail-size) minmax(0, 1fr) !important;
    }

    html body #app .app-shell.chat-shell:has(.chat-rail-spaces-details[open]) {
      --chat-rail-current: var(--chat-rail-expanded);
      grid-template-columns: var(--chat-rail-expanded) minmax(0, 1fr) !important;
    }

    html body #app .app-shell.chat-shell > .chat-workspace-rail {
      position: fixed !important;
      inset: 0 auto 0 0 !important;
      width: var(--chat-rail-current, var(--chat-rail-size)) !important;
      height: 100vh !important;
      max-height: none !important;
      margin: 0 !important;
      border-radius: 0 !important;
      padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom));
      display: flex !important;
      flex-direction: column;
    }

    html body #app .app-shell.chat-shell > .main {
      grid-column: 2;
    }

    html body #app .app-shell.chat-shell .content:has(.aios-chat-app) {
      padding: 0 !important;
    }

    html body #app .app-shell.chat-shell .aios-chat-app {
      height: 100dvh !important;
    }

    html body #app .app-shell.chat-shell .chat-more-actions {
      min-width: 44px !important;
      min-height: 44px !important;
    }

    html body #app .app-shell.chat-shell .aios-chat-sidebar {
      width: min(348px, calc(100% - 20px)) !important;
    }

    html body #app .app-shell.chat-shell .chat-is-empty .composer-wrap {
      inset: 50% auto auto 50% !important;
      width: min(780px, calc(100% - 48px)) !important;
      transform: translate(-50%, -50px) !important;
    }

    html body #app .app-shell.chat-shell .chat-is-empty .welcome-screen {
      position: fixed !important;
      inset: calc(50% - 190px) auto auto calc(50% + 38px) !important;
      min-height: 0 !important;
      padding: 0 !important;
      transform: translateX(-50%) !important;
    }
  }

  @media (max-width: 820px) {
    html body #app .app-shell.chat-shell {
      display: grid !important;
      grid-template-columns: minmax(0, 1fr) !important;
      grid-template-rows: 60px minmax(0, 1fr) !important;
    }

    html body #app .app-shell.chat-shell > .chat-workspace-rail {
      position: var(--chat-mobile-rail-position, relative) !important;
      inset: var(--chat-mobile-rail-inset, auto) !important;
      width: var(--chat-mobile-rail-width, 100vw) !important;
      height: var(--chat-mobile-rail-height, 60px) !important;
      margin: 0 !important;
      padding: var(--chat-mobile-rail-padding, max(6px, env(safe-area-inset-top)) 8px 6px) !important;
      display: flex !important;
      flex-direction: var(--chat-mobile-rail-direction, row) !important;
    }

    html body #app .app-shell.chat-shell > .main,
    html body #app .app-shell.chat-shell .content:has(.aios-chat-app),
    html body #app .app-shell.chat-shell .aios-chat-app {
      height: calc(100dvh - 60px) !important;
    }

    html body #app .app-shell.chat-shell .chat-more-actions {
      min-width: 44px !important;
      min-height: 44px !important;
    }

    html body #app .app-shell.chat-shell .claude-composer .icon-button,
    html body #app .app-shell.chat-shell .claude-composer .primary,
    html body #app .app-shell.chat-shell .claude-composer .secondary {
      min-width: 44px !important;
      min-height: 44px !important;
    }

    html body #app .app-shell.chat-shell .chat-header-context {
      display: none;
    }

    html body #app .app-shell.chat-shell .aios-chat-sidebar {
      inset: 60px auto 0 0 !important;
      height: calc(100dvh - 60px) !important;
    }

    html body #app .app-shell.chat-shell .chat-sidebar-backdrop {
      position: fixed !important;
      inset: 60px 0 0 !important;
    }

    html body #app .chat-workspace-rail:not(:has(.chat-rail-spaces-details[open])) .chat-rail-primary {
      flex: 0 0 92px;
    }

    html body #app .chat-workspace-rail .chat-rail-button {
      flex: 0 0 44px;
    }

    html body #app .chat-workspace-rail .chat-rail-spaces-toggle {
      min-width: 44px !important;
    }

    html body #app .chat-workspace-rail:not(:has(.chat-rail-spaces-details[open])) > .brand-lockup {
      width: 46px !important;
      min-width: 46px !important;
      height: 46px;
      min-height: 46px !important;
      padding: 0 !important;
      display: grid !important;
    }

    html body #app .chat-workspace-rail:not(:has(.chat-rail-spaces-details[open])) > .brand-lockup > span:not(.brand-mark) {
      display: none !important;
    }

    html body #app .chat-workspace-rail:not(:has(.chat-rail-spaces-details[open])) > .sidebar-footer {
      margin: 0 0 0 auto !important;
    }

    html body #app .chat-workspace-rail:not(:has(.chat-rail-spaces-details[open])) .sidebar-account {
      width: 44px !important;
      min-width: 44px !important;
      height: 44px !important;
      min-height: 44px !important;
      padding: 4px !important;
      grid-template-columns: 1fr !important;
    }

    html body #app .chat-workspace-rail:not(:has(.chat-rail-spaces-details[open])) .sidebar-account > div {
      display: none !important;
    }

    .chat-rail-spaces-details {
      display: block;
      overflow: visible;
    }

    .chat-rail-spaces-details[open] > .chat-rail-spaces {
      position: relative !important;
      inset: auto !important;
      width: 100% !important;
      height: 100% !important;
      padding: 4px 0 !important;
      display: flex !important;
      background: var(--cg-sidebar);
      overflow-y: auto !important;
    }

    .chat-rail-spaces-details[open] > .chat-rail-spaces-toggle {
      top: max(12px, env(safe-area-inset-top));
      right: 12px;
      left: auto;
    }

    html body #app .app-shell.chat-shell .chat-is-empty .welcome-screen {
      position: fixed !important;
      top: 110px !important;
      left: 50% !important;
      width: calc(100% - 32px) !important;
      transform: translateX(-50%) !important;
    }

    html body #app .app-shell.chat-shell .chat-is-empty .composer-wrap {
      position: fixed !important;
      top: 50% !important;
      left: 50% !important;
      bottom: auto !important;
      width: calc(100% - 24px) !important;
      height: auto !important;
      min-height: 0 !important;
      transform: translateX(-50%) !important;
    }

    html body #app .app-shell.chat-shell .chat-is-empty .welcome-prompts {
      position: absolute !important;
      top: calc(100% + 12px) !important;
      left: 0 !important;
      bottom: auto !important;
      width: 100% !important;
      display: grid !important;
      transform: none !important;
    }

    html body #app .app-shell.chat-shell .chat-is-empty .suggestion-card:nth-child(n + 2) {
      display: none !important;
    }
  }

  @media (max-width: 820px) and (max-height: 650px) {
    html body #app .app-shell.chat-shell .chat-is-empty .welcome-prompts {
      display: none !important;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    html body #app .app-shell.chat-shell .aios-chat-sidebar,
    html body #app .app-shell.chat-shell .chat-sidebar-backdrop,
    .chat-workspace-rail,
    .chat-rail-button {
      transition: none;
      animation: none;
    }
  }

  html body #app .app-shell.chat-shell .chat-is-empty .welcome-screen .welcome-prompts-mobile {
    display: none !important;
  }
  }

  @media (max-width: 820px) {
    html body #app .app-shell.chat-shell .chat-header-context,
    html body #app .app-shell.chat-shell .chat-more-actions,
    html body #app .app-shell.chat-shell .chat-history-head,
    html body #app .app-shell.chat-shell .welcome-prompts-desktop {
      display: none !important;
    }
  }

  /* Rail chrome: the sidebar carried a blue optical edge (liquid-glass inset)
     and a divider above the account button. Both read as stray lines in the
     chat shell, so the rail is flat and its whole surface is the toggle. */
  html body #app .app-shell.chat-shell > .chat-workspace-rail {
    border-right: 0 !important;
    box-shadow: none !important;
    cursor: pointer;
  }

  html body #app .app-shell.chat-shell > .chat-workspace-rail > .sidebar-footer {
    padding-top: 0 !important;
    border-top: 0 !important;
  }

  html body #app .app-shell.chat-shell > .chat-workspace-rail button,
  html body #app .app-shell.chat-shell > .chat-workspace-rail summary {
    cursor: pointer;
  }
}
