﻿    /* ==================== SIDEBAR ==================== */
    .sidebar {
      position: fixed;
      left: 0;
      top: 0;
      width: var(--sidebar-width);
      height: 100vh;
      background: linear-gradient(180deg, rgba(255, 255, 255, 0.93), rgba(249, 252, 255, 0.91));
      border-right: 1px solid var(--border);
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
      box-shadow: 8px 0 22px rgba(21, 43, 78, 0.05);
      display: flex;
      flex-direction: column;
      z-index: 100;
      transition: transform 0.3s ease;
    }

    .sidebar-header {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 16px 20px;
      height: var(--navbar-height);
      border-bottom: 1px solid var(--border);
    }

    .sidebar-header-link {
      display: flex;
      align-items: center;
      gap: 12px;
      text-decoration: none;
      color: inherit;
      flex: 1;
      min-width: 0;
      border-radius: var(--radius-sm);
      transition: opacity 0.2s ease;
    }

    .sidebar-header-link:hover {
      opacity: 0.8;
    }

    .sidebar-logo {
      width: 36px;
      height: 36px;
      background: linear-gradient(145deg, #ebf4ff, #dcebff);
      border-radius: 10px;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .sidebar-logo img {
      width: 36px;
      height: 36px;
      object-fit: contain;
      border-radius: 10px;
    }

    .sidebar-logo svg {
      width: 22px;
      height: 22px;
      color: var(--background);
    }

    .sidebar-brand {
      font-size: 1.25rem;
      font-weight: 800;
      letter-spacing: -0.02em;
      color: #12223a;
    }

    .sidebar-nav {
      flex: 1;
      padding: 16px 12px;
      overflow-y: auto;
    }

    .nav-section {
      margin-bottom: 24px;
    }

    .nav-section-title {
      font-size: 0.7rem;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      color: var(--muted);
      padding: 0 12px;
      margin-bottom: 8px;
    }

    .nav-item {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 10px 12px;
      border-radius: var(--radius-sm);
      color: #4e6280;
      text-decoration: none;
      font-size: 0.9rem;
      font-weight: 500;
      transition: all 0.2s ease;
      cursor: pointer;
      border: none;
      background: none;
      width: 100%;
      text-align: left;
      position: relative;
    }

    .nav-item:hover {
      background: #edf4ff;
      color: #1d3861;
    }

    .nav-item.active {
      background: linear-gradient(90deg, rgba(24, 119, 242, 0.18), rgba(24, 119, 242, 0.05));
      color: #0f4b9a;
    }

    .nav-item.active::before {
      content: '';
      position: absolute;
      left: 0;
      top: 50%;
      transform: translateY(-50%);
      width: 3px;
      height: 24px;
      background: var(--primary);
      border-radius: 0 2px 2px 0;
    }

    .ui-toast-container {
      position: fixed;
      top: 16px;
      left: 50%;
      transform: translateX(-50%);
      display: flex;
      flex-direction: column;
      gap: 10px;
      z-index: 2000;
      width: min(92vw, 520px);
      pointer-events: none;
    }

    .ui-toast {
      border: 1px solid var(--border);
      background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 252, 255, 0.98));
      color: #17304f;
      border-radius: 12px;
      padding: 12px;
      line-height: 1.4;
      white-space: pre-line;
      box-shadow: 0 14px 34px rgba(15, 23, 42, 0.18);
      opacity: 0;
      transform: translateY(-8px);
      transition: opacity 0.2s ease, transform 0.2s ease;
      pointer-events: auto;
      display: grid;
      grid-template-columns: auto 1fr auto;
      align-items: start;
      gap: 10px;
    }

    .ui-toast.show {
      opacity: 1;
      transform: translateY(0);
    }

    .ui-toast.success {
      border-color: rgba(22, 163, 74, 0.32);
      box-shadow: 0 14px 34px rgba(22, 163, 74, 0.14);
    }

    .ui-toast.error {
      border-color: rgba(220, 38, 38, 0.3);
      box-shadow: 0 14px 34px rgba(220, 38, 38, 0.14);
    }

    .ui-toast.warning {
      border-color: rgba(217, 119, 6, 0.3);
      box-shadow: 0 14px 34px rgba(217, 119, 6, 0.14);
    }

    .ui-toast.info {
      border-color: rgba(37, 99, 235, 0.3);
      box-shadow: 0 14px 34px rgba(37, 99, 235, 0.14);
    }

    .ui-toast-icon {
      width: 26px;
      height: 26px;
      border-radius: 999px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      font-size: 0.85rem;
      font-weight: 700;
      color: #fff;
      margin-top: 2px;
    }

    .ui-toast.success .ui-toast-icon {
      background: #16a34a;
    }

    .ui-toast.error .ui-toast-icon {
      background: #dc2626;
    }

    .ui-toast.warning .ui-toast-icon {
      background: #d97706;
    }

    .ui-toast.info .ui-toast-icon {
      background: #2563eb;
    }

    .ui-toast-title {
      font-size: 0.86rem;
      font-weight: 700;
      margin-bottom: 2px;
      letter-spacing: 0.02em;
      text-transform: uppercase;
      color: #1f3652;
    }

    .ui-toast-message {
      font-size: 0.93rem;
      color: #274260;
      line-height: 1.45;
    }

    .ui-toast-close {
      border: 0;
      background: transparent;
      color: #64748b;
      width: 24px;
      height: 24px;
      border-radius: 6px;
      cursor: pointer;
      font-size: 1rem;
      line-height: 1;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      transition: background 0.2s ease, color 0.2s ease;
    }

    .ui-toast-close:hover {
      background: #e2e8f0;
      color: #334155;
    }

    .nav-item svg {
      width: 20px;
      height: 20px;
      flex-shrink: 0;
    }

    .nav-badge {
      margin-left: auto;
      padding: 2px 8px;
      background: var(--primary);
      color: #ffffff;
      border-radius: 10px;
      font-size: 0.75rem;
      font-weight: 600;
    }

    .sidebar-footer {
      padding: 16px;
      border-top: 1px solid var(--border);
    }

    .user-card {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 12px;
      border-radius: var(--radius);
      background: var(--secondary);
    }

    .user-avatar {
      width: 40px;
      height: 40px;
      border-radius: 50%;
      background: linear-gradient(135deg, var(--primary), #60a5fa);
      display: flex;
      align-items: center;
      justify-content: center;
      font-weight: 600;
      font-size: 1rem;
      color: var(--background);
    }

    .user-info {
      flex: 1;
      min-width: 0;
    }

    .user-name {
      font-weight: 600;
      font-size: 0.9rem;
      color: var(--foreground);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .user-email {
      font-size: 0.75rem;
      color: var(--muted);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    /* Mobile Menu Button */
    .mobile-menu-btn {
      display: none;
      position: fixed;
      top: 16px;
      left: 16px;
      z-index: 150;
      width: 44px;
      height: 44px;
      border-radius: var(--radius-sm);
      background: var(--card);
      border: 1px solid var(--border);
      color: var(--foreground);
      cursor: pointer;
      align-items: center;
      justify-content: center;
    }

    .mobile-menu-btn svg {
      width: 24px;
      height: 24px;
    }

    .sidebar-overlay {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.6);
      backdrop-filter: blur(4px);
      z-index: 90;
    }

    .sidebar-close {
      display: none;
      position: absolute;
      top: 16px;
      right: 12px;
      width: 32px;
      height: 32px;
      border-radius: var(--radius-sm);
      background: transparent;
      border: none;
      color: var(--muted);
      cursor: pointer;
      align-items: center;
      justify-content: center;
    }

    .sidebar-close:hover {
      background: var(--secondary);
      color: var(--foreground);
    }

    /* ==================== MAIN CONTENT ==================== */
    .main-content {
      margin-left: var(--sidebar-width);
      min-height: 100vh;
    }

    /* ==================== TOP NAVBAR ==================== */
    .navbar {
      position: sticky;
      top: 0;
      height: var(--navbar-height);
      background: rgba(255, 255, 255, 0.78);
      backdrop-filter: blur(14px);
      -webkit-backdrop-filter: blur(14px);
      border-bottom: 1px solid var(--border);
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 24px;
      z-index: 50;
    }

    .navbar-left {
      display: flex;
      align-items: center;
      gap: 16px;
    }

    .page-title {
      font-size: 1.25rem;
      font-weight: 600;
      color: var(--foreground);
    }

    .search-box {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 10px 16px;
      background: var(--secondary);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      min-width: 280px;
      transition: all 0.2s ease;
    }

    .search-box:focus-within {
      border-color: var(--primary);
      box-shadow: 0 0 0 3px rgba(34, 211, 187, 0.1);
    }

    .search-box svg {
      width: 18px;
      height: 18px;
      color: var(--muted);
    }

    .search-box input {
      flex: 1;
      background: none;
      border: none;
      outline: none;
      color: var(--foreground);
      font-size: 0.9rem;
    }

    .search-box input::placeholder {
      color: var(--muted);
    }

    .search-shortcut {
      padding: 4px 8px;
      background: var(--card);
      border-radius: 4px;
      font-size: 0.7rem;
      color: var(--muted);
      font-family: 'JetBrains Mono', monospace;
    }

    .navbar-right {
      display: flex;
      align-items: center;
      gap: 12px;
    }

    /* User Profile Section */
    .user-profile-section {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 0 12px;
      border-right: 1px solid var(--border);
    }

    .user-info {
      display: flex;
      flex-direction: column;
      align-items: flex-end;
      font-size: 0.85rem;
    }

    .user-name {
      color: var(--foreground);
      font-weight: 500;
    }

    .user-role {
      color: var(--muted);
      font-size: 0.75rem;
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }

    .user-role.admin {
      color: #fbbf24;
    }

    .user-selector-trigger {
      position: relative;
    }

    /* User Selector Modal */
    .user-selector-modal {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background: rgba(0, 0, 0, 0.6);
      display: none;
      align-items: center;
      justify-content: center;
      z-index: 1000;
    }

    .user-selector-modal.open {
      display: flex;
    }

    .user-selector-content {
      background: var(--card);
      border-radius: var(--radius-lg);
      padding: 32px;
      width: 90%;
      max-width: 500px;
      box-shadow: 0 20px 60px rgba(22, 44, 79, 0.15);
      border: 1px solid var(--border);
    }

    .user-selector-header {
      margin-bottom: 24px;
    }

    .user-selector-header h3 {
      color: var(--foreground);
      margin-bottom: 4px;
    }

    .user-selector-header p {
      color: var(--muted);
      font-size: 0.9rem;
    }

    .user-selector-close {
      position: absolute;
      top: 16px;
      right: 16px;
      background: var(--card-hover);
      border: none;
      color: var(--foreground);
      cursor: pointer;
      width: 32px;
      height: 32px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: all 0.2s ease;
    }

    .user-selector-close:hover {
      background: var(--border);
    }

    .user-list {
      display: flex;
      flex-direction: column;
      gap: 8px;
      max-height: 400px;
      overflow-y: auto;
    }

    .user-item {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 12px;
      border-radius: var(--radius-sm);
      cursor: pointer;
      transition: all 0.2s ease;
      border: 1px solid transparent;
    }

    .user-item:hover {
      background: var(--secondary);
      border-color: var(--border);
    }

    .user-item.active {
      background: var(--primary)20;
      border-color: var(--primary);
    }

    .user-avatar {
      width: 40px;
      height: 40px;
      border-radius: 50%;
      background: var(--primary)20;
      color: var(--primary);
      display: flex;
      align-items: center;
      justify-content: center;
      font-weight: 600;
      font-size: 0.9rem;
    }

    .user-item.active .user-avatar {
      background: var(--primary);
      color: var(--background);
    }

    .user-item-info {
      flex: 1;
    }

    .user-item-name {
      color: var(--foreground);
      font-weight: 500;
      font-size: 0.9rem;
    }

    .user-item-email {
      color: var(--muted);
      font-size: 0.8rem;
    }

    .user-item-badge {
      background: var(--warning);
      color: var(--background);
      padding: 2px 8px;
      border-radius: 4px;
      font-size: 0.7rem;
      font-weight: 600;
      margin-left: 8px;
    }

    .btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      padding: 10px 20px;
      border-radius: var(--radius-sm);
      font-size: 0.9rem;
      font-weight: 500;
      cursor: pointer;
      transition: all 0.2s ease;
      border: none;
      text-decoration: none;
    }

    .btn-primary {
      background: var(--primary);
      color: var(--background);
    }

    .btn-primary:hover {
      background: var(--primary-dark);
      box-shadow: 0 0 20px var(--primary-glow);
    }

    .btn-secondary {
      background: var(--secondary);
      color: var(--foreground);
      border: 1px solid var(--border);
    }

    .btn-secondary:hover {
      background: var(--card-hover);
      border-color: var(--muted);
    }

    .btn-ghost {
      background: transparent;
      color: var(--muted-foreground);
      padding: 8px;
    }

    .btn-ghost:hover {
      background: var(--secondary);
      color: var(--foreground);
    }

    .icon-btn {
      width: 40px;
      height: 40px;
      padding: 0;
      border-radius: var(--radius-sm);
      background: var(--secondary);
      border: 1px solid var(--border);
      color: var(--muted-foreground);
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      position: relative;
      transition: all 0.2s ease;
    }

    .icon-btn:hover {
      background: var(--card-hover);
      color: var(--foreground);
    }

    .icon-btn svg {
      width: 20px;
      height: 20px;
    }

    .notification-dot {
      position: absolute;
      top: 8px;
      right: 8px;
      width: 8px;
      height: 8px;
      background: var(--error);
      border-radius: 50%;
      border: 2px solid var(--secondary);
    }

    .avatar-btn {
      width: 40px;
      height: 40px;
      border-radius: 50%;
      background: linear-gradient(135deg, var(--primary), #60a5fa);
      border: none;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      font-weight: 600;
      color: var(--background);
      font-size: 0.9rem;
      transition: all 0.2s ease;
    }

    .avatar-btn:hover {
      box-shadow: 0 0 20px var(--primary-glow);
    }

    /* ==================== DASHBOARD CONTENT ==================== */

    /* ==================== RESPONSIVE OVERRIDES ==================== */
    /*
     * These rules MUST live at the END of this file.
     * layout.css loads after index.css, so any @media rule in index.css
     * that targets the same property is silently overridden by layout.css
     * base rules (same specificity, later in cascade = wins).
     * Placing the overrides HERE — after the base rules in the same file —
     * ensures the @media queries correctly win over the base rules.
     */

    html { overflow-x: hidden; }

    /* ── ≤1024px  sidebar collapses, content fills full width ── */
    @media (max-width: 1024px) {
      /* Slide sidebar off-screen; .open brings it back */
      .sidebar           { transform: translateX(-100%); }
      .sidebar.open      { transform: translateX(0);      }
      .sidebar-overlay.open { display: block; }
      .sidebar-close     { display: flex;   }

      /* Show the hamburger button */
      .mobile-menu-btn   { display: flex;   }

      /* Remove the 248 px sidebar gap from main content */
      .main-content      { margin-left: 0;  }

      /* Leave room for hamburger inside navbar */
      .navbar            { padding-left: 68px; }

      /* Allow search box to shrink a bit */
      .search-box        { min-width: 160px; }
    }

    /* ── ≤768px  hide search box entirely ── */
    @media (max-width: 768px) {
      .search-box        { display: none; }
    }

    /* ── ≤480px  shrink the hamburger slightly ── */
    @media (max-width: 480px) {
      .mobile-menu-btn   { top: 8px; left: 10px; width: 38px; height: 38px; }
    }
