/* Portfolio voice additions: keep the existing teal/gray/blue desktop skin. */
body #win-main, body.theme-31 #win-main, body.theme-98 #win-main {
  width: min(680px, calc(100vw - 24px)) !important;
  height: min(570px, calc(100dvh - 72px)) !important;
  min-width: 0 !important;
  min-height: 0 !important;
  max-width: calc(100vw - 16px) !important;
  max-height: calc(100dvh - var(--taskbar-h, 36px) - 12px) !important;
}
body .companion-left {
  grid-template-rows: 86px 62px 29px 28px minmax(70px, 1fr) auto 34px auto !important;
  gap: 5px !important;
  min-width: 0 !important;
  min-height: 0 !important;
}
body .chat-welcome { padding-top: 8px !important; padding-bottom: 6px !important; }
body .chat-welcome strong { font-size: 16px !important; line-height: 1.15 !important; }
body .chat-welcome span { font-size: 12px !important; line-height: 1.3 !important; }
.suggested-questions { display: flex; flex-wrap: wrap; gap: 4px; }
body .stage-bubble { position: fixed !important; max-height: min(180px, calc(100dvh - 60px)) !important; overflow: auto !important; pointer-events: auto !important; }
.suggested-questions .ui-btn { font: 11px/1.25 Tahoma, sans-serif; padding: 4px 6px; white-space: normal; min-height: 25px; }
body .chat-history { min-height: 70px !important; overflow: auto !important; overflow-wrap: anywhere; }
body .chat-statusbar { display: flex !important; flex-wrap: wrap !important; height: auto !important; }
body .chat-statusbar span { max-width: 100%; height: auto !important; min-height: 17px; white-space: normal !important; }
body .chat-statusbar #chatStatus { flex: 1 0 100%; }
body .speech-option-row { flex-wrap: wrap !important; gap: 4px 12px !important; height: auto !important; }
.finance-window { max-width: calc(100vw - 16px) !important; max-height: calc(100dvh - var(--taskbar-h, 36px) - 12px) !important; min-width: 0 !important; min-height: 0 !important; }
.finance-body { overflow: auto !important; padding: 12px !important; height: calc(100% - 46px) !important; background: #c0c0c0; color: #111; font: 13px/1.45 Tahoma, sans-serif; }
.finance-body p { margin: 9px 0; }
.finance-toolbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.finance-toolbar [hidden] { display: none !important; }
.finance-facts { display: grid; grid-template-columns: minmax(100px, 32%) minmax(0, 1fr); gap: 0; border: 2px solid; border-color: #808080 #fff #fff #808080; background: #eee; margin: 12px 0; }
.finance-facts dt, .finance-facts dd { padding: 7px; margin: 0; border-bottom: 1px solid #ccc; overflow-wrap: anywhere; }
.finance-facts dt { font-weight: bold; }
.finance-empty { padding: 10px; background: #ffffe1; border: 1px solid #888; }
.finance-sources { border-top: 1px solid #888; margin-top: 14px; font-size: 11px; overflow-wrap: anywhere; }
.finance-sources a { display: inline-block; margin: 0 12px 6px 0; color: #000080; }
.finance-table-wrap { overflow-x: auto; }
.finance-table { border-collapse: collapse; width: 100%; background: #fff; font-size: 12px; }
.finance-table td, .finance-table th { border: 1px solid #888; padding: 7px; text-align: left; overflow-wrap: anywhere; }
.finance-table th { background: #ddd; }
.finance-table small, .finance-table a { display: block; font-size: 10px; }
body #win-contract, body.theme-31 #win-contract { width: min(480px, calc(100vw - 16px)) !important; height: min(330px, calc(100dvh - 70px)) !important; min-height: 0 !important; min-width: 0 !important; max-height: calc(100dvh - 70px) !important; max-width: calc(100vw - 16px) !important; }
body #win-contract .contract-body { overflow: auto !important; height: calc(100% - 48px) !important; align-items: flex-start !important; }
body #win-contract #contractCopied { display: block !important; }
body .contract-copy { min-width: 0; }
body .contract-copy input { width: 100%; box-sizing: border-box; }
body .contract-copy p { margin: 6px 0; font-size: 12px; }
body .contract-copy small { display: block; white-space: normal; }
body .window { max-width: calc(100vw - 12px); max-height: calc(100dvh - var(--taskbar-h, 36px) - 10px); }
body.theme-31 #desktop .window { min-width: 0 !important; min-height: 0 !important; max-width: calc(100vw - 16px) !important; max-height: calc(100dvh - var(--taskbar-h, 36px) - 12px) !important; }
body .titlebar { touch-action: none; }
body .start-menu, body.theme-31 .start-menu, body.theme-98 .start-menu { overflow: hidden !important; }
body .start-menu .start-mainpanel, body.theme-31 .start-menu .start-mainpanel, body.theme-98 .start-menu .start-mainpanel {
  overflow-y: auto !important; max-height: calc(100dvh - var(--taskbar-h, 36px) - 16px) !important;
}
body .start-menu .start-item { flex-shrink: 0 !important; }
body .desktop-icons, body.theme-31 .desktop-icons, body.theme-98 .desktop-icons {
  width: 158px !important; grid-template-columns: repeat(2, 76px) !important;
  max-height: calc(100dvh - var(--taskbar-h, 36px) - 20px) !important; overflow-y: auto !important;
}
body .cmd-help { white-space: normal; font-size: 10px; }
body .command-body { overflow: auto !important; }
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible { outline: 1px dotted #000; outline-offset: -4px; }
@media (max-width: 640px) {
  body #win-main, body.theme-31 #win-main, body.theme-98 #win-main { width: calc(100vw - 16px) !important; height: min(720px, calc(100dvh - 64px)) !important; }
  body .companion-left { grid-template-rows: 108px 94px 29px auto minmax(85px, 1fr) auto 34px auto !important; }
  body #win-main .window-body.companion-chat { overflow-y: auto !important; overflow-x: hidden !important; }
  body .chat-welcome { padding-right: 112px !important; }
  body .chat-welcome strong { font-size: 14px !important; }
  body .companion-stage-wrap { right: 4px !important; top: 4px !important; width: 100px !important; height: 100px !important; }
  body .agent-button-bar { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; overflow: auto !important; }
  body .agent-select-btn { display: flex !important; gap: 3px !important; padding: 2px !important; min-width: 0 !important; }
  body .agent-select-btn b { font-size: 10px !important; white-space: normal !important; overflow: visible !important; text-overflow: clip !important; }
  body .agent-thumb { flex: 0 0 18px !important; width: 18px !important; }
  body .stage-bubble { top: 90px !important; left: auto !important; right: 0 !important; width: min(270px, calc(100vw - 44px)) !important; max-height: 150px !important; overflow: auto; pointer-events: auto; }
  body .stage-bubble::before, body .stage-bubble::after { display: none; }
  body .window { min-width: 0 !important; }
  body .contract-icon { display: none; }
  body .contract-body { display: block !important; }
  body .finance-body { padding: 8px !important; }
  body .fm-tree { min-width: 75px; width: 75px; }
  body .fm-file { grid-template-columns: 24px minmax(80px, 1fr) 55px 35px; font-size: 11px; }
  body .paint-body canvas { max-width: 100%; }
}
@media (max-height: 560px) {
  body #win-main .window-body.companion-chat { overflow-y: auto !important; }
  body .companion-left { min-height: 480px !important; }
}

/* Keep both icon columns inside the rail; native scrollbars must not steal a column. */
body #desktop .desktop-icons {
  left: var(--desktop-rail-left, 24px) !important;
  top: 18px !important;
  width: var(--desktop-rail-width, 154px) !important;
  max-width: calc(100vw - 24px) !important;
  height: auto !important;
  max-height: var(--desktop-rail-height, calc(100dvh - 64px)) !important;
  grid-template-columns: repeat(var(--desktop-columns, 2), 76px) !important;
  grid-auto-rows: var(--desktop-row-height, 76px) !important;
  gap: 2px !important;
  padding: 0 !important;
  box-sizing: border-box !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  scrollbar-width: none;
}
body #desktop .desktop-icons::-webkit-scrollbar { display: none; }
body #desktop .desktop-icon {
  width: 76px !important; min-width: 0 !important;
  height: 100% !important; min-height: 0 !important;
  box-sizing: border-box !important;
}
body #desktop .desktop-icon span { max-width: 70px !important; white-space: normal !important; }
