/* Reset e Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #111827;
    color: #e5e7eb;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* Navbar */
.navbar {
    background: #1F2937;
    border-bottom: 1px solid #374151;
    padding: 1rem 2rem;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 1rem;
}

.nav-brand {
    font-size: 1.25rem;
    font-weight: bold;
    color: #06b6d4;
}

.nav-menu {
    display: flex;
    gap: 1.5rem;
    justify-self: end;
}

.server-clock {
    font-family: 'Courier New', 'Consolas', monospace;
    font-size: 1.125rem;
    font-weight: 600;
    color: #06b6d4;
    background: #111827;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    border: 1px solid #374151;
    letter-spacing: 0.05em;
    text-align: center;
    min-width: 100px;
    justify-self: center;
}

.nav-link {
    color: #9ca3af;
    text-decoration: none;
    transition: color 0.2s;
}

.nav-link:hover, .nav-link.active {
    color: #06b6d4;
}

/* Cards */
.card {
    background: #1F2937;
    border: 1px solid #374151;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #374151;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #f9fafb;
}

.card-body {
    padding: 1.5rem;
}

/* Summary Grid */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: #06b6d4;
    margin-bottom: 0.5rem;
}

.stat-label {
    color: #9ca3af;
    font-size: 0.875rem;
}

/* Table */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table thead {
    background: #111827;
}

.table th {
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    color: #9ca3af;
    font-size: 0.875rem;
    text-transform: uppercase;
}

.table td {
    padding: 0.75rem;
    border-top: 1px solid #374151;
}

.table tbody tr:hover {
    background: #111827;
}

.table code {
    background: #111827;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    color: #06b6d4;
}

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

.status-dot {
    display: inline-block;
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 50%;
}

.status-dot.status-online {
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
    animation: pulse-online 2s infinite;
}

.status-dot.status-offline {
    background: #ef4444;
    box-shadow: 0 0 6px #ef4444;
}

@keyframes pulse-online {
    0%, 100% { box-shadow: 0 0 8px #10b981; }
    50% { box-shadow: 0 0 12px #10b981, 0 0 20px rgba(16, 185, 129, 0.4); }
}

.status-online {
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
}

.status-offline {
    background: #6b7280;
}

.status-unknown {
    background: #f59e0b;
}

.status-standby {
    background: #6366f1;
}

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: #06b6d4;
    color: #111827;
}

.btn-primary:hover {
    background: #0891b2;
}

.btn-secondary {
    background: #374151;
    color: #e5e7eb;
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-warning {
    background: #f59e0b;
    color: white;
}

.btn-warning:hover {
    background: #d97706;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    min-width: 80px;
    text-align: center;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.125rem;
}

.btn-block {
    width: 100%;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #d1d5db;
    font-weight: 500;
}

.form-control, input[type="text"], input[type="email"], input[type="password"], input[type="number"], textarea, select {
    width: 100%;
    padding: 0.625rem;
    background: #111827;
    border: 1px solid #374151;
    border-radius: 0.375rem;
    color: #e5e7eb;
    font-family: inherit;
}

.form-control:focus, input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: #06b6d4;
    box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.1);
}

.form-check {
    margin-bottom: 1rem;
}

.form-check input[type="checkbox"] {
    width: auto;
    margin-right: 0.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.text-muted {
    color: #9ca3af;
    font-size: 0.875rem;
    display: block;
    margin-top: 0.25rem;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid #10b981;
    color: #10b981;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid #ef4444;
    color: #ef4444;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid #f59e0b;
    color: #f59e0b;
}

.alert-info {
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid #06b6d4;
    color: #06b6d4;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #1F2937;
    border: 1px solid #374151;
    border-radius: 0.5rem;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #374151;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.25rem;
    color: #f9fafb;
}

.modal-close {
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 2rem;
    height: 2rem;
}

.modal-close:hover {
    color: #e5e7eb;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid #374151;
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
}

.login-card {
    background: #1F2937;
    border: 1px solid #374151;
    border-radius: 0.5rem;
    padding: 2rem;
}

.login-card h1 {
    color: #06b6d4;
    margin-bottom: 0.5rem;
    text-align: center;
}

.subtitle {
    color: #9ca3af;
    text-align: center;
    margin-bottom: 2rem;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-header h1 {
    color: #f9fafb;
}

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.info-grid div {
    padding: 0.5rem 0;
}

.info-grid strong {
    color: #9ca3af;
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

/* Filter Buttons */
.filter-buttons {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-short {
    display: none;
}

.filter-full {
    display: inline;
}

/* P/L Colors */
.pl-positive {
    color: #10b981;
}

.pl-negative {
    color: #ef4444;
}

/* Code Copy Container */
.code-copy-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 100%;
}

.code-truncate {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 400px;
    display: inline-block;
}

.btn-copy {
    background: #374151;
    border: 1px solid #4b5563;
    color: #9ca3af;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-copy:hover {
    background: #4b5563;
    color: #06b6d4;
}

.btn-copy.copied {
    background: #10b981;
    color: white;
}

/* IBKR KO Status */
.status-ibkr-ko {
    background: #f59e0b;
    animation: ibkr-blink 1s infinite;
}

.status-standby-warning {
    background: #f59e0b;
    animation: ibkr-blink 1s infinite;
}

@keyframes ibkr-blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.3; }
}

.ibkr-tooltip {
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translateY(-30%);
    background: #1F2937;
    border: 2px solid #f59e0b;
    border-radius: 0.375rem;
    padding: 0.5rem;
    margin-right: 0.5rem;
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    font-weight: bold;
    color: #f59e0b;
    white-space: nowrap;
    z-index: 10;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.ibkr-tooltip::after {
    content: '';
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-left-color: #f59e0b;
}

/* System Health Warning Info */
.health-info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: #f59e0b;
    color: #111827;
    border-radius: 50%;
    font-size: 13px;
    font-weight: bold;
    font-style: normal;
    cursor: pointer;
    margin-left: 10px;
    vertical-align: middle;
    transition: all 0.2s;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
}

.health-info-icon:hover {
    background: #d97706;
    transform: scale(1.15);
    box-shadow: 0 0 12px rgba(245, 158, 11, 0.8);
}

.health-warning-popup {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #1F2937;
    border: 2px solid #f59e0b;
    border-radius: 0.5rem;
    padding: 1.5rem;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    z-index: 2000;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.health-warning-popup.active {
    display: block;
}

.health-warning-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1999;
}

.health-warning-overlay.active {
    display: block;
}

.health-warning-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #f59e0b;
}

.health-warning-header h3 {
    color: #f59e0b;
    font-size: 1.25rem;
    margin: 0;
}

.health-warning-close {
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 2rem;
    height: 2rem;
    line-height: 1;
}

.health-warning-close:hover {
    color: #f59e0b;
}

.health-warning-content {
    font-family: 'Courier New', 'Consolas', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    color: #e5e7eb;
    white-space: pre-wrap;
    word-break: break-word;
}

.health-warning-section {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: #111827;
    border-left: 3px solid #f59e0b;
    border-radius: 0.25rem;
}

.health-warning-section:last-child {
    margin-bottom: 0;
}

.health-warning-label {
    color: #f59e0b;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.health-warning-value {
    color: #06b6d4;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0.75rem;
    }
    
    .navbar {
        grid-template-columns: 1fr;
        padding: 0.75rem;
        gap: 0.75rem;
    }
    
    .nav-brand {
        text-align: center;
        font-size: 1.1rem;
    }
    
    .server-clock {
        font-size: 1rem;
        padding: 0.4rem 0.75rem;
        min-width: 90px;
    }
    
    .nav-menu {
        justify-self: center;
        gap: 1rem;
        font-size: 0.9rem;
    }
    
    .summary-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        padding: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .table {
        display: block;
        overflow-x: auto;
        font-size: 0.8rem;
        -webkit-overflow-scrolling: touch;
    }
    
    .table th,
    .table td {
        padding: 0.5rem;
        white-space: nowrap;
    }
    
    .btn {
        padding: 0.6rem 1rem;
        font-size: 0.95rem;
        min-height: 44px;
    }
    
    .btn-sm {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
        min-height: 40px;
    }
    
    .filter-buttons {
        justify-content: center;
        width: 100%;
    }
    
    .filter-buttons .btn {
        flex: 1;
        min-width: 0;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .modal-content {
        width: 95%;
        margin: 1rem;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }
    
    /* User Detail Page */
    .page-header h1 {
        font-size: 1.5rem;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .code-copy-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .code-truncate {
        max-width: 100%;
        word-break: break-all;
        white-space: normal;
    }
    
    .btn-copy {
        width: 100%;
        margin-top: 0.5rem;
    }
    
    /* User page grids */
    [style*="grid-template-columns: repeat(3, 1fr)"] {
        grid-template-columns: 1fr !important;
    }
    
    [style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
    
    /* User page inline tables */
    [style*="max-height: 400px"] table {
        font-size: 0.75rem;
    }
    
    [style*="max-height: 400px"] th,
    [style*="max-height: 400px"] td {
        padding: 0.35rem !important;
    }
    
    /* Slider coefficiente - aumenta altezza e spazio */
    [style*="flex: 0.6"] {
        flex: 1 !important;
        min-height: 140px;
    }
    
    /* Slider input range su mobile */
    input[type="range"] {
        height: 40px !important;
        -webkit-appearance: none;
        appearance: none;
        background: transparent;
    }
    
    input[type="range"]::-webkit-slider-thumb {
        -webkit-appearance: none;
        appearance: none;
        width: 24px;
        height: 24px;
        background: #06b6d4;
        cursor: pointer;
        border-radius: 50%;
    }
    
    input[type="range"]::-moz-range-thumb {
        width: 24px;
        height: 24px;
        background: #06b6d4;
        cursor: pointer;
        border-radius: 50%;
        border: none;
    }
    
    input[type="range"]::-webkit-slider-runnable-track {
        width: 100%;
        height: 8px;
        background: #374151;
        border-radius: 4px;
    }
    
    input[type="range"]::-moz-range-track {
        width: 100%;
        height: 8px;
        background: #374151;
        border-radius: 4px;
    }
    
    /* Abbrevia testi filtri */
    .filter-full {
        display: none;
    }
    
    .filter-short {
        display: inline;
    }
    
    /* Azioni - bottoni full width e stack */
    .card:last-child .card-body {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .card:last-child .card-body form,
    .card:last-child .card-body button {
        width: 100%;
        margin: 0;
    }
    
    .card:last-child .card-body form button {
        width: 100%;
    }
}


/* ==================== RESTART PROGRESS BAR ==================== */

/* Confirm Dialog */
.restart-confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0);
    z-index: 2000;
    transition: background 0.2s ease;
}

.restart-confirm-overlay.active {
    background: rgba(0, 0, 0, 0.7);
}

.restart-confirm-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: #1F2937;
    border: 1px solid #374151;
    border-radius: 0.75rem;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
    z-index: 2001;
    text-align: center;
    opacity: 0;
    transition: all 0.2s ease;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.restart-confirm-dialog.active {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.restart-confirm-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 1.25rem;
    background: rgba(239, 68, 68, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.restart-confirm-icon svg {
    width: 32px;
    height: 32px;
    color: #ef4444;
}

.restart-confirm-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #f9fafb;
    margin: 0 0 0.75rem;
}

.restart-confirm-message {
    color: #d1d5db;
    margin: 0 0 0.5rem;
    font-size: 0.95rem;
}

.restart-confirm-message strong {
    color: #06b6d4;
}

.restart-confirm-warning {
    color: #f59e0b;
    font-size: 0.85rem;
    margin: 0 0 1.5rem;
    padding: 0.5rem;
    background: rgba(245, 158, 11, 0.1);
    border-radius: 0.375rem;
}

.restart-confirm-buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.restart-confirm-buttons .btn {
    min-width: 100px;
    padding: 0.625rem 1.25rem;
}

.restart-confirm-ok {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ==================== BULK SELECTION ==================== */

.header-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.select-column {
    width: 40px;
    text-align: center;
}

.select-column input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #06b6d4;
}

tr.selected {
    background: rgba(6, 182, 212, 0.1) !important;
}

tr.selected td {
    border-color: rgba(6, 182, 212, 0.3);
}

#btn-select-mode {
    display: inline-flex;
    align-items: center;
}

#btn-select-mode.active {
    background: #06b6d4;
    color: #111827;
}

/* Bulk Actions Popover */
.bulk-actions-popover {
    position: fixed;
    display: none;
    z-index: 1500;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.bulk-actions-popover.visible {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.bulk-actions-arrow {
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid #1F2937;
}

.bulk-actions-content {
    background: #1F2937;
    border: 1px solid #374151;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.bulk-actions-count {
    color: #9ca3af;
    font-size: 0.875rem;
    white-space: nowrap;
}

.bulk-actions-count span {
    color: #06b6d4;
    font-weight: 600;
}

.bulk-actions-buttons {
    display: flex;
    gap: 0.5rem;
}

.bulk-actions-buttons .btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    white-space: nowrap;
}

/* Actions cell layout */
.actions-cell {
    white-space: nowrap;
}

.actions-buttons {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.restart-status-container {
    display: inline-block;
    margin-left: 0.5rem;
    vertical-align: middle;
}

.restart-status-container:empty {
    display: none;
}

.restart-progress-container {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 150px;
    background: #111827;
    border-radius: 0.375rem;
    padding: 0.5rem;
    position: relative;
    overflow: hidden;
}

.restart-progress-bar {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: linear-gradient(90deg, #06b6d4, #0891b2);
    border-radius: 0.375rem;
    transition: width 0.1s linear;
    z-index: 1;
}

.restart-progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    animation: restart-shimmer 1.5s infinite;
}

@keyframes restart-shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.restart-progress-bar.restart-progress-failed {
    background: linear-gradient(90deg, #ef4444, #dc2626);
}

.restart-progress-text {
    position: relative;
    z-index: 2;
    font-size: 0.75rem;
    font-weight: 600;
    color: #e5e7eb;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    margin-left: auto;
    padding-right: 0.25rem;
}

/* Success State */
.restart-success {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid #10b981;
    border-radius: 0.375rem;
    color: #10b981;
    font-size: 0.875rem;
    font-weight: 500;
    animation: restart-fade-in 0.3s ease-out;
}

.restart-success-icon {
    font-size: 1rem;
    font-weight: bold;
}

/* Failed State */
.restart-failed {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid #ef4444;
    border-radius: 0.375rem;
    color: #ef4444;
    font-size: 0.875rem;
    font-weight: 500;
    animation: restart-fade-in 0.3s ease-out;
}

.restart-failed-icon {
    font-size: 1rem;
    font-weight: bold;
}

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

/* Restart Button */
.btn-restart {
    background: #374151;
    color: #e5e7eb;
    border: 1px solid #4b5563;
    padding: 0.375rem 0.5rem;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-restart:hover {
    background: #4b5563;
    border-color: #06b6d4;
    color: #06b6d4;
}

.btn-restart:disabled,
.btn-restart.btn-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-restart svg {
    width: 16px;
    height: 16px;
}

/* Responsive */
@media (max-width: 768px) {
    .restart-progress-container {
        min-width: 120px;
        padding: 0.4rem;
    }
    
    .restart-success,
    .restart-failed {
        font-size: 0.75rem;
        padding: 0.4rem 0.5rem;
    }
}


/* ==================== MASTERBOT ROW ==================== */

tr.masterbot-row {
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.1) 0%, rgba(251, 191, 36, 0.05) 100%) !important;
    border: 2px solid #f59e0b !important;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.2);
}

tr.masterbot-row td {
    border-top: none !important;
    border-bottom: none !important;
}

tr.masterbot-row td:first-child {
    border-left: 3px solid #f59e0b;
}

tr.masterbot-row:hover {
    background: linear-gradient(90deg, rgba(245, 158, 11, 0.15) 0%, rgba(251, 191, 36, 0.08) 100%) !important;
}

/* ==================== MASTERBOT TOGGLE ==================== */

.masterbot-toggle {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 0.75rem;
    background: #374151;
    border: 2px solid #4b5563;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 70px;
}

.masterbot-toggle:hover {
    background: #4b5563;
    border-color: #6b7280;
    transform: scale(1.05);
}

.masterbot-toggle.active {
    background: linear-gradient(135deg, #b45309 0%, #d97706 50%, #f59e0b 100%);
    border-color: #fbbf24;
    box-shadow: 0 0 15px rgba(251, 191, 36, 0.4);
}

.masterbot-toggle.active:hover {
    background: linear-gradient(135deg, #d97706 0%, #f59e0b 50%, #fbbf24 100%);
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.6);
}

.masterbot-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.masterbot-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.masterbot-toggle.active .masterbot-label {
    color: #111827;
}

/* ==================== MASTERBOT GOLD CARD ==================== */

.card-masterbot {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #1a1a2e 100%);
    border: 2px solid #f59e0b;
    border-radius: 0.75rem;
    margin-bottom: 1.5rem;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.2);
    position: relative;
}

.card-masterbot::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #f59e0b, #fbbf24, #f59e0b);
}

.card-masterbot .card-header {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(251, 191, 36, 0.1) 100%);
    border-bottom: 1px solid rgba(245, 158, 11, 0.3);
    padding: 0.75rem 1rem;
}

.card-masterbot .card-header h3 {
    color: #fbbf24;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
}

.card-masterbot .card-body {
    padding: 1rem;
}

.masterbot-crown {
    font-size: 1.25rem;
}

.masterbot-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
}

.masterbot-name {
    font-weight: 600;
    color: #fbbf24;
    font-size: 1.1rem;
}

.masterbot-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.masterbot-status .status-dot {
    width: 10px;
    height: 10px;
}

.masterbot-link {
    color: #9ca3af;
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s;
}

.masterbot-link:hover {
    color: #fbbf24;
}
