:root{
  --abby-bg:#f5f8fc;
  --abby-surface:#ffffff;
  --abby-surface-2:#f8fbff;
  --abby-text:#142033;
  --abby-muted:#667085;
  --abby-border:#e4eaf2;
  --abby-primary:#0ea5a4;
  --abby-primary-dark:#087c7b;
  --abby-navy:#101828;
  --abby-success:#12b76a;
  --abby-danger:#f04438;
  --abby-warning:#f79009;
  --abby-purple:#7c3aed;
  --abby-shadow:0 18px 50px rgba(16,24,40,.08);
}

[data-theme="dark"]{
  --abby-bg:#08141a;
  --abby-surface:#11222c;
  --abby-surface-2:#0c1822;
  --abby-text:#f8fafc;
  --abby-muted:#98a2b3;
  --abby-border:#2a4458;
  --abby-navy:#050816;
  --abby-shadow:0 18px 50px rgba(0,0,0,.35);
}

*{box-sizing:border-box}

body.auth-body,
body.app-body{
  margin:0;
  font-family:Manrope,Arial,sans-serif;
  background:var(--abby-bg);
  color:var(--abby-text);
}

.auth-shell{
  min-height:100vh;
  display:grid;
  grid-template-columns:1.05fr .95fr;
}

.auth-visual{
  padding:46px;
  display:flex;
  flex-direction:column;
  justify-content:center;
  background:radial-gradient(circle at top left,#0ea5a4 0,#101828 38%,#050816 100%);
  color:white;
  position:relative;
  overflow:hidden;
}

.auth-visual:after{
  content:"";
  position:absolute;
  right:-120px;
  bottom:-120px;
  width:320px;
  height:320px;
  border-radius:50%;
  background:rgba(255,255,255,.08);
}

.auth-brand{
  position:absolute;
  top:34px;
  left:42px;
  display:flex;
  gap:12px;
  align-items:center;
  color:white;
  font-weight:900;
  font-size:20px;
  text-decoration:none;
}

.auth-brand img{
  width:42px;
  height:42px;
  border-radius:12px;
  background:white;
  padding:4px;
}

.auth-kicker{
  display:inline-flex;
  width:max-content;
  padding:8px 12px;
  border:1px solid rgba(255,255,255,.18);
  border-radius:999px;
  color:#ccfbf1;
  margin-bottom:18px;
  font-weight:800;
  font-size:13px;
}

.auth-visual h1{
  font-family:Sora,Manrope,sans-serif;
  font-size:46px;
  line-height:1.05;
  max-width:720px;
  margin:0 0 18px;
  font-weight:800;
  color:white;
}

.auth-visual p{
  max-width:620px;
  color:#d0d5dd;
  font-size:17px;
  line-height:1.7;
}

.auth-points{
  display:grid;
  gap:12px;
  margin-top:28px;
  max-width:520px;
}

.auth-points div{
  background:rgba(255,255,255,.09);
  border:1px solid rgba(255,255,255,.12);
  padding:14px 16px;
  border-radius:16px;
  color:#eef4ff;
  font-weight:800;
}

.auth-points i{
  margin-right:10px;
  color:#99f6e4;
}

.auth-main{
  display:flex;
  align-items:center;
  justify-content:center;
  padding:28px;
}

.auth-card{
  width:100%;
  max-width:450px;
  background:var(--abby-surface);
  border:1px solid var(--abby-border);
  border-radius:28px;
  padding:34px;
  box-shadow:var(--abby-shadow);
}

.auth-card-head h2{
  font-family:Sora,Manrope,sans-serif;
  font-size:30px;
  font-weight:800;
  margin:0 0 8px;
  color:var(--abby-text);
}

.auth-card-head p{
  color:var(--abby-muted);
  margin-bottom:24px;
}

.auth-card .form-label{
  font-weight:800;
  color:var(--abby-text);
}

.auth-card .form-control{
  border-radius:14px;
  padding:13px 14px;
  border-color:var(--abby-border);
}

.auth-card .input-group .form-control{
  border-radius:14px 0 0 14px;
}

.auth-card .input-group .btn{
  border-radius:0 14px 14px 0;
}

.auth-submit{
  border-radius:14px;
  padding:13px;
  font-weight:900;
}

.auth-back{
  display:block;
  text-align:center;
  margin-top:18px;
  color:var(--abby-primary);
  font-weight:800;
  text-decoration:none;
}

.app-topbar{
  position:fixed;
  top:0;
  left:280px;
  right:0;
  height:76px;
  background:rgba(255,255,255,.88);
  backdrop-filter:blur(18px);
  border-bottom:1px solid var(--abby-border);
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:0 24px;
  z-index:40;
}

[data-theme="dark"] .app-topbar{
  background:rgba(17,34,44,.88);
}

.topbar-left,
.topbar-right{
  display:flex;
  align-items:center;
  gap:14px;
}

.icon-btn{
  width:42px;
  height:42px;
  border:1px solid var(--abby-border);
  background:var(--abby-surface);
  color:var(--abby-text);
  border-radius:14px;
  display:grid;
  place-items:center;
}

.topbar-search{
  height:42px;
  width:380px;
  display:flex;
  align-items:center;
  gap:10px;
  background:var(--abby-surface-2);
  border:1px solid var(--abby-border);
  border-radius:14px;
  padding:0 14px;
  color:var(--abby-muted);
}

.topbar-search input{
  border:0;
  outline:0;
  background:transparent;
  width:100%;
  color:var(--abby-muted);
}

.user-pill{
  display:flex;
  align-items:center;
  gap:10px;
  background:var(--abby-surface);
  border:1px solid var(--abby-border);
  border-radius:18px;
  padding:8px 12px;
}

.avatar{
  width:38px;
  height:38px;
  border-radius:14px;
  background:linear-gradient(135deg,var(--abby-primary),var(--abby-success));
  color:white;
  display:grid;
  place-items:center;
  font-weight:900;
}

.user-pill strong{
  display:block;
  font-size:14px;
  color:var(--abby-text);
}

.user-pill span{
  display:block;
  font-size:12px;
  color:var(--abby-muted);
  text-transform:capitalize;
}

.app-sidebar{
  position:fixed;
  top:0;
  left:0;
  width:280px;
  height:100vh;
  background:var(--abby-navy);
  color:white;
  z-index:50;
  display:flex;
  flex-direction:column;
  padding:18px;
}

.sidebar-brand{
  height:58px;
  display:flex;
  align-items:center;
  gap:12px;
  color:white;
  margin-bottom:18px;
  text-decoration:none;
}

.sidebar-brand img{
  width:42px;
  height:42px;
  border-radius:14px;
  background:white;
  padding:4px;
}

.sidebar-brand strong{
  display:block;
  font-size:19px;
  color:white;
}

.sidebar-brand span{
  display:block;
  color:#98a2b3;
  font-size:12px;
}

.app-sidebar .sidebar-nav{
  display:flex;
  flex-direction:column;
  gap:6px;
  overflow:auto;
  flex:1;
}

.app-sidebar .nav-section{
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:.12em;
  color:#98a2b3;
  font-weight:900;
  margin:16px 10px 8px;
}

.app-sidebar .nav-link{
  height:46px;
  display:flex;
  align-items:center;
  gap:12px;
  color:#cbd5e1;
  border-radius:14px;
  padding:0 13px;
  font-weight:800;
  text-decoration:none;
}

.app-sidebar .nav-link i{
  font-size:18px;
}

.app-sidebar .nav-link:hover,
.app-sidebar .nav-link.active{
  background:#1d2939;
  color:white;
}

.app-sidebar .nav-link.logout{
  margin-top:8px;
  color:#fecaca;
}

.app-sidebar .nav-link.disabled{
  opacity:.55;
  pointer-events:none;
}

.sidebar-help{
  margin-top:auto;
  background:rgba(255,255,255,.08);
  border:1px solid rgba(255,255,255,.1);
  border-radius:18px;
  padding:14px;
  display:flex;
  gap:12px;
  align-items:center;
}

.sidebar-help i{
  font-size:24px;
  color:#86efac;
}

.sidebar-help strong{
  display:block;
  color:white;
}

.sidebar-help span{
  display:block;
  color:#98a2b3;
  font-size:12px;
}

.app-main{
  margin-left:280px;
  padding-top:76px;
  min-height:100vh;
  background:var(--abby-bg);
}

.app-content{
  padding:26px;
  min-height:calc(100vh - 130px);
}

.page-header{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:18px;
  margin-bottom:18px;
}

.page-kicker{
  font-size:12px;
  font-weight:900;
  color:var(--abby-primary);
  text-transform:uppercase;
  letter-spacing:.12em;
}

.page-header h1{
  font-family:Sora,Manrope,sans-serif;
  font-size:34px;
  font-weight:800;
  margin:6px 0;
  color:var(--abby-text);
}

.page-header p{
  margin:0;
  color:var(--abby-muted);
}

.page-actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}

.hero-card{
  background:linear-gradient(135deg,var(--abby-primary),#101828);
  color:white;
  border-radius:28px;
  padding:28px;
  display:flex;
  justify-content:space-between;
  gap:18px;
  box-shadow:var(--abby-shadow);
  margin-bottom:18px;
}

.hero-label{
  font-size:12px;
  font-weight:900;
  letter-spacing:.12em;
  text-transform:uppercase;
  color:#ccfbf1;
}

.hero-card h2{
  font-family:Sora,Manrope,sans-serif;
  font-size:30px;
  font-weight:800;
  margin:8px 0;
  color:white;
}

.hero-card p{
  max-width:760px;
  color:#dbeafe;
  margin:0;
}

.hero-badge{
  height:max-content;
  background:rgba(255,255,255,.12);
  border:1px solid rgba(255,255,255,.16);
  border-radius:999px;
  padding:10px 14px;
  font-weight:900;
}

.stat-grid{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:16px;
  margin-bottom:18px;
}

.stat-card{
  background:var(--abby-surface);
  border:1px solid var(--abby-border);
  border-radius:24px;
  padding:22px;
  box-shadow:var(--abby-shadow);
}

.stat-icon{
  width:44px;
  height:44px;
  border-radius:16px;
  display:grid;
  place-items:center;
  color:white;
  margin-bottom:14px;
}

.stat-icon.blue{background:#0ea5a4}
.stat-icon.green{background:#12b76a}
.stat-icon.purple{background:#7c3aed}
.stat-icon.orange{background:#f79009}

.stat-card span{
  display:block;
  color:var(--abby-muted);
  font-weight:800;
}

.stat-card strong{
  display:block;
  font-size:30px;
  font-weight:900;
  margin:4px 0;
  text-transform:capitalize;
  color:var(--abby-text);
}

.stat-card small{
  color:var(--abby-muted);
}

.dashboard-grid{
  display:grid;
  grid-template-columns:1.2fr .8fr;
  gap:16px;
}

.panel-card{
  background:var(--abby-surface);
  border:1px solid var(--abby-border);
  border-radius:24px;
  padding:22px;
  box-shadow:var(--abby-shadow);
}

.panel-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:16px;
}

.panel-head h3{
  font-family:Sora,Manrope,sans-serif;
  font-size:18px;
  font-weight:800;
  margin:0;
  color:var(--abby-text);
}

.panel-head span{
  color:var(--abby-muted);
  font-size:13px;
  font-weight:800;
}

.task-list,
.health-list{
  display:grid;
  gap:12px;
}

.task-item{
  display:flex;
  gap:12px;
  align-items:flex-start;
  padding:14px;
  border:1px solid var(--abby-border);
  border-radius:18px;
  background:var(--abby-surface-2);
}

.task-item i{
  font-size:22px;
  color:var(--abby-muted);
}

.task-item.done i{color:var(--abby-success)}
.task-item.active i{color:var(--abby-primary)}

.task-item strong{
  display:block;
  color:var(--abby-text);
}

.task-item span{
  display:block;
  color:var(--abby-muted);
  font-size:13px;
}

.health-list div{
  display:flex;
  justify-content:space-between;
  border-bottom:1px solid var(--abby-border);
  padding:12px 0;
}

.health-list div:last-child{
  border-bottom:0;
}

.health-list span{
  color:var(--abby-muted);
  font-weight:800;
}

.health-list strong.ok{
  color:var(--abby-success);
}

.app-footer{
  height:54px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:0 26px;
  color:var(--abby-muted);
  font-size:13px;
  border-top:1px solid var(--abby-border);
}

.sidebar-overlay{
  display:none;
}

@media(max-width:1100px){
  .stat-grid{grid-template-columns:repeat(2,1fr)}
  .dashboard-grid{grid-template-columns:1fr}
  .topbar-search{display:none}
}

@media(max-width:860px){
  .auth-shell{grid-template-columns:1fr}
  .auth-visual{display:none}

  .app-sidebar{
    transform:translateX(-105%);
    transition:.25s ease;
  }

  .sidebar-open .app-sidebar{
    transform:translateX(0);
  }

  .app-topbar{
    left:0;
  }

  .app-main{
    margin-left:0;
  }

  .sidebar-open .sidebar-overlay{
    display:block;
    position:fixed;
    inset:0;
    background:rgba(0,0,0,.45);
    z-index:45;
  }

  .stat-grid{grid-template-columns:1fr}
  .page-header,
  .hero-card{flex-direction:column}
}

/* =========================================================
   HCIH Sidebar Collapse / Hide Fix
   ========================================================= */

:root {
  --hcih-sidebar-width: 280px;
  --hcih-sidebar-collapsed-width: 84px;
}

/* Desktop default */
@media (min-width: 992px) {
  body.app-body .app-sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: var(--hcih-sidebar-width) !important;
    transform: none !important;
    overflow-x: hidden !important;
    transition: width .2s ease !important;
    z-index: 1040 !important;
  }

  body.app-body .app-main {
    margin-left: var(--hcih-sidebar-width) !important;
    transition: margin-left .2s ease !important;
  }

  body.app-body .app-topbar {
    left: var(--hcih-sidebar-width) !important;
    width: calc(100% - var(--hcih-sidebar-width)) !important;
    transition: left .2s ease, width .2s ease !important;
  }

  body.app-body.sb-collapsed .app-sidebar {
    width: var(--hcih-sidebar-collapsed-width) !important;
  }

  body.app-body.sb-collapsed .app-main {
    margin-left: var(--hcih-sidebar-collapsed-width) !important;
  }

  body.app-body.sb-collapsed .app-topbar {
    left: var(--hcih-sidebar-collapsed-width) !important;
    width: calc(100% - var(--hcih-sidebar-collapsed-width)) !important;
  }

  body.app-body.sb-collapsed .sidebar-brand div,
  body.app-body.sb-collapsed .nav-section,
  body.app-body.sb-collapsed .nav-link span {
    display: none !important;
  }

  body.app-body.sb-collapsed .sidebar-brand {
    justify-content: center !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  body.app-body.sb-collapsed .sidebar-brand img {
    margin: 0 auto !important;
  }

  body.app-body.sb-collapsed .sidebar-nav {
    align-items: center !important;
  }

  body.app-body.sb-collapsed .nav-link {
    justify-content: center !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  body.app-body.sb-collapsed .nav-link i {
    margin: 0 !important;
    font-size: 1.15rem !important;
  }

  body.app-body .sidebar-overlay {
    display: none !important;
  }
}

/* Mobile drawer */
@media (max-width: 991.98px) {
  body.app-body .app-sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: var(--hcih-sidebar-width) !important;
    transform: translateX(-105%) !important;
    transition: transform .2s ease !important;
    z-index: 1040 !important;
    overflow-x: hidden !important;
    box-shadow: 0 20px 60px rgba(15, 23, 42, .24) !important;
  }

  body.app-body.sidebar-open .app-sidebar {
    transform: translateX(0) !important;
  }

  body.app-body .app-main {
    margin-left: 0 !important;
  }

  body.app-body .app-topbar {
    left: 0 !important;
    width: 100% !important;
  }

  body.app-body .sidebar-overlay {
    display: none !important;
  }

  body.app-body.sidebar-open .sidebar-overlay {
    display: block !important;
    position: fixed !important;
    inset: 0 !important;
    background: rgba(15, 23, 42, .42) !important;
    z-index: 1030 !important;
  }

  body.app-body.sb-collapsed .sidebar-brand div,
  body.app-body.sb-collapsed .nav-section,
  body.app-body.sb-collapsed .nav-link span {
    display: block !important;
  }

  body.app-body.sb-collapsed .nav-link {
    justify-content: flex-start !important;
    padding-left: 16px !important;
    padding-right: 16px !important;
  }
}