/* Mobile search sheet, account controls and loan amount alignment. */
#kf-view .dashboard-account {
  display:flex;
  align-items:center;
  justify-content:space-between;
  flex-wrap:nowrap;
  gap:10px;
}
#kf-view .dashboard-account > div:first-child {
  min-width:0;
  flex:1 1 auto;
}
#kf-view .dashboard-account .account-actions {
  display:flex!important;
  flex:0 0 auto!important;
  flex-wrap:nowrap;
  width:auto!important;
  align-items:center;
  justify-content:flex-start;
  gap:8px;
  direction:rtl;
}
#kf-view .dashboard-account .account-actions .settings-btn,
#kf-view .dashboard-account .account-actions .logout-btn {
  display:inline-flex;
  flex:0 0 auto;
  align-items:center;
  justify-content:center;
  width:auto!important;
  min-width:0;
  min-height:36px;
  padding:6px 11px!important;
  border:1px solid var(--border);
  border-radius:12px;
  color:#d4e5f4;
  background:rgba(255,255,255,.04);
  white-space:nowrap;
  font:inherit;
  line-height:inherit;
}
#kf-view .dashboard-account .account-actions .settings-btn:disabled {
  opacity:.74;
  cursor:default;
  color:#b6cce2;
}
#kf-view .dashboard-account .account-actions .logout-btn:hover {
  border-color:rgba(255,116,127,.5);
  color:var(--red);
}
@media(max-width:640px){
  #kf-view .dashboard-account {gap:8px;}
  #kf-view .dashboard-account .account-actions {gap:6px;}
  #kf-view .dashboard-account .account-actions .settings-btn {
    padding:7px 9px!important;
    font-size:12px;
  }
  #kf-view .dashboard-account .account-actions .logout-btn {
    padding:6px 10px!important;
    font-size:inherit;
  }
}

/* The repaid amount is flush with the left of its cell, like other amounts. */
#dashboard .loans-table .loan-repaid-cell {
  text-align:left;
}
#dashboard .loans-table .loan-repaid-value {
  justify-content:flex-start;
  text-align:left;
  margin-left:0;
}
@media(max-width:760px){
  #dashboard .loans-table .loan-repaid-cell {
    justify-content:space-between;
  }
  #dashboard .loans-table .loan-repaid-value {
    flex:0 0 auto;
    margin-left:0;
    margin-right:auto;
  }
}

/* When the virtual keyboard shortens iOS Safari's visual viewport, keep the
   budget sheet fully inside that viewport rather than underneath the keyboard. */
@media(max-width:640px){
  .budget-activity-overlay.is-budget-search-keyboard {
    inset:auto 0 auto 0;
    top:var(--kama-keyboard-top,0px);
    height:var(--kama-keyboard-height,100dvh);
    min-height:0;
    padding:8px max(8px,env(safe-area-inset-right)) 8px max(8px,env(safe-area-inset-left));
    align-items:start;
    place-items:start center;
    overflow:hidden;
  }
  .budget-activity-overlay.is-budget-search-keyboard > .budget-activity-modal {
    max-height:calc(var(--kama-keyboard-height,100dvh) - 16px);
    height:auto;
    min-height:0;
    flex:0 1 auto;
  }
  .budget-activity-overlay.is-budget-search-keyboard .budget-activity-header {
    flex:0 0 auto;
  }
  .budget-activity-overlay.is-budget-search-keyboard .budget-activity-content,
  .budget-activity-overlay.is-budget-search-keyboard .budget-allocation-body {
    min-height:0;
    overflow-y:auto;
    overscroll-behavior:contain;
  }
  .budget-activity-overlay.is-budget-search-keyboard .budget-allocation-search-pane {
    min-height:0;
    display:flex;
    flex-direction:column;
    gap:10px;
  }
  .budget-activity-overlay.is-budget-search-keyboard .budget-center-choices {
    height:auto!important;
    max-height:max(74px,calc(var(--kama-keyboard-height,100dvh) - 205px))!important;
    min-height:0;
    overflow-y:auto!important;
  }
  .budget-activity-overlay.is-budget-search-keyboard .budget-allocation-body {
    padding:12px 15px;
  }
  .budget-activity-overlay.is-budget-search-keyboard .budget-center-filters {
    position:relative;
    z-index:1;
  }
  .budget-activity-overlay.is-budget-search-keyboard .kama-search-suggestions {
    display:none!important;
  }
}
#kf-view .kf-chart-values[open] {
  scroll-margin-top:20px;
}
@media(prefers-reduced-motion:reduce){
  #kf-view .kf-chart-values {
    scroll-behavior:auto;
  }
}
