.index-container {
    padding: 0;
    margin: 0;
    width: 100%;
    max-width: 100%;
    align-items: stretch;
    justify-content: flex-start;
    min-height: unset;
    background-color: var(--background-color);
    color: var(--text-color-dark);
    overflow-x: auto; /* Allow horizontal scrolling if needed */
    overflow-y: visible;
}

.index-header {
    color: var(--primary-color);
    font-size: var(--font-size-heading);
    margin-bottom: var(--spacing-medium);
    text-align: center;
}

.index-description {
    color: var(--text-color-light);
    max-width: 600px;
    text-align: center;
    margin-bottom: var(--spacing-large);
}

.cta-button {
    display: inline-block;
    background-color: var(--secondary-color);
    color: #101c11;
    font-size: 0.85em;
    padding: 0.35em 1.1em;
    height: 2em;
    text-decoration: none;
    border-radius: 5px;
    transition: background-color 0.3s ease, box-shadow 0.3s, transform 0.12s cubic-bezier(0.4,0,0.2,1);
    box-shadow: 0 2px 8px rgba(0,255,65,0.08);
    border: 1px solid #00ff41;
    font-family: 'Consolas', 'Courier New', monospace;
}

.cta-button:hover {
    background-color: #1aff5c;
    color: #101c11;
    transform: translateY(-2px); /* Add a slight lift */
    box-shadow: 0 4px 12px rgba(0,255,65,0.15); /* Enhance shadow */
}

.cta-button:active {
    background-color: #00e639; /* Slightly darker green for click */
    transform: scale(0.96);
    box-shadow: 0 2px 8px rgba(0,255,65,0.08); /* Reset shadow to normal */
}

/* Special styling for "All Devices" button */
#sendAllDevicesBtn {
    background-color: #ff4400 !important;
    border-color: #ff4400 !important;
    color: #ffffff !important;
    font-weight: bold;
}

#sendAllDevicesBtn:hover {
    background-color: #ff6600 !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(255,68,0,0.3) !important;
}

#sendAllDevicesBtn:active {
    background-color: #cc3300 !important;
}

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: #142a17;
    border-bottom: 1px solid #00ff41;
    position: relative;
    top: 0;
    z-index: 10;
    min-height: 3.5rem; /* Ensure enough height for vertical centering */
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.page-title-bar {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 2.1rem !important;
    font-weight: bold !important;
    color: #7fff7f !important;
    letter-spacing: 0.5px !important;
    text-shadow: 0 0 8px #00ff41 !important;
    z-index: 1;
}

.toolbar-title {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-left: 2rem;
    text-shadow: 0 0 8px #00ff41;
}

.toolbar-dropdown:not(#pageNavDropdown), .cta-button, #commandInput {
    margin-right: 1rem;
}

.toolbar-dropdown:not(#pageNavDropdown), #commandInput {
    background: #101c11;
    color: var(--primary-color);
    border: 1px solid #00ff41;
    font-family: 'Consolas', 'Courier New', monospace;
}

.command-panel {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#machines-table {
    width: 100%;
    max-width: 100%;
    overflow: visible; /* Let GridJS handle overflow */
    margin: 0;
    padding: 0;
    background: #101c11;
    color: var(--primary-color);
}

.gridjs-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important; /* Allow horizontal scrolling if needed */
    overflow-y: visible !important;
    display: block !important;
}

.gridjs-table {
    width: 100% !important;
    max-width: 100% !important;
    table-layout: fixed !important;
    background: #101c11 !important;
    color: var(--primary-color) !important;
    border-color: #00ff41 !important;
    font-size: 0.9rem !important; /* Slightly smaller font to fit more content */
}

.gridjs-th, .gridjs-td {
    text-align: center !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    padding: 6px 4px !important; /* Reduced padding for tighter layout */
    font-size: 0.85rem !important;
    line-height: 1.2 !important;
}

.gridjs-th:nth-child(2), .gridjs-td:nth-child(2) { /* DeviceId */
    width: 16% !important;
    min-width: 120px !important;
}
.gridjs-th:nth-child(3), .gridjs-td:nth-child(3) { /* DeviceName */
    width: 19% !important;
    min-width: 140px !important;
}
.gridjs-th:nth-child(4), .gridjs-td:nth-child(4) { /* OS */
    width: 8% !important;
    min-width: 60px !important;
}
.gridjs-th:nth-child(5), .gridjs-td:nth-child(5) { /* Value */
    width: 8% !important;
    min-width: 60px !important;
}
.gridjs-th:nth-child(6), .gridjs-td:nth-child(6) { /* Risk */
    width: 7% !important;
    min-width: 50px !important;
}
.gridjs-th:nth-child(7), .gridjs-td:nth-child(7) { /* Group */
    width: 18% !important;
    min-width: 120px !important;
}
.gridjs-th:nth-child(8), .gridjs-td:nth-child(8) { /* LastSeen */
    width: 12% !important;
    min-width: 100px !important;
}
.gridjs-th:nth-child(9), .gridjs-td:nth-child(9) { /* IP */
    width: 11% !important;
    min-width: 90px !important;
}

.gridjs-thead, .gridjs-th, .gridjs-tr, .gridjs-td {
    background: #101c11 !important;
    color: var(--primary-color) !important;
    border-color: #00ff41 !important;
}

/* Add specific border styling for body cells */
.gridjs-td {
    border: 1px solid #444 !important;
    background: #101c11 !important;
    color: #7fff7f !important;
}

/* Alternate row styling */
.gridjs-tr:nth-child(even) .gridjs-td {
    background: #0f1b10 !important;
}

.gridjs-thead .gridjs-th {
    background: #142a17 !important;
    color: #7fff7f !important;
    border: 1px solid #00ff41 !important;
    border-bottom: 2px solid #00ff41 !important;
    width: 100% !important;
    box-sizing: border-box !important;
    position: relative !important;
    font-weight: bold !important;
}

/* Ensure first header cell has left border */
.gridjs-thead .gridjs-th:first-child {
    border-left: 1px solid #00ff41 !important;
}

/* Ensure last header cell has right border */
.gridjs-thead .gridjs-th:last-child {
    border-right: 1px solid #00ff41 !important;
}

/* Add proper table border styling */
.gridjs-thead {
    border-collapse: collapse !important;
    position: relative !important;
    width: 100% !important;
}

/* Ensure table has proper border handling */
.gridjs-thead tr {
    border-collapse: collapse !important;
}

/* Override any default GridJS borders for table structure */
.gridjs-table {
    border-collapse: collapse !important;
    border: 1px solid #00ff41 !important;
}

/* Ensure consistent header cell styling */
.gridjs-table .gridjs-thead .gridjs-tr .gridjs-th {
    border: 1px solid #00ff41 !important;
    border-bottom: 2px solid #00ff41 !important;
}

.gridjs-pagination, .gridjs-search {
    background: #101c11 !important;
    color: var(--primary-color) !important;
}

.gridjs-pagination .gridjs-pages {
    background: #101c11 !important;
}

.gridjs-pagination .gridjs-pages button {
    background: #142a17 !important;
    color: var(--primary-color) !important;
    border: 1px solid #00ff41 !important;
    font-family: 'Consolas', 'Courier New', monospace !important;
}

.gridjs-pagination .gridjs-pages button:hover {
    background: #00ff41 !important;
    color: #101c11 !important;
}

.gridjs-pagination .gridjs-pages button[disabled] {
    background: #0a1a0b !important;
    color: #4d7f4f !important;
    border-color: #4d7f4f !important;
}

.gridjs-pagination .gridjs-summary {
    background: #101c11 !important;
    color: #7fff7f !important;
    font-family: 'Consolas', 'Courier New', monospace !important;
    border: 1px solid #00ff41 !important;
    border-radius: 4px !important;
    padding: 8px 12px !important;
    box-shadow: none !important;
}

/* Additional selectors to override Mermaid theme */
.gridjs-footer .gridjs-summary,
.gridjs-pagination-summary,
.gridjs-summary,
div[class*="summary"] {
    background: #101c11 !important;
    color: #7fff7f !important;
    border: 1px solid #00ff41 !important;
    border-radius: 4px !important;
    box-shadow: none !important;
    outline: none !important;
}

/* Override any potential conflicting mermaid theme styles */
.gridjs-wrapper .gridjs-pagination .gridjs-summary,
.gridjs-container .gridjs-pagination .gridjs-summary {
    background: #101c11 !important;
    color: #7fff7f !important;
    border: 1px solid #00ff41 !important;
    border-radius: 4px !important;
    box-shadow: none !important;
    outline: none !important;
}

/* Complete GridJS styling to replace Mermaid theme */
.gridjs-container {
    background: #101c11 !important;
    color: var(--primary-color) !important;
    border: none !important;
}

.gridjs-head {
    background: #142a17 !important;
}

/* Ensure the table itself has proper border handling */
.gridjs-table {
    border-collapse: collapse !important;
    border-spacing: 0 !important;
}

/* Make sure the thead element spans full width */
.gridjs-thead {
    display: table-header-group !important;
    width: 100% !important;
}

/* Ensure header row spans full table width */
.gridjs-thead .gridjs-tr {
    display: table-row !important;
    width: 100% !important;
    border: none !important;
}

.gridjs-search input {
    background: #142a17 !important;
    color: var(--primary-color) !important;
    border: 1px solid #00ff41 !important;
    border-radius: 4px !important;
}

.gridjs-footer {
    background: #101c11 !important;
    border-top: 1px solid #00ff41 !important;
}

.gridjs-pagination {
    justify-content: space-between !important;
    align-items: center !important;
    background: #101c11 !important;
    padding: 1rem !important;
}

.gridjs-pagination .gridjs-summary,
.gridjs-pagination .gridjs-pages {
    background: transparent !important;
}

/* Ensure no default borders or backgrounds interfere */
.gridjs-pagination * {
    background: transparent !important;
    border: none !important;
}

.gridjs-pagination .gridjs-summary {
    background: #101c11 !important;
    color: #7fff7f !important;
    border: 1px solid #00ff41 !important;
    border-radius: 4px !important;
    padding: 8px 12px !important;
    font-family: 'Consolas', 'Courier New', monospace !important;
}

.gridjs-pagination .gridjs-pages button {
    background: #142a17 !important;
    color: var(--primary-color) !important;
    border: 1px solid #00ff41 !important;
    font-family: 'Consolas', 'Courier New', monospace !important;
    margin: 0 2px !important;
    padding: 6px 12px !important;
    border-radius: 4px !important;
}

.gridjs-search input[type="search"] {
    background: #142a17 !important;
    color: var(--primary-color) !important;
    border: 1px solid #00ff41 !important;
    font-family: 'Consolas', 'Courier New', monospace;
    box-shadow: none !important;
}



/* Secondary Parameter Bar Styling */
#secondaryParamsBar {
    border-top: 1px solid #333;
}

#paramLabel {
    font-weight: 600;
    font-size: 0.9rem;
    min-width: fit-content;
    white-space: nowrap;
}

#paramInputContainer {
    flex: 1;
}

#paramInputContainer input,
#paramInputContainer select {
    min-width: 200px;
}

#paramInputContainer .cta-button {
    margin-left: 1rem;
    margin-right: 0;
}

/* --- 3. Modernize Modals (for tenant modal and future modals) --- */
#tenantModal, .modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.7);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    animation: modal-fade-in 0.35s cubic-bezier(0.4,0,0.2,1);
}

@keyframes modal-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

#tenantModal .modal-content, .modal-content {
    background: #142a17 !important;
    padding: 2rem !important;
    border-radius: 18px !important;
    min-width: 400px;
    max-width: 90vw;
    box-shadow: 0 8px 32px 0 rgba(0,255,65,0.25), 0 1.5px 8px 0 #00ff41;
    border: 1.5px solid #00ff41;
    animation: modal-scale-in 0.35s cubic-bezier(0.4,0,0.2,1);
    color: #7fff7f !important;
    font-family: Consolas, monospace !important;
}

@keyframes modal-scale-in {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

#tenantModal .modal-header, .modal-header {
    border-bottom: 1px solid #00ff41;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

#tenantModal .close, .modal .close {
    color: #00ff41;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}
#tenantModal .close:hover, .modal .close:hover {
    color: #1aff5c;
}

/* --- 5. Loading Indicator --- */
#loadingOverlay .neon-spinner {
    border: 3px solid #00ff41;
    border-top: 3px solid #1aff5c;
    border-right: 3px solid #00e639;
    border-bottom: 3px solid #00ff41;
    border-left: 3px solid #7fff7f;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    margin: 0 auto 20px;
    animation: spin 1s linear infinite, neon-pulse 1.2s infinite alternate;
    box-shadow: 0 0 16px #00ff41, 0 0 32px #1aff5c;
}
@keyframes neon-pulse {
    0% { box-shadow: 0 0 8px #00ff41, 0 0 16px #1aff5c; }
    100% { box-shadow: 0 0 32px #00ff41, 0 0 64px #1aff5c; }
}

#loadingOverlay .progress-bar {
    width: 80%;
    height: 6px;
    background: linear-gradient(90deg, #00ff41 0%, #1aff5c 100%);
    border-radius: 3px;
    margin: 18px auto 0 auto;
    overflow: hidden;
    position: relative;
}
#loadingOverlay .progress-bar-inner {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #00ff41 0%, #1aff5c 100%);
    border-radius: 3px;
    animation: progress-bar-move 2.5s linear infinite;
}
@keyframes progress-bar-move {
    0% { width: 0%; }
    80% { width: 100%; }
    100% { width: 0%; }
}

/* --- 7. Microinteractions --- */
.cta-button {
    /* ...existing styles... */
    transition: background-color 0.3s, box-shadow 0.3s, transform 0.12s cubic-bezier(0.4,0,0.2,1);
}
.cta-button:active {
    /* ...existing styles... */
    transform: scale(0.96);
}

.gridjs-tr {
    transition: background 0.18s, box-shadow 0.18s;
}
.gridjs-tr:hover .gridjs-td {
    background: #1a2e1d !important;
    box-shadow: 0 0 8px #00ff4133;
    cursor: pointer;
}

@keyframes row-flash {
    0% { background: #00ff4133; }
    100% { background: inherit; }
}
.gridjs-tr.flash {
    animation: row-flash 0.7s;
}

/* Master Tenant Device Group Styles */
#deviceGroupBar {
    background: linear-gradient(135deg, #0d1f10 0%, #1a2b1f 100%);
    border-bottom: 2px solid #00ff41;
    box-shadow: 0 2px 4px rgba(0, 255, 65, 0.1);
}

#deviceGroupBar .toolbar-left {
    align-items: center;
    gap: 1rem;
}

#deviceGroupDropdown {
    background: #1a1a1a;
    border: 2px solid #00ff41;
    color: #7fff7f;
    font-family: Consolas, monospace;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 255, 65, 0.2);
}

#deviceGroupDropdown:focus {
    outline: none;
    border-color: #1aff5c;
    box-shadow: 0 0 0 2px rgba(26, 255, 92, 0.3);
}

#refreshDeviceGroups {
    background-color: #006600;
    border-color: #006600;
    font-size: 0.8em;
    padding: 0.3em 0.8em;
}

#refreshDeviceGroups:hover {
    background-color: #00aa00;
    border-color: #00aa00;
}

#deviceGroupInfo {
    font-style: italic;
    color: #aaa;
    font-size: 0.9em;
}

/* Master Tenant Indicators */
.master-tenant-badge {
    background: linear-gradient(135deg, #00ff41 0%, #1aff5c 100%);
    color: #101c11;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.7em;
    font-weight: bold;
    margin-left: 4px;
}

/* Tenant Modal Master Tenant Checkbox */
#newTenantMasterFlag {
    accent-color: #00ff41;
    transform: scale(1.2);
}

#newTenantMasterFlag:checked {
    background-color: #00ff41;
}

/* Master Tenant visual enhancement in tenant list */
.tenant-item.master-tenant {
    border-left: 4px solid #00ff41;
    background: linear-gradient(135deg, #0a1a0a 0%, #0f2f0f 100%);
}