/* ═══════════════════════════════════════════
       LAYOUT SHELL
    ═══════════════════════════════════════════ */
    #app {
      display: flex;
      height: 100vh;
      overflow: hidden;
    }

    /* ═══════════════════════════════════════════
       SIDEBAR
    ═══════════════════════════════════════════ */
    #sidebar {
      width: var(--sidebar-w);
      flex-shrink: 0;
      background: var(--bg2);
      border-right: 1px solid var(--border);
      display: flex;
      flex-direction: column;
      height: 100%;
      overflow: hidden;
      transition: width var(--transition), transform var(--transition);
      position: relative;
      z-index: 30;
    }

    .sidebar-logo {
      padding: 20px 20px 16px;
      border-bottom: 1px solid var(--border);
      display: flex;
      align-items: center;
      gap: 10px;
      flex-shrink: 0;
    }

    .logo-icon {
      width: 32px; height: 32px;
      border-radius: 9px;
      background: linear-gradient(135deg, var(--sky), #6366f1);
      display: flex; align-items: center; justify-content: center;
      flex-shrink: 0;
    }
    .logo-icon svg { width: 17px; height: 17px; fill: white; }

    .logo-text {
      display: flex; flex-direction: column;
      overflow: hidden;
    }
    .logo-text strong {
      font-size: 14px; font-weight: 700; letter-spacing: .3px;
      white-space: nowrap;
    }
    .logo-text span {
      font-size: 11px; color: var(--text2); white-space: nowrap;
    }

    /* nav sections */
    .sidebar-nav {
      flex: 1;
      overflow-y: auto;
      padding: 12px 10px;
      display: flex;
      flex-direction: column;
      gap: 2px;
    }

    .nav-section-label {
      font-size: 10px;
      font-weight: 600;
      letter-spacing: .8px;
      text-transform: uppercase;
      color: var(--text3);
      padding: 10px 10px 6px;
    }

    .nav-item {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 9px 10px;
      border-radius: var(--radius-sm);
      cursor: pointer;
      color: var(--text2);
      font-size: 13px;
      font-weight: 500;
      transition: background var(--transition), color var(--transition);
      white-space: nowrap;
      overflow: hidden;
      border: 1px solid transparent;
      user-select: none;
    }
    .nav-item:hover {
      background: rgba(255,255,255,.04);
      color: var(--text);
    }
    .nav-item.active {
      background: var(--sky-dim);
      color: var(--sky);
      border-color: rgba(56,189,248,.18);
    }
    .nav-item.active .nav-icon { color: var(--sky); }

    /* roles: items hidden depending on role */
    .nav-item[data-role="admin"] { /* shown only for admin */ }

    .nav-icon {
      width: 17px; height: 17px;
      flex-shrink: 0;
      opacity: .85;
    }
    .nav-label { flex: 1; }

    .nav-badge {
      font-size: 10px;
      font-weight: 700;
      padding: 2px 6px;
      border-radius: 99px;
      background: var(--sky-dim);
      color: var(--sky);
      flex-shrink: 0;
    }

    /* sidebar footer */
    .sidebar-footer {
      border-top: 1px solid var(--border);
      padding: 12px 10px;
      flex-shrink: 0;
    }

    .user-card {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 9px 10px;
      border-radius: var(--radius-sm);
      cursor: pointer;
      transition: background var(--transition);
    }
    .user-card:hover { background: rgba(255,255,255,.04); }

    .user-avatar {
      width: 30px; height: 30px;
      border-radius: 999px;
      background: linear-gradient(135deg, #6366f1, var(--sky));
      display: flex; align-items: center; justify-content: center;
      font-size: 12px; font-weight: 700;
      flex-shrink: 0;
    }

    .user-info { overflow: hidden; flex: 1; }
    .user-name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .user-role { font-size: 11px; color: var(--text2); }

    .logout-btn {
      background: none;
      border: none;
      color: var(--text3);
      cursor: pointer;
      padding: 4px;
      display: flex;
      align-items: center;
      border-radius: 6px;
      transition: color var(--transition), background var(--transition);
    }
    .logout-btn:hover { color: var(--red); background: var(--red-dim); }

    /* ═══════════════════════════════════════════
       MAIN CONTENT AREA
    ═══════════════════════════════════════════ */
    #main {
      flex: 1;
      display: flex;
      flex-direction: column;
      overflow: auto;
      min-width: 0;
    }

    /* topbar */
    #topbar {
      height: var(--topbar-h);
      border-bottom: 1px solid var(--border);
      background: rgba(8,13,23,.85);
      backdrop-filter: blur(12px);
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 24px;
      flex-shrink: 0;
      gap: 16px;
    }

    .topbar-left {
      display: flex; align-items: center; gap: 12px;
      min-width: 0;
    }

    .page-title {
      font-size: 15px;
      font-weight: 600;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .page-breadcrumb {
      font-size: 12px;
      color: var(--text2);
      display: flex; align-items: center; gap: 6px;
    }
    .page-breadcrumb span { color: var(--text3); }

    .topbar-right {
      display: flex; align-items: center; gap: 10px;
      flex-shrink: 0;
    }

    .topbar-pill {
      display: flex; align-items: center; gap: 6px;
      padding: 6px 10px;
      border: 1px solid var(--border);
      border-radius: 99px;
      font-size: 12px;
      color: var(--text2);
      background: rgba(255,255,255,.03);
    }
    .topbar-pill .dot {
      width: 7px; height: 7px; border-radius: 99px;
    }
    .topbar-pill .dot.green { background: var(--green); box-shadow: 0 0 6px var(--green); }
    .topbar-pill .dot.red   { background: var(--red);   }

    /* page content wrapper */
    #page-content {
      flex: 1;
      overflow-y: auto;
      padding: 28px 28px;
    }

    /* ═══════════════════════════════════════════
       VIEWS (pages)
    ═══════════════════════════════════════════ */
    .view { display: none; animation: fadeIn .22s ease; }
    .view.active { display: block; }

    @keyframes fadeIn {
      from { opacity: 0; transform: translateY(6px); }
      to   { opacity: 1; transform: translateY(0); }
    }
