/* v6.5.38 dashboard/workspace/files/mobile preservation patch
   Scoped to client-side Atticus views so admin console remains independent. */

:root {
  --atticus-new-conversation: #b97348;
  --atticus-new-conversation-strong: #d18a55;
  --atticus-new-workspace: #697f74;
  --atticus-new-workspace-strong: #91aa9b;
  --atticus-walkthrough: #48a76f;
  --atticus-walkthrough-strong: #63d48e;
}

html, body, #appRoot, .app-shell, .stage, .view {
  max-width: 100%;
  overflow-x: hidden;
}

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

.action-new-conversation,
.personal-action-pill.action-new-conversation,
#focusNewThreadButton,
#newThreadButton {
  border-color: rgba(209, 138, 85, 0.58) !important;
  background: linear-gradient(180deg, rgba(185, 115, 72, 0.30), rgba(185, 115, 72, 0.12)) !important;
  color: #f4d2b7 !important;
}

.action-new-workspace,
.personal-action-pill.action-new-workspace,
#focusCreateWorkspaceButton,
#newWorkspaceButton,
#dashboardCreateWorkspaceButton {
  border-color: rgba(145, 170, 155, 0.62) !important;
  background: linear-gradient(180deg, rgba(105, 127, 116, 0.34), rgba(105, 127, 116, 0.14)) !important;
  color: #d7eadf !important;
}

.action-walkthrough,
.walkthrough-button,
#focusWalkthroughButton {
  border-color: rgba(99, 212, 142, 0.62) !important;
  background: linear-gradient(180deg, rgba(72, 167, 111, 0.34), rgba(72, 167, 111, 0.13)) !important;
  color: #d6ffe4 !important;
}

.action-new-conversation:hover,
.action-new-workspace:hover,
.action-walkthrough:hover,
#focusNewThreadButton:hover,
#focusCreateWorkspaceButton:hover,
#newThreadButton:hover,
#newWorkspaceButton:hover,
#focusWalkthroughButton:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-context-selects > #focusCreateWorkspaceButton {
  min-width: 132px;
  padding-inline: 12px;
  white-space: nowrap;
}

body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-context-selects > #focusNewThreadButton {
  min-width: 146px;
  white-space: nowrap;
}

.messenger-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  max-width: 100%;
}

.thread-card {
  position: relative;
  overflow: hidden;
}

.thread-card .thread-button {
  padding-right: 96px;
}

.thread-card-actions {
  position: absolute;
  right: 10px;
  top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 3;
}

.thread-card-actions button,
.thread-archive-card,
.thread-rename {
  width: 78px;
  min-height: 28px;
  border: 1px solid rgba(228, 214, 189, 0.18);
  border-radius: 10px;
  background: rgba(7, 10, 9, 0.78);
  color: rgba(228, 214, 189, 0.86);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.thread-archive-card {
  border-color: rgba(209, 100, 85, 0.30);
  color: #efb5aa;
}

.thread-card-actions button:hover {
  background: rgba(228, 214, 189, 0.10);
}

.workspace-manager-grid {
  align-items: start;
}

.workspace-limit-banner {
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
  padding: 12px 14px;
  border: 1px solid rgba(209, 138, 85, 0.38);
  border-radius: 16px;
  background: rgba(185, 115, 72, 0.12);
  color: rgba(244, 210, 183, 0.96);
}

.workspace-limit-banner span {
  color: rgba(228, 214, 189, 0.72);
  font-size: 0.86rem;
}

.workspace-row-card.project-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 0;
  overflow: hidden;
}

.workspace-row-main {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 14px 14px 0;
  cursor: pointer;
}

.workspace-row-card.is-archived .workspace-row-main {
  cursor: default;
}

.workspace-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 14px 14px;
}

.workspace-archive-button,
.workspace-restore-button {
  border: 1px solid rgba(228, 214, 189, 0.18);
  border-radius: 12px;
  min-height: 34px;
  padding: 0 12px;
  background: rgba(228, 214, 189, 0.06);
  color: rgba(228, 214, 189, 0.86);
  cursor: pointer;
}

.workspace-archive-button {
  border-color: rgba(209, 100, 85, 0.34);
  color: #efb5aa;
}

.workspace-restore-button {
  border-color: rgba(145, 170, 155, 0.44);
  color: #d7eadf;
}

.workspace-main-note {
  color: rgba(228, 214, 189, 0.52);
  font-size: 0.82rem;
}

/* User dashboard should feel like the client interface, not the admin console. */
.personal-console {
  color: var(--text, #e4d6bd);
}

.personal-console .personal-panel,
.personal-console .abdash-panel,
.file-explorer-panel {
  border: 1px solid rgba(228, 214, 189, 0.13) !important;
  background:
    radial-gradient(circle at top left, rgba(199, 122, 75, 0.10), transparent 34%),
    linear-gradient(180deg, rgba(16, 23, 19, 0.92), rgba(5, 7, 10, 0.84)) !important;
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.28) !important;
}

.personal-console .personal-hero,
.personal-console .abdash-hero {
  border: 1px solid rgba(199, 122, 75, 0.23) !important;
  background:
    linear-gradient(135deg, rgba(199, 122, 75, 0.15), transparent 42%),
    rgba(16, 23, 19, 0.82) !important;
}

.personal-console .personal-dashboard-grid,
.personal-console .personal-dashboard-grid-secondary {
  gap: 14px;
}

.personal-console .project-row,
.personal-console .notification-row,
.personal-console .system-card,
.personal-console .personal-radar-row,
.personal-console .personal-app-row,
.personal-console .personal-workspace-breakdown-row,
.personal-console .personal-snapshot-card,
.personal-console .personal-chart-card {
  border-color: rgba(228, 214, 189, 0.12) !important;
  background: rgba(5, 7, 10, 0.40) !important;
}

.interactive-chart-card {
  position: relative;
}

.personal-chart-stage {
  position: relative;
  min-height: 72px;
  margin: 8px 0 4px;
}

.personal-chart-stage .personal-sparkline {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.personal-chart-points {
  position: absolute;
  inset: 7px 0 7px 0;
}

.personal-chart-point {
  position: absolute;
  width: 13px;
  height: 13px;
  border-radius: 999px;
  border: 1px solid rgba(228, 214, 189, 0.78);
  background: rgba(199, 122, 75, 0.94);
  transform: translate(-50%, -50%);
  cursor: crosshair;
  opacity: 0.26;
}

.personal-chart-point:hover,
.personal-chart-point:focus-visible {
  opacity: 1;
  width: 17px;
  height: 17px;
  outline: 2px solid rgba(199, 122, 75, 0.22);
}

.personal-chart-readout {
  min-height: 24px;
  margin-top: 8px;
  padding: 6px 9px;
  border: 1px solid rgba(228, 214, 189, 0.10);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.20);
  color: rgba(228, 214, 189, 0.82);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  letter-spacing: 0.04em;
}

.file-browser-toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(280px, 2fr);
  gap: 12px;
  align-items: end;
}

.file-browser-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.file-browser-controls input,
.file-browser-controls select,
.file-view-button {
  min-height: 38px;
  max-width: 100%;
  border: 1px solid rgba(228, 214, 189, 0.16);
  border-radius: 12px;
  background: rgba(5, 7, 10, 0.72);
  color: rgba(228, 214, 189, 0.92);
  padding: 0 11px;
}

.file-browser-controls input {
  flex: 1 1 180px;
}

.file-browser-controls select {
  flex: 0 1 150px;
}

.file-view-toggle {
  display: flex;
  gap: 6px;
}

.file-view-button {
  cursor: pointer;
  flex: 0 0 auto;
}

.file-view-button.is-active {
  border-color: rgba(199, 122, 75, 0.52);
  background: rgba(199, 122, 75, 0.18);
}

.file-browser-summary {
  color: rgba(228, 214, 189, 0.58);
  font-size: 0.82rem;
  margin-bottom: 10px;
}

.file-folder-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.file-folder-title span {
  color: rgba(228, 214, 189, 0.46);
  font-weight: 500;
}

.file-explorer.is-list-view .file-row-grid {
  display: grid;
  grid-template-columns: 1fr;
}

.file-explorer.is-list-view .file-tile {
  display: grid;
  grid-template-columns: 72px 1fr;
  text-align: left;
  min-height: 82px;
}

.file-info em {
  display: block;
  margin-top: 4px;
  color: rgba(228, 214, 189, 0.44);
  font-style: normal;
  font-size: 0.76rem;
}

/* Serious mobile bounding. Keep inputs visible and stop right-side overflow. */
@media (max-width: 900px) {
  .stage,
  .page-view,
  .focus-stage,
  .messenger-layout,
  .personal-console,
  .file-explorer-panel {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  .page-header,
  .personal-dashboard-header,
  .messenger-header-actions,
  .file-browser-toolbar,
  .file-browser-controls {
    grid-template-columns: 1fr !important;
    justify-content: stretch;
  }

  .messenger-header-actions > *,
  .file-browser-controls > *,
  .file-browser-controls input,
  .file-browser-controls select,
  .file-view-toggle,
  .file-view-button {
    width: 100%;
    flex: 1 1 100%;
  }

  .focus-context-selects {
    grid-template-columns: 1fr !important;
    width: 100%;
  }

  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-context-selects > #focusNewThreadButton,
  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-context-selects > #focusCreateWorkspaceButton,
  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-context-selects > #focusWalkthroughButton,
  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-context-selects > .focus-icon-action,
  body .stage > section.view.focus-view.is-active[data-view="focus"] .focus-context-selects select {
    width: 100% !important;
    max-width: 100% !important;
  }

  .focus-view .focus-console,
  .messenger-layout .thread-compose {
    position: sticky !important;
    bottom: max(8px, env(safe-area-inset-bottom)) !important;
    z-index: 20;
    width: 100% !important;
    max-width: calc(100vw - 18px) !important;
    margin-inline: auto !important;
  }

  .terminal,
  .thread-compose .terminal {
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
  }

  .terminal textarea,
  .thread-compose textarea,
  #focusInput,
  #messengerInput {
    max-width: 100% !important;
    min-width: 0 !important;
  }

  .thread-card .thread-button {
    padding-right: 12px;
    padding-bottom: 72px;
  }

  .thread-card-actions {
    left: 12px;
    right: 12px;
    top: auto;
    bottom: 10px;
    flex-direction: row;
  }

  .thread-card-actions button {
    width: auto;
    flex: 1;
  }

  .workspace-row-main {
    align-items: flex-start;
    flex-direction: column;
  }

  .personal-dashboard-grid,
  .personal-dashboard-grid-secondary,
  .workspace-manager-grid {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 520px) {
  .stage {
    padding-inline: 8px !important;
  }

  .focus-stage {
    gap: 8px !important;
  }

  .response,
  .focus-console,
  .thread-main,
  .thread-list,
  .abdash-panel,
  .file-explorer-panel {
    border-radius: 16px !important;
  }

  .composer-actions {
    flex-wrap: wrap;
  }

  .composer-icon-button {
    min-width: 42px;
  }

  .file-explorer.is-list-view .file-tile {
    grid-template-columns: 54px 1fr;
  }
}

body .stage > section.view.page-view.is-active[data-view="messenger"] .thread-card-actions .thread-rename,
body .stage > section.view.page-view.is-active[data-view="messenger"] .thread-card-actions .thread-archive-card {
  position: static !important;
  right: auto !important;
  bottom: auto !important;
  grid-column: auto !important;
  justify-self: stretch !important;
  width: 78px !important;
  min-width: 78px !important;
  max-width: 78px !important;
  height: 28px !important;
  padding: 0 8px !important;
}

@media (max-width: 900px) {
  body .stage > section.view.page-view.is-active[data-view="messenger"] .thread-card-actions .thread-rename,
  body .stage > section.view.page-view.is-active[data-view="messenger"] .thread-card-actions .thread-archive-card {
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    flex: 1 1 0;
  }
}
