.tabs{direction:rtl}.tabs .tab{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px}.tabs .tab:before{display:block;font-size:19px;line-height:1}.tabs .tab[data-panel="home"]:before{content:"⌂"}.tabs .tab[data-panel="meds"]:before{content:"✚"}.tabs .tab[data-panel="history"]:before{content:"☷"}.tabs .tab[data-panel="settings"]:before{content:"⚙"}.layout-edit38{border:1px solid #ddd5e5;border-radius:11px;background:#f3edf9;color:#68429d;padding:9px 12px;font-weight:850}.med-toolbar .layout-edit38{margin-inline-start:auto}.layout-hint38{position:fixed;left:50%;bottom:92px;transform:translateX(-50%);z-index:100;width:min(520px,calc(100% - 28px));padding:12px 16px;border-radius:14px;background:#6f48a5;color:#fff;text-align:center;font-weight:800;box-shadow:0 10px 28px #0005}.layout-editing38 #latest .card,.layout-editing38 #medList .med,.layout-editing38 #home>#weatherStrip,.layout-editing38 #home>.page-heading,.layout-editing38 #home>#upcomingSection,.layout-editing38 #home>.alerts-banner{outline:2px dashed #a97cf1;outline-offset:2px;touch-action:none;cursor:grab;animation:wiggle38 .22s ease-in-out infinite alternate}.dragging38{opacity:.6!important;transform:scale(.98)!important;animation:none!important;cursor:grabbing!important}.family-member span small{display:block;color:#7c7482;margin-top:3px}.family-member38{display:grid!important;grid-template-columns:1fr auto;gap:10px;align-items:center}.member-editor38{grid-column:1/-1;border-top:1px solid #ddd5e5;padding-top:10px;display:grid;gap:9px}.member-editor38[hidden]{display:none}.member-editor38 .field{margin:0}.member-editor-actions38,.password-wrap38{display:flex;gap:8px;align-items:center}.password-wrap38 input{flex:1}.password-wrap38 button,.member-edit38{border:0;border-radius:10px;padding:10px 12px;background:#eee7f7;color:#68429d;font-weight:800}.member-save38{border:0;border-radius:11px;padding:12px;background:#7650b4;color:#fff;font-weight:850;flex:1}.member-status38{font-size:13px;min-height:18px}.member-result38{display:grid;gap:5px;margin-top:12px;padding:12px;border-radius:12px}.member-result38.success{background:#e9f8ef;color:#166534}.member-result38.error{background:#fff0ee;color:#a1261d}.member-result38 span{font-family:ui-monospace,monospace;direction:ltr;text-align:start}@keyframes wiggle38{from{transform:rotate(-.35deg)}to{transform:rotate(.35deg)}}html[data-theme="dark"] .layout-edit38{background:#342c3d;color:#c9a8ff;border-color:#4d4555}html[data-theme="dark"] .member-result38.success{background:#183527;color:#9ee2b5}html[data-theme="dark"] .member-result38.error{background:#492d32;color:#ffb1b8}html[data-theme="dark"] .member-editor38{border-color:#4d4555}html[data-theme="dark"] .password-wrap38 button,html[data-theme="dark"] .member-edit38{background:#342c3d;color:#c9a8ff}@media(max-width:560px){.tabs .tab{font-size:11px!important}.layout-edit38{padding:8px 10px}.layout-hint38{bottom:104px;font-size:13px}}

/* v43: final iPhone layout layer (SE through Pro Max, portrait and landscape). */
html,body{width:100%;max-width:100%;overflow-x:hidden}
button,input,select,textarea{max-width:100%}
.grid>*,:is(.appointment-cards,.report-checks,.report-dates,.report-actions,.settings-actions,.medicine-form-actions,.reorder-row)>*{min-width:0}
.sheet{overscroll-behavior:contain}
@supports(height:100dvh){.sheet{max-height:calc(100dvh - max(10px,env(safe-area-inset-top)))}}
@media(max-width:560px){
  body{min-width:0}
  .app{width:100%;max-width:100%;padding-top:max(14px,env(safe-area-inset-top));padding-right:max(12px,env(safe-area-inset-right));padding-bottom:calc(130px + env(safe-area-inset-bottom));padding-left:max(12px,env(safe-area-inset-left))}
  header{width:100%;min-height:58px;margin-bottom:7px}
  #themeBtn,#accountBtn{width:44px!important;min-width:44px!important;height:44px!important}
  #themeBtn{left:0!important}
  #accountBtn{right:0!important}
  #langBtn{right:52px!important;height:44px!important;max-width:92px;padding:8px 10px!important;white-space:nowrap}
  .hospital-file{left:37%!important;max-width:124px!important;overflow:hidden;text-overflow:ellipsis}
  #cloudStatus{max-width:calc(100% - 20px);overflow-wrap:anywhere}
  .tabs{left:max(12px,env(safe-area-inset-left))!important;right:max(12px,env(safe-area-inset-right))!important;bottom:max(8px,env(safe-area-inset-bottom))!important;width:auto!important;min-height:64px;padding:6px!important;gap:3px!important;border-radius:20px}
  .tabs .tab{min-width:0!important;min-height:52px;padding:6px 3px!important;font-size:11px!important;line-height:1.15;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .tabs .tab:before{font-size:18px}
  #buildBadge{bottom:calc(84px + env(safe-area-inset-bottom))!important}
  .page-heading{grid-template-columns:minmax(0,1fr) auto;gap:8px}
  .page-heading h2,.section-title,.section-row h3{overflow-wrap:anywhere}
  .home-actions{max-width:132px}
  .home-actions .add,.appointment-add{width:100%!important;white-space:normal;line-height:1.2}
  .grid{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:9px!important}
  .card{width:100%;min-width:0;min-height:108px!important;padding:11px 10px!important}
  .card .card-label{min-width:0;font-size:13px!important;gap:7px!important}
  .card .card-label:not(.metric-icon){overflow-wrap:anywhere}
  .card strong{font-size:21px!important;letter-spacing:-.25px!important;overflow-wrap:anywhere}
  .card small{font-size:11px!important;line-height:1.3!important;overflow-wrap:anywhere}
  .card-inr strong,.card-catheter strong,.card strong.countdown{font-size:18px!important}
  .appointment-cards{grid-template-columns:1fr!important}
  .appointment-mini,.alert-row,.history-item,.activity-row{min-width:0;overflow-wrap:anywhere}
  .alert-row{grid-template-columns:36px minmax(0,1fr) 10px;gap:8px}
  .history-head{gap:8px}.history-actions{display:grid;grid-template-columns:1fr 1fr}
  .history-add,.history-all{min-height:44px}
  .history-switch{max-width:100%;padding-bottom:6px}
  .audit-row{grid-template-columns:36px minmax(0,1fr);gap:9px}.audit-row>*:last-child{grid-column:2}
  .med-toolbar{gap:8px}.med-toolbar>div{gap:6px!important}
  #addMed{min-height:42px;white-space:normal}
  #medList:not(.grid-view) .med{grid-template-columns:76px minmax(0,1fr)!important;padding:11px}
  #medList:not(.grid-view) .med-photo{width:76px;height:76px;min-width:76px}
  #medList.grid-view{grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}
  #medList.grid-view .med{width:100%;min-width:0;min-height:0!important;height:auto!important;padding:10px 9px 13px}
  #medList.grid-view .med-photo{height:116px!important;min-height:116px!important;flex-basis:116px!important}
  #medList.grid-view .med-info{min-height:104px!important;padding:0 1px 10px}
  #medList.grid-view .med-info b{font-size:13px;line-height:1.25}
  .med-actions{gap:7px!important}.med-actions button{min-height:44px!important;font-size:13px!important;padding:9px 5px!important}
  .sheet{width:100%;max-width:100%;padding:17px max(14px,env(safe-area-inset-right)) calc(18px + env(safe-area-inset-bottom)) max(14px,env(safe-area-inset-left));border-radius:22px 22px 0 0}
  .sheet-head{position:sticky;top:-17px;z-index:2;margin:-17px -2px 10px;padding:17px 2px 8px;background:inherit}
  .sheet-head h2{min-width:0;font-size:23px;overflow-wrap:anywhere}
  .close{flex:0 0 40px}
  .choices{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.choice{min-width:0;min-height:82px;padding:13px 8px;overflow-wrap:anywhere}
  .field input,.field select,.field textarea{font-size:16px;min-height:46px}
  .row{grid-template-columns:repeat(2,minmax(0,1fr))}
  .settings-grid,.settings-card,.layout-editor-card{min-width:0}
  .settings-actions{grid-template-columns:repeat(2,minmax(0,1fr))}
  .settings-actions button,.settings-actions label{min-width:0;overflow-wrap:anywhere}
  .family-member38{grid-template-columns:minmax(0,1fr) auto!important}
  .member-editor38{min-width:0}.password-wrap38{align-items:stretch}.password-wrap38 input{min-width:0}.password-wrap38 button{flex:0 0 auto}
  .report-preview-doc{padding:12px;max-height:55dvh;overflow:auto}.report-document{min-width:560px}.report-preview-doc{overflow-x:auto}
  .report-dates input[type="date"]{font-size:14px!important;padding-inline:5px!important}
  .undo-toast{inset-inline:max(12px,env(safe-area-inset-left));bottom:calc(84px + env(safe-area-inset-bottom))}
}
@media(max-width:390px){
  .hospital-file{left:36%!important;max-width:112px!important}.hospital-file span{font-size:10px!important}.hospital-file b{font-size:12px!important}
  #langBtn{max-width:82px;font-size:12px!important;padding-inline:8px!important}
  .page-heading{grid-template-columns:minmax(0,1fr) 116px}.page-heading h2{font-size:20px}
  #medList.grid-view .med-photo{height:104px!important;min-height:104px!important;flex-basis:104px!important}
  #medList.grid-view .med-info{min-height:112px!important}
  .reorder-row{grid-template-columns:22px minmax(0,1fr) 38px 38px!important;gap:4px!important}
}
@media(max-width:350px){
  .hospital-file{display:none}
  .tabs .tab{font-size:10px!important}.tabs .tab:before{font-size:17px}
  .page-heading{grid-template-columns:1fr}.home-actions{grid-column:1;width:100%;max-width:none;grid-template-columns:1fr 1fr}
  .card .metric-icon{width:28px!important;height:28px!important;min-width:28px!important;flex-basis:28px!important}
  .card strong{font-size:19px!important}.card-inr strong,.card-catheter strong{font-size:16px!important}
  #medList.grid-view{grid-template-columns:1fr}
  #medList.grid-view .med-photo{height:145px!important;min-height:145px!important;flex-basis:145px!important}
  #medList.grid-view .med-info{min-height:0!important}
  .row,.settings-actions,.medicine-form-actions,.appointment-form-actions{grid-template-columns:1fr!important}
  .medicine-form-actions .save,.appointment-form-actions .save{grid-column:1!important}
}
@media(max-height:650px) and (orientation:landscape){
  .sheet{max-height:96dvh;border-radius:18px}
  .tabs{min-height:54px}.tabs .tab{min-height:44px}
  .app{padding-bottom:110px}
}

/* v46: account-specific Liquid Glass appearance. */
.appearance-card38{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:14px;margin-bottom:14px}.appearance-card38 h3{margin:0 0 5px}.appearance-card38 p{margin:0;color:#766e7c;line-height:1.45}.glass-switch38{position:relative;display:inline-block;width:54px;height:32px;flex:0 0 54px}.glass-switch38 input{position:absolute;opacity:0;pointer-events:none}.glass-switch38 span{position:absolute;inset:0;border-radius:999px;background:#cbc4d2;box-shadow:inset 0 1px 3px #0002;transition:.22s}.glass-switch38 span:before{content:"";position:absolute;width:26px;height:26px;top:3px;left:3px;border-radius:50%;background:#fff;box-shadow:0 2px 7px #0004;transition:.22s}.glass-switch38 input:checked+span{background:#9f75eb}.glass-switch38 input:checked+span:before{transform:translateX(22px)}html[dir="rtl"] .glass-switch38 input:checked+span:before{transform:translateX(22px)}
html.liquid-glass38 body{background:linear-gradient(145deg,#d8e9ff 0%,#f4e8ff 45%,#dff8f2 100%);background-attachment:fixed}
html.liquid-glass38 body:before,html.liquid-glass38 body:after{content:"";position:fixed;z-index:-1;width:52vw;height:52vw;max-width:520px;max-height:520px;border-radius:50%;filter:blur(45px);opacity:.62;pointer-events:none}
html.liquid-glass38 body:before{top:-15vw;left:-14vw;background:#79b8ff}html.liquid-glass38 body:after{right:-18vw;bottom:4vh;background:#b88cff}
html.liquid-glass38 .app{background:transparent!important;border-color:transparent}
html.liquid-glass38 :is(.card,.med,.history-item,.appointment-mini,.alerts-banner,.weather-strip,.settings-card,.layout-editor-card,.report-group,.activity-row,.account-summary){background:linear-gradient(145deg,#ffffffa8,#ffffff62)!important;border:1px solid #ffffffb8!important;box-shadow:0 12px 34px #3d4c7620,inset 0 1px 0 #fff!important;backdrop-filter:blur(22px) saturate(145%);-webkit-backdrop-filter:blur(22px) saturate(145%)}
html.liquid-glass38 .tabs{background:linear-gradient(145deg,#ffffffb8,#ffffff78)!important;border:1px solid #ffffffc7!important;box-shadow:0 12px 32px #263a652e,inset 0 1px 0 #fff!important;backdrop-filter:blur(28px) saturate(160%);-webkit-backdrop-filter:blur(28px) saturate(160%)}
html.liquid-glass38 .tab{color:#465269}html.liquid-glass38 .tab.active{background:linear-gradient(145deg,#ffffffdf,#dfe9ffb8)!important;color:#6540a5!important;box-shadow:0 5px 15px #40598020,inset 0 1px 0 #fff}
html.liquid-glass38 :is(.sheet,#authOverlay .sheet){background:linear-gradient(145deg,#f9fbffe8,#f1eaffd6)!important;border:1px solid #ffffffd9!important;box-shadow:0 -18px 50px #28396040,inset 0 1px 0 #fff!important;backdrop-filter:blur(30px) saturate(155%);-webkit-backdrop-filter:blur(30px) saturate(155%)}
html.liquid-glass38 :is(.lang,.theme-toggle,.account-button,.edit,.photo,.view-btn,.layout-edit38,.member-edit38,.password-wrap38 button){background:linear-gradient(145deg,#ffffffc9,#ffffff73)!important;border:1px solid #ffffffc7!important;box-shadow:0 6px 18px #40517420,inset 0 1px 0 #fff!important;backdrop-filter:blur(18px);-webkit-backdrop-filter:blur(18px)}
html.liquid-glass38 .add,html.liquid-glass38 .save,html.liquid-glass38 .member-save38{background:linear-gradient(135deg,#8d69d8e8,#5f8ee8e8)!important;box-shadow:0 10px 24px #6551a945,inset 0 1px 0 #ffffff80!important}
html[data-theme="dark"].liquid-glass38 body{background:linear-gradient(145deg,#07131f 0%,#151025 48%,#071c1c 100%)}html[data-theme="dark"].liquid-glass38 body:before{background:#195da0;opacity:.42}html[data-theme="dark"].liquid-glass38 body:after{background:#672da0;opacity:.4}
html[data-theme="dark"].liquid-glass38 :is(.card,.med,.history-item,.appointment-mini,.alerts-banner,.weather-strip,.settings-card,.layout-editor-card,.report-group,.activity-row,.account-summary){background:linear-gradient(145deg,#ffffff17,#ffffff09)!important;border-color:#ffffff28!important;box-shadow:0 14px 38px #0007,inset 0 1px 0 #ffffff24!important}
html[data-theme="dark"].liquid-glass38 .tabs{background:linear-gradient(145deg,#1e2532d9,#111722c7)!important;border-color:#ffffff24!important}html[data-theme="dark"].liquid-glass38 .tab{color:#b7c1d0}html[data-theme="dark"].liquid-glass38 .tab.active{background:linear-gradient(145deg,#906be966,#4f7ed855)!important;color:#f2eaff!important}
html[data-theme="dark"].liquid-glass38 :is(.sheet,#authOverlay .sheet){background:linear-gradient(145deg,#1d2431ed,#171321e8)!important;border-color:#ffffff24!important}
html[data-theme="dark"].liquid-glass38 .appearance-card38 p{color:#aaa1b2}
@media(max-width:560px){.appearance-card38{gap:10px}.appearance-card38 p{font-size:13px}.glass-switch38{width:50px;height:30px}.glass-switch38 span:before{width:24px;height:24px}.glass-switch38 input:checked+span:before{transform:translateX(20px)}}

/* v48: controls occupy the former Rearrange position beside the title. */
@media(max-width:560px){
  .med-toolbar{display:flex!important;flex-direction:row!important;align-items:center!important;justify-content:space-between!important;gap:8px!important;margin:8px 0 12px}
  .med-toolbar .section-title{margin:8px 0!important;align-self:center;flex:0 1 auto;font-size:clamp(21px,6.2vw,27px)!important;white-space:nowrap}
  .med-toolbar>div{width:auto!important;min-width:0;display:flex!important;align-items:center;justify-content:flex-end!important;gap:5px!important;flex-wrap:nowrap!important;direction:inherit}
  .med-toolbar .view-toggle{display:flex;gap:6px;flex:0 0 auto}
  .med-toolbar .view-btn{width:42px;height:42px;padding:6px!important;flex:0 0 42px}
  .med-toolbar #addMed{width:auto;min-width:0;min-height:42px;padding:8px 10px;font-size:clamp(11px,3.2vw,14px);white-space:nowrap}
}
@media(max-width:370px){
  .med-toolbar{align-items:flex-start!important;flex-wrap:wrap}
  .med-toolbar>div{width:100%!important;justify-content:flex-start!important}
  html[dir="ltr"] .med-toolbar>div{justify-content:flex-end!important}
}

/* v49: consistent Add Record sheets on every iPhone. */
#readingForm{display:grid;grid-template-columns:minmax(0,1fr);gap:14px;width:100%;min-width:0;padding:2px 0 4px}
#readingForm>.field,#readingForm>.row,#readingForm>.photo,#readingForm>.save{width:100%;min-width:0;margin:0}
#readingForm .row{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
#readingForm .row .field{min-width:0;margin:0}
#readingForm .field{margin:0}
#readingForm .field label{margin-bottom:7px;line-height:1.3;overflow-wrap:anywhere}
#readingForm input[type="number"],#readingForm input[type="date"],#readingForm input[type="datetime-local"]{display:block;width:100%!important;max-width:100%!important;min-width:0!important;min-height:50px;padding:12px 10px!important;box-sizing:border-box;text-align:center;direction:ltr;font-variant-numeric:tabular-nums}
#readingForm input[type="date"],#readingForm input[type="datetime-local"]{-webkit-appearance:none;appearance:none}
#readingForm input[type="date"]::-webkit-date-and-time-value,#readingForm input[type="datetime-local"]::-webkit-date-and-time-value{display:block;width:100%;min-width:0;margin:0;text-align:center}
#readingForm .photo{display:flex;align-items:center;justify-content:center;gap:6px;min-height:52px;padding:12px 10px!important;border-radius:13px;text-align:center;white-space:normal;overflow-wrap:anywhere;line-height:1.25}
#readingForm #photoStatus{display:inline;min-width:0;max-width:100%;font-size:12px;overflow-wrap:anywhere}
#readingForm .save{position:static!important;display:block;transform:none!important;min-height:52px;padding:13px 16px!important;border-radius:14px}
@media(max-width:560px){
  #overlay .sheet{padding-bottom:calc(18px + env(safe-area-inset-bottom))}
  #readingForm{gap:13px}
  #readingForm .field input{font-size:16px!important}
  #readingForm .photo{font-size:15px!important}
}
@media(max-width:350px){
  #readingForm .row{grid-template-columns:1fr}
}

/* v50: a contextual exit control appears only while arranging. */
.layout-hint38{display:flex;align-items:center;justify-content:space-between;gap:12px;text-align:start}
.layout-hint38[hidden]{display:none!important}
.layout-hint38 span{min-width:0;flex:1}
.layout-hint38 button{flex:0 0 auto;border:1px solid #ffffff70;border-radius:11px;background:#fff;color:#603a96;padding:10px 14px;font-weight:900;font-size:14px;box-shadow:0 4px 12px #24143f2e}
html[data-theme="dark"] .layout-hint38 button{background:#f3eaff;color:#4d277f}
@media(max-width:390px){.layout-hint38{gap:8px;padding:10px 11px;font-size:12px}.layout-hint38 button{padding:9px 11px;font-size:13px}}
