@media (min-width: 1101px) {
  #app .profile-grading-control { display: none; }
  #app .customer-grading-panel { margin: 0 2px; }
  #app .customer-grading-dimensions { grid-template-columns: minmax(0, 1fr); }

  :root {
    --reference-green: #00a968;
    --reference-green-dark: #008b57;
    --reference-green-soft: #eefaf5;
    --reference-blue: #2f6bff;
    --reference-blue-soft: #f1f5ff;
    --reference-border: #dfe6e2;
    --reference-text: #17221d;
    --reference-muted: #6d7973;
  }

  html,
  html body {
    height: 100%;
    min-height: 0;
    overflow: hidden; /* desktop-viewport-boundary */
  }

  body {
    background: #f4f7f5;
    color: var(--reference-text);
  }

  .page-atmosphere,
  .mobile-mode-tabs {
    display: none;
  }

  #workspace-shell:not([hidden]) {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
  }

  #workspace-shell > .app-header {
    flex: 0 0 56px;
    align-items: center;
    width: 100%;
    max-width: none;
    min-height: 56px;
    margin: 0;
    padding: 0 20px;
    border-bottom: 1px solid var(--reference-border);
    background: #ffffff;
    box-shadow: 0 1px 8px rgb(26 62 43 / 5%);
  }

  .product-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
  }

  .product-brand .eyebrow {
    display: none;
  }

  .product-brand h1 {
    margin: 0;
    color: #17241e;
    font-size: 25px;
    font-weight: 760;
    letter-spacing: 0.02em;
    white-space: nowrap;
  }

  .product-badge {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 12px;
    border: 1px solid #9dd7bd;
    border-radius: 999px;
    background: #f5fcf8;
    color: var(--sales-blue-700);
    font-size: 12px;
    font-weight: 650;
    white-space: nowrap;
  }

  #workspace-shell > #app.simulator-shell {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: minmax(300px, 0.82fr) minmax(540px, 1.28fr) minmax(390px, 1fr);
    gap: 8px;
    width: 100%;
    max-width: none;
    min-height: 0;
    margin: 0;
    padding: 8px 12px 12px;
    overflow: hidden;
  }

  #app > [data-desktop-panel] {
    width: auto;
    height: 100%;
    min-width: 0;
    min-height: 0;
    margin: 0;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 4px 16px rgb(30 70 49 / 6%);
    overflow: hidden;
  }

  #app > .client-zone {
    display: flex;
    flex-direction: column;
    border: 0;
  }

  #app > .sales-zone {
    display: flex;
    flex-direction: column;
    border: 0;
  }

  #app > .intelligence-zone {
    display: grid;
    grid-template-rows: 48px 44px minmax(0, 1fr);
    border: 0;
  }

  #app .zone-header {
    flex: 0 0 48px;
    min-height: 48px;
    padding: 0 14px;
    border: 0;
    border-bottom: 1px solid var(--reference-border);
    border-radius: 0;
    box-shadow: none;
  }

  #app .client-zone > .zone-header {
    background: linear-gradient(90deg, var(--reference-green-soft), #ffffff 78%);
  }

  #app .ai-zone-header {
    background: linear-gradient(90deg, var(--sales-blue-50), #ffffff 78%);
  }

  #app .ai-zone-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  #app .coach-settings-button {
    width: 29px;
    min-width: 29px;
    height: 29px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--sales-blue-700);
    background: transparent;
  }

  #app .coach-settings-button:hover,
  #app .coach-settings-button:focus-visible {
    border-color: var(--sales-blue-400);
    color: #ffffff;
    background: var(--sales-blue-gradient);
  }

  #app .sales-zone > .zone-header {
    background: #2f80ed;
    color: #ffffff;
  }

  #app .zone-header > div {
    display: flex;
    align-items: center;
    gap: 8px;
  }

  #app .zone-kicker {
    display: none;
  }

  #app .zone-header h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 730;
    letter-spacing: 0;
  }

  .panel-brand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 25px;
    height: 25px;
    border: 1px solid var(--sales-blue-300);
    border-radius: 7px;
    background: var(--sales-blue-50);
    color: var(--sales-blue-700);
    font-size: 10px;
    font-weight: 800;
  }

  .client-zone .connection-state,
  .sales-zone .account-pill {
    min-height: 24px;
    padding: 0 9px;
    border-radius: 999px;
    font-size: 11px;
  }

  #app .sales-zone .account-tabs {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }

  #app .sales-zone .account-tabs::-webkit-scrollbar {
    display: none;
  }

  #app .sales-zone .account-switch-button {
    flex: 0 0 auto;
    min-height: 28px;
    padding: 0 10px;
    border: 1px solid rgb(255 255 255 / 45%);
    border-radius: 999px;
    background: rgb(255 255 255 / 12%);
    color: rgb(255 255 255 / 85%);
    font: inherit;
    font-size: 11px;
    font-weight: 650;
    cursor: pointer;
  }

  #app .sales-zone .account-switch-button[aria-pressed="true"] {
    border-color: #ffffff;
    background: #ffffff;
    color: #2273da;
  }

  #app .contact-title.compact-title {
    flex: 0 0 48px;
    min-height: 48px;
    padding: 8px 14px;
    border-bottom: 1px solid #e8ecea;
    border-radius: 0;
    background: #ffffff;
  }

  #app .contact-avatar,
  #app .customer-avatar,
  #app .sales-avatar,
  #app .user-avatar,
  #app [class~="avatar"] {
    display: none;
  }

  #app .message-thread {
    flex: 1 1 auto;
    min-height: 0;
    padding: 14px;
    overflow-x: hidden;
    overflow-y: auto; /* desktop-internal-scroll */
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }

  #app .chat-composer {
    flex: 0 0 auto;
    margin: 0;
    padding: 10px;
    border-top: 1px solid #e3e9e6;
    border-radius: 0;
    background: #ffffff;
    box-shadow: none;
  }

  #app .chat-composer textarea {
    min-height: 72px;
    max-height: 144px;
    resize: vertical;
  }

  #app .sales-workspace {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: 190px minmax(0, 1fr);
    min-height: 0;
    overflow: hidden;
  }

  #app .contact-rail {
    min-width: 0;
    min-height: 0;
    border-right: 1px solid #e3e8e6;
    border-radius: 0;
    background: #f8faf9;
    overflow-y: auto;
  }

  #app .sales-chat {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    border-radius: 0;
    background: #ffffff;
    overflow: hidden;
  }

  #app .assistant-nav {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 48px;
    min-width: 0;
    border-bottom: 1px solid var(--reference-border);
    background: #ffffff;
  }

  #app .assistant-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-width: 0;
    border: 0;
    background: #ffffff;
  }

  #app .assistant-tabs button {
    min-width: 0;
    min-height: 43px;
    padding: 0 8px;
    border-radius: 0;
    font-size: 13px;
    font-weight: 700;
  }

  #app .assistant-tabs button[aria-selected="true"] {
    color: var(--reference-green-dark);
    box-shadow: inset 0 -2px var(--reference-green);
  }

  #app .assistant-nav > .follow-up-button {
    position: relative;
    align-self: center;
    justify-self: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 34px;
    min-width: 36px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: #f3fbf7;
    color: var(--reference-green-dark);
    box-shadow: none;
  }

  #app .assistant-nav > .follow-up-button:hover {
    background: #e5f7ee;
  }

  #app .assistant-nav .notification-badge {
    position: absolute;
    z-index: 30;
    top: -4px;
    right: -4px;
    left: auto;
  }

  #app .assistant-panel {
    min-width: 0;
    min-height: 0;
    border: 0;
    border-radius: 0;
    background: #ffffff;
    box-shadow: none;
    overflow: hidden;
  }

  #app .coach-panel:not([hidden]) {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
  }

  #app .profile-panel:not([hidden]) {
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  #app .coach-toolbar {
    min-height: 36px;
    padding: 5px 12px;
    border-bottom: 1px solid #edf0ef;
    background: #fbfcfb;
  }

  #app .coach-output {
    min-height: 0;
    padding: 13px 15px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    color: #29352f;
    font-size: 13px;
    line-height: 1.58;
  }

  #coach-output h3 {
    margin: 13px 0 5px;
    color: #18251f;
    font-size: 14px;
    font-weight: 760;
  }

  #coach-output h3:first-child {
    margin-top: 0;
  }

  #coach-output .accent-heading {
    color: var(--reference-green-dark);
  }

  #coach-output .warning-heading {
    color: #a96700;
  }

  #coach-output p,
  #coach-output ul {
    margin: 0 0 8px;
  }

  #coach-output ul {
    padding-left: 18px;
  }

  #coach-output .reply-option {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 36px;
    gap: 8px;
    align-items: center;
    margin: 0;
    padding: 10px 0;
    border: 0;
    border-top: 1px solid #e4e9e6;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  #coach-output .reply-option p {
    margin: 0;
  }

  #coach-output .insert-reply {
    width: 34px;
    height: 34px;
    min-width: 34px;
    padding: 0;
    border: 1px solid #8fd0af;
    border-radius: 8px;
    background: #ffffff;
    color: var(--reference-green-dark);
  }

  #app .coach-form {
    min-height: 0;
    margin: 0;
    padding: 9px 10px 10px;
    border-top: 1px solid #e2e8e5;
    border-radius: 0;
    background: #ffffff;
    box-shadow: 0 -3px 12px rgb(20 64 41 / 4%);
  }

  #app .coach-form textarea {
    min-height: 68px;
    max-height: 180px;
    overflow-y: hidden;
    resize: none;
  }

  #app button,
  #app textarea,
  #app input {
    transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease, box-shadow 140ms ease;
  }

  #app button:focus-visible,
  #app textarea:focus-visible,
  #app input:focus-visible {
    outline: 2px solid rgb(47 107 255 / 35%);
    outline-offset: 2px;
  }
}

@media (min-width: 1101px) and (max-width: 1320px) {
  #workspace-shell > #app.simulator-shell {
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1fr) minmax(0, 1.1fr);
  }

  #app .sales-workspace {
    grid-template-columns: minmax(0, 1fr);
  }
  #app .contact-rail { display: none; }

  .product-badge {
    display: none;
  }
}

@media (min-width: 1101px) {
  :root {
    --wecom-blue: #267ef0;
    --wecom-blue-dark: #1568d8;
    --wecom-blue-soft: #eaf3ff;
    --wechat-green: #07c160;
    --wechat-green-dark: #06ad56;
    --wechat-bubble: #95ec69;
    --wechat-surface: #ededed;
  }

  #app > .client-zone {
    border-color: #cbd1ce;
  }

  #app .client-zone > .zone-header {
    background: #ededed;
    border-bottom-color: #d7dcda;
  }

  #app .client-zone > .zone-header h2 {
    color: #171717;
  }

  #app .client-zone .contact-title.compact-title,
  #app .client-zone .chat-composer {
    background: #f6f6f6;
  }

  #app .client-zone .message-thread {
    background: var(--wechat-surface);
  }

  #app .client-zone .message-row.outgoing .message-bubble {
    border-color: #86dc5f;
    background: var(--wechat-bubble);
    color: #171717;
  }

  #app .client-zone .message-row.incoming .message-bubble {
    border-color: #e2e2e2;
    background: #ffffff;
    color: #171717;
  }

  #app .client-zone .primary-button {
    border-color: var(--wechat-green);
    background: var(--wechat-green);
  }

  #app .client-zone .primary-button:hover {
    border-color: var(--wechat-green-dark);
    background: var(--wechat-green-dark);
  }

  #app > .sales-zone {
    border-color: #7eb1f7;
  }

  #app .sales-zone > .zone-header {
    background: var(--wecom-blue);
    color: #ffffff;
  }

  #app .sales-zone > .zone-header h2 {
    color: #ffffff;
  }

  #app .sales-zone .account-pill {
    border-color: rgb(255 255 255 / 38%);
    background: rgb(255 255 255 / 16%);
    color: #ffffff;
  }

  #app .sales-zone .contact-rail {
    background: #f3f6fa;
  }

  #app .sales-zone .contact-item.is-selected {
    border-left-color: var(--wecom-blue);
    background: var(--wecom-blue-soft);
  }

  #app .sales-zone .contact-title {
    background: #f8fbff;
  }

  #app .sales-zone .manual-badge {
    border-color: #9bc2f8;
    background: var(--wecom-blue-soft);
    color: var(--wecom-blue-dark);
  }

  #app .sales-zone .message-thread {
    background: #f2f4f7;
  }

  #app .sales-zone .message-row.outgoing .message-bubble {
    border-color: #bdd8fb;
    background: #dcecff;
    color: #172536;
  }

  #app .sales-zone .message-row.incoming .message-bubble {
    border-color: #e1e5eb;
    background: #ffffff;
    color: #172536;
  }

  #app .sales-zone .primary-button {
    border-color: var(--wecom-blue);
    background: var(--wecom-blue);
  }

  #app .sales-zone .primary-button:hover {
    border-color: var(--wecom-blue-dark);
    background: var(--wecom-blue-dark);
  }

  #app .coach-form-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    width: auto;
  }

  #app .analysis-split,
  #app .analysis-split-control { width: auto; }

  #app .coach-send { align-self: center; width: auto; min-width: 72px; min-height: 42px; }

  #app .analysis-split-control > button {
    white-space: nowrap; /* prevent-button-wrap */
  }

  #app .analysis-split-control .analyze-now {
    min-width: 56px;
    padding-inline: 8px;
  }

  #app .analysis-mode-toggle {
    flex: 0 0 42px;
    justify-content: center;
    min-width: 42px;
    padding-inline: 8px;
  }

  #app .coach-stream-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 11px;
    color: #7546a8;
    font-size: 12px;
    font-weight: 650;
  }

  #app .coach-stream-pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7955d2, #b36cd5 65%, #d38bbb);
    animation: coach-stream-pulse 1.1s ease-in-out infinite;
  }

  #coach-output .adaptive-heading {
    color: #126b48;
  }

  #coach-output .streaming-reply,
  #coach-output .insert-reply:disabled {
    opacity: 0.55;
    cursor: not-allowed;
  }
}

@keyframes coach-stream-pulse {
  0%, 100% { transform: scale(0.75); opacity: 0.45; }
  50% { transform: scale(1); opacity: 1; }
}

/* Analysis and questions share the available height above the composer. */
#app #sales-coach-panel:not([hidden]) { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
#app .coach-content { display: block; flex: 1 1 0; min-height: 0; overflow-y: auto; overscroll-behavior: contain; overflow-anchor: none; }
#app .coach-content > .coach-output-scroll { min-height: 0; overflow: visible; }
#app .coach-content > [hidden] { display: none; }
#app .assistant-header-actions .follow-up-button { position: relative; z-index: 2; overflow: visible; }
#app .assistant-header-actions .notification-badge { top: 0; right: 0; z-index: 3; pointer-events: none; }
#app #sales-coach-panel > .coach-form { flex: 0 0 auto; position: static; }

@media (min-width: 1025px) {
    #workspace-shell .intelligence-zone {
        grid-template-rows: auto minmax(0, 1fr);
    }

    #workspace-shell .intelligence-zone .assistant-panel {
        min-height: 0;
    }

    #workspace-shell .intelligence-zone .coach-panel {
        grid-template-rows: minmax(0, 1fr) auto;
    }
}

/* The top divider controls composer height; text navigation keeps no visible scrollbar. */
#app #coach-question { min-height: 68px; height: 68px; max-height: min(50dvh, 420px); overflow-y: auto; resize: none; scrollbar-width: none; }
@media (min-width: 1101px) { #app #coach-question { height: 100px; } }
#app #coach-question::-webkit-scrollbar { display: none; width: 0; height: 0; }
#app #coach-form { border-top: 0; }
#app .composer-divider { display: flex; align-items: center; justify-content: center; flex: 0 0 12px; height: 12px; width: 100%; border-top: 1px solid var(--line); background: var(--paper); cursor: ns-resize; touch-action: none; user-select: none; }
#app .composer-divider::before { content: ""; width: 44px; height: 3px; border-radius: 3px; background: var(--line-strong); }
#app .composer-divider:focus-visible { outline: none; }
#app .client-zone .composer-divider:is(:hover, :focus-visible)::before,
#app .client-zone.is-composer-resizing .composer-divider::before { background: #17ae70; }
#app .sales-zone .composer-divider:is(:hover, :focus-visible)::before,
#app .sales-zone .is-composer-resizing .composer-divider::before { background: #368bee; }
#app .intelligence-zone .composer-divider:is(:hover, :focus-visible)::before,
#app .intelligence-zone .is-composer-resizing .composer-divider::before { background: #9562ca; }
#app #customer-input, #app #sales-input { min-height: 68px; max-height: min(50dvh, 420px); overflow-y: auto; resize: none; scrollbar-width: none; }
#app #customer-input::-webkit-scrollbar, #app #sales-input::-webkit-scrollbar { display: none; width: 0; height: 0; }
#app #customer-form, #app #sales-form { border-top: 0; }
#app #customer-form > .primary-button,
#app #sales-form > .primary-button,
#app #coach-form .coach-send { box-sizing: border-box; height: 44px; min-height: 44px; padding-block: 0; }
#app .coach-form-actions { align-items: flex-end; }
#app #coach-form .coach-send { align-self: flex-end; }
@media (min-width: 1101px) {
  #app #customer-form > .primary-button,
  #app #sales-form > .primary-button,
  #app #coach-form .coach-send { transform: translateY(-20px); }
}
.is-composer-resizing { cursor: ns-resize; user-select: none; }
@media (pointer: coarse) { #app .composer-divider { flex-basis: 24px; height: 24px; } }
html[coach-desktop-shell] #ai-coach-zone { gap: 0 !important; padding: 0 !important; }
html[coach-desktop-shell] #ai-coach-zone .ai-zone-header {
    flex: 0 0 44px !important; min-height: 44px !important; height: 44px !important;
    margin: 0 !important; padding: 0 64px 0 12px !important; box-sizing: border-box !important;
}
html[coach-desktop-shell] #ai-coach-zone .assistant-panel { margin: 0 !important; padding: 0 !important; }
