/* Mirror GPT UI refactor v2.
   Visual baseline: the supplied ChatGPT-inspired prototype.
   This file intentionally loads last and normalizes accumulated bundle rules. */

:root {
  color-scheme: dark;
  --mg-page: #212121;
  --mg-page-soft: #252525;
  --mg-sidebar: #171717;
  --mg-surface: #2f2f2f;
  --mg-surface-2: #282828;
  --mg-surface-3: #333333;
  --mg-hover: #2a2a2a;
  --mg-active: #303030;
  --mg-text: #ffffff;
  --mg-text-2: #f4f4f4;
  --mg-text-3: #d4d4d4;
  --mg-line: #353535;
  --mg-line-2: #424242;
  --mg-accent: #10a37f;
  --mg-danger: #ef5350;
  --mg-shadow: 0 12px 40px rgba(0, 0, 0, 0.32);
  --mg-overlay: rgba(0, 0, 0, 0.58);
  --mg-sidebar-w: 260px;
  --mg-header-h: 56px;
  --mg-content-w: 760px;
  --mg-radius-sm: 10px;
  --mg-radius-md: 14px;
  --mg-radius-lg: 18px;
  --mg-radius-xl: 26px;
  --mg-font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

/* Attachment upload and parsing progress. */
html[data-mgpt-theme] #app .public-shell .attachment-chip {
  position: relative;
  overflow: hidden;
}

html[data-mgpt-theme] #app .public-shell .attachment-chip.is-progressing::before,
html[data-mgpt-theme] #app .public-shell .attachment-chip.is-progressing::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  content: "";
  pointer-events: none;
}

html[data-mgpt-theme] #app .public-shell .attachment-chip.is-progressing::before {
  background: color-mix(in srgb, var(--mg-line-2) 70%, transparent);
}

html[data-mgpt-theme] #app .public-shell .attachment-chip.is-progressing::after {
  right: auto;
  width: var(--attachment-progress, 0%);
  background: var(--mg-accent);
  transition: width 180ms ease;
}

html[data-mgpt-theme='light'] {
  color-scheme: light;
  --mg-page: #ffffff;
  --mg-page-soft: #fafafa;
  --mg-sidebar: #f7f7f8;
  --mg-surface: #ffffff;
  --mg-surface-2: #f4f4f4;
  --mg-surface-3: #ececec;
  --mg-hover: #ececec;
  --mg-active: #e7e7e7;
  --mg-text: #0d0d0d;
  --mg-text-2: #565656;
  --mg-text-3: #8e8e8e;
  --mg-line: #e5e5e5;
  --mg-line-2: #d4d4d4;
  --mg-danger: #d9342b;
  --mg-shadow: 0 12px 40px rgba(0, 0, 0, 0.1);
  --mg-overlay: rgba(0, 0, 0, 0.34);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  letter-spacing: 0;
}

html,
body,
#app {
  width: 100%;
  min-width: 0;
  height: 100%;
  min-height: 100%;
  background: var(--mg-page) !important;
}

body {
  margin: 0;
  overflow: hidden;
  color: var(--mg-text) !important;
  font-family: var(--mg-font) !important;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
textarea,
select {
  font: inherit;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[role='button']:focus-visible {
  outline: 2px solid var(--mg-text-3) !important;
  outline-offset: 2px !important;
}

/* Sun/moon capsule, shared by public and admin headers. */
.mgpt-theme-toggle {
  position: relative !important;
  display: inline-grid !important;
  grid-template-columns: 1fr 1fr !important;
  align-items: center !important;
  justify-items: center !important;
  flex: 0 0 66px !important;
  width: 66px !important;
  min-width: 66px !important;
  height: 34px !important;
  min-height: 34px !important;
  padding: 2px !important;
  margin: 0 !important;
  border: 1px solid var(--mg-line-2) !important;
  border-radius: 999px !important;
  background: var(--mg-surface-2) !important;
  color: var(--mg-text) !important;
  box-shadow: none !important;
  cursor: pointer !important;
  overflow: hidden !important;
  isolation: isolate;
  -webkit-tap-highlight-color: transparent;
}

.mgpt-theme-toggle__thumb {
  position: absolute;
  z-index: 0;
  top: 2px;
  left: 2px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.22);
  transform: translateX(0);
  transition: transform 180ms ease, background-color 180ms ease;
}

.mgpt-theme-toggle__icon {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: var(--mg-text);
  opacity: 0.56;
  transition: color 180ms ease, opacity 180ms ease;
}

.mgpt-theme-toggle__icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mgpt-theme-toggle[data-theme='light'] .mgpt-theme-toggle__sun {
  color: #0d0d0d;
  opacity: 1;
}

.mgpt-theme-toggle[data-theme='dark'] .mgpt-theme-toggle__thumb {
  background: #ececec;
  transform: translateX(32px);
}

.mgpt-theme-toggle[data-theme='dark'] .mgpt-theme-toggle__moon {
  color: #171717;
  opacity: 1;
}

/* Public application shell. */
.public-shell,
.public-shell.sidebar-collapsed {
  display: grid !important;
  grid-template-columns: var(--mg-sidebar-w) minmax(0, 1fr) !important;
  width: 100% !important;
  height: 100dvh !important;
  min-height: 0 !important;
  overflow: hidden !important;
  color: var(--mg-text) !important;
  background: var(--mg-page) !important;
  font-family: var(--mg-font) !important;
}

.public-shell.sidebar-collapsed {
  grid-template-columns: 76px minmax(0, 1fr) !important;
}

.sidebar {
  position: relative !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 2px !important;
  width: auto !important;
  height: 100dvh !important;
  min-width: 0 !important;
  min-height: 0 !important;
  padding: 8px !important;
  overflow: hidden !important;
  color: var(--mg-text) !important;
  background: var(--mg-sidebar) !important;
  border: 0 !important;
  border-right: 1px solid var(--mg-line) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

.sidebar-head {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  flex: 0 0 var(--mg-header-h) !important;
  min-height: var(--mg-header-h) !important;
  padding: 8px 6px !important;
}

.brand-card,
.brand-card--trigger {
  min-width: 0 !important;
  min-height: 40px !important;
  padding: 5px 8px !important;
  gap: 10px !important;
  color: var(--mg-text) !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: var(--mg-radius-sm) !important;
  box-shadow: none !important;
}

.brand-card--trigger:hover {
  background: var(--mg-hover) !important;
}

.brand-copy {
  min-width: 0 !important;
}

.nav-list,
.nav-list--primary {
  display: grid !important;
  gap: 2px !important;
  flex: 0 0 auto !important;
  padding: 4px 0 !important;
}

.nav-item,
.conversation-card {
  min-width: 0 !important;
  min-height: 40px !important;
  padding: 0 10px !important;
  gap: 11px !important;
  color: var(--mg-text) !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: var(--mg-radius-sm) !important;
  box-shadow: none !important;
  font-size: 14px !important;
  font-weight: 500 !important;
}

.nav-item:hover,
.conversation-card:hover,
.conversation-card.active,
.nav-item.active {
  background: var(--mg-hover) !important;
}

.sidebar-section {
  flex: 0 0 auto !important;
  min-width: 0 !important;
  height: auto !important;
  max-height: none !important;
  padding: 4px 0 !important;
  border: 0 !important;
}

.sidebar-section--recent {
  flex: 1 1 auto !important;
  min-height: 92px !important;
  overflow: hidden !important;
}

.sidebar-section__head {
  min-height: 32px !important;
  padding: 0 10px !important;
  color: var(--mg-text-3) !important;
  font-size: 12px !important;
}

.conversation-list {
  min-height: 0 !important;
  overflow-y: auto !important;
  scrollbar-width: thin;
  scrollbar-color: var(--mg-line-2) transparent;
}

.folder-chip {
  height: 27px !important;
  padding-inline: 10px !important;
  color: var(--mg-text-2) !important;
  background: transparent !important;
  border: 1px solid var(--mg-line) !important;
  border-radius: 999px !important;
}

.folder-chip.active,
.folder-chip.selected {
  color: var(--mg-page) !important;
  background: var(--mg-text) !important;
  border-color: var(--mg-text) !important;
}

.sidebar-footer {
  flex: 0 0 auto !important;
  gap: 4px !important;
  padding: 8px 0 0 !important;
  border-top: 1px solid var(--mg-line) !important;
}

.account-card,
.footer-icon-btn {
  color: var(--mg-text) !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: var(--mg-radius-sm) !important;
  box-shadow: none !important;
}

.account-card:hover,
.footer-icon-btn:hover {
  background: var(--mg-hover) !important;
}

.workspace {
  position: relative !important;
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  height: 100dvh !important;
  min-width: 0 !important;
  min-height: 0 !important;
  overflow: hidden !important;
  color: var(--mg-text) !important;
  background: var(--mg-page) !important;
}

.topbar {
  position: relative !important;
  z-index: 20 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 8px !important;
  flex: 0 0 var(--mg-header-h) !important;
  width: 100% !important;
  min-height: var(--mg-header-h) !important;
  padding: 0 12px 0 16px !important;
  color: var(--mg-text) !important;
  background: var(--mg-page) !important;
  border: 0 !important;
  border-bottom: 1px solid transparent !important;
  box-shadow: none !important;
}

.topbar-left,
.topbar-right {
  display: flex !important;
  align-items: center !important;
  gap: 4px !important;
  min-width: 0 !important;
}

.topbar-left {
  flex: 1 1 auto !important;
}

.topbar-right {
  flex: 0 0 auto !important;
}

.product-switch {
  min-width: 0 !important;
  max-width: min(440px, 48vw) !important;
  min-height: 40px !important;
  padding: 0 10px !important;
  gap: 8px !important;
  color: var(--mg-text) !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: var(--mg-radius-sm) !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}

.product-switch:hover,
.product-switch[aria-expanded='true'] {
  background: var(--mg-hover) !important;
}

.product-switch__title {
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  font-size: 18px !important;
  font-weight: 600 !important;
}

.topbar :is(.icon-btn, .notice-pill, .admin-entry-pill) {
  min-height: 40px !important;
  color: var(--mg-text-2) !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: var(--mg-radius-sm) !important;
  box-shadow: none !important;
}

.topbar :is(.icon-btn, .notice-pill, .admin-entry-pill):hover {
  color: var(--mg-text) !important;
  background: var(--mg-hover) !important;
}

.surface {
  position: relative !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
  min-height: 0 !important;
  padding: 0 0 18px !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  color: var(--mg-text) !important;
  background: var(--mg-page) !important;
  scrollbar-width: thin;
  scrollbar-color: var(--mg-line-2) transparent;
}

.content-stage,
.status-banner {
  width: 100% !important;
  max-width: var(--mg-content-w) !important;
  margin-inline: auto !important;
  padding-inline: 24px !important;
}

.content-stage--wide {
  max-width: 1120px !important;
}

.workspace--home .capability-strip {
  display: none !important;
}

.workspace--home .hero {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  width: min(100%, var(--mg-content-w)) !important;
  max-width: var(--mg-content-w) !important;
  min-height: 100% !important;
  padding: 38px 20px 44px !important;
  gap: 0 !important;
  text-align: center !important;
}

.workspace--home .hero-brand {
  min-height: 36px !important;
  padding: 0 12px !important;
  color: var(--mg-text-2) !important;
  background: var(--mg-surface-2) !important;
  border: 1px solid var(--mg-line) !important;
  border-radius: 999px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
}

.workspace--home .hero h1 {
  max-width: 14em !important;
  margin: 25px 0 8px !important;
  color: var(--mg-text) !important;
  font-size: 34px !important;
  font-weight: 650 !important;
  line-height: 1.18 !important;
  letter-spacing: 0 !important;
}

.workspace--home .hero p {
  max-width: 560px !important;
  margin: 0 !important;
  color: var(--mg-text-3) !important;
  font-size: 15px !important;
  line-height: 1.7 !important;
}

.workspace--home .quick-grid {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  width: min(100%, 680px) !important;
  margin-top: 28px !important;
  gap: 10px !important;
}

.workspace--home .quick-card {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: flex-start !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  min-height: 52px !important;
  padding: 10px 12px !important;
  gap: 9px !important;
  color: var(--mg-text-2) !important;
  background: transparent !important;
  border: 1px solid var(--mg-line) !important;
  border-radius: var(--mg-radius-sm) !important;
  box-shadow: none !important;
  text-align: left !important;
}

.workspace--home .quick-card:hover {
  color: var(--mg-text) !important;
  background: var(--mg-hover) !important;
}

.workspace--home .quick-card__icon {
  flex: 0 0 25px !important;
  width: 25px !important;
  height: 25px !important;
  border-radius: 8px !important;
}

.workspace--home .quick-card__label {
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  font-size: 13px !important;
  font-weight: 550 !important;
}

.thread {
  display: grid !important;
  gap: 0 !important;
  padding: 18px 0 24px !important;
}

.message-card {
  display: flex !important;
  gap: 14px !important;
  max-width: 100% !important;
  padding: 16px 0 22px !important;
  color: var(--mg-text) !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

.message-card__body,
.message-rich,
.message-plain {
  min-width: 0 !important;
  max-width: 100% !important;
  color: var(--mg-text) !important;
  overflow-wrap: anywhere !important;
}

.composer-dock {
  position: relative !important;
  z-index: 18 !important;
  flex: 0 0 auto !important;
  padding: 10px 18px max(16px, env(safe-area-inset-bottom, 0px)) !important;
  background: var(--mg-page) !important;
}

.composer-shell,
.workspace--home .composer-shell {
  width: min(100%, var(--mg-content-w)) !important;
  max-width: var(--mg-content-w) !important;
  margin-inline: auto !important;
  padding: 0 !important;
  gap: 8px !important;
}

.composer-panel,
.composer-panel--reasoning,
.workspace--home .composer-panel,
.composer-panel.mgpt-effort-native-panel {
  gap: 8px !important;
  padding: 12px 12px 10px !important;
  color: var(--mg-text) !important;
  background: var(--mg-surface) !important;
  border: 1px solid var(--mg-line-2) !important;
  border-radius: var(--mg-radius-xl) !important;
  box-shadow: var(--mg-shadow) !important;
  filter: none !important;
}

html[data-mgpt-theme] .composer-panel:has(.effort-switch[data-mgpt-effort-native='1']),
html[data-mgpt-theme] .composer-panel--reasoning:has(.effort-switch[data-mgpt-effort-native='1']),
html[data-mgpt-theme] .composer-panel.mgpt-effort-native-panel,
html[data-mgpt-theme] .composer-panel--reasoning.mgpt-effort-native-panel {
  color: var(--mg-text) !important;
  background: var(--mg-surface) !important;
  border-color: var(--mg-line-2) !important;
  box-shadow: var(--mg-shadow) !important;
}

.composer-panel:focus-within,
.composer-panel--reasoning:focus-within {
  border-color: var(--mg-text-3) !important;
  background: var(--mg-surface) !important;
}

.composer-input-shell {
  min-height: 50px !important;
  padding: 0 !important;
  border: 0 !important;
}

.composer-input,
.composer-input--panel {
  min-height: 50px !important;
  max-height: 180px !important;
  padding: 8px 9px 10px !important;
  color: var(--mg-text) !important;
  background: transparent !important;
  border: 0 !important;
  font-size: 16px !important;
  line-height: 1.5 !important;
}

.composer-input::placeholder {
  color: var(--mg-text-3) !important;
}

.composer-toolbar {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 8px !important;
  min-width: 0 !important;
  overflow: visible !important;
}

.composer-toolbar__left,
.composer-toolbar__right {
  display: flex !important;
  align-items: center !important;
  min-width: 0 !important;
  gap: 4px !important;
  flex-wrap: nowrap !important;
}

.composer-toolbar__left {
  flex: 1 1 auto !important;
  overflow-x: auto !important;
  scrollbar-width: none;
}

.composer-toolbar__left::-webkit-scrollbar {
  display: none;
}

.composer-toolbar__right {
  flex: 0 0 auto !important;
  margin-left: auto !important;
}

.composer-tool,
.model-pill {
  min-height: 34px !important;
  padding: 0 10px !important;
  color: var(--mg-text-2) !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 999px !important;
  box-shadow: none !important;
  font-size: 13px !important;
}

.model-pill {
  max-width: 165px !important;
  background: var(--mg-surface-2) !important;
}

.composer-tool:hover,
.composer-tool.active,
.model-pill:hover,
.model-pill.active {
  color: var(--mg-text) !important;
  background: var(--mg-hover) !important;
}

.send-btn {
  flex: 0 0 34px !important;
  width: 34px !important;
  min-width: 34px !important;
  height: 34px !important;
  min-height: 34px !important;
  padding: 0 !important;
  color: var(--mg-page) !important;
  background: var(--mg-text) !important;
  border: 0 !important;
  border-radius: 50% !important;
  box-shadow: none !important;
}

.send-btn:disabled {
  color: var(--mg-text-3) !important;
  background: var(--mg-surface-3) !important;
}

.composer-note,
.composer-disclaimer {
  margin-top: 8px !important;
  color: var(--mg-text-3) !important;
  font-size: 11px !important;
  text-align: center !important;
}

.model-menu,
.dialog,
.notice-dialog,
.acct-dialog,
.thinking-drawer,
.image-lightbox__body {
  color: var(--mg-text) !important;
  background: var(--mg-surface-2) !important;
  border: 1px solid var(--mg-line-2) !important;
  border-radius: var(--mg-radius-md) !important;
  box-shadow: var(--mg-shadow) !important;
}

.overlay,
.notice-overlay,
.image-lightbox,
.thinking-drawer__scrim {
  background: var(--mg-overlay) !important;
  backdrop-filter: blur(2px) !important;
}

.info-card,
.research-panel,
.prompt-template-panel,
.image-workbench,
.image-grid-panel,
.image-history-panel,
.artifact-card,
.rail-card,
.acct-section,
.acct-info-cell {
  color: var(--mg-text) !important;
  background: var(--mg-surface-2) !important;
  border-color: var(--mg-line) !important;
  box-shadow: none !important;
}

/* Keep the existing pixel/canvas reasoning logic; integrate its shell only. */
.effort-switch[data-mgpt-effort-native='1'] {
  flex: 0 1 208px !important;
  width: 208px !important;
  min-width: 168px !important;
  max-width: 208px !important;
  height: 68px !important;
  min-height: 68px !important;
  margin: 0 !important;
}

/* Public responsive layout follows the supplied prototype. */
@media (max-width: 1024px) and (min-width: 769px) {
  :root {
    --mg-sidebar-w: 236px;
  }

  .workspace--home .quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    max-width: 520px !important;
  }
}

@media (max-width: 768px) {
  .public-shell,
  .public-shell.sidebar-collapsed {
    display: block !important;
    width: 100% !important;
    height: 100dvh !important;
  }

  .sidebar,
  .public-shell.compact .sidebar {
    position: fixed !important;
    inset: 0 auto 0 0 !important;
    z-index: 70 !important;
    width: min(86vw, 320px) !important;
    max-width: 320px !important;
    height: 100dvh !important;
    padding: calc(8px + env(safe-area-inset-top, 0px)) 8px calc(8px + env(safe-area-inset-bottom, 0px)) !important;
    border-right: 1px solid var(--mg-line) !important;
    border-radius: 0 !important;
    box-shadow: 24px 0 70px rgba(0, 0, 0, 0.28) !important;
    transform: translateX(-105%) !important;
    transition: transform 220ms cubic-bezier(0.22, 0.61, 0.36, 1) !important;
  }

  .sidebar.open,
  .public-shell.compact .sidebar.open {
    transform: translateX(0) !important;
  }

  .sidebar-scrim {
    z-index: 60 !important;
    background: var(--mg-overlay) !important;
    backdrop-filter: blur(2px) !important;
  }

  .workspace,
  .public-shell.compact .workspace {
    width: 100% !important;
    height: 100dvh !important;
  }

  .topbar,
  .public-shell.compact .topbar {
    flex-basis: 52px !important;
    min-height: calc(52px + env(safe-area-inset-top, 0px)) !important;
    padding: env(safe-area-inset-top, 0px) 8px 0 !important;
    gap: 4px !important;
    border-bottom-color: var(--mg-line) !important;
  }

  .topbar-left {
    flex: 1 1 auto !important;
    min-width: 0 !important;
  }

  .topbar-right,
  .public-shell.compact .topbar-right {
    flex: 0 0 auto !important;
    max-width: none !important;
    gap: 3px !important;
    padding: 0 !important;
  }

  .product-switch,
  .public-shell.compact .product-switch {
    max-width: 46vw !important;
    min-height: 40px !important;
    padding: 0 8px !important;
  }

  .product-switch__title {
    font-size: 16px !important;
  }

  .topbar :is(.icon-btn, .notice-pill, .admin-entry-pill) {
    width: 40px !important;
    min-width: 40px !important;
    height: 40px !important;
    min-height: 40px !important;
    padding: 0 !important;
    justify-content: center !important;
  }

  .notice-pill__track,
  .admin-entry-pill__label {
    display: none !important;
  }

  .mgpt-theme-toggle {
    flex-basis: 56px !important;
    width: 56px !important;
    min-width: 56px !important;
    height: 32px !important;
    min-height: 32px !important;
  }

  .mgpt-theme-toggle__thumb {
    width: 26px;
    height: 26px;
  }

  .mgpt-theme-toggle__icon {
    width: 24px;
    height: 26px;
  }

  .mgpt-theme-toggle[data-theme='dark'] .mgpt-theme-toggle__thumb {
    transform: translateX(24px);
  }

  .surface,
  .public-shell.compact .surface {
    padding: 0 0 10px !important;
    overscroll-behavior: contain;
    scroll-padding-bottom: 154px;
  }

  .content-stage,
  .content-stage--wide,
  .status-banner,
  .public-shell.compact .content-stage,
  .public-shell.compact .content-stage--wide {
    width: 100% !important;
    max-width: 100% !important;
    padding-inline: 16px !important;
  }

  .workspace--home .hero {
    justify-content: flex-start !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: auto !important;
    padding: 72px 16px 28px !important;
  }

  .workspace--home .hero h1 {
    margin-top: 20px !important;
    font-size: 30px !important;
  }

  .workspace--home .hero p {
    max-width: 320px !important;
    font-size: 14px !important;
  }

  .workspace--home .quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    width: 100% !important;
    max-width: 520px !important;
    gap: 8px !important;
    margin-top: 24px !important;
  }

  .workspace--home .quick-card {
    min-height: 48px !important;
    padding: 9px 10px !important;
  }

  .workspace--home .quick-card__label {
    font-size: 12px !important;
  }

  .thread {
    padding-top: 8px !important;
  }

  .message-card {
    gap: 10px !important;
    padding: 10px 0 16px !important;
  }

  .message-rich pre,
  .message-rich table {
    max-width: 100% !important;
    overflow-x: auto !important;
  }

  .composer-dock,
  .public-shell.compact .composer-dock {
    padding: 8px 8px max(10px, env(safe-area-inset-bottom, 0px)) !important;
  }

  .composer-shell,
  .workspace--home .composer-shell,
  .public-shell.compact .composer-shell {
    width: 100% !important;
    max-width: 100% !important;
  }

  .composer-panel,
  .composer-panel--reasoning,
  .workspace--home .composer-panel,
  .public-shell.compact .composer-panel {
    padding: 9px 9px 8px !important;
    border-radius: 22px !important;
  }

  .composer-input-shell,
  .composer-input,
  .composer-input--panel {
    min-height: 44px !important;
  }

  .composer-input,
  .composer-input--panel {
    padding: 6px 7px 8px !important;
    font-size: 16px !important;
  }

  .composer-toolbar {
    display: flex !important;
    gap: 5px !important;
  }

  .composer-toolbar__left {
    flex: 1 1 auto !important;
  }

  .composer-toolbar__right {
    flex: 0 1 auto !important;
    gap: 4px !important;
  }

  .composer-tool span,
  .composer-disclaimer,
  .composer-note {
    display: none !important;
  }

  .composer-tool,
  .model-pill {
    min-height: 34px !important;
    padding-inline: 9px !important;
  }

  .model-pill {
    max-width: 118px !important;
  }

  .effort-switch[data-mgpt-effort-native='1'] {
    flex-basis: clamp(136px, 38vw, 186px) !important;
    width: clamp(136px, 38vw, 186px) !important;
    min-width: 136px !important;
    max-width: 186px !important;
  }

  .overlay,
  .notice-overlay {
    align-items: flex-end !important;
    padding: 8px !important;
    padding-bottom: max(8px, env(safe-area-inset-bottom, 0px)) !important;
  }

  .dialog,
  .notice-dialog,
  .acct-dialog {
    width: 100% !important;
    max-width: 640px !important;
    max-height: 88dvh !important;
    padding: 18px !important;
    border-radius: var(--mg-radius-lg) !important;
  }
}

@media (max-width: 430px) {
  .content-stage,
  .content-stage--wide,
  .public-shell.compact .content-stage,
  .public-shell.compact .content-stage--wide {
    padding-inline: 12px !important;
  }

  .workspace--home .hero {
    padding: 60px 12px 24px !important;
  }

  .workspace--home .hero-brand {
    min-height: 32px !important;
    font-size: 12px !important;
  }

  .workspace--home .hero h1 {
    font-size: 27px !important;
  }

  .workspace--home .quick-grid {
    gap: 7px !important;
  }

  .workspace--home .quick-card {
    min-height: 46px !important;
    border-radius: var(--mg-radius-sm) !important;
  }

  .product-switch,
  .public-shell.compact .product-switch {
    max-width: 40vw !important;
  }

  .effort-switch[data-mgpt-effort-native='1'] {
    flex-basis: 126px !important;
    width: 126px !important;
    min-width: 126px !important;
  }
}

/* Screenshot parity: force every public child to inherit the prototype theme. */
html[data-mgpt-theme] #app .public-shell .sidebar,
html[data-mgpt-theme] #app .public-shell .sidebar-footer {
  color: var(--mg-text) !important;
  background: var(--mg-sidebar) !important;
}

html[data-mgpt-theme] #app .public-shell .sidebar :is(
  .brand-copy strong,
  .nav-item,
  .nav-item__icon,
  .nav-item__label,
  .conversation-card__main strong,
  .account-copy strong,
  .folder-chip__main
) {
  color: var(--mg-text) !important;
}

html[data-mgpt-theme] #app .public-shell .sidebar :is(
  .brand-copy span,
  .sidebar-section__head h3,
  .account-copy span,
  .account-copy__meta,
  .account-copy__tiers b,
  .conversation-card__edit,
  .conversation-card__delete
) {
  color: var(--mg-text-3) !important;
}

html[data-mgpt-theme] #app .public-shell .sidebar .nav-item--search input {
  color: var(--mg-text) !important;
  background: transparent !important;
}

html[data-mgpt-theme] #app .public-shell .sidebar .nav-item--search input::placeholder {
  color: var(--mg-text-3) !important;
}

html[data-mgpt-theme] #app .public-shell .sidebar :is(.nav-item:hover, .nav-item.active, .conversation-card:hover, .conversation-card.active, .account-card:hover) {
  color: var(--mg-text) !important;
  background: var(--mg-hover) !important;
}

html[data-mgpt-theme] #app .public-shell .folder-chip {
  color: var(--mg-text-2) !important;
  background: transparent !important;
  border-color: var(--mg-line) !important;
}

html[data-mgpt-theme] #app .public-shell .folder-chip.active {
  color: var(--mg-page) !important;
  background: var(--mg-text) !important;
  border-color: var(--mg-text) !important;
}

html[data-mgpt-theme] #app .public-shell .sidebar-footer {
  border-top-color: var(--mg-line) !important;
}

html[data-mgpt-theme] #app .public-shell .account-card {
  color: var(--mg-text) !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

html[data-mgpt-theme] #app .public-shell .account-avatar {
  color: var(--mg-page) !important;
  background: var(--mg-text) !important;
}

html[data-mgpt-theme] #app .public-shell .footer-icon-btn,
html[data-mgpt-theme] #app .public-shell .footer-icon-btn--accent,
html[data-mgpt-theme] #app .public-shell .footer-icon-btn--admin {
  color: var(--mg-text-2) !important;
  background: transparent !important;
  border-color: var(--mg-line) !important;
}

html[data-mgpt-theme] #app .public-shell .footer-icon-btn:hover {
  color: var(--mg-text) !important;
  background: var(--mg-hover) !important;
  border-color: var(--mg-line-2) !important;
}

html[data-mgpt-theme] #app .public-shell .footer-icon-btn--logout {
  color: var(--mg-danger) !important;
  background: transparent !important;
  border-color: color-mix(in srgb, var(--mg-danger) 42%, var(--mg-line)) !important;
}

html[data-mgpt-theme] #app .public-shell .product-switch__title,
html[data-mgpt-theme] #app .public-shell .topbar-left,
html[data-mgpt-theme] #app .public-shell .topbar-right {
  color: var(--mg-text) !important;
}

html[data-mgpt-theme] #app .public-shell :is(.notice-pill, .admin-entry-pill) {
  color: var(--mg-text-2) !important;
  background: transparent !important;
  border-color: transparent !important;
}

html[data-mgpt-theme] #app .public-shell :is(.notice-pill, .admin-entry-pill):hover {
  color: var(--mg-text) !important;
  background: var(--mg-hover) !important;
}

html[data-mgpt-theme] #app .public-shell :is(.notice-pill__icon, .notice-pill__label, .admin-entry-pill__icon) {
  color: inherit !important;
  background: transparent !important;
}

html[data-mgpt-theme] #app .public-shell .notice-pill__text {
  color: var(--mg-text-3) !important;
}

html[data-mgpt-theme] #app .public-shell .hero-brand,
html[data-mgpt-theme] #app .public-shell .workspace--home .hero-brand {
  color: var(--mg-text-2) !important;
  background: var(--mg-surface-2) !important;
  border-color: var(--mg-line) !important;
}

html[data-mgpt-theme] #app .public-shell .hero-brand__mark {
  color: var(--mg-text) !important;
  background: var(--mg-surface) !important;
}

html[data-mgpt-theme] #app .public-shell .workspace--home .hero h1,
html[data-mgpt-theme] #app .public-shell .workspace--home .quick-card__label {
  color: var(--mg-text) !important;
}

html[data-mgpt-theme] #app .public-shell .workspace--home .hero p {
  color: var(--mg-text-3) !important;
}

html[data-mgpt-theme] #app .public-shell .workspace--home .quick-card {
  color: var(--mg-text-2) !important;
  background: transparent !important;
  border-color: var(--mg-line) !important;
}

html[data-mgpt-theme] #app .public-shell .workspace--home .quick-card:hover {
  color: var(--mg-text) !important;
  background: var(--mg-hover) !important;
  border-color: var(--mg-line-2) !important;
}

html[data-mgpt-theme] #app .public-shell .composer-input-shell {
  border: 0 !important;
  border-bottom: 0 !important;
}

html[data-mgpt-theme] #app .public-shell .composer-panel--reasoning[data-effort],
html[data-mgpt-theme] #app .public-shell .composer-panel--reasoning[data-effort]:focus-within,
html[data-mgpt-theme] #app .public-shell .composer-panel:focus-within {
  background: var(--mg-surface) !important;
  border-color: var(--mg-line-2) !important;
  box-shadow: var(--mg-shadow) !important;
  animation: none !important;
}

html[data-mgpt-refactor='ready'] #app .public-shell .effort-switch[data-mgpt-effort-native='1']:not(.mgpt-effort-popover-source) {
  position: absolute !important;
  width: 1px !important;
  min-width: 1px !important;
  height: 1px !important;
  min-height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
  overflow: hidden !important;
}

html[data-mgpt-theme] #app .admin-shell {
  grid-template-columns: 260px minmax(0, 1fr) !important;
  width: 100% !important;
  height: 100dvh !important;
  min-height: 0 !important;
  overflow: hidden !important;
  background: var(--mg-page) !important;
}

html[data-mgpt-theme] #app .admin-shell .admin-sidebar {
  width: auto !important;
  height: 100dvh !important;
  padding: 8px !important;
  overflow-y: auto !important;
  background: var(--mg-sidebar) !important;
  border-right: 1px solid var(--mg-line) !important;
}

html[data-mgpt-theme] #app .admin-shell .admin-main {
  height: 100dvh !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  background: var(--mg-page) !important;
}

html[data-mgpt-theme] #app .admin-shell .admin-main > .topbar {
  position: sticky !important;
  top: 0 !important;
  min-height: 56px !important;
  padding: 0 18px !important;
  background: var(--mg-page) !important;
  border-bottom: 1px solid var(--mg-line) !important;
}

html[data-mgpt-theme] #app .admin-shell .admin-body {
  padding: 18px 20px 32px !important;
}

html[data-mgpt-theme] #app .admin-shell :is(.hero-card, .admin-page-header) {
  margin-bottom: 14px !important;
  padding: 4px 0 14px !important;
  background: transparent !important;
  border: 0 !important;
  border-bottom: 1px solid var(--mg-line) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

html[data-mgpt-theme] #app .admin-shell :is(.brand-card, .profile-card, .panel-card, .detail-card) {
  background: var(--mg-surface) !important;
  border-color: var(--mg-line) !important;
  border-radius: 8px !important;
  box-shadow: none !important;
}

html[data-mgpt-theme] #app .admin-shell .admin-sidebar :is(.brand-card, .profile-card) {
  background: transparent !important;
  border: 0 !important;
  border-radius: 10px !important;
}

html[data-mgpt-theme] #app .admin-shell :is(.metric-card, .admin-metric-card) {
  min-height: 94px !important;
  padding: 13px 14px !important;
  background: var(--mg-surface) !important;
  border: 1px solid var(--mg-line) !important;
  border-left: 3px solid var(--mg-accent) !important;
  border-radius: 8px !important;
  box-shadow: none !important;
}

html[data-mgpt-theme] #app .admin-shell .panel-card {
  padding: 14px !important;
  overflow: hidden !important;
}

html[data-mgpt-theme] #app .admin-shell .table-shell {
  max-width: 100% !important;
  overflow: auto !important;
  background: var(--mg-surface) !important;
  border: 1px solid var(--mg-line) !important;
  border-radius: 8px !important;
  box-shadow: none !important;
}

html[data-mgpt-theme] #app .admin-shell .table-shell th {
  background: var(--mg-surface-2) !important;
  color: var(--mg-text-3) !important;
}

html[data-mgpt-theme] #app .admin-shell .table-shell td {
  color: var(--mg-text-2) !important;
  background: var(--mg-surface) !important;
}

@media (max-width: 768px) {
  html[data-mgpt-theme] #app .admin-shell {
    display: block !important;
    grid-template-columns: none !important;
    height: auto !important;
    min-height: 100dvh !important;
    overflow-y: auto !important;
  }

  html[data-mgpt-theme] #app .admin-shell .admin-sidebar {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) auto !important;
    align-items: center !important;
    width: 100% !important;
    height: auto !important;
    min-height: 56px !important;
    padding: 7px 8px !important;
    overflow: visible !important;
    border-right: 0 !important;
    border-bottom: 1px solid var(--mg-line) !important;
  }

  html[data-mgpt-theme] #app .admin-shell .admin-nav {
    display: flex !important;
    grid-template-columns: none !important;
    min-width: 0 !important;
    overflow-x: auto !important;
    flex-wrap: nowrap !important;
    scrollbar-width: none !important;
  }

  html[data-mgpt-theme] #app .admin-shell .admin-nav .nav-link {
    flex: 0 0 auto !important;
    min-height: 40px !important;
    white-space: nowrap !important;
  }

  html[data-mgpt-theme] #app .admin-shell .admin-main {
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  html[data-mgpt-theme] #app .admin-shell .admin-main > .topbar {
    min-height: 52px !important;
    padding: 0 10px !important;
  }

  html[data-mgpt-theme] #app .admin-shell .admin-body {
    padding: 12px 10px calc(24px + env(safe-area-inset-bottom, 0px)) !important;
  }

  html[data-mgpt-theme] #app .admin-shell :is(.section-split, .section-split.wide-right, .two-column, .three-column, .form-grid) {
    grid-template-columns: 1fr !important;
  }

  html[data-mgpt-theme] #app .admin-shell .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  html[data-mgpt-theme] #app .admin-shell .table-shell {
    width: calc(100vw - 20px) !important;
    max-height: 58dvh !important;
    margin-inline: calc(50% - 50vw) !important;
    border-right: 0 !important;
    border-left: 0 !important;
    border-radius: 0 !important;
  }
}

@media (max-width: 430px) {
  html[data-mgpt-theme] #app .admin-shell .metric-grid {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 360px) {
  .workspace--home .quick-grid {
    grid-template-columns: 1fr !important;
  }

  .topbar :is(.notice-pill, .admin-entry-pill) {
    display: none !important;
  }

  .effort-switch[data-mgpt-effort-native='1'] {
    flex-basis: 116px !important;
    width: 116px !important;
    min-width: 116px !important;
  }
}

/* Admin console: quiet operational layout using the same token system. */
.admin-shell {
  --line: var(--mg-line) !important;
  --line-strong: var(--mg-line-2) !important;
  --text: var(--mg-text) !important;
  --muted: var(--mg-text-3) !important;
  --accent: var(--mg-accent) !important;
  --accent-soft: color-mix(in srgb, var(--mg-accent) 14%, transparent) !important;
  --surface: var(--mg-surface) !important;
  --surface-strong: var(--mg-surface) !important;
  --surface-soft: var(--mg-surface-2) !important;
  --shadow-soft: none !important;
  --shadow-panel: none !important;
  display: grid !important;
  grid-template-columns: var(--mg-sidebar-w) minmax(0, 1fr) !important;
  width: 100% !important;
  height: 100dvh !important;
  min-height: 0 !important;
  overflow: hidden !important;
  color: var(--mg-text) !important;
  background: var(--mg-page) !important;
  font-family: var(--mg-font) !important;
}

.admin-sidebar {
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
  width: auto !important;
  height: 100dvh !important;
  min-width: 0 !important;
  min-height: 0 !important;
  padding: 8px !important;
  overflow-y: auto !important;
  color: var(--mg-text) !important;
  background: var(--mg-sidebar) !important;
  border: 0 !important;
  border-right: 1px solid var(--mg-line) !important;
  box-shadow: none !important;
}

.admin-sidebar .brand-card,
.admin-sidebar .profile-card {
  flex: 0 0 auto !important;
  min-height: 52px !important;
  padding: 7px 8px !important;
  gap: 10px !important;
  color: var(--mg-text) !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: var(--mg-radius-sm) !important;
  box-shadow: none !important;
}

.admin-sidebar .profile-card {
  margin-top: auto !important;
  border-top: 1px solid var(--mg-line) !important;
  border-radius: 0 !important;
}

.admin-nav {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 2px !important;
  min-width: 0 !important;
}

.admin-nav .nav-link {
  display: flex !important;
  align-items: center !important;
  min-width: 0 !important;
  min-height: 40px !important;
  padding: 0 10px !important;
  gap: 10px !important;
  color: var(--mg-text-2) !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: var(--mg-radius-sm) !important;
  box-shadow: none !important;
  font-size: 14px !important;
}

.admin-nav .nav-link:hover,
.admin-nav .nav-link.active {
  color: var(--mg-text) !important;
  background: var(--mg-hover) !important;
}

.admin-main {
  display: flex !important;
  flex-direction: column !important;
  width: 100% !important;
  height: 100dvh !important;
  min-width: 0 !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  color: var(--mg-text) !important;
  background: var(--mg-page) !important;
}

.admin-main > .topbar,
.admin-shell .admin-main .topbar {
  position: sticky !important;
  top: 0 !important;
  z-index: 30 !important;
  flex: 0 0 var(--mg-header-h) !important;
  min-height: var(--mg-header-h) !important;
  padding: 0 18px !important;
  color: var(--mg-text) !important;
  background: color-mix(in srgb, var(--mg-page) 94%, transparent) !important;
  border-bottom: 1px solid var(--mg-line) !important;
  box-shadow: none !important;
  backdrop-filter: blur(12px) !important;
}

.admin-shell .topbar-actions {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  width: auto !important;
  min-width: 0 !important;
  gap: 6px !important;
  flex-wrap: nowrap !important;
}

.admin-shell .topbar-actions > * {
  flex: 0 0 auto !important;
}

.admin-body {
  width: 100% !important;
  min-width: 0 !important;
  padding: 18px 20px 32px !important;
}

.admin-page-header,
.hero-card {
  width: 100% !important;
  margin: 0 0 14px !important;
  padding: 4px 0 14px !important;
  color: var(--mg-text) !important;
  background: transparent !important;
  border: 0 !important;
  border-bottom: 1px solid var(--mg-line) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

.admin-page-header h1,
.admin-page-header h2,
.hero-card h2 {
  margin: 4px 0 6px !important;
  color: var(--mg-text) !important;
  font-size: 1.34rem !important;
  font-weight: 650 !important;
  line-height: 1.24 !important;
}

.admin-page-header p,
.hero-card p,
.page-copy {
  color: var(--mg-text-3) !important;
  font-size: 0.86rem !important;
  line-height: 1.55 !important;
}

.metric-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)) !important;
  gap: 10px !important;
  margin-bottom: 12px !important;
}

.metric-card,
.admin-metric-card {
  position: relative !important;
  min-width: 0 !important;
  min-height: 94px !important;
  padding: 13px 14px !important;
  color: var(--mg-text) !important;
  background: var(--mg-surface) !important;
  border: 1px solid var(--mg-line) !important;
  border-left: 3px solid var(--mg-accent) !important;
  border-radius: 8px !important;
  box-shadow: none !important;
  transform: none !important;
}

.metric-card strong,
.admin-metric-card strong {
  color: var(--mg-text) !important;
  font-size: 1.46rem !important;
  font-weight: 700 !important;
}

.metric-card span,
.metric-card p,
.admin-metric-card span,
.admin-metric-card p {
  color: var(--mg-text-3) !important;
}

.metric-orb {
  display: none !important;
}

.panel-card,
.detail-card,
.preview-card,
.subsection {
  color: var(--mg-text) !important;
  background: var(--mg-surface) !important;
  border-color: var(--mg-line) !important;
  border-radius: 8px !important;
  box-shadow: none !important;
}

.panel-card {
  padding: 14px !important;
  overflow: hidden !important;
}

.detail-card {
  padding: 13px !important;
}

.panel-head,
.preview-head,
.detail-meta {
  display: flex !important;
  align-items: flex-start !important;
  justify-content: space-between !important;
  gap: 12px !important;
  margin-bottom: 12px !important;
}

.panel-head h2,
.panel-head h3,
.preview-head h3,
.primary-text {
  color: var(--mg-text) !important;
}

.panel-head p,
.secondary-text,
.field-hint,
.empty-block,
.empty-cell,
.eyebrow {
  color: var(--mg-text-3) !important;
}

.section-split {
  display: grid !important;
  grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.2fr) !important;
  gap: 12px !important;
}

.section-split.wide-right {
  grid-template-columns: minmax(280px, 0.7fr) minmax(0, 1.3fr) !important;
}

.form-grid,
.two-column,
.three-column {
  display: grid !important;
  gap: 12px !important;
}

.two-column {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

.three-column {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

.field input,
.field textarea,
.field select,
.acct-field__input,
.acct-field__textarea {
  width: 100% !important;
  min-height: 38px !important;
  color: var(--mg-text) !important;
  background: var(--mg-surface-2) !important;
  border: 1px solid var(--mg-line-2) !important;
  border-radius: 8px !important;
  box-shadow: none !important;
}

.field textarea,
.acct-field__textarea {
  min-height: 96px !important;
}

.primary-btn,
.ghost-btn,
.soft-btn,
.danger-btn,
.inline-btn,
.admin-page-header__button {
  min-height: 36px !important;
  padding: 0 11px !important;
  border-radius: 8px !important;
  box-shadow: none !important;
}

.primary-btn,
.admin-page-header__button--primary {
  color: #ffffff !important;
  background: var(--mg-accent) !important;
  border-color: var(--mg-accent) !important;
}

.ghost-btn,
.soft-btn,
.inline-btn,
.admin-page-header__button {
  color: var(--mg-text-2) !important;
  background: var(--mg-surface-2) !important;
  border-color: var(--mg-line) !important;
}

.ghost-btn:hover,
.soft-btn:hover,
.inline-btn:hover,
.admin-page-header__button:hover {
  color: var(--mg-text) !important;
  background: var(--mg-hover) !important;
}

.table-shell {
  position: relative !important;
  max-width: 100% !important;
  overflow: auto !important;
  background: var(--mg-surface) !important;
  border: 1px solid var(--mg-line) !important;
  border-radius: 8px !important;
  box-shadow: none !important;
  scrollbar-gutter: stable;
}

.table-shell table {
  width: 100% !important;
  min-width: 760px !important;
  border-collapse: collapse !important;
}

.table-shell th,
.table-shell td {
  padding: 9px 10px !important;
  color: var(--mg-text-2) !important;
  background: var(--mg-surface) !important;
  border-bottom: 1px solid var(--mg-line) !important;
  font-size: 0.78rem !important;
  line-height: 1.42 !important;
}

.table-shell th {
  position: sticky !important;
  top: 0 !important;
  z-index: 3 !important;
  color: var(--mg-text-3) !important;
  background: var(--mg-surface-2) !important;
  font-size: 0.72rem !important;
  font-weight: 700 !important;
  text-transform: none !important;
  white-space: nowrap !important;
}

.table-shell tbody tr:nth-child(2n) td {
  background: color-mix(in srgb, var(--mg-surface-2) 52%, var(--mg-surface)) !important;
}

.table-shell tbody tr:hover td,
.table-shell tbody tr.selected td {
  background: var(--mg-hover) !important;
}

.table-shell td.action-links,
.table-shell table:has(td.action-links) th:last-child {
  background: var(--mg-surface) !important;
  box-shadow: -1px 0 var(--mg-line) !important;
}

.filter-row,
.panel-actions,
.inline-actions,
.action-links,
.topbar-actions {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  flex-wrap: wrap !important;
}

@media (max-width: 1140px) and (min-width: 769px) {
  .admin-shell {
    grid-template-columns: 220px minmax(0, 1fr) !important;
  }

  .section-split,
  .section-split.wide-right {
    grid-template-columns: 1fr !important;
  }

  .three-column {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 768px) {
  .admin-shell {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    min-height: 100dvh !important;
    overflow-y: auto !important;
  }

  .admin-sidebar {
    display: grid !important;
    grid-template-columns: auto minmax(0, 1fr) auto !important;
    align-items: center !important;
    gap: 6px !important;
    width: 100% !important;
    height: auto !important;
    min-height: 56px !important;
    padding: 7px 8px !important;
    overflow: visible !important;
    border: 0 !important;
    border-bottom: 1px solid var(--mg-line) !important;
  }

  .admin-sidebar .brand-card,
  .admin-sidebar .profile-card {
    min-width: 44px !important;
    min-height: 44px !important;
    margin: 0 !important;
    padding: 5px 6px !important;
    border: 0 !important;
  }

  .admin-sidebar .brand-copy,
  .admin-sidebar .profile-copy {
    display: none !important;
  }

  .admin-nav {
    display: flex !important;
    grid-template-columns: none !important;
    min-width: 0 !important;
    gap: 3px !important;
    overflow-x: auto !important;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }

  .admin-nav::-webkit-scrollbar {
    display: none;
  }

  .admin-nav .nav-link {
    flex: 0 0 auto !important;
    min-height: 40px !important;
    padding-inline: 10px !important;
    white-space: nowrap !important;
  }

  .admin-main {
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  .admin-main > .topbar,
  .admin-shell .admin-main .topbar {
    min-height: 52px !important;
    padding: 0 10px !important;
  }

  .admin-shell .topbar-copy {
    min-width: 0 !important;
  }

  .admin-shell .topbar-copy > * {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  .admin-shell .topbar-actions {
    width: auto !important;
    flex-wrap: nowrap !important;
  }

  .admin-body {
    padding: 12px 10px calc(24px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .admin-page-header,
  .hero-card {
    padding-bottom: 12px !important;
  }

  .admin-page-header,
  .admin-page-header__copy,
  .panel-head,
  .preview-head,
  .detail-meta {
    min-width: 0 !important;
  }

  .admin-page-header,
  .panel-head,
  .preview-head {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
  }

  .admin-page-header__actions,
  .panel-actions,
  .inline-actions,
  .filter-row {
    width: 100% !important;
    overflow-x: auto !important;
    flex-wrap: nowrap !important;
    scrollbar-width: none;
  }

  .admin-page-header__actions > *,
  .panel-actions > *,
  .inline-actions > *,
  .filter-row > * {
    flex: 0 0 auto !important;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }

  .metric-card,
  .admin-metric-card {
    min-height: 88px !important;
    padding: 11px !important;
  }

  .metric-card strong,
  .admin-metric-card strong {
    font-size: 1.24rem !important;
  }

  .section-split,
  .section-split.wide-right,
  .two-column,
  .three-column,
  .form-grid {
    grid-template-columns: 1fr !important;
  }

  .panel-card {
    padding: 12px !important;
  }

  .table-shell {
    width: calc(100vw - 20px) !important;
    max-height: 58dvh !important;
    margin-inline: calc(50% - 50vw) !important;
    border-right: 0 !important;
    border-left: 0 !important;
    border-radius: 0 !important;
  }

  .table-shell table,
  .request-logs-table,
  .operation-logs-table,
  .audit-logs-table {
    min-width: 760px !important;
  }

  .table-shell th,
  .table-shell td {
    padding: 8px 9px !important;
  }

  .admin-shell .mgpt-theme-toggle {
    flex: 0 0 56px !important;
  }
}

@media (max-width: 430px) {
  .admin-sidebar {
    grid-template-columns: minmax(0, 1fr) auto !important;
  }

  .admin-sidebar .brand-card {
    display: none !important;
  }

  .metric-grid {
    grid-template-columns: 1fr !important;
  }

  .admin-page-header h1,
  .admin-page-header h2,
  .hero-card h2 {
    font-size: 1.18rem !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .mgpt-effort-native-canvas,
  .mgpt-effort-native-sweep,
  .mgpt-effort-native-mesh {
    animation: none !important;
  }
}

/* Final specificity bridge: older hotfixes used deeply scoped !important rules. */
html[data-mgpt-theme] #app .public-shell:not(.compact) {
  grid-template-columns: 260px minmax(0, 1fr) !important;
}

html[data-mgpt-theme] #app .public-shell.sidebar-collapsed:not(.compact) {
  grid-template-columns: 76px minmax(0, 1fr) !important;
}

html[data-mgpt-theme] #app .public-shell:not(.compact) .sidebar {
  width: auto !important;
  height: 100dvh !important;
  padding: 8px !important;
  gap: 2px !important;
  overflow: hidden !important;
  background: var(--mg-sidebar) !important;
  border-right: 1px solid var(--mg-line) !important;
}

html[data-mgpt-theme] #app .public-shell.sidebar-collapsed:not(.compact) .sidebar {
  width: 76px !important;
  min-width: 76px !important;
  max-width: 76px !important;
  padding-inline: 8px !important;
}

html[data-mgpt-theme] #app .public-shell.sidebar-collapsed .sidebar-head {
  justify-content: center !important;
  padding-inline: 0 !important;
}

html[data-mgpt-theme] #app .public-shell.sidebar-collapsed .brand-card--trigger {
  flex: 0 0 56px !important;
  width: 56px !important;
  min-width: 56px !important;
  max-width: 56px !important;
  padding: 0 !important;
  justify-content: center !important;
}

html[data-mgpt-theme] #app .public-shell:not(.compact) .sidebar-head {
  flex: 0 0 56px !important;
  min-height: 56px !important;
  padding: 8px 6px !important;
}

html[data-mgpt-theme] #app .public-shell:not(.compact) .sidebar-section:not(.sidebar-section--recent) {
  flex: 0 0 auto !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  padding: 4px 0 !important;
  overflow: visible !important;
  border: 0 !important;
}

html[data-mgpt-theme] #app .public-shell:not(.compact) .sidebar-section--recent {
  flex: 1 1 auto !important;
  min-height: 92px !important;
  max-height: none !important;
  padding: 4px 0 !important;
  overflow: hidden !important;
  border: 0 !important;
}

html[data-mgpt-theme] #app .public-shell .conversation-card__main > span {
  display: none !important;
}

html[data-mgpt-theme] #app .public-shell .conversation-card__main {
  min-height: 40px !important;
  align-items: center !important;
}

html[data-mgpt-theme] #app .public-shell .conversation-card__main > strong {
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
  font-size: 14px !important;
  font-weight: 500 !important;
}

html[data-mgpt-theme] #app .public-shell:not(.compact) .topbar {
  flex: 0 0 56px !important;
  min-height: 56px !important;
  padding: 0 12px 0 16px !important;
  background: var(--mg-page) !important;
  border-bottom: 1px solid transparent !important;
}

html[data-mgpt-theme] #app .public-shell .surface {
  padding: 0 0 18px !important;
  background: var(--mg-page) !important;
}

html[data-mgpt-theme] #app .public-shell .content-stage,
html[data-mgpt-theme] #app .public-shell .status-banner {
  max-width: 760px !important;
  padding-inline: 24px !important;
}

html[data-mgpt-theme] #app .public-shell .content-stage--wide {
  max-width: 1120px !important;
}

html[data-mgpt-theme] #app .public-shell .workspace--home .hero {
  width: min(100%, 760px) !important;
  max-width: 760px !important;
  min-height: 100% !important;
  padding: 38px 20px 44px !important;
  justify-content: center !important;
}

html[data-mgpt-theme] #app .public-shell .workspace--home .quick-grid {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  width: min(100%, 680px) !important;
  max-width: 680px !important;
  gap: 10px !important;
  margin-top: 28px !important;
}

html[data-mgpt-theme] #app .public-shell .workspace--home .quick-card {
  display: flex !important;
  flex-direction: row !important;
  justify-content: flex-start !important;
  width: 100% !important;
  max-width: none !important;
  min-height: 52px !important;
  padding: 10px 12px !important;
  gap: 9px !important;
  border: 1px solid var(--mg-line) !important;
  border-radius: 10px !important;
  background: transparent !important;
  box-shadow: none !important;
}

html[data-mgpt-theme] #app .public-shell .quick-card__icon,
html[data-mgpt-theme] #app .public-shell .quick-card__icon--blue,
html[data-mgpt-theme] #app .public-shell .quick-card__icon--green,
html[data-mgpt-theme] #app .public-shell .quick-card__icon--orange,
html[data-mgpt-theme] #app .public-shell .quick-card__icon--purple {
  width: 25px !important;
  height: 25px !important;
  min-width: 25px !important;
  color: var(--mg-text-2) !important;
  background: var(--mg-surface-2) !important;
  border-radius: 8px !important;
  box-shadow: none !important;
}

html[data-mgpt-theme] #app .public-shell .composer-dock,
html[data-mgpt-theme] #app .public-shell .workspace--home .composer-dock {
  padding: 10px 18px max(16px, env(safe-area-inset-bottom, 0px)) !important;
  background: linear-gradient(180deg, transparent 0, var(--mg-page) 26%, var(--mg-page) 100%) !important;
}

html[data-mgpt-theme] #app .public-shell .composer-shell,
html[data-mgpt-theme] #app .public-shell .workspace--home .composer-shell {
  width: min(100%, 760px) !important;
  max-width: 760px !important;
  padding: 0 !important;
}

html[data-mgpt-theme] #app .public-shell .composer-panel,
html[data-mgpt-theme] #app .public-shell .composer-panel--reasoning,
html[data-mgpt-theme] #app .public-shell .composer-panel.mgpt-effort-native-panel {
  padding: 12px 12px 10px !important;
  gap: 8px !important;
  border: 1px solid var(--mg-line-2) !important;
  border-radius: 26px !important;
  background: var(--mg-surface) !important;
  box-shadow: var(--mg-shadow) !important;
}

html[data-mgpt-theme] #app .public-shell .composer-toolbar__right {
  position: relative !important;
  flex-wrap: nowrap !important;
  gap: 6px !important;
}

/* Prototype-style compact effort button with the existing pixel slider in a popover. */
.mgpt-effort-trigger {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex: 0 0 auto !important;
  height: 34px !important;
  min-height: 34px !important;
  padding: 0 11px !important;
  color: var(--mg-text-2) !important;
  background: var(--mg-surface-2) !important;
  border: 0 !important;
  border-radius: 999px !important;
  box-shadow: none !important;
  font-size: 13px !important;
  font-weight: 650 !important;
  cursor: pointer !important;
}

.mgpt-effort-trigger:hover,
.mgpt-effort-trigger[data-open] {
  color: var(--mg-text) !important;
  background: var(--mg-surface-3) !important;
}

html[data-mgpt-theme] #app .public-shell .effort-switch.mgpt-effort-popover-source {
  position: absolute !important;
  right: 0 !important;
  bottom: 46px !important;
  z-index: 95 !important;
  display: block !important;
  flex: none !important;
  width: 380px !important;
  min-width: 380px !important;
  max-width: min(380px, calc(100vw - 24px)) !important;
  height: 168px !important;
  min-height: 168px !important;
  margin: 0 !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
  transform: translateY(8px) !important;
  transition: opacity 160ms ease, transform 160ms ease, visibility 160ms ease !important;
}

html[data-mgpt-theme] #app .public-shell .effort-switch.mgpt-effort-popover-source[data-mgpt-popover-open] {
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  transform: translateY(0) !important;
}

@media (max-width: 768px) {
  html[data-mgpt-theme] #app .public-shell,
  html[data-mgpt-theme] #app .public-shell.sidebar-collapsed,
  html[data-mgpt-theme] #app .public-shell.compact {
    display: block !important;
    grid-template-columns: none !important;
  }

  html[data-mgpt-theme] #app .public-shell.compact .sidebar {
    width: min(86vw, 320px) !important;
    min-width: 0 !important;
    max-width: 320px !important;
    height: 100dvh !important;
    padding: calc(8px + env(safe-area-inset-top, 0px)) 8px calc(8px + env(safe-area-inset-bottom, 0px)) !important;
  }

  html[data-mgpt-theme] #app .public-shell.compact .topbar {
    flex: 0 0 52px !important;
    min-height: calc(52px + env(safe-area-inset-top, 0px)) !important;
    padding: env(safe-area-inset-top, 0px) 8px 0 !important;
  }

  html[data-mgpt-theme] #app .public-shell.compact .content-stage,
  html[data-mgpt-theme] #app .public-shell.compact .content-stage--wide {
    max-width: 100% !important;
    padding-inline: 16px !important;
  }

  html[data-mgpt-theme] #app .public-shell.compact .workspace--home .hero {
    width: 100% !important;
    max-width: 100% !important;
    min-height: auto !important;
    padding: 72px 16px 28px !important;
    justify-content: flex-start !important;
  }

  html[data-mgpt-theme] #app .public-shell.compact .workspace--home .quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    width: 100% !important;
    max-width: 520px !important;
    gap: 8px !important;
    margin-top: 24px !important;
  }

  html[data-mgpt-theme] #app .public-shell.compact .workspace--home .quick-card {
    min-height: 48px !important;
    padding: 9px 10px !important;
  }

  html[data-mgpt-theme] #app .public-shell.compact .composer-dock {
    padding: 8px 8px max(10px, env(safe-area-inset-bottom, 0px)) !important;
    background: linear-gradient(180deg, transparent 0, var(--mg-page) 20%, var(--mg-page) 100%) !important;
  }

  html[data-mgpt-theme] #app .public-shell.compact .composer-panel {
    padding: 9px 9px 8px !important;
    border-radius: 22px !important;
  }

  html[data-mgpt-theme] #app .public-shell .effort-switch.mgpt-effort-popover-source {
    position: fixed !important;
    right: 8px !important;
    bottom: calc(112px + env(safe-area-inset-bottom, 0px)) !important;
    left: 8px !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 164px !important;
    min-height: 164px !important;
  }
}

@media (max-width: 430px) {
  html[data-mgpt-theme] #app .public-shell.compact .content-stage,
  html[data-mgpt-theme] #app .public-shell.compact .content-stage--wide {
    padding-inline: 12px !important;
  }

  html[data-mgpt-theme] #app .public-shell.compact .workspace--home .hero {
    padding: 60px 12px 24px !important;
  }

  .mgpt-effort-trigger {
    max-width: 94px !important;
    padding-inline: 8px !important;
  }
}

/* Final prototype alignment: remove reasoning chrome from the composer. */
html[data-mgpt-theme] #app .public-shell .composer-panel--reasoning::before,
html[data-mgpt-theme] #app .public-shell .composer-panel--reasoning::after,
html[data-mgpt-theme] #app .public-shell .composer-panel--reasoning[data-sending]::before,
html[data-mgpt-theme] #app .public-shell .composer-panel--reasoning[data-sending]::after {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  content: none !important;
  background: transparent !important;
  box-shadow: none !important;
  animation: none !important;
}

html[data-mgpt-theme] #app .public-shell .composer-panel,
html[data-mgpt-theme] #app .public-shell .composer-panel--reasoning,
html[data-mgpt-theme] #app .public-shell .composer-panel:focus-within,
html[data-mgpt-theme] #app .public-shell .composer-panel--reasoning:focus-within {
  border-color: var(--mg-line-2) !important;
  outline: 0 !important;
  box-shadow: var(--mg-shadow) !important;
  animation: none !important;
}

/* Reserve the sidebar body for history while retaining full-size touch targets on mobile. */
@media (min-width: 769px) {
  html[data-mgpt-theme] #app .public-shell:not(.compact) .sidebar-head {
    flex-basis: 50px !important;
    min-height: 50px !important;
    padding-block: 5px !important;
  }

  html[data-mgpt-theme] #app .public-shell:not(.compact) .brand-card,
  html[data-mgpt-theme] #app .public-shell:not(.compact) .brand-card--trigger {
    min-height: 36px !important;
    padding-block: 3px !important;
  }

  html[data-mgpt-theme] #app .public-shell:not(.compact) :is(.nav-list, .nav-list--primary) {
    gap: 1px !important;
    padding-block: 2px !important;
    margin-bottom: 0 !important;
  }

  html[data-mgpt-theme] #app .public-shell:not(.compact) .nav-item {
    min-height: 36px !important;
  }

  html[data-mgpt-theme] #app .public-shell:not(.compact) .sidebar-section:not(.sidebar-section--recent) {
    padding-block: 2px !important;
  }

  html[data-mgpt-theme] #app .public-shell:not(.compact) .sidebar-section__head {
    min-height: 28px !important;
    padding-inline: 8px !important;
  }

  html[data-mgpt-theme] #app .public-shell:not(.compact) .folder-chip {
    flex: 0 0 auto !important;
    height: 25px !important;
    min-height: 25px !important;
    padding-inline: 8px !important;
  }

  html[data-mgpt-theme] #app .public-shell:not(.compact) .sidebar-section--recent {
    flex: 1 1 0 !important;
    min-height: 128px !important;
    padding-block: 0 !important;
  }

  html[data-mgpt-theme] #app .public-shell:not(.compact) .conversation-list {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    padding-bottom: 2px !important;
  }

  html[data-mgpt-theme] #app .public-shell:not(.compact) .conversation-card:not(.editing),
  html[data-mgpt-theme] #app .public-shell:not(.compact) .conversation-card:not(.editing) .conversation-card__main {
    min-height: 38px !important;
  }

  html[data-mgpt-theme] #app .public-shell:not(.compact) .conversation-card:not(.editing) {
    padding: 0 8px !important;
  }

  html[data-mgpt-theme] #app .public-shell:not(.compact) .sidebar-footer {
    gap: 3px !important;
    padding-top: 4px !important;
  }

  html[data-mgpt-theme] #app .public-shell:not(.compact) .account-card {
    min-height: 42px !important;
    padding: 4px 6px !important;
  }

  html[data-mgpt-theme] #app .public-shell:not(.compact) .account-copy__tiers {
    display: none !important;
  }

  html[data-mgpt-theme] #app .public-shell:not(.compact) .footer-actions {
    grid-template-columns: repeat(3, 30px) !important;
    justify-content: start !important;
    gap: 4px !important;
  }

  html[data-mgpt-theme] #app .public-shell:not(.compact) .footer-icon-btn {
    width: 30px !important;
    min-width: 30px !important;
    min-height: 30px !important;
    padding: 0 !important;
  }

  html[data-mgpt-theme] #app .public-shell:not(.compact) .footer-icon-btn__label {
    display: none !important;
  }
}

/* Keep folder filters on one horizontally scrollable row on every viewport. */
html[data-mgpt-theme] #app .public-shell .sidebar .folder-chip-row {
  display: flex !important;
  min-width: 0 !important;
  padding: 0 6px 6px !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  flex-wrap: nowrap !important;
  overscroll-behavior-inline: contain;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: var(--mg-line-2) transparent;
  touch-action: pan-x pan-y;
  -webkit-overflow-scrolling: touch;
}

html[data-mgpt-theme] #app .public-shell .sidebar .folder-chip-row .folder-chip {
  flex: 0 0 auto !important;
}

html[data-mgpt-theme] #app .public-shell .sidebar .folder-chip-row::-webkit-scrollbar {
  display: block;
  height: 6px;
}

html[data-mgpt-theme] #app .public-shell .sidebar .folder-chip-row::-webkit-scrollbar-track {
  background: transparent;
}

html[data-mgpt-theme] #app .public-shell .sidebar .folder-chip-row::-webkit-scrollbar-thumb {
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--mg-line-2);
  background-clip: padding-box;
}

html[data-mgpt-theme] #app .public-shell .sidebar .folder-chip-row:focus-visible {
  outline: 1px solid var(--mg-text-3);
  outline-offset: 2px;
}

/* Complete theme coverage for nested bundle surfaces. */
html[data-mgpt-theme] #app .public-shell :is(
  .model-menu__hero,
  .model-menu__item--instant,
  .model-menu__item--nested,
  .model-series__trigger,
  .attachment-chip,
  .thinking-badge,
  .message-action-btn,
  .tabs,
  .acct-nav,
  .acct-content
) {
  color: var(--mg-text-2) !important;
  background: var(--mg-surface-2) !important;
  border-color: var(--mg-line) !important;
  box-shadow: none !important;
}

html[data-mgpt-theme] #app .public-shell :is(
  .model-menu__item:hover,
  .model-menu__item.active,
  .thinking-badge:hover,
  .message-action-btn:hover,
  .acct-nav button:hover,
  .acct-nav button.active
) {
  color: var(--mg-text) !important;
  background: var(--mg-hover) !important;
  border-color: var(--mg-line-2) !important;
}

html[data-mgpt-theme] #app .public-shell :is(
  .model-menu__item strong,
  .model-menu__hero-copy strong,
  .message-card__head strong,
  .thinking-badge__label,
  .acct-pane-title,
  .acct-section__title
) {
  color: var(--mg-text) !important;
}

html[data-mgpt-theme] #app .public-shell :is(
  .model-menu__copy > span,
  .model-menu__label,
  .agent-status-line,
  .acct-pane-desc,
  .acct-section__desc
) {
  color: var(--mg-text-3) !important;
}

html[data-mgpt-theme] #app .public-shell :is(
  .conversation-card.editing,
  .conversation-editor__input,
  .conversation-editor__select,
  .folder-editor input,
  .empty-block,
  .prompt-template-item,
  .rail-prompt-card
) {
  color: var(--mg-text) !important;
  background: var(--mg-surface-2) !important;
  border-color: var(--mg-line-2) !important;
  box-shadow: none !important;
}

html[data-mgpt-theme] #app .public-shell .message-card.assistant .message-plain {
  color: var(--mg-text) !important;
  background: transparent !important;
  border-color: transparent !important;
}

html[data-mgpt-theme] #app .public-shell .message-card.user .message-plain {
  color: var(--mg-text) !important;
  background: var(--mg-surface-2) !important;
  border-color: var(--mg-line) !important;
}

html[data-mgpt-theme] #app .public-shell :is(
  .thinking-section,
  .thinking-section__reasoning,
  .thinking-timeline,
  .thinking-timeline__item,
  .agent-trace-card,
  .agent-trace-item,
  .agent-trace-item__body
) {
  color: var(--mg-text) !important;
  background: var(--mg-surface-2) !important;
  border-color: var(--mg-line) !important;
  box-shadow: none !important;
}

html[data-mgpt-theme] #app .public-shell :is(
  .thinking-drawer__title,
  .thinking-section__label,
  .thinking-timeline__head,
  .thinking-timeline__summary,
  .agent-trace-card__title,
  .agent-trace-item__title
) {
  color: var(--mg-text) !important;
}

html[data-mgpt-theme] #app .public-shell :is(
  .thinking-timeline__status,
  .thinking-timeline__meta,
  .agent-trace-item__meta,
  .agent-trace-item__status
) {
  color: var(--mg-text-3) !important;
}

html[data-mgpt-theme] #app .public-shell :is(
  .acct-id-card,
  .acct-toggle,
  .acct-payment-tier,
  .acct-payment-card,
  .acct-payment-panel,
  .acct-payment-preview,
  .acct-payment-frame,
  .acct-payment-inline-url,
  .acct-payment-action,
  .byok-channel,
  .byok-model-row
) {
  color: var(--mg-text) !important;
  background: var(--mg-surface-2) !important;
  border-color: var(--mg-line) !important;
  box-shadow: none !important;
}

html[data-mgpt-theme] #app .public-shell :is(
  .acct-id-card__copy span,
  .acct-payment-tier p,
  .acct-payment-card p,
  .acct-payment-preview p,
  .byok-model-row__main span,
  .byok-key-state
) {
  color: var(--mg-text-3) !important;
}

html[data-mgpt-theme] #app .public-shell :is(
  .image-guide-card,
  .image-generation-progress,
  .image-job-card,
  .image-job-loading,
  .image-gallery__item,
  .image-lightbox__toolbar
) {
  color: var(--mg-text) !important;
  background: var(--mg-surface-2) !important;
  border-color: var(--mg-line) !important;
  box-shadow: none !important;
}

html[data-mgpt-theme] #app .public-shell :is(
  .image-guide-card p,
  .image-generation-progress span,
  .image-job-card__prompt,
  .image-lightbox__filename,
  .image-lightbox__prompt,
  .artifact-card__sub,
  .attachment-chip__status
) {
  color: var(--mg-text-3) !important;
}

html[data-mgpt-theme] #app .public-shell :is(
  .attachment-bar__action,
  .artifact-card__download,
  .prompt-template-item__actions button
) {
  color: var(--mg-text-2) !important;
  background: transparent !important;
  border-color: var(--mg-line) !important;
}

html[data-mgpt-theme] #app .admin-shell :is(
  .toggle-row label,
  .toggle-chip,
  .filter-row,
  .preview-surface,
  .empty-block,
  .banner,
  .user-create-card > .form-grid,
  .user-create-card > .toggle-row,
  .user-empty-state,
  .user-url-row,
  .url-limit-row,
  .panel-card--editor > .panel-actions:last-child
) {
  color: var(--mg-text) !important;
  background: var(--mg-surface-2) !important;
  border-color: var(--mg-line) !important;
  box-shadow: none !important;
}

html[data-mgpt-theme] #app .admin-shell :is(
  .preview-meta span,
  .detail-meta span,
  .admin-page-header__status,
  .admin-metric-card__meta,
  .admin-metric-card__hint
) {
  color: var(--mg-text-3) !important;
}

html[data-mgpt-theme] #app .admin-shell :is(.chip, .tag, .status-chip) {
  color: var(--mg-text-2) !important;
  background: var(--mg-surface-3) !important;
  border-color: var(--mg-line) !important;
}

/* The composer is one continuous surface; focusing the textarea adds no second frame. */
html[data-mgpt-theme] #app .public-shell :is(
  .composer-input,
  .composer-input--panel,
  .composer-input-shell
):focus,
html[data-mgpt-theme] #app .public-shell :is(
  .composer-input,
  .composer-input--panel,
  .composer-input-shell
):focus-visible {
  outline: none !important;
  outline-offset: 0 !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

/* Dopamine palette with a single consistent line-icon grammar. */
html[data-mgpt-theme] #app .public-shell .workspace--home .quick-card {
  border-radius: 14px !important;
  transition: color 150ms ease, background-color 150ms ease, border-color 150ms ease !important;
}

html[data-mgpt-theme] #app .public-shell .workspace--home .quick-card__icon {
  display: grid !important;
  place-items: center !important;
  flex: 0 0 30px !important;
  width: 30px !important;
  min-width: 30px !important;
  height: 30px !important;
  padding: 5px !important;
  border: 1px solid color-mix(in srgb, currentColor 24%, var(--mg-line)) !important;
  border-radius: 9px !important;
  box-shadow: none !important;
}

html[data-mgpt-theme] #app .public-shell .quick-card__icon[data-mgpt-quick-icon='translate'] {
  color: #2f80ed !important;
  background: color-mix(in srgb, #2f80ed 14%, var(--mg-surface)) !important;
}

html[data-mgpt-theme] #app .public-shell .quick-card__icon[data-mgpt-quick-icon='summarize'] {
  color: #ff8a00 !important;
  background: color-mix(in srgb, #ff8a00 15%, var(--mg-surface)) !important;
}

html[data-mgpt-theme] #app .public-shell .quick-card__icon[data-mgpt-quick-icon='advice'] {
  color: #20b26b !important;
  background: color-mix(in srgb, #20b26b 14%, var(--mg-surface)) !important;
}

html[data-mgpt-theme] #app .public-shell .quick-card__icon[data-mgpt-quick-icon='write'] {
  color: #9b5de5 !important;
  background: color-mix(in srgb, #9b5de5 15%, var(--mg-surface)) !important;
}

.mgpt-quick-icon {
  display: block;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  overflow: visible;
}

/* Sidebar footer stays on two compact rows, even for administrators. */
@media (min-width: 769px) {
  html[data-mgpt-theme] #app .public-shell:not(.compact) .sidebar-footer {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: 46px 32px !important;
    align-content: end !important;
    gap: 5px !important;
    min-height: 88px !important;
    overflow: hidden !important;
  }

  html[data-mgpt-theme] #app .public-shell:not(.compact) .account-card {
    display: grid !important;
    grid-template-columns: 34px minmax(0, 1fr) !important;
    align-items: center !important;
    height: 46px !important;
    min-height: 46px !important;
    padding: 4px 6px !important;
    overflow: hidden !important;
  }

  html[data-mgpt-theme] #app .public-shell:not(.compact) .account-copy > span:nth-of-type(n + 2) {
    display: none !important;
  }

  html[data-mgpt-theme] #app .public-shell:not(.compact) .footer-actions {
    display: flex !important;
    flex-flow: row nowrap !important;
    align-items: center !important;
    justify-content: stretch !important;
    width: 100% !important;
    gap: 6px !important;
    overflow: hidden !important;
  }

  html[data-mgpt-theme] #app .public-shell:not(.compact) .footer-actions .footer-icon-btn {
    grid-column: auto !important;
    flex: 1 1 0 !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 32px !important;
    min-height: 32px !important;
    padding: 0 !important;
    overflow: hidden !important;
  }

  html[data-mgpt-theme] #app .public-shell:not(.compact) .footer-actions .footer-icon-btn > span {
    display: none !important;
  }
}

/* The selected black folder chip is "All"; keep its label visible. */
html[data-mgpt-theme] #app .public-shell .sidebar .folder-chip.active,
html[data-mgpt-theme] #app .public-shell .sidebar .folder-chip.active .folder-chip__main,
html[data-mgpt-theme] #app .public-shell .sidebar .folder-chip.selected,
html[data-mgpt-theme] #app .public-shell .sidebar .folder-chip.selected .folder-chip__main {
  color: var(--mg-page) !important;
}

/* Dark mode is contextual: deep surfaces inherit the theme palette, while
   intentionally light controls retain dark readable text. */
html[data-mgpt-theme='dark'] #app .public-shell {
  color: var(--mg-text) !important;
}

html[data-mgpt-theme='dark'] #app .public-shell .tiny-btn {
  color: #292929 !important;
  background: #f5f5f5 !important;
  border-color: #dddddd !important;
}

html[data-mgpt-theme='dark'] #app .public-shell .tiny-btn:hover {
  color: #111111 !important;
  background: #ffffff !important;
}

html[data-mgpt-theme='dark'] #app .public-shell .footer-icon-btn--logout {
  color: var(--mg-danger) !important;
}

html[data-mgpt-theme='dark'] #app .public-shell .send-btn:not(:disabled) {
  color: var(--mg-page) !important;
}

html[data-mgpt-theme='dark'] #app .public-shell .quick-card__icon[data-mgpt-quick-icon='translate'] {
  color: #65a8ff !important;
}

html[data-mgpt-theme='dark'] #app .public-shell .quick-card__icon[data-mgpt-quick-icon='summarize'] {
  color: #ffad42 !important;
}

html[data-mgpt-theme='dark'] #app .public-shell .quick-card__icon[data-mgpt-quick-icon='advice'] {
  color: #55d995 !important;
}

html[data-mgpt-theme='dark'] #app .public-shell .quick-card__icon[data-mgpt-quick-icon='write'] {
  color: #c596ff !important;
}

html[data-mgpt-theme='dark'] #app .admin-shell {
  color: var(--mg-text) !important;
}
