/*
 * Dr.Prompt · PSD surface and embedded-control system (P10)
 * Presentation-only: normalize panel frames, remove redundant nested card chrome,
 * keep actions visually embedded, and close remaining responsive width gaps.
 */
:root {
  --df-frame-line: rgba(255, 255, 255, .14);
  --df-frame-fill: rgba(255, 255, 255, .045);
  --df-inset-fill: rgba(8, 8, 11, .56);
  --df-control-hover: rgba(255, 255, 255, .075);
  --df-control-active: rgba(189, 168, 255, .13);
}

/* One quiet outer frame language for functional-page modules. */
#app[data-active-view]:not([data-active-view="home"]) .panel,
#app[data-active-view]:not([data-active-view="home"]) .page-hero,
#app[data-active-view]:not([data-active-view="home"]) .task-session-board,
#app[data-active-view]:not([data-active-view="home"]) .project-log-toolbar,
#app[data-active-view]:not([data-active-view="home"]) .model-service-nav,
#app[data-active-view]:not([data-active-view="home"]) .template-use-workspace,
#app[data-active-view]:not([data-active-view="home"]) .workflow-board,
#app[data-active-view]:not([data-active-view="home"]) .schema-grid,
#app[data-active-view]:not([data-active-view="home"]) .project-log-summary,
#app[data-active-view]:not([data-active-view="home"]) .project-log-detail,
#app[data-active-view]:not([data-active-view="home"]) .model-service-workspace {
  box-sizing: border-box !important;
  min-width: 0 !important;
  max-width: 100% !important;
  border: 1px solid var(--df-frame-line) !important;
  border-radius: 18px !important;
  background: var(--df-frame-fill) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.035) !important;
}

/* Avoid card-within-card chrome: inner groups become open content areas. */
#app[data-active-view]:not([data-active-view="home"]) .template-use-workspace .template-use-editor-card,
#app[data-active-view]:not([data-active-view="home"]) .project-log-toolbar .project-log-filters,
#app[data-active-view]:not([data-active-view="home"]) .project-log-grid .project-log-card,
#app[data-active-view]:not([data-active-view="home"]) .model-service-detail-stack .model-service-detail-card,
#app[data-active-view]:not([data-active-view="home"]) .task-session-board .session-card,
#app[data-active-view]:not([data-active-view="home"]) .workflow-board > div,
#app[data-active-view]:not([data-active-view="home"]) .schema-grid > section,
#app[data-active-view]:not([data-active-view="home"]) .asset-row-card {
  box-shadow: none !important;
}

#app[data-active-view]:not([data-active-view="home"]) .template-use-workspace .template-use-editor-card,
#app[data-active-view]:not([data-active-view="home"]) .project-log-toolbar .project-log-filters,
#app[data-active-view]:not([data-active-view="home"]) .model-service-detail-stack .model-service-detail-card,
#app[data-active-view]:not([data-active-view="home"]) .workflow-board > div,
#app[data-active-view]:not([data-active-view="home"]) .schema-grid > section {
  border-color: transparent !important;
  background: transparent !important;
}

/* Text entry fields are the intentional solid inner frame. */
#app[data-active-view]:not([data-active-view="home"]) .idea-input,
#app[data-active-view]:not([data-active-view="home"]) .template-editor,
#app[data-active-view]:not([data-active-view="home"]) .project-log-filters input,
#app[data-active-view]:not([data-active-view="home"]) .project-log-filters select,
#app[data-active-view]:not([data-active-view="home"]) .model-service-detail-stack input,
#app[data-active-view]:not([data-active-view="home"]) .model-service-detail-stack select,
#app[data-active-view]:not([data-active-view="home"]) .model-service-detail-stack textarea {
  box-sizing: border-box !important;
  min-width: 0 !important;
  max-width: 100% !important;
  border-color: rgba(255,255,255,.12) !important;
  border-radius: 12px !important;
  background: var(--df-inset-fill) !important;
}

/* Buttons sit in their parent surface instead of forming another pile of cards. */
#app[data-active-view]:not([data-active-view="home"]) .panel button:not(.primary-btn):not(.composer-send-btn),
#app[data-active-view]:not([data-active-view="home"]) .page-hero button:not(.primary-btn),
#app[data-active-view]:not([data-active-view="home"]) .template-use-workspace button:not(.primary-btn),
#app[data-active-view]:not([data-active-view="home"]) .task-session-board button:not(.primary-btn),
#app[data-active-view]:not([data-active-view="home"]) .project-log-page button:not(.primary-btn),
#app[data-active-view]:not([data-active-view="home"]) .model-service-workspace button:not(.primary-btn),
#app[data-active-view]:not([data-active-view="home"]) .workflow-board button:not(.primary-btn) {
  box-shadow: none !important;
  background-image: none !important;
}

#app[data-active-view]:not([data-active-view="home"]) .panel button:not(.primary-btn):hover,
#app[data-active-view]:not([data-active-view="home"]) .template-use-workspace button:not(.primary-btn):hover,
#app[data-active-view]:not([data-active-view="home"]) .task-session-board button:not(.primary-btn):hover,
#app[data-active-view]:not([data-active-view="home"]) .project-log-page button:not(.primary-btn):hover,
#app[data-active-view]:not([data-active-view="home"]) .model-service-workspace button:not(.primary-btn):hover,
#app[data-active-view]:not([data-active-view="home"]) .workflow-board button:not(.primary-btn):hover {
  background-color: var(--df-control-hover) !important;
}

/* Creative Engine: parent owns gutters; composer-stage owns only its frame. */
#app#app[data-active-view="workbench"][data-creation-entry="fast"] .composer-card.composer-studio {
  box-sizing: border-box !important;
  min-width: 0 !important;
  max-width: 100% !important;
  overflow: hidden !important;
}
#app#app[data-active-view="workbench"][data-creation-entry="fast"] .composer-stage {
  box-sizing: border-box !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: clamp(8px, 1vw, 12px) !important;
  overflow: hidden !important;
}
#app#app[data-active-view="workbench"][data-creation-entry="fast"] .composer-stage > .idea-input,
#app#app[data-active-view="workbench"][data-creation-entry="fast"] .composer-stage > textarea.idea-input {
  box-sizing: border-box !important;
  display: block !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  margin: 0 !important;
}

/* Remove the duplicate outer frame around the composer action row; controls
   remain individually discoverable, compact, and aligned within the parent. */
#app#app[data-active-view="workbench"][data-creation-entry="fast"] .composer-bottombar {
  box-sizing: border-box !important;
  min-width: 0 !important;
  max-width: 100% !important;
  margin: 8px 0 0 !important;
  padding: 8px 0 0 !important;
  border: 0 !important;
  border-top: 1px solid rgba(255,255,255,.10) !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
#app#app[data-active-view="workbench"][data-creation-entry="fast"] .composer-bottom-left,
#app#app[data-active-view="workbench"][data-creation-entry="fast"] .composer-bottom-right {
  min-width: 0 !important;
  max-width: 100% !important;
}
#app#app[data-active-view="workbench"][data-creation-entry="fast"] .composer-bottom-left > .reference-upload-group,
#app#app[data-active-view="workbench"][data-creation-entry="fast"] .composer-bottom-left > .composer-more-control,
#app#app[data-active-view="workbench"][data-creation-entry="fast"] .composer-bottom-left > .composer-styles-trigger,
#app#app[data-active-view="workbench"][data-creation-entry="fast"] .composer-bottom-left > .first-frame-toggle-compact {
  box-shadow: none !important;
}

/* Remove fixed minimum tracks that can force page-level horizontal overflow. */
#app[data-active-view="logs"] .project-log-toolbar {
  grid-template-columns: minmax(0, .75fr) minmax(0, 1.8fr) auto !important;
}
#app[data-active-view="sessions"] .task-session-list .session-card.session-row {
  grid-template-columns: 38px minmax(0, 1.4fr) minmax(0, .8fr) auto !important;
}
#app[data-active-view="setup"] .model-service-workspace {
  grid-template-columns: minmax(0, 248px) minmax(0, 1fr) !important;
}
#app[data-active-view="templates"] .template-use-workspace {
  grid-template-columns: minmax(0, .42fr) minmax(0, .58fr) !important;
}
#app[data-active-view="workbench"] .output-stage {
  grid-template-columns: minmax(0, 1fr) minmax(0, .72fr) !important;
}
#app[data-active-view] .asset-row-card {
  grid-template-columns: minmax(0, .25fr) minmax(0, 1fr) auto !important;
}
#app[data-active-view] .project-log-toolbar > *,
#app[data-active-view] .task-session-list .session-card.session-row > *,
#app[data-active-view] .asset-row-card > *,
#app[data-active-view] .template-use-workspace > *,
#app[data-active-view] .output-stage > *,
#app[data-active-view] .model-service-workspace > * {
  box-sizing: border-box !important;
  min-width: 0 !important;
  max-width: 100% !important;
}

@media (max-width: 900px) {
  #app[data-active-view="logs"] .project-log-toolbar,
  #app[data-active-view="templates"] .template-use-workspace,
  #app[data-active-view="setup"] .model-service-workspace,
  #app[data-active-view="workbench"] .output-stage {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  #app[data-active-view="sessions"] .task-session-list .session-card.session-row {
    grid-template-columns: 32px minmax(0, 1fr) auto !important;
  }
}

@media (max-width: 720px) {
  #app[data-active-view] .page-scroll {
    box-sizing: border-box !important;
    width: 100% !important;
    max-width: 100% !important;
    padding-inline: 12px !important;
  }
  #app[data-active-view="logs"] .project-log-toolbar,
  #app[data-active-view="sessions"] .task-session-list .session-card.session-row,
  #app[data-active-view="templates"] .template-use-workspace,
  #app[data-active-view="setup"] .model-service-workspace {
    grid-template-columns: minmax(0, 1fr) !important;
  }
  #app[data-active-view] .asset-row-card {
    grid-template-columns: minmax(0, 1fr) auto !important;
  }
  #app[data-active-view] .asset-row-card > * {
    overflow-wrap: anywhere !important;
  }
}

/* P10 specificity lock: the legacy studio skin has more specific rules for
   the Creative Engine input; the intended PSD inner surface must win. */
#app#app[data-active-view="workbench"][data-creation-entry="fast"] .composer-stage > .idea-input,
#app#app[data-active-view="workbench"][data-creation-entry="fast"] .composer-stage > textarea.idea-input,
#app#app[data-active-view="workbench"][data-creation-entry="fast"] .idea-input.studio-input {
  box-sizing: border-box !important;
  display: block !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  margin: 0 !important;
  padding: 22px 22px 48px !important;
  border: 1px solid rgba(255,255,255,.12) !important;
  border-radius: 14px !important;
  background: linear-gradient(145deg, rgba(27,23,34,.94), rgba(13,12,17,.86) 70%) !important;
  color: rgba(247,245,251,.94) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.065), 0 8px 22px rgba(0,0,0,.13) !important;
}
#app#app[data-active-view="workbench"][data-creation-entry="fast"] .composer-stage > .idea-input:focus,
#app#app[data-active-view="workbench"][data-creation-entry="fast"] .composer-stage > textarea.idea-input:focus,
#app#app[data-active-view="workbench"][data-creation-entry="fast"] .idea-input.studio-input:focus {
  border-color: rgba(177,142,255,.44) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 0 0 3px rgba(143,101,242,.10), 0 12px 30px rgba(0,0,0,.18) !important;
}

/* The controls are embedded in the composer surface, not independent cards. */
#app#app[data-active-view="workbench"][data-creation-entry="fast"] .composer-bottombar button,
#app#app[data-active-view="workbench"][data-creation-entry="fast"] .composer-bottombar .composer-inline-control,
#app#app[data-active-view="workbench"][data-creation-entry="fast"] .composer-bottombar .composer-meta-trigger,
#app#app[data-active-view="workbench"][data-creation-entry="fast"] .composer-bottombar .composer-reset-btn {
  box-shadow: none !important;
}

/* Final cascade guard: use the live DOM class path without duplicate-ID specificity. */
#app[data-active-view="workbench"][data-creation-entry="fast"] .composer-stage > textarea.idea-input.studio-input {
  background: linear-gradient(145deg, rgba(27,23,34,.94), rgba(13,12,17,.86) 70%) !important;
  border: 1px solid rgba(255,255,255,.12) !important;
  border-radius: 14px !important;
  padding: 22px 22px 48px !important;
  box-sizing: border-box !important;
}
