/* App shell: sidebar + topbar + content + right panel */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg2) 100%);
  color: #d7e8e7;
  position: fixed; top: 0; left: 0; bottom: 0;
  z-index: 40;
  display: flex; flex-direction: column;
  transition: width .25s ease, left .25s ease;
  box-shadow: 4px 0 20px rgba(0,0,0,.12);
}
.sidebar-brand {
  height: var(--topbar-height);
  background: var(--teal);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 14px 0 16px;
  flex-shrink: 0;
}
.sidebar-brand .brand-logo { display: flex; align-items: center; gap: 10px; color: #fff; overflow: hidden; }
.sidebar-brand .brand-logo img { height: 44px; width: auto; }
.sidebar-toggle {
  width: 30px; height: 30px; border-radius: 50%; border: 0;
  background: var(--sidebar-bg); color: #fff; cursor: pointer; display: grid; place-items: center;
  flex-shrink: 0;
}
.sidebar-menu { list-style: none; margin: 0; padding: 8px 0 30px; overflow-y: auto; flex: 1; }
.sidebar-menu > li { border-bottom: 1px solid rgba(255,255,255,.05); }
.sidebar-menu a {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 18px; color: #d7e8e7; font-size: 14px; white-space: nowrap;
  transition: background .15s, color .15s;
}
.sidebar-menu a i.icon { width: 20px; text-align: center; font-size: 14px; opacity: .85; }
.sidebar-menu a .arrow { margin-left: auto; font-size: 10px; opacity: .6; transition: transform .2s; }
.sidebar-menu li.open > a .arrow { transform: rotate(180deg); }
.sidebar-menu a:hover, .sidebar-menu li.active > a { background: rgba(255,255,255,.06); color: var(--theme-color); }
.sidebar-menu > li.active > a { border-left: 3px solid var(--theme-color); padding-left: 15px; }
.sidebar-menu .submenu { list-style: none; margin: 0; padding: 0; display: none; background: rgba(0,0,0,.18); }
.sidebar-menu li.open > .submenu { display: block; }
.sidebar-menu .submenu a { padding: 10px 18px 10px 38px; font-size: 13px; }
.sidebar-menu .submenu li.active > a { color: var(--theme-color); background: rgba(0,0,0,.2); }
.sidebar-menu .badge-new { background: var(--red); color: #fff; font-size: 9px; padding: 2px 6px; border-radius: 10px; margin-left: 6px; font-weight: 600; }

body.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed); }
body.sidebar-collapsed .sidebar-brand { padding: 0; justify-content: center; }
body.sidebar-collapsed .sidebar-brand .brand-logo,
body.sidebar-collapsed .sidebar-menu a span,
body.sidebar-collapsed .sidebar-menu a .arrow,
body.sidebar-collapsed .submenu { display: none; }
body.sidebar-collapsed .sidebar-menu a { justify-content: center; padding: 14px 0; }
body.sidebar-collapsed .main { margin-left: var(--sidebar-collapsed); }
body.sidebar-collapsed .topbar { left: var(--sidebar-collapsed); }

.main { margin-left: var(--sidebar-width); flex: 1; min-width: 0; transition: margin .25s ease; }

.topbar {
  position: fixed; top: 0; right: 0; left: var(--sidebar-width);
  height: var(--topbar-height);
  background: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
  z-index: 30;
  box-shadow: 0 2px 12px rgba(17,98,95,.06);
  transition: left .25s ease;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar .updates-btn {
  background: var(--smoke); border: 1px solid var(--border); border-radius: 30px;
  padding: 7px 18px; font-size: 13px; color: var(--body-color); cursor: pointer; font-family: var(--body-font);
}
.topbar .updates-btn:hover { background: #e5eff5; }
.topbar .mobile-menu-btn { display: none; border: 0; background: var(--teal); color: #fff; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; }
.topbar .flag { width: 26px; height: 18px; border-radius: 3px; cursor: pointer; opacity: .55; display: inline-block; }
.topbar .flag.active { opacity: 1; }
.topbar .search-box {
  display: flex; align-items: center; background: var(--theme-color); border-radius: 30px; padding: 0 14px;
  height: 36px; min-width: 240px; color: #fff; cursor: pointer; gap: 10px; font-weight: 500;
}
.topbar .search-box:hover { background: var(--theme-color-dark); }
.topbar .search-box span { flex: 1; text-align: center; font-size: 14px; }
.topbar .user-menu { display: flex; align-items: center; gap: 8px; cursor: pointer; position: relative; padding: 4px 10px 4px 4px; border-radius: 30px; }
.topbar .user-menu:hover { background: var(--smoke); }
.topbar .user-menu .avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--teal); color: #fff; display: grid; place-items: center; font-family: var(--title-font); font-weight: 600; }
.topbar .right-toggle { width: 34px; height: 34px; border-radius: 50%; background: var(--theme-color); border: 0; color: #fff; cursor: pointer; }

.content { padding: calc(var(--topbar-height) + 18px) 18px 60px; min-height: 100vh; }

.right-panel {
  position: fixed; top: 0; right: -340px; bottom: 0; width: 320px; background: #fff; z-index: 60;
  box-shadow: -6px 0 30px rgba(0,0,0,.15); transition: right .3s ease; overflow-y: auto; padding: 18px;
}
.right-panel.open { right: 0; }
.right-panel h4 { font-size: 13px; letter-spacing: .5px; text-transform: uppercase; margin: 18px 0 10px; color: var(--teal-deep); }
.right-panel .rp-item { background: var(--cream); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; font-size: 13px; }
.right-panel .rp-item small { display: block; color: var(--muted); }
.right-panel .rp-empty { font-size: 12px; color: var(--muted); }
.panel-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 55; display: none; }
.panel-backdrop.show { display: block; }

.net-status {
  position: fixed; right: 18px; bottom: 18px; z-index: 50;
  padding: 14px 20px; border-radius: 14px; color: #fff; font-family: var(--title-font); font-weight: 500;
  box-shadow: 0 6px 20px rgba(0,0,0,.15); font-size: 14px;
}
.net-status.online { background: var(--teal); }
.net-status.offline { background: var(--red); }

@media (max-width: 992px) {
  .sidebar { left: -270px; }
  body.sidebar-open .sidebar { left: 0; }
  body.sidebar-collapsed .sidebar { width: var(--sidebar-width); }
  .main, body.sidebar-collapsed .main { margin-left: 0; }
  .topbar, body.sidebar-collapsed .topbar { left: 0; }
  .topbar .mobile-menu-btn { display: inline-block; }
  .topbar .search-box { min-width: 0; }
  .topbar .updates-btn, .topbar .user-menu .user-name { display: none; }
  .content { padding-left: 12px; padding-right: 12px; }
}
