/* Desktop workspace shell — layout only. Mobile keeps the existing compact UI. */
.desktop-conversation-width-toggle,
.desktop-context-dock-resize,
.desktop-mode-label,
.desktop-model-summary {
  display: none;
}

.desktop-conversation-meta {
  display: contents;
}

@media (min-width: 901px) {
  body {
    --desktop-context-width: 320px;
    --desktop-conversation-width: 900px;
    width: 100%;
    max-width: none;
    height: 100dvh;
    min-height: 100vh;
    margin: 0;
    padding: 12px 18px 14px;
    gap: 10px;
    overflow: hidden;
  }

  body[data-desktop-conversation="expanded"] {
    --desktop-conversation-width: 1040px;
  }

  body.deep-thought-sidecar-open {
    max-width: none;
    margin: 0;
  }

  .page-header {
    position: relative;
    flex: 0 0 auto;
    width: 100%;
    min-height: 40px;
    display: flex;
    align-items: center;
  }

  .page-header-brand {
    position: relative;
    z-index: 52;
  }

  .top-chat-controls {
    position: fixed;
    z-index: 50;
    top: 62px;
    bottom: 12px;
    left: 12px;
    width: 72px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 4px 5px 64px;
    overflow-x: hidden;
    overflow-y: auto;
    border: 0;
    background: transparent;
  }

  .top-library-control,
  .top-library-menu {
    display: contents;
  }

  .top-chat-control.top-library-toggle {
    display: none;
  }

  .top-chat-controls .top-chat-control {
    flex: 0 0 auto;
    width: 60px;
    min-width: 60px;
    min-height: 52px;
    padding: 6px 4px;
    flex-direction: column;
    gap: 4px;
    border-radius: 10px;
    font-size: 10px;
    line-height: 1.1;
    text-align: center;
    border-color: transparent;
    background: transparent;
  }

  .top-chat-controls .top-chat-control:hover,
  .top-chat-controls .top-chat-control:focus-visible {
    border-color: transparent;
    background: var(--surface-purple-hover);
  }

  .top-chat-controls .top-chat-control[aria-expanded="true"] {
    border-color: transparent;
    background: var(--surface-purple-active);
  }

  .top-chat-controls .top-chat-control-icon {
    font-size: 17px;
  }

  .top-chat-controls .top-chat-control-value {
    width: 54px;
    font-size: 9px;
  }

  .top-chat-controls .top-model-launcher .top-chat-control-value {
    display: none;
  }

  .top-chat-controls .desktop-mode-label {
    display: block;
    width: 60px;
    color: var(--text-subtle);
    font-size: 10px;
    font-weight: 600;
    line-height: 1.15;
    overflow: visible;
    white-space: normal;
  }

  .top-chat-controls .top-chat-control-chevron {
    display: none;
  }

  .settings-toggle {
    position: relative;
    z-index: 52;
    margin-left: 10px;
    width: 42px;
    min-height: 42px;
    padding: 5px;
    border-color: transparent;
    background: transparent;
  }

  .desktop-conversation-meta {
    position: absolute;
    z-index: 52;
    top: 0;
    left: 50%;
    width: min(var(--desktop-conversation-width), calc(100vw - 200px));
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    transform: translateX(-50%);
  }

  .desktop-model-summary {
    min-width: 0;
    max-width: min(640px, calc(100% - 52px));
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 6px 10px;
    color: var(--text-subtle);
    border: 1px solid var(--border-purple-soft);
    border-radius: 10px;
    background: var(--surface-tint);
  }

  .desktop-model-summary-label {
    flex: 0 0 auto;
    color: var(--text-faint);
    font-size: 10px;
    font-weight: 750;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .desktop-model-summary-value {
    min-width: 0;
    overflow: hidden;
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  body > .status,
  body > .transcript-shell,
  body > .composer-shell,
  body > .hint,
  body > .command-hint,
  body > .multi-tab-warning {
    width: min(var(--desktop-conversation-width), calc(100vw - 200px));
    max-width: calc(100vw - 200px);
    margin-right: auto;
    margin-left: auto;
    align-self: center;
  }

  body > .status {
    flex: 0 0 auto;
  }

  body > .transcript-shell {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    border-color: transparent;
    border-radius: 0;
    background: transparent;
  }

  body > .transcript-shell .transcript-toolbar {
    padding-right: 0;
    padding-left: 0;
    background: transparent;
  }

  body > .transcript-shell #log {
    padding-right: 0;
    padding-left: 0;
  }

  body > .composer-shell,
  body > .hint,
  body > .command-hint {
    flex: 0 0 auto;
  }

  body > .composer-shell #form {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  body > .composer-shell #input {
    --desktop-composer-line-height: 24px;
    width: 100%;
    height: 98px;
    min-height: 98px;
    max-height: min(242px, 33.333dvh);
    line-height: var(--desktop-composer-line-height);
    overflow-y: hidden;
  }

  .composer-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
  }

  .composer-toolbar-left,
  .composer-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  .composer-toolbar-left {
    min-width: 0;
    flex: 1 1 520px;
    flex-wrap: wrap;
  }

  .composer-toolbar-actions {
    flex: 0 0 auto;
    margin-left: auto;
  }

  .composer-toolbar-left .quick-audio-row {
    justify-content: flex-start;
    align-self: auto;
    flex: 1 1 auto;
  }

  .composer-toolbar-actions #send {
    min-height: 44px;
  }

  .desktop-composer-expand {
    display: inline-flex;
    flex: 0 0 auto;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    padding: 10px 12px;
    border: 1px solid var(--border-purple);
    border-radius: 8px;
    color: var(--brand-deep);
    background: var(--surface-tint);
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 700;
  }

  .desktop-composer-expand:hover,
  .desktop-composer-expand:focus-visible,
  .desktop-composer-expand[aria-expanded="true"] {
    border-color: var(--border-purple-strong);
    background: var(--surface-purple);
    outline: none;
  }

  .desktop-conversation-width-toggle {
    display: inline-flex;
    align-items: center;
  }

  body.history-open .status,
  body.files-open .status {
    display: block;
  }

  body.history-open .transcript-shell,
  body.files-open .transcript-shell,
  body.history-open .composer-shell,
  body.files-open .composer-shell,
  body.history-open .controls,
  body.files-open .controls,
  body.history-open .quick-audio-row,
  body.files-open .quick-audio-row,
  body.history-open .mode-toggle,
  body.files-open .mode-toggle {
    display: flex;
  }

  body.history-open .hint,
  body.files-open .hint,
  body.history-open .command-hint,
  body.files-open .command-hint {
    display: block;
  }

  body.history-open .top-history-panel,
  body.files-open .top-files-panel {
    position: fixed;
    z-index: 44;
    top: 62px;
    bottom: 12px;
    left: 94px;
    width: var(--desktop-context-width);
    max-width: var(--desktop-context-width);
    max-height: none;
    margin: 0;
    overflow-x: hidden;
    overflow-y: auto;
    border: 0;
    border-radius: 12px;
    box-shadow: 0 18px 54px rgba(23, 18, 48, 0.16);
  }

  body.history-open .top-history-header {
    flex-wrap: wrap;
  }

  body.history-open .top-history-header > div:first-child {
    min-width: 0;
    flex: 1 1 150px;
  }

  body.history-open .top-history-search-wrap {
    flex: 1 1 100%;
    order: 3;
  }

  body.history-open .history-view-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 3px;
    border-bottom: 1px solid var(--border-warm);
  }

  body.history-open .history-view-tab,
  body.files-open .history-view-tab {
    border: 0;
    border-radius: 8px;
    background: transparent;
  }

  body.history-open .history-view-tab:hover,
  body.files-open .history-view-tab:hover {
    background: var(--surface-purple-hover);
  }

  body.history-open .history-view-tab.active,
  body.files-open .history-view-tab.active {
    color: var(--brand-strong);
    background: var(--surface-purple-active);
  }

  body.history-open .saved-history-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    overflow: hidden;
    border: 0;
    border-bottom: 1px solid var(--border-warm);
    border-radius: 0;
    background: transparent;
  }

  body.history-open .saved-history-list {
    gap: 0;
  }

  body.history-open .saved-history-item:hover,
  body.history-open .saved-history-item:focus-within {
    border-bottom-color: var(--border-warm);
    background: var(--surface-tint);
  }

  body.history-open .saved-history-item.active {
    margin: 3px 0;
    border-bottom-color: transparent;
    border-radius: 9px;
    background: var(--surface-purple);
    box-shadow: none;
  }

  body.history-open .saved-history-open,
  body.history-open .saved-history-row-actions {
    width: 100%;
  }

  body.history-open .saved-history-row-actions,
  body.history-open .saved-history-row-actions.has-project-control {
    flex: 0 0 auto;
    padding: 0 10px 9px;
    flex-wrap: wrap;
  }

  body.history-open .saved-history-row-actions .settings-reset-btn {
    border-color: transparent;
    background: transparent;
  }

  body.files-open .file-card {
    border: 0;
    border-bottom: 1px solid var(--border-warm);
    border-radius: 0;
    background: transparent;
  }

  body.history-open .desktop-context-dock-resize,
  body.files-open .desktop-context-dock-resize {
    position: fixed;
    z-index: 53;
    top: 62px;
    bottom: 12px;
    left: calc(88px + var(--desktop-context-width));
    width: 12px;
    display: block;
    cursor: col-resize;
    touch-action: none;
  }

  .desktop-context-dock-resize::after {
    position: absolute;
    top: 44%;
    bottom: 44%;
    left: 5px;
    width: 2px;
    min-height: 48px;
    border-radius: 999px;
    background: var(--border-purple-strong);
    content: "";
    opacity: 0.8;
  }

  .desktop-context-dock-resize:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 1px;
  }

  .deep-thought-sidecar {
    top: 62px;
    bottom: 12px;
    box-shadow: 0 18px 54px rgba(23, 18, 48, 0.16);
  }

  .deep-thought-sidecar-content {
    padding: 0 16px 16px;
  }

  .deep-thought-sidecar-readiness {
    margin: 14px 0 0;
    border-width: 0 0 0 3px;
    border-radius: 0 9px 9px 0;
  }

  .deep-thought-sidecar-metric {
    padding: 4px 2px;
    border: 0;
    border-radius: 0;
    background: transparent;
  }

  .deep-thought-sidecar-checkpoint {
    margin: 0;
    padding: 15px 2px;
    border: 0;
    border-bottom: 1px solid var(--border-neutral-soft);
    border-radius: 0;
    background: transparent;
  }

  .deep-thought-sidecar-section {
    margin: 0;
    padding: 16px 2px 5px;
    border: 0;
    border-bottom: 1px solid var(--border-neutral-soft);
    border-radius: 0;
    background: transparent;
  }

  .deep-thought-sidecar-item {
    margin: 0;
    padding: 12px 0;
    border: 0;
    border-top: 1px solid var(--border-neutral-soft);
    border-radius: 0;
    background: transparent;
  }

  .deep-thought-sidecar-item:first-of-type {
    border-top: 0;
  }

  .roundtable-run-controls {
    padding: 6px 0;
    border-width: 1px 0 0;
    border-radius: 0;
    background: transparent;
  }

  body.settings-open .settings-panel,
  body.model-open .top-model-panel {
    width: min(1040px, calc(100vw - 200px));
    max-width: calc(100vw - 200px);
    margin-right: auto;
    margin-left: auto;
    align-self: center;
  }
}

@media (min-width: 1680px) {
  body.history-open .top-history-panel,
  body.files-open .top-files-panel {
    box-shadow: none;
  }

  .deep-thought-sidecar {
    box-shadow: none;
  }
}
