/* Main Application Styles */

:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --dark-color: #343a40;
    --light-color: #f8f9fa;
    --border-radius: 12px;
    --topbar-height: 56px;
    --sidebar-width: 264px;
    --sidebar-collapsed-width: 76px;
    --sidebar-bg: #212529;
    --sidebar-text: #dbe2ee;
    --sidebar-muted: #9aa6b8;
    --placeholder-opacity: 0.6;  /* Global placeholder text opacity - change this value to adjust all placeholders */
}

/* Global placeholder styling - uses CSS variable for easy customization */
::placeholder {
    /*opacity: var(--placeholder-opacity);*/
    opacity: 1; /* ensures the exact color is applied */
    color: #bdbdbd;
    /*color: #6c757d;*/
}

.form-control::placeholder {
    /*opacity: var(--placeholder-opacity);*/
    opacity: 1; /* ensures the exact color is applied */
    color: #bdbdbd;
    /*color: #6c757d;*/
}


::-webkit-input-placeholder { /* WebKit browsers */
    opacity: 1; /* ensures the exact color is applied */
    color: #bdbdbd;
}

::-moz-placeholder { /* Mozilla Firefox */
    opacity: 1; /* ensures the exact color is applied */
    color: #bdbdbd;
}

:-ms-input-placeholder { /* Internet Explorer 10-11 */
    opacity: 1; /* ensures the exact color is applied */
    color: #bdbdbd;
}

:-moz-placeholder { /* Mozilla Firefox 4 to 18 */
    opacity: 1; /* ensures the exact color is applied */
    color: #bdbdbd;
}

/* Form text helper styling to match placeholder opacity */
.form-text {
    opacity: calc(var(--placeholder-opacity) + 0.2);  /* Slightly more visible than placeholders */
    color: #6c757d;
}

body {
    padding-top: var(--topbar-height);
    background-color: #f5f5f5;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Responsive padding for main container */
#mainContainer {
    width: auto;
    min-height: calc(100vh - var(--topbar-height));
    margin-left: var(--sidebar-width);
    padding: 0 1rem 1rem;
    transition: margin-left 0.2s ease;
}

body.sidebar-collapsed #mainContainer {
    margin-left: var(--sidebar-collapsed-width);
}

/* Page header - tight spacing */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0.75rem 0;
    padding: 0 1rem;
}

.page-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

/* Mobile specific adjustments */
@media (max-width: 576px) {
    body {
        padding-top: var(--topbar-height);
    }
    
    #mainContent {
        padding: 0.25rem; /* Very reduced padding on mobile */
    }
    
    .page-header {
        margin: 0.25rem 0; /* Minimal margin on mobile */
        padding: 0 0.5rem;
    }
    
    .page-header h2 {
        font-size: 1.25rem; /* Smaller heading on mobile */
    }
    
    .card {
        margin-bottom: 0.5rem;
    }
}

/* Navigation */
.app-topbar {
    height: var(--topbar-height);
    background-color: var(--sidebar-bg);
    box-shadow: 0 2px 4px rgba(0,0,0,.1);
    z-index: 1040;
}

.app-topbar-content {
    min-height: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.app-sidebar-toggle {
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 6px;
    color: #f8f9fa;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.app-sidebar-toggle:hover,
.app-sidebar-toggle:focus {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.32);
    box-shadow: none;
}

.navbar-brand {
    font-weight: bold;
    color: var(--primary-color) !important;
}

.app-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 0;
    margin-right: 0;
    white-space: nowrap;
}

.app-sidebar {
    position: fixed;
    top: var(--topbar-height);
    bottom: 0;
    left: 0;
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    z-index: 1030;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.12);
    transition: width 0.2s ease, transform 0.2s ease;
}

.sidebar-nav {
    min-height: 100%;
    padding: 1rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.sidebar-section-system {
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-section-heading {
    padding: 0.4rem 0.75rem 0.25rem;
    color: var(--sidebar-muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
}

.nav-link {
    transition: all 0.3s ease;
}

.nav-link:hover {
    color: var(--primary-color) !important;
}

.nav-link.active {
    color: var(--primary-color) !important;
    border-bottom: 2px solid var(--primary-color);
}

.sidebar-link.nav-link {
    min-height: 42px;
    padding: 0.65rem 0.75rem;
    border-bottom: 0;
    border-radius: 8px;
    color: var(--sidebar-text) !important;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    overflow: hidden;
    position: relative;
    text-decoration: none;
    white-space: nowrap;
}

.sidebar-link.nav-link i {
    width: 20px;
    flex: 0 0 20px;
    color: #aeb8c8;
    text-align: center;
}

.sidebar-link.nav-link span {
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-link.nav-link:hover,
.sidebar-link.nav-link:focus {
    background-color: rgba(255, 255, 255, 0.08);
    color: #fff !important;
}

.sidebar-link.nav-link.active {
    background-color: rgba(102, 126, 234, 0.2);
    border-bottom: 0;
    box-shadow: inset 3px 0 0 var(--primary-color);
    color: #fff !important;
}

.sidebar-link.nav-link.active i {
    color: #fff;
}

body.sidebar-collapsed .app-sidebar {
    width: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .sidebar-nav {
    padding: 0.75rem 0.5rem;
    align-items: center;
}

body.sidebar-collapsed .sidebar-section {
    width: 100%;
    align-items: center;
}

body.sidebar-collapsed .sidebar-section-heading {
    height: 1px;
    margin: 0.35rem 0;
    padding: 0;
    opacity: 0;
    overflow: hidden;
}

body.sidebar-collapsed .sidebar-link.nav-link {
    width: 44px;
    justify-content: center;
    gap: 0;
    padding: 0.65rem 0;
}

body.sidebar-collapsed .sidebar-link.nav-link span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

.sidebar-backdrop {
    display: none;
}

@media (max-width: 991.98px) {
    #mainContainer,
    body.sidebar-collapsed #mainContainer {
        margin-left: 0;
        padding: 0 0.5rem 1rem;
        transition: none;
    }

    .app-sidebar,
    body.sidebar-collapsed .app-sidebar {
        width: min(82vw, 280px);
        transform: translateX(-100%);
    }

    body.sidebar-open .app-sidebar {
        transform: translateX(0);
    }

    body.sidebar-collapsed .sidebar-nav {
        padding: 1rem 0.75rem;
        align-items: stretch;
    }

    body.sidebar-collapsed .sidebar-section {
        width: auto;
        align-items: stretch;
    }

    body.sidebar-collapsed .sidebar-section-heading {
        height: auto;
        margin: 0;
        padding: 0.4rem 0.75rem 0.25rem;
        opacity: 1;
        overflow: visible;
    }

    body.sidebar-collapsed .sidebar-link.nav-link {
        width: auto;
        justify-content: flex-start;
        gap: 0.75rem;
        padding: 0.65rem 0.75rem;
    }

    body.sidebar-collapsed .sidebar-link.nav-link span {
        position: static;
        width: auto;
        height: auto;
        overflow: hidden;
        clip: auto;
    }

    .sidebar-backdrop {
        position: fixed;
        top: var(--topbar-height);
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 1025;
        background-color: rgba(0, 0, 0, 0.35);
    }

    body.sidebar-open .sidebar-backdrop {
        display: block;
    }
}

/* Cards */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0,0,0,0.08);
    margin-bottom: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 25px rgba(0,0,0,0.15);
}

.card-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    font-weight: bold;
    border-radius: 10px 10px 0 0 !important;
}

/* Dashboard Stats */
.stat-card {
    text-align: center;
    padding: 20px;
}

.stat-card i {
    font-size: 48px;
    margin-bottom: 10px;
    opacity: 0.8;
}

.stat-card h3 {
    font-size: 32px;
    font-weight: bold;
    margin: 10px 0;
}

.stat-card p {
    color: #6c757d;
    margin: 0;
}

/* Tables */
.table-responsive {
    border-radius: 10px;
    overflow: hidden;
}

.table thead th {
    background-color: var(--dark-color);
    color: white;
    border: none;
    font-weight: 500;
}

.table-hover tbody tr:hover {
    background-color: rgba(102, 126, 234, 0.1);
}

/* Buttons */
.btn {
    border-radius: 5px;
    padding: 8px 16px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border: none;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.875rem;
}

.btn-group-sm > .btn {
    padding: 5px 10px;
}

/* Forms */
.form-control, .form-select {
    border-radius: 5px;
    border: 1px solid #dee2e6;
    transition: all 0.3s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.form-label {
    font-weight: 500;
    color: #495057;
    margin-bottom: 5px;
}

/* Modals */
.modal-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
}

.modal-header .btn-close {
    filter: brightness(0) invert(1);
}

/* Code/Pre blocks */
pre {
    background-color: #2d2d2d;
    color: #f8f8f2;
    padding: 15px;
    border-radius: 5px;
    overflow-x: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
}

.code-output {
    max-height: 500px;
    overflow-y: auto;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-overlay .spinner-border {
    width: 3rem;
    height: 3rem;
}

/* Badges */
.badge {
    padding: 5px 10px;
    font-weight: 500;
    border-radius: 5px;
}

/* Status Indicators */
.status-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 5px;
}

.status-online {
    background-color: var(--success-color);
    animation: pulse 2s infinite;
}

.status-offline {
    background-color: var(--danger-color);
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(40, 167, 69, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0);
    }
}

/* Command/Script Editor */
.code-editor {
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    line-height: 1.5;
    min-height: 200px;
}

/* Log Viewer */
.log-entry {
    padding: 10px;
    border-left: 3px solid transparent;
    margin-bottom: 5px;
    transition: all 0.3s ease;
}

.log-entry:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.log-entry.success {
    border-left-color: var(--success-color);
}

.log-entry.error {
    border-left-color: var(--danger-color);
}

.log-entry.warning {
    border-left-color: var(--warning-color);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    body {
        padding-top: var(--topbar-height);
    }
    
    .card {
        margin-bottom: 15px;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-card i {
        font-size: 36px;
    }
    
    .stat-card h3 {
        font-size: 24px;
    }
    
    .table {
        font-size: 14px;
    }
    
    .btn-group {
        display: flex;
        flex-direction: column;
    }
    
    .btn-group .btn {
        border-radius: 5px !important;
        margin-bottom: 5px;
    }
    
    /* Make tables horizontally scrollable on mobile */
    .table-responsive {
        -webkit-overflow-scrolling: touch;
    }
    
    /* Stack form groups on mobile */
    .row.g-3 > [class*="col-"] {
        margin-bottom: 10px;
    }
}

/* Tablet Responsive */
@media (min-width: 768px) and (max-width: 1024px) {
    .container-fluid {
        padding: 0 20px;
    }
}

/* Action Buttons Container */
.action-buttons {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

/* Quick Actions */
.quick-action {
    cursor: pointer;
    transition: all 0.3s ease;
}

.quick-action:hover {
    transform: scale(1.05);
}

/* Toast Notifications Override */
.notyf__toast {
    border-radius: 10px !important;
    font-family: inherit !important;
}

.notyf__toast--success {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%) !important;
}

.notyf__toast--error {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%) !important;
}

/* Clear Filters button on gradient card headers */
.card-header .btn-outline-secondary {
    background-color: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    color: white;
}

.card-header .btn-outline-secondary:hover {
    background-color: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.7);
    color: white;
}

/* Logs count text on gradient card headers */
.card-header .text-muted,
.card-header small.text-muted {
    color: rgba(255, 255, 255, 0.9) !important;
    font-weight: 500;
}

/* DataTables Customization */
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
    color: white !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--secondary-color) !important;
    border-color: var(--secondary-color) !important;
    color: white !important;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.empty-state i {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h4 {
    margin-bottom: 10px;
}

.empty-state p {
    margin-bottom: 20px;
}

/* Animated Background for Dashboard */
.dashboard-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 30px;
    border-radius: 10px;
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
}

.dashboard-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: rotate 30s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* Hosts table layout */
.hosts-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.btn-icon i {
    font-size: 14px;
}

/* Disabled delete button styling */
.btn-icon[disabled] {
    opacity: 0.5;
    cursor: not-allowed !important;
}

.btn-icon.btn-secondary[disabled] {
    background-color: #6c757d;
    border-color: #6c757d;
}

.btn-icon.btn-secondary[disabled]:hover {
    background-color: #6c757d;
    border-color: #6c757d;
}

/* Command Cards - Similar to Host Cards */
.commands-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
}

.command-card {
    background: white;
    border-radius: var(--border-radius);
    border: 1px solid #e0e0e0;
    transition: all 0.2s ease;
    overflow: hidden;
}

.command-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.command-card-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.command-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.command-id {
    font-size: 1rem;
}

.command-id .text-muted,
.command-host .text-muted,
.command-description .text-muted {
    font-size: 0.85rem;
    font-weight: normal;
}

.command-description {
    color: #333;
    font-size: 0.95rem;
}

.command-description em {
    color: #999;
    font-style: italic;
}

.command-code {
    background: #f5f5f5;
    padding: 5px 12px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 1.2rem;
    font-weight: 600;
    overflow-x: auto;
    white-space: pre;
    text-align: left !important;
    color: #cc5916 ;

}

/*.command-code code {
    text-align: left;
    display: block;
}*/

.command-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.command-schedule {
    font-size: 0.9rem;
    color: #666;
}

.command-features {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.command-stats {
    display: flex;
    gap: 20px;
    font-size: 0.9rem;
    color: #666;
}

.command-stats .stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.command-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

/* Mobile responsiveness for command cards */
@media (min-width: 768px) {
    .commands-container {
        max-width: 600px;
    }
}

@media (max-width: 768px) {
    .command-card-body {
        padding: 12px;
        gap: 10px;
    }
    
    .command-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .command-code {
        font-size: 0.85rem;
        padding: 6px 10px;
    }
    
    .command-details {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .command-actions {
        justify-content: center;
        width: 100%;
        padding-top: 8px;
        border-top: 1px solid #e0e0e0;
    }
    
    .command-stats {
        width: 100%;
        justify-content: space-around;
    }
}

@media (max-width: 576px) {
    .commands-container {
        padding: 0;
    }
    
    .command-card {
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    
    .command-card-body {
        padding: 10px;
    }
    
    .btn-icon {
        width: 36px;
        height: 36px;
    }
}

/* Modern Commands table layout */
.commands-page { max-width: 100%; padding: 1.25rem 0 0; color: #202530; }
.commands-page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.commands-page-header h1 { margin: 0; font-size: 1.75rem; font-weight: 700; letter-spacing: -0.025em; }
.commands-page-header p { margin: 0.35rem 0 0; color: #7a8291; font-size: 0.925rem; }
.commands-add-button { padding: 0.7rem 1rem; border: 0; border-radius: 8px; background: linear-gradient(135deg, var(--primary-color), var(--secondary-color)); box-shadow: 0 6px 14px rgba(102,126,234,.2); font-weight: 600; }
.commands-toolbar { display: grid; grid-template-columns: minmax(260px,1fr) minmax(160px,.27fr) minmax(190px,.32fr) auto; gap: 1rem; align-items: end; margin-bottom: 1rem; }
.commands-search-wrap { position: relative; }
.commands-search-wrap > i { position: absolute; top: 50%; left: 1rem; z-index: 2; color: #929aa8; transform: translateY(-50%); pointer-events: none; }
.commands-search-wrap .form-control { min-height: 48px; padding-left: 2.75rem; border-color: #dfe3e9; border-radius: 8px; background: #fff; }
.commands-filter-field label { display: block; margin-bottom: 0.35rem; color: #596170; font-size: 0.75rem; font-weight: 600; }
.commands-filter-field .form-select, .commands-clear-button { min-height: 48px; border-color: #dfe3e9; border-radius: 8px; background-color: #fff; }
.commands-clear-button { padding-inline: 1rem; color: #4f5664; white-space: nowrap; }
.commands-clear-button:hover { color: var(--primary-color); border-color: var(--primary-color); background: #f8f9ff; }
.commands-summary { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); margin-bottom: 1.25rem; padding: 0.7rem; border: 1px solid #e1e5eb; border-radius: 10px; background: #fff; }
.commands-summary-item { display: flex; align-items: center; gap: 0.7rem; min-width: 0; padding: 0.3rem 0.7rem; border-right: 1px solid #e9ecf1; }
.commands-summary-item:last-child { border-right: 0; }
.commands-summary-icon { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex: 0 0 40px; border-radius: 9px; color: var(--primary-color); background: #f2f4ff; }
.commands-summary-icon-success { color: #2d9148; background: #eef8f0; }
.commands-summary-item small, .commands-summary-item strong { display: block; }
.commands-summary-item small { overflow: hidden; margin-bottom: 0.05rem; color: #727a89; font-size: 0.72rem; text-overflow: ellipsis; white-space: nowrap; }
.commands-summary-item strong { color: #232934; font-size: 1.1rem; line-height: 1.1; }
.commands-table-card { overflow: hidden; border: 1px solid #dfe3e9; border-radius: 10px; background: #fff; box-shadow: 0 2px 8px rgba(31,38,51,.035); }
.commands-table-scroll { overflow-x: auto; }
.commands-table { width: 100%; min-width: 1130px; border-collapse: collapse; font-size: 0.84rem; }
.commands-table th { height: 52px; padding: 0.7rem 0.75rem; border-bottom: 1px solid #dfe3e9; color: #596170; background: #fbfbfc; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.01em; text-align: left; white-space: nowrap; }
.commands-table th button { padding: 0; border: 0; color: inherit; background: none; font: inherit; }
.commands-table th button i { margin-left: 0.3rem; color: #a6adba; }
.commands-table td { height: 60px; padding: 0.65rem 0.75rem; border-bottom: 1px solid #eceef2; color: #38404c; vertical-align: middle; }
.commands-table tbody tr:last-child td { border-bottom: 0; }
.commands-table tbody tr:hover { background: #fafbff; }
.hosts-table { min-width: 980px; }
.hosts-address-text, .hosts-username-text { display: block; max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hosts-table .commands-row-actions { justify-content: flex-end; }
.hosts-table th:last-child { text-align: right; }
.commands-checkbox-cell { width: 42px; text-align: center !important; }
.commands-command-name { max-width: 250px; overflow: hidden; color: #4d63d6; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.commands-description-text { display: block; max-width: 300px; overflow: hidden; color: #505866; text-overflow: ellipsis; white-space: nowrap; }
.commands-feature-icons { display: flex; gap: 0.4rem; margin-top: 0.25rem; color: #8992a2; font-size: 0.7rem; }
.commands-host-badge, .commands-schedule-badge, .commands-status-badge { display: inline-flex; align-items: center; gap: 0.35rem; border-radius: 6px; white-space: nowrap; }
.commands-host-badge { padding: 0.3rem 0.55rem; border: 1px solid #7f8ff0; color: #5368da; background: #f8f9ff; font-weight: 600; }
.commands-host-badge.is-winrm { border-color: #56b9c8; color: #23899a; background: #f3fbfc; }
.commands-schedule-badge { max-width: 160px; overflow: hidden; padding: 0.3rem 0.55rem; color: #4d6387; background: #eef4fb; text-overflow: ellipsis; }
.commands-schedule-badge.is-manual { color: #737b88; background: #f1f2f4; }
.commands-number-cell { color: #555d6a; text-align: center; }
.commands-status-badge { padding: 0.28rem 0.55rem; color: #2b8243; background: #edf8ef; font-weight: 600; }
.commands-status-badge > span { width: 6px; height: 6px; border-radius: 50%; background: #38a653; }
.commands-status-badge.is-manual { color: #646d7b; background: #f1f2f4; }
.commands-status-badge.is-manual > span { background: #929aa8; }
.commands-row-actions { display: flex; align-items: center; gap: 0.4rem; }
.commands-run-button, .commands-more-button { height: 34px; border-radius: 6px; }
.commands-run-button { display: inline-flex; align-items: center; gap: 0.45rem; padding-inline: 0.75rem; border-color: #687bea; color: #5166dc; background: #fff; font-size: 0.78rem; font-weight: 600; }
.commands-run-button:hover { border-color: #566ada; color: #fff; background: #667eea; }
.commands-more-button { width: 34px; border-color: #d8dce3; color: #555e6c; background: #fff; }
.commands-actions-menu { min-width: 165px; padding: 0.4rem; border-color: #e0e3e8; border-radius: 8px; box-shadow: 0 10px 28px rgba(31,38,51,.14); }
.commands-actions-menu .dropdown-item { display: flex; align-items: center; gap: 0.7rem; padding: 0.55rem 0.65rem; border-radius: 5px; font-size: 0.83rem; }
.commands-actions-menu .dropdown-item i { width: 15px; text-align: center; }
.hosts-actions-menu-portal, .commands-actions-menu-portal { position: fixed; inset: auto; display: block; z-index: 1080; margin: 0; }
.commands-table-footer { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 60px; padding: 0.65rem 1rem; border-top: 1px solid #e2e5ea; color: #737b89; font-size: 0.78rem; }
.commands-selected-count { margin-left: 0.65rem; color: #556ad9; font-weight: 600; }
.commands-pagination { display: flex; align-items: center; gap: 0.25rem; }
.commands-page-arrow, .commands-page-number { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: 1px solid transparent; border-radius: 6px; color: #555e6c; background: #fff; font-size: 0.75rem; }
.commands-page-arrow { border-color: #dfe3e9; }
.commands-page-arrow:disabled { opacity: 0.4; }
.commands-page-number.active { color: #fff; background: #6656b8; }
.commands-page-gap { padding: 0 0.2rem; }
.commands-page-size { width: 100px; height: 34px; margin-left: 0.5rem; padding-block: 0.25rem; border-color: #dfe3e9; border-radius: 6px; font-size: 0.75rem; }
.commands-empty-state, .commands-no-results { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 260px; text-align: center; }
.commands-no-results { gap: 0.4rem; color: #8a92a0; }
.commands-no-results i { margin-bottom: 0.3rem; font-size: 1.5rem; }
.commands-no-results strong { color: #4d5562; }

@media (max-width: 1199px) {
    .commands-summary { grid-template-columns: repeat(3,minmax(0,1fr)); }
    .commands-summary-item:nth-child(3) { border-right: 0; }
    .commands-summary-item:nth-child(-n+3) { padding-bottom: 0.65rem; border-bottom: 1px solid #e9ecf1; }
    .commands-summary-item:nth-child(n+4) { padding-top: 0.65rem; }
}
@media (max-width: 900px) {
    .commands-toolbar { grid-template-columns: 1fr 1fr; }
    .commands-search-wrap { grid-column: 1 / -1; }
}
@media (max-width: 576px) {
    .commands-page { padding-top: 0.5rem; }
    .commands-page-header, .commands-table-footer { align-items: stretch; flex-direction: column; }
    .commands-add-button { width: 100%; }
    .commands-toolbar, .commands-summary { grid-template-columns: 1fr; }
    .commands-search-wrap { grid-column: auto; }
    .commands-summary-item, .commands-summary-item:nth-child(3) { padding: 0.55rem; border-right: 0; border-bottom: 1px solid #e9ecf1; }
    .commands-summary-item:last-child { border-bottom: 0; }
    .commands-pagination { flex-wrap: wrap; }
}

/* RunBooks */
.runbooks-toolbar { grid-template-columns: minmax(260px, 1fr) minmax(160px, .27fr) minmax(160px, .27fr) auto; }
.runbooks-table { min-width: 980px; }
.runbook-step-preview { max-width: 320px; overflow: hidden; white-space: nowrap; }
.runbook-builder-header, .runbook-run-header { margin-bottom: 1rem; }
.runbook-builder-header h1, .runbook-run-header h1 { margin: 0; font-size: 1.75rem; }
.runbook-step-card, .runbook-run-step { display: flex; align-items: flex-start; gap: 1rem; margin-bottom: 1rem; padding: 1rem; border: 1px solid #e1e5eb; border-radius: 10px; background: #fff; }
.runbook-step-number { display: flex; align-items: center; justify-content: center; width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%; color: #fff; background: var(--primary-color); font-weight: 700; }
.runbook-step-content { flex: 1; min-width: 0; }
.runbook-step-actions { display: flex; flex-direction: column; gap: .25rem; }
.runbook-builder-actions { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: .75rem; margin-top: 1rem; padding: 1rem; border-top: 1px solid #e1e5eb; background: rgba(245,245,245,.96); z-index: 10; }
.runbook-timeline { position: relative; }
.runbook-run-step.is-succeeded .runbook-step-number { background: #2d9148; }
.runbook-run-step.is-failed .runbook-step-number, .runbook-run-step.is-timed_out .runbook-step-number { background: #dc3545; }
.runbook-run-step.is-pending .runbook-step-number, .runbook-run-step.is-stopped .runbook-step-number { background: #8b93a1; }
@media (max-width: 767.98px) {
    .runbook-step-card, .runbook-run-step { flex-wrap: wrap; }
    .runbook-step-content { order: 2; flex-basis: calc(100% - 50px); }
    .runbook-step-actions { flex-direction: row; margin-left: auto; }
    .runbook-builder-actions { flex-wrap: wrap; }
}

/* PEM Files table */
.pem-files-container {
    max-width: 100%;
    margin: 0 auto;
}

.commands-header-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    justify-content: flex-end;
}

.commands-header-actions .btn-outline-primary.commands-add-button {
    border: 1px solid rgba(102, 126, 234, 0.45);
    background: #fff;
    color: var(--primary-color);
    box-shadow: none;
}

.commands-header-actions .btn-outline-primary.commands-add-button:hover,
.commands-header-actions .btn-outline-primary.commands-add-button:focus {
    background: rgba(102, 126, 234, 0.08);
    color: var(--primary-color);
}

.pem-files-table {
    min-width: 760px;
}

.pem-files-table th:nth-child(2),
.pem-files-table th:nth-child(4),
.pem-files-table td:nth-child(2),
.pem-files-table td:nth-child(4) {
    text-align: center;
}

.pem-files-table th:last-child {
    text-align: right;
}

.pem-files-table .commands-row-actions {
    justify-content: flex-end;
}

.pem-usage-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0.25rem 0.55rem;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}

.pem-usage-badge.is-in-use {
    color: #a16400;
    background: #fff4dd;
}

.pem-usage-badge.is-unused {
    color: #4d5c70;
    background: #eef2f7;
}

/* In-use buttons remain clickable to show the existing explanation. */
.pem-files-table .pem-file-actions .btn.disabled {
    cursor: not-allowed !important;
    pointer-events: auto !important;
}

.pem-files-table .pem-file-actions .btn.opacity-50 {
    opacity: 0.5;
}

.pem-create-key-textarea {
    min-height: 280px;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.88rem;
    line-height: 1.45;
    white-space: pre;
    resize: vertical;
}

/* Scheduled Jobs Overview */
.overview-page {
    --overview-border: #dfe4ea;
    --overview-muted: #687386;
    --overview-panel-shadow: 0 1px 3px rgba(31, 41, 55, 0.06);
    padding-top: 0.75rem;
    color: #202938;
}

.overview-toolbar {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) auto;
    gap: 0.75rem 1rem;
    align-items: center;
    margin-bottom: 0.75rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--overview-border);
    border-radius: 10px;
    background: #fff;
    box-shadow: var(--overview-panel-shadow);
}

.overview-title h1 {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin: 0;
    font-size: 1.35rem;
    font-weight: 650;
}

.overview-title h1 i {
    color: #386fc4;
}

.overview-title p,
.overview-panel-header p {
    margin: 0.2rem 0 0;
    color: var(--overview-muted);
    font-size: 0.78rem;
}

.overview-date-controls {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.overview-date-input-wrap {
    position: relative;
}

.overview-date-input-wrap i {
    position: absolute;
    top: 50%;
    left: 0.65rem;
    z-index: 1;
    color: #64748b;
    transform: translateY(-50%);
    pointer-events: none;
}

.overview-date-input-wrap input {
    width: 154px;
    padding-left: 2rem;
    font-weight: 600;
}

.overview-updated {
    grid-column: 1 / -1;
    justify-self: end;
    color: #7b8491;
    font-size: 0.74rem;
}

.overview-notice {
    display: flex;
    gap: 0.55rem;
    align-items: center;
    margin-bottom: 0.65rem;
    padding: 0.55rem 0.8rem;
    border-radius: 8px;
    font-size: 0.82rem;
}

.overview-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.65rem;
    margin-bottom: 0.75rem;
}

.overview-kpi {
    display: flex;
    gap: 0.8rem;
    align-items: center;
    min-height: 88px;
    padding: 0.8rem 0.9rem;
    border: 1px solid var(--overview-border);
    border-radius: 9px;
    background: #fff;
    box-shadow: var(--overview-panel-shadow);
}

.overview-kpi-icon {
    display: inline-flex;
    flex: 0 0 38px;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 9px;
    background: #edf4ff;
    color: #2f73c9;
}

.overview-kpi.tone-danger .overview-kpi-icon { color: #dc3545; background: #fff0f1; }
.overview-kpi.tone-info .overview-kpi-icon { color: #0f83a6; background: #eaf8fc; }
.overview-kpi.tone-warning .overview-kpi-icon { color: #c47700; background: #fff7e6; }

.overview-kpi > div:last-child {
    min-width: 0;
}

.overview-kpi span,
.overview-kpi small,
.overview-kpi strong {
    display: block;
}

.overview-kpi span {
    color: var(--overview-muted);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.035em;
}

.overview-kpi strong {
    overflow: hidden;
    margin-top: 0.1rem;
    color: #172033;
    font-size: 1.35rem;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.overview-kpi small {
    overflow: hidden;
    margin-top: 0.1rem;
    color: #7a8493;
    font-size: 0.7rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.overview-kpi.is-loading strong,
.overview-kpi.is-loading small {
    color: #b8c0cb;
}

.overview-main-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(285px, 330px);
    gap: 0.75rem;
    align-items: start;
}

.overview-panel {
    overflow: hidden;
    border: 1px solid var(--overview-border);
    border-radius: 10px;
    background: #fff;
    box-shadow: var(--overview-panel-shadow);
}

.overview-panel-header {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    align-items: flex-start;
    min-height: 62px;
    padding: 0.75rem 0.9rem;
    border-bottom: 1px solid #e8ebef;
}

.overview-panel-header.compact {
    min-height: 55px;
    padding-bottom: 0.55rem;
}

.overview-panel-header h2 {
    margin: 0;
    color: #202938;
    font-size: 0.95rem;
    font-weight: 650;
}

.overview-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.85rem;
    margin-top: 0.45rem;
}

.overview-legend span {
    display: inline-flex;
    gap: 0.3rem;
    align-items: center;
    color: #555f6f;
    font-size: 0.68rem;
}

.overview-legend-swatch {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

.overview-view {
    min-height: 380px;
    background: #fff;
}

.overview-widget-loading,
.overview-empty-state,
.overview-error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 380px;
    padding: 2rem;
    color: #788393;
    text-align: center;
}

.overview-widget-loading {
    flex-direction: row;
    gap: 0.5rem;
}

.overview-empty-state i,
.overview-error-state i {
    margin-bottom: 0.7rem;
    color: #9aa5b4;
    font-size: 2rem;
}

.overview-empty-state h3,
.overview-error-state h3 {
    margin: 0 0 0.25rem;
    color: #374151;
    font-size: 1rem;
}

.overview-empty-state p,
.overview-error-state p {
    margin: 0;
    font-size: 0.8rem;
}

.overview-analytics {
    display: grid;
    gap: 0.75rem;
}

.overview-chart {
    width: 100%;
    height: 275px;
}

.overview-footer-note {
    padding: 0.65rem 0.25rem 0.15rem;
    color: #8a93a0;
    font-size: 0.72rem;
    text-align: center;
}

/* DHTMLX Community Gantt customization: one full-day task per job. */
.overview-schedule-panel .gantt_container {
    border: 0;
    font-family: inherit;
}

.overview-schedule-panel .gantt_grid_scale,
.overview-schedule-panel .gantt_task_scale {
    border-color: #dfe4ea;
    background: #fbfcfd;
}

.overview-schedule-panel .gantt_grid_head_cell,
.overview-schedule-panel .gantt_scale_cell {
    color: #465163;
    font-size: 0.7rem;
    font-weight: 600;
}

.overview-schedule-panel .gantt_grid_data .gantt_row,
.overview-schedule-panel .gantt_task_row {
    border-color: #edf0f3;
}

.overview-schedule-panel .gantt_cell {
    overflow: hidden;
    padding: 0 0.7rem;
    color: #273244;
    font-size: 0.73rem;
    font-weight: 550;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.overview-schedule-panel .gantt_task_cell {
    border-color: #edf0f3;
}

.overview-schedule-panel .overview-gantt-task {
    overflow: visible !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    cursor: default !important;
}

.overview-schedule-panel .overview-gantt-task .gantt_task_content {
    overflow: visible;
    width: 100%;
    height: 100%;
}

.overview-gantt-track {
    position: relative;
    width: 100%;
    height: 100%;
}

.overview-occurrence {
    position: absolute;
    top: 4px;
    z-index: 2;
    min-width: 4px;
    height: 12px;
    border-radius: 2px;
    outline: none;
    cursor: help;
}

.overview-occurrence:focus,
.overview-occurrence:hover {
    z-index: 4;
    box-shadow: 0 0 0 2px rgba(32, 41, 56, 0.25);
}

.overview-page .status-success { background-color: #4caf50; }
.overview-page .status-failed { background-color: #ef4444; }
.overview-page .status-long_run { background-color: #f59e0b; }
.overview-page .status-running { background-color: #2563eb; }
.overview-page .status-skipped { background-color: #8b5cf6; }
.overview-page .status-upcoming { background-color: #93c5fd; }
.overview-page .status-disabled { background-color: #64748b; }
.overview-page .status-history_unavailable { background-color: #d1d5db; }
.overview-page .status-no_record {
    border: 1px solid #aab2bd;
    background: repeating-linear-gradient(135deg, #f6f7f9 0, #f6f7f9 3px, #cfd5dd 3px, #cfd5dd 5px);
}

.overview-occurrence.status-running {
    animation: overview-running-pulse 1.8s ease-in-out infinite;
}

@keyframes overview-running-pulse {
    50% { opacity: 0.55; }
}

/* Tabulator integration */
.overview-table-view {
    padding: 0;
}

.overview-table-view .tabulator {
    border: 0;
    background: #fff;
    font-family: inherit;
    font-size: 0.73rem;
}

.overview-table-view .tabulator-header {
    border-bottom: 1px solid #dfe4ea;
    background: #fbfcfd;
}

.overview-table-view .tabulator-col,
.overview-table-view .tabulator-col-row-handle {
    background: #fbfcfd;
}

.overview-table-view .tabulator-row {
    min-height: 34px;
    border-bottom-color: #edf0f3;
}

.overview-table-view .tabulator-row:hover {
    background: #f4f8fd;
}

.overview-status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 20px;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    color: #fff;
    font-size: 0.66rem;
    font-weight: 650;
    white-space: nowrap;
}

.overview-status-badge.status-upcoming,
.overview-status-badge.status-history_unavailable,
.overview-status-badge.status-no_record {
    color: #374151;
}

.overview-status-badge.status-no_record {
    border: 1px solid #aab2bd;
}

@media (max-width: 1199.98px) {
    .overview-main-grid {
        grid-template-columns: 1fr;
    }

    .overview-analytics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 991.98px) {
    .overview-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 767.98px) {
    .overview-toolbar {
        grid-template-columns: 1fr;
    }

    .overview-date-controls {
        flex-wrap: wrap;
    }

    .overview-updated {
        grid-column: auto;
        justify-self: start;
    }

    .overview-analytics {
        grid-template-columns: 1fr;
    }

    .overview-panel-header {
        flex-wrap: wrap;
    }

}

@media (max-width: 575.98px) {
    .overview-page {
        padding-top: 0.25rem;
    }

    .overview-toolbar {
        padding: 0.7rem;
    }

    .overview-title h1 {
        font-size: 1.1rem;
    }

    .overview-date-input-wrap {
        order: -1;
        width: calc(100% - 88px);
    }

    .overview-date-input-wrap input {
        width: 100%;
    }

    .overview-kpi-grid {
        grid-template-columns: 1fr;
    }

    .overview-kpi {
        min-height: 76px;
    }

    .overview-chart {
        height: 250px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .overview-occurrence.status-running {
        animation: none;
    }
}
