:root{
  --elite-sidebar: #16233d;
  --elite-sidebar-soft: #1c2c4c;
  --elite-sidebar-hover: #223559;
  --elite-sidebar-text: #a9b7cd;
  --elite-sidebar-text-active: #ffffff;
  --elite-sidebar-border: rgba(255, 255, 255, 0.08);
}

.app-shell{
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  background: var(--app-bg);
  transition: grid-template-columns 0.18s ease;
}

.app-sidebar{
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--elite-sidebar);
  color: #fff;
  padding: 18px 14px;
  overflow-y: auto;
  border-right: 1px solid var(--elite-sidebar-border);
}

.app-brand{
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 8px;
  margin-bottom: 22px;
}

.app-brand-identity{
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-brand-logo{
  display: block;
  height: 34px;
  width: auto;
  max-width: 100%;
}

.sidebar-toggle-btn{
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--elite-sidebar-text);
  cursor: pointer;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-toggle-btn:hover{
  color: #fff;
  background: var(--elite-sidebar-hover);
}

.app-nav{
  display: grid;
  gap: 4px;
}

.app-nav a{
  color: var(--elite-sidebar-text);
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 11px;
  transition: background 0.15s ease, color 0.15s ease;
}

.app-nav a:hover{
  background: var(--elite-sidebar-hover);
  color: #fff;
}

.app-nav a.active{
  background: var(--app-primary);
  color: var(--elite-sidebar-text-active);
}

.nav-icon{
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-icon svg{
  width: 18px;
  height: 18px;
}

.nav-label{
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-main{
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-topbar{
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 64px;
  background: #fff;
  border-bottom: 1px solid var(--app-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 24px;
  box-shadow: var(--app-shadow-sm);
}

.app-breadcrumbs{
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  overflow: hidden;
  color: var(--app-muted);
  font-size: 13px;
}

.app-breadcrumbs a{
  color: var(--app-link);
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
}

.app-breadcrumbs a:hover{
  text-decoration: underline;
}

.app-breadcrumbs span{
  margin: 0 6px;
  color: var(--app-border-strong);
  white-space: nowrap;
}

.app-userbox{
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-size: 14px;
  white-space: nowrap;
}

.app-user{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  padding: 4px 8px;
  border-radius: 999px;
  transition: background 0.15s ease;
}

.app-user:hover{
  background: var(--app-surface-soft);
  color: inherit;
}

.token-balance{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--app-surface-soft);
  color: var(--app-text);
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  transition: background 0.15s ease;
}

.token-balance:hover{
  background: var(--app-border);
  color: var(--app-text);
}

.token-balance svg{
  width: 18px;
  height: 18px;
  color: var(--app-primary);
  flex-shrink: 0;
}

.app-user-avatar{
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--app-primary-soft);
  color: var(--app-primary-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
}

.app-user-name{
  font-weight: 600;
  color: var(--app-text);
}

.app-logout-btn{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--app-border-strong);
  background: #fff;
  color: var(--app-text);
  border-radius: 10px;
  padding: 8px 12px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.app-logout-btn svg{
  width: 15px;
  height: 15px;
}

.app-logout-btn:hover{
  background: var(--app-surface-soft);
  border-color: #9ca3af;
}

.app-content{
  width: 100%;
  padding: 24px;
  display: flex;
  justify-content: center;
}

.app-page-card{
  width: 100%;
  max-width: 1280px;
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--app-shadow-sm);
}

.app-footer{
  margin-top: auto;
  padding: 18px 24px;
  text-align: center;
  font-size: 12px;
  color: var(--app-muted);
}

.app-footer a{
  color: var(--app-muted);
  text-decoration: none;
}

.app-footer a:hover{
  text-decoration: underline;
}

body.sidebar-collapsed .app-shell{
  grid-template-columns: 76px minmax(0, 1fr);
}

body.sidebar-collapsed .app-sidebar{
  padding-left: 10px;
  padding-right: 10px;
}

body.sidebar-collapsed .app-brand{
  justify-content: center;
  padding-left: 0;
  padding-right: 0;
}

body.sidebar-collapsed .app-brand-logo{
  display: none;
}

body.sidebar-collapsed .app-nav a{
  justify-content: center;
  padding-left: 8px;
  padding-right: 8px;
}

body.sidebar-collapsed .nav-label{
  display: none;
}

body.sidebar-collapsed .sidebar-toggle-btn{
  width: 40px;
  font-size: 18px;
}

@media (max-width: 900px){
  .app-shell{
    grid-template-columns: 1fr;
  }

  .app-sidebar{
    position: static;
    height: auto;
    display: none;
  }

  .app-topbar{
    padding: 0 16px;
  }

  .app-content{
    padding: 16px;
  }

  .app-page-card{
    padding: 18px;
    border-radius: 14px;
  }
}
