/* Shared phone ergonomics. Tables/charts may scroll inside their own labelled regions. */
.pocket-speaker-name { font-size: 14px; line-height: 1.5; }
.pocket-transcript-text { font-size: 16px; line-height: 1.6; overflow-wrap: anywhere; }
#pocketTranscript .passage-text { font-size: 16px; line-height: 1.6; color: var(--ink); }
#pocketTranscript .speaker-chip { color: var(--accent-text); font-size: 14px; line-height: 1.5; }
html.is-phone #pocketDraftBadge { display: none; } /* Count already appears above the transcript. */
html.is-phone :focus-visible { outline: 3px solid var(--accent-text, #975000); outline-offset: 3px; }
html.is-phone .modal :is(p, li, label, .hint, .status) { font-size: 16px !important; line-height: 1.6; }
html.is-phone *, html.is-phone *::before, html.is-phone *::after { box-sizing: border-box; }
html.is-phone :is(main, section, article, .grid, .grid > *, .cols, .cols > *, .card, .row > *, .modal) { min-width: 0; }
html.is-phone :is(h1, h2, h3, p, label, .status, .hint) { overflow-wrap: anywhere; }
html.is-phone :is(button, .btn) { min-height: 44px; max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
html.is-phone :is(input:not([type=checkbox]):not([type=radio]):not([type=range]), select, textarea) {
  font-size: 16px !important; min-width: 0; max-width: 100%;
}
html.is-phone :is(input:not([type=checkbox]):not([type=radio]):not([type=range]), select) { min-height: 44px; }
html.is-phone :is(img, video, canvas, iframe) { max-width: 100%; }
html.is-phone [data-tooltip]::after { display: none !important; }
html.is-phone .row { flex-wrap: wrap; }
html.is-phone .modal-bg { padding: max(12px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom)); }
html.is-phone .modal {
  width: 100% !important; max-width: 620px !important;
  max-height: calc(100dvh - 32px) !important; padding: 18px 14px !important;
  overflow-y: auto; overscroll-behavior: contain;
}
html.is-phone .modal :is(h2, h3, .row) { flex-wrap: wrap; gap: 8px; }

/* Client workspace pages and their dialogs. */
html.is-phone body[data-mobile-page=app] .phone-page-nav { padding: 10px 12px; }
html.is-phone.phone-home .phone-page-nav,
html.is-phone body.view-mode-wizard .phone-page-nav,
body.view-mode-wizard .phone-page-nav { display: none !important; }
html.is-phone .sticky-version-badge { display: none !important; }
html.is-phone #speakerOutputCard h3, html.is-phone .virality-gauge { flex-wrap: wrap; gap: 10px; }
html.is-phone .speaker-vault-tabs { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); }
html.is-phone .speaker-vault-tabs button { width: 100%; min-width: 0; }
html.is-phone #upgradeModal [style*="display:flex"], html.is-phone #upgradeModal [style*="display: flex"] { flex-wrap: wrap; }
html.is-phone #upgradeModal input { width: 100%; flex-basis: 100% !important; }
html.is-phone .dual-draft-grid { grid-template-columns: minmax(0, 1fr); }

/* The field guide is instructional content: use comfortable reading sizes on phones. */
html.is-phone #guideModal .modal { padding: 16px 14px !important; }
html.is-phone #guideModal #guideTitle { font-size: 21px !important; line-height: 1.25; }
html.is-phone #guideModal > .modal > p { font-size: 16px !important; line-height: 1.55; }
html.is-phone #guideModal [role="tablist"] { gap: 8px !important; padding-bottom: 10px !important; }
html.is-phone #guideModal [role="tablist"] .btn { flex: 0 0 auto; min-height: 46px; padding: 10px 12px !important; font-size: 14px !important; }
html.is-phone #guideModal [style*="flex:1"][style*="overflow-y"] { font-size: 16px !important; line-height: 1.65 !important; padding: 16px 2px !important; }
html.is-phone #guideModal [style*="flex:1"][style*="overflow-y"] h3 { font-size: 20px !important; line-height: 1.3; }
html.is-phone #guideModal [style*="flex:1"][style*="overflow-y"] li { margin-bottom: 10px; }
html.is-phone #guideModal [style*="flex:1"][style*="overflow-y"] code { font-size: 14px !important; overflow-wrap: anywhere; }
html.is-phone #guideModal .row { gap: 8px !important; }
html.is-phone #guideModal .row .btn { flex: 1 1 100%; font-size: 15px !important; min-height: 48px; }

/* Admin: use the full phone width, stack form groups, contain wide data tables. */
html.is-phone body[data-mobile-page=admin] { padding: 0 !important; }
html.is-phone body[data-mobile-page=admin] main { padding: 12px; }
html.is-phone body[data-mobile-page=admin] header { padding: 12px !important; flex-direction: column; align-items: stretch; gap: 12px; }
html.is-phone body[data-mobile-page=admin] .brand-lockup { flex-wrap: wrap; justify-content: flex-start !important; gap: 4px; white-space: normal; }
html.is-phone body[data-mobile-page=admin] header .row { margin: 0 !important; width: 100%; }
html.is-phone body[data-mobile-page=admin] header .row > * { flex: 1; }
html.is-phone body[data-mobile-page=admin] :is(.grid, [style*="grid-template-columns"]) { grid-template-columns: minmax(0, 1fr) !important; }
html.is-phone body[data-mobile-page=admin] .grid > * { min-width: 0; max-width: 100%; }
html.is-phone body[data-mobile-page=admin] .kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
html.is-phone body[data-mobile-page=admin] .kpi { min-width: 0; }
html.is-phone body[data-mobile-page=admin] .card { padding: 14px 12px; }
html.is-phone body[data-mobile-page=admin] :is(h2, h3, .card > [style*="display:flex"], .card > [style*="display: flex"]) { flex-wrap: wrap; gap: 8px; }
html.is-phone body[data-mobile-page=admin] .filter-bar { flex-direction: column; align-items: stretch; }
html.is-phone body[data-mobile-page=admin] .filter-bar :is(input, select) { width: 100%; min-width: 0 !important; }
html.is-phone body[data-mobile-page=admin] .table-responsive { max-width: 100%; }
html.is-phone body[data-mobile-page=admin] :is(#testsSuites, #testsLastRuns) { overflow-x: auto; }
html.is-phone body[data-mobile-page=admin] .tab-bar { display: flex; flex-wrap: nowrap; overflow-x: auto; max-width: 100%; }
html.is-phone body[data-mobile-page=admin] .tab-btn { flex: 0 0 auto; }
html.is-phone body[data-mobile-page=admin] .row > div { flex-basis: 100% !important; }

/* Radar: wrap summaries/actions while keeping the chart's local horizontal scroll. */
html.is-phone body[data-mobile-page=radar] :is(.flex, .grid, .grid > *, .flex > *) { min-width: 0; }
html.is-phone body[data-mobile-page=radar] .flex:not(.flex-col) { flex-wrap: wrap; }
html.is-phone body[data-mobile-page=radar] .md\:flex-row { flex-direction: column; align-items: stretch; }
html.is-phone body[data-mobile-page=radar] .lg\:grid-cols-3 { grid-template-columns: minmax(0, 1fr); }
html.is-phone body[data-mobile-page=radar] .lg\:grid-cols-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
html.is-phone body[data-mobile-page=radar] .lg\:col-span-2 { grid-column: span 1 / span 1; }
html.is-phone body[data-mobile-page=radar] .shrink-0.flex { flex-shrink: 1; max-width: 100%; }
html.is-phone body[data-mobile-page=radar] :is(#draftPostModal, #resonanceReportModal) > div { max-height: calc(100dvh - 32px); overflow-y: auto; }
html.is-phone body[data-mobile-page=radar] #chartViewport { max-width: 100%; }

/* Reading and integration pages. */
html.is-phone body[data-mobile-page=privacy] { padding: 16px 12px; }
html.is-phone body[data-mobile-page=privacy] .container { padding: 22px 18px; }
html.is-phone body[data-mobile-page=sdk] { padding: 16px 12px; }
html.is-phone body[data-mobile-page=sdk] .header { flex-direction: column; align-items: flex-start; gap: 14px; }
html.is-phone body[data-mobile-page=sdk] .logo { flex-wrap: wrap; }
html.is-phone body[data-mobile-page=sdk] .grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
html.is-phone body[data-mobile-page=sdk] .card { padding: 18px 14px; }
html.is-phone body[data-mobile-page=sdk] pre { max-width: 100%; }
html.is-phone body[data-mobile-page=survey] :is(.sctrl, .shead, .sctrl input) { min-width: 0; }

.phone-intent-toggle { display: none; }
.language-flag { display: inline-block; width: 32px; height: 24px; object-fit: contain; vertical-align: middle; border-radius: 2px; }
#transButtonLabel, #pocketTransButtonLabel { display: inline-flex; align-items: center; gap: 6px; }
.flag-picker { display: flex; justify-content: center; align-items: center; gap: 12px; min-height: 48px; width: 100%; padding: 8px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: var(--bg); cursor: pointer; }
.flag-choices { display: grid; gap: 4px; max-height: 220px; overflow-y: auto; margin-top: 12px; }
.flag-choices[hidden] { display: none !important; }
.flag-choice { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 8px; font-size: 16px; text-align: left; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.flag-choice:focus-visible, .flag-picker:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#translationPopover { max-height: calc(100dvh - 20px); overflow-y: auto; }
/* These live-room tools belong to Studio, not the guided capture-to-post flow.
   Override inline display changes from roster and telemetry updates as well. */
body.view-mode-wizard :is(#stagePanelistRosterWrap, #liveQADrawer, #attendeePostRadarDrawer, .phone-extra-tools) {
  display: none !important;
}
body.view-mode-wizard .wizard-step-container[hidden] { display: none !important; }
html.is-phone .wizard-step-container { animation: none !important; }
html.is-phone #transcriptToolbarRow { gap: 12px !important; }
html.is-phone #transcriptToolbarRow > div { flex: 1 1 100%; min-width: 0; }
html.is-phone #transcriptToolbarRow .btn { min-width: 80px; word-break: normal; }
html.is-phone #liveStatus { margin-bottom: 12px; line-height: 1.5; }
html.is-phone #transcript { font-size: 16px; line-height: 1.6; }
html.is-phone #transcript .inline-rx-selector { display: none !important; }
html.is-phone #btnDirectPublish { min-width: 90px; flex-shrink: 0; word-break: normal; }
html.is-phone main button { overflow-wrap: normal; word-break: normal; }
html.is-phone .phone-extra-tools { margin-top: 12px; border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
html.is-phone .phone-extra-tools > summary { font-size: 16px; line-height: 1.5; min-height: 44px; cursor: pointer; }
html.is-phone .phone-intent-toggle { display: flex; width: 100%; margin-bottom: 12px; }
html.is-phone #qvBox-live:not(.phone-expanded) { display: none; }
html.is-phone .wizard-step-container:not(.active-step) { display: none !important; }
html.is-phone .wizard-step-container.active-step { display: block !important; width: 100%; min-width: 0; }
html.is-phone :is(#wStep1, #wStep2, #wStep3, #wStep4) .card { padding: 16px 14px; min-width: 0; }
html.is-phone :is(#wStep1, #wStep2, #wStep3, #wStep4) p:not(.hint):not(.caption):not(.business-value) { font-size: 15px; line-height: 1.55; }
html.is-phone :is(#wStep1, #wStep2, #wStep3, #wStep4) :is(.hint, .caption, .charcount) { font-size: 12.5px !important; line-height: 1.4; color: var(--muted); }
html.is-phone :is(#wStep1, #wStep2, #wStep3, #wStep4) label { font-size: 13.5px !important; font-weight: 600; }
html.is-phone :is(#wStep1, #wStep2, #wStep3, #wStep4) .row { flex-wrap: wrap; }
html.is-phone .qv-info-btn { flex: 0 0 44px; width: 44px; height: 44px; padding: 0; border-radius: 50%; }
html.is-phone #guideModal :is(p, li, .hint) { font-size: 15px !important; line-height: 1.55; }
html.is-phone #guideModal [style*="grid-template-columns"] { grid-template-columns: minmax(0, 1fr) !important; }

/* In-flow mobile navigation never covers transcripts or drafts */
html.is-phone .wizard-nav-footer:not([style*="display: none"]):not([style*="display:none"]),
body.is-phone-device .wizard-nav-footer:not([style*="display: none"]):not([style*="display:none"]) {
  position: static !important;
  bottom: auto !important;
  left: auto !important;
  right: auto !important;
  z-index: auto !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 10px !important;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 12px)) !important;
  background: var(--surface, #202024) !important;
  border-top: 1px solid var(--line, #3E3E42) !important;
  box-shadow: 0 -4px 18px rgba(0, 0, 0, 0.4) !important;
  margin: 16px 0 0 !important;
}
html.is-phone .wizard-nav-footer[style*="display: none"],
html.is-phone .wizard-nav-footer[style*="display:none"],
body.is-phone-device .wizard-nav-footer[style*="display: none"],
body.is-phone-device .wizard-nav-footer[style*="display:none"],
.wizard-nav-footer[hidden] {
  display: none !important;
}
html.is-phone .wizard-nav-footer .btn,
body.is-phone-device .wizard-nav-footer .btn {
  min-height: 48px !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  border-radius: var(--radius-md, 10px) !important;
}
html.is-phone .wizard-nav-footer .btn.hero,
body.is-phone-device .wizard-nav-footer .btn.hero {
  flex: 1.6 !important;
}
html.is-phone .wizard-nav-footer .btn.secondary,
body.is-phone-device .wizard-nav-footer .btn.secondary {
  flex: 1 !important;
}
html.is-phone .wizard-nav-footer > div:has(.pill),
body.is-phone-device .wizard-nav-footer > div:has(.pill) {
  display: none !important;
}
html.is-phone .wizard-step-container.active-step,
body.is-phone-device .wizard-step-container.active-step {
  padding-bottom: env(safe-area-inset-bottom, 16px) !important;
}

/* Stepper Node Touch Targets (Apple HIG >= 44px) */
html.is-phone .wizard-step-node,
body.is-phone-device .wizard-step-node {
  position: relative;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
html.is-phone .wizard-step-node::after,
body.is-phone-device .wizard-step-node::after {
  content: '';
  position: absolute;
  top: -8px;
  bottom: -8px;
  left: -8px;
  right: -8px;
}

/* Step 1 Live Reactions 4-Column Grid */
html.is-phone #liveReactionsBar.recording-active,
body.is-phone-device #liveReactionsBar.recording-active {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr) !important;
  gap: 8px !important;
  width: 100% !important;
  box-sizing: border-box !important;
}
html.is-phone #liveReactionsBar .btn,
body.is-phone-device #liveReactionsBar .btn {
  min-height: 48px !important;
  font-size: 12.5px !important;
  padding: 6px 4px !important;
  white-space: nowrap !important;
  justify-content: center !important;
}
html.is-phone body[data-mobile-page=admin] #tabSec-referrals .card { overflow-x: auto; }
html.is-phone body[data-mobile-page=admin] #tabSec-referrals .card > * { max-width: 100%; }
html.is-phone body[data-mobile-page=admin] #tabSec-referrals :is(input, select, textarea) { width: 100% !important; min-width: 0 !important; }
html.is-phone body[data-mobile-page=admin] #tabSec-referrals .row > * { min-width: 0 !important; }
/* Focused capture: keep the transcript and four reactions central. */
html.is-phone #pocketOverlay {
  height: 100dvh;
  min-height: 0;
  justify-content: flex-start !important;
  align-items: stretch !important;
  overflow-y: auto !important;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  scroll-padding-bottom: calc(32px + env(safe-area-inset-bottom));
}
html.is-phone #pocketOverlay > div { flex: 0 0 auto; margin-left: auto !important; margin-right: auto !important; }
html.is-phone #pocketOverlay > div:nth-of-type(2) { margin-top: 0 !important; margin-bottom: 0 !important; }
html.is-phone #pocketOverlay > div:last-child { margin-top: 14px !important; padding-bottom: calc(24px + env(safe-area-inset-bottom)) !important; }
html.is-phone .capture-focused :is(.phone-home-nav, #btnGuide, #btnSettings, #btnLogout, #btnPocketTrans) { display:none !important; }
html.is-phone .capture-focused #pocketOverlay div:has(> #btnPhoneVideo),
html.is-phone .has-captured-transcript #pocketOverlay div:has(> #btnPhoneVideo) { display:none !important; }
html.is-phone .capture-focused #pocketTranscript { max-height:none !important; height:max(220px, calc(100dvh - 330px)) !important; font-size:18px !important; line-height:1.6 !important; }
html.is-phone .has-captured-transcript:not(.capture-focused) #pocketTranscript { max-height:min(38dvh, 360px) !important; }
html.is-phone .capture-focused #pocketVuWrap { height:12px !important; }
html.is-phone #btnLogout { display:none !important; }
html.is-phone #btnPhoneHome { font-size:0 !important; min-width:44px; min-height:44px; }
html.is-phone #btnPhoneHome::before { content:'←'; font-size:24px; }
html.is-phone label:has(#autoSuggest) { display:none !important; }
html.is-phone :is(.spinner-step-item, .spinner-title, .spinner-steps) { font-size:16px !important; line-height:1.5 !important; }
.transcript-reaction { display:inline-block; padding:4px 8px; margin:4px 4px 4px 0; border:1px solid var(--accent); border-radius:8px; color:var(--ink); font-size:14px; font-weight:600; }
html.is-phone .capture-focused :is(#btnOpenGuide, #btnOpenSettings) { display:none !important; }
html.is-phone #transcript div:has(> .transcript-reaction) { flex-wrap:wrap; min-width:0; }
html.is-phone :is(.optional-post-tools, .topic-options) { width:100%; margin-top:12px; }
html.is-phone :is(.optional-post-tools, .topic-options) > summary { min-height:44px; padding:10px 4px; font-size:16px; line-height:1.5; cursor:pointer; }
html.is-phone #finalDraftPreview { margin-bottom:16px; }
html.is-phone #wStep3 textarea#postEditor { min-height:42dvh; height:auto; font-size:17px !important; line-height:1.55; }
html.is-phone #wStep3 .card { border-color:var(--accent); }
html.is-phone #wStep3 #postStatus:not(:empty) { padding:10px 12px; margin-bottom:12px; border-radius:10px; background:rgba(249,157,50,.10); }
#businessProfileDialog select { box-sizing:border-box; width:100%; min-width:0; padding:12px; min-height:48px; background:var(--bg); color:var(--ink); border:1px solid var(--line); border-radius:8px; }
#peerIntelligenceDialog { width:min(620px,calc(100% - 24px)); box-sizing:border-box; max-height:90dvh; overflow:auto; background:var(--surface,#202024); color:var(--ink,#fff); border:2px solid var(--accent,#ffa126); border-radius:16px; padding:16px; }
#peerIntelligenceDialog::backdrop { background:#000b; }
#peerIntelligenceDialog :is(p,label,input,textarea,select,button,summary) { font-size:16px; line-height:1.5; }
#peerIntelligenceDialog :is(input:not([type=checkbox]),textarea,select) { display:block; width:100%; box-sizing:border-box; min-width:0; margin:8px 0; }
#peerIntelligenceDialog button, #peerIntelligenceDialog summary { min-height:44px; margin:8px 0; white-space:normal; }
#peerIdentity { overflow-wrap:anywhere; white-space:pre-wrap; }
.peer-passage { border-top:1px solid var(--line); padding:12px 0; overflow-wrap:anywhere; }
