.paid-work-switch { display:flex; flex-wrap:wrap; gap:10px; margin-top:16px; }
.paid-work-switch button { flex:1 1 130px; min-height:44px; color:#fff; border:1px solid #d6ad4a; background:#08090b; }
.paid-work-switch button[aria-pressed="true"] { box-shadow:inset 0 0 0 2px #d6ad4a; }
.hive-install-help summary { cursor:pointer; color:#d6ad4a; padding:8px 0; }
#hiveAppInstallStatus, #hiveArtworkSettingsStatus, #hivePhoneAppStatus, #hiveWalletStatus { overflow-wrap:anywhere; }
#hivePhoneAppOwnerPanel a, #hiveCreditsLink { display:inline-block; margin:10px 14px 10px 0; }
#hivePhoneAppOwnerPanel a[hidden], #hiveCreditsLink[hidden] { display:none; }
@media(max-width:640px) {
  #artworkSettingsPanel select, #costControlPanel input, #costControlPanel select { width:100%; max-width:100%; }
  #hivePhoneAppOwnerPanel button, #artworkSettingsPanel button { max-width:100%; white-space:normal; }
}
/* Let phone content fit its columns instead of concealing overflowing controls. */
@media(max-width:850px) {
  .workspace-context .project-gauge { grid-template-columns:minmax(0,1fr); width:100%; box-sizing:border-box; gap:7px; }
  .project-gauge > *, .project-gauge-detail > *, .project-gauge-drilldown > * { min-width:0; max-width:100%; overflow-wrap:anywhere; }
  .project-gauge > b { white-space:normal; font-size:14px; }
  .project-gauge > small { font-size:10px; }
  .project-gauge-stages { grid-template-columns:repeat(4,minmax(0,1fr)); width:100%; }
  .project-gauge-stage { min-width:0; min-height:44px; padding:5px 1px; font-size:11px; white-space:normal; }
  .project-gauge-detail, .project-gauge-detail > b, .project-gauge > span, .project-gauge-drilldown { font-size:12px; line-height:1.5; }
  .active-companion { grid-template-columns:72px minmax(0,1fr); gap:10px; }
  .active-companion > .portrait-screen { width:72px; height:96px; min-height:96px; }
  .active-companion-copy, .active-companion-copy > *, .atlas-chat-identity > *, .profile-screen > * { min-width:0; max-width:100%; overflow-wrap:anywhere; }
  .active-companion h3 small { display:block; margin:3px 0; }
  .panel-head, .page-head, .item-actions, .profile-actions { flex-wrap:wrap; }
  .panel-head > *, .page-head > *, .chat-composer > *, .item-actions > * { min-width:0; max-width:100%; }
  .companion-actions button, .profile-actions button, .chat-composer button { white-space:normal; }
  #atlasChatPanel .chat-composer { display:flex; flex-wrap:wrap; }
  #atlasChatPanel .chat-composer textarea { width:100%; flex:1 0 100%; box-sizing:border-box; }
  #atlasChatPanel select { width:100%; min-width:0; max-width:100%; }
  #piperChatPanel[data-phone-panel="history"] > .piper-chat-head { display:none; }
  #piperChatPanel[data-phone-panel="history"] #piperHistoryPanel { margin:0; }
  #piperHistoryPanel .panel-head { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:6px; }
  #piperHistoryPanel .panel-head h3 { margin:0; font-size:14px; }
  #piperHistoryPanel .panel-head button { padding:6px; font-size:11px; }
  #piperChatPanel { padding:8px!important; font-size:11px; line-height:1.4; }
  #piperChatPanel .piper-chat-head { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:6px; margin:-8px -8px 6px; padding:6px 8px; top:-8px; }
  #piperChatPanel .piper-chat-head h3, #piperHistoryPanel .panel-head h3 { font-size:13px; line-height:1.3; }
  #piperChatPanel button, #piperHistoryPanel .panel-head button { min-height:32px; padding:5px 7px; font-size:10px; line-height:1.2; }
  #piperChatPanel .piper-composer { margin:6px 0; gap:6px; }
  #piperChatPanel .piper-composer textarea { min-height:40px; max-height:70px; padding:6px; font-size:13px; line-height:1.4; }
  #piperChatPanel .piper-message, #piperChatPanel .event, #piperChatPanel .piper-history-item, #piperChatPanel .piper-history-list { font-size:11px; line-height:1.4; }
  #piperChatPanel .piper-message, #piperChatPanel .piper-messages, #piperChatPanel .piper-history-item { padding:6px; }
  #piperChatPanel p { margin:6px 0; font-size:11px; line-height:1.4; }
}
@media(max-width:360px) {
  .project-gauge-stages { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .active-companion, .profile-screen, .atlas-chat-identity { grid-template-columns:minmax(0,1fr); }
  .active-companion > .portrait-screen { justify-self:center; }
  .companion-panel { padding:10px; }
  .project-gauge-stage { font-size:12px; }
}

/* 40.1: one compact, explicit paid-work switch. */
#costControlPanel .paid-work-switch{display:flex;justify-content:flex-start;align-items:center;width:auto}
#paidWorkToggle{flex:0 0 auto;width:auto!important;min-width:136px;max-width:100%;padding:10px 16px;min-height:44px;border:2px solid #9d8248;border-radius:8px;background:#171717;color:#fff;font-weight:700}
#paidWorkToggle[data-state="on"]{border-color:#f0c966;background:#342b15;box-shadow:0 0 0 2px #b9923855;color:#fff}
#paidWorkToggle[data-state="off"]{box-shadow:none}
#paidBudgetStatus{font-size:12px;line-height:1.5;max-width:65ch;margin:8px 0}

/* Piper's small actions appear only after opening her conversation. */
#piperMobileActions[hidden] { display:none!important; }
@media(max-width:850px) {
  #piperMobileDock { gap:3px; max-width:calc(100vw - 20px); box-sizing:border-box; }
  #piperMobileActions { display:flex; align-items:center; gap:3px; min-width:0; }
  #piperMobileDock .piper-mobile-mini { flex:0 0 44px; margin:0; }
  #piperMobileDock #piperMobileLauncher { flex:0 0 62px; margin:0; }
}

.business-paid-budget { margin:18px 0; padding:16px; border:1px solid #b99b50; border-radius:12px; }
.business-paid-budget h3 { margin:0 0 10px; }
.business-paid-budget input { width:100%; max-width:220px; }
.business-paid-budget button { max-width:100%; white-space:normal; }

.billing-review-panel {margin-top:14px;padding:14px;border:1px solid #b58a35;border-radius:12px;}
.billing-review-panel article {margin:12px 0;padding:10px;border-top:1px solid #665028;overflow-wrap:anywhere;}
.billing-review-panel input[type=number] {max-width:220px;}
#paidWorkState {max-width:100%;white-space:normal;text-align:left;}
