*, *::before, *::after {
  margin: 0; padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%; height: 100%;
  font-family: 'Poppins', sans-serif;
  background: var(--bg-page);
  color: var(--text-primary);
  overflow: hidden;
}

#app {
  display: flex;
  width: 100%; height: 100dvh;
  overflow: hidden;
  position: relative;
  visibility: hidden;
}

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-width);
  height: 100dvh;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0; right: 0;
  z-index: 200;
  transform: translateX(100%);
  transition: transform var(--transition-slow);
}
.sidebar.open { transform: translateX(0); }

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 30px 8px 15px;
  border-bottom: 2px solid var(--brand-light);
}
.sidebar-logo { display: flex; align-items: center; gap: 15px; }
.sidebar-logo-icon {
  width: 45px; height: 45px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 18px; flex-shrink: 0;
  background: url('LogoTTN.png') center/contain no-repeat;
}
.sidebar-logo-title {
  font-size: 15px; font-weight: 700;
  color: var(--text-white);
  display: block; line-height: 1.2;
}
/* ── NAV ── */
.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex; flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}
.nav-item {
  display: flex; align-items: center;
  gap: 15px; padding: 8px 5px;
  border-radius: 15px;
  cursor: pointer; text-decoration: none;
  color: var(--text-sidebar);
  font-size: 14px; font-weight: 500;
  transition: background var(--transition-fast), color var(--transition-fast);
  user-select: none;
  white-space: nowrap; overflow: hidden;
}
.nav-item:hover { background: var(--bg-sidebar-hover); color: var(--text-white); }
.nav-item:hover .nav-icon { background: rgba(255,255,255,0.18); }
.nav-item.active { background: var(--bg-sidebar-active); color: var(--text-white); }
.nav-icon {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px;
  background: rgba(255,255,255,0.1);
  font-size: 14px; flex-shrink: 0;
  transition: background var(--transition-fast);
}
.nav-item.active .nav-icon { background: rgba(255,255,255,0.25); color: #fff; }

/* ── MAIN WRAPPER ── */
.main-wrapper {
  flex: 1;
  display: flex; flex-direction: column;
  min-width: 0; height: 100dvh;
  overflow: hidden;
  background: var(--bg-sidebar);
  padding: 30px 0 30px 20px;
}

.main-inner {
  flex: 1;
  display: flex; flex-direction: column;
  border-radius: 20px;
  overflow: hidden;
  background: var(--bg-page);
  box-shadow: -4px 0 24px rgba(0,0,0,0.15);
  min-height: 0;
}

/* ── TOPBAR ── */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-page);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
  border-radius: 0;
  position: relative; z-index: 50;
}

.topbar::after {
  content: "";
  position: absolute;
  bottom: 0; left: 14px; right: 14px;
  height: 3px;
  background: var(--brand-light);
  border-radius: 999px;
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-title { font-size: 17px; font-weight: 700; color: var(--text-primary); }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.topbar-back-btn {
  width: 40px; height: 40px;
  border: none;
  background: var(--bg-hover);
  border-radius: 10px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--brand-primary); font-size: 15px;
  transition: background var(--transition-fast);
}
.topbar-back-btn:hover { background: rgba(176,138,92,0.15); }
.topbar-reload {
  width: 40px; height: 40px;
  border: none;
  background: var(--bg-hover);
  border-radius: 10px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--brand-primary); font-size: 15px;
  transition: background var(--transition-fast);
}
.topbar-reload:hover { background: rgba(176,138,92,0.15); }
.topbar-notif {
  width: 40px; height: 40px;
  border: none;
  background: var(--bg-hover);
  border-radius: 10px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--brand-primary); font-size: 16px;
  position: relative;
  transition: background var(--transition-fast);
}
.topbar-notif:hover { background: rgba(176,138,92,0.15); }

.notif-badge {
  position: absolute; top: 6px; right: 6px;
  min-width: 16px; height: 16px;
  background: var(--danger); border-radius: 8px;
  font-size: 9px; font-weight: 700; color: #fff;
  display: none; align-items: center; justify-content: center;
  padding: 0 4px;
}

.topbar-avatar {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand-mid), var(--brand-primary));
  color: #fff; font-size: 14px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(138,98,52,0.3);
}

/* ── HAMBURGER ── */
.hamburger {
  width: 50px; height: 50px;
  border: none;
  background: linear-gradient(135deg, var(--brand-primary), var(--brand-mid));
  border-radius: 50%; cursor: pointer;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 5px; padding: 0;
  position: fixed; bottom: 28px; right: 7px;
  z-index: 300;
  box-shadow: 0 4px 16px rgba(138,98,52,0.45);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.hamburger:hover { transform: scale(1.08); box-shadow: 0 6px 24px rgba(138,98,52,0.6); }
.hamburger:active { transform: scale(0.95); }
.hamburger span {
  display: block; width: 18px; height: 2px;
  background: #fff; border-radius: 2px;
  transition: transform var(--transition-base), opacity var(--transition-base);
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── CONTENT AREA ── */
.content-area {
  flex: 1; overflow: hidden;
  position: relative;
  background: var(--bg-sidebar);
  padding: 0;
}
.view {
  display: none;
  width: 100%; height: 100%;
  position: absolute;
  inset: 0;
  background: var(--bg-page);
  border-radius: 0;
  overflow: hidden;
}
.view.active { display: flex; flex-direction: column; }
.view-scroll {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 28px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.view-scroll::-webkit-scrollbar { display: none; }

/* ── COMING SOON ── */
.coming-soon {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  height: 60vh; gap: 16px; color: var(--text-muted);
}
.coming-soon i { font-size: 48px; opacity: 0.3; }
.coming-soon p { font-size: 16px; font-weight: 500; }

/* ── BOTTOM NAV ── */
.bottom-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 64px;
  background: var(--bg-sidebar);
  border-top: 1px solid var(--border-sidebar);
  z-index: 400;
  padding: 0 8px;
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav-item {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 3px; flex: 1;
  color: var(--text-sidebar);
  font-size: 10px; font-weight: 500;
  cursor: pointer; text-decoration: none;
  padding: 8px 4px;
  border-radius: 12px;
  transition: color var(--transition-fast), background var(--transition-fast);
  user-select: none;
}
.bottom-nav-item i { font-size: 18px; }
.bottom-nav-item.active { color: var(--brand-light); }
.bottom-nav-item:active { background: var(--bg-sidebar-hover); }

/* ── MEDIA QUERIES ── */
@media (min-width: 769px) {
  #app { display: flex; flex-direction: row; }

  .sidebar {
    position: relative !important;
    top: auto !important; right: auto !important;
    transform: translateX(0) !important;
    width: 65px;
    overflow: hidden;
    height: 100dvh;
    order: 2;
    flex-shrink: 0;
    transition: width var(--transition-slow);
  }
  .sidebar.open {
    width: var(--sidebar-width);
  }

  .main-wrapper {
    flex: 1; min-width: 0; order: 1;
    transition: none;
  }

  .sidebar-overlay { display: none !important; }
  .bottom-nav { display: none !important; }
  .hamburger { display: flex !important; }
}

@media (max-width: 768px) {
  .topbar { padding: 0 16px; border-radius: 0; }
  .view-scroll { padding: 16px; padding-bottom: 80px; }
  .main-wrapper { padding: 20px 0 0; background: var(--bg-sidebar); }
  .main-inner { border-radius: 20px; box-shadow: none; }
  .sidebar { display: none !important; }
  .sidebar-overlay { display: none !important; }
  .hamburger { display: none !important; }
  .bottom-nav { display: flex; }
}