/* MODAL */
    .modal-backdrop {
      position: fixed;
      inset: 0;
      background-color: rgba(0, 0, 0, 0.75);
      display: none;
      align-items: center;
      justify-content: center;
      z-index: 100;
    }
    .modal-backdrop.open { display: flex; }
    .modal {
      background-color: var(--card-bg);
      border: 1px solid var(--border-accent);
      max-width: 580px;
      width: 90%;
      max-height: 90vh;
      overflow-y: auto;
    }
    .modal-head {
      padding: 1.4rem 1.75rem;
      border-bottom: 1px solid var(--border);
      display: flex;
      justify-content: space-between;
      align-items: center;
    }
    .modal-body { padding: 1.4rem 1.75rem; }
    .form-group { margin-bottom: 1.15rem; }
    .form-label {
      display: block;
      font-size: 0.85rem;
      font-weight: 600;
      color: var(--text-muted);
      margin-bottom: 0.45rem;
      text-transform: uppercase;
      letter-spacing: 0.04em;
    }
    .form-control {
      width: 100%;
      background-color: var(--input-bg);
      border: 1px solid var(--border);
      padding: 0.7rem 0.95rem;
      color: var(--text);
      font-family: var(--font-sans);
      font-size: 0.95rem;
      outline: none;
    }
    .form-control:focus { border-color: var(--primary); }
    .btn-solid-primary {
      background-color: var(--primary-solid);
      color: #ffffff;
      border: 1px solid var(--primary-solid);
      padding: 0.65rem 1.4rem;
      font-size: 0.95rem;
      font-weight: 600;
      cursor: pointer;
    }
    .btn-solid-primary:hover {
      background-color: var(--primary-hover);
    }

    /* ======================================================== */
    /* RESPONSIVE DESIGN & NATIVE MOBILE APP EXPERIENCE        */
    /* ======================================================== */
    .sidebar-backdrop {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.65);
      backdrop-filter: blur(3px);
      z-index: 998;
      opacity: 0;
      transition: opacity 0.25s ease;
      pointer-events: none;
    }
    .sidebar-backdrop.active {
      display: block;
      opacity: 1;
      pointer-events: auto;
    }
    .sidebar-close-btn {
      display: none;
      background: transparent;
      border: 1px solid var(--border);
      color: var(--text-muted);
      width: 30px;
      height: 30px;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      transition: all 0.15s ease;
    }
    .sidebar-close-btn:hover {
      background: var(--btn-hover);
      color: var(--text);
      border-color: var(--border-accent);
    }
    .mobile-hamburger-btn {
      display: none;
      background: transparent;
      border: 1px solid var(--border);
      color: var(--text);
      width: 36px;
      height: 36px;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      flex-shrink: 0;
    }
    .mobile-hamburger-btn:hover {
      background: var(--btn-hover);
      border-color: var(--border-accent);
    }
    .mobile-brand {
      display: none;
      align-items: center;
      gap: 0.5rem;
      cursor: pointer;
      font-weight: 700;
      color: var(--text);
      text-decoration: none;
      user-select: none;
    }
    .mobile-only-btn {
      display: none;
      flex-shrink: 0;
    }
    .mobile-actions-menu {
      display: none;
      position: absolute;
      top: 56px;
      right: 0.85rem;
      width: 230px;
      background: var(--card-bg);
      border: 1px solid var(--border);
      box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
      z-index: 995;
    }
    .mobile-actions-menu.active {
      display: block;
      animation: fadeInDown 0.15s ease-out;
    }
    @keyframes fadeInDown {
      from { opacity: 0; transform: translateY(-6px); }
      to { opacity: 1; transform: translateY(0); }
    }
    .mobile-action-item {
      width: 100%;
      display: flex;
      align-items: center;
      gap: 0.75rem;
      padding: 0.7rem 1rem;
      background: transparent;
      border: none;
      color: var(--text);
      font-size: 0.86rem;
      text-align: left;
      cursor: pointer;
      transition: background 0.15s, color 0.15s;
    }
    .mobile-action-item:hover {
      background: var(--btn-hover);
      color: var(--primary);
    }
    .mobile-action-item.danger {
      color: #ef4444;
    }
    .mobile-action-item.danger:hover {
      background: #450a0a;
    }
    .mobile-action-divider {
      height: 1px;
      background: var(--border);
      margin: 0.35rem 0;
    }

    /* NATIVE APP BOTTOM NAVIGATION BAR */
    .mobile-bottom-nav {
      display: none;
      position: fixed;
      bottom: 0;
      left: 0;
      right: 0;
      height: 56px;
      background: var(--header-bg);
      border-top: 1px solid var(--border);
      z-index: 850;
      align-items: center;
      justify-content: space-around;
      padding-bottom: env(safe-area-inset-bottom, 0px);
      box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.35);
    }
    .bottom-nav-item {
      flex: 1;
      height: 100%;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 3px;
      background: transparent;
      border: none;
      color: var(--text-muted);
      font-size: 0.68rem;
      font-weight: 500;
      cursor: pointer;
      padding: 4px 0;
      text-decoration: none;
      transition: color 0.15s ease;
      -webkit-tap-highlight-color: transparent;
      position: relative;
    }
    .bottom-nav-item svg {
      transition: transform 0.15s ease, stroke 0.15s ease;
    }
    .bottom-nav-item:active svg {
      transform: scale(0.9);
    }
    .bottom-nav-item.active {
      color: var(--primary);
      font-weight: 700;
    }
    .bottom-nav-item.active svg {
      stroke: var(--primary);
    }
    .bottom-nav-item.active::before {
      content: '';
      position: absolute;
      top: 0;
      left: 20%;
      right: 20%;
      height: 2px;
      background: var(--primary);
    }

    /* TABLE SCROLL ENHANCEMENT */
    .table-container {
      width: 100%;
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
    }
    .table-container table {
      min-width: 680px;
    }
    .table-container th, .table-container td {
      white-space: nowrap;
    }

    /* RESPONSIVE MEDIA QUERIES (<= 860px) */
    @media (max-width: 860px) {
      .desktop-only {
        display: none !important;
      }
      .mobile-hamburger-btn {
        display: inline-flex;
      }
      .mobile-brand {
        display: flex;
      }
      .mobile-only-btn {
        display: inline-flex;
      }
      .mobile-bottom-nav {
        display: flex;
      }
      .sidebar-close-btn {
        display: inline-flex;
      }

      /* Sidebar turns into off-canvas drawer */
      .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 280px;
        max-width: 85vw;
        height: 100vh;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
        box-shadow: none;
      }
      .sidebar.mobile-open {
        transform: translateX(0);
        box-shadow: 6px 0 28px rgba(0, 0, 0, 0.7);
      }
      .main-wrap {
        width: 100%;
        min-width: 0;
      }
      .top-header {
        padding: 0 1rem;
        height: 56px;
      }
      .header-left {
        gap: 0.65rem;
      }
      .body-content {
        padding: 1rem 0.85rem 5rem 0.85rem;
      }

      /* 2x2 Gauges on Tablet/Mobile */
      .gauges-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
      }
      .gauge-card {
        padding: 1rem;
        min-height: 115px;
      }
      .gauge-ring-wrap {
        width: 76px;
        height: 76px;
      }
      .gauge-ring-svg {
        width: 76px;
        height: 76px;
      }
      .gauge-status {
        font-size: 1.15rem;
      }
      .gauge-metric {
        font-size: 0.8rem;
      }

      /* Overview modular 2x2 grid + full-width memo */
      .overview-card {
        padding: 0.95rem 1rem;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
        box-sizing: border-box;
      }
      .overview-grid {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 0.65rem;
        width: 100%;
      }
      .ov-card {
        min-width: 0;
        width: 100%;
        overflow: hidden;
        box-sizing: border-box;
        padding: 0.75rem 0.75rem;
      }
      .ov-card-memo {
        grid-column: span 2;
        width: 100%;
        min-width: 0;
      }
      .ov-card-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.25rem;
        width: 100%;
        min-width: 0;
      }
      .ov-icon-title {
        display: flex;
        align-items: center;
        gap: 0.35rem;
        min-width: 0;
        overflow: hidden;
      }
      .ov-title {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }
      .ov-sub-badges {
        display: flex;
        align-items: center;
        gap: 0.3rem;
        flex-wrap: wrap;
        width: 100%;
        min-width: 0;
      }
      .ov-badge {
        max-width: 100%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }

      /* Software and Traffic stacked */
      .split-row {
        grid-template-columns: 1fr;
        gap: 1.15rem;
      }

      /* Site Toolbar */
      .site-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
      }
      .site-toolbar-left {
        flex-wrap: wrap;
        justify-content: space-between;
        gap: 0.5rem;
      }
      .site-toolbar-right {
        width: 100%;
      }
      .site-toolbar-right > div {
        width: 100%;
      }
      #site-search-input {
        width: 100% !important;
      }

      /* Modals Responsive */
      .modal {
        width: 95vw !important;
        max-width: 95vw !important;
        margin: 1rem auto;
        max-height: 90vh;
      }
      .vhost-modal-inner {
        flex-direction: column !important;
        min-height: auto !important;
      }
      .vhost-tabs-sidebar {
        width: 100% !important;
        border-right: none !important;
        border-bottom: 1px solid var(--border) !important;
        display: flex !important;
        flex-direction: row !important;
        overflow-x: auto;
        padding: 0.4rem 0.5rem !important;
        gap: 0.35rem;
      }
      .vhost-tabs-sidebar .settings-tab-btn {
        width: auto !important;
        white-space: nowrap;
        padding: 0.45rem 0.75rem;
        border-left: none !important;
        border-bottom: 2px solid transparent;
        font-size: 0.82rem;
      }
      .vhost-tabs-sidebar .settings-tab-btn.active {
        border-bottom-color: var(--primary) !important;
        background: transparent;
      }
      .vhost-content-area {
        padding: 1rem !important;
      }

      /* Terminal */
      #view-terminal {
        height: calc(100vh - 125px);
      }
      .terminal-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.6rem;
        padding: 0.65rem 0.85rem;
      }
      .terminal-actions {
        flex-wrap: wrap;
      }
    }

    /* PHONES (<= 520px) */
    @media (max-width: 520px) {
      #header-os-badge, #header-access-badge {
        display: none !important;
      }
      .gauges-row {
        grid-template-columns: 1fr 1fr;
        gap: 0.55rem;
      }
      .gauge-card {
        padding: 0.85rem 0.7rem;
        min-height: 100px;
      }
      .gauge-ring-wrap {
        width: 64px;
        height: 64px;
      }
      .gauge-ring-svg {
        width: 64px;
        height: 64px;
      }
      .gauge-status {
        font-size: 1rem;
      }
      .gauge-title {
        font-size: 0.82rem;
      }
      .gauge-metric {
        font-size: 0.72rem;
      }
      .overview-card {
        padding: 0.75rem 0.65rem;
        width: 100%;
        max-width: 100%;
        overflow: hidden;
        box-sizing: border-box;
      }
      .overview-grid {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 0.5rem;
        width: 100%;
      }
      .ov-card-memo {
        grid-column: span 2;
        width: 100%;
        min-width: 0;
      }
      .ov-card {
        padding: 0.65rem 0.55rem;
        min-height: 90px;
        min-width: 0;
        width: 100%;
        overflow: hidden;
        box-sizing: border-box;
      }
      .ov-icon-box {
        width: 24px;
        height: 24px;
      }
      .ov-icon-box svg {
        width: 13px;
        height: 13px;
      }
      .ov-title {
        font-size: 0.76rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }
      .ov-metric-val {
        font-size: 1.15rem;
      }
      .ov-badge {
        font-size: 0.62rem;
        padding: 0.1rem 0.35rem;
        max-width: 100%;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }
      .software-grid {
        grid-template-columns: 1fr;
      }
      .traffic-rates-bar {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.45rem;
        font-size: 0.74rem;
        padding: 0.6rem 0.75rem;
      }
      .login-container {
        padding: 1rem;
      }
      .login-card {
        padding: 2rem 1.5rem;
      }
    }

    /* ======================================================== */
