html.mx-edition.mx-cabinet[data-page="dashboard"] body {
  & #editionFrame :is(#editionHistorySlot,#editionMobileHistory) button#menuToggle[aria-current="page"],
  & #editionFrame :is(#editionHistorySlot,#editionMobileHistory) button#menuToggle[aria-current="page"]:hover {
    background: #284cb0 !important;
    color: white !important;
    border-color: #284cb0 !important;
    box-shadow: 0 2px 5px #1d345921 !important;
  }
  & #editionFrame :is(#editionHistorySlot,#editionMobileHistory) button#menuToggle[aria-current="page"] svg {
    color: white !important;
    background: #ffffff25 !important;
  }
  & main.main > #historyView.view.active {
    display: block !important;
    padding: 0 !important;
    justify-content: start !important;
    align-content: start !important;
  }
  & #historyView {
    --history-text: var(--mxc-ink, #17263a);
    --history-secondary: #506481;
    --history-line: #dce5f2;
    --history-blue: var(--mxc-primary, #284cb0);
    --history-selected: #edf3ff;
    color: var(--history-text);
  }
  & #historyView .mx-history-page {
    box-sizing: border-box;
    width: min(100%, 852px);
    margin-inline: auto;
    padding: clamp(20px, 4vw, 44px) clamp(16px, 4vw, 36px) 48px;
  }
  & #historyView svg {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  & #historyView button { font: inherit; cursor: pointer; text-shadow: none; }
  & #historyView :is(button, input):focus-visible {
    outline: 2px solid var(--mxc-focus, #325cc0);
    outline-offset: 2px;
  }
  & #historyView .mx-history-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    margin-inline-start: -8px;
    padding: 0 8px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--history-secondary);
    font-size: 13px;
    font-weight: 600;
    text-align: left;
  }
  & #historyView .mx-history-back:hover { background: #f0f5fc; color: var(--history-blue); }
  & #historyView .mx-history-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px 12px;
    margin: 6px 0 18px;
  }
  & #historyView #historyTitle {
    margin: 0;
    color: inherit;
    font-size: clamp(26px, 4vw, 37px);
    font-weight: 740;
    letter-spacing: -.04em;
    line-height: 1.1;
    text-shadow: none;
  }
  & #historyView #historyTitle:focus { outline: none; }
  & #historyView .mx-history-new {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 44px;
    padding: 0 13px;
    border: 0;
    border-radius: 9px;
    background: var(--history-blue);
    color: #fff;
    font-size: 13px;
    font-weight: 650;
    white-space: nowrap;
  }
  & #historyView .mx-history-new:hover { background: #203e93; }
  & #historyView .mx-history-search {
    display: flex;
    align-items: center;
    gap: 10px;
    box-sizing: border-box;
    width: min(100%, 390px);
    min-height: 46px;
    margin: 0 0 24px;
    padding: 0 12px;
    border: 1px solid var(--history-line);
    border-radius: 9px;
    background: #fff;
    color: var(--history-secondary);
  }
  & #historyView .mx-history-search:focus-within {
    border-color: var(--history-blue);
    box-shadow: 0 0 0 2px #365cc121;
  }
  & #historyView #historySearch {
    box-sizing: border-box;
    min-width: 0;
    width: 100%;
    padding: 10px 0;
    border: 0 !important;
    box-shadow: none !important;
    outline: 0 !important;
    background: transparent !important;
    color: var(--history-text);
    font: inherit;
    font-size: 16px;
    line-height: 1.4;
  }
  & #historyView #historySearch::placeholder { color: var(--history-secondary); }
  & #historyView #historyList > section + section { margin-top: 20px; }
  & #historyView .history-group-label {
    margin: 0 0 7px;
    padding: 0 2px;
    color: var(--history-secondary);
    font-size: 13px;
    font-weight: 650;
    line-height: 1.4;
  }
  & #historyView .history-group-rows {
    margin: 0;
    padding: 0;
    list-style: none;
    border: 1px solid var(--history-line);
    border-radius: 12px;
    background: #fff;
  }
  & #historyView .history-entry {
    display: flex;
    align-items: stretch;
    min-width: 0;
    min-height: 62px;
    padding-inline-end: 7px;
  }
  & #historyView .history-entry:first-child { border-radius: 11px 11px 0 0; }
  & #historyView .history-entry:last-child { border-radius: 0 0 11px 11px; }
  & #historyView .history-entry:only-child { border-radius: 11px; }
  & #historyView .history-entry + .history-entry { border-top: 1px solid var(--history-line); }
  @media (hover: hover) {
    & #historyView .history-entry:hover { background: #f7faff; }
  }
  & #historyView .history-entry.active { background: var(--history-selected); }
  & #historyView .history-open {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    flex: 1 1 0;
    min-width: 0;
    padding: 9px 12px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--history-text);
    text-align: left;
  }
  & #historyView .history-open:focus-visible { outline-offset: -3px; }
  & #historyView .history-row-icon {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: #f0f4fb;
    color: #4b6491;
  }
  & #historyView .active .history-row-icon { background: #dce8ff; color: var(--history-blue); }
  & #historyView .history-name {
    font-size: 15px;
    font-weight: 640;
    line-height: 1.35;
    overflow-wrap: anywhere;
  }
  & #historyView .history-time {
    color: var(--history-secondary);
    font-size: 12px;
    white-space: nowrap;
  }
  & #historyView .history-unread {
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-inline-start: 7px;
    border-radius: 50%;
    background: var(--history-blue);
    vertical-align: middle;
  }
  & #historyView .history-actions { display: flex; align-items: center; flex: none; }
  & #historyView .history-actions button {
    display: grid;
    place-items: center;
    width: 40px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--history-secondary);
  }
  & #historyView .history-actions button:hover { color: var(--history-blue); background: #e7efff; }
  & #historyView .history-actions .history-delete:hover { color: #a42a36; background: #fff1f2; }
  & #historyView .history-state {
    margin: 0;
    padding: 17px;
    color: var(--history-secondary);
    font-size: 14px;
    line-height: 1.5;
    background: #f4f7fc;
    border-radius: 10px;
  }
  & #historyView .history-rename {
    display: flex;
    flex: 1;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 9px 12px;
  }
  & #historyView .history-rename input {
    flex: 1 1 220px;
    min-width: 0;
    min-height: 40px;
    padding: 7px 10px;
    border: 1px solid #bccde7;
    border-radius: 8px;
    background: #fff;
    color: var(--history-text);
    font: inherit;
    font-size: 16px;
  }
  & #historyView .history-rename button {
    min-height: 40px;
    padding: 0 11px;
    border: 1px solid #bccde7;
    border-radius: 8px;
    background: #fff;
    color: var(--history-blue);
    font-size: 13px;
    font-weight: 600;
  }
  & #historyView .history-rename button[type="submit"] {
    background: var(--history-blue);
    color: #fff;
    border-color: var(--history-blue);
  }
}
@media (max-width: 600px) {
  html.mx-edition.mx-cabinet[data-page="dashboard"] body {
    & #historyView .mx-history-page { padding: 12px 14px 26px; }
    & #historyView .mx-history-heading { margin: 4px 0 14px; }
    & #historyView .mx-history-new { padding-inline: 10px; }
    & #historyView .mx-history-search { margin-bottom: 18px; }
    & #historyView .history-entry { padding-inline-end: 2px; }
    & #historyView .history-open {
      grid-template-columns: auto minmax(0, 1fr);
      gap: 2px 8px;
      align-content: center;
      padding: 9px 5px 9px 9px;
    }
    & #historyView .history-row-icon { grid-row: 1 / span 2; width: 29px; height: 29px; }
    & #historyView .history-row-icon svg { width: 16px; height: 16px; }
    & #historyView :is(.history-name, .history-time) { grid-column: 2; }
    & #historyView .history-actions button { width: 44px; }
  }
}
@media (max-width: 365px) {
  html.mx-edition.mx-cabinet[data-page="dashboard"] body #historyView .mx-history-new svg { display: none; }
}

html.mx-edition.mx-cabinet[data-page="dashboard"] body #chatView #heroSection:not(.chat-active) {
  & .chat-start-sheet {
    box-sizing: border-box;
    grid-template-columns: minmax(0, 1fr) minmax(142px, 27%) !important;
    gap: 18px clamp(20px, 4vw, 46px) !important;
    align-items: center;
    padding: clamp(22px, 3.6vw, 38px) !important;
    border: 1px solid #dce5f5 !important;
    border-radius: 16px !important;
    background: #eef3fd !important;
  }
  & .cabinet-intro .cabinet-title {
    font-size: clamp(31px, 4vw, 45px) !important;
    font-weight: 730 !important;
    line-height: 1.08 !important;
    letter-spacing: -.045em !important;
    text-shadow: none !important;
    white-space: normal !important;
  }
  & .cabinet-intro .hero-subtitle {
    margin: 9px 0 0 !important;
    max-width: 54ch !important;
    color: #415675 !important;
    font-size: clamp(15px, 2vw, 17px) !important;
    line-height: 1.48 !important;
  }
  & #chatStoreLink:not([hidden]) {
    display: inline-flex !important;
    align-items: center;
    gap: 7px;
    max-width: 100%;
    min-height: 44px !important;
    margin: 12px 0 0 !important;
    padding: 0 11px;
    border: 1px solid #c7d6f2;
    border-radius: 9px;
    background: #f9fbff;
    color: var(--mxc-primary, #284cb0) !important;
    font-size: 13px !important;
    font-weight: 650 !important;
    text-decoration: none;
  }
  & #chatStoreLink:hover { background: #e2ebff; }
  & .chat-store-caption { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  & #chatStoreLink svg { flex: none; }
  & .edition-chat-art { min-height: 0; }
  & .edition-analyst { width: 100%; height: clamp(155px, 22vw, 230px); }
  & .hero-input-card {
    min-height: 0 !important;
    border: 1px solid #c8d5eb !important;
    border-radius: 12px !important;
    background: #fff !important;
    box-shadow: none !important;
  }
  & .hero-input-card:focus-within { border-color: #c8d5eb !important; box-shadow: none !important; }
  & .hero-input-card:has(#heroInput:focus) {
    border-color: #5277cc !important;
    box-shadow: 0 0 0 2px #325cc023 !important;
  }
  & #heroAttachedFiles:empty { display: none; }
  & .hero-input-top { padding: 13px 14px 0 !important; }
  & textarea#heroInput {
    min-height: 42px !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    font-size: 16px !important;
  }
  & textarea#heroInput:focus { outline: none !important; box-shadow: none !important; }
  & textarea#heroInput::placeholder { color: #526684 !important; }
  & .hero-input-bottom { padding: 2px 8px 8px !important; }
  & #heroAttachBtn {
    width: 44px !important;
    height: 44px !important;
    color: #456088 !important;
  }
  & #heroAttachBtn:hover { background: #edf3ff !important; }
  & #heroSendBtn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: auto !important;
    min-width: 44px;
    min-height: 44px !important;
    padding: 0 11px !important;
    font-size: 13px;
    font-weight: 650;
    line-height: 1;
  }
  & #heroSendBtn svg { flex: none; width: 17px !important; height: 17px !important; }
  & #heroSendBtn:hover { background: #203e93 !important; }
}
@media (max-width: 650px) {
  html.mx-edition.mx-cabinet[data-page="dashboard"] body #chatView #heroSection:not(.chat-active) {
    & .chat-start-sheet {
      grid-template-columns: minmax(0, 1fr) 74px !important;
      gap: 16px 6px !important;
      padding: 18px 15px 15px !important;
    }
    & .cabinet-intro .cabinet-title { font-size: clamp(27px, 6.9vw, 34px) !important; }
    & .edition-chat-art { align-self: start; margin: 0; }
    & .edition-analyst { height: 76px; }
    & .hero-input-row { grid-column: 1 / -1; }
    & .hero-input-top { padding-inline: 11px !important; }
  }
}
@media (max-width: 365px) {
  html.mx-edition.mx-cabinet[data-page="dashboard"] body #chatView #heroSection:not(.chat-active) {
    & .chat-start-sheet { grid-template-columns: minmax(0, 1fr) !important; }
    & .edition-chat-art { display: none !important; }
  }
}

html.mx-edition.mx-cabinet[data-page="dashboard"] body {
  & :is([data-focus-field], .mx-history-search, .bots-search-wrapper, .afv-search, .uv-search-wrap) { cursor: text; }
  & [data-focus-field] [data-field-action] { cursor: default; }
  & #composer.composer-v2 [data-focus-field="input"]:has(#input:focus) {
    border-color: #5277cc !important;
    box-shadow: 0 0 0 2px #325cc023 !important;
  }
  & #composer.composer-v2 textarea#input:focus { outline: none !important; box-shadow: none !important; }
}

html.mx-edition.mx-cabinet[data-page="dashboard"] body #locoWizardModal {
  & .loco-catalog-hint, & .loco-catalog-loading {
    margin: 0 0 16px;
    color: var(--mxc-muted, #506481);
    font-size: 14px;
    line-height: 1.5;
  }
  & .loco-catalog-store {
    display: grid;
    gap: 6px;
    max-width: 360px;
    margin-bottom: 16px;
    color: var(--mxc-ink, #17263a);
    font-size: 13px;
    font-weight: 600;
  }
  & #locoCatalogStore {
    width: 100%;
    min-height: 44px;
    padding: 0 10px;
    border: 1px solid #cbd9ef;
    border-radius: 9px;
    background: #fff;
    color: inherit;
    font: inherit;
    font-size: 16px;
  }
  & .loco-search-wrap {
    min-height: 46px;
    margin-bottom: 16px !important;
    border: 1px solid #cbd9ef !important;
    border-radius: 9px !important;
    background: #fff !important;
    color: #506481;
    cursor: text;
  }
  & .loco-search-wrap:focus-within { border-color: #5277cc !important; box-shadow: 0 0 0 2px #325cc023; }
  & #locoCatalogSearch {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 8px 0 !important;
    margin: 0 !important;
    border: 0 !important;
    background: transparent !important;
    outline: 0 !important;
    box-shadow: none !important;
    font-size: 16px !important;
  }
  & .loco-catalog-state {
    border: 1px solid #dae5f7;
    border-radius: 12px;
    background: #f2f6ff;
    padding: clamp(16px, 3vw, 24px);
    color: var(--mxc-ink, #17263a);
  }
  & .loco-catalog-state h3 { margin: 0; font-size: 19px; font-weight: 700; line-height: 1.25; }
  & .loco-catalog-state p {
    margin: 8px 0 16px;
    color: var(--mxc-muted, #506481);
    max-width: 52ch;
    font-size: 14px;
    line-height: 1.5;
  }
  & .loco-catalog-actions { display: flex; flex-wrap: wrap; gap: 8px; }
  & .loco-catalog-actions :is(button, a) { min-height: 44px; }
  & #locoPickGrid .loco-empty-inline { background: #f2f6ff !important; border-color: #dae5f7 !important; }
}

/* Keep the conversation title and its primary action on one line of navigation. */
html.mx-edition.mx-cabinet[data-page="dashboard"] body #chatView #heroSection.chat-active .thread-heading {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px !important;
  min-height: 62px;
  padding: 8px clamp(12px, 3vw, 20px) !important;
}
html.mx-edition.mx-cabinet[data-page="dashboard"] body #chatView .thread-heading #threadTitle {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  white-space: normal;
  overflow-wrap: anywhere;
  font-size: clamp(15px, 2.2vw, 18px) !important;
  font-weight: 700 !important;
  line-height: 1.28;
}
html.mx-edition.mx-cabinet[data-page="dashboard"] body #chatView #threadNew {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 13px;
  border: 0;
  border-radius: 9px;
  background: #284cb0;
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
  cursor: pointer;
}
html.mx-edition.mx-cabinet[data-page="dashboard"] body #chatView #threadNew svg { flex: 0 0 18px; }
html.mx-edition.mx-cabinet[data-page="dashboard"] body #chatView #threadNew:hover { background: #203e93; }
html.mx-edition.mx-cabinet[data-page="dashboard"] body #chatView #threadNew:focus-visible {
  outline: 2px solid #284cb0;
  outline-offset: 3px;
}

html.mx-edition.mx-cabinet[data-page="dashboard"] body header.top-header#editionFrame {
  & button#brandLogo.brand-logo-header {
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    text-shadow: none !important;
  }
  & button#brandLogo .mx-brand-mark {
    display: grid;
    flex: 0 0 23px;
    width: 23px;
    height: 23px;
    padding: 5px;
    grid-template: repeat(2, 1fr) / repeat(2, 1fr);
    gap: 2px;
    background: #284cb0;
    border-radius: 7px;
  }
  & button#brandLogo .mx-brand-mark i { border-radius: 1px; background: white; }
  & button#brandLogo .mx-brand-mark i:last-child { background: #b6ceff; }
  & button#brandLogo .edition-wordmark {
    color: #182741 !important;
    font: 720 24px/1 Inter, system-ui, sans-serif;
    letter-spacing: -.04em;
  }
  & button#brandLogo .edition-wordmark span {
    margin-inline-start: 1px;
    color: #3d66bd !important;
    font-weight: 600;
    letter-spacing: -.025em;
  }
  & #menuToggle .mx-history-label-short { display: none; }
}

html.mx-cabinet[data-page="dashboard"] body #chatView .mx-thread-label { min-width: 0; }

@media (max-width: 900px) {
  html.mx-edition.mx-cabinet[data-page="dashboard"] {
    --ed-head: 61px;
    --ed-foot: calc(64px + env(safe-area-inset-bottom, 0px));
  }
  html.mx-edition.mx-cabinet.keyboard-open[data-page="dashboard"] { --ed-foot: 0px; }
  html.mx-edition.mx-cabinet[data-page="dashboard"] body header.top-header#editionFrame {
    border-radius: 0 !important;
    background: #fff !important;

    & .edition-topline {
      display: grid !important;
      grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
      align-items: center;
      column-gap: clamp(4px, 1.5vw, 9px);
      height: 100% !important;
      padding: 0 max(10px, env(safe-area-inset-right)) 0 max(10px, env(safe-area-inset-left)) !important;
    }

    & #editionMobileBrand {
      grid-column: 2;
      grid-row: 1;
      justify-self: center;
    }
    & #editionMobileBrand button#brandLogo { gap: 5px; }
    & #editionMobileBrand button#brandLogo .edition-wordmark { font-size: clamp(17px, 5vw, 21px); }
    & #editionMobileBrand button#brandLogo .mx-brand-mark { width: 17px; height: 17px; flex-basis: 17px; padding: 4px; border-radius: 5px; }

    & #storeSelectorContainer {
      grid-column: 1;
      grid-row: 1;
      justify-self: start;
      width: max-content;
      min-width: 0;
      max-width: min(100%, 180px);
    }
    & #storeSelectorContainer #storeSelectBtn {
      width: 100% !important;
      height: 44px !important;
      padding: 0 7px !important;
      justify-content: flex-start;
      gap: 5px;
      border-radius: 10px !important;
      background: transparent !important;
      border-color: transparent !important;
      font-size: 13px !important;
    }
    & #storeSelectorContainer #storeSelectBtn:is(:hover,[aria-expanded="true"]) {
      background: #edf2fc !important;
      color: #214291 !important;
    }
    & #storeSelectorContainer #storeSelectBtn .chevron-down { width: 12px; height: 12px; }

    & .edition-account-area {
      grid-column: 3;
      grid-row: 1;
      justify-self: end;
      display: flex !important;
      align-items: center;
      gap: 2px;
    }
    & #editionMobileHistory button#menuToggle {
      display: inline-flex !important;
      justify-content: center !important;
      align-items: center;
      width: auto !important;
      min-height: 44px !important;
      padding: 0 5px !important;
      color: #214291 !important;
      font: 650 13px/1 Inter, system-ui, sans-serif !important;
    }
    & #editionMobileHistory button#menuToggle :is(svg,.mx-history-label-full) { display: none !important; }
    & #editionMobileHistory button#menuToggle .mx-history-label-short { display: inline !important; }
    & #editionMobileHistory button#menuToggle[aria-current="page"] { color: #fff !important; }
    & #userBadgeContainer #editionAccountButton {
      display: grid !important;
      place-items: center;
      width: 44px !important;
      height: 44px !important;
      min-height: 44px !important;
      max-height: none !important;
      padding: 0 !important;
      border: 0 !important;
      border-radius: 10px !important;
      margin: 0 !important;
    }
    & #editionAccountButton .user-initials {
      width: 31px !important;
      height: 31px !important;
      font-size: 12px;
      font-weight: 700;
    }
    & #storeDropdown {
      top: calc(var(--ed-head) + 3px) !important;
      right: max(8px, env(safe-area-inset-right)) !important;
      left: auto !important;
    }

    & .edition-nav.tabs {
      position: fixed !important;
      inset: auto 0 0 !important;
      box-sizing: border-box !important;
      width: 100% !important;
      max-width: none !important;
      height: var(--ed-foot) !important;
      padding: 5px max(4px, env(safe-area-inset-right)) calc(5px + env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-left)) !important;
      gap: 2px !important;
      margin: 0 !important;
      border: 0 !important;
      border-top: 1px solid #dce4ef !important;
      border-radius: 0 !important;
      box-shadow: none !important;
      background: #fff !important;
    }

    & .edition-rail .edition-nav.tabs button.tab {
      position: relative;
      min-width: 0 !important;
      min-height: 44px !important;
      padding: 3px 1px !important;
      gap: 4px !important;
      border: 0 !important;
      border-radius: 9px !important;
      color: #455875 !important;
      background: transparent !important;
      box-shadow: none !important;
      font: 600 11px/1.15 Inter, system-ui, sans-serif !important;
      white-space: nowrap;
    }
    & .edition-rail .edition-nav.tabs button.tab svg {
      width: 21px !important;
      height: 21px !important;
      padding: 0 !important;
      color: inherit !important;
      background: none !important;
    }
    & .edition-rail .edition-nav.tabs button.tab:is(.active,[aria-current="page"]) {
      background: #e9efff !important;
      color: #214291 !important;
      font-weight: 700 !important;
    }
    & :is(.edition-nav,.edition-topline) button:focus-visible {
      outline: 2px solid #284cb0 !important;
      outline-offset: -3px;
    }
  }
}

