/* Styles are scoped to the empty conversation so navigating to an existing
   thread retains the native scrolling and composer lifecycle. */
html.mx-cabinet[data-page="dashboard"] body #chatView #heroSection.chat-active .cabinet-workbench { display: none !important; }
/* A completed response replaces the streaming node in the same thread.
   Both must be visible even when entrance animations are disabled. */
html.mx-cabinet[data-page="dashboard"] body #chatView #messages .msg {
  opacity: 1 !important; transform: none !important; animation: none !important;
}
html.mx-cabinet[data-page="dashboard"] body #chatView #messages {
  width: min(100%,816px) !important; margin-inline: auto !important;
  & .msg.assistant, & .msg.user {
    width: 100% !important; max-width: 100% !important; gap: 6px !important;
  }
  & .msg.assistant { align-items: flex-start !important; flex-direction: column !important; }
  & .msg.user { align-items: flex-start !important; justify-content: flex-end !important; flex-direction: row !important; }
  & .msg.user > .avatar { display: none !important; }
  & .msg.assistant > .avatar {
    display: block !important; width: auto !important; min-width: 0 !important; height: auto !important;
    margin: 0 !important; padding: 0 !important; border: 0 !important; border-radius: 0 !important;
    color: #28503b !important; background: transparent !important; box-shadow: none !important;
    font: 680 14px/1.4 Inter,system-ui,sans-serif !important;
  }
  & .msg.assistant > .avatar::before, & .msg.assistant > .avatar::after { content: none !important; }
  & .msg.assistant .bubble {
    display: block !important; width: fit-content !important; max-width: min(100%,72ch) !important;
    background: transparent !important; border: 0 !important; box-shadow: none !important;
    padding: 0 !important; color: #22342a !important; text-align: left;
    font-size: 16px !important; line-height: 1.6 !important;
  }
  & .msg.assistant .bubble p { color: #22342a !important; font-size: 16px !important; line-height: 1.6 !important; }
  & .msg.user .bubble {
    padding: 10px 15px !important; background: #e3edde !important; border: 1px solid #d0ddca !important;
    border-radius: 15px 15px 4px 15px !important; box-shadow: none !important; max-width: 85% !important;
    color: #21392b !important; font-size: 15px !important; line-height: 1.5 !important;
  }
  & .msg.user .bubble :is(p,div,span,b,strong,em,li,code) {
    color: #21392b !important; -webkit-text-fill-color: currentColor !important; text-shadow: none !important;
  }
  & .msg.user .message-file-item.file-icon { background: #f4f7f0 !important; border: 1px solid #c8d6c2 !important; }
  & .msg.user .message-file-item .icon-wrapper { background: #48614f !important; border-radius: 6px; }
  & .msg.user .message-file-item .icon-wrapper svg { color: #fff !important; }
  & .msg .bubble .message-timestamp {
    color: #56685c !important; opacity: 1 !important; font-size: 11px !important; margin-top: 4px !important;
  }
  & .msg .bubble .copy-btn-unified {
    color: #49634f !important; background: transparent !important; border: 0 !important; box-shadow: none !important;
    min-height: 32px; padding: 4px 0 !important; margin-top: 4px;
  }
  & .msg .bubble .copy-btn-unified svg { color: inherit !important; stroke: currentColor !important; }
  & .msg .bubble .copy-btn-unified:hover { text-decoration: underline; }
  & .msg.assistant .bubble > .message-timestamp { float: right; margin: 12px 0 0 18px !important; }
}
html.mx-cabinet[data-page="dashboard"] body.hero-page #chatView #chatContainer:has(#heroSection:not(.chat-active)) {
  padding: 0 !important; align-items: center !important; justify-content: flex-start !important;
}
html.mx-cabinet[data-page="dashboard"] body #composer.composer-v2 .composer-bar {
  display: grid !important; grid-template-columns: 44px minmax(0,1fr) 44px !important; align-items: end !important;
  gap: 6px !important; padding: 7px !important; min-height: 0 !important; border-radius: 16px !important;
  & .c-top-row { grid-area: 1/2; display: flex !important; align-items: center; min-height: 44px !important; padding: 0 !important; min-width: 0; }
  & .c-bottom-row { display: contents !important; }
  & #input {
    margin: 0 !important; padding: 10px 2px !important; min-height: 44px !important; max-height: min(32dvh,186px) !important;
    resize: none; overflow-y: auto; font: 450 16px/1.5 Inter,system-ui,sans-serif !important;
  }
  & #attachBtn { grid-area: 1/1; width: 44px !important; height: 44px !important; border: 0 !important; background: transparent !important; }
  & #send { grid-area: 1/3; width: 44px !important; height: 44px !important; margin: 0 !important; }
  &:has(#composerRecordingBar[style*="flex"]) .c-top-row { grid-column: 1/-1; }
  &:has(#composerRecordingBar[style*="flex"]) :is(#attachBtn,#send) { visibility: hidden; pointer-events: none; }
}
html.mx-cabinet[data-page="dashboard"] body #chatView #heroSection:not(.chat-active) {
  --cab-ink: #213329; --cab-rule: #d1d8ce;
  box-sizing: border-box; display: block !important; overflow: visible !important;
  width: min(calc(100% - 64px),1192px) !important; max-width: none !important;
  height: auto !important; min-height: 0 !important; max-height: none !important;
  margin: 0 auto !important; padding: clamp(32px,4vw,64px) 0 60px !important;
  text-align: left !important; color: var(--cab-ink);
  &::before, &::after { display: none !important; }
  & *, & *::before, & *::after { box-sizing: border-box; }
  & .cabinet-workbench {
    position: relative; isolation: isolate; width: min(100%,1056px); margin: 0 auto;
    padding: 0 clamp(18px,5vw,74px);
  }
  & .cabinet-workbench::before {
    content: ""; pointer-events: none; position: absolute; inset: 0 0 44px; z-index: -1;
    border-radius: 18px; border: 1px solid #cfdbcb;
    background: url("/entry/paper-fibre.webp"), linear-gradient(105deg,#edf2e6,#e4eedc 78%,#e2eada);
  }
  & .cabinet-intro {
    position: relative; display: grid; align-content: center; justify-items: center;
    min-height: 150px; margin: 0; padding: 22px clamp(104px,12vw,158px);
  }
  & .cabinet-intro::after {
    content: ""; pointer-events: none; position: absolute; right: 0; top: 50%; transform: translateY(-50%) rotate(3deg);
    width: clamp(90px,9.5vw,140px); aspect-ratio: 1.25;
    background: url("/entry/studio-order-book.webp") center / contain no-repeat;
  }
  & .cabinet-title {
    margin: 0 !important; padding: 0 !important; color: var(--cab-ink) !important; -webkit-text-fill-color: currentColor !important;
    font: 690 clamp(32px,3vw,47px)/1.08 Inter,system-ui,sans-serif !important;
    letter-spacing: -.055em !important; text-align: center !important; text-shadow: none !important; background: transparent !important;
  }
  & .cabinet-intro .hero-subtitle {
    margin: 8px 0 0 !important; padding: 0 !important; width: auto !important; max-width: none !important;
    text-align: center !important; color: #425747 !important; font: 450 15px/1.5 Inter,system-ui,sans-serif !important;
  }
  & .hero-input-row { width: 100% !important; max-width: 794px !important; padding: 0 !important; margin: 0 auto !important; }
  & .hero-input-card {
    display: flex !important; flex-direction: column; gap: 0 !important; width: 100% !important; max-width: none !important;
    margin: 0 !important; padding: 0 !important; border: 1px solid #bdc9c0 !important; border-radius: 15px !important;
    background: #fffefa !important; box-shadow: 0 8px 20px -15px #1b372e70 !important; overflow: visible !important;
  }
  & .hero-input-card:focus-within { border-color: #60816c !important; box-shadow: 0 0 0 2px #58856524 !important; }
  & #heroAttachedFiles:empty { display: none !important; }
  & .hero-input-top { width: 100% !important; padding: 18px 19px 0 !important; border: 0 !important; }
  & textarea#heroInput {
    min-height: 46px !important; width: 100% !important; margin: 0 !important; padding: 0 !important;
    border: 0 !important; background: transparent !important; box-shadow: none !important;
    font: 450 16px/1.5 Inter,system-ui,sans-serif !important; color: var(--cab-ink) !important;
  }
  & textarea#heroInput::placeholder { color: #687569 !important; opacity: 1; }
  & .hero-input-bottom {
    display: flex !important; align-items: center !important; justify-content: space-between !important; flex-wrap: nowrap !important;
    width: 100% !important; gap: 8px !important; padding: 5px 11px 10px !important; margin: 0 !important; border: 0 !important;
  }
  & :is(.hero-bottom-left,.hero-bottom-right) { display: flex !important; width: auto !important; flex: none !important; gap: 0 !important; margin: 0 !important; }
  & #heroAttachBtn { background: transparent !important; border: 0 !important; border-radius: 9px !important; color: #506858 !important; box-shadow: none !important; }
  & #heroAttachBtn:hover { background: #eff3ed !important; }
  & #heroSendBtn { display: grid !important; place-items: center; flex: none; width: 42px !important; height: 42px !important; border-radius: 11px !important; background: #245b43 !important; box-shadow: none !important; }
  & .hero-input-card :is(button,textarea):focus-visible { outline-offset: 1px !important; }
  & #heroCasesSection {
    display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; column-gap: 14px;
    width: 100% !important; max-width: none !important; margin: clamp(30px,3.6vw,55px) 0 0 !important;
    padding: clamp(20px,2vw,28px) 0 0 !important; border: 0 !important; border-top: 1px solid var(--cab-rule) !important;
    text-align: left !important; overflow: visible !important;
  }
  & #cabinet-cases-title { grid-area: 1/1; margin: 0; color: var(--cab-ink); font: 660 clamp(23px,2.1vw,31px)/1.2 Inter,system-ui,sans-serif; letter-spacing: -.045em; }
  & .cabinet-filters { grid-area: 1/2; justify-self: end; max-width: 100%; text-align: right; }
  & .cabinet-filters[open] { grid-area: 2/1/3/-1; justify-self: stretch; align-self: start; margin-top: 6px; }
  & #heroCasesSection:has(.cabinet-filters[open]) #cabinet-cases-title { align-self: start; }
  & .cabinet-filters summary { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 5px 11px; border: 1px solid #c8d1c5; border-radius: 7px; cursor: pointer; color: #425c4d; font: 570 13px/1.3 Inter,system-ui,sans-serif; }
  & .cabinet-filters summary::after { content: ""; width: 6px; height: 6px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: translateY(-2px) rotate(45deg); }
  & .cabinet-filters[open] summary::after { transform: translateY(2px) rotate(225deg); }
  & .cabinet-filters summary::-webkit-details-marker { display: none; }
  & .cabinet-filters summary:focus-visible { outline: 2px solid #4e7659; }
  & #heroCasesTabs { display: flex !important; flex-wrap: wrap !important; justify-content: flex-start !important; gap: 5px !important; margin: 12px 0 0 !important; padding: 0 !important; border: 0 !important; overflow: visible !important; }
  & .hero-cases-tab { color: #465d4d !important; background: transparent !important; border: 0 !important; border-radius: 7px !important; padding: 8px 11px !important; box-shadow: none !important; font: 550 13px/1.25 Inter,system-ui,sans-serif !important; }
  & .hero-cases-tab::after { content: none !important; }
  & .hero-cases-tab.active { color: white !important; background: #2b503d !important; }
  & #heroCasesGrid {
    display: grid !important; grid-template-columns: repeat(4,minmax(0,1fr)) !important; grid-template-rows: none !important;
    grid-auto-flow: row !important; grid-auto-columns: auto !important; align-items: stretch !important; gap: 22px 18px !important;
    width: 100% !important; height: auto !important; max-height: none !important; padding: 0 !important; margin: 0 !important;
    overflow: visible !important; scroll-snap-type: none !important;
  }
  & #heroCasesGrid .hero-case-card:not([hidden]) {
    display: flex !important; flex-direction: column !important; min-width: 0 !important; max-width: none !important; width: auto !important;
    height: auto !important; border-radius: 11px !important; border: 1px solid #d2d7ca !important; background: #fffefa !important;
    text-align: left !important; box-shadow: none !important; overflow: hidden !important; transition: border-color 160ms ease;
  }
  & #heroCasesGrid .hero-case-card[hidden] { display: none !important; }
  & #heroCasesGrid .hero-case-card:hover { transform: none !important; border-color: #829b86 !important; }
  & .hero-case-card-img { order: -1; width: 100% !important; height: auto !important; aspect-ratio: 5/4; flex: none; border-radius: 0 !important; background-size: cover; background-position: center; }
  & .hero-case-card-body { padding: 14px 16px 16px !important; text-align: left !important; }
  & .hero-case-card-title { margin: 0 0 9px !important; color: #213628 !important; font: 660 clamp(16px,1.2vw,19px)/1.28 Inter,system-ui,sans-serif !important; letter-spacing: -.035em; }
  & .hero-case-sub, & .hero-case-card-tag { color: #57685a !important; font-size: 12px !important; font-weight: 500; letter-spacing: 0; }

  & #heroCasesGrid { grid-column: 1/-1; margin-top: 16px !important; }
  @media (min-width: 901px) {
    & .cabinet-workbench { margin-top: 26px; }
  }
  @media (max-width: 1050px) {
    width: calc(100% - 40px) !important;
    & #heroCasesGrid { grid-template-columns: repeat(3,minmax(0,1fr)) !important; }
  }
  @media (max-width: 720px) {
    width: calc(100% - 28px) !important; padding: 15px 0 36px !important;
    & .cabinet-workbench { padding-inline: clamp(10px,2.6vw,16px); }
    & .cabinet-workbench::before { inset-block-end: 33px; }
    & .cabinet-intro { min-height: 118px; padding: 14px 92px 14px 8px; justify-items: start; }
    & .cabinet-intro::after { right: 2px; width: 82px; }
    & .cabinet-title { font-size: clamp(26px,6.6vw,32px) !important; text-align: left !important; }
    & .cabinet-intro .hero-subtitle { margin-top: 5px !important; font-size: 13px !important; line-height: 1.4 !important; text-align: left !important; }
    & #heroCasesGrid { grid-template-columns: repeat(2,minmax(0,1fr)) !important; gap: 14px 10px !important; }
    & .hero-case-card-body { padding: 10px !important; }
    & .hero-case-card-title { font-size: 15px !important; }
    & #heroAttachBtn, & #heroSendBtn { min-height: 44px !important; min-width: 44px !important; }
    & .hero-input-top { padding: 14px 14px 0 !important; }
    & .hero-input-bottom { padding: 4px 8px 7px !important; }
    & .cabinet-filters summary, & .hero-cases-tab { min-height: 44px !important; }
  }
  @media (max-width: 359px) {
    & .cabinet-intro { padding-right: 70px; min-height: 112px; }
    & .cabinet-intro::after { width: 65px; }
    & #heroCasesSection { column-gap: 8px; }
    & #cabinet-cases-title { font-size: 20px; }
    & .cabinet-filters summary { padding-inline: 7px; font-size: 12px; }
  }
}
