/* Clinic phone layout; presentation only, no access or data changes. */
@media (max-width: 640px) {
  [data-testid="stMainBlockContainer"], .block-container {padding:4rem .75rem 1.5rem!important;min-width:0!important;}
  [data-testid="stMain"] {min-width:0!important;}
  [data-testid="stHorizontalBlock"] {flex-wrap:wrap!important;gap:.65rem!important;}
  [data-testid="stHorizontalBlock"] > [data-testid="stColumn"] {width:100%!important;min-width:0!important;flex:1 1 100%!important;}
  [data-testid="stForm"] {padding:14px!important;}
  .brand-header {padding:16px!important;margin-bottom:16px!important;gap:12px!important;}
  .brand-header h1,.brand-login h1 {font-size:1.45rem!important;line-height:1.35!important;}
  .brand-login {margin:0 auto 18px!important;}
  .brand-login img {max-width:240px!important;margin-bottom:16px!important;}
  input,textarea,[role="combobox"] {font-size:16px!important;}
  [data-testid="stButton"] button,[data-testid="stDownloadButton"] button,[data-testid="stFormSubmitButton"] button {min-height:44px!important;white-space:normal!important;}
  [data-testid="stButton"] button p {white-space:normal!important;overflow-wrap:anywhere;}
  [data-testid="stExpandSidebarButton"] {visibility:visible!important;display:flex!important;}
  [data-testid="stSidebar"][aria-expanded="true"] {width:min(280px,88vw)!important;min-width:0!important;max-width:88vw!important;}
  [role="tablist"] {overflow-x:auto!important;flex-wrap:nowrap!important;max-width:100%;}
  [role="tab"] {flex-shrink:0;min-height:44px!important;}
  [role="dialog"] {width:calc(100vw - 16px)!important;min-width:0!important;max-width:calc(100vw - 16px)!important;}
  [data-testid="stFileUploaderDropzone"] {padding:12px!important;}
  .st-key-ref_entry_actions [data-testid="stColumn"] {width:100%!important;flex:1 1 100%!important;}
  .st-key-ref_urgent {padding:8px!important;overflow-x:visible!important;}
  .st-key-urgent_columns,.st-key-ref_list_header {display:none!important;}
  [class*="st-key-urgent_group_"] {min-width:0!important;max-width:100%!important;border:1px solid #ddc7ac;border-radius:10px;padding:10px!important;}
  [class*="st-key-ref_row_"] {min-width:0!important;padding:12px!important;}
  [class*="st-key-ref_row_"] [data-testid="stHorizontalBlock"], [class*="st-key-urgent_group_"] [data-testid="stHorizontalBlock"] {gap:.4rem!important;}
  [class*="st-key-ref_row_"] [data-testid="stColumn"]::before,
  [class*="st-key-urgent_group_"] [data-testid="stColumn"]::before {display:block;color:#536b60;font-size:.78rem;font-weight:600;margin-top:6px;}
  [class*="st-key-ref_row_"] [data-testid="stColumn"]:nth-child(1)::before {content:"הושלם / Done";}
  [class*="st-key-ref_row_"] [data-testid="stColumn"]:nth-child(3)::before {content:"גורם מממן / Funding";}
  [class*="st-key-ref_row_"] [data-testid="stColumn"]:nth-child(4)::before {content:"מטפל ותחום / Therapist";}
  [class*="st-key-ref_row_"] [data-testid="stColumn"]:nth-child(6)::before {content:"סדרה / Sessions";}
  [class*="st-key-ref_row_"] [data-testid="stColumn"]:nth-child(7)::before {content:"טיפולוג / Tipulog";}
  [class*="st-key-ref_row_"] [data-testid="stColumn"]:nth-child(8)::before {content:"טפסים / Forms";}
  [class*="st-key-urgent_group_"] [data-testid="stColumn"]:nth-child(2)::before {content:"מטפל ותחום / Therapist";}
  [class*="st-key-urgent_group_"] [data-testid="stColumn"]:nth-child(4)::before {content:"טפסים / Forms";}
  [class*="st-key-urgent_group_"] [data-testid="stColumn"]:nth-child(5)::before {content:"אישור התחלה / Approve start";}
  [class*="st-key-urgent_group_"] [data-testid="stColumn"]:nth-child(6)::before {content:"טיפולוג / Tipulog";}
  [class*="st-key-urgent_group_"] [data-testid="stColumn"]:nth-child(7)::before {content:"הושלם / Done";}
  .st-key-ref_list_scroll {height:auto!important;max-height:none!important;overflow:visible!important;}
}
@media (max-width:640px) {
 [class*="st-key-ref_row_"] [data-testid="stHorizontalBlock"] > [data-testid="stColumn"],
 [class*="st-key-urgent_group_"] [data-testid="stHorizontalBlock"] > [data-testid="stColumn"] {width:calc(50% - .4rem)!important;flex:1 1 calc(50% - .4rem)!important;}
 [class*="st-key-ref_row_"] [data-testid="stHorizontalBlock"] > [data-testid="stColumn"]:nth-child(2),
 [class*="st-key-urgent_group_"] [data-testid="stHorizontalBlock"] > [data-testid="stColumn"]:first-child {width:100%!important;flex-basis:100%!important;order:-1;}
 [class*="st-key-urgent_group_"] [data-testid="stColumn"]:nth-child(5):not(:has(input))::before {content:none;}
}
/* Forms views: compact navigation, readable cards and bounded dialogs. */
@media(max-width:640px) {
 [data-testid="stElementContainer"]:has([data-testid="stMarkdownContainer"] > style:only-child) {display:none!important;}
 .brand-header [role="heading"] {gap:6px!important;}
 .brand-header [role="heading"] > span:first-child {font-size:24px!important;}
 .brand-header [role="heading"] > span:last-child {font-size:19px!important;}
 .st-key-patient_forms_mode {width:100%!important;}
 .st-key-patient_forms_mode [role="radiogroup"] {display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));width:100%!important;gap:8px!important;}
 .st-key-patient_forms_mode [role="radio"] {width:100%!important;min-width:0!important;min-height:44px!important;}
 .st-key-patient_forms_mode [role="radio"] p {white-space:normal!important;overflow-wrap:anywhere;}
 .st-key-sent_header {display:none!important;}
 [class*="st-key-sent_row_"] {padding:12px!important;border-radius:12px!important;min-width:0!important;}
 [class*="st-key-sent_row_"] [data-testid="stHorizontalBlock"] {gap:10px!important;}
 [class*="st-key-sent_row_"] [data-testid="stHorizontalBlock"] > [data-testid="stColumn"] {width:calc(50% - 5px)!important;flex:1 1 calc(50% - 5px)!important;min-width:0!important;}
 [class*="st-key-sent_row_"] [data-testid="stHorizontalBlock"] > [data-testid="stColumn"]:nth-child(2) {order:-3;width:100%!important;flex-basis:100%!important;}
 [class*="st-key-sent_row_"] [data-testid="stHorizontalBlock"] > [data-testid="stColumn"]:nth-child(3) {order:-2;width:100%!important;flex-basis:100%!important;border-bottom:1px solid #d7e2d7;padding-bottom:8px;}
 [class*="st-key-sent_row_"] button {width:100%!important;min-height:44px!important;}
 [class*="st-key-sent_row_"] .sent-main {font-size:15px;}
 [class*="st-key-sent_row_"] .sent-email {font-size:13px;overflow-wrap:anywhere;}
 [class*="st-key-completed_row_"] {min-width:0!important;}
 [class*="st-key-completed_row_"] [data-testid="stHorizontalBlock"] > [data-testid="stColumn"] {width:calc(50% - .4rem)!important;flex:1 1 calc(50% - .4rem)!important;}
 [class*="st-key-completed_row_"] [data-testid="stHorizontalBlock"] > [data-testid="stColumn"]:first-child {width:100%!important;flex-basis:100%!important;}
 [class*="st-key-completed_row_"] p {overflow-wrap:anywhere;}
 [class*="st-key-completed_row_"] button,[data-testid="stPopover"] button {min-height:44px!important;}
 [data-testid="stPopoverBody"] {max-width:calc(100vw - 24px)!important;min-width:0!important;box-sizing:border-box;}
 [role="dialog"] [data-testid="stVerticalBlock"] {min-width:0!important;}
 body .st-key-ref_entry_actions [data-testid="stColumn"] {width:100%!important;flex:1 1 100%!important;}
 [data-testid="stExpandSidebarButton"] button {min-width:44px!important;min-height:44px!important;}
}
@media(max-width:640px) {
 .st-key-patient_forms_mode > [data-testid="stButtonGroup"] {width:100%!important;}
 [class*="st-key-sent_row_"] [data-testid="stButton"], [class*="st-key-sent_row_"] [data-testid="stPopover"],
 [class*="st-key-completed_row_"] [data-testid="stButton"], [class*="st-key-completed_row_"] [data-testid="stDownloadButton"] {width:100%!important;}
 [class*="st-key-completed_row_"] button {width:100%!important;}
}
