/* ==========================================================================
   1. STRUCTURAL BASE, RESETS & VIEWPORT SETUP
   ========================================================================== */
   *, *::before, *::after {
    box-sizing: border-box;
  }
  
  body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
  }
  
  .main-content {
    flex: 1;
    padding: 1.5rem 2rem;
    max-width: 96%;
    width: 100%;
    margin: 0 auto;
  }
  
  /* ==========================================================================
     2. DASHBOARD LAYOUT & RESPONSIVE GRID MATRIX
     ========================================================================== */
  .dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--gap);
    align-items: start;
  }
  
  @media (min-width: 1025px) {
    .dashboard-grid {
      grid-template-columns: 1fr 340px;
    }
  }
  
  .sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--gap);
  }
  
  /* Metric Cards Banner Strip */
  .metric-strip {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: var(--gap);
  }
  
  @media (min-width: 1025px) {
    .metric-strip {
      grid-template-columns: repeat(4, 1fr);
    }
  }
  
  .metric-card {
    border-radius: 10px;
    padding: 0.85rem 1rem;
  }
  
  .metric-card .metric-label {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 4px;
  }
  
  .metric-card .metric-value {
    font-size: 22px;
    font-weight: 500;
    line-height: 1.1;
  }
  
  .metric-card .metric-sub {
    font-size: 11px;
    margin-top: 3px;
  }
  
  /* Structural Layout Rows */
  .spend-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 12px;
  }
  
  @media (min-width: 481px) {
    .spend-row {
      grid-template-columns: 1fr 1fr;
    }
  }
  
  .spend-val {
    font-size: 20px;
    font-weight: 500;
    margin: 3px 0;
  }
  
  .spend-sub {
    font-size: 11px;
  }
  
  /* Generic Layout Panel Surface Blocks */
  .card, .card-sm {
    border: 1px solid;
    border-radius: var(--border-radius);
    padding: 1.25rem;
    margin-bottom: var(--gap);
  }
  
  .card-sm {
    padding: 0.9rem 1rem;
  }
  
  .card-title {
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 0.85rem;
  }
  
  .main-container {
    display: flex;
    flex-direction: column;
    gap: var(--gap);
    width: 100%;
  }
  
  .column2, .column3, .column70 {
    width: 100%;
    box-sizing: border-box;
  }

  .high_severity, .medium_severity, .low_severity {
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 1rem;
  }
  
  @media (min-width: 768px) {
    .main-container { flex-direction: row; justify-content: space-between; }
    .column2  { width: 48%; }
    .column3  { width: 30%; }
    .column70 { width: 68%; }
  }
  
/* ==========================================================================
   3. HORIZONTAL & VERTICAL INFRASTRUCTURE MENUS (Working Navigation)
   ========================================================================== */
   .navbar ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
  }
  
  .navbar a {
    display: block;
    text-decoration: none;
    box-sizing: border-box;
  }
  
  .navbar li {
    position: relative;
  }
  
  .nav-toggle {
    display: none;
  }
  
  /* --- MODE A: Desktop Dropdown Configurations --- */
  @media (min-width: 769px) {
    .nav-horizontal {
      width: 100%;
      display: block;
      position: sticky;
      top: 0;
      z-index: 1000;
    }
    
    .nav-horizontal > ul {
      display: flex;
      flex-direction: row;
      flex-wrap: wrap;
      align-items: center;
    }
    
    .nav-horizontal > ul > li {
      display: inline-block;
    }
    
    /* Reset white-space for text safety */
    .nav-horizontal a {
      white-space: nowrap;
    }
    
    /* Primary Dropdown Container (Level 1 Submenus) */
    .nav-horizontal ul li > ul {
      display: none;
      position: absolute;
      top: 100%;
      left: 0;
      min-width: 250px;
      z-index: 1000;
      padding: 0.25rem 0;
    }
    
    /* Deep Flyout Submenu Containers (Level 2+ Secondary Submenus) */
    .nav-horizontal ul ul li > ul,
    .nav-horizontal .secondary-submenu {
      top: 0;
      left: 100%;
      position: absolute;
      display: none;
      min-width: 250px;
      z-index: 1050;
    }
    
    /* Hover Cascades for Desktop Display */
    .nav-horizontal ul li:hover > ul,
    .nav-horizontal ul ul li:hover > .secondary-submenu {
      display: block !important;
    }
    
    /* Edge Detection Rule Overwrites */
    .nav-horizontal ul ul.adjust-left,
    .nav-horizontal .secondary-submenu.adjust-left {
      left: auto !important;
      right: 100% !important;
    }
  }
  
  /* --- MODE B: Mobile Accordion Infrastructure --- */
  @media (max-width: 768px) {

    .nav-toggle {
      display: block;
      text-align: right;
      padding: 15px 20px;
      font-size: 24px;
      text-decoration: none;
    }
  
    .navbar {
      display: none;
      width: 100%;
      position: absolute;
      z-index: 2000;        /* single consistent value */
      top: 60px;
      right: 0;
      overflow-y: auto;     /* prevents the menu being taller than viewport and eating taps */
      max-height: calc(100vh - 60px);
    }
  
    .navbar.active {
      display: block;
    }
  
    .navbar ul {
      display: flex;
      flex-direction: column;
      width: 100%;
    }
  
    .navbar li {
      padding: 0;
      position: relative; /* keep but don't let it create stacking issues */
    }

    .nav-horizontal {
      all: unset; /* strip ALL nav-horizontal rules on mobile */
      display: block;
      width: 100%;
    }
  
    /* Kill ALL desktop hover behaviours on mobile — covers both ul and secondary-submenu */
    .nav-horizontal ul li:hover > ul,
    .nav-horizontal ul li:hover > .secondary-submenu,
    .nav-horizontal ul ul li:hover > ul,
    .nav-horizontal ul ul li:hover > .secondary-submenu {
      display: none !important;
    }
  
    /* Reset ALL submenus to flat accordion layout */
    .navbar ul ul,
    .navbar ul .secondary-submenu {
      display: none !important;
      position: relative !important;
      width: 100% !important;
      left: 0 !important;
      right: auto !important;
      top: 0 !important;
      padding-left: 16px !important;
      box-shadow: none !important;
      border-radius: 0 !important;
      /* Remove border/background fighting from theme CSS on mobile */
      border: none !important;
      border-left: 3px solid rgba(255,255,255,0.2) !important;
    }
  
    /* The ONLY thing that opens a submenu — both ul and secondary-submenu */
    .navbar ul ul.active,
    .navbar ul .secondary-submenu.active {
      display: block !important;
    }
  
    .form-group { flex-direction: column; align-items: flex-start; }
    .form-label { margin-bottom: 5px; }
  }
  
  /* ==========================================================================
     4. INTERACTIVE ACTIONS CONTEXT MENUS DROPDOWNS
     ========================================================================== */
  .action-dropdown {
    position: relative;
    display: inline-block;
  }
  
  .dropbtn {
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    border: 1px solid;
    box-sizing: border-box;
  }
  
  .dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    min-width: 220px;
    z-index: 1050;
    border-radius: 8px;
    border: 1px solid;
    padding: 8px 0;
  }
  
  .dropdown-content a {
    padding: 10px 16px;
    display: block;
    font-size: 13px;
    text-decoration: none;
  }
  
  .action-dropdown:hover .dropdown-content {
    display: block;
  }
  
  .action-dropdown.drop-up .dropdown-content {
    top: auto;
    bottom: 100%;
    margin-bottom: 5px;
  }
  
  /* ==========================================================================
     5. BATCH INPUT FORMS & ADVANCED SEARCH FILTER BARS
     ========================================================================== */
  .filter-section {
    border: 1px solid;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
  }
  
  .filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
  }
  
  .filter-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1 1 180px;
  }
  
  .filter-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
  }
  
  .filter-input {
    height: 38px;
    padding: 8px 12px;
    border: 1px solid;
    border-radius: 6px;
    font-size: 14px;
    width: 100%;
    box-sizing: border-box;
  }
  
  .filter-btn {
    font-weight: 600;
    padding: 0 24px;
    height: 38px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
  }
  
  /* ==========================================================================
     6. PLATFORM DATA REPEATING CONTAINER LAYOUTS (Tables, Badges, Tickets)
     ========================================================================== */
  table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 10px;
  }
  
  th, td {
    padding: 10px 12px;
    text-align: left;
  }
  
  .admin-pills {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: var(--gap);
  }
  
  .admin-pill {
    font-size: 12px;
    font-weight: 500;
    padding: 5px 12px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border: 1px solid;
  }
  
  .ticket-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 0.6rem 0;
    border-bottom: 1px solid;
  }
  
  .ticket-item:last-child {
    border-bottom: none;
  }
  
  .ticket-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 5px;
    flex-shrink: 0;
  }
  
  .ticket-text {
    flex: 1;
    font-size: 13px;
    line-height: 1.4;
  }
  
  .ticket-age {
    font-size: 11px;
    white-space: nowrap;
  }
  
  /* FIXED: Structural wrapper allocations for rounded container announcements */
  .announce-item {
    padding: 1rem;
    margin-bottom: 10px;
    font-size: 13px;
    line-height: 1.5;
    border-left: 4px solid transparent; /* Structural hook for theme accents */
  }
  
  .announce-item:last-child {
    margin-bottom: 0;
  }
  
  .announce-tag {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 4px;
    margin-right: 6px;
    vertical-align: middle;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }
  
  .announce-date {
    font-size: 11px;
    margin-top: 4px;
  }
  
  .services-section {
    grid-column: 1 / -1;
    margin-top: 4px;
  }
  
  .service-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
    gap: 10px;
  }
  
  .service-card {
    border-radius: 10px;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid;
    transition: transform 0.15s, box-shadow 0.15s;
  }
  
  .service-card:hover {
    transform: translateY(-2px);
  }
  
  .service-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
  }
  
  .service-num {
    font-size: 20px;
    font-weight: 500;
    line-height: 1;
  }
  
  .service-name {
    font-size: 11px;
    margin-top: 2px;
    line-height: 1.3;
  }
  
  .pagination {
    margin-top: 20px;
    text-align: center;
  }
  
  .pagination a {
    display: inline-block;
    padding: 5px 10px;
    margin-right: 5px;
    text-decoration: none;
    border-radius: 3px;
  }
  
  .form-container {
    max-width: 75%;
    margin: 0 auto;
    padding: 20px;
  }
  
  .form-group {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
  }
  
  .form-label {
    flex-basis: 30%;
    font-weight: 500;
  }
  
  .form-input {
    flex: 1;
    padding: 10px;
    border: 1px solid;
    border-radius: 5px;
  }
  
  /* ==========================================================================
     7. INTERACTIVE APP ENGINE PIPELINES (Tabs, Toggles, Spinners, Text Editors)
     ========================================================================== */
  .tabs {
    display: flex !important;
    flex-direction: row !important;
    justify-content: flex-start !important; /* Locks tabs tightly side-by-side */
    list-style-type: none;
    padding: 0;
    margin: 0 0 20px 0;
  }
  
  ul.tabs li {
    display: inline-block;
    margin-right: 5px;
  }
  
  ul.tabs li a, .tab {
    display: block;
    padding: 10px 20px;
    text-decoration: none;
    cursor: pointer;
  }
  
  .tab-content {
    display: none;
  }
  
  .tab-content.active {
    display: block;
  }
  
  .editor-toolbar {
    display: flex;
    gap: 4px;
    padding: 5px;
    border: 1px solid;
    border-bottom: none;
    border-radius: 4px 4px 0 0;
    flex-wrap: wrap;
  }
  
  .editor-toolbar button {
    padding: 4px 10px;
    font-size: 12px;
    border: 1px solid;
    border-radius: 3px;
    display: inline-block;
  }
  
  .editor-area {
    border-top-left-radius: 0 !important;
    border-top-right-radius: 0 !important;
    font-family: monospace;
    width: 100%;
    box-sizing: border-box;
  }
  
  .switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
  }
  
  .switch input {
    opacity: 0;
    width: 0;
    height: 0;
  }
  
  .slider {
    position: absolute;
    cursor: pointer;
    inset: 0; 
    transition: .4s;
    border-radius: 24px;
  }
  
  .slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 2px; 
    transition: .4s;
    border-radius: 50%;
  }
  
  input:checked + .slider { background: #4CAF50; }
  
  input:checked + .slider:before {
    transform: translateX(26px);
  }
  
  .spinner {
    position: relative;
    width: 20px;
    height: 20px;
    text-indent: -99999px;
    margin: 0 auto;
    box-shadow: inset 0 0 0 2px;
    border-radius: 50%;
  }
  
  /* ==========================================================================
     8. CORE SYSTEM SCREEN HEADER & FOOTER LAYOUTS
     ========================================================================== */
  .header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
  }
  
  .header .logos img {
    max-width: 150px;
    height: auto;
  }
  
  .header .wallet {
    text-align: right;
  }
  
  .header .wallet h1 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 600;
  }
  
  .header .wallet h2 {
    margin: 0.25rem 0 0;
    font-size: 0.95rem;
    font-weight: 400;
  }
  
  .footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    font-size: 13px;
    margin-top: auto;
  }
  
  .footer .language-links {
    display: flex;
    gap: 12px; 
    justify-content: center;
    flex-wrap: wrap;
  }
  
  /* ==========================================================================
     9. DEVICE MEDIA OVERRIDES DOWN-SCALE PIPELINES
     ========================================================================== */
  @media (max-width: 1024px) {
    .dashboard-grid { grid-template-columns: 1fr; }
    .sidebar { grid-row: 1; }
  }
  
  @media (max-width: 768px) {
    .main-content { padding: 1rem; }
    .header, .footer { padding: 1rem; }
    .metric-strip { grid-template-columns: 1fr 1fr; }
    .services-section { grid-column: 1; }
    .main-container { flex-direction: column; }
    .column2, .column70, .column3 { width: 100%; }
    
    /* Mobile Hamburger Navigation Layout Frame */
    .nav-toggle { display: block; text-align: right; padding: 20px; font-size: 24px; text-decoration: none; }
    .navbar { display: none; width: 100%; position: absolute; z-index: 1000; top: 60px; right: 0; }
    .navbar.active { display: block; }
    .navbar ul { display: flex; flex-direction: column; width: 100%; }
    .navbar li { padding: 0; } /* Remove generic padding to keep full horizontal link hit zones */
    
    /* FIXED: Mobile Accordion Reset - Prevents hover states from conflicting with mobile taps */
    .nav-horizontal ul li:hover > ul {
      display: none !important;
    }
    
    /* FIXED: Universal Mobile Submenu Structure (Level 1, Level 2, Level 3+) */
    .navbar ul ul {
      display: none !important; /* Force items closed until explicitly toggled */
      position: relative !important;
      width: 100% !important;
      left: 0 !important;
      top: 0 !important;
      padding-left: 15px !important; /* Creates clear layout indent for deeper configurations */
      box-shadow: none !important;
    }
    
    /* FIXED: The explicit class trigger that matches your JavaScript .classList.toggle("active") */
    .navbar ul ul.active {
      display: block !important;
    }
    
    .form-group { flex-direction: column; align-items: flex-start; }
    .form-label { margin-bottom: 5px; }
  }
  
  @media (max-width: 480px) {
    .metric-strip { grid-template-columns: 1fr; }
    .spend-row { grid-template-columns: 1fr; }
  }