/* Phone shell docks and sheets. Navigation is the sliding sidebar
   (mobile-sidebar.css, 2026-11-02; the bottom tab bar this file was named for
   is gone), so pages and docks meet the bottom safe area themselves.
   --ms-below-fold reaches the true screen bottom on iOS; --ms-ios-nudge moves
   only top surfaces. */
.agents-conversation-back { display: none; }
@media (max-width: 768px) {
  /* Pages clear the home indicator. */
  .kairos-redesign #view-content.view:not(.chat-layout):not(.settings-mobile-page):not(.ms-home):not(:has(.mf-home, .mf-session)) {
    padding-bottom: calc(max(24px, var(--mobile-safe-bottom, env(safe-area-inset-bottom, 0px))));
  }
  .kairos-redesign .ms-launch-bottom { padding-bottom: calc(max(var(--mobile-safe-bottom, env(safe-area-inset-bottom, 0px)), 12px)); }
  /* Forge New reserves the bottom group's actual flex size. Only the intro
     scrolls, so activity updates and composer growth cannot cover its copy.
     Safe centering keeps the start reachable when the intro overflows. */
  .kairos-redesign .mf-project .ms-launch { overflow: hidden; }
  .kairos-redesign .mf-project .ms-intro { flex: 1 1 0; min-height: 0; padding-block: 0; overflow-y: auto; justify-content: safe center; }
  .kairos-redesign .mf-project .ms-intro > * { flex-shrink: 0; }
  .kairos-redesign .mf-project .ms-intro > :first-child { margin-top: 12px; }
  .kairos-redesign .mf-project .ms-intro > :last-child { margin-bottom: 12px; }
  .kairos-redesign .mf-project .ms-launch-bottom { position: relative; display: flex; flex-direction: column; flex: 0 1 auto; min-height: 0; max-height: 100%; box-sizing: border-box; }
  .kairos-redesign .mf-project .ms-activity-slot { min-height: 0; overflow-y: auto; }
  .kairos-redesign .mf-project .ms-launch-bottom > :not(.ms-activity-slot) { flex-shrink: 0; }
  @media (max-height: 700px) {
    .kairos-redesign .mf-project .ms-finished-deck > button,
    .kairos-redesign .mf-project .forge-composer-hint { display: none; }
  }
  .kairos-redesign .ms-history { padding-bottom: calc(max(var(--mobile-safe-bottom, env(safe-area-inset-bottom, 0px)), 12px)); }
  .kairos-redesign .mf-dashboard-body { padding-bottom: calc(max(24px, var(--mobile-safe-bottom, env(safe-area-inset-bottom, 0px)))); }

  /* Pushed pages: docks clear the home indicator. */
  .kairos-redesign .ms-conversation:not(.ms-launch-chat) .chat-composer-dock {
    padding-bottom: calc(max(12px, var(--mobile-safe-bottom, env(safe-area-inset-bottom, 0px))));
  }
  .kairos-redesign #view-content.view:has(.mf-session):not(.chat-layout):not(.settings-mobile-page):not(.ms-home) { padding-bottom: 0; }
  .kairos-redesign:is(:has(.forge-transcript-composer), :has(.ms-git-dock)) .ms-activity-floating {
    bottom: calc(max(12px, var(--mobile-safe-bottom, env(safe-area-inset-bottom, 0px))) + 74px);
  }
  .kairos-redesign .ms-conversation .chat-input-right .model-picker-menu {
    bottom: calc(100px + var(--mobile-safe-bottom, env(safe-area-inset-bottom, 0px)) - var(--ms-below-fold, 0px));
  }
  /* The live launch dock otherwise uses interface.css's 16px + safe bottom. */
  .kairos-redesign .ms-live-chat .chat-composer-dock {
    padding-bottom: calc(max(12px, var(--mobile-safe-bottom, env(safe-area-inset-bottom, 0px))));
  }
  .kairos-redesign .settings-mobile-page :is(#settings-nav, .settings-content) {
    padding-bottom: calc(max(24px, var(--mobile-safe-bottom, env(safe-area-inset-bottom, 0px))));
  }
  /* The Design board list: its sticky composer sits 10px above the bottom edge, as every dock does. */
  .kairos-redesign #view-content.view:has(.design-composer):not(.chat-layout):not(.settings-mobile-page):not(.ms-home) {
    padding-bottom: calc(max(12px, var(--mobile-safe-bottom, env(safe-area-inset-bottom, 0px))));
  }
  .kairos-redesign .design-composer { padding-bottom: 10px; }

  /* A shared phone back control for agent, team and inbox conversations. */
  .kairos-redesign .agents-workspace.has-conversation .agents-workspace-controls { flex: 1; }
  .kairos-redesign .agents-workspace.has-conversation .agents-conversation-back:not([hidden]) {
    display: inline-grid; place-items: center; width: 44px; height: 44px; min-width: 44px;
    padding: 0; margin-right: auto; border: 1px solid var(--rd-line-strong);
    border-radius: var(--rd-radius-pill); background: var(--rd-surface-solid); color: var(--rd-ink);
    font: 400 28px/1 var(--rd-font-ui); box-shadow: var(--rd-shadow);
  }
  .kairos-redesign .agents-conversation-back:focus-visible { outline: 2px solid var(--rd-focus); outline-offset: 2px; }
  .kairos-redesign .agents-messenger .swarm-header > button:first-child { display: none; }

  /* More: a glass sheet over the page. */
  .kairos-redesign .ms-more-sheet {
    background: color-mix(in srgb, var(--rd-surface-solid) 94%, transparent);
    box-shadow: inset 0 1px 0 rgba(var(--parchment-rgb), .6), 0 -14px 44px rgba(var(--shade-rgb), .16);
  }
  @supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .kairos-redesign .ms-more-sheet {
      background: color-mix(in srgb, var(--rd-surface-solid) 74%, transparent);
      backdrop-filter: blur(30px) saturate(180%); -webkit-backdrop-filter: blur(30px) saturate(180%);
    }
  }
  .kairos-redesign .ms-more-sheet .ms-sheet-heading { margin-bottom: 16px; }
  .kairos-redesign .ms-more-sheet :is(.ms-profile-row, .ms-settings-row) { display: flex; align-items: center; gap: 12px; min-height: 52px; }
  .kairos-redesign .ms-more-sheet .ms-profile-initial {
    flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
    border: 1px solid var(--rd-line-strong); background: var(--rd-surface-2); font-weight: 600;
  }
  .kairos-redesign .ms-more-sheet .ms-profile-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .kairos-redesign .ms-more-sheet .ms-settings-row svg { flex: none; width: 22px; height: 22px; margin-inline: 7px; }

  /* Short screens (a phone on its side): the launch introduction gives way before the composer does. */
  @media (max-height: 480px) {
    .kairos-redesign .ms-intro { min-height: 0; overflow: hidden; }
  }
}
/* Round 2 phone shell: shared geometry and motion; Classic has no matching rules. */
@media (max-width: 768px) {
  .kairos-redesign :is(.ms-sheet, .ms-tab-sheet, .permission-dialog:not(.agent-inline-permission), .question-dialog) {
    position: fixed; inset: auto 0 calc(var(--ms-keyboard, 0px) - var(--ms-below-fold, 0px)); margin: 0; width: 100%; max-width: none;
    max-height: min(90dvh, var(--ms-sheet-height, 90dvh)); height: auto; box-sizing: border-box; overflow: auto;
    border: 1px solid var(--rd-line); border-bottom: 0; border-radius: 32px 32px 0 0;
    background: var(--rd-surface-solid); color: var(--rd-ink); box-shadow: 0 -12px 40px rgba(var(--shade-rgb), .2);
    backdrop-filter: none; -webkit-backdrop-filter: none; font-family: var(--rd-font-ui);
  }
  /* Full sheets cover the visible screen below the status bar. Compact sheets
     keep the content height and cap above; --mobile-safe-top includes the nudge. */
  .kairos-redesign .ms-sheet.ms-sheet-full {
    height: calc(var(--ms-sheet-height, 100dvh) - var(--mobile-safe-top, env(safe-area-inset-top, 0px)));
    max-height: calc(var(--ms-sheet-height, 100dvh) - var(--mobile-safe-top, env(safe-area-inset-top, 0px)));
  }
  .kairos-redesign .ms-tab-sheet.ms-more-sheet { max-height: 88dvh; background: color-mix(in srgb, var(--rd-surface-solid) 94%, transparent); backdrop-filter: blur(30px) saturate(180%); -webkit-backdrop-filter: blur(30px) saturate(180%); }
  .kairos-redesign :is(.ms-sheet, .ms-tab-sheet, .permission-dialog, .question-dialog)::backdrop { background: rgba(var(--shade-rgb), .38); animation: rd-opacity var(--rd-dur-fade) var(--rd-ease) both; }
  .kairos-redesign :is(.ms-sheet, .permission-dialog:not(.agent-inline-permission), .question-dialog) { padding: 0 20px max(28px, env(safe-area-inset-bottom, 0px)); }
  .kairos-redesign .ms-sheet-panel { padding-inline: 20px; }
  .kairos-redesign :is(.ms-sheet-grabber, .ms-sheet-grab) { display: block; position: relative; flex: none; width: 64px; min-height: 44px; height: 44px; margin: 0 auto; padding: 0; border: 0; background: transparent; touch-action: none; box-shadow: none; }
  .kairos-redesign :is(.ms-sheet-grabber, .ms-sheet-grab)::after { content: ''; display: block; position: static; width: 42px; height: 5px; margin: auto; border-radius: var(--rd-radius-pill); background: var(--rd-line-strong); }
  /* The grab handle is a 64x44 hit area; its focus ring hugs the bar as a pill instead of the box. */
  .kairos-redesign :is(.ms-sheet-grabber, .ms-sheet-grab):focus-visible { outline: 2px solid var(--rd-focus); outline-offset: -10px; border-radius: var(--rd-radius-pill); }
  .kairos-redesign :is(.ms-sheet-header, .ms-more-header) { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 0 16px; }
  .kairos-redesign :is(.ms-sheet-header h2, .ms-sheet-heading) { margin: 0; font: italic 600 32px/1.1 var(--rd-font-title); }
  .kairos-redesign .ms-more-sheet .ms-sheet-heading { margin: 0; }
  .kairos-redesign :is(.ms-sheet-close, .ms-sheet-header > button) { flex: none; min-width: 46px; min-height: 46px; padding: 0 12px; border: 1px solid var(--rd-line); border-radius: var(--rd-radius-pill); background: var(--rd-ground); box-shadow: none; color: var(--rd-ink); font: 500 12px var(--rd-font-ui); cursor: pointer; }
  .kairos-redesign .ms-sheet-body { padding: 0; overflow: auto; min-height: 0; }
  /* Tool panels own their dock's keyboard and safe-area clearance. */
  .kairos-redesign .ms-sheet:has(.ms-sheet-body > .mf-tool) { padding-bottom: 0; }
  .kairos-redesign .ms-tab-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .kairos-redesign .ms-tab-tile { min-height: 84px !important; border-radius: 22px; background: var(--rd-ground); box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; border: 1px solid var(--rd-line-strong); font-size: 13px !important; }
  .kairos-redesign .ms-group-label { margin: 18px 0 10px; font: 500 11px var(--rd-font-ui); text-transform: uppercase; letter-spacing: .16em; color: var(--rd-ink-dim); }
  .kairos-redesign .ms-more-sheet .ms-profile-initial { width: 44px; height: 44px; background: var(--rd-primary-bg); color: var(--rd-primary-fg); font: italic 600 22px var(--rd-font-title); }

  .kairos-redesign .ms-model-root { display: flex; flex-direction: column; gap: 12px; }
  .kairos-redesign .ms-model-root > input { width: 100%; min-height: 52px; border-radius: var(--rd-radius-pill); padding: 0 18px; border: 1px solid var(--rd-line-strong); background: var(--rd-ground); color: var(--rd-ink); }
  .kairos-redesign .ms-model-menu { position: static; max-height: none; padding: 0; border-radius: 24px; box-shadow: none; background: var(--rd-surface-solid); }
  .kairos-redesign .ms-model-menu .model-picker-item { display: flex; align-items: center; width: 100%; min-height: 54px; padding: 14px 16px; border-radius: 0; border-bottom: 1px solid var(--rd-line); color: var(--rd-ink); }
  .kairos-redesign .ms-model-menu .model-picker-item.active { background: var(--rd-ground); }
  .kairos-redesign .ms-model-menu .model-picker-item.active::after { content: ''; flex: 0 0 20px; width: 20px; height: 20px; margin-left: auto; box-sizing: border-box; border: 6px solid var(--rd-ink); border-radius: 50%; }
  .kairos-redesign .ms-model-menu .model-effort-btn { min-height: 42px; border: 1px solid var(--rd-line-strong); border-radius: var(--rd-radius-pill); background: var(--rd-ground); color: var(--rd-ink); }
  .kairos-redesign .ms-model-menu .model-effort-btn.active { background: var(--rd-primary-bg); color: var(--rd-primary-fg); }
  .kairos-redesign .ms-provider-heading { font: 500 11px var(--rd-font-ui); text-transform: uppercase; letter-spacing: .16em; }

  .kairos-redesign .question-dialog .question-card { max-height: none; padding: 0; border: 0; border-radius: 0; background: var(--rd-surface-solid); color: var(--rd-ink); }
  .kairos-redesign .chat-question-host .question-dialog .question-card { max-height: 65dvh; }
  .kairos-redesign .chat-question-host .question-dialog .question-card::before { display: none; }
  .kairos-redesign .question-head { flex-wrap: wrap; margin-bottom: 16px; }
  .kairos-redesign .question-head h2 { flex: 1; font: 500 11px/1.5 var(--rd-font-ui); letter-spacing: .12em; text-transform: uppercase; color: var(--rd-ink-dim); }
  .kairos-redesign .question-pulse { background: var(--rd-ink); animation: none; }
  .kairos-redesign .question-item legend { font: 600 26px/1.2 var(--rd-font-title); margin-bottom: 12px; }
  .kairos-redesign .question-option { min-height: 52px; padding: 10px 16px; border-radius: 18px; border-color: var(--rd-line-strong); background: var(--rd-ground); font-size: 15px; }
  .kairos-redesign .question-option:has(input:checked) { border-color: var(--rd-ink); background: var(--rd-surface-solid); }
  .kairos-redesign .question-option input { width: 20px; height: 20px; min-width: 20px; min-height: 20px; accent-color: var(--rd-ink); }
  .kairos-redesign .question-description { color: var(--rd-ink-dim); }
  .kairos-redesign .question-item input[type=text] { min-height: 52px; border: 1px dashed var(--rd-line-strong); border-radius: 18px; padding-inline: 16px; background: transparent; color: var(--rd-ink); font-size: 16px; }
  .kairos-redesign .question-footer { background: var(--rd-surface-solid); }
  .kairos-redesign .question-actions .btn { min-height: 52px; border-radius: var(--rd-radius-pill); }
  .kairos-redesign .question-actions .primary { background: var(--rd-primary-bg); color: var(--rd-primary-fg); }
  .kairos-redesign .permission-head .ms-sheet-close { margin-left: auto; }
  .kairos-redesign .permission-choices { display: flex; flex-direction: column; gap: 8px; }
  .kairos-redesign .permission-choices .btn { flex: none; width: 100%; min-height: 52px; border-radius: 18px; text-align: left; background: var(--rd-ground); border-color: var(--rd-line-strong); color: var(--rd-ink); }
  .kairos-redesign .permission-choices .btn.primary { background: var(--rd-primary-bg); color: var(--rd-primary-fg); }
  .kairos-redesign .permission-choices .btn.danger { color: var(--danger); }
  .kairos-redesign :is(.permission-target, .permission-args pre) { border-radius: 18px; padding: 14px 16px; }
  .kairos-redesign .ms-sheet .bg-tasks-panel { padding: 0; background: var(--rd-surface-solid); }
  .kairos-redesign .bg-tasks-list { gap: 10px; }
  .kairos-redesign .ms-sheet .bg-task-row { min-height: 90px; padding: 14px 16px; border-radius: 22px; background: var(--rd-ground); border-color: var(--rd-line-strong); color: var(--rd-ink); }
  .kairos-redesign .ms-sheet :is(.bg-task-top, .bg-task-elapsed, .bg-task-activity) { color: var(--rd-ink-dim); }
  .kairos-redesign .ms-sheet :is(.bg-task-status-running, .bg-task-status-waiting) { color: var(--rd-ink); }

  .kairos-redesign .ms-notifications h3 { font: 500 11px var(--rd-font-ui); text-transform: uppercase; letter-spacing: .16em; color: var(--rd-ink-dim); }
  .kairos-redesign .ms-notification-row { width: 100%; padding: 14px 16px; min-height: 56px; border: 1px solid var(--rd-line-strong); border-radius: 22px; text-align: left; background: var(--rd-ground); color: var(--rd-ink); font: 400 15px/1.4 var(--rd-font-ui); margin-bottom: 8px; }
  .kairos-redesign .ms-notification-live { padding: 16px; border-radius: 26px; background: var(--rd-primary-bg); color: var(--rd-primary-fg); }
  .kairos-redesign .ms-notification-live :is(h3, .ms-notification-row) { background: transparent; color: inherit; }

  .kairos-redesign .ms-header-row:has(.ms-root-title) { height: auto; grid-template-columns: minmax(0, 1fr) 46px; }
  .kairos-redesign .ms-root-title { margin: 0; grid-column: 1; font: italic 600 38px/1.1 var(--rd-font-title); }
  .kairos-redesign .ms-header-row:has(.ms-root-title) > .ms-switch { grid-column: 1 / -1; grid-row: 2; justify-self: stretch; width: auto; margin-top: 12px; }
  .kairos-redesign .ms-header-row:has(#ms-tab-0) { grid-template-columns: 46px minmax(0, 1fr) 46px; }
  .kairos-redesign .ms-header-row:has(#ms-tab-0) > .ms-switch { grid-column: 2; align-self: start; width: min(174px, 100%); }
  .kairos-redesign .ms-header-row:has(#ms-tab-0) > .ms-notifications-open { grid-column: 3; }
  .kairos-redesign .ms-notifications-open { grid-column: 2; grid-row: 1; width: 46px; height: 46px; min-width: 46px; border: 1px solid var(--rd-line-strong); border-radius: var(--rd-radius-pill); background: var(--rd-surface-solid); color: var(--rd-ink); font: 500 10px var(--rd-font-ui); }
  .kairos-redesign .mf-dashboard-title { text-align: left; font: italic 600 38px/46px var(--rd-font-title); }
  .kairos-redesign .mf-dashboard .ms-header-row { grid-template-columns: minmax(0, 1fr) 46px; }
  .kairos-redesign :is(.ms-chat-back, .mf-session-header > button) { min-width: 46px; min-height: 46px; border-radius: var(--rd-radius-pill); }

  /* Override the older shell's local entrances with phase 1's motion vocabulary. */
  /* Release the sheet transform after opening, including shared panel dialogs.
     Filling forwards retains an identity matrix and reanchors fixed children. */
  .kairos-redesign .rd-sheet-in:not(#_) { animation: rd-sheet var(--rd-dur-sheet) var(--rd-spring) backwards; }
  /* Reveal phone detail pages inside their layout bounds. Translating a full
     page inflates its parent scrollWidth during the push, even with overflow
     hidden, and reanchors fixed children such as drawers and artifact panes. */
  .kairos-redesign .rd-push-in:not(#_) { animation: ms-chat-reveal var(--rd-dur-push) var(--rd-ease) both; }
  .kairos-redesign .rd-enter-rise:not(#_) { animation: rd-rise var(--rd-dur-fade) var(--rd-ease) both; }
  .kairos-redesign .ms-switch-thumb { transition: transform var(--rd-dur-tab) var(--rd-ease); }
  .kairos-redesign .ms-page-track { transition: transform var(--rd-dur-fade) var(--rd-ease); }
  @media (prefers-reduced-motion: reduce) {
    .kairos-redesign :is(.rd-sheet-in, .rd-push-in, .rd-enter-rise, .rd-scrim-in, .rd-stagger > *) { animation: rd-opacity 120ms var(--rd-ease) both !important; animation-delay: 0ms !important; transform: none; }
    .kairos-redesign :is(.ms-sheet, .ms-tab-sheet, .permission-dialog, .question-dialog)::backdrop { animation: rd-opacity 120ms var(--rd-ease) both; }
  }
}

@media (max-width: 768px) {
  .kairos-redesign .ms-sheet .ms-model-menu .model-effort-row { display: flex; flex-wrap: wrap; gap: 6px; padding-block: 12px; }
  .kairos-redesign .ms-notifications-open { display: grid; place-items: center; padding: 0; }
}
@media (max-width: 768px) {
  /* Release the entrance transform so existing back/edge drags can own it. */
  .kairos-redesign [data-ms-entered=true]:not(.rd-push-in):not(.rd-enter-rise):not(#_) { animation: none; }
  /* Motion board: tab titles lead the row; pushed Settings keeps Back left. */
  .kairos-redesign #view-content > .view-header:first-child h2,
  .kairos-redesign #view-content > :first-child > .view-header:first-child h2,
  .kairos-redesign #view-content .tool-store-view .view-header h2,
  .kairos-redesign #view-content .agents-workspace-bar > h2 {
    left: 20px; right: 20px; height: 46px; text-align: left;
    font: italic 600 38px/46px var(--rd-font-title);
  }
  .kairos-redesign .ms-header,
  .kairos-redesign :is(.mf-dashboard, .mf-project) .ms-header { padding-inline: max(20px, env(safe-area-inset-left, 0px)) max(20px, env(safe-area-inset-right, 0px)); }
  .kairos-redesign .mf-dashboard .ms-header-row { height: 46px; }
  .kairos-redesign .mf-project .ms-header-row:has(.ms-root-title) { grid-template-columns: minmax(0, 1fr) 46px 46px; }
  .kairos-redesign .mf-project .ms-notifications-open { grid-column: 3; }
  .kairos-redesign .mf-project .mf-project-trigger { grid-column: 2; grid-row: 1; display: grid; place-items: center; width: 46px; height: 46px; padding: 0; border: 1px solid var(--rd-line-strong); border-radius: 999px; background: var(--rd-surface-solid); color: var(--rd-ink); }
  .kairos-redesign .settings-mobile-page .settings-titlebar { padding-inline: 20px; justify-content: flex-start; }
  .kairos-redesign .settings-mobile-page .settings-titlebar .title { margin-left: 0; text-align: left; min-height: 46px; }
  .kairos-redesign .settings-mobile-title { font: italic 600 32px/46px var(--rd-font-title); }
  .kairos-redesign .settings-mobile-back { width: 46px; height: 46px; min-width: 46px; margin-left: 0; border-radius: 999px; }
}

/* Mobile v2 board fidelity. Shell-owned surfaces only; page views own their content. */
@media (max-width: 768px) {
  .kairos-redesign .ms-tab-sheet.ms-more-sheet {
    height: min(720px, calc(100dvh - 32px)); max-height: calc(100dvh - 32px);
    background: var(--rd-surface-solid); backdrop-filter: none; -webkit-backdrop-filter: none;
  }
  .kairos-redesign .ms-more-sheet .ms-sheet-panel { display: flex; flex-direction: column; min-height: 100%; box-sizing: border-box; padding: 0 20px 36px; }
  /* The shell's own sheets: 12px of ground, the 42 x 5 grabber, then 16px to the header (the boards). The grabber button keeps a 44px
     touch area by hanging over the 33px the sheet reserves, in the empty middle of the header row. */
  .kairos-redesign .ms-sheet:is(.ms-model-sheet, .ms-notifications-sheet, .ms-background-sheet), .kairos-redesign :is(.permission-dialog, .question-dialog):not(.agent-inline-permission) { padding-top: 33px; }
  .kairos-redesign .ms-more-sheet .ms-sheet-panel { padding-top: 33px; }
  .kairos-redesign :is(.ms-more-sheet, .ms-model-sheet, .ms-notifications-sheet, .ms-background-sheet, .permission-dialog, .question-dialog) :is(.ms-sheet-grabber, .ms-sheet-grab):not(#_) { position: absolute; top: 0; left: 50%; margin: 0 0 0 -32px; width: 64px; height: 44px; min-height: 44px; }
  .kairos-redesign :is(.ms-more-sheet, .ms-model-sheet, .ms-notifications-sheet, .ms-background-sheet, .permission-dialog, .question-dialog) :is(.ms-sheet-grabber, .ms-sheet-grab)::after { position: absolute; top: 12px; left: 11px; margin: 0; }
  .kairos-redesign :is(.ms-sheet-close, .ms-sheet-header > button) {
    display: grid; place-items: center; width: 44px; height: 44px; min-width: 44px; min-height: 44px; padding: 0;
    border: 0; background: var(--rd-ground); font-size: 24px; line-height: 1;
  }
  .kairos-redesign :is(.ms-sheet-close, .ms-sheet-header > button) svg { width: 18px; height: 18px; }
  .kairos-redesign .ms-more-sheet .ms-sheet-heading { font-size: 34px; }
  .kairos-redesign .ms-tab-tile { border-color: var(--rd-line); gap: 8px; }
  .kairos-redesign .ms-tab-tile svg { width: 20px; height: 20px; }
  .kairos-redesign .ms-more-sheet .ms-sheet-footer { margin-top: auto; padding: 0; border-top: 1px solid var(--rd-line); }
  .kairos-redesign .ms-profile-row { border-bottom: 1px solid var(--rd-line); padding-block: 12px; }
  .kairos-redesign .ms-profile-copy { display: block; flex: 1; min-width: 0; text-align: left; }
  .kairos-redesign .ms-profile-name { display: block; font-weight: 500; }
  .kairos-redesign .ms-profile-detail { display: block; font-weight: 400; font-size: 13px; color: var(--rd-ink-dim); }
  .kairos-redesign .ms-more-extras { margin-block: 14px; font-size: 13px; color: var(--rd-ink-dim); }
  .kairos-redesign .ms-more-extras > summary { cursor: pointer; }
  .kairos-redesign .ms-sheet.ms-model-sheet { height: 640px; max-height: min(90dvh, calc(var(--ms-sheet-height, 100dvh) - var(--mobile-safe-top, env(safe-area-inset-top, 0px)))); }
  /* Only the body scrolls: the title, Close and grabber stay in place. */
  .kairos-redesign .ms-sheet.ms-model-sheet { overflow: hidden; }
  .kairos-redesign .ms-model-sheet > .ms-sheet-header { flex: none; }
  .kairos-redesign .ms-model-sheet > .ms-sheet-body { flex: 1 1 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
  .kairos-redesign .ms-model-sheet .ms-model-root > * { flex: none; }
  .kairos-redesign .ms-sheet.ms-notifications-sheet { height: 770px; max-height: calc(100dvh - 32px); }
  .kairos-redesign .ms-sheet.ms-background-sheet { height: 620px; max-height: calc(100dvh - 32px); }
  .kairos-redesign .ms-sheet:is(.ms-model-sheet, .ms-notifications-sheet, .ms-background-sheet) { display: flex; flex-direction: column; padding-bottom: max(34px, env(safe-area-inset-bottom, 0px)); }
  .kairos-redesign .ms-model-menu { display: flex; flex-direction: column; border: 0; overflow: visible; }
  .kairos-redesign .ms-model-menu > .model-picker-heading,
  .kairos-redesign .ms-model-menu .model-version-section > .model-picker-heading { display: none; }
  .kairos-redesign .ms-model-menu .model-connection-list { display: flex; gap: 0; padding: 5px; border-radius: 999px; background: var(--rd-surface-2); margin: 0 0 16px; overflow-x: auto; }
  .kairos-redesign .ms-model-menu .model-connection-item { flex: 1 0 84px; min-width: 0; justify-content: center; min-height: 42px; padding: 0 8px; border: 0; border-radius: 999px; background: transparent; color: var(--rd-ink-dim); font-size: 14px; }
  .kairos-redesign .ms-model-menu .model-connection-text { display: block; min-width: 0; }
  .kairos-redesign .ms-model-menu .model-connection-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .kairos-redesign .ms-model-menu .model-connection-item.active { background: var(--rd-surface-solid); color: var(--rd-ink); font-weight: 500; box-shadow: 0 1px 3px rgba(var(--shade-rgb), .1); }
  .kairos-redesign .ms-model-menu .model-connection-item :is(.model-connection-sub, .model-mark),
  .kairos-redesign .ms-model-menu .model-connection-item::after { display: none; }
  .kairos-redesign .ms-model-menu .model-catalog-list { border: 1px solid var(--rd-line); border-radius: 24px; overflow: hidden; max-height: none; }
  .kairos-redesign .ms-model-menu .model-catalog-item { display: grid; grid-template-columns: minmax(0, 1fr) 20px; gap: 2px 12px; text-align: left; min-height: 69px; }
  .kairos-redesign .ms-model-menu .model-catalog-name { grid-column: 1; font-size: 15px; font-weight: 500; }
  .kairos-redesign .ms-model-menu .model-catalog-desc { grid-column: 1; font-size: 13px; color: var(--rd-ink-dim); }
  .kairos-redesign .ms-model-menu .model-catalog-item::after { content: ''; grid-column: 2; grid-row: 1 / 3; width: 20px; height: 20px; border: 1.5px solid var(--rd-line-strong); border-radius: 50%; box-sizing: border-box; }
  .kairos-redesign .ms-model-menu .model-catalog-item.active::after { border: 6px solid var(--rd-ink); }
  .kairos-redesign .ms-model-menu .model-catalog-item:last-child { border-bottom: 0; }
  .kairos-redesign .ms-model-menu .model-version-section { border: 0; padding: 0; margin: 0; }
  .kairos-redesign .ms-sheet .ms-model-menu .model-effort-row { gap: 6px; margin: 16px 0 0; border: 0; padding: 0; }
  .kairos-redesign .ms-model-menu .model-effort-label { flex-basis: 100%; font: 500 11px var(--rd-font-ui); text-transform: uppercase; letter-spacing: .16em; margin-bottom: 4px; }
  .kairos-redesign .ms-model-menu .model-effort-btn { flex: 1; padding: 0 8px; font-size: 13px; }
  .kairos-redesign .ms-model-extras { font-size: 13px; color: var(--rd-ink-dim); }
  .kairos-redesign .ms-model-extras > :not(summary) { margin-top: 12px; }
  .kairos-redesign .ms-model-extras input { width: 100%; box-sizing: border-box; min-height: 44px; border-radius: 999px; background: var(--rd-ground); color: var(--rd-ink); border: 1px solid var(--rd-line); padding-inline: 16px; }
  .kairos-redesign .ms-notifications { display: flex; flex-direction: column; gap: 16px; }
  .kairos-redesign .ms-notifications h3 { margin: 0 0 10px; }
  .kairos-redesign .ms-notification-row { display: flex; align-items: center; gap: 12px; margin: 0; border: 0; background: transparent; }
  .kairos-redesign .ms-notification-copy { flex: 1; min-width: 0; }
  .kairos-redesign .ms-notification-copy :is(strong, small) { display: block; }
  .kairos-redesign .ms-notification-copy strong { font-size: 15px; font-weight: 500; }
  .kairos-redesign .ms-notification-copy small { font-size: 13px; color: var(--rd-ink-dim); }
  .kairos-redesign .ms-notification-live { padding: 16px; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent), 0 0 30px color-mix(in srgb, var(--accent) 25%, transparent); }
  .kairos-redesign .ms-notification-live h3 { display: none; }
  .kairos-redesign .ms-notification-live .ms-notification-row { padding: 0; }
  .kairos-redesign .ms-notification-live small { color: inherit; opacity: .65; }
  .kairos-redesign .ms-notification-needs .ms-notification-row { border: 1px solid var(--rd-line-strong); background: var(--rd-ground); }
  .kairos-redesign .ms-notification-earlier .ms-notification-list { padding: 2px 16px; border: 1px solid var(--rd-line); border-radius: 22px; background: var(--rd-ground); }
  .kairos-redesign .ms-notification-earlier .ms-notification-row { min-height: 44px; border-radius: 0; padding: 12px 0; border-bottom: 1px solid var(--rd-line); }
  .kairos-redesign .ms-notification-earlier .ms-notification-row:last-child { border-bottom: 0; }
  .kairos-redesign .ms-notification-dot { width: 10px; height: 10px; flex: 0 0 10px; border-radius: 50%; background: var(--success); }
  .kairos-redesign .ms-notification-dot[data-status=Failed] { background: var(--danger); }
  .kairos-redesign .ms-background-sheet .bg-tasks-summary { margin: 0 0 16px; font-size: 13px; color: var(--rd-ink-dim); }
  .kairos-redesign .ms-background-sheet .bg-task-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; border: 1px solid var(--rd-line); text-align: left; }
  .kairos-redesign .ms-background-sheet .bg-task-label { grid-column: 1; grid-row: 1; font-size: 15px; font-weight: 500; }
  .kairos-redesign .ms-background-sheet .bg-task-label::before { content: ''; display: inline-block; width: 10px; height: 10px; margin-right: 10px; border-radius: 50%; background: var(--accent); }
  .kairos-redesign .ms-background-sheet .bg-task-row[data-status=waiting] .bg-task-label::before { background: var(--danger); }
  .kairos-redesign .ms-background-sheet .bg-task-row[data-status=done] .bg-task-label::before { background: var(--success); }
  .kairos-redesign .ms-background-sheet .bg-task-elapsed { position: static; grid-column: 2; grid-row: 1; font: 12px var(--font-mono); }
  .kairos-redesign .ms-background-sheet .bg-task-top { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; gap: 8px; }
  .kairos-redesign .ms-background-sheet .bg-task-kind { padding: 3px 9px; border-radius: 999px; background: var(--rd-surface-solid); font-size: 12px; }
  .kairos-redesign .ms-background-sheet .bg-task-activity { grid-column: 1 / -1; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}

/* Mobile v2 fidelity, second pass: model rows, effort, notifications, question, permission, background tasks. */
@media (max-width: 768px) {
  /* More: the last row has no rule under it */
  .kairos-redesign .ms-more-sheet .ms-settings-row { border-bottom: 0; }
  /* Model sheet */
  .kairos-redesign .ms-sheet:is(.ms-model-sheet, .ms-notifications-sheet, .ms-background-sheet) .ms-sheet-header { padding: 0; margin: 0 0 16px; border: 0; min-height: 44px; }
  .kairos-redesign .ms-sheet:is(.ms-model-sheet, .ms-notifications-sheet, .ms-background-sheet) .ms-sheet-header h2 { font: italic 600 32px/1 var(--rd-font-title); }
  .kairos-redesign .ms-sheet:is(.ms-model-sheet, .ms-notifications-sheet, .ms-background-sheet) .ms-sheet-body { padding: 0; }
  .kairos-redesign .ms-model-menu .model-connection-list { margin: 0 0 16px; }
  .kairos-redesign .ms-model-menu .model-catalog-list { display: flex; flex-direction: column; gap: 0; padding: 0; }
  .kairos-redesign .ms-model-menu .model-catalog-item { padding: 14px 16px; border: 0; border-bottom: 1px solid var(--rd-line); border-radius: 0; background: var(--rd-surface-solid); color: var(--rd-ink); align-items: center; }
  .kairos-redesign .ms-model-menu .model-catalog-item.active { background: var(--rd-ground); }
  .kairos-redesign .ms-model-menu .model-catalog-item > span { min-width: 0; }
  .kairos-redesign .ms-model-menu .model-catalog-desc { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .kairos-redesign .ms-model-menu .model-version-section { display: flex; flex-direction: column; }
  .kairos-redesign .ms-model-menu .model-effort-row { order: 1; display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }
  .kairos-redesign .ms-model-menu .model-effort-label { grid-column: 1 / -1; }
  .kairos-redesign .ms-model-menu .model-effort-btn { min-height: 42px; height: 42px; border: 1px solid var(--rd-line); border-radius: 999px; background: var(--rd-ground); color: var(--rd-ink); text-transform: capitalize; }
  .kairos-redesign .ms-model-menu .model-effort-btn.active { border-color: transparent; background: var(--rd-primary-bg); color: var(--rd-primary-fg); }
  .kairos-redesign .ms-model-menu .rd-effort-seg { display: contents; }
  .kairos-redesign .ms-model-menu .model-use-endpoint, .kairos-redesign .ms-model-menu .model-custom-details { order: 2; }
  .kairos-redesign .ms-model-menu .model-use-endpoint { min-height: 44px; justify-content: flex-start; padding: 0; background: transparent; color: var(--accent); font-size: 13px; }
  .kairos-redesign .ms-model-menu .model-add-item { justify-content: flex-start; padding: 0; background: transparent; color: var(--accent); font-size: 13px; }
  /* Notifications */
  .kairos-redesign .ms-notification-list { display: flex; flex-direction: column; gap: 8px; }
  .kairos-redesign .ms-notification-needs .ms-notification-row { padding: 14px 16px; border-radius: 22px; }
  .kairos-redesign .ms-notification-earlier .ms-notification-list { gap: 0; }
  .kairos-redesign .ms-notification-earlier .ms-notification-copy { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .kairos-redesign .ms-notification-earlier .ms-notification-copy strong { font-size: 14px; font-weight: 400; }
  .kairos-redesign .ms-notification-earlier .ms-notification-copy small { flex: none; font-size: 12px; }
  /* Question and permission, the head: icon, label over one quiet line, close */
  .kairos-redesign .question-dialog .question-head-copy, .kairos-redesign .permission-dialog .permission-head-copy { flex: 1; min-width: 0; }
  .kairos-redesign .question-dialog .question-head h2, .kairos-redesign .permission-dialog:not(.agent-inline-permission) .permission-head h2 { margin: 0; font: 500 11px/1.5 var(--rd-font-ui); letter-spacing: .16em; text-transform: uppercase; color: var(--accent); }
  .kairos-redesign .question-dialog .question-head-sub, .kairos-redesign .permission-dialog:not(.agent-inline-permission) .permission-tool { display: block; margin: 0; padding: 0; border: 0; border-radius: 0; font: 13px/1.5 var(--rd-font-ui); color: var(--rd-ink-dim); width: auto; order: 0; }
  .kairos-redesign .permission-dialog:not(.agent-inline-permission) .permission-tool::before { content: none; }
  .kairos-redesign .question-dialog .question-footer > p.muted:not(:last-of-type) { display: none; }
  .kairos-redesign .permission-dialog:not(.agent-inline-permission) .permission-choices .btn:not(#_) { background: var(--rd-ground); border-color: var(--rd-line); }
  .kairos-redesign .permission-dialog:not(.agent-inline-permission) .permission-choices .btn.primary:not(#_) { background: var(--rd-primary-bg); border-color: var(--rd-primary-bg); }
  /* The chosen model reads as a filled radio ring (ModelSheet board); this resets the check mark the shared rows draw. */
  .kairos-redesign .ms-model-menu .model-catalog-item:not(#_)::after { content: ''; position: static; display: block; grid-column: 2; grid-row: 1 / 3; width: 20px; height: 20px; margin: 0; background: none; -webkit-mask: none; mask: none; border: 1.5px solid var(--rd-line-strong); border-radius: 50%; box-sizing: border-box; }
  .kairos-redesign .ms-model-menu .model-catalog-item.active:not(#_)::after { border: 6px solid var(--rd-ink); }
  .kairos-redesign .permission-dialog:not(.agent-inline-permission) .permission-target { font: 12px/1.6 var(--font-mono); }
  .kairos-redesign :is(.question-dialog, .permission-dialog) .ms-sheet-close:not(#_) { font-size: 26px; font-weight: 400; line-height: 1; }
  /* Background tasks: the counts under the title, rows as three lines */
  .kairos-redesign .ms-background-sheet .ms-sheet-titles { min-width: 0; }
  .kairos-redesign .ms-background-sheet .bg-tasks-summary { margin: 4px 0 0; font-size: 13px; line-height: 1.5; color: var(--rd-ink-dim); }
  .kairos-redesign .ms-background-sheet .bg-tasks-list { display: flex; flex-direction: column; gap: 10px; }
  .kairos-redesign .ms-background-sheet .bg-task-row { padding: 14px 16px; border-radius: 22px; background: var(--rd-ground); border-color: var(--rd-line); }
}
