:root{
  --portal-primary:#3157e8;
  --portal-primary-2:#6d36ef;
  --portal-accent:#03b5d8;
  --portal-success:#0f9d67;
  --portal-warning:#f59e0b;
  --portal-danger:#e33b4f;
  --portal-ink:#111c38;
  --portal-muted:#64748b;
  --portal-bg:#f3f6fc;
  --portal-surface:#ffffff;
  --portal-surface-2:#f8faff;
  --portal-border:#e1e8f4;
  --portal-shadow:0 14px 40px rgba(24,39,75,.08);
  --portal-shadow-lg:0 24px 60px rgba(20,33,68,.18);
  --portal-sidebar-width:286px;
  --portal-sidebar-rail:88px;
  --portal-topbar-height:74px;
  --portal-radius:20px;
  --portal-radius-sm:13px;
  --portal-transition:.22s cubic-bezier(.2,.75,.3,1);
  color-scheme:light;
}
html[data-portal-theme="dark"]{
  --portal-ink:#f4f7ff;
  --portal-muted:#a8b3c7;
  --portal-bg:#0e1525;
  --portal-surface:#151f34;
  --portal-surface-2:#1b2740;
  --portal-border:#293753;
  --portal-shadow:0 14px 40px rgba(0,0,0,.24);
  color-scheme:dark;
}
*{box-sizing:border-box}
html{scroll-behavior:smooth;-webkit-text-size-adjust:100%}
body.portal-body{
  margin:0!important;
  min-height:100vh;
  padding:var(--portal-topbar-height) 0 96px var(--portal-sidebar-width)!important;
  overflow-x:hidden;
  background:
    radial-gradient(circle at 85% 0,rgba(109,54,239,.08),transparent 28rem),
    radial-gradient(circle at 15% 100%,rgba(3,181,216,.07),transparent 28rem),
    var(--portal-bg)!important;
  color:var(--portal-ink)!important;
  font-family:Inter,"Segoe UI",Roboto,Arial,sans-serif!important;
  line-height:1.5;
  transition:padding var(--portal-transition),background .2s ease,color .2s ease;
  -webkit-tap-highlight-color:transparent;
}
body.portal-body a{color:inherit}
body.portal-body img{max-width:100%}
body.portal-body button,body.portal-body input,body.portal-body select,body.portal-body textarea{font:inherit}
body.portal-body .container,
body.portal-body .container-fluid{max-width:100%!important}
body.portal-body .portal-main{
  width:min(100%,1600px);
  margin:0 auto;
  padding:24px 26px 0;
  min-height:calc(100vh - var(--portal-topbar-height) - 130px);
}
body.portal-body .portal-main:empty{display:none}
.portal-topbar{
  position:fixed;
  z-index:1200;
  top:0;right:0;left:var(--portal-sidebar-width);
  height:var(--portal-topbar-height);
  display:flex;
  align-items:center;
  gap:16px;
  padding:0 24px;
  color:#fff;
  background:linear-gradient(110deg,#2446c8 0%,#415de8 48%,#7935ef 100%);
  box-shadow:0 8px 30px rgba(36,70,200,.22);
  transition:left var(--portal-transition);
}
.portal-icon-btn{
  width:42px;height:42px;border:0;border-radius:13px;
  display:grid;place-items:center;cursor:pointer;
  color:inherit;background:rgba(255,255,255,.12);
  transition:transform .15s ease,background .15s ease;
}
.portal-icon-btn:hover{background:rgba(255,255,255,.2);transform:translateY(-1px)}
.portal-icon-btn:focus-visible,.portal-user-button:focus-visible,.portal-nav-link:focus-visible{outline:3px solid rgba(255,255,255,.55);outline-offset:2px}
.portal-brand{display:flex;align-items:center;gap:11px;text-decoration:none;min-width:0;color:#fff!important}
.portal-brand-mark{width:42px;height:42px;border-radius:13px;background:#fff;display:grid;place-items:center;padding:4px;box-shadow:0 6px 16px rgba(0,0,0,.14);flex:0 0 auto}
.portal-brand-mark img{width:100%;height:100%;object-fit:contain;border-radius:10px}
.portal-brand strong{display:block;font-size:15px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:420px}
.portal-brand small{display:block;font-size:10px;opacity:.82;letter-spacing:.35px;margin-top:1px}
.portal-top-actions{margin-left:auto;display:flex;align-items:center;gap:9px}
.portal-session-chip{height:42px;padding:0 13px;border-radius:13px;background:rgba(255,255,255,.12);display:flex;align-items:center;gap:8px;font-size:12px;font-weight:800;white-space:nowrap}
.portal-user-button{height:48px;max-width:285px;border:0;border-radius:15px;padding:4px 8px 4px 5px;background:rgba(255,255,255,.12);color:#fff;display:flex;align-items:center;gap:9px;cursor:pointer;text-align:left}
.portal-user-avatar{width:38px;height:38px;border-radius:12px;background:#fff;color:var(--portal-primary);display:grid;place-items:center;overflow:hidden;flex:0 0 auto}
.portal-user-avatar img{width:100%;height:100%;object-fit:cover}
.portal-user-copy{min-width:0;flex:1}
.portal-user-copy strong,.portal-user-copy small{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.portal-user-copy strong{font-size:12px}
.portal-user-copy small{font-size:9px;opacity:.82;margin-top:1px}
.portal-profile-menu{
  position:fixed;z-index:1300;right:22px;top:68px;width:245px;
  padding:8px;border:1px solid var(--portal-border);border-radius:18px;
  background:var(--portal-surface);box-shadow:var(--portal-shadow-lg);
  opacity:0;visibility:hidden;transform:translateY(-8px) scale(.98);
  transition:var(--portal-transition);color:var(--portal-ink)
}
.portal-profile-menu.open{opacity:1;visibility:visible;transform:none}
.portal-profile-head{padding:11px 12px 12px;border-bottom:1px solid var(--portal-border);margin-bottom:5px}
.portal-profile-head strong,.portal-profile-head small{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.portal-profile-head strong{font-size:14px}.portal-profile-head small{font-size:10px;color:var(--portal-muted);margin-top:2px}
.portal-profile-menu a{display:flex;align-items:center;gap:10px;padding:10px 11px;border-radius:11px;text-decoration:none;color:var(--portal-ink)!important;font-size:12px;font-weight:700}
.portal-profile-menu a:hover{background:var(--portal-surface-2)}
.portal-profile-menu a i{width:20px;text-align:center;color:var(--portal-primary)}
.portal-profile-menu a.danger,.portal-profile-menu a.danger i{color:var(--portal-danger)!important}
.portal-sidebar{
  position:fixed;z-index:1250;inset:0 auto 0 0;width:var(--portal-sidebar-width);
  display:flex;flex-direction:column;padding:14px 12px 12px;
  background:linear-gradient(180deg,#0e1930,#111e37 58%,#0b162a);
  color:#d8e4ff;box-shadow:12px 0 30px rgba(12,24,48,.12);
  transition:width var(--portal-transition),transform var(--portal-transition);
}
.portal-sidebar-head{height:67px;display:flex;align-items:center;gap:10px;padding:5px 7px 12px;min-width:0;border-bottom:1px solid rgba(255,255,255,.08)}
.portal-sidebar-logo{width:47px;height:47px;border-radius:15px;background:#fff;padding:4px;display:grid;place-items:center;flex:0 0 auto}
.portal-sidebar-logo img{width:100%;height:100%;object-fit:contain;border-radius:11px}
.portal-sidebar-head>span:last-child{min-width:0}
.portal-sidebar-head strong,.portal-sidebar-head small{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.portal-sidebar-head strong{font-size:12px;color:#fff}.portal-sidebar-head small{font-size:9px;color:#8ea4c8;margin-top:3px;text-transform:uppercase;letter-spacing:.35px}
.portal-menu-search{height:43px;margin:12px 1px 8px;padding:0 12px;display:flex;align-items:center;gap:9px;border:1px solid rgba(255,255,255,.1);border-radius:13px;background:rgba(255,255,255,.05);color:#8ca2c7}
.portal-menu-search input{width:100%;min-width:0;background:transparent;border:0;outline:0;color:#fff;font-size:11px}
.portal-menu-search input::placeholder{color:#8296b8}
.portal-nav{min-height:0;overflow:auto;padding:2px 1px 18px;scrollbar-width:thin;scrollbar-color:#354561 transparent}
.portal-nav::-webkit-scrollbar{width:5px}.portal-nav::-webkit-scrollbar-thumb{background:#354561;border-radius:20px}
.portal-nav-group{margin-top:12px}
.portal-nav-label{padding:0 10px 7px;color:#6f86ad;font-size:8px;font-weight:900;letter-spacing:1px;text-transform:uppercase;white-space:nowrap}
.portal-nav-link{min-height:43px;margin:3px 0;padding:0 11px;border-radius:13px;display:flex;align-items:center;gap:11px;text-decoration:none!important;color:#b8c8e5!important;font-size:11px;font-weight:700;transition:background .15s ease,color .15s ease,transform .15s ease}
.portal-nav-link i{width:22px;text-align:center;font-size:14px;color:#7f98c3;transition:color .15s ease}
.portal-nav-link:hover{background:rgba(255,255,255,.07);color:#fff!important;transform:translateX(2px)}
.portal-nav-link.active{color:#fff!important;background:linear-gradient(100deg,rgba(49,87,232,.75),rgba(109,54,239,.72));box-shadow:0 8px 20px rgba(34,61,165,.24)}
.portal-nav-link.active i{color:#fff}
.portal-sidebar-foot{margin-top:auto;padding-top:10px;border-top:1px solid rgba(255,255,255,.08);display:grid;grid-template-columns:1fr 1fr;gap:7px}
.portal-sidebar-foot a{height:39px;border-radius:11px;background:rgba(255,255,255,.05);display:flex;align-items:center;justify-content:center;gap:7px;text-decoration:none;color:#aebfda!important;font-size:9px;font-weight:800}
.portal-sidebar-foot a:hover{background:rgba(255,255,255,.1);color:#fff!important}
.portal-overlay{position:fixed;z-index:1190;inset:0;background:rgba(7,15,31,.58);backdrop-filter:blur(3px);opacity:0;visibility:hidden;transition:.2s ease}
.portal-bottom-nav{display:none}
.portal-footer{margin:34px 26px 0;padding:18px 0 8px;border-top:1px solid var(--portal-border);display:flex;justify-content:space-between;align-items:center;gap:15px;color:var(--portal-muted);font-size:10px}
.portal-footer-links{display:flex;gap:15px}.portal-footer a{text-decoration:none;color:var(--portal-primary)!important;font-weight:700}
.portal-toast-stack{position:fixed;z-index:2200;right:18px;top:88px;width:min(360px,calc(100vw - 32px));display:grid;gap:10px;pointer-events:none}
.portal-toast{pointer-events:auto;padding:12px 14px;border-radius:14px;background:var(--portal-surface);border:1px solid var(--portal-border);box-shadow:var(--portal-shadow-lg);display:flex;align-items:flex-start;gap:10px;animation:portalToastIn .24s ease;color:var(--portal-ink);font-size:12px}
.portal-toast.success i{color:var(--portal-success)}.portal-toast.error i{color:var(--portal-danger)}.portal-toast.warning i{color:var(--portal-warning)}
@keyframes portalToastIn{from{opacity:0;transform:translateY(-8px)}to{opacity:1;transform:none}}
.portal-page-loader{position:fixed;z-index:2500;top:0;left:var(--portal-sidebar-width);right:0;height:3px;pointer-events:none}
.portal-page-loader span{display:block;width:0;height:100%;background:linear-gradient(90deg,#04c2df,#fff,#7d38ef);box-shadow:0 0 10px rgba(255,255,255,.6)}
.portal-page-loader.loading span{animation:portalLoading 1.2s ease infinite}
@keyframes portalLoading{0%{width:0;transform:translateX(0)}50%{width:65%}100%{width:100%;transform:translateX(100%)}}

/* Unified content components */
.portal-page-head{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:20px}
.portal-page-head h1{margin:0!important;font-size:clamp(23px,2.5vw,34px)!important;line-height:1.15;color:var(--portal-ink)!important;font-weight:900!important;letter-spacing:-.5px}
.portal-page-head p{margin:6px 0 0;color:var(--portal-muted);font-size:12px}
.portal-actions{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.portal-card,.card,.box,.hms-card{
  border:1px solid var(--portal-border)!important;
  border-radius:var(--portal-radius)!important;
  background:var(--portal-surface)!important;
  color:var(--portal-ink)!important;
  box-shadow:var(--portal-shadow)!important;
  overflow:hidden;
}
.portal-card{padding:20px}
.portal-card-head,.box-header,.card-header{padding:16px 18px!important;border-bottom:1px solid var(--portal-border)!important;background:linear-gradient(180deg,var(--portal-surface),var(--portal-surface-2))!important;display:flex;align-items:center;justify-content:space-between;gap:12px}
.portal-card-head h2,.portal-card-head h3,.box-title,.card-title{margin:0!important;font-size:16px!important;font-weight:900!important;color:var(--portal-ink)!important}
.portal-card-body,.box-body,.card-body{padding:18px!important}
.portal-grid{display:grid;gap:16px}.portal-grid-2{grid-template-columns:repeat(2,minmax(0,1fr))}.portal-grid-3{grid-template-columns:repeat(3,minmax(0,1fr))}.portal-grid-4{grid-template-columns:repeat(4,minmax(0,1fr))}
.portal-stat{position:relative;min-height:130px;padding:18px;border:1px solid var(--portal-border);border-radius:18px;background:var(--portal-surface);box-shadow:var(--portal-shadow);overflow:hidden}
.portal-stat:after{content:"";position:absolute;width:95px;height:95px;border-radius:50%;right:-28px;top:-28px;background:linear-gradient(135deg,rgba(49,87,232,.13),rgba(109,54,239,.08))}
.portal-stat-icon{width:42px;height:42px;border-radius:13px;display:grid;place-items:center;background:#edf2ff;color:var(--portal-primary);font-size:17px;margin-bottom:15px}
html[data-portal-theme="dark"] .portal-stat-icon{background:#243455}
.portal-stat-label{font-size:9px;text-transform:uppercase;letter-spacing:.65px;color:var(--portal-muted);font-weight:900}
.portal-stat-value{font-size:25px;font-weight:950;color:var(--portal-ink);margin-top:5px;line-height:1.1}
.portal-stat-meta{font-size:10px;color:var(--portal-muted);margin-top:7px}
.portal-hero{position:relative;overflow:hidden;padding:24px;border-radius:24px;background:linear-gradient(120deg,#294ed6,#4d5ee8 55%,#7b37ed);color:#fff;box-shadow:0 20px 50px rgba(49,87,232,.22)}
.portal-hero:before,.portal-hero:after{content:"";position:absolute;border-radius:50%;background:rgba(255,255,255,.08)}
.portal-hero:before{width:210px;height:210px;right:-55px;top:-90px}.portal-hero:after{width:130px;height:130px;right:160px;bottom:-80px}
.portal-hero-grid{position:relative;z-index:1;display:grid;grid-template-columns:auto 1fr auto;gap:18px;align-items:center}
.portal-hero-avatar{width:84px;height:84px;border-radius:22px;background:rgba(255,255,255,.18);border:3px solid rgba(255,255,255,.65);display:grid;place-items:center;overflow:hidden;font-size:28px}
.portal-hero-avatar img{width:100%;height:100%;object-fit:cover}
.portal-hero h2{margin:0;color:#fff;font-size:26px;font-weight:950}.portal-hero p{margin:6px 0 0;opacity:.82;font-size:12px}
.portal-chip-row{display:flex;flex-wrap:wrap;gap:7px;margin-top:12px}.portal-chip{display:inline-flex;align-items:center;gap:6px;padding:6px 9px;border-radius:999px;background:rgba(255,255,255,.14);font-size:9px;font-weight:800}
.portal-quick-grid{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:12px}
.portal-quick-link{min-height:112px;padding:14px 9px;border:1px solid var(--portal-border);border-radius:17px;background:var(--portal-surface);box-shadow:0 7px 20px rgba(24,39,75,.055);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;text-align:center;text-decoration:none!important;color:var(--portal-ink)!important;transition:transform .16s ease,box-shadow .16s ease,border-color .16s ease}
.portal-quick-link:hover{transform:translateY(-3px);box-shadow:var(--portal-shadow);border-color:#aabcf6}
.portal-quick-icon{width:45px;height:45px;border-radius:14px;display:grid;place-items:center;color:#fff;font-size:18px;background:linear-gradient(135deg,var(--portal-primary),var(--portal-primary-2))}
.portal-quick-link:nth-child(6n+2) .portal-quick-icon{background:linear-gradient(135deg,#08a9c8,#28c5a4)}
.portal-quick-link:nth-child(6n+3) .portal-quick-icon{background:linear-gradient(135deg,#f59e0b,#f97316)}
.portal-quick-link:nth-child(6n+4) .portal-quick-icon{background:linear-gradient(135deg,#e33b4f,#ee5fa6)}
.portal-quick-link:nth-child(6n+5) .portal-quick-icon{background:linear-gradient(135deg,#0f9d67,#49c172)}
.portal-quick-link:nth-child(6n+6) .portal-quick-icon{background:linear-gradient(135deg,#7b37ed,#aa54ed)}
.portal-quick-link strong{font-size:10px;line-height:1.25}.portal-quick-link small{font-size:8px;color:var(--portal-muted)}
.portal-list{display:grid;gap:9px}.portal-list-item{display:flex;align-items:center;gap:12px;padding:11px 12px;border:1px solid var(--portal-border);border-radius:14px;background:var(--portal-surface-2)}
.portal-list-icon{width:39px;height:39px;border-radius:12px;display:grid;place-items:center;flex:0 0 auto;background:#eaf0ff;color:var(--portal-primary)}
html[data-portal-theme="dark"] .portal-list-icon{background:#243455}
.portal-list-copy{min-width:0;flex:1}.portal-list-copy strong,.portal-list-copy small{display:block}.portal-list-copy strong{font-size:11px}.portal-list-copy small{font-size:9px;color:var(--portal-muted);margin-top:2px}.portal-list-side{font-size:10px;font-weight:800;white-space:nowrap}
.portal-empty{padding:34px 18px;text-align:center;color:var(--portal-muted)}.portal-empty i{display:block;font-size:30px;color:#a7b5cc;margin-bottom:9px}.portal-empty strong{display:block;color:var(--portal-ink);font-size:13px}.portal-empty span{font-size:10px}
.portal-badge,.badge,.label,.hms-badge{display:inline-flex!important;align-items:center!important;justify-content:center!important;gap:5px!important;padding:5px 8px!important;border-radius:999px!important;font-size:8px!important;font-weight:900!important;line-height:1.2!important;border:0!important}
.portal-badge.success,.badge-success,.label-success,.hms-badge-success{background:#dcfce7!important;color:#117146!important}.portal-badge.danger,.badge-danger,.label-danger,.hms-badge-danger{background:#fee2e2!important;color:#b42335!important}.portal-badge.warning,.badge-warning,.label-warning{background:#fef3c7!important;color:#92530a!important}.portal-badge.info,.badge-info,.label-info,.hms-badge-info{background:#e1ecff!important;color:#2450bc!important}
.btn,.portal-btn,button[type="submit"]{border-radius:12px!important;min-height:39px;padding:8px 13px!important;font-size:10px!important;font-weight:850!important;display:inline-flex!important;align-items:center!important;justify-content:center!important;gap:7px!important;box-shadow:none!important;transition:transform .15s ease,filter .15s ease!important}
.btn:hover,.portal-btn:hover,button[type="submit"]:hover{transform:translateY(-1px);filter:brightness(.98)}
.btn-primary,.portal-btn.primary,button[type="submit"]{border-color:transparent!important;background:linear-gradient(135deg,var(--portal-primary),var(--portal-primary-2))!important;color:#fff!important}
.btn-success,.portal-btn.success{border-color:transparent!important;background:linear-gradient(135deg,#0c9b65,#32ba7d)!important;color:#fff!important}
.btn-danger,.portal-btn.danger{border-color:transparent!important;background:linear-gradient(135deg,#d9364b,#ed5d6f)!important;color:#fff!important}
.btn-warning,.portal-btn.warning{border-color:transparent!important;background:linear-gradient(135deg,#f59e0b,#f97316)!important;color:#fff!important}
.btn-default,.portal-btn.secondary{border:1px solid var(--portal-border)!important;background:var(--portal-surface)!important;color:var(--portal-ink)!important}
.form-control,input[type="text"],input[type="email"],input[type="password"],input[type="number"],input[type="date"],input[type="time"],input[type="search"],select,textarea{
  max-width:100%;min-height:43px;padding:9px 12px;border:1px solid var(--portal-border)!important;border-radius:12px!important;background:var(--portal-surface)!important;color:var(--portal-ink)!important;box-shadow:none!important;outline:0!important;font-size:11px!important
}
textarea{min-height:90px;resize:vertical}
.form-control:focus,input:focus,select:focus,textarea:focus{border-color:#7b93ef!important;box-shadow:0 0 0 3px rgba(49,87,232,.11)!important}
label{color:var(--portal-ink)}
.form-group{margin-bottom:13px!important}
.table-responsive{width:100%;overflow:auto;border-radius:14px;border:1px solid var(--portal-border)}
table,.table{width:100%!important;max-width:100%;margin:0!important;border-collapse:separate!important;border-spacing:0!important;background:var(--portal-surface)!important;color:var(--portal-ink)!important}
thead th,.table>thead>tr>th{padding:12px 13px!important;background:#eef4ff!important;color:#193a82!important;border:0!important;border-bottom:1px solid #dce7fb!important;font-size:9px!important;text-transform:uppercase;letter-spacing:.42px;white-space:nowrap}
html[data-portal-theme="dark"] thead th,html[data-portal-theme="dark"] .table>thead>tr>th{background:#1f3153!important;color:#c7d5ff!important;border-color:#304364!important}
tbody td,.table>tbody>tr>td{padding:12px 13px!important;border:0!important;border-bottom:1px solid var(--portal-border)!important;vertical-align:middle!important;font-size:10px!important;color:var(--portal-ink)!important;background:transparent!important}
tbody tr:last-child td{border-bottom:0!important}tbody tr:hover td{background:var(--portal-surface-2)!important}
.alert{border-radius:14px!important;border:1px solid var(--portal-border)!important;padding:12px 14px!important;font-size:11px!important}.alert-success{background:#effcf6!important;color:#11663f!important}.alert-danger{background:#fff0f1!important;color:#a92639!important}.alert-warning{background:#fff8e7!important;color:#82500a!important}.alert-info{background:#edf4ff!important;color:#22499f!important}
.modal-content{border:1px solid var(--portal-border)!important;border-radius:20px!important;background:var(--portal-surface)!important;color:var(--portal-ink)!important;box-shadow:var(--portal-shadow-lg)!important}.modal-header,.modal-footer{border-color:var(--portal-border)!important}.modal-title{font-weight:900!important}
.pagination>li>a,.pagination>li>span{border-color:var(--portal-border)!important;background:var(--portal-surface)!important;color:var(--portal-primary)!important;border-radius:9px!important;margin:0 2px!important}.pagination>.active>a,.pagination>.active>span{background:var(--portal-primary)!important;color:#fff!important;border-color:var(--portal-primary)!important}

/* Legacy page compatibility */
body.portal-body>.topbar,body.portal-body>.sidebar,body.portal-body>.overlay,body.portal-body>.bottom-nav{display:none!important}
body.portal-body .content-wrapper,body.portal-body .wrapper,body.portal-body .main-content{margin:0!important;padding:0!important;min-height:0!important;background:transparent!important;max-width:none!important}
body.portal-body .content-header{padding:0 0 18px!important}.content-header h1{font-size:28px!important;font-weight:900!important;color:var(--portal-ink)!important}.content-header h1 small{display:inline;font-size:11px!important;color:var(--portal-muted)!important}
body.portal-body .content{padding:0!important;margin:0!important}
body.portal-body .row{margin-left:-7px!important;margin-right:-7px!important}body.portal-body [class*="col-"]{padding-left:7px!important;padding-right:7px!important}
body.portal-body .section-grid{display:grid!important;grid-template-columns:repeat(4,minmax(0,1fr))!important;gap:14px!important;padding:0!important;margin:16px 0 0!important}
body.portal-body .section-grid .box,body.portal-body .section-grid .tile{min-height:120px;border:1px solid var(--portal-border)!important;border-radius:18px!important;background:var(--portal-surface)!important;color:var(--portal-ink)!important;box-shadow:var(--portal-shadow)!important;text-decoration:none!important;display:flex!important;flex-direction:column!important;align-items:center!important;justify-content:center!important;gap:8px!important}
body.portal-body .profile-header{margin:0 0 18px!important;border-radius:24px!important;box-shadow:0 20px 50px rgba(49,87,232,.19)!important}
body.portal-body .banner-slider{border-radius:18px!important;height:auto!important;min-height:150px!important;overflow:hidden!important}
body.portal-body .dataTables_wrapper{color:var(--portal-ink)!important}.dataTables_wrapper .dataTables_filter input,.dataTables_wrapper .dataTables_length select{margin:5px!important}.dataTables_info,.dataTables_length,.dataTables_filter{font-size:10px!important;color:var(--portal-muted)!important}
body.portal-body .select2-container{max-width:100%!important}.select2-container .select2-selection--single{height:43px!important;border:1px solid var(--portal-border)!important;border-radius:12px!important;background:var(--portal-surface)!important}.select2-container--default .select2-selection--single .select2-selection__rendered{line-height:41px!important;color:var(--portal-ink)!important}.select2-container--default .select2-selection--single .select2-selection__arrow{height:41px!important}

/* Tablet rail */
@media (min-width:768px) and (max-width:1199px){
  body.portal-body{padding-left:var(--portal-sidebar-rail)!important}
  .portal-sidebar{width:var(--portal-sidebar-rail);padding-left:10px;padding-right:10px}
  .portal-topbar{left:var(--portal-sidebar-rail)}
  .portal-page-loader{left:var(--portal-sidebar-rail)}
  .portal-sidebar-head>span:last-child,.portal-menu-search input,.portal-nav-label,.portal-nav-link span,.portal-sidebar-foot span{display:none}
  .portal-sidebar-head{justify-content:center}.portal-sidebar-logo{width:48px;height:48px}
  .portal-menu-search{justify-content:center;padding:0}.portal-menu-search i{font-size:15px}
  .portal-nav-link{justify-content:center;padding:0}.portal-nav-link i{width:auto;font-size:17px}.portal-nav-link:hover{transform:none}
  .portal-sidebar-foot{grid-template-columns:1fr}.portal-sidebar-foot a{font-size:14px}
  body.portal-sidebar-expanded{padding-left:var(--portal-sidebar-width)!important}
  body.portal-sidebar-expanded .portal-sidebar{width:var(--portal-sidebar-width)}
  body.portal-sidebar-expanded .portal-topbar{left:var(--portal-sidebar-width)}
  body.portal-sidebar-expanded .portal-sidebar-head{justify-content:flex-start}
  body.portal-sidebar-expanded .portal-sidebar-head>span:last-child,body.portal-sidebar-expanded .portal-menu-search input,body.portal-sidebar-expanded .portal-nav-label,body.portal-sidebar-expanded .portal-nav-link span,body.portal-sidebar-expanded .portal-sidebar-foot span{display:block}
  body.portal-sidebar-expanded .portal-menu-search{justify-content:flex-start;padding:0 12px}
  body.portal-sidebar-expanded .portal-nav-link{justify-content:flex-start;padding:0 11px}
  body.portal-sidebar-expanded .portal-nav-link i{width:22px;font-size:14px}
  body.portal-sidebar-expanded .portal-sidebar-foot{grid-template-columns:1fr 1fr}
  .portal-quick-grid{grid-template-columns:repeat(4,minmax(0,1fr))}
  .portal-grid-4{grid-template-columns:repeat(2,minmax(0,1fr))}
}

@media (min-width:1200px){
  body.portal-sidebar-collapsed{padding-left:var(--portal-sidebar-rail)!important}
  body.portal-sidebar-collapsed .portal-sidebar{width:var(--portal-sidebar-rail)}
  body.portal-sidebar-collapsed .portal-topbar{left:var(--portal-sidebar-rail)}
  body.portal-sidebar-collapsed .portal-page-loader{left:var(--portal-sidebar-rail)}
  body.portal-sidebar-collapsed .portal-sidebar-head>span:last-child,body.portal-sidebar-collapsed .portal-menu-search input,body.portal-sidebar-collapsed .portal-nav-label,body.portal-sidebar-collapsed .portal-nav-link span,body.portal-sidebar-collapsed .portal-sidebar-foot span{display:none}
  body.portal-sidebar-collapsed .portal-sidebar-head,body.portal-sidebar-collapsed .portal-menu-search,body.portal-sidebar-collapsed .portal-nav-link{justify-content:center}
  body.portal-sidebar-collapsed .portal-menu-search{padding:0}
  body.portal-sidebar-collapsed .portal-nav-link{padding:0}
  body.portal-sidebar-collapsed .portal-nav-link i{width:auto;font-size:17px}
  body.portal-sidebar-collapsed .portal-sidebar-foot{grid-template-columns:1fr}
}

@media (max-width:991px){
  .portal-grid-3{grid-template-columns:repeat(2,minmax(0,1fr))}
  .portal-quick-grid{grid-template-columns:repeat(4,minmax(0,1fr))}
  .portal-hero-grid{grid-template-columns:auto 1fr}.portal-hero-grid>.portal-actions{grid-column:1/-1}
}

@media (max-width:767px){
  :root{--portal-topbar-height:64px}
  body.portal-body{padding:var(--portal-topbar-height) 0 84px!important}
  body.portal-body .portal-main{padding:12px 11px 0}
  .portal-sidebar{width:min(88vw,310px);transform:translateX(-105%);padding-bottom:80px}
  .portal-sidebar.open{transform:none}
  .portal-overlay.open{opacity:1;visibility:visible}
  .portal-topbar{left:0;padding:0 10px;gap:8px}
  .portal-page-loader{left:0}
  .portal-brand strong{font-size:12px;max-width:150px}.portal-brand small{font-size:8px}.portal-brand-mark{width:38px;height:38px;border-radius:12px}
  .portal-session-chip{display:none}.portal-theme-toggle{display:none}.portal-user-copy{display:none}.portal-user-button{width:43px;padding:3px;justify-content:center}.portal-user-button>i{display:none}.portal-user-avatar{width:37px;height:37px}
  .portal-profile-menu{top:58px;right:8px;width:min(260px,calc(100vw - 16px))}
  .portal-footer{display:none}
  .portal-bottom-nav{position:fixed;z-index:1180;left:8px;right:8px;bottom:7px;height:66px;padding:5px;border:1px solid var(--portal-border);border-radius:19px;background:rgba(255,255,255,.94);box-shadow:0 12px 38px rgba(17,28,56,.22);backdrop-filter:blur(16px);display:grid;grid-template-columns:repeat(5,1fr)}
  html[data-portal-theme="dark"] .portal-bottom-nav{background:rgba(21,31,52,.94)}
  .portal-bottom-nav a{position:relative;border-radius:14px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;text-decoration:none!important;color:var(--portal-muted)!important;font-size:8px;font-weight:800}
  .portal-bottom-nav a i{font-size:15px}.portal-bottom-nav a.active{color:#fff!important;background:linear-gradient(135deg,var(--portal-primary),var(--portal-primary-2));box-shadow:0 8px 18px rgba(49,87,232,.28)}
  .portal-page-head{align-items:flex-start;margin-bottom:14px}.portal-page-head h1{font-size:23px!important}.portal-page-head p{font-size:10px}.portal-page-head>.portal-actions{width:100%}
  .portal-grid-2,.portal-grid-3,.portal-grid-4{grid-template-columns:1fr}
  .portal-stat{min-height:112px;padding:15px}.portal-stat-value{font-size:22px}.portal-stat-icon{width:38px;height:38px;margin-bottom:11px}
  .portal-hero{padding:16px;border-radius:20px}.portal-hero-grid{grid-template-columns:62px 1fr;gap:11px}.portal-hero-avatar{width:62px;height:62px;border-radius:17px}.portal-hero h2{font-size:19px}.portal-hero p{font-size:9px}.portal-chip-row{gap:5px;margin-top:8px}.portal-chip{font-size:8px;padding:5px 7px}
  .portal-quick-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}.portal-quick-link{min-height:96px;padding:10px 5px;border-radius:15px}.portal-quick-icon{width:39px;height:39px;border-radius:12px;font-size:15px}.portal-quick-link strong{font-size:9px}.portal-quick-link small{display:none}
  .portal-card{padding:14px}.portal-card-head,.box-header,.card-header{padding:13px 14px!important}.portal-card-body,.box-body,.card-body{padding:14px!important}
  .content-header h1{font-size:23px!important}.content-header h1 small{display:block!important;margin-top:4px}
  body.portal-body .row{margin-left:-4px!important;margin-right:-4px!important}body.portal-body [class*="col-"]{padding-left:4px!important;padding-right:4px!important}
  body.portal-body .section-grid{grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:8px!important}body.portal-body .section-grid .box,body.portal-body .section-grid .tile{min-height:100px!important;border-radius:15px!important;padding:10px 5px!important}
  .portal-toast-stack{top:72px;right:8px;width:calc(100vw - 16px)}
  .table-responsive{border:0;border-radius:0}
  table.portal-mobile-cards thead,.hms-responsive-table thead{display:none}
  table.portal-mobile-cards,table.portal-mobile-cards tbody,table.portal-mobile-cards tr,table.portal-mobile-cards td,.hms-responsive-table,.hms-responsive-table tbody,.hms-responsive-table tr,.hms-responsive-table td{display:block!important;width:100%!important}
  table.portal-mobile-cards tr,.hms-responsive-table tr{margin-bottom:10px;border:1px solid var(--portal-border);border-radius:15px;background:var(--portal-surface);overflow:hidden;box-shadow:0 7px 18px rgba(24,39,75,.05)}
  table.portal-mobile-cards td,.hms-responsive-table td{position:relative;padding:9px 11px 9px 43%!important;border-bottom:1px solid var(--portal-border)!important;min-height:37px;text-align:right!important}
  table.portal-mobile-cards td:before,.hms-responsive-table td:before{content:attr(data-label);position:absolute;left:11px;top:10px;width:38%;text-align:left;color:var(--portal-muted);font-size:8px;font-weight:900;text-transform:uppercase}
  table.portal-mobile-cards td:last-child,.hms-responsive-table td:last-child{border-bottom:0!important}
  .dataTables_wrapper .dataTables_length,.dataTables_wrapper .dataTables_filter{float:none!important;text-align:left!important;width:100%}.dataTables_wrapper .dataTables_filter input{width:calc(100% - 58px)!important}
}

@media (max-width:420px){
  .portal-brand>span:last-child{display:none}
  .portal-topbar{justify-content:space-between}.portal-top-actions{margin-left:0}
  .portal-quick-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
  body.portal-body .section-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .portal-hero-grid{grid-template-columns:54px 1fr}.portal-hero-avatar{width:54px;height:54px}.portal-hero h2{font-size:17px}
}

@media print{
  body.portal-body{padding:0!important;background:#fff!important;color:#000!important}
  .portal-topbar,.portal-sidebar,.portal-overlay,.portal-bottom-nav,.portal-footer,.portal-profile-menu,.portal-page-loader,.portal-actions,.no-print{display:none!important}
  body.portal-body .portal-main{width:100%;max-width:none;padding:0}
  .portal-card,.card,.box,.hms-card{box-shadow:none!important;border-color:#aaa!important;break-inside:avoid}
}

/* ===== Unified legacy + fee/accounting compatibility ===== */
.wrapper,.content-wrapper,.content,.content-header{display:contents}
.content-header h1{margin:0 0 16px;font-size:clamp(1.45rem,2.4vw,2.1rem);font-weight:900;color:var(--portal-text)}
.content-header h1 small{display:inline;font-size:.48em;font-weight:600;color:var(--portal-muted);margin-left:6px}
.hms-card,.box{background:var(--portal-card);border:1px solid var(--portal-border);border-radius:18px;box-shadow:var(--portal-shadow);overflow:hidden}
.hms-card .box-header,.box>.box-header{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:16px 18px;border-bottom:1px solid var(--portal-border)}
.hms-card .box-body,.box>.box-body{padding:17px 18px}.box-title{margin:0;font-size:1.05rem;font-weight:900}
.hms-grid{display:grid;gap:15px}.hms-grid-2{grid-template-columns:repeat(2,minmax(0,1fr))}.hms-grid-3{grid-template-columns:repeat(3,minmax(0,1fr))}.hms-grid-4{grid-template-columns:repeat(4,minmax(0,1fr))}
.hms-stat{padding:18px}.hms-stat .label{font-size:.73rem;color:var(--portal-muted);font-weight:800;text-transform:uppercase;letter-spacing:.05em}.hms-stat .value{font-size:1.65rem;font-weight:900;margin-top:7px}.hms-stat .meta{font-size:.76rem;color:var(--portal-muted);margin-top:5px}
.hms-filter-card{background:var(--portal-soft);border:1px solid var(--portal-border);border-radius:15px;padding:14px}.hms-filter-grid{display:grid;grid-template-columns:repeat(6,minmax(130px,1fr));gap:11px;align-items:end}.hms-filter-field.wide{grid-column:span 2}.hms-filter-field.search{grid-column:span 2}.hms-filter-field label{display:block;font-size:.68rem;font-weight:900;color:var(--portal-muted);margin-bottom:6px;text-transform:uppercase}.hms-filter-actions{display:flex;gap:7px;align-items:end}
.hms-report-head{display:flex;justify-content:space-between;align-items:center;gap:15px;margin-bottom:16px}.hms-report-head h2{margin:0}.hms-report-head p{margin:5px 0 0;color:var(--portal-muted)}.hms-page-actions{display:flex;gap:8px;flex-wrap:wrap}.hms-report-note,.hms-alert{padding:12px 14px;border-radius:12px;background:#eef6ff;border:1px solid #cfe1ff;display:flex;gap:9px;align-items:flex-start;color:#31527b}.hms-alert-warning{background:#fff8e5;border-color:#f7df91;color:#7a4b00}
.hms-badge{display:inline-flex;align-items:center;border-radius:999px;padding:5px 9px;font-size:.68rem;font-weight:900}.hms-badge-info{background:#e4efff;color:#2457c5}.hms-badge-success{background:#dcfce7;color:#166534}.hms-badge-danger{background:#fee2e2;color:#b91c1c}.hms-badge-warning{background:#fef3c7;color:#92400e}
.hms-money-paid{color:var(--portal-success)!important;font-weight:900}.hms-money-due{color:var(--portal-danger)!important;font-weight:900}.hms-table-empty,.text-center{text-align:center}.text-right{text-align:right}.text-muted{color:var(--portal-muted)!important}.text-success{color:var(--portal-success)!important}.text-danger{color:var(--portal-danger)!important}
.table-responsive{width:100%;overflow:auto;-webkit-overflow-scrolling:touch}.table{width:100%;border-collapse:separate;border-spacing:0}.table th,.table td{padding:12px 13px;border-bottom:1px solid var(--portal-border);vertical-align:middle}.table th{background:var(--portal-soft);font-size:.69rem;text-transform:uppercase;letter-spacing:.04em;color:var(--portal-muted);font-weight:900}.table-striped tbody tr:nth-child(even){background:color-mix(in srgb,var(--portal-soft) 55%,transparent)}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:7px;border:1px solid transparent;border-radius:10px;padding:9px 13px;font:inherit;font-size:.78rem;font-weight:800;text-decoration:none;cursor:pointer;transition:.18s ease}.btn:hover{transform:translateY(-1px);text-decoration:none}.btn-primary{background:linear-gradient(135deg,var(--portal-primary),var(--portal-accent));color:#fff}.btn-success{background:#16a34a;color:#fff}.btn-danger{background:#dc2626;color:#fff}.btn-warning{background:#f59e0b;color:#fff}.btn-default,.btn-secondary{background:var(--portal-card);border-color:var(--portal-border);color:var(--portal-text)}.btn-info{background:#0ea5e9;color:#fff}.btn-xs{padding:6px 8px;font-size:.68rem}.btn-sm{padding:7px 10px;font-size:.72rem}
.form-control,input[type=text],input[type=number],input[type=date],input[type=email],input[type=password],input[type=search],select,textarea{width:100%;border:1px solid var(--portal-border);background:var(--portal-card);color:var(--portal-text);border-radius:11px;padding:10px 12px;min-height:42px;outline:0;transition:.18s ease}.form-control:focus,input:focus,select:focus,textarea:focus{border-color:var(--portal-primary);box-shadow:0 0 0 3px rgba(49,87,232,.12)}
.pagination{display:flex;gap:5px;list-style:none;padding:0}.pagination a{display:grid;place-items:center;min-width:34px;height:34px;border-radius:9px;border:1px solid var(--portal-border);color:var(--portal-text);text-decoration:none}.pagination .active a{background:var(--portal-primary);color:#fff;border-color:var(--portal-primary)}
@media(max-width:1100px){.hms-grid-4{grid-template-columns:repeat(2,minmax(0,1fr))}.hms-filter-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(max-width:767px){.hms-grid-2,.hms-grid-3,.hms-grid-4{grid-template-columns:1fr}.hms-filter-grid{grid-template-columns:1fr 1fr}.hms-filter-field.wide,.hms-filter-field.search{grid-column:1/-1}.hms-report-head{align-items:flex-start;flex-direction:column}.hms-page-actions{width:100%}.hms-page-actions .btn{flex:1}.hms-responsive-table thead{display:none}.hms-responsive-table,.hms-responsive-table tbody,.hms-responsive-table tr,.hms-responsive-table td{display:block;width:100%}.hms-responsive-table tr{background:var(--portal-card);border:1px solid var(--portal-border);border-radius:14px;padding:10px 12px;margin-bottom:10px;box-shadow:0 5px 15px rgba(15,23,42,.04)}.hms-responsive-table td{display:flex!important;justify-content:space-between;gap:12px;border:0!important;padding:7px 0!important;text-align:right!important}.hms-responsive-table td:before{content:attr(data-label);color:var(--portal-muted);font-size:.68rem;font-weight:800;text-align:left}.hms-responsive-table td.hms-card-primary{display:block!important;text-align:left!important;border-bottom:1px dashed var(--portal-border)!important;padding-bottom:10px!important}.hms-responsive-table td.hms-card-primary:before,.hms-responsive-table td.hms-card-actions:before{display:none}.hms-responsive-table td.hms-card-actions{display:block!important;text-align:left!important;padding-top:10px!important}.hms-responsive-table td.hms-card-actions .btn{width:100%}.hms-filter-actions{grid-column:1/-1}.hms-filter-actions .btn{flex:1}}
@media(max-width:480px){.hms-filter-grid{grid-template-columns:1fr}.hms-filter-field.wide,.hms-filter-field.search{grid-column:auto}}
