/* A sibling control keeps button/label card markup valid. */
.document-viewer-header { display: contents; }
.document-viewer-heading { display: none; }
.document-window-minimize, .document-window-dock, .document-window-dock-stack, .document-window-resizer { display: none; }
/* Close stays a text action, including the viewer's initial programmatic focus. */
html body .document-viewer-layer .document-viewer-header > button.document-viewer-close.button-variant-3 {
  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
}
html body .document-viewer-layer .document-viewer-header > button.document-viewer-close.button-variant-3:focus-visible {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}
@media (min-width: 1024px) {
  html body .document-viewer-layer {
    --document-window-radius: 24px;
    z-index: 70;
    inset: var(--desk-top) calc(var(--desk-main-right) + var(--desk-float-gap)) var(--desk-float-gap) var(--desk-nav-width);
    width: auto;
    height: auto;
    display: grid;
    grid-template-rows: 72px minmax(0, 1fr);
    border: 1px solid var(--line);
    border-radius: var(--document-window-radius);
    background: var(--panel);
    isolation: isolate;
    box-shadow: 0 18px 54px rgb(0 0 0 / .24);
    transition: inset .26s cubic-bezier(.22,.75,.28,1);
  }
  html body .document-viewer-header {
    display: grid;
    grid-template-columns: minmax(88px,1fr) minmax(0,4fr) minmax(88px,1fr);
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 20px;
    border-bottom: 0;
    background: transparent;
  }
  html body .document-viewer-heading { display: grid; gap: 2px; min-width: 0; text-align: center; grid-column: 2; grid-row: 1; }
  html body .document-viewer-heading small { font-size: 12px; line-height: 1.2; color: var(--muted); }
  html body .document-viewer-heading strong { font-size: 16px; line-height: 1.35; color: var(--text); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  html body .document-viewer-header > .document-viewer-close {
    position: static;
    grid-column: 3; grid-row: 1; justify-self: end;
    flex: 0 0 auto;
    min-height: 44px;
    height: 44px;
  }
  html body .document-viewer-frame {
    min-width: 0; min-height: 0; width: 100%; height: 100%; border: 0; background: var(--panel);
    border-radius: var(--document-window-radius) var(--document-window-radius) 0 0;
    clip-path: inset(0 round var(--document-window-radius) var(--document-window-radius) 0 0);
  }
  html body.desktop-assistant-resizing .document-viewer-layer { transition: none; }
  html body .document-viewer-layer[hidden] { display: none; }
  html body .document-viewer-header { cursor: grab; touch-action: none; user-select: none; }
  html body .document-viewer-heading { flex: 1; }
  html body .document-viewer-header:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; }
  html body .document-window-minimize { grid-column: 1; grid-row: 1; justify-self: start; display: grid; place-items: center; width: 44px; height: 44px; flex: 0 0 44px; border: 1px solid var(--line); border-radius: 12px; background: rgb(255 255 255 / .06); color: var(--text); font-size: 28px; cursor: pointer; }
  html body .document-viewer-layer.document-window-dragging, html body .document-viewer-layer.document-window-positioned { transition: none; }
  html body .document-window-dragging .document-viewer-header { cursor: grabbing; }
  html body :is(.document-window-dragging,.document-window-resizing) iframe { pointer-events: none; }
  html body .document-window-minimize svg { width: 24px; height: 24px; stroke: currentColor; fill: none; }
  html body .document-window-resizer { display: block; position: absolute; top: 0; bottom: 0; width: 10px; z-index: 4; cursor: col-resize; touch-action: none; }
  html body .document-window-resizer[data-edge="left"] { left: 0; }
  html body .document-window-resizer[data-edge="right"] { right: 0; }
  html body .document-window-resizer::after { content: ""; position: absolute; top: 50%; left: 3px; width: 4px; height: 56px; border-radius: 4px; background: var(--accent); opacity: 0; transform: translateY(-50%); transition: opacity .16s ease; }
  html body .document-window-resizer:is(:hover,:focus-visible)::after,
  html body .document-window-resizing .document-window-resizer::after { opacity: .6; }
  html body .document-window-resizer:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
  html body:has(.document-window-resizing) { cursor: col-resize; user-select: none; }
  html body .document-viewer-layer.document-window-resizing { transition: none; }
  html body .document-window-animating { transform-origin: top left; pointer-events: none; transition: none; will-change: left, top, width, height; }
  html body .document-window-dock-stack:not([hidden]) { display: flex; flex-direction: column; gap: 10px; position: fixed; z-index: 71; overflow-y: auto; padding: 4px; box-sizing: border-box; scrollbar-width: thin; }
  html body .document-window-dock-stack[hidden] { display: none; }
  html body .document-window-dock:not([hidden]) { display: flex; position: relative; width: 100%; min-height: 50px; height: 50px; flex: 0 0 50px; align-items: center; gap: 0; padding: 0 6px 0 0; border: 1px solid #345581; border-radius: 16px; background: linear-gradient(145deg,#203f6b,#081b39); color: #fff; -webkit-text-fill-color: #fff; box-shadow: 0 8px 24px #0005, inset 0 1px 0 #ffffff24; cursor: pointer; text-align: left; }
  html body .document-window-restore { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; align-self: stretch; padding: 0 6px 0 12px; border: 0; border-radius: 0; background: transparent; color: #fff; -webkit-text-fill-color: #fff; box-shadow: none; font: inherit; font-size: var(--text-sm,14px); cursor: pointer; text-align: left; }
  html body .document-window-restore > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  html body .document-window-dismiss { display: grid; place-items: center; width: 32px; height: 32px; min-width: 32px; flex: 0 0 32px; align-self: center; padding: 0; border: 0; border-radius: 0; background: transparent; color: #fff; -webkit-text-fill-color: #fff; box-shadow: none; cursor: pointer; }
  html body .document-window-dismiss-symbol { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; }
  html body :is(.document-window-restore,.document-window-dismiss):focus-visible { outline: 2px solid #fff; outline-offset: -3px; }
  html body .document-window-symbol { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; flex: 0 0 auto; }
  html body .document-window-dock:focus-visible { outline: 3px solid #6ac5ff; outline-offset: 3px; }
}
.desktop-swipe-toggle { display: none; }
@media (min-width: 1024px) {
  html body .desktop-swipe-surface { padding-inline-end: 64px !important; }
  html body .desktop-swipe-toggle {
    position: absolute; z-index: 5; right: 10px; top: 50%;
    display: inline-grid; place-items: center;
    width: 44px; min-width: 44px; height: 44px; min-height: 44px;
    margin: 0; padding: 0; border: 0; border-radius: 12px;
    background: transparent !important; border: 0 !important; box-shadow: none !important;
    color: var(--text, #f5f7fb);
    cursor: pointer; transform: translateY(-50%);
    transition: transform .22s cubic-bezier(.22,.78,.25,1);
  }
  html body .open > .desktop-swipe-toggle { transform: translate(calc(-1 * var(--desktop-swipe-width, 0px)), -50%); }
  html body .desktop-swipe-toggle:focus-visible { outline: 2px solid currentColor; outline-offset: -2px; }
  html body .desktop-swipe-toggle .ui-icon { width: calc(20px * var(--ui-icon-scale,1)); height: calc(20px * var(--ui-icon-scale,1)); transition: transform .22s ease; }
  html body .open > .desktop-swipe-toggle .ui-icon { transform: rotate(180deg); }
}
@media (prefers-reduced-motion: reduce) { html body .desktop-swipe-toggle, html body .desktop-swipe-toggle .ui-icon { transition: none; } }

/* Desktop Word document: shared variant 4, only the folded corner changes. */
body.home-route [data-home-card="document-builder"] .home-card-word-art {
  display: none;
  --home-art-field-right: .145833333;
  --home-art-field-bottom: .098958333;
}
html[data-theme="exclusive"] body.home-route [data-home-card="document-builder"] .word-v4-exclusive,
html[data-theme="dark"] body.home-route [data-home-card="document-builder"] .word-v4-dark,
html[data-theme="light"] body.home-route [data-home-card="document-builder"] .word-v4-light { display: block; }

/* Share the leading navigation Add accent; keep SVG paint independent of
   the generic light-theme icon gradient. */
html[data-theme="exclusive"] { --desktop-swipe-color: #52f3b7; }
html[data-theme="dark"] { --desktop-swipe-color: var(--iq-top, #8a29fa); }
html[data-theme="light"] { --desktop-swipe-color: #36dfad; }
html[data-theme] body .desktop-swipe-toggle,
html[data-theme] body .desktop-swipe-toggle > svg.ui-icon {
  color: var(--desktop-swipe-color) !important;
  stroke: var(--desktop-swipe-color) !important;
}

/* An opened case fills the center between the main navigation and assistant. */
@media (min-width: 1024px) {
  body.case-route,
  body.case-route.desktop-assistant-panel-open.desktop-assistant-hidden {
    --desk-content-max: var(--desk-main-width);
  }
}

/* Center against the full card, including readiness/actions below the title. */
@media (min-width: 1024px) {
  /* A pressed grid must not re-anchor its absolute icon and edit button. */
  html body.case-route #app .doc-library .document-library-row:active {
    transform: none;
  }
  html body.case-route #app .doc-library .document-library-row > .document-card-edit {
    position: absolute;
    top: 50%;
    right: 64px;
    transform: translateY(-50%);
  }
  html body.case-route #app .doc-library .document-library-row > .doc-icon {
    position: absolute;
    top: 50%;
    left: var(--space-4, 12px);
    margin: 0;
    transform: translateY(-50%);
  }
  html body.case-route #app .doc-library .document-library-row > div {
    grid-column: 2;
  }
}

/* Only the inner document glyph changes paint; the icon tile stays intact. */
html[data-theme="exclusive"] body.case-route #app .doc-library { --case-document-glyph: #52f3b7; }
html[data-theme="light"] body.case-route #app .doc-library { --case-document-glyph: #36dfad; }
html:is([data-theme="exclusive"], [data-theme="light"]) body.case-route #app .doc-library .doc-icon > svg.ui-icon {
  color: var(--case-document-glyph) !important;
  stroke: currentColor !important;
}

/* Discussion cards already have a separate Desktop action-menu arrow. */
@media (min-width: 1024px) {
  html body #app .discussion-swipe-row > .history-item.desktop-swipe-surface > b[aria-hidden] { display: none !important; }
  html body #app .discussion-history .history-item[data-assistant-history-index] { grid-template-columns: minmax(0, 1fr) !important; }
  html body #app #caseDiscussionPreview .case-discussion-preview[data-case-dialog] { grid-template-columns: 42px minmax(0, 1fr) !important; }
}

/* Compact image editor; the image itself is the sole action trigger. */
html body #app .case-client-photo-editor { display: flex; width: 100px; height: 100px; padding: 0; gap: 0; box-sizing: border-box; justify-self: start; align-items: center; justify-content: center; }
html body #app #caseClientAvatarInput[hidden] { display: none !important; }
html body #app button.case-client-avatar { flex: 0 0 72px; width: 72px; height: 72px; margin: 0; padding: 0; border: 0; background: transparent; box-shadow: none; cursor: pointer; transition: transform 160ms ease; }
@media (min-width: 1024px) and (hover: hover) and (pointer: fine) {
  html body #app button.case-client-avatar:hover { transform: scale(1.06); box-shadow: none; outline: none; }
  html body #app button.case-client-avatar:active { transform: scale(.98); }
}
@media (prefers-reduced-motion: reduce) {
  html body #app button.case-client-avatar { transition: none; }
}
html body #app button.case-client-avatar:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
html body #app .case-client-avatar .case-image-default { object-fit: contain; }
.case-image-menu { display: grid; gap: 12px; }

/* A narrow sheet with equally sized actions, independent of generic danger decoration. */
html body #sheetRoot .sheet.case-image-menu { width: min(312px,calc(100vw - 24px)) !important; max-width: 312px; min-width: 0; padding: 16px; box-sizing: border-box; }
html body #sheetRoot .case-image-menu-head { display: grid; grid-template-columns: minmax(0,1fr) 36px; gap: 12px; align-items: center; }
html body #sheetRoot .case-image-menu-head h2 { margin: 0; }
html body #sheetRoot .case-image-menu-close {
  display: grid; place-items: center; width: 36px; min-width: 36px; height: 36px; min-height: 36px;
  margin: 0; padding: 0; border: 1px solid #fff !important; border-radius: 50%;
  background: #000 !important; background-image: none !important; color: #fff !important; box-shadow: none;
}
html body #sheetRoot .case-image-menu-close svg.ui-icon { width: 18px; height: 18px; color: #fff !important; stroke: #fff !important; }
html body #sheetRoot .case-image-menu-actions { display: grid; justify-items: center; gap: 12px; }
html body #sheetRoot .case-image-menu-actions > button {
  display: flex; justify-content: center; align-items: center; width: 100% !important; height: 44px; min-height: 44px;
  margin: 0; padding: 12px 16px; box-sizing: border-box; text-align: center; white-space: nowrap; border: 1px solid transparent; border-radius: 14px;
  font-size: var(--text-sm,14px); line-height: 1.25;
}
html body #sheetRoot .case-image-menu-actions > [data-case-image-remove] {
  white-space: nowrap; background: linear-gradient(180deg,#8a29fa 0%,#6726e1 35%,#471ac0 70%,#330a9e 100%) !important;
  border: 1px solid transparent !important; background-origin: border-box !important; background-repeat: no-repeat !important; box-shadow: none !important; text-decoration: none !important; color: #fff !important; -webkit-text-fill-color: #fff !important;
}
html body #sheetRoot .case-image-menu button:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }

/* Pin actions use the same creation paint as the navigation Add button. */
html[data-theme="exclusive"]:not(#pin-paint-reserve):not(#pin-paint-reserve) body :is(#app,#sheetRoot,#desktopAssistantPanel) button.case-action.pin {
  background: var(--creation-button-fill) !important;
  background-origin: border-box !important;
  background-repeat: no-repeat !important;
  border-color: transparent !important;
  color: #fff !important;
  -webkit-text-fill-color: #fff !important;
  box-shadow: var(--creation-button-shadow) !important;
}

/* Archive actions share the same white/navy paint on touch and Desktop. */
html[data-theme="exclusive"]:not(#archive-paint-reserve):not(#archive-paint-reserve) body :is(#app,#sheetRoot,#desktopAssistantPanel) button:is(.case-action.archive,[data-case-action="archive"]) {
  background: #fff !important;
  border-color: #fff !important;
  color: #031743 !important;
  -webkit-text-fill-color: currentColor !important;
  box-shadow: 0 4px 12px rgba(0,5,29,.18) !important;
}
html[data-theme="exclusive"]:not(#archive-paint-reserve):not(#archive-paint-reserve) body :is(#app,#sheetRoot,#desktopAssistantPanel) button:is(.case-action.archive,[data-case-action="archive"]) :is(span,small,svg) {
  color: inherit !important;
  -webkit-text-fill-color: currentColor !important;
}
html[data-theme="exclusive"]:not(#archive-paint-reserve):not(#archive-paint-reserve) body :is(#app,#sheetRoot,#desktopAssistantPanel) button:is(.case-action.archive,[data-case-action="archive"]) .case-archive-icon {
  background: currentColor !important;
}
html[data-theme="exclusive"]:not(#archive-paint-reserve):not(#archive-paint-reserve) body :is(#app,#sheetRoot,#desktopAssistantPanel) button:is(.case-action.archive,[data-case-action="archive"]) svg {
  stroke: currentColor !important;
}

/* A clear glass control above the assistant composer; timeline keeps its paint. */
html:not(#chat-scroll-glass):not(#chat-scroll-glass):not(#chat-scroll-glass) body :is(#app,#desktopAssistantPanel) button.chat-scroll-down:not(.timeline-scroll-down) {
  background: rgba(255,255,255,.08) !important;
  border-color: rgba(255,255,255,.30) !important;
  color: var(--text) !important;
  -webkit-text-fill-color: currentColor !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.24),0 5px 18px rgba(0,0,0,.16) !important;
  backdrop-filter: blur(16px) saturate(115%);
  -webkit-backdrop-filter: blur(16px) saturate(115%);
}
html[data-theme="light"]:not(#chat-scroll-glass):not(#chat-scroll-glass):not(#chat-scroll-glass) body :is(#app,#desktopAssistantPanel) button.chat-scroll-down:not(.timeline-scroll-down) {
  background: rgba(255,255,255,.24) !important;
  border-color: rgba(80,90,100,.18) !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.75),0 5px 18px rgba(0,0,0,.10) !important;
}

/* Reference close control: black circle, white rim and cross in all themes. */
html body :is(#app,#sheetRoot) .reference-dismiss,
html body #sheetRoot #billingDialog .reference-dismiss {
  display: grid; place-items: center; flex: none;
  width: 36px; min-width: 36px; height: 36px; min-height: 36px;
  padding: 0; margin: 0; border: 1.5px solid #fff !important; border-radius: 50% !important;
  background: #000 !important; background-image: none !important; color: #fff !important;
  box-shadow: none; cursor: pointer;
}
html body :is(#app,#sheetRoot) .reference-dismiss svg.ui-icon {
  width: 24px; height: 24px; margin: 0; background: none !important;
  color: #fff !important; stroke: #fff !important; stroke-width: 3;
}
html body :is(#app,#sheetRoot) .reference-dismiss:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
html body :is(#app,#sheetRoot) .reference-dismiss:disabled { opacity: .6; cursor: wait; }

/* Case filters float on the page; button shadows must not form a shared strip. */
html[data-theme]:not(#case-filter-paint):not(#case-filter-paint):not(#case-filter-paint) body.cases-route #app > .chips {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
html[data-theme]:not(#case-filter-paint):not(#case-filter-paint):not(#case-filter-paint) body.cases-route #app > .chips > .filter-token:not(.holding):not(.dragging) {
  box-shadow: none !important;
}

/* Fixed card height with an intrinsically sized, vertically centered text group. */
html body.cases-route #app #caseList > .case-swipe-row > .case-card {
  box-sizing: border-box;
  padding-top: 6px !important;
  padding-bottom: 6px !important;
  height: max(104px, calc(108px * var(--ui-font-scale, 1)));
  min-height: max(104px, calc(108px * var(--ui-font-scale, 1)));
  display: flex;
  align-items: center;
}
html body.cases-route #app #caseList .case-preview-layout { width: 100%; min-width: 0; }
html body.cases-route #app #caseList .case-preview-main {
  display: grid;
  grid-template-rows: none;
  grid-auto-rows: max-content;
  gap: 2px;
  min-width: 0;
}
html body.cases-route #app #caseList .case-preview-meta {
  margin: 0;
  align-items: center;
  overflow: hidden;
}
html body.cases-route #app #caseList .case-kind-badge { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
html body.cases-route #app #caseList :is(.case-preview-title, .case-preview-details) {
  margin: 0 !important;
  min-width: 0;
  overflow: hidden;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}
html body.cases-route #app #caseList .case-preview-title { line-height: 1.1; }
html body.cases-route #app #caseList :is(.case-preview-details, .case-preview-client) { line-height: 1.15; }

/* The category belongs to the icon column, leaving title and client together. */
html body :is(#app #caseList, #sheetRoot .plan-case-list) .case-preview-visual {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 2px;
  min-width: 0;
}
html body :is(#app #caseList, #sheetRoot .plan-case-list) .case-preview-visual .case-preview-avatar {
  width: 64px;
  height: 64px;
  min-width: 64px;
  justify-self: center;
}
html body :is(#app #caseList, #sheetRoot .plan-case-list) .case-preview-visual .case-preview-meta {
  position: static;
  /* The pin is on the card edge; its old reserved space must not offset the caption. */
  padding-inline: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  min-width: 0;
  width: calc(100% + 12px);
  max-width: calc(100% + 12px);
  justify-self: center;
  margin: 0 !important;
}
html body :is(#app #caseList, #sheetRoot .plan-case-list) .case-preview-visual .case-kind-badge {
  max-width: 100%;
  padding: 2px;
  font-size: calc(10px * var(--ui-font-scale, 1));
  line-height: 1.1;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: center;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}
html body :is(#app #caseList, #sheetRoot .plan-case-list) .case-preview-visual img.case-type-corner {
  right: 0;
  bottom: 0;
  width: 34%;
  height: 34%;
}

/* Cases keep a centered reading width while filters use the full workspace. */
@media (min-width: 1024px) {
  html body.cases-route { --desk-main-edge: var(--desk-gutter); }
  html body.cases-route #app > :is(.cases-page-head, .search) {
    width: 100%;
    max-width: 560px;
    margin-inline: auto;
  }
  html body.cases-route #app > .chips {
    justify-content: space-between;
    /* Scroll to the workspace edge, rather than disappearing inside its 40px gutter. */
    width: calc(100% + 2 * var(--desk-main-edge));
    margin-inline: calc(-1 * var(--desk-main-edge));
    padding-inline: var(--desk-float-gap);
    max-width: none;
    box-sizing: border-box;
  }
  html body.cases-route #app #caseList {
    width: 100%;
    max-width: 560px;
    margin-inline: auto;
    grid-template-columns: minmax(0, 1fr) !important;
    align-items: stretch;
  }
  html body.cases-route #app #caseList > .case-swipe-row {
    width: 100%;
    max-width: 560px;
    justify-self: center;
  }
}

/* Expanded Upload Center actions fit their labels rather than stretching across the card. */
html body #app .material-job-card .material-job-details .material-job-actions > button {
  box-sizing: border-box;
  justify-self: center;
  width: fit-content !important;
  min-width: 0 !important;
  max-width: 100%;
  padding: 10px 40px !important;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* Desktop chat jump control is only visible while the user scrolls. */
@media (min-width: 1024px) {
  html body :is(#app,#desktopAssistantPanel) > .chat-scroll-down {
    opacity: 0 !important;
    pointer-events: none !important;
  }
  html body :is(#app,#desktopAssistantPanel) > .chat-scroll-down.visible {
    opacity: 1 !important;
    pointer-events: auto !important;
  }
  html[data-theme="exclusive"]:not(#chat-scroll-paint):not(#chat-scroll-paint):not(#chat-scroll-paint) body :is(#app,#desktopAssistantPanel) > .chat-scroll-down {
    background: rgba(72,247,184,.3) !important;
    border-color: rgba(72,247,184,.3) !important;
    box-shadow: none !important;
  }
}

/* The desktop conversation continues behind the floating input, without a footer strip. */
@media (min-width: 1024px) {
  html body .app-shell > #desktopAssistantPanel { padding-bottom: 0; }
  html body #desktopAssistantPanel > #messages.assistant-thread {
    padding-bottom: var(--assistant-floating-footer-height, 96px);
    scroll-padding-bottom: var(--assistant-floating-footer-height, 96px);
  }
  html body #desktopAssistantPanel > .assistant-compose.chat-box {
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: 18px;
    width: auto;
    max-width: none;
    margin: 0;
    z-index: 3;
  }
  html body #desktopAssistantPanel > .assistant-attachment-tray {
    position: absolute;
    left: 18px;
    right: 18px;
    bottom: calc(var(--assistant-floating-composer-height, 60px) + 26px);
    width: auto;
    max-height: 30%;
    overflow-y: auto;
    z-index: 3;
  }
  html body.desktop-assistant-expanded #desktopAssistantPanel > :is(.assistant-compose.chat-box,.assistant-attachment-tray) {
    width: min(calc(100% - 36px), 1280px);
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }
}

/* My Cases: share the free space between the text and the actions control. */
@media (min-width: 1024px) {
  html body.cases-route #app #caseList > .case-swipe-row > .case-card:has(.case-card-pin-mark) {
    display: grid;
    --case-pin-slot-floor: 44px;
    grid-template-columns: 84px minmax(0, max-content) minmax(var(--case-pin-slot-floor), 1fr);
    padding-inline-end: 42px !important;
  }
  html body.cases-route #app #caseList .case-card:has(.case-card-pin-mark) > .case-preview-layout {
    display: contents;
  }
  html body.cases-route #app #caseList .case-card:has(.case-card-pin-mark) .case-preview-visual {
    grid-column: 1;
    grid-row: 1;
  }
  html body.cases-route #app #caseList .case-card:has(.case-card-pin-mark) .case-preview-main {
    grid-column: 2;
    grid-row: 1;
    margin-inline-start: var(--space-5, 16px);
  }
  html body.cases-route #app #caseList .case-card > .case-card-pin-mark {
    position: static;
    grid-column: 3;
    grid-row: 1;
    justify-self: center;
    align-self: center;
    transform: none;
  }
  html body.cases-route #app #caseList .case-card:has(.case-card-pin-mark) .case-preview-meta {
    padding-inline-end: 0;
  }
  html body.cases-route #app #caseList > .rich-empty {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    justify-self: stretch;
  }
  html body.cases-route #app #caseList > .rich-empty > :is(h3,p) {
    max-width: 100%;
    overflow-wrap: anywhere;
  }
}

/* Card navigation/disclosure chevrons share the existing case-action arrow.
   Page navigation, month switching and scroll controls retain their own semantics. */
html[data-theme] body :is(#app, #sheetRoot, #desktopAssistantPanel) svg.ui-icon:has(> use:is([href$="#forward"], [href$="#down"])):not(.page-head *, .month-switch *, [data-calendar-month] *, .calendar-month-menu *, .chat-scroll-down *, .timeline-scroll-down *, .analytics-scroll-down *, .scanner-head *, [data-scanner-move-down] *) {
  width: calc(20px * var(--ui-icon-scale,1)) !important;
  height: calc(20px * var(--ui-icon-scale,1)) !important;
  min-width: calc(20px * var(--ui-icon-scale,1));
  flex-shrink: 0;
  color: var(--desktop-swipe-color) !important;
  stroke: var(--desktop-swipe-color) !important;
  fill: none !important;
}
html body :is(#app, #sheetRoot, #desktopAssistantPanel) .card-chevron-slot {
  display: inline-flex; align-items: center; justify-content: center;
  width: calc(20px * var(--ui-icon-scale,1));
  min-width: calc(20px * var(--ui-icon-scale,1));
  height: calc(20px * var(--ui-icon-scale,1));
  flex: 0 0 auto; justify-self: end; align-self: center;
  line-height: 1;
}
html body :is(#app, #sheetRoot) :is(.menu-row, .sheet > button):has(> .card-chevron-slot) {
  grid-template-columns: max-content minmax(0,1fr) calc(20px * var(--ui-icon-scale,1));
}
html[data-theme] body #app .material-job-chevron {
  width: calc(20px * var(--ui-icon-scale,1)); height: calc(20px * var(--ui-icon-scale,1));
  min-width: calc(20px * var(--ui-icon-scale,1));
  border: 0; color: var(--desktop-swipe-color); background: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center/contain no-repeat;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center/contain no-repeat;
  transform: rotate(0deg);
}
html[data-theme] body #app .material-job-card.expanded .material-job-chevron { transform: rotate(180deg); }

/* A card's trailing arrow is reserved for an existing swipe-action menu.
   Navigation and form controls keep their own arrows; cards still open on click. */
html body :is(#app, #sheetRoot, #desktopAssistantPanel) :is(
  .card-chevron-slot, .material-job-chevron, .upload-history-chevron:not(.is-unavailable),
  svg.ui-icon:has(> use[href$="#forward"])
):not(
  [data-card-swipe-menu] *, .desktop-swipe-toggle *,
  .page-head *, .month-switch *, [data-calendar-month] *, .calendar-month-menu *,
  .calendar-form-row *, .plan-field *, .scanner-head *, [data-scanner-move-down] *
) { display: none !important; }
html body :is(#app, #sheetRoot) .document-parts summary::after { content: none !important; }
html body :is(#app, #sheetRoot, #desktopAssistantPanel) [data-card-swipe-menu] :is(
  .card-chevron-slot, .material-job-chevron, .upload-history-chevron:not(.is-unavailable),
  svg.ui-icon:has(> use[href$="#forward"])
):not(.desktop-swipe-toggle *) { display:none!important; }
html body #sheetRoot .calendar-search-result {
  grid-template-columns: var(--calendar-result-date-width, 100px) 3px minmax(0, 1fr) max-content;
}
html body #sheetRoot .calendar-search-result > button {
  width: auto; min-width: 44px; padding-inline: 8px;
  font-size: calc(13px * var(--ui-font-scale, 1));
}
@media(max-width:380px){html body #sheetRoot .calendar-search-result{--calendar-result-date-width:82px}}

/* The exclusive palette uses the same green gradient as its navigation Add button. */
@media (min-width: 1024px) {
  html[data-theme="exclusive"] body .app-shell > .desktop-assistant-panel > .desktop-assistant-resizer::after {
    background: var(--creation-button-fill);
  }
}

/* Header notifications float directly on the page/header surface. */
html[data-theme]:not(#header-bell-surface):not(#header-bell-surface):not(#header-bell-surface) body #app .home-header button.bell,
html[data-theme]:not(#header-bell-surface):not(#header-bell-surface):not(#header-bell-surface) body > .desktop-topbar button.desktop-topbar-bell {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}
html[data-theme]:not(#header-bell-surface):not(#header-bell-surface):not(#header-bell-surface) body #app .home-header button.bell::before,
html[data-theme]:not(#header-bell-surface):not(#header-bell-surface):not(#header-bell-surface) body #app .home-header button.bell::after,
html[data-theme]:not(#header-bell-surface):not(#header-bell-surface):not(#header-bell-surface) body > .desktop-topbar button.desktop-topbar-bell::before,
html[data-theme]:not(#header-bell-surface):not(#header-bell-surface):not(#header-bell-surface) body > .desktop-topbar button.desktop-topbar-bell::after {
  content: none !important;
}
html[data-theme]:not(#header-bell-surface):not(#header-bell-surface):not(#header-bell-surface) body #app .home-header button.bell:focus-visible,
html[data-theme]:not(#header-bell-surface):not(#header-bell-surface):not(#header-bell-surface) body > .desktop-topbar button.desktop-topbar-bell:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* Desktop category controls use the same click affordance as navigation. */
@media (min-width: 1024px) {
  .home-draggable-card:not(.home-card-dragging),
  .filter-token:not(.dragging),
  .filter-token:not(.dragging) .chip,
  .case-tabs button:not(.case-tab-dragging) { cursor: pointer; }
}

/* Mobile chat shares the floating composer while retaining visual-viewport sizing. */
@media (max-width: 1023px) {
  html body:is(.global-chat-route,.assistant-chat-route) #app {
    position: relative;
    padding-bottom: 0 !important;
  }
  html body:is(.global-chat-route,.assistant-chat-route) #app > #messages.assistant-thread {
    padding-bottom: var(--assistant-floating-footer-height, 110px);
    scroll-padding-bottom: var(--assistant-floating-footer-height, 110px);
  }
  html body:is(.global-chat-route,.assistant-chat-route) #app > .assistant-compose.chat-box {
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: max(10px, env(safe-area-inset-bottom));
    width: auto;
    max-width: none;
    margin: 0;
    transform: none;
    z-index: 3;
  }
  html body:is(.global-chat-route,.assistant-chat-route).chat-keyboard-open #app > .assistant-compose.chat-box {
    bottom: 10px;
  }
  html body:is(.global-chat-route,.assistant-chat-route) #app > .assistant-attachment-tray {
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: calc(var(--assistant-floating-composer-height, 60px) + max(10px, env(safe-area-inset-bottom)) + 8px);
    width: auto;
    max-height: 30%;
    overflow-y: auto;
    z-index: 3;
  }
  html body:is(.global-chat-route,.assistant-chat-route).chat-keyboard-open #app > .assistant-attachment-tray {
    bottom: calc(var(--assistant-floating-composer-height, 60px) + 18px);
  }
}

@media (min-width: 1024px) {
  /* Both floating panels share one outer vertical frame on every route.
     --desk-height also follows the expanded Desktop scene at browser zoom. */
  html body .app-shell > nav.tabbar,
  html body .app-shell > #desktopAssistantPanel {
    --desk-floating-height: calc(var(--desk-height) - var(--desk-float-gap));
    padding-top: 22px !important;
    box-sizing: border-box;
    top: var(--desk-top);
    bottom: var(--desk-float-gap);
    height: var(--desk-floating-height) !important;
    min-height: 0;
    max-height: var(--desk-floating-height);
    margin-block: 0;
  }

}

/* One viewport canvas for every Desktop section header, including while resizing.
   Keep the opaque mask above sticky headers so scrolled content stays hidden. */
@media (min-width: 1024px) {
  html[data-theme]:not(#desktop-section-canvas):not(#desktop-section-mask) body #app > :is(.page-head,.case-sticky-head),
  html[data-theme]:not(#desktop-section-canvas):not(#desktop-section-mask) body #app > :is(.page-head,.case-sticky-head)::before {
    background-color: var(--system-surface-color) !important;
    background-image: var(--system-surface-background) !important;
    background-size: 100vw 100dvh !important;
    background-repeat: no-repeat !important;
    background-origin: border-box !important;
    background-attachment: scroll !important;
    background-position: var(--section-canvas-x, 0px) var(--section-canvas-y, 0px) !important;
  }
  html[data-theme]:not(#desktop-section-canvas):not(#desktop-section-mask) body #app > :is(.page-head,.case-sticky-head)::before {
    bottom: calc(100% + var(--section-canvas-top-border, 0px));
    background-position: var(--section-canvas-x, 0px) calc(100dvh + var(--section-canvas-y, 0px)) !important;
  }
}


/* Вложения помощника внутри строки ввода (13.11.2026): миниатюры над текстом, поле растёт вверх. */
html body .assistant-compose.has-attachments.chat-box { border-radius: 22px; row-gap: 6px; }
html body .assistant-compose > .assistant-compose-files { grid-column: 1 / -1; grid-row: 1; display: grid; gap: 4px; min-width: 0; padding: 2px 2px 0; position: static; inset: auto; max-height: none; overflow: visible; }
.assistant-compose-files-row { display: flex; gap: 8px; overflow-x: auto; overflow-y: hidden; padding: 6px 2px 4px; scrollbar-width: thin; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
.assistant-compose-file { position: relative; flex: 0 0 64px; width: 64px; height: 64px; border-radius: 12px; overflow: hidden; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); display: grid; place-items: center; }
.assistant-compose-file > img { width: 100%; height: 100%; object-fit: cover; display: block; }
.assistant-compose-file-type { font-size: calc(11px * var(--ui-font-scale, 1)); font-weight: 800; letter-spacing: .02em; color: var(--text); opacity: .85; padding-bottom: 12px; }
.assistant-compose-file-name { position: absolute; left: 0; right: 0; bottom: 0; padding: 2px 4px; font-size: calc(8.5px * var(--ui-font-scale, 1)); line-height: 1.2; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.62)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.assistant-compose-file-progress { position: absolute; inset: 0; background: rgba(8,14,26,.55); display: grid; place-items: center; }
.assistant-compose-file-progress::after { content: ""; width: 26px; height: 26px; border-radius: 50%; background: conic-gradient(#fff var(--assistant-file-progress, 0%), rgba(255,255,255,.22) 0); -webkit-mask: radial-gradient(circle, transparent 9px, #000 9.5px); mask: radial-gradient(circle, transparent 9px, #000 9.5px); }
.assistant-compose-file.is-queued .assistant-compose-file-progress::after { opacity: .5; }
/* 13.11.2026: кольцо загрузки вложения плавно заполняется по кругу; сомкнулось — файл загружен, кольцо гаснет. */
@property --assistant-file-progress { syntax: '<percentage>'; inherits: true; initial-value: 0%; }
.assistant-compose-file { transition: --assistant-file-progress .35s linear; }
.assistant-compose-file.is-ready .assistant-compose-file-progress { opacity: 0; pointer-events: none; transition: opacity .25s ease .35s; }
@media (prefers-reduced-motion: reduce) { .assistant-compose-file, .assistant-compose-file.is-ready .assistant-compose-file-progress { transition: none; } }
.assistant-compose-file.is-error, .assistant-compose-file.is-cleanup-error { border-color: rgba(255, 99, 99, .75); }
.assistant-compose-file-alert { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(120, 20, 20, .55); color: #fff; font-weight: 900; font-size: 20px; }
html body .assistant-compose-file-remove { position: absolute; top: 0; right: 0; width: 44px; height: 44px; margin: 0; padding: 3px; border: 0; border-radius: 0; display: flex; align-items: flex-start; justify-content: flex-end; background: none; box-shadow: none; cursor: pointer; z-index: 1; }
.assistant-compose-file-remove > span { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: rgba(0,0,0,.66); color: #fff; line-height: 1; }
.assistant-compose-file-remove > span svg { width: 13px; height: 13px; }
.assistant-compose-files-count { padding: 0 4px; font-size: calc(10px * var(--ui-font-scale, 1)); color: var(--muted, #8a9ab0); }
html[data-theme="light"] .assistant-compose-file { background: rgba(0,0,0,.05); border-color: rgba(0,0,0,.12); }

/* Неотправленный черновик помощника в строке «Задать вопрос» на главной (13.11.2026). */
html body .home-ai-search > .home-chat-entry.has-draft { display: flex; align-items: center; gap: 8px; color: var(--text); }
html body .home-ai-search > .home-chat-entry.has-draft > span { flex: 1 1 auto; min-width: 0; }
.home-chat-draft-files { flex: none; display: inline-flex; align-items: center; gap: 3px; padding: 3px 8px; border-radius: 999px; background: rgba(255,255,255,.1); font-size: calc(12px * var(--ui-font-scale, 1)); font-weight: 750; color: var(--text); }
.home-chat-draft-files svg { width: 13px; height: 13px; }

/* Editing pencils share one paint across all screens; hit areas stay intact. */
html[data-theme="exclusive"] { --edit-pencil-color: #52f3b7; }
html[data-theme="dark"] { --edit-pencil-color: #8a29fa; }
html[data-theme="light"] { --edit-pencil-color: #36dfad; }
html[data-theme] body :is(#app, #sheetRoot, #desktopAssistantPanel) button:is(
  .summary-edit, .plan-task-edit, .scanner-session-rename, .task-edit-action,
  :has(svg.ui-icon > use[href$="#edit"])
):not(#iq-theme-button-paint-override):not(#iq-theme-button-paint-override) {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  color: var(--edit-pencil-color) !important;
  -webkit-text-fill-color: var(--edit-pencil-color) !important;
}
html[data-theme] body :is(#app, #sheetRoot, #desktopAssistantPanel) button:is(
  .summary-edit, .plan-task-edit, .scanner-session-rename, .task-edit-action,
  :has(svg.ui-icon > use[href$="#edit"])
):not(#iq-theme-button-paint-override):not(#iq-theme-button-paint-override) :is(span, svg, use) {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  color: var(--edit-pencil-color) !important;
  -webkit-text-fill-color: var(--edit-pencil-color) !important;
  stroke: var(--edit-pencil-color) !important;
}
html[data-theme] body :is(#app, #sheetRoot, #desktopAssistantPanel) button:is(
  .summary-edit, .plan-task-edit, .scanner-session-rename, .task-edit-action,
  :has(svg.ui-icon > use[href$="#edit"])
):not(#iq-theme-button-paint-override):not(#iq-theme-button-paint-override)::before,
html[data-theme] body :is(#app, #sheetRoot, #desktopAssistantPanel) button:is(
  .summary-edit, .plan-task-edit, .scanner-session-rename, .task-edit-action,
  :has(svg.ui-icon > use[href$="#edit"])
):not(#iq-theme-button-paint-override):not(#iq-theme-button-paint-override)::after { content: none !important; }
