/*
  MOBILE_RESPONSIVE_OVERHAUL_20260616
  Last-loaded layout safety layer for the full AtticusBeta app.

  Goal:
  - Desktop keeps the current look.
  - Tablet uses simpler columns.
  - Phone uses one real scrollable view plus a horizontal bottom nav.
  - No important content hides behind the topbar, footer, or bottom nav.
  - Panels/cards grow from content instead of trapping content.
  - Tables/lists are the only elements that use internal horizontal scrolling.
*/

*,
*::before,
*::after {
  min-width: 0;
}

img,
svg,
video,
canvas,
iframe {
  max-width: 100%;
}

button,
input,
textarea,
select {
  max-width: 100%;
}

:root {
  --mobile-nav-height: 76px;
  --mobile-footer-height: 48px;
  --mobile-content-pad: clamp(12px, 3.6vw, 18px);
  --mobile-gap: 14px;
}

/* Tablet: stop two-column areas from squeezing too hard. */
@media (max-width: 1180px) {
  .dashboard-layout,
  .dashboard-layout.dashboard-layout-live,
  .dashboard-grid-two,
  .abdash-panel-grid,
  .settings-layout,
  .settings-clean-row-main,
  .settings-clean-row-secondary,
  .tools-layout,
  [data-view="tools"] .tools-layout,
  .contacts-directory,
  .file-explorer-layout,
  .master-panel-grid,
  .master-section-split,
  .master-sales-hero,
  .master-sales-control-grid,
  .master-sales-list-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .page-view[data-view="dashboard"] > .atticus-dashboard,
  .page-view[data-view="settings"] > .settings-page-scroll,
  .page-view[data-view="settings"] > .settings-layout,
  [data-view="tools"] .tools-layout,
  .file-explorer-panel,
  .contacts-panel {
    width: 100% !important;
    max-width: 100% !important;
  }

  .settings-clean-row-main,
  .settings-clean-row-secondary {
    display: grid !important;
    gap: 16px !important;
  }
}

/* Phone app shell. */
@media (max-width: 900px) {
  html,
  body,
  .app {
    width: 100% !important;
    height: 100dvh !important;
    min-height: 100dvh !important;
    overflow: hidden !important;
  }

  .app {
    position: fixed !important;
    inset: 0 !important;
  }

  .shell {
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: minmax(0, 1fr) calc(var(--mobile-nav-height) + var(--safe-bottom, 0px)) !important;
    overflow: hidden !important;
  }

  .stage {
    grid-row: 1 !important;
    width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    overflow: hidden !important;
  }

  .rail {
    grid-row: 2 !important;
    width: 100% !important;
    height: calc(var(--mobile-nav-height) + var(--safe-bottom, 0px)) !important;
    min-height: 0 !important;
    display: block !important;
    overflow: hidden !important;
    padding: 0 0 var(--safe-bottom, 0px) !important;
    border-right: 0 !important;
    border-top: 1px solid var(--line, rgba(240,223,195,.12)) !important;
    background:
      linear-gradient(180deg, rgba(5, 7, 10, 0.84), rgba(4, 6, 6, 0.98)),
      rgba(0, 0, 0, 0.18) !important;
    backdrop-filter: blur(12px) !important;
  }

  .brand,
  .recent,
  .rail-footer {
    display: none !important;
  }

  .rail .nav,
  .nav {
    width: 100% !important;
    height: var(--mobile-nav-height) !important;
    min-height: var(--mobile-nav-height) !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    gap: 6px !important;
    padding: 6px 10px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    border: 0 !important;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .rail .nav::-webkit-scrollbar,
  .nav::-webkit-scrollbar {
    display: none;
  }

  .nav-button,
  .app.compact-nav .nav-button,
  .nav-button[data-master-console-button] {
    flex: 0 0 clamp(68px, 17vw, 92px) !important;
    width: clamp(68px, 17vw, 92px) !important;
    height: calc(var(--mobile-nav-height) - 12px) !important;
    min-height: 0 !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: 31px minmax(15px, auto) !important;
    align-content: center !important;
    justify-items: center !important;
    gap: 4px !important;
    padding: 7px 4px 6px !important;
    border-radius: 14px !important;
    text-align: center !important;
    font-size: clamp(8px, 2.15vw, 10px) !important;
    line-height: 1.05 !important;
    letter-spacing: 0.025em !important;
    scroll-snap-align: start;
    overflow: hidden !important;
  }

  .nav-button::before,
  .app.compact-nav .nav-button::before {
    left: 8px !important;
    right: 8px !important;
    top: auto !important;
    bottom: 2px !important;
    width: auto !important;
    height: 3px !important;
    border-radius: 999px !important;
  }

  .nav-button span,
  .app.compact-nav .nav-button span {
    display: block !important;
    max-width: 100% !important;
    white-space: normal !important;
    overflow: hidden !important;
    text-overflow: clip !important;
  }

  .nav-icon,
  .app.compact-nav .nav-icon {
    width: 23px !important;
    height: 23px !important;
    margin: 0 !important;
  }

  .topbar {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 30 !important;
    min-height: var(--topbar-height, 56px) !important;
    height: var(--topbar-height, 56px) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 8px !important;
    padding: 0 12px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    white-space: nowrap !important;
    scrollbar-width: none;
    background: linear-gradient(180deg, rgba(5,7,10,.92), rgba(5,7,10,.72)) !important;
    backdrop-filter: blur(10px) !important;
  }

  .topbar::-webkit-scrollbar {
    display: none;
  }

  .topbar > span:nth-child(2),
  .topbar .online {
    display: none !important;
  }

  .top-install-button,
  .logout-button,
  .action,
  .modal-btn,
  .settings-primary-button,
  .settings-danger-button,
  .settings-small-button,
  .install-btn,
  .master-button {
    min-height: 36px !important;
    height: auto !important;
    padding: 8px 10px !important;
    font-size: 9px !important;
    line-height: 1.15 !important;
    letter-spacing: 0.07em !important;
    white-space: normal !important;
    text-align: center !important;
  }

  .core-legal-footer {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: calc(var(--mobile-nav-height) + var(--safe-bottom, 0px)) !important;
    z-index: 22 !important;
    min-height: var(--mobile-footer-height) !important;
    max-height: var(--mobile-footer-height) !important;
    padding: 5px 8px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 6px !important;
    overflow: hidden !important;
    background: linear-gradient(180deg, rgba(5,7,10,.58), rgba(5,7,10,.94)) !important;
    backdrop-filter: blur(10px) !important;
  }

  .core-footer-copy {
    display: none !important;
  }

  .core-footer-links {
    width: 100% !important;
    display: flex !important;
    gap: 4px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    justify-content: flex-start !important;
    padding: 0 4px !important;
    scrollbar-width: none;
  }

  .core-footer-links::-webkit-scrollbar {
    display: none;
  }

  .core-legal-footer button {
    flex: 0 0 auto !important;
    min-height: 30px !important;
    padding: 6px 8px !important;
    font-size: 9px !important;
    white-space: nowrap !important;
  }

  .view,
  .view.is-active,
  .page-view,
  .focus-view,
  .page-view[data-view="dashboard"],
  .page-view[data-view="messenger"],
  .page-view[data-view="tools"],
  .page-view[data-view="files"],
  .page-view[data-view="contacts"],
  .page-view[data-view="settings"],
  [data-view="atticus"].master-console-view {
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding:
      calc(var(--topbar-height, 56px) + 14px)
      var(--mobile-content-pad)
      calc(var(--mobile-nav-height) + var(--mobile-footer-height) + 26px + var(--safe-bottom, 0px)) !important;
    -webkit-overflow-scrolling: touch;
    scroll-padding-bottom: calc(var(--mobile-nav-height) + var(--mobile-footer-height) + 34px + var(--safe-bottom, 0px)) !important;
  }

  .view:not(.is-active) {
    overflow: hidden !important;
  }

  .page-header,
  .settings-page-header,
  .focus-header,
  .master-topline {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    gap: 12px !important;
    width: 100% !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 0 14px !important;
  }

  .page-title,
  .settings-page .page-title,
  .master-title {
    font-size: clamp(24px, 8vw, 34px) !important;
    line-height: 1.05 !important;
    letter-spacing: 0.055em !important;
    overflow-wrap: anywhere !important;
  }

  .page-subtitle,
  .master-subtitle,
  .dashboard-hero-copy,
  .app-card-copy,
  .system-card-copy,
  .project-copy,
  .notification-copy,
  .setting-copy,
  .master-action-copy,
  .master-radar-copy,
  .master-sales-copy {
    max-width: 100% !important;
    font-size: 12px !important;
    line-height: 1.42 !important;
    overflow-wrap: anywhere !important;
  }

  .focus-stage,
  .dashboard-layout,
  .dashboard-layout.dashboard-layout-live,
  .atticus-dashboard,
  .settings-layout,
  .settings-page-scroll,
  .settings-clean-stack,
  .tools-layout,
  [data-view="tools"] .tools-layout,
  .file-explorer-panel,
  .contacts-panel,
  .messenger-layout,
  .master-console {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-auto-rows: auto !important;
    gap: var(--mobile-gap) !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
    align-content: start !important;
  }

  .focus-stage {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
  }

  .response,
  .panel,
  .settings-card,
  .abdash-panel,
  .dashboard-hero,
  .thread-list,
  .thread-main,
  .app-card,
  .file-explorer-panel,
  .contacts-panel,
  .master-panel,
  .master-card,
  .master-radar-card,
  .master-action-card,
  .master-brief-card,
  .master-sales-step,
  .master-sales-form,
  .master-sales-list-grid section {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  .panel,
  .settings-card,
  .abdash-panel,
  .dashboard-hero,
  .app-card,
  .response,
  .thread-list,
  .thread-main,
  .master-panel {
    padding: 16px !important;
    border-radius: 18px !important;
  }

  .panel .scroll-area,
  .scroll-area,
  [data-view="tools"] .scroll-area,
  .settings-page-scroll,
  .settings-card,
  .project-list,
  .notification-list,
  .system-card-list,
  .tool-list,
  .master-panel-body {
    max-height: none !important;
    height: auto !important;
    overflow: visible !important;
    padding-right: 0 !important;
  }

  .dashboard-grid-two,
  .abdash-panel-grid,
  .settings-clean-row-main,
  .settings-clean-row-secondary,
  .settings-account-grid,
  .settings-form-grid,
  .settings-toggle-grid,
  .settings-button-row,
  .settings-sliders,
  .tools-layout,
  [data-view="tools"] .tools-layout,
  .app-filter-bar,
  .apps-grid,
  [data-view="tools"] .apps-grid,
  .library-grid,
  .file-grid,
  .contacts-directory,
  .master-grid,
  .master-radar-grid,
  .master-panel-grid,
  .master-section-split,
  .master-brief-grid,
  .master-sales-hero,
  .master-sales-funnel,
  .master-sales-control-grid,
  .master-sales-list-grid,
  .master-mini-explainer-grid {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: var(--mobile-gap) !important;
  }

  .dashboard-chip-row,
  .settings-button-row,
  .modal-actions,
  .master-refresh-row,
  .btns {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: flex-start !important;
    gap: 8px !important;
  }

  .dashboard-chip,
  .settings-pill,
  .master-pill,
  .master-status,
  .project-state,
  .notification-count,
  .system-card-value,
  .tool-state {
    width: max-content !important;
    max-width: 100% !important;
    white-space: normal !important;
  }

  .system-card,
  .project-row,
  .notification-row,
  .tool-row,
  .setting-row,
  .settings-plan-option,
  .master-action-card,
  .master-sales-row {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    align-items: start !important;
    gap: 10px !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 12px !important;
  }

  .tool-icon,
  .app-card-icon {
    display: none !important;
  }

  .install-btn,
  .settings-plan-option .settings-primary-button,
  .settings-plan-option .settings-small-button,
  .project-state,
  .notification-count,
  .system-card-value,
  .tool-state {
    justify-self: start !important;
  }

  .focus-context-bar,
  .focus-context-selects,
  .settings-profile,
  .app-card-header,
  .master-sales-sender {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 10px !important;
    align-items: start !important;
  }

  .focus-context-selects label,
  .settings-profile > *,
  .master-sales-sender > *,
  .master-sales-form label {
    min-width: 0 !important;
  }

  .focus-console,
  .thread-compose {
    position: relative !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    z-index: 5 !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 12px !important;
    border: 1px solid var(--line-soft, rgba(240,223,195,.08)) !important;
    border-radius: 18px !important;
    background: linear-gradient(180deg, rgba(13,19,17,.94), rgba(5,8,8,.99)) !important;
    box-shadow: 0 16px 44px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.04) !important;
  }

  .terminal,
  .thread-compose .terminal {
    min-height: 56px !important;
    grid-template-columns: 32px minmax(0, 1fr) 44px !important;
  }

  .terminal textarea,
  #focusInput,
  #messengerInput,
  .thread-compose .terminal textarea {
    min-height: 48px !important;
    max-height: 120px !important;
    font-size: 16px !important;
  }

  .response {
    min-height: 240px !important;
    padding: 18px 16px !important;
  }

  .response-content {
    max-height: none !important;
    overflow: visible !important;
    padding-right: 0 !important;
    font-size: 14px !important;
    line-height: 1.55 !important;
  }

  .focus-logo {
    font-size: clamp(30px, 10vw, 44px) !important;
    line-height: 1 !important;
  }

  .messenger-layout {
    display: flex !important;
    flex-direction: column !important;
  }

  .thread-list {
    flex: 0 0 auto !important;
    display: flex !important;
    gap: 10px !important;
    padding: 10px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }

  .thread-button,
  .thread-list .project-row {
    flex: 0 0 min(78vw, 280px) !important;
    width: min(78vw, 280px) !important;
    min-height: 76px !important;
    scroll-snap-align: start;
  }

  .thread-main {
    display: grid !important;
    grid-template-rows: auto minmax(320px, 58vh) auto !important;
    overflow: hidden !important;
  }

  .thread-body {
    min-height: 320px !important;
    max-height: 58vh !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 16px 12px !important;
  }

  .thread-compose {
    border-radius: 0 0 18px 18px !important;
  }

  .message,
  .message.user {
    max-width: 100% !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  .message-text {
    font-size: 14px !important;
    line-height: 1.5 !important;
    overflow-wrap: anywhere !important;
  }

  .message-image img {
    max-height: 320px !important;
    width: 100% !important;
    object-fit: contain !important;
  }

  .table-wrap,
  .master-table-wrap,
  .file-table-wrap,
  .settings-table-wrap {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch;
  }

  .master-table {
    min-width: 640px !important;
  }

  .master-row,
  .master-event-row,
  .master-user-row,
  .master-money-row,
  .master-system-row,
  .master-action-row {
    min-width: 640px !important;
  }

  .master-panel {
    min-height: 0 !important;
  }

  .master-panel-head,
  .panel-head,
  .settings-card-head {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: flex-start !important;
    gap: 8px !important;
    height: auto !important;
    min-height: 0 !important;
    padding: 0 0 12px !important;
  }

  .master-panel-body {
    padding: 0 !important;
  }

  .master-chart-wrap {
    min-height: 240px !important;
  }

  .master-chart-canvas {
    min-height: 240px !important;
  }

  .master-card,
  .master-radar-card,
  .master-sales-step {
    min-height: 112px !important;
  }

  .master-card-value,
  .master-radar-value {
    font-size: clamp(24px, 9vw, 36px) !important;
  }

  .master-card-foot {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .master-spark {
    display: none !important;
  }

  .master-sales-form input,
  .master-sales-form select,
  .form-field input,
  .form-field textarea,
  .form-field select,
  .auth-input {
    min-height: 42px !important;
    height: auto !important;
    font-size: 16px !important;
  }

  .tool-frame-shell {
    width: 100vw !important;
    height: 100dvh !important;
    max-width: 100vw !important;
    max-height: 100dvh !important;
    border-radius: 0 !important;
  }

  .tool-frame-header {
    min-height: 66px !important;
    padding: 10px 12px !important;
  }

  .tool-frame-title {
    font-size: 16px !important;
  }

  .modal,
  .auth-overlay {
    padding: 12px !important;
  }

  .modal-panel,
  .auth-panel {
    width: min(100%, 520px) !important;
    max-height: calc(100dvh - 24px) !important;
    overflow-y: auto !important;
    padding: 18px !important;
  }
}

@media (max-width: 520px) {
  :root {
    --mobile-nav-height: 74px;
    --mobile-footer-height: 42px;
    --mobile-content-pad: 12px;
  }

  .topbar {
    gap: 6px !important;
    padding-left: 10px !important;
    padding-right: 10px !important;
  }

  #topClock {
    font-size: 10px !important;
  }

  .top-install-button,
  .logout-button {
    min-height: 32px !important;
    padding: 7px 9px !important;
    font-size: 8.5px !important;
  }

  .nav-button,
  .app.compact-nav .nav-button,
  .nav-button[data-master-console-button] {
    flex-basis: 72px !important;
    width: 72px !important;
  }

  .page-title,
  .master-title {
    font-size: clamp(22px, 8.5vw, 30px) !important;
  }

  .panel,
  .settings-card,
  .abdash-panel,
  .dashboard-hero,
  .app-card,
  .response,
  .master-panel {
    padding: 14px !important;
    border-radius: 16px !important;
  }

  .core-legal-footer button {
    font-size: 8.5px !important;
    min-height: 28px !important;
  }

  .auth-title {
    font-size: 25px !important;
  }
}

/* Very short phones / landscape: prioritize usable content over fixed chrome. */
@media (max-height: 560px) and (max-width: 900px) {
  :root {
    --mobile-nav-height: 64px;
    --mobile-footer-height: 0px;
  }

  .core-legal-footer {
    display: none !important;
  }

  .nav-button,
  .app.compact-nav .nav-button,
  .nav-button[data-master-console-button] {
    height: 52px !important;
    grid-template-rows: 26px 14px !important;
  }

  .nav-icon,
  .app.compact-nav .nav-icon {
    width: 20px !important;
    height: 20px !important;
  }
}

/* Reduce the Focus brand mark so it does not dominate the panel. */
.focus-logo {
  font-size: clamp(24px, 4.2vw, 40px) !important;
  letter-spacing: 0.05em !important;
  line-height: 0.96 !important;
}

/* 2026-06-18 Focus grid-track width fix final override.
   This stylesheet loads after final-live-polish.css, so this is the last word.
   The Focus messenger must be sized from the available stage width, not from old
   860/900/980/1040px centered caps. Desktop uses percentage width after the parent grid track is forced to fill the stage. */
@media (min-width: 901px) {
  body .stage > section.view.focus-view.is-active[data-view="focus"] {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: minmax(0, 1fr) !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    height: 100% !important;
    min-height: 0 !important;
    padding-top: calc(var(--topbar-height) + clamp(10px, 1.4vh, 20px)) !important;
    padding-right: clamp(18px, 2vw, 42px) !important;
    padding-bottom: calc(var(--dynamic-footer-height, 70px) + clamp(8px, 1vh, 14px)) !important;
    padding-left: clamp(18px, 2vw, 42px) !important;
    overflow: hidden !important;
    justify-items: stretch !important;
    align-items: stretch !important;
    justify-content: stretch !important;
    align-content: stretch !important;
    box-sizing: border-box !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] > .focus-stage {
    grid-row: 1 !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    height: 100% !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: auto minmax(0, 1fr) auto !important;
    row-gap: clamp(12px, 1.6vh, 20px) !important;
    align-items: stretch !important;
    align-content: stretch !important;
    justify-items: center !important;
    justify-content: stretch !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-header {
    width: 86% !important;
    min-width: 80% !important;
    max-width: none !important;
    margin: 0 auto !important;
    padding: 0 !important;
    justify-self: center !important;
    align-self: end !important;
    display: grid !important;
    place-items: center !important;
    text-align: center !important;
    box-sizing: border-box !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-logo {
    width: auto !important;
    max-width: none !important;
    margin: 0 auto !important;
    text-align: center !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-stage > article.response,
  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-stage > form.focus-console {
    width: 86% !important;
    min-width: 80% !important;
    max-width: none !important;
    margin-left: auto !important;
    margin-right: auto !important;
    justify-self: center !important;
    box-sizing: border-box !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-stage > article.response {
    height: 100% !important;
    min-height: min(500px, 54vh) !important;
    max-height: none !important;
    align-self: stretch !important;
    padding-left: clamp(30px, 3vw, 62px) !important;
    padding-right: clamp(30px, 3vw, 62px) !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-stage .response-content,
  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-stage .focus-context-bar,
  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-stage .focus-pair,
  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-stage .focus-message-card,
  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-stage .message-text,
  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-stage .rich-text,
  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-stage .terminal,
  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-stage .composer-actions,
  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-stage .attachment-tray,
  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-stage .terminal-help {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-thread-actions {
    width: 100% !important;
    max-width: none !important;
    justify-content: center !important;
  }
}

@media (min-width: 1500px) {
  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-header,
  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-stage > article.response,
  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-stage > form.focus-console {
    width: 88% !important;
    min-width: 80% !important;
    max-width: none !important;
  }
}

@media (min-width: 1900px) {
  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-header,
  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-stage > article.response,
  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-stage > form.focus-console {
    width: 90% !important;
    min-width: 80% !important;
    max-width: none !important;
  }
}

/* 2026-06-18 Focus action placement + top alignment + compact topbar actions.
   This stylesheet loads last, so these rules intentionally override earlier focus/topbar polish. */
@media (min-width: 901px) {
  body .stage > section.view.focus-view.is-active[data-view="focus"] {
    padding-top: calc(var(--topbar-height) + clamp(12px, 1.8vh, 26px)) !important;
    padding-bottom: calc(var(--dynamic-footer-height, 82px) + clamp(36px, 4.2vh, 60px)) !important;
    align-content: start !important;
    align-items: start !important;
    overflow: hidden !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] > .focus-stage {
    grid-template-rows: auto auto auto !important;
    align-content: start !important;
    align-items: start !important;
    justify-items: center !important;
    row-gap: clamp(12px, 1.45vh, 18px) !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-header {
    align-self: start !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-stage > article.response {
    position: relative !important;
    height: auto !important;
    min-height: clamp(380px, 47vh, 560px) !important;
    max-height: calc(var(--app-real-height, 100vh) - var(--topbar-height) - var(--dynamic-footer-height, 82px) - 245px) !important;
    align-self: start !important;
    overflow: hidden !important;
    padding-top: clamp(72px, 7.6vh, 96px) !important;
    padding-bottom: clamp(26px, 3vh, 42px) !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-stage > form.focus-console {
    position: relative !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    align-self: start !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    z-index: 30 !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .response > .walkthrough-button {
    position: absolute !important;
    top: clamp(24px, 3vh, 36px) !important;
    right: clamp(24px, 3vw, 42px) !important;
    z-index: 8 !important;
    width: auto !important;
    min-width: 0 !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-thread-actions {
    position: absolute !important;
    top: clamp(24px, 3vh, 36px) !important;
    right: clamp(172px, 13vw, 230px) !important;
    z-index: 8 !important;
    width: auto !important;
    max-width: calc(100% - 320px) !important;
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: flex-end !important;
    align-items: center !important;
    gap: 10px !important;
    margin: 0 !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-new-thread-button {
    min-height: 36px !important;
    padding: 0 14px !important;
    font-size: 10px !important;
    letter-spacing: .12em !important;
    white-space: nowrap !important;
    background: color-mix(in srgb, var(--amber) 9%, transparent) !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-context-bar {
    padding-top: 0 !important;
    padding-right: 0 !important;
  }
}

.topbar {
  gap: 8px !important;
  padding-inline: clamp(16px, 2vw, 30px) !important;
}

.topbar .topbar-action,
.topbar .top-install-button.topbar-action,
.topbar .logout-button.topbar-action {
  height: 30px !important;
  min-width: 0 !important;
  padding: 0 9px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  border-radius: 10px !important;
  font-size: 9px !important;
  line-height: 1 !important;
  letter-spacing: .11em !important;
  box-shadow: none !important;
}

.topbar .topbar-action svg {
  width: 14px !important;
  height: 14px !important;
  flex: 0 0 auto !important;
  opacity: .9 !important;
}

.topbar .topbar-action span {
  display: inline-block !important;
  line-height: 1 !important;
}

@media (max-width: 1120px) {
  .topbar .topbar-action span {
    display: none !important;
  }
  .topbar .topbar-action,
  .topbar .top-install-button.topbar-action,
  .topbar .logout-button.topbar-action {
    width: 32px !important;
    padding: 0 !important;
  }
}

/* 2026-06-18 Auto Seller control desk visual upgrade. */
.master-auto-selling-panel .master-panel-body {
  padding: clamp(14px, 1.7vw, 22px) !important;
}

.master-sales-controls-v2,
.master-sales-review-board-v2 {
  gap: 18px !important;
}

.master-sales-control-strip {
  position: sticky !important;
  top: 0 !important;
  z-index: 6 !important;
  gap: 12px !important;
  padding: 14px !important;
  border: 1px solid color-mix(in srgb, var(--master-cream) 12%, transparent) !important;
  border-radius: 24px !important;
  background:
    linear-gradient(135deg, rgba(255,255,255,.065), rgba(255,255,255,.018)),
    color-mix(in srgb, var(--master-bg, #07100e) 86%, transparent) !important;
  box-shadow: 0 18px 44px rgba(0,0,0,.28), inset 0 1px 0 rgba(255,255,255,.055) !important;
  backdrop-filter: blur(16px) saturate(1.2) !important;
}

.master-sales-inline-form {
  min-width: min(100%, 430px) !important;
  flex: 1 1 430px !important;
  gap: 10px !important;
  padding: 10px !important;
  border-radius: 20px !important;
  border: 1px solid color-mix(in srgb, var(--master-cream) 14%, transparent) !important;
  background:
    linear-gradient(145deg, rgba(255,255,255,.06), rgba(255,255,255,.02)),
    rgba(0,0,0,.12) !important;
}

.master-sales-inline-form select,
.master-sales-inline-form input:not([type="checkbox"]),
.master-sales-settings-card input,
.master-sales-settings-card select,
.master-sales-settings-card textarea {
  height: 36px !important;
  border-radius: 12px !important;
  border: 1px solid color-mix(in srgb, var(--master-cream) 18%, transparent) !important;
  background: rgba(255,255,255,.075) !important;
  color: color-mix(in srgb, var(--master-cream) 90%, transparent) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05) !important;
}

.master-sales-inline-form input[type="checkbox"] {
  accent-color: var(--master-amber, #D48A55) !important;
}

.master-sales-settings-card {
  position: relative !important;
  gap: 18px !important;
  padding: clamp(18px, 1.8vw, 28px) !important;
  border-radius: 28px !important;
  border: 1px solid color-mix(in srgb, var(--master-cream) 12%, transparent) !important;
  background:
    radial-gradient(circle at 12% 0%, rgba(212,138,85,.11), transparent 34%),
    radial-gradient(circle at 88% 8%, rgba(79,209,197,.08), transparent 32%),
    linear-gradient(145deg, rgba(255,255,255,.06), rgba(255,255,255,.016)),
    rgba(5,10,9,.72) !important;
  box-shadow: 0 22px 60px rgba(0,0,0,.30), inset 0 1px 0 rgba(255,255,255,.055) !important;
  overflow: hidden !important;
}

.master-sales-settings-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(240,223,195,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(240,223,195,.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,.55), transparent 78%);
}

.master-sales-settings-card > * {
  position: relative !important;
  z-index: 1 !important;
}

.master-sales-settings-card .master-sales-list-title,
.master-sales-form-title,
.master-sales-list-title {
  color: var(--master-amber, #D48A55) !important;
  letter-spacing: .14em !important;
}

.master-sales-slider-grid {
  grid-template-columns: repeat(4, minmax(190px, 1fr)) !important;
  gap: 16px !important;
}

.master-sales-three-col {
  grid-template-columns: repeat(3, minmax(220px, 1fr)) !important;
  gap: 16px !important;
}

.master-sales-color-row {
  grid-template-columns: repeat(5, minmax(140px, 1fr)) !important;
  gap: 14px !important;
}

.master-sales-slider-grid label,
.master-sales-three-col label,
.master-sales-color-row label {
  padding: 12px !important;
  border: 1px solid color-mix(in srgb, var(--master-cream) 10%, transparent) !important;
  border-radius: 18px !important;
  background: rgba(255,255,255,.035) !important;
}

.master-sales-slider-grid input[type="range"] {
  width: 100% !important;
  accent-color: var(--master-amber, #D48A55) !important;
  cursor: pointer !important;
}

.master-sales-slider-grid output {
  justify-self: start !important;
  display: inline-flex !important;
  align-items: center !important;
  width: max-content !important;
  min-width: 36px !important;
  height: 22px !important;
  padding: 0 8px !important;
  border: 1px solid color-mix(in srgb, var(--master-amber, #D48A55) 28%, transparent) !important;
  border-radius: 999px !important;
  background: color-mix(in srgb, var(--master-amber, #D48A55) 10%, transparent) !important;
  color: color-mix(in srgb, var(--master-cream) 86%, transparent) !important;
}

.master-sales-control-buttons {
  gap: 12px !important;
  padding: 8px 4px 0 !important;
}

.master-sales-control-buttons label {
  min-height: 36px !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 0 12px !important;
  border: 1px solid color-mix(in srgb, var(--master-cream) 12%, transparent) !important;
  border-radius: 999px !important;
  background: rgba(255,255,255,.035) !important;
  color: color-mix(in srgb, var(--master-cream) 74%, transparent) !important;
}

.master-sales-settings-card textarea {
  min-height: 112px !important;
  line-height: 1.45 !important;
  resize: vertical !important;
}

.master-sales-color-row input[type="color"] {
  height: 36px !important;
  padding: 3px !important;
  cursor: pointer !important;
}

.master-sales-chart-card {
  border-radius: 24px !important;
  border-color: color-mix(in srgb, var(--master-cream) 12%, transparent) !important;
  background:
    linear-gradient(145deg, rgba(255,255,255,.055), rgba(255,255,255,.014)),
    rgba(0,0,0,.14) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.045) !important;
}

.master-sales-chart-controls button {
  min-height: 30px !important;
  padding: 0 12px !important;
  border-radius: 999px !important;
  cursor: pointer !important;
}

.master-sales-bars {
  gap: 10px !important;
}

.master-sales-bars button {
  grid-template-columns: 150px minmax(160px, 1fr) 72px !important;
  min-height: 44px !important;
  border: 1px solid color-mix(in srgb, var(--master-cream) 10%, transparent) !important;
  border-radius: 16px !important;
  background: rgba(255,255,255,.038) !important;
  cursor: pointer !important;
  transition: transform .16s ease, border-color .16s ease, background .16s ease !important;
}

.master-sales-bars button:hover,
.master-sales-feed-row:hover {
  transform: translateY(-1px) !important;
  border-color: color-mix(in srgb, var(--master-amber, #D48A55) 36%, transparent) !important;
  background: rgba(212,138,85,.055) !important;
}

.master-sales-bars i {
  height: 10px !important;
  border-radius: 999px !important;
  box-shadow: 0 0 16px rgba(212,138,85,.18) !important;
}

.master-sales-feed-list {
  max-height: 620px !important;
  gap: 12px !important;
}

.master-sales-feed-row {
  border-radius: 20px !important;
  border-color: color-mix(in srgb, var(--master-cream) 10%, transparent) !important;
  background:
    linear-gradient(145deg, rgba(255,255,255,.045), rgba(255,255,255,.014)),
    rgba(0,0,0,.10) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.035) !important;
  transition: transform .16s ease, border-color .16s ease, background .16s ease !important;
}

.master-sales-score {
  min-width: 64px !important;
  padding: 8px 10px !important;
  border-radius: 999px !important;
  background: rgba(255,255,255,.045) !important;
  color: color-mix(in srgb, var(--master-amber, #D48A55) 76%, var(--master-cream) 24%) !important;
}

@media (max-width: 1180px) {
  .master-sales-slider-grid,
  .master-sales-three-col,
  .master-sales-color-row {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 760px) {
  .master-sales-control-strip,
  .master-sales-inline-form,
  .master-sales-settings-card {
    border-radius: 18px !important;
  }
  .master-sales-slider-grid,
  .master-sales-three-col,
  .master-sales-color-row,
  .master-sales-bars button {
    grid-template-columns: 1fr !important;
  }
}

/* 2026-06-18 Focus final polish: tighter top title spacing, aligned focus actions, header icons as links. */
@media (min-width: 901px) {
  body .stage > section.view.focus-view.is-active[data-view="focus"] {
    padding-top: calc(var(--topbar-height) + clamp(2px, .45vh, 8px)) !important;
    padding-bottom: calc(var(--dynamic-footer-height, 82px) + clamp(30px, 3.6vh, 50px)) !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] > .focus-stage {
    row-gap: clamp(8px, 1vh, 13px) !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-header {
    transform: translateY(-2px) !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-stage > article.response {
    padding-top: clamp(66px, 6.7vh, 84px) !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .response > .walkthrough-button,
  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-thread-actions {
    top: clamp(20px, 2.25vh, 28px) !important;
    height: 42px !important;
    min-height: 42px !important;
    align-items: center !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .response > .walkthrough-button,
  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-new-thread-button {
    height: 42px !important;
    min-height: 42px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    vertical-align: top !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-thread-actions {
    right: clamp(174px, 12.8vw, 230px) !important;
    gap: 10px !important;
  }
}

.topbar .topbar-action,
.topbar .top-install-button.topbar-action,
.topbar .logout-button.topbar-action,
.topbar .topbar-action:disabled,
.topbar .top-install-button.topbar-action:disabled,
.topbar .logout-button.topbar-action:disabled {
  height: 34px !important;
  min-width: 0 !important;
  padding: 0 7px !important;
  border-color: transparent !important;
  background: transparent !important;
  box-shadow: none !important;
  color: color-mix(in srgb, var(--cream) 74%, var(--amber) 26%) !important;
  opacity: 1 !important;
}

.topbar .topbar-action:hover,
.topbar .top-install-button.topbar-action:hover,
.topbar .logout-button.topbar-action:hover,
.topbar .topbar-action:focus-visible,
.topbar .top-install-button.topbar-action:focus-visible,
.topbar .logout-button.topbar-action:focus-visible {
  border-color: transparent !important;
  background: transparent !important;
  color: var(--amber) !important;
  box-shadow: none !important;
  transform: translateY(-1px) !important;
  outline: none !important;
}

.topbar .topbar-action svg {
  width: 20px !important;
  height: 20px !important;
  opacity: 1 !important;
  stroke-width: 1.75 !important;
}

.topbar .topbar-action span {
  font-size: 9px !important;
  letter-spacing: .105em !important;
  color: currentColor !important;
}

@media (max-width: 1120px) {
  .topbar .topbar-action,
  .topbar .top-install-button.topbar-action,
  .topbar .logout-button.topbar-action {
    width: 36px !important;
    height: 36px !important;
    padding: 0 !important;
  }
  .topbar .topbar-action svg {
    width: 21px !important;
    height: 21px !important;
  }
}

/* 2026-06-18 final Focus spacing polish: halve the vertical margin above and below the Focus messenger box. */
@media (min-width: 901px) {
  body .stage > section.view.focus-view.is-active[data-view="focus"] {
    padding-top: calc(var(--topbar-height) + clamp(1px, .22vh, 4px)) !important;
    padding-bottom: calc(var(--dynamic-footer-height, 82px) + clamp(15px, 1.8vh, 25px)) !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] > .focus-stage {
    row-gap: clamp(4px, .5vh, 7px) !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-stage > article.response,
  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-stage > form.focus-console {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
  }
}

/* 2026-06-18 Focus vertical fit correction: previous spacing pass changed padding/gaps only.
   This pass fixes the actual source of the remaining top/bottom void by letting the
   Focus stack occupy the safe viewport height and allowing the response panel to take
   the extra vertical space. */
@media (min-width: 901px) {
  body .stage > section.view.focus-view.is-active[data-view="focus"] {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: minmax(0, 1fr) !important;
    padding-top: clamp(0px, .28vh, 4px) !important;
    padding-right: clamp(18px, 2vw, 42px) !important;
    padding-bottom: clamp(8px, 1vh, 12px) !important;
    padding-left: clamp(18px, 2vw, 42px) !important;
    align-items: stretch !important;
    align-content: stretch !important;
    justify-items: stretch !important;
    justify-content: stretch !important;
    overflow: hidden !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] > .focus-stage {
    grid-row: 1 !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: clamp(54px, 6.4vh, 70px) minmax(0, 1fr) minmax(104px, auto) !important;
    row-gap: clamp(4px, .55vh, 7px) !important;
    align-content: stretch !important;
    align-items: stretch !important;
    justify-content: stretch !important;
    justify-items: center !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-header {
    width: 90% !important;
    min-width: 80% !important;
    max-width: none !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    align-self: stretch !important;
    justify-self: center !important;
    display: grid !important;
    place-items: end center !important;
    margin: 0 !important;
    padding: 0 !important;
    transform: translateY(-4px) !important;
    overflow: visible !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-kicker {
    margin-bottom: clamp(4px, .55vh, 7px) !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-logo {
    margin: 0 auto !important;
    line-height: .88 !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-stage > article.response {
    width: 90% !important;
    min-width: 80% !important;
    max-width: none !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    align-self: stretch !important;
    justify-self: center !important;
    margin: 0 !important;
    padding-top: clamp(62px, 6.4vh, 82px) !important;
    padding-bottom: clamp(20px, 2.2vh, 30px) !important;
    overflow: hidden !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-stage > form.focus-console {
    width: 90% !important;
    min-width: 80% !important;
    max-width: none !important;
    align-self: stretch !important;
    justify-self: center !important;
    margin: 0 !important;
    min-height: 104px !important;
    max-height: 130px !important;
    overflow: visible !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-console .terminal {
    min-height: clamp(54px, 6.8vh, 68px) !important;
    max-height: 78px !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-console .composer-actions {
    height: clamp(24px, 3vh, 32px) !important;
  }
}


/* 2026-06-18 Focus footer-safe alignment final: keep the action buttons in one row,
   reserve the fixed legal footer, and keep a small breathing gap below the topbar. */
@media (min-width: 901px) {
  body .stage > section.view.focus-view.is-active[data-view="focus"] {
    inset: var(--topbar-height, 72px) 0 calc(86px + var(--safe-bottom, 0px) + 12px) 0 !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: minmax(0, 1fr) !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    padding: clamp(12px, 1.45vh, 18px) clamp(18px, 2vw, 42px) 0 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    align-items: stretch !important;
    align-content: stretch !important;
    justify-items: stretch !important;
    justify-content: stretch !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] > .focus-stage {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: auto minmax(0, 1fr) auto !important;
    row-gap: clamp(6px, .85vh, 10px) !important;
    align-content: stretch !important;
    align-items: stretch !important;
    justify-content: stretch !important;
    justify-items: center !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-header,
  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-stage > article.response,
  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-stage > form.focus-console {
    width: 90% !important;
    min-width: 80% !important;
    max-width: none !important;
    margin-left: auto !important;
    margin-right: auto !important;
    justify-self: center !important;
    box-sizing: border-box !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-header {
    align-self: start !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding: 0 !important;
    display: grid !important;
    place-items: start center !important;
    transform: none !important;
    overflow: visible !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-kicker {
    margin: 0 0 clamp(4px, .55vh, 7px) !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-logo {
    margin: 0 auto !important;
    line-height: .9 !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-stage > article.response {
    position: relative !important;
    align-self: stretch !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    padding-top: clamp(62px, 6.2vh, 78px) !important;
    padding-bottom: clamp(16px, 1.7vh, 24px) !important;
    overflow: hidden !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-stage > form.focus-console {
    position: relative !important;
    align-self: start !important;
    height: auto !important;
    min-height: clamp(96px, 10.8vh, 112px) !important;
    max-height: clamp(108px, 12vh, 124px) !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    overflow: hidden !important;
    z-index: 30 !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-console .composer-actions {
    height: clamp(22px, 2.5vh, 28px) !important;
    min-height: 22px !important;
    margin-bottom: 2px !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-console .terminal {
    min-height: clamp(52px, 6.2vh, 62px) !important;
    max-height: 68px !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-console .terminal-help {
    margin-top: 6px !important;
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .response > .walkthrough-button,
  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-thread-actions {
    top: clamp(20px, 2.4vh, 28px) !important;
    height: 42px !important;
    min-height: 42px !important;
    max-height: 42px !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    align-items: stretch !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .response > .walkthrough-button {
    position: absolute !important;
    right: clamp(24px, 3vw, 42px) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    line-height: 1 !important;
    z-index: 9 !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-thread-actions {
    position: absolute !important;
    right: clamp(174px, 13vw, 232px) !important;
    display: flex !important;
    flex-wrap: nowrap !important;
    justify-content: flex-end !important;
    gap: 10px !important;
    width: auto !important;
    max-width: calc(100% - 340px) !important;
    z-index: 9 !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-new-thread-button,
  body .stage > section.view.focus-view.is-active[data-view="focus"] .walkthrough-button {
    height: 42px !important;
    min-height: 42px !important;
    max-height: 42px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    line-height: 1 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    box-sizing: border-box !important;
    white-space: nowrap !important;
  }
}

@media (min-width: 901px) and (max-height: 820px) {
  body .stage > section.view.focus-view.is-active[data-view="focus"] {
    inset: var(--topbar-height, 72px) 0 calc(82px + var(--safe-bottom, 0px) + 10px) 0 !important;
    padding-top: clamp(8px, 1vh, 12px) !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] > .focus-stage {
    row-gap: 5px !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-logo {
    font-size: clamp(28px, 3.4vw, 38px) !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-stage > article.response {
    padding-top: 58px !important;
    padding-bottom: 14px !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-stage > form.focus-console {
    min-height: 96px !important;
    max-height: 108px !important;
  }
}

/* 2026-06-18 Focus logo breathing room and unified action button group. */
@media (min-width: 901px) {
  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-header {
    padding-top: clamp(5px, .65vh, 9px) !important;
    padding-bottom: clamp(6px, .75vh, 10px) !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-kicker {
    margin-bottom: clamp(5px, .65vh, 9px) !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-logo {
    margin-top: clamp(1px, .2vh, 3px) !important;
    margin-bottom: clamp(2px, .3vh, 5px) !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .response > .walkthrough-button {
    display: none !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-thread-actions {
    position: absolute !important;
    top: clamp(22px, 2.55vh, 30px) !important;
    right: clamp(24px, 3vw, 42px) !important;
    height: 42px !important;
    min-height: 42px !important;
    max-height: 42px !important;
    display: inline-flex !important;
    align-items: stretch !important;
    justify-content: flex-end !important;
    gap: 10px !important;
    width: auto !important;
    max-width: calc(100% - 48px) !important;
    margin: 0 !important;
    padding: 0 !important;
    z-index: 12 !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-thread-actions .focus-new-thread-button,
  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-thread-actions .walkthrough-button {
    position: static !important;
    inset: auto !important;
    height: 42px !important;
    min-height: 42px !important;
    max-height: 42px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 0 0 auto !important;
    margin: 0 !important;
    padding: 0 clamp(16px, 1.35vw, 22px) !important;
    line-height: 1 !important;
    vertical-align: top !important;
    box-sizing: border-box !important;
    white-space: nowrap !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-thread-actions .walkthrough-button {
    border-color: color-mix(in srgb, var(--green) 72%, transparent) !important;
    background: linear-gradient(180deg, color-mix(in srgb, var(--green) 46%, transparent), color-mix(in srgb, var(--green) 26%, transparent)) !important;
    color: color-mix(in srgb, #ffffff 86%, var(--cream)) !important;
    box-shadow: 0 0 18px color-mix(in srgb, var(--green) 18%, transparent) !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-stage > article.response {
    padding-top: clamp(66px, 6.8vh, 86px) !important;
  }
}

/* 2026-06-18 Focus action order and composer icon breathing room. */
@media (min-width: 901px) {
  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-stage > article.response {
    padding-top: clamp(70px, 7vh, 88px) !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-thread-actions {
    position: absolute !important;
    top: clamp(22px, 2.45vh, 30px) !important;
    left: clamp(42px, 3.8vw, 64px) !important;
    right: clamp(42px, 3.8vw, 64px) !important;
    height: 42px !important;
    min-height: 42px !important;
    max-height: 42px !important;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) minmax(132px, max-content) !important;
    align-items: stretch !important;
    justify-items: stretch !important;
    gap: clamp(10px, 1.15vw, 16px) !important;
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    z-index: 14 !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-thread-actions #focusCreateWorkspaceButton {
    order: 1 !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-thread-actions #focusNewThreadButton {
    order: 2 !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-thread-actions #focusWalkthroughButton {
    order: 3 !important;
    justify-self: stretch !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-thread-actions .focus-new-thread-button,
  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-thread-actions .walkthrough-button {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 42px !important;
    min-height: 42px !important;
    max-height: 42px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    padding: 0 clamp(14px, 1vw, 20px) !important;
    box-sizing: border-box !important;
    white-space: nowrap !important;
    line-height: 1 !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-context-bar {
    margin-top: 0 !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-console .composer-actions {
    height: auto !important;
    min-height: 44px !important;
    max-height: 48px !important;
    padding-top: 8px !important;
    padding-bottom: 8px !important;
    margin-bottom: 4px !important;
    box-sizing: border-box !important;
    align-items: center !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-console .composer-icon-button {
    align-self: center !important;
  }
}

/* 2026-06-18 Focus action row: buttons below matching dropdowns. */
@media (min-width: 901px) {
  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-stage > article.response {
    display: grid !important;
    grid-template-rows: auto auto minmax(0, 1fr) !important;
    align-content: stretch !important;
    align-items: stretch !important;
    row-gap: clamp(10px, 1.15vh, 14px) !important;
    padding-top: clamp(30px, 3.2vh, 44px) !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-context-bar {
    position: relative !important;
    inset: auto !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    width: 100% !important;
    max-width: none !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(126px, max-content) !important;
    column-gap: clamp(10px, 1.15vw, 16px) !important;
    row-gap: 0 !important;
    align-items: end !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-context-selects {
    display: contents !important;
    width: auto !important;
    max-width: none !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-context-selects label {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    display: grid !important;
    gap: 8px !important;
    margin: 0 !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-context-selects select {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-context-bar .time {
    grid-column: 3 !important;
    justify-self: center !important;
    align-self: end !important;
    margin: 0 !important;
    padding: 0 0 4px !important;
    white-space: nowrap !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-thread-actions {
    position: relative !important;
    inset: auto !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    width: 100% !important;
    max-width: none !important;
    height: 42px !important;
    min-height: 42px !important;
    max-height: 42px !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(126px, max-content) !important;
    column-gap: clamp(10px, 1.15vw, 16px) !important;
    row-gap: 0 !important;
    align-items: stretch !important;
    justify-items: stretch !important;
    margin: 0 !important;
    padding: 0 !important;
    z-index: 12 !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-thread-actions #focusCreateWorkspaceButton {
    grid-column: 1 !important;
    order: 1 !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-thread-actions #focusNewThreadButton {
    grid-column: 2 !important;
    order: 2 !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-thread-actions #focusWalkthroughButton {
    grid-column: 3 !important;
    order: 3 !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-thread-actions .focus-new-thread-button,
  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-thread-actions .walkthrough-button {
    position: static !important;
    inset: auto !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 42px !important;
    min-height: 42px !important;
    max-height: 42px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    padding: 0 clamp(14px, 1vw, 20px) !important;
    box-sizing: border-box !important;
    line-height: 1 !important;
    white-space: nowrap !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .response-content {
    min-height: 0 !important;
    height: 100% !important;
    max-height: none !important;
    margin-top: clamp(2px, 0.55vh, 6px) !important;
    overflow-y: auto !important;
  }
}

/* 2026-06-18 Focus context row: dropdown + action + dropdown + action + walkthrough. */
@media (min-width: 901px) {
  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-stage > article.response {
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr) !important;
    row-gap: clamp(10px, 1.1vh, 14px) !important;
    padding-top: clamp(30px, 3.15vh, 42px) !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .response > .walkthrough-button {
    display: none !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-context-bar {
    position: relative !important;
    inset: auto !important;
    width: 100% !important;
    max-width: none !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: auto auto !important;
    row-gap: 4px !important;
    margin: 0 !important;
    padding: 0 0 clamp(10px, 1vh, 14px) !important;
    border-bottom: 1px solid color-mix(in srgb, var(--cream) 13%, transparent) !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-context-selects {
    width: 100% !important;
    max-width: none !important;
    display: grid !important;
    grid-template-columns: minmax(210px, 1.15fr) minmax(130px, auto) minmax(210px, 1.15fr) minmax(168px, auto) minmax(18px, 1fr) minmax(126px, auto) !important;
    column-gap: clamp(9px, 0.95vw, 14px) !important;
    row-gap: 8px !important;
    align-items: end !important;
    justify-items: stretch !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-context-selects label {
    display: grid !important;
    gap: 8px !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    margin: 0 !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-context-selects select {
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-workspace-field {
    grid-column: 1 !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] #focusCreateWorkspaceButton {
    grid-column: 2 !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-conversation-field {
    grid-column: 3 !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] #focusNewThreadButton {
    grid-column: 4 !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-context-spacer {
    grid-column: 5 !important;
    min-width: clamp(18px, 2vw, 42px) !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-thread-actions {
    position: static !important;
    inset: auto !important;
    grid-column: 6 !important;
    width: auto !important;
    min-width: 126px !important;
    max-width: none !important;
    height: 42px !important;
    min-height: 42px !important;
    max-height: 42px !important;
    display: flex !important;
    align-items: stretch !important;
    justify-content: flex-end !important;
    gap: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    z-index: 14 !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-inline-action,
  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-thread-actions .walkthrough-button {
    position: static !important;
    inset: auto !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 42px !important;
    min-height: 42px !important;
    max-height: 42px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
    padding: 0 clamp(14px, 1vw, 18px) !important;
    box-sizing: border-box !important;
    line-height: 1 !important;
    white-space: nowrap !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] #focusNewThreadButton {
    min-width: 168px !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] #focusCreateWorkspaceButton {
    min-width: 130px !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-context-bar .time {
    grid-column: 1 !important;
    grid-row: 2 !important;
    justify-self: end !important;
    align-self: center !important;
    margin: 0 !important;
    padding: 0 !important;
    opacity: 0.56 !important;
    white-space: nowrap !important;
    transform: translateY(1px) !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .response-content {
    min-height: 0 !important;
    height: 100% !important;
    max-height: none !important;
    margin-top: 0 !important;
    overflow-y: auto !important;
  }
}

@media (min-width: 901px) and (max-width: 1220px) {
  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-context-selects {
    grid-template-columns: minmax(160px, 1fr) minmax(118px, auto) minmax(160px, 1fr) minmax(144px, auto) minmax(8px, 1fr) minmax(118px, auto) !important;
    column-gap: 8px !important;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-inline-action,
  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-thread-actions .walkthrough-button {
    padding-left: 10px !important;
    padding-right: 10px !important;
    letter-spacing: 0.11em !important;
  }
}


/* 2026-06-18 restore Focus inline controls and welcome behavior (20260618-focus-media-thread-parity-16). */
@media (min-width: 901px) {
  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-thread-actions #focusWalkthroughButton {
    display: inline-flex !important;
    visibility: visible !important;
    opacity: 1 !important;
  }
  body .stage > section.view.focus-view.is-active[data-view="focus"] #focusNewThreadButton {
    min-width: 168px !important;
  }
}

/* 2026-06-18 Focus media/thread parity: use Messenger-style message lines/cards in Focus and keep generated images visible. */
body .stage > section.view.focus-view.is-active[data-view="focus"] .response-content .focus-thread-slice {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  justify-content: flex-start !important;
  gap: clamp(16px, 1.8vh, 22px) !important;
  width: 100% !important;
  min-height: 100% !important;
  padding: clamp(6px, 0.9vh, 10px) 0 clamp(14px, 1.8vh, 22px) !important;
}

body .stage > section.view.focus-view.is-active[data-view="focus"] .response-content .focus-thread-slice .message {
  flex: 0 0 auto !important;
  width: auto !important;
  max-width: min(980px, 100%) !important;
  margin: 0 !important;
  padding: 0 0 0 20px !important;
  border-left: 1px solid color-mix(in srgb, var(--amber) 42%, transparent) !important;
  border-right: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  text-align: left !important;
}

body .stage > section.view.focus-view.is-active[data-view="focus"] .response-content .focus-thread-slice .message.user {
  align-self: flex-end !important;
  padding-left: 0 !important;
  padding-right: 20px !important;
  border-left: 0 !important;
  border-right: 1px solid color-mix(in srgb, var(--cream) 24%, transparent) !important;
  text-align: right !important;
}

body .stage > section.view.focus-view.is-active[data-view="focus"] .response-content .focus-thread-slice .message-name {
  margin: 0 0 8px !important;
  color: var(--amber) !important;
  font-family: var(--sans) !important;
  font-size: 11px !important;
  letter-spacing: 0.16em !important;
  text-transform: uppercase !important;
}

body .stage > section.view.focus-view.is-active[data-view="focus"] .response-content .focus-thread-slice .message.user .message-name {
  color: color-mix(in srgb, var(--cream) 54%, transparent) !important;
}

body .stage > section.view.focus-view.is-active[data-view="focus"] .response-content .focus-thread-slice .message-text {
  color: color-mix(in srgb, var(--cream) 80%, transparent) !important;
  font-size: 15px !important;
  line-height: 1.6 !important;
  white-space: pre-wrap !important;
  overflow-wrap: anywhere !important;
}

body .stage > section.view.focus-view.is-active[data-view="focus"] .response-content .focus-thread-slice .message-text .rich-text p {
  margin: 0 0 10px !important;
}

body .stage > section.view.focus-view.is-active[data-view="focus"] .response-content .focus-thread-slice .message-image {
  width: min(680px, 100%) !important;
  max-width: min(680px, 100%) !important;
  display: grid !important;
  gap: 10px !important;
}

body .stage > section.view.focus-view.is-active[data-view="focus"] .response-content .focus-thread-slice .message-image img {
  display: block !important;
  width: auto !important;
  max-width: 100% !important;
  max-height: min(520px, 48vh) !important;
  object-fit: contain !important;
  border: 1px solid var(--line-soft) !important;
  background: rgba(0, 0, 0, 0.16) !important;
}

body .stage > section.view.focus-view.is-active[data-view="focus"] .response-content .focus-thread-slice .message-caption {
  color: color-mix(in srgb, var(--cream) 50%, transparent) !important;
  font-family: var(--sans) !important;
  font-size: 12px !important;
  line-height: 1.5 !important;
}

body .stage > section.view.focus-view.is-active[data-view="focus"] .response-content .focus-thread-slice .message-attachments {
  margin-top: 12px !important;
}
