/* Profitalyzer V50.8.8 — Money Tracker-only corrective patch. */
/* KPI cards must remain in normal document flow at every viewport. */
.mt-body .mt-summary{position:static!important;top:auto!important;inset:auto!important;z-index:auto!important}

/* Make the selected Money Tracker currency explicit beside the month controls. */
.mt-monthtools{display:flex;align-items:center;justify-content:flex-end;gap:12px;min-width:0}
.mt-currency-control{display:flex;align-items:center;gap:7px;color:var(--mt-muted);font-size:11px;font-weight:800;white-space:nowrap}
.mt-currency-control select{min-width:92px;height:38px;border:1px solid var(--mt-rule);border-radius:11px;background:var(--mt-card);color:var(--mt-text);padding:0 30px 0 10px;font:700 12px/1 var(--p6-font,Manrope,system-ui,sans-serif);outline:none}
.mt-currency-control select:focus{border-color:var(--mt-brand);box-shadow:0 0 0 3px color-mix(in srgb,var(--mt-brand) 16%,transparent)}

/* Transaction actions are deliberately visible, including on phone. */
.mt-tx-actions{display:inline-flex;align-items:center;justify-content:flex-end;gap:4px}
.mt-row-action{width:32px;height:32px;display:grid;place-items:center;border:1px solid var(--mt-rule);border-radius:10px;background:transparent;color:var(--mt-muted);cursor:pointer;padding:0}
.mt-row-action svg{width:16px;height:16px}
.mt-row-action:hover,.mt-row-action:focus-visible{background:var(--mt-soft);color:var(--mt-text);outline:none}
.mt-row-action.mt-delete{color:var(--mt-red)}
.mt-row-action.mt-delete:hover,.mt-row-action.mt-delete:focus-visible{background:color-mix(in srgb,var(--mt-red) 10%,transparent);border-color:color-mix(in srgb,var(--mt-red) 35%,var(--mt-rule))}

/* Money Tracker mobile header: logo -> Search stay together at inline-start; account/menu stay at inline-end. */
@media screen and (max-width:1179px){
  body.mt-body .top.v2-global-top .topin{display:flex!important;align-items:center!important;justify-content:flex-start!important;flex-wrap:nowrap!important}
  body.mt-body .top.v2-global-top .brand{order:0!important;flex:0 0 auto!important;margin:0!important}
  body.mt-body .top.v2-global-top #searchtoggle{order:1!important;flex:0 0 auto!important;margin-inline-start:6px!important;margin-inline-end:0!important;position:static!important}
  body.mt-body .top.v2-global-top .navlinks{display:none!important}
  body.mt-body .top.v2-global-top .tools{order:2!important;margin-inline-start:auto!important;margin-inline-end:0!important;flex:0 0 auto!important}
}

@media screen and (max-width:620px){
  .mt-monthbar{align-items:flex-start;gap:9px;flex-wrap:wrap}
  .mt-monthnav{flex:1 1 auto;min-width:0}
  .mt-monthtools{width:100%;justify-content:space-between;gap:8px}
  .mt-currency-control{min-width:0}
  .mt-currency-control select{min-width:86px;max-width:120px}
  .mt-tx{grid-template-columns:36px minmax(0,1fr) auto!important;row-gap:5px!important}
  .mt-tx-actions{grid-column:2/-1;justify-self:end}
  .mt-row-action{width:34px;height:34px}
}


/* V50.9.0 desktop density fix: fill the left-column gap with Tools & analysis. */
@media screen and (min-width:901px){
  .mt-grid>.mt-stack:first-child>.mt-toolbox{margin-top:0!important}
  .mt-toolbox-actions{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px!important}
  .mt-toolbox-actions .mt-btn{width:100%;justify-content:flex-start;min-height:46px}
}

/* Preserve the existing phone/tablet content order: Tools & analysis remains after the dashboard cards. */
@media screen and (max-width:900px){
  .mt-grid>.mt-stack{display:contents!important}
  .mt-grid>.mt-stack>.mt-toolbox{order:99!important;margin-top:12px!important}
}

/* V50.9.0 visual cleanup: remove the stray full-width divider lines visible
   around the Money Tracker shell/footer in the desktop layout. */
body.mt-body .top.v2-global-top{border-bottom-color:transparent!important;box-shadow:none!important}
body.mt-body .mt-footer{border-top:0!important}

/* ================================================================
   V50.9.2 — Money Tracker phone dashboard + final shell fixes
   Phone only: compact 2×2 dashboard, exact requested section order.
   Desktop/tablet financial logic and layout remain unchanged.
   ================================================================ */
.mt-account-stat{display:none}

/* Money Tracker shell: no floating divider line and footer is always visible. */
body.mt-body .top.v2-global-top{
  border-bottom:0!important;
  box-shadow:none!important;
}
body.mt-body .top.v2-global-top::before,
body.mt-body .top.v2-global-top::after{display:none!important}
body.mt-body .mt-footer{
  display:flex!important;
  visibility:visible!important;
  opacity:1!important;
  border-top:0!important;
  position:static!important;
}

@media screen and (max-width:620px){
  /* Enter directly into the useful dashboard instead of a tall browser-like intro. */
  .mt-introbar{display:none!important}
  .mt-app{padding-top:12px!important}
  .mt-monthbar{
    position:static!important;
    top:auto!important;
    z-index:auto!important;
    padding:8px 0 10px!important;
    background:transparent!important;
    backdrop-filter:none!important;
    -webkit-backdrop-filter:none!important;
  }

  /* Phone dashboard: Accounts | Spending / Net cash flow | Transactions. */
  .mt-summary{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:10px!important;
    margin:4px 0 14px!important;
    padding:0!important;
    overflow:visible!important;
    position:static!important;
  }
  .mt-summary .mt-stat{
    min-width:0!important;
    min-height:104px!important;
    padding:14px!important;
    border-radius:17px!important;
    display:flex!important;
    flex-direction:column!important;
    justify-content:space-between!important;
  }
  .mt-summary .mt-stat span{font-size:11px!important;line-height:1.25!important}
  .mt-summary .mt-stat b{
    font-size:clamp(18px,5.8vw,24px)!important;
    line-height:1.1!important;
    margin-top:10px!important;
    white-space:normal!important;
    overflow-wrap:anywhere!important;
  }
  .mt-summary .mt-income-stat{display:none!important}
  .mt-summary .mt-account-stat{display:flex!important}

  /* Exact phone-only section order requested by the user. */
  .mt-grid{
    display:flex!important;
    flex-direction:column!important;
    gap:14px!important;
  }
  .mt-grid>.mt-stack{display:contents!important}
  .mt-daily-card{order:10!important}
  .mt-scheduled-card{order:20!important}
  .mt-accounts-card{order:30!important}
  .mt-category-card{order:40!important}
  .mt-trend-card{order:50!important}
  .mt-toolbox{order:60!important;margin-top:0!important}

  .mt-card{width:100%!important;min-width:0!important;margin:0!important}
  .mt-toolbox-actions{display:grid!important;grid-template-columns:1fr!important;gap:8px!important}
  .mt-toolbox-actions .mt-btn{width:100%!important;justify-content:flex-start!important}

  /* Keep footer clear of the floating add button and readable on small phones. */
  body.mt-body .mt-footer{
    flex-direction:column!important;
    align-items:flex-start!important;
    gap:10px!important;
    padding:20px 14px 96px!important;
  }
  body.mt-body .mt-footer nav{display:flex!important;flex-wrap:wrap!important;gap:10px 14px!important}
}
