/* ======================================================================
   MostHelt V3.12 — Component QA / layout hardening
   Cards · buttons · tables · form controls
   Loaded last on portal pages to remove cascade drift between legacy themes.
   ====================================================================== */

/* 1) Layout safety: grid/flex children must be allowed to shrink. */
.portal-page .portal-main,
.portal-page .portal-content,
.portal-page .portal-content > *,
.portal-page .portal-grid,
.portal-page .portal-grid > *,
.portal-page .metric-grid,
.portal-page .metric-grid > *,
.portal-page .panel-card,
.portal-page .panel-head,
.portal-page .panel-head > *,
.portal-page .quick-action,
.portal-page .quick-action > *,
.portal-page .table-name,
.portal-page .table-name > *,
.portal-page .portal-form,
.portal-page .portal-form label,
.portal-page .form-grid,
.portal-page .form-grid > *,
.portal-doktor .pro-surface,
.portal-doktor .pro-surface > *,
.portal-doktor .doctor-kpi-card,
.portal-doktor .doctor-ops-overview > *,
.portal-doktor .mh-consent-card-grid-v39 > *,
.portal-doktor .mh-consent-method-grid-v39 > *{
  min-width:0;
  max-width:100%;
}

/* 2) Cards: one geometry, no accidental nested scroll/padding drift. */
.portal-page .panel-card{
  border:1px solid #dfe9e5!important;
  border-radius:20px!important;
  background:#fff!important;
  padding:22px!important;
  box-shadow:0 8px 26px rgba(12,55,47,.04)!important;
}
.portal-page .panel-card.flush{
  padding:0!important;
  overflow:hidden!important;
}
.portal-page .panel-card.flush > .panel-head,
.portal-page .flush > .panel-head{
  margin-bottom:16px!important;
  padding:21px 22px 0!important;
}
.portal-page .panel-head{
  display:flex!important;
  align-items:flex-start!important;
  justify-content:space-between!important;
  gap:14px!important;
  flex-wrap:wrap!important;
}
.portal-page .panel-head > div:first-child{
  flex:1 1 260px;
  min-width:0;
}
.portal-page .panel-head h2{
  margin:0!important;
  color:#17342e!important;
  font-size:19px!important;
  line-height:1.2!important;
  letter-spacing:-.025em!important;
  overflow-wrap:anywhere;
}
.portal-page .panel-head p{
  margin:5px 0 0!important;
  color:#7f908b!important;
  font-size:13px!important;
  line-height:1.5!important;
  overflow-wrap:anywhere;
}
.portal-page .metric-grid{
  grid-template-columns:repeat(4,minmax(0,1fr))!important;
  gap:12px!important;
  align-items:stretch;
}
.portal-page .metric-card{
  width:100%;
  min-height:126px!important;
  height:100%;
  grid-template-columns:42px minmax(0,1fr)!important;
  gap:12px!important;
  align-items:start!important;
  padding:17px!important;
  border:1px solid #dfe9e5!important;
  border-radius:19px!important;
  background:#fff!important;
  box-shadow:0 6px 22px rgba(12,55,47,.035)!important;
  overflow:hidden;
}
.portal-page .metric-copy{min-width:0}
.portal-page .metric-copy small{
  display:block;
  color:#768983!important;
  font-size:12.5px!important;
  line-height:1.35!important;
  font-weight:700!important;
  overflow-wrap:anywhere;
}
.portal-page .metric-copy strong{
  display:block;
  margin:7px 0 5px!important;
  color:#17342e!important;
  font-size:30px!important;
  line-height:1!important;
  letter-spacing:-.04em!important;
  font-variant-numeric:tabular-nums;
  overflow-wrap:anywhere;
}
.portal-page .metric-copy span{
  display:block;
  color:#8d9b97!important;
  font-size:12px!important;
  line-height:1.4!important;
  overflow-wrap:anywhere;
}
.portal-page .quick-action{
  grid-template-columns:38px minmax(0,1fr) auto!important;
  gap:11px!important;
  align-items:center!important;
  padding:11px 12px!important;
  border-radius:14px!important;
}
.portal-page .quick-action div{min-width:0}
.portal-page .quick-action b{
  display:block;
  color:#29463f!important;
  font-size:13px!important;
  line-height:1.35!important;
  overflow-wrap:anywhere;
}
.portal-page .quick-action small{
  display:block;
  margin-top:2px;
  color:#82928d!important;
  font-size:12px!important;
  line-height:1.45!important;
  overflow-wrap:anywhere;
}
.portal-page .quick-action > span{
  max-width:150px;
  color:#687c76!important;
  font-size:12px!important;
  line-height:1.35!important;
  text-align:right;
  overflow-wrap:anywhere;
}

/* Professional dashboard/card grids that were prone to text squeezing. */
.portal-doktor .doctor-kpi-grid,
.portal-doktor .mh-visibility-kpis,
.portal-doktor .mh-consent-kpis-v38,
.portal-doktor .mh-consent-kpis-v39,
.portal-doktor .mh-consent-method-grid-v38,
.portal-doktor .mh-consent-method-grid-v39{
  grid-template-columns:repeat(4,minmax(0,1fr))!important;
}
.portal-doktor .doctor-ops-overview{grid-template-columns:repeat(6,minmax(0,1fr))!important}
.portal-doktor .doctor-kpi-card,
.portal-doktor .doctor-ops-overview > a,
.portal-doktor .mh-consent-kpis-v39 article,
.portal-doktor .mh-consent-method-grid-v39 article{
  min-width:0!important;
  overflow:hidden;
}

/* 3) Buttons: consistent hit area; long Turkish labels must wrap instead of clipping. */
.portal-page button,
.portal-page .action-button,
.portal-page .portal-button,
.portal-page .clinic-button,
.portal-page a.action-button,
.portal-page a.clinic-button{
  box-sizing:border-box;
  max-width:100%;
}
.portal-page .action-button,
.portal-page .portal-button,
.portal-page .clinic-button{
  min-height:44px!important;
  height:auto!important;
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  gap:7px!important;
  padding:9px 15px!important;
  border-radius:12px!important;
  font-size:13px!important;
  font-weight:750!important;
  line-height:1.2!important;
  text-align:center;
  white-space:normal!important;
  overflow-wrap:anywhere;
  vertical-align:middle;
  transform:none!important;
}
.portal-page .action-button.small,
.portal-page .clinic-button.small{
  min-height:38px!important;
  padding:7px 11px!important;
  border-radius:10px!important;
  font-size:12px!important;
}
.portal-page .action-button:hover,
.portal-page .portal-button:hover,
.portal-page .clinic-button:hover{
  transform:none!important;
}
.portal-page .action-button svg,
.portal-page .portal-button svg,
.portal-page .clinic-button svg{
  width:16px!important;
  height:16px!important;
  flex:0 0 16px;
}
.portal-page .button-row,
.portal-page .form-actions,
.portal-page .portal-form-actions,
.portal-page .pro-ops-actions,
.portal-page .pro-row-actions,
.portal-page .pro-doc-actions,
.portal-page .pro-request-actions,
.portal-page .mh-source-doc-actions,
.portal-page .mh-consent-row-actions-v39{
  flex-wrap:wrap!important;
  max-width:100%;
}
.portal-page .panel-head > .action-button,
.portal-page .panel-head > .clinic-button,
.portal-page .panel-head > a{
  flex:0 0 auto;
}

/* 4) Tables: single horizontal scroll owner and readable hierarchy. */
.portal-page .panel-table-wrap,
.portal-page .table-scroll,
.portal-page .portal-table-wrap{
  width:100%;
  max-width:100%;
  min-width:0;
  overflow-x:auto!important;
  overflow-y:visible;
  -webkit-overflow-scrolling:touch;
  overscroll-behavior-inline:contain;
  scrollbar-gutter:stable;
}
.portal-page .panel-table-wrap:after{content:none!important;display:none!important}
.portal-page .panel-table{
  width:100%!important;
  min-width:640px!important;
  border-collapse:collapse!important;
  table-layout:auto;
}
.portal-page .panel-table:has(th:nth-child(6)){min-width:820px!important}
.portal-page .panel-table:has(th:nth-child(7)){min-width:940px!important}
.portal-page .panel-table:has(th:nth-child(8)){min-width:1060px!important}
.portal-page .panel-table th{
  padding:12px 13px!important;
  color:#778983!important;
  font-size:11.5px!important;
  line-height:1.3!important;
  font-weight:800!important;
  letter-spacing:.055em!important;
  text-transform:uppercase;
  white-space:nowrap;
  vertical-align:middle;
}
.portal-page .panel-table td{
  padding:13px!important;
  color:#526862!important;
  font-size:13px!important;
  line-height:1.45!important;
  vertical-align:middle!important;
  overflow-wrap:anywhere;
}
.portal-page .panel-table td strong{
  color:#203d36!important;
  font-size:13.5px!important;
  line-height:1.35!important;
  font-weight:750!important;
}
.portal-page .panel-table td small{
  display:block;
  margin-top:3px;
  color:#8a9994!important;
  font-size:12px!important;
  line-height:1.4!important;
}
.portal-page .panel-table td .action-button,
.portal-page .panel-table td .clinic-button,
.portal-page .panel-table td .status-badge{
  white-space:nowrap!important;
  overflow-wrap:normal;
}
.portal-page .table-name{
  min-width:150px!important;
  max-width:320px;
  grid-template-columns:auto minmax(0,1fr);
}
.portal-page .table-name > div{min-width:0}
.portal-page .table-name strong,
.portal-page .table-name small{overflow-wrap:anywhere}
.portal-page .panel-table details{max-width:320px}
.portal-page .panel-table details .portal-form{min-width:240px}

/* 5) Form controls: stop mixed 43/46/48/50px heights and label/help inversion. */
.portal-page .portal-form .form-grid,
.portal-page .form-grid{
  grid-template-columns:repeat(2,minmax(0,1fr))!important;
  gap:13px!important;
}
.portal-page .portal-form label,
.portal-page .form-grid label{
  min-width:0;
  gap:7px!important;
}
.portal-page .portal-form label > span,
.portal-page .form-grid label > span,
.portal-page .doctor-profile-form label > span,
.portal-page .doctor-consultation-field > span{
  color:#536a63!important;
  font-size:12.5px!important;
  line-height:1.35!important;
  font-weight:750!important;
}
.portal-page .portal-form input:not([type=checkbox]):not([type=radio]),
.portal-page .portal-form select,
.portal-page .portal-form textarea,
.portal-page .form-grid input:not([type=checkbox]):not([type=radio]),
.portal-page .form-grid select,
.portal-page .form-grid textarea,
.portal-page .filter-bar input,
.portal-page .filter-bar select{
  width:100%!important;
  min-width:0!important;
  max-width:100%!important;
  min-height:48px!important;
  height:auto;
  border:1px solid #d6e3de!important;
  border-radius:12px!important;
  background:#fff!important;
  color:#263f39!important;
  padding:11px 13px!important;
  font-size:14px!important;
  line-height:1.4!important;
  box-shadow:none!important;
}
.portal-page .portal-form select,
.portal-page .form-grid select,
.portal-page .filter-bar select{padding-right:34px!important}
.portal-page .portal-form textarea,
.portal-page .form-grid textarea{
  min-height:108px!important;
  resize:vertical;
}
.portal-page .portal-form input[type=file],
.portal-page .form-grid input[type=file]{padding:8px 10px!important}
.portal-page input[type=checkbox],
.portal-page input[type=radio]{
  width:18px!important;
  height:18px!important;
  min-width:18px!important;
  min-height:18px!important;
  padding:0!important;
  flex:0 0 18px;
  accent-color:#087c69;
}
.portal-page .portal-form input::placeholder,
.portal-page .portal-form textarea::placeholder,
.portal-page .form-grid input::placeholder,
.portal-page .form-grid textarea::placeholder{color:#9aa7a3!important;opacity:1}
.portal-page .portal-form input:focus,
.portal-page .portal-form select:focus,
.portal-page .portal-form textarea:focus,
.portal-page .form-grid input:focus,
.portal-page .form-grid select:focus,
.portal-page .form-grid textarea:focus,
.portal-page .filter-bar input:focus,
.portal-page .filter-bar select:focus{
  outline:0!important;
  border-color:#79bfae!important;
  box-shadow:0 0 0 4px rgba(8,124,105,.07)!important;
}
.portal-page .form-help,
.portal-page .portal-form label > small,
.portal-page .form-grid label > small{
  color:#879690!important;
  font-size:12px!important;
  line-height:1.5!important;
}
.portal-page .portal-form-actions{
  display:flex!important;
  align-items:center!important;
  justify-content:flex-end!important;
  gap:8px!important;
}
.portal-page fieldset{min-width:0;max-width:100%}

/* Filter bars should not produce fake horizontal scroll. */
.portal-page .filter-bar{
  min-width:0;
  max-width:100%;
  gap:9px!important;
}
.portal-page .filter-bar input{flex:1 1 240px!important}
.portal-page .filter-bar select{flex:0 1 210px!important}

/* Dialogs/forms inside cards cannot escape viewport. */
.portal-page .portal-dialog,
.portal-page .portal-dialog-inner{
  max-width:calc(100vw - 24px)!important;
}
.portal-page .portal-dialog-inner{overflow-wrap:anywhere}

/* Responsive QA breakpoints */
@media(max-width:1180px){
  .portal-page .metric-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .portal-doktor .doctor-kpi-grid,
  .portal-doktor .mh-visibility-kpis,
  .portal-doktor .mh-consent-kpis-v38,
  .portal-doktor .mh-consent-kpis-v39,
  .portal-doktor .mh-consent-method-grid-v38,
  .portal-doktor .mh-consent-method-grid-v39{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .portal-doktor .doctor-ops-overview{grid-template-columns:repeat(3,minmax(0,1fr))!important}
}
@media(max-width:820px){
  .portal-page .panel-card{padding:16px!important;border-radius:18px!important}
  .portal-page .panel-card.flush{padding:0!important}
  .portal-page .panel-card.flush > .panel-head,
  .portal-page .flush > .panel-head{padding:17px 16px 0!important}
  .portal-page .panel-head{gap:10px!important}
  .portal-page .panel-head > div:first-child{flex-basis:100%}
  .portal-page .panel-head > .action-button,
  .portal-page .panel-head > .clinic-button{flex:1 1 auto}
  .portal-page .metric-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:8px!important}
  .portal-page .metric-card{min-height:108px!important;padding:13px!important;grid-template-columns:36px minmax(0,1fr)!important;gap:9px!important}
  .portal-page .metric-copy strong{font-size:23px!important}
  .portal-page .quick-action{grid-template-columns:36px minmax(0,1fr) auto!important}
  .portal-page .portal-form .form-grid,
  .portal-page .form-grid{grid-template-columns:1fr!important}
  .portal-page .portal-form .form-full,
  .portal-page .form-grid .wide{grid-column:auto!important}
  .portal-page .portal-form input:not([type=checkbox]):not([type=radio]),
  .portal-page .portal-form select,
  .portal-page .portal-form textarea,
  .portal-page .form-grid input:not([type=checkbox]):not([type=radio]),
  .portal-page .form-grid select,
  .portal-page .form-grid textarea,
  .portal-page .filter-bar input,
  .portal-page .filter-bar select{font-size:16px!important}
  .portal-page .portal-form-actions{align-items:stretch!important;flex-direction:column-reverse!important}
  .portal-page .portal-form-actions > *{width:100%!important}
  .portal-page .filter-bar{display:grid!important;grid-template-columns:1fr!important}
  .portal-page .filter-bar input,
  .portal-page .filter-bar select,
  .portal-page .filter-bar .action-button{width:100%!important;min-width:0!important;margin-left:0!important}
  .portal-page .panel-table{min-width:620px!important}
  .portal-page .panel-table:has(th:nth-child(6)){min-width:820px!important}
  .portal-page .panel-table:has(th:nth-child(7)){min-width:930px!important}
  .portal-page .panel-table:has(th:nth-child(8)){min-width:1040px!important}
  .portal-doktor .doctor-ops-overview{grid-template-columns:repeat(2,minmax(0,1fr))!important}
}
@media(max-width:480px){
  .portal-page .panel-head > .action-button,
  .portal-page .panel-head > .clinic-button{width:100%!important;flex-basis:100%}
  .portal-page .quick-action{grid-template-columns:34px minmax(0,1fr)!important;align-items:start!important}
  .portal-page .quick-action > span{grid-column:2;text-align:left;max-width:none}
  .portal-doktor .mh-consent-method-grid-v38,
  .portal-doktor .mh-consent-method-grid-v39{grid-template-columns:1fr!important}
}

/* 6) Custom clinic/admin surfaces use the same QA rules. */
.portal-page .marketing-card,
.portal-page .commercial-admin-card,
.portal-page .marketing-grid > *,
.portal-page .commercial-admin-grid > *{min-width:0;max-width:100%}
.portal-page .marketing-table-wrap{
  width:100%;
  max-width:100%;
  min-width:0;
  overflow-x:auto!important;
  -webkit-overflow-scrolling:touch;
  overscroll-behavior-inline:contain;
  scrollbar-gutter:stable;
}
.portal-page .marketing-table{
  width:100%!important;
  min-width:760px!important;
}
.portal-page .marketing-table th{
  padding:12px 13px!important;
  font-size:11.5px!important;
  line-height:1.3!important;
}
.portal-page .marketing-table td{
  padding:13px!important;
  font-size:13px!important;
  line-height:1.45!important;
}
.portal-page .marketing-table strong{font-size:13.5px!important}
.portal-page .marketing-table small{font-size:12px!important;line-height:1.4!important}
.portal-page .marketing-mini-btn{
  min-height:36px!important;
  height:auto!important;
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  gap:6px!important;
  max-width:100%;
  padding:7px 10px!important;
  border-radius:9px!important;
  font-size:12px!important;
  line-height:1.2!important;
  text-align:center;
  white-space:normal!important;
}
.portal-page .marketing-row-actions{display:flex;align-items:center;gap:6px;flex-wrap:wrap;min-width:0}
.portal-page .marketing-row-actions select{max-width:100%!important;min-height:38px}
.portal-page .panel-table details .portal-form,
.portal-page .marketing-table details form{
  width:min(320px,calc(100vw - 52px))!important;
  min-width:0!important;
  max-width:100%!important;
}
.portal-page .commercial-admin-card input:not([type=checkbox]):not([type=radio]),
.portal-page .commercial-admin-card select,
.portal-page .commercial-admin-card textarea{
  width:100%;
  min-width:0;
  max-width:100%;
  min-height:44px;
  border:1px solid #d6e3de;
  border-radius:11px;
  padding:9px 11px;
  background:#fff;
  color:#263f39;
  font-size:14px;
}

/* 7) Very long content should expand vertically, never force a card sideways. */
.portal-page .panel-card,
.portal-page .metric-card,
.portal-page .quick-action,
.portal-page .pro-surface,
.portal-page .marketing-card,
.portal-page .commercial-admin-card{
  overflow-wrap:anywhere;
  word-break:normal;
}

/* ======================================================================
   MostHelt V3.13 — Site-wide card / button / table / mobile UX hardening
   2026-09-02
   Scope: public pages + portal surfaces. Loaded last.
   ====================================================================== */

/* Universal geometry safety. */
html{overflow-x:clip}
body:not(.mh-hospital-document),
body:not(.mh-hospital-document) * ,
body:not(.mh-hospital-document) *::before,
body:not(.mh-hospital-document) *::after{box-sizing:border-box}
body:not(.mh-hospital-document) :where(main,section,article,aside,header,footer,nav,form,fieldset,div){min-width:0}
body:not(.mh-hospital-document) :where(img,video,canvas,iframe,svg){max-width:100%}
body:not(.mh-hospital-document) :where(h1,h2,h3,h4,h5,h6,p,li,dd,dt,strong,small,span){overflow-wrap:anywhere}

/* Public + portal card geometry: calm radius, predictable borders and no width leaks. */
:where(
  .mh-card,.panel-card,.metric-card,.filter-card,.safe-card,.doctor-result-card,
  .clinic-result-card,.unified-directory-card,.mh13-card,.mh13-side-card,.mh13-service-card,
  .mh13-education-card,.mh13-booking-card,.mh13-booking-card-new,.cg-card,.cg-side-card,
  .cg-placeholder-card,.sec-card,.sec-protection-card,.sec-flow-card,.legal-sec-card,
  .public-form-card,.setup-card,.portal-entry-card,.role-card,.sales-plan-card,.sales-summary-card,
  .pay-card,.directory-card,.directory-profile-card,.directory-info-panel,.directory-source-panel,
  .video-wait-card,.video-sidecard,.video-frame-card,.af-card,.mhc-card,.module-page-card,
  .specialty-demo-card,.page-cta-card,.marketing-card,.commercial-admin-card,.builder-side-card,
  .pro-video-setup-card,.doctor-kpi-card,.pro-surface,.mh-consent-template-card-v39
){max-width:100%;min-width:0}

/* Action controls: protect tap area and prevent long Turkish labels from clipping. */
:where(
  button,.btn,.button,.action-button,.portal-button,.clinic-button,.secretariat-button,
  .link-button,.link-action,.soft-action,.profile-btn,.book-btn,.pay-button,.sec-button,
  .mh13-primary-btn,.mh13-secondary-btn,.video-primary-button,.video-test-button,
  .result-search-btn,.result-mode-btn,.home-v3-button,.mh-auth-full-button,.marketing-mini-btn
){max-width:100%;text-wrap:balance}
:where(
  .action-button,.portal-button,.clinic-button,.secretariat-button,.link-button,.soft-action,
  .profile-btn,.book-btn,.pay-button,.sec-button,.mh13-primary-btn,.mh13-secondary-btn,
  .video-primary-button,.video-test-button,.result-search-btn,.home-v3-button,.mh-auth-full-button
){min-height:44px;height:auto;align-items:center;justify-content:center;line-height:1.2}

/* Action rows must wrap instead of pushing the page sideways. */
:where(
  .actions,.mh-actions,.nav-actions,.hero-actions,.sales-hero-actions,.pay-actions,.button-row,
  .form-actions,.portal-form-actions,.registration-actions,.clinic-subpage-actions,
  .marketing-hero-actions,.marketing-form-actions,.marketing-row-actions,.table-actions,
  .unified-directory-actions,.mh13-inline-actions,.mh13-location-actions,.mh-empty-actions,
  .pro-ops-actions,.pro-row-actions,.pro-doc-actions,.pro-request-actions,.doctor-sticky-actions,
  .tracking-buttons,.tracking-action,.mhc-actions,.sec-actions
){display:flex;flex-wrap:wrap;gap:8px;min-width:0;max-width:100%}

/* Runtime-created wrapper for tables that did not already have one. */
.mh-table-scroll{
  position:relative;
  width:100%;
  max-width:100%;
  min-width:0;
  overflow-x:auto;
  overflow-y:visible;
  -webkit-overflow-scrolling:touch;
  overscroll-behavior-inline:contain;
  scrollbar-gutter:stable;
  border-radius:inherit;
}
.mh-table-scroll:focus-visible{outline:3px solid rgba(8,124,105,.20);outline-offset:2px}
.mh-table-scroll > table{width:100%;min-width:640px}
.mh-table-scroll > table:has(th:nth-child(6)){min-width:820px}
.mh-table-scroll > table:has(th:nth-child(8)){min-width:1040px}
.mh-table-scroll th{white-space:nowrap}
.mh-table-scroll :where(td,th){vertical-align:middle}

/* Tabs and segmented controls stay usable on small widths without shrinking labels to unreadable sizes. */
:where(
  .marketing-tabs,.mh13-section-tabs,.client360-tabs,.clinic-segmented,.mh-consent-tabs-v39,
  .specialty-jump-nav,.pro-directory-toolbar
){max-width:100%;min-width:0}

/* Dialog / modal containment. */
:where(.portal-dialog,.appointment-dialog,.mh-consent-dialog,.mh-pdf-sign-dialog){max-width:calc(100vw - 20px)!important}
:where(.portal-dialog-inner,.appointment-dialog>*,.mh-consent-dialog .portal-dialog-inner,.mh-pdf-sign-dialog){max-height:calc(100dvh - 28px);overflow-y:auto;overscroll-behavior:contain}

/* Forms: all fields stay inside cards; controls remain finger-friendly. */
body:not(.mh-hospital-document) :where(input:not([type=checkbox]):not([type=radio]),select,textarea){max-width:100%}
body:not(.mh-hospital-document) textarea{resize:vertical}
body:not(.mh-hospital-document) :where(input,select,textarea,button){touch-action:manipulation}

/* Known copy surfaces that legacy rules forced onto a single line. */
.portal-page :where(
  .clinic-schedule-person b,.clinic-schedule-person span,.clinic-client-row b,.clinic-client-row span,
  .minimal-schedule-copy b,.minimal-schedule-copy small,.minimal-client-list b,
  .clinic-directory-person b,.clinic-directory-person small,.clinic-directory-next b,.clinic-directory-next small,
  .clinic-appointment-person b,.clinic-appointment-person small,.clinic-appointment-meta b,.clinic-appointment-meta small,
  .pro-client-person b,.pro-client-person small,.pro-appointment-person b,.pro-video-session-person b
){max-width:100%;overflow:hidden;text-overflow:ellipsis}

@media(max-width:900px){
  /* Fixed desktop hero copy widths should collapse naturally. */
  :where(
    .inner-hero-copy>p,.specialties-hero-content>p,.directory-hero-content>p,.automation-copy>p,
    .shared-core-grid>div>p,.cg-hero p,.cg-empty p,.cg-placeholder-intro>div,
    .sales-page [class*="hero"] p,.ai-sales-v2 .ai-v2-hero h1,.ai-sales-v2 .ai-v2-hero-lead,
    .ai-sales-v2 .ai-v2-hero-note,.ai-sales-v2 .ai-v2-section-intro,
    .portal-entry-intro,.portal-entry-intro p,.public-form-hero p,.public-form-submit p,
    .portal-klinik .clinic-subpage-head p,.portal-klinik .home-v3-heading p,
    .portal-doktor .pro-public-request-head-copy,.portal-doktor .pro-public-request-inbox .pro-public-request-head-copy p,
    .pro-video-hero-copy,.pro-video-hero-copy p,.mh-consent-title-v39,.mh-consent-title-v39 p
  ){width:auto!important;max-width:100%!important}

  /* Horizontal tab strips: thumb-scroll instead of crushed multi-line pills. */
  :where(.marketing-tabs,.mh13-section-tabs,.client360-tabs,.clinic-segmented,.mh-consent-tabs-v39,.specialty-jump-nav){
    display:flex!important;
    flex-wrap:nowrap!important;
    overflow-x:auto!important;
    overflow-y:hidden;
    -webkit-overflow-scrolling:touch;
    scrollbar-width:none;
    overscroll-behavior-inline:contain;
  }
  :where(.marketing-tabs,.mh13-section-tabs,.client360-tabs,.clinic-segmented,.mh-consent-tabs-v39,.specialty-jump-nav)::-webkit-scrollbar{display:none}
  :where(.marketing-tabs a,.mh13-section-tabs a,.client360-tabs button,.clinic-segmented button,.mh-consent-tabs-v39 button,.specialty-jump-nav a){flex:0 0 auto;white-space:nowrap!important}

  /* Long identity/meta rows may wrap rather than overflow. */
  .portal-page :where(
    .clinic-schedule-person b,.clinic-schedule-person span,.clinic-client-row b,.clinic-client-row span,
    .minimal-schedule-copy b,.minimal-schedule-copy small,.minimal-client-list b,
    .clinic-directory-person b,.clinic-directory-person small,.clinic-directory-next b,.clinic-directory-next small,
    .clinic-appointment-person b,.clinic-appointment-person small,.clinic-appointment-meta b,.clinic-appointment-meta small,
    .pro-client-person b,.pro-client-person small,.pro-appointment-person b,.pro-video-session-person b,
    .topbar-copy h1
  ){white-space:normal!important;overflow:visible;text-overflow:clip}

  /* Remove desktop-only fixed card heights where content can grow on tablets/phones. */
  :where(
    .module-page-card,.dual-card,.specialty-detail,.specialty-demo-card,.cg-card,.cg-placeholder-card,
    .role-card,.portal-entry-card,.sales-plan-card,.video-frame-card,.pro-video-setup-card,
    .mh-consent-template-card-v39
  ){height:auto!important;min-height:0!important}
}

@media(max-width:640px){
  body:not(.mh-hospital-document){overflow-x:hidden}
  body:not(.mh-hospital-document) :where(input:not([type=checkbox]):not([type=radio]),select,textarea){font-size:16px!important;min-height:46px}

  /* Main CTAs / destructive actions become easy to tap, while tiny icon controls stay compact. */
  :where(
    .form-actions,.portal-form-actions,.registration-actions,.clinic-subpage-actions,.marketing-form-actions,
    .pay-actions,.mh-empty-actions,.pro-request-actions,.doctor-sticky-actions,.tracking-buttons
  ){align-items:stretch!important}
  :where(
    .form-actions,.portal-form-actions,.registration-actions,.clinic-subpage-actions,.marketing-form-actions,
    .pay-actions,.mh-empty-actions,.pro-request-actions,.doctor-sticky-actions,.tracking-buttons
  ) > :where(a,button,input[type=submit]){flex:1 1 100%;width:100%;min-height:46px}

  /* Two/three-button action rows use the available width evenly. */
  :where(.actions,.mh-actions,.hero-actions,.sales-hero-actions,.mh13-inline-actions,.mh13-location-actions,.sec-actions) > :where(a,button){flex:1 1 150px}

  .mh-table-scroll{margin-inline:0;border-radius:12px}
  .mh-table-scroll > table{min-width:620px}
  .mh-table-scroll::after{
    content:"Yatay kaydırın →";
    position:sticky;
    left:10px;
    display:inline-block;
    margin:8px 0 2px;
    padding:5px 8px;
    border:1px solid #dce8e3;
    border-radius:999px;
    background:rgba(255,255,255,.94);
    color:#70847d;
    font-size:10.5px;
    font-weight:750;
    line-height:1;
    pointer-events:none;
  }

  /* Card padding / typography guardrails for legacy public surfaces. */
  :where(
    .mh-card,.filter-card,.safe-card,.doctor-result-card,.clinic-result-card,.unified-directory-card,
    .mh13-card,.mh13-side-card,.cg-card,.cg-side-card,.sec-protection-card,.sec-flow-card,
    .legal-sec-card,.public-form-card,.setup-card,.portal-entry-card,.sales-plan-card,.sales-summary-card,
    .pay-card,.directory-card,.directory-profile-card,.directory-info-panel,.directory-source-panel,
    .video-wait-card,.video-sidecard,.af-card,.mhc-card,.module-page-card,.specialty-demo-card,.page-cta-card
  ){max-width:100%;overflow-wrap:anywhere}

  /* Drawers/modals must respect device safe area and never exceed viewport height. */
  :where(.portal-dialog,.appointment-dialog,.mh-consent-dialog){width:calc(100vw - 20px)!important;max-width:calc(100vw - 20px)!important;margin-inline:auto!important}
  .mh-pdf-sign-dialog{width:100%!important;max-width:100%!important}
  :where(.portal-dialog-inner,.mh-consent-dialog .portal-dialog-inner){width:100%!important;max-width:100%!important}
}

@media(max-width:390px){
  /* Dense KPI grids become one column only on very narrow devices. */
  .portal-page .metric-grid,
  .portal-doktor .doctor-kpi-grid,
  .portal-doktor .mh-visibility-kpis,
  .portal-doktor .mh-consent-kpis-v38,
  .portal-doktor .mh-consent-kpis-v39,
  .portal-doktor .doctor-ops-overview{grid-template-columns:1fr!important}
}

/* V3.13.1 — final mobile overflow pass for secondary action systems. */
:where(.pro-wait-actions,.mh-pdf-sign-actions,.mh-pdf-complete-actions,.video-actions,.directory-card-foot,.marketing-card-head,.clinic-panel-head){min-width:0;max-width:100%;flex-wrap:wrap}
@media(max-width:640px){
  :where(
    .action-button,.portal-button,.clinic-button,.secretariat-button,.link-button,.soft-action,
    .profile-btn,.book-btn,.pay-button,.sec-button,.mh13-primary-btn,.mh13-secondary-btn,
    .video-primary-button,.video-test-button,.result-search-btn,.home-v3-button,.mh-auth-full-button,
    .marketing-mini-btn
  ){white-space:normal!important;overflow-wrap:anywhere}
  :where(.marketing-card-head>a,.clinic-panel-head>a,.cg-placeholder-intro>a){white-space:normal!important;max-width:100%}
  :where(.pro-wait-actions,.mh-pdf-sign-actions,.mh-pdf-complete-actions,.video-actions) > :where(a,button){flex:1 1 120px;min-height:44px}
}
