/* Bank Senoa v2.4.0 — authoritative application layout layer.
   This file is intentionally loaded last. It freezes shell geometry and keeps
   desktop/tablet/mobile layouts independent from page-specific content. */
html{width:100%;min-width:0;scrollbar-gutter:stable}
body{width:100%;min-width:0;overflow-x:hidden}
.app-body,.parent-body{min-height:100dvh}
.app-body *,.parent-body *{min-width:0}
.section-gap{margin-top:18px!important}.section-gap-sm{margin-top:12px!important}

/* Stable reusable states */
.inline-error{display:flex;align-items:flex-start;gap:12px;width:100%;margin:0 0 18px;padding:14px 16px;border:1px solid rgba(255,92,118,.24);border-radius:18px;background:rgba(255,92,118,.09);color:#f7dce3}
.inline-error-icon{flex:0 0 34px;width:34px;height:34px;display:grid;place-items:center;border-radius:11px;background:rgba(255,92,118,.16);font-weight:900;color:#ff9bae}
.inline-error b,.inline-error span{display:block}.inline-error b{font-size:13px}.inline-error span{margin-top:4px;color:#c9aab3;font-size:11px;line-height:1.55}.inline-error code{overflow-wrap:anywhere}
.inline-note{padding:13px 15px;border-radius:16px;border:1px solid rgba(43,140,255,.16);background:rgba(43,140,255,.08);color:#bcd6ff;font-size:13px;line-height:1.6}
.empty-state.compact{display:grid;gap:5px;padding:20px;border:1px dashed rgba(255,255,255,.1);border-radius:18px;background:rgba(255,255,255,.025)}
.empty-state.compact span{color:var(--text-soft);font-size:12px}
.row-actions{display:flex;align-items:center;gap:6px;flex-wrap:wrap}.tiny-btn.danger{color:#ffafbd;border-color:rgba(255,92,118,.24);background:rgba(255,92,118,.08)}
.audit-item pre{max-width:100%;margin:8px 0 0;padding:12px;border-radius:12px;overflow:auto;white-space:pre-wrap;overflow-wrap:anywhere;background:#081226;border:1px solid rgba(255,255,255,.06);color:#bfcdea;font-size:11px;line-height:1.55}

/* Controls never stretch their parent unexpectedly. */
.panel,.stat,.hero-card,.hero-mini,.account-tile,.activity-item,.metric-item,.audit-item{min-width:0;max-width:100%}
.panel-head>*{min-width:0}.panel-head h2,.panel-head p{overflow-wrap:anywhere}
code{max-width:100%;overflow-wrap:anywhere;word-break:break-word}
input,select,textarea,button,.btn{max-width:100%}
.table-wrap{width:100%;max-width:100%;overflow:auto;overscroll-behavior-inline:contain}
table{min-width:720px}.table-wrap table{width:100%}

/* ---------------- Desktop shell: never changes between pages ---------------- */
@media (min-width:1024px){
  .app-shell{display:grid!important;grid-template-columns:288px minmax(0,1fr)!important;width:100%!important;min-height:100dvh!important;overflow:visible!important}
  .sidebar{position:sticky!important;inset:auto!important;top:0!important;width:288px!important;min-width:288px!important;max-width:288px!important;height:100dvh!important;transform:none!important;z-index:20!important;padding:20px 16px 14px!important;overflow:hidden!important;box-sizing:border-box!important}
  .sidebar-close,.mobile-appbar,.mobile-bottom-nav{display:none!important}
  .brand{flex:0 0 74px!important;height:74px!important;padding:0 8px 8px!important;justify-content:center!important}
  .brand img{display:block!important;width:184px!important;height:58px!important;object-fit:contain!important}
  .brand-mark{display:none!important}
  .school-pill{flex:none!important;margin:4px 4px 14px!important;padding:13px 14px!important;border-radius:18px!important}
  .sidebar nav{flex:1 1 auto!important;min-height:0!important;width:100%!important;overflow-y:auto!important;overflow-x:hidden!important;padding:0 5px 6px 0!important;scrollbar-gutter:stable!important;overscroll-behavior:contain!important}
  .sidebar nav a{width:100%!important;min-height:43px!important;margin:0!important;padding:9px 11px!important;border:1px solid transparent!important;border-radius:14px!important;gap:10px!important;box-sizing:border-box!important;white-space:nowrap!important}
  .sidebar nav a.active{border-color:rgba(105,151,255,.20)!important}
  .sidebar nav a .nav-svg{flex:0 0 19px!important;width:19px!important;height:19px!important}
  .sidebar nav a span{display:block!important;min-width:0!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important;font-size:12px!important}
  .sidebar-foot{flex:none!important;margin:0!important;padding:12px 10px 4px!important;min-height:70px!important;background:#091327!important}

  .main{display:block!important;width:100%!important;min-width:0!important;max-width:none!important;overflow:visible!important}
  .desktop-topbar{display:flex!important;position:sticky!important;top:0!important;z-index:15!important;width:100%!important;height:90px!important;min-height:90px!important;padding:0 28px!important;box-sizing:border-box!important}
  .desktop-topbar>div:first-child{min-width:0!important;max-width:44%!important}.desktop-topbar h1{font-size:25px!important;line-height:1.1!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important}
  .top-actions{flex:0 0 auto!important;min-width:0!important}.top-search{width:min(330px,25vw)!important}
  .content{display:block!important;width:min(100%,1600px)!important;max-width:1600px!important;margin-inline:auto!important;padding:26px 30px 56px!important;overflow:visible!important;box-sizing:border-box!important}

  .grid{align-items:stretch}.grid-4{grid-template-columns:repeat(4,minmax(0,1fr))!important}.grid-3{grid-template-columns:repeat(3,minmax(0,1fr))!important}.grid-2{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .stat{min-height:118px!important;padding:20px!important}.stat strong{font-size:clamp(23px,2vw,30px)!important;overflow-wrap:anywhere}
  .dashboard-hero{grid-template-columns:minmax(0,1.35fr) minmax(280px,.65fr)!important}
  .hero-aside{min-width:0!important}.hero-mini{min-height:0!important}
}

/* Mid desktop: content reflows, shell does not. */
@media (min-width:1024px) and (max-width:1279px){
  .grid-4,.report-summary-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .dashboard-hero{grid-template-columns:1fr!important}
  .filter-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .content{padding-inline:24px!important}
}

/* ---------------- Tablet: fixed rail, never drawer/desktop hybrid ---------------- */
@media (min-width:768px) and (max-width:1023px){
  .app-shell{display:grid!important;grid-template-columns:76px minmax(0,1fr)!important;width:100%!important;min-height:100dvh!important}
  .sidebar{position:sticky!important;top:0!important;left:auto!important;bottom:auto!important;width:76px!important;min-width:76px!important;max-width:76px!important;height:100dvh!important;transform:none!important;padding:10px 7px!important;overflow:hidden!important;z-index:20!important}
  .sidebar-close,.desktop-topbar,.mobile-bottom-nav{display:none!important}
  .mobile-appbar{display:block!important}
  .brand{height:60px!important;padding:0!important}.brand img{display:none!important}.brand-mark{display:grid!important;width:44px;height:44px;margin:auto;place-items:center;border-radius:14px;background:linear-gradient(135deg,#218aff,#7647ff);font-weight:900;color:white}
  .school-pill,.sidebar-foot{display:none!important}
  .sidebar nav{height:calc(100dvh - 70px)!important;overflow-y:auto!important;overflow-x:hidden!important;padding:0!important;scrollbar-width:none!important}
  .sidebar nav::-webkit-scrollbar{display:none!important}
  .sidebar nav a{display:grid!important;place-items:center!important;width:54px!important;height:50px!important;min-height:50px!important;margin:0 auto 5px!important;padding:0!important;border:1px solid transparent!important;border-radius:15px!important}
  .sidebar nav a span{display:none!important}.sidebar nav a .nav-svg{width:21px!important;height:21px!important}
  .main{width:100%!important;min-width:0!important}.content{width:100%!important;max-width:none!important;margin:0!important;padding:22px 22px 46px!important;overflow:visible!important}
  .grid-4{grid-template-columns:repeat(2,minmax(0,1fr))!important}.grid-3{grid-template-columns:repeat(2,minmax(0,1fr))!important}.grid-2{grid-template-columns:1fr!important}.dashboard-hero{grid-template-columns:1fr!important}.filter-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
}

/* ---------------- Phones: real application shell ---------------- */
@media (max-width:767px){
  html{scrollbar-gutter:auto}
  .app-shell{display:block!important;width:100%!important;min-height:100dvh!important;overflow:visible!important}
  .main{display:block!important;width:100%!important;min-height:100dvh!important;overflow:visible!important}
  .desktop-topbar{display:none!important}.mobile-appbar{display:block!important}.mobile-bottom-nav{display:grid!important}
  .content{width:100%!important;max-width:none!important;margin:0!important;padding:14px 13px calc(var(--s-mobile-nav) + var(--s-safe-bottom) + 24px)!important;overflow:visible!important}

  .sidebar{position:fixed!important;inset:0 auto 0 0!important;width:min(86vw,304px)!important;min-width:0!important;max-width:304px!important;height:100dvh!important;transform:translate3d(-105%,0,0)!important;transition:transform .22s ease!important;z-index:70!important;padding:14px 12px calc(14px + var(--s-safe-bottom))!important;overflow:hidden!important;box-shadow:30px 0 90px rgba(0,0,0,.45)!important}
  body.menu-open .sidebar{transform:translate3d(0,0,0)!important}
  body.menu-open{overflow:hidden!important;touch-action:none!important}
  .sidebar-close{display:grid!important;position:absolute!important;right:10px!important;top:10px!important;width:38px!important;height:38px!important;place-items:center!important;border:1px solid rgba(255,255,255,.08)!important;border-radius:12px!important;background:rgba(255,255,255,.05)!important;color:#fff!important;z-index:2!important}
  .brand{height:62px!important;padding:0 44px 4px 4px!important}.brand img{display:block!important;width:150px!important;height:50px!important;object-fit:contain!important}.brand-mark{display:none!important}
  .school-pill{margin:5px 2px 10px!important;padding:11px 12px!important}
  .sidebar nav{flex:1!important;min-height:0!important;width:100%!important;overflow-y:auto!important;overflow-x:hidden!important;padding:0 4px 6px 0!important;scrollbar-gutter:stable!important;overscroll-behavior:contain!important}
  .sidebar nav a{width:100%!important;min-height:44px!important;padding:9px 10px!important;border:1px solid transparent!important;border-radius:13px!important;gap:10px!important}.sidebar nav a.active{border-color:rgba(105,151,255,.18)!important}
  .sidebar nav a span{font-size:12px!important}.sidebar-foot{flex:none!important;margin:0!important;padding:10px 8px 2px!important;background:#091327!important}

  .grid-4,.grid-3,.grid-2,.dashboard-hero,.student-top-grid,.report-summary-grid,.audit-summary-grid{grid-template-columns:1fr!important}
  .panel,.stat,.hero-card,.hero-mini{border-radius:20px!important;padding:16px!important}.stat{min-height:102px!important}.stat strong{font-size:26px!important}
  .panel-head{display:flex!important;align-items:flex-start!important;flex-wrap:wrap!important;gap:10px!important}.panel-head>.quick-actions{width:100%!important;display:grid!important;grid-template-columns:1fr 1fr!important}
  .quick-actions,.export-row,.filter-actions{gap:8px!important}.quick-actions .btn,.filter-actions .btn{min-height:44px!important}
  .search-row{display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;gap:8px!important}.search-row .btn{width:auto!important;min-width:68px!important}
  .form-grid{grid-template-columns:1fr!important}
  .inline-form{display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;width:100%!important}
  .inline-form select{width:100%!important}.inline-form .tiny-btn{min-height:38px!important}
  .account-list{grid-template-columns:1fr!important}.account-tile{grid-template-columns:auto minmax(0,1fr)!important;gap:10px!important;padding:14px!important}.account-tile>strong{grid-column:2!important;text-align:left!important;font-size:18px!important}.account-tile-main span{white-space:normal!important;overflow-wrap:anywhere!important}
  .audit-item summary{grid-template-columns:minmax(0,1fr)!important;gap:8px!important}.audit-item summary code{justify-self:start!important}.audit-detail{grid-template-columns:1fr!important}
  .statement-launch-form{grid-template-columns:1fr!important}.statement-account-picker{grid-column:auto!important}
  .row-actions{justify-content:flex-start!important}
  .inline-error{margin-top:10px!important;padding:12px!important}.inline-error-icon{width:30px;height:30px;flex-basis:30px}

  /* Tables are card lists only on phones. JS adds data-label once. */
  table[data-mobile-table-ready]:not([data-mobile-table="keep"]){min-width:0!important;border:0!important}
  table[data-mobile-table-ready]:not([data-mobile-table="keep"]) thead{display:none!important}
  table[data-mobile-table-ready]:not([data-mobile-table="keep"]) tbody,table[data-mobile-table-ready]:not([data-mobile-table="keep"]) tr,table[data-mobile-table-ready]:not([data-mobile-table="keep"]) td{display:block!important;width:100%!important}
  table[data-mobile-table-ready]:not([data-mobile-table="keep"]) tr{margin:0 0 10px!important;padding:8px 12px!important;border:1px solid rgba(255,255,255,.07)!important;border-radius:17px!important;background:rgba(255,255,255,.025)!important}
  table[data-mobile-table-ready]:not([data-mobile-table="keep"]) td{display:grid!important;grid-template-columns:minmax(94px,.7fr) minmax(0,1.3fr)!important;align-items:start!important;gap:10px!important;padding:8px 0!important;border-bottom:1px solid rgba(255,255,255,.05)!important;text-align:right!important;overflow-wrap:anywhere!important}
  table[data-mobile-table-ready]:not([data-mobile-table="keep"]) td:last-child{border-bottom:0!important}
  table[data-mobile-table-ready]:not([data-mobile-table="keep"]) td::before{content:attr(data-label);color:#8296ba;font-size:9px;font-weight:900;letter-spacing:.08em;text-transform:uppercase;text-align:left!important}
  table[data-mobile-table-ready]:not([data-mobile-table="keep"]) td[colspan]::before{display:none!important}
}

@media (max-width:420px){
  .mobile-appbar-copy h1{font-size:17px!important}.mobile-appbar-actions{gap:4px!important}.mobile-appbar-actions .notify-btn,.mobile-appbar-actions .mobile-search-btn,.mobile-appbar-actions .avatar{width:38px!important;height:38px!important;min-height:38px!important}
  .panel-head>.quick-actions{grid-template-columns:1fr!important}.search-row{grid-template-columns:1fr!important}.search-row .btn{width:100%!important}
  table[data-mobile-table-ready]:not([data-mobile-table="keep"]) td{grid-template-columns:1fr!important;text-align:left!important;gap:3px!important}
}

/* Parent portal stability */
.parent-shell{width:min(760px,100%)!important;max-width:760px!important;margin-inline:auto!important;min-height:100dvh!important;overflow-x:hidden!important}
.parent-main{width:100%!important;min-width:0!important}.parent-title{overflow-wrap:anywhere}
@media(max-width:767px){.parent-shell{max-width:none!important}.parent-main{padding-inline:13px!important}.parent-bottom{width:100%!important;max-width:none!important}}
@media(max-width:767px){body.page-locked{position:fixed!important;left:0!important;right:0!important;top:calc(-1 * var(--s-lock-y,0px))!important;width:100%!important}}
