:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    --bg-hover: #263247;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --accent-blue: #3b82f6;
    --accent-green: #22c55e;
    --accent-red: #ef4444;
    --accent-yellow: #eab308;
    --accent-orange: #f97316;
    --accent-cyan: #06b6d4;
    --border-color: #334155;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: var(--bg-secondary);
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #38bdf8, #22d3ee, #34d399);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.source {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-left: 12px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(34, 197, 94, 0.1);
    border-radius: 20px;
    border: 1px solid var(--accent-green);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.connection-status.disconnected {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--accent-red);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-green);
    animation: pulse 2s ease-in-out infinite;
    box-shadow: 0 0 6px var(--accent-green);
}

.disconnected .status-dot {
    background: var(--accent-red);
    box-shadow: 0 0 6px var(--accent-red);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: 0.5;
        transform: scale(1.2);
    }
}

.status-text {
    font-size: 0.85rem;
    font-weight: 500;
}

.last-update {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Alerts Panel */
.alerts-panel {
    background: var(--bg-secondary);
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    display: none;
}

.alerts-panel.has-alerts {
    display: block;
    border-color: var(--accent-red);
    animation: alertGlow 2s infinite;
}

@keyframes alertGlow {

    0%,
    100% {
        box-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
    }

    50% {
        box-shadow: 0 0 20px rgba(239, 68, 68, 0.5);
    }
}

.alerts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: rgba(239, 68, 68, 0.1);
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
}

.alert-count {
    background: var(--accent-red);
    color: white;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.85rem;
}

.alerts-list {
    max-height: 200px;
    overflow-y: auto;
}

.alert-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
    gap: 12px;
}

.alert-item:last-child {
    border-bottom: none;
}

.alert-item.critical {
    background: rgba(239, 68, 68, 0.1);
}

.alert-item.warning {
    background: rgba(234, 179, 8, 0.1);
}

.alert-message {
    flex: 1;
    font-size: 0.9rem;
}

.alert-time {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 500;
    animation: toastIn 0.3s ease;
    box-shadow: var(--shadow-lg);
    max-width: 360px;
}

.toast.success {
    background: rgba(34, 197, 94, 0.95);
    color: #052e16;
}

.toast.error {
    background: rgba(239, 68, 68, 0.95);
    color: #fff;
}

.toast.info {
    background: rgba(59, 130, 246, 0.95);
    color: #fff;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(100px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(100px);
    }
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    gap: 12px;
    border: 1px solid var(--border-color);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.stat-card.warning {
    border-color: var(--accent-yellow);
    background: linear-gradient(135deg, var(--bg-card), rgba(234, 179, 8, 0.1));
}

.stat-card.critical {
    border-color: var(--accent-red);
    background: linear-gradient(135deg, var(--bg-card), rgba(239, 68, 68, 0.1));
    animation: alertGlow 2s infinite;
}

.stat-icon {
    font-size: 1.5rem;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 10px;
}

.stat-info {
    flex: 1;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 2px;
}

.stat-value {
    font-size: 1.3rem;
    font-weight: 700;
    transition: color 0.3s ease;
}

.stat-value.running-value {
    color: var(--accent-green);
}

.stat-value.stopped-value {
    color: var(--accent-red);
}

.stat-divider {
    color: var(--text-secondary);
    margin: 0 4px;
}

.stat-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.stat-progress {
    height: 5px;
    background: var(--border-color);
    border-radius: 3px;
    margin-top: 8px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-green));
    border-radius: 3px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    width: 0%;
    will-change: width;
}

.remaining-progress {
    background: linear-gradient(90deg, var(--accent-orange), var(--accent-yellow));
}

/* Tab Bar */
.tab-bar {
    display: flex;
    gap: 4px;
    background: var(--bg-secondary);
    padding: 6px;
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.tab {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.tab:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.tab.active {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.15), rgba(52, 211, 153, 0.15));
    color: var(--text-primary);
    box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.3);
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.section-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-cyan));
    color: white;
}

.btn-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.btn-success {
    background: rgba(34, 197, 94, 0.2);
    color: var(--accent-green);
    border: 1px solid var(--accent-green);
}

.btn-success:hover {
    background: rgba(34, 197, 94, 0.35);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.2);
    color: var(--accent-red);
    border: 1px solid var(--accent-red);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.35);
}

.btn-warning {
    background: rgba(234, 179, 8, 0.2);
    color: var(--accent-yellow);
    border: 1px solid var(--accent-yellow);
}

.btn-warning:hover {
    background: rgba(234, 179, 8, 0.35);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-sm {
    padding: 4px 10px;
    font-size: 0.75rem;
}

.btn-icon {
    padding: 6px;
    min-width: 32px;
    justify-content: center;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-group {
    display: flex;
    gap: 6px;
}

/* Servers Grid → Server Cards with Controls */
.servers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.server-card {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.server-card.active {
    border-color: var(--accent-green);
}

.server-card.disconnect {
    border-color: var(--accent-red);
    background: rgba(239, 68, 68, 0.05);
    animation: alertGlow 2s infinite;
}

.server-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.server-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.server-status {
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.server-status.active {
    background: rgba(34, 197, 94, 0.2);
    color: var(--accent-green);
}

.server-status.disconnect {
    background: rgba(239, 68, 68, 0.2);
    color: var(--accent-red);
}

.server-load {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.server-load-text {
    font-size: 1rem;
    font-weight: 600;
}

.server-load-bar {
    flex: 1;
    height: 5px;
    background: var(--border-color);
    border-radius: 3px;
    overflow: hidden;
}

.server-load-fill {
    height: 100%;
    background: var(--accent-green);
    border-radius: 3px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: width;
}

.server-card.disconnect .server-load-fill {
    background: var(--accent-red);
}

.server-actions {
    display: flex;
    gap: 6px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
}

.server-actions .btn {
    flex: 1;
    justify-content: center;
}

.server-loading,
.loading-cell {
    text-align: center;
    color: var(--text-secondary);
    padding: 30px;
    grid-column: 1 / -1;
}

/* Devices Table */
.devices-table-wrapper {
    overflow-x: auto;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 4px;
}

.devices-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.devices-table th,
.devices-table td {
    padding: 12px 10px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.devices-table th {
    background: var(--bg-primary);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.devices-table tbody tr {
    transition: background-color 0.2s ease;
}

.devices-table tbody tr:hover {
    background: rgba(59, 130, 246, 0.08);
}

.device-status {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.device-status.running {
    background: rgba(34, 197, 94, 0.2);
    color: var(--accent-green);
}

.device-status.stopped {
    background: rgba(239, 68, 68, 0.2);
    color: var(--accent-red);
}

.failure-rate {
    font-weight: 600;
}

.failure-rate.high {
    color: var(--accent-red);
}

.failure-rate.medium {
    color: var(--accent-yellow);
}

.failure-rate.low {
    color: var(--accent-green);
}

/* Schedule List */
.schedules-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.schedule-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.2s;
}

.schedule-card:hover {
    border-color: var(--accent-cyan);
}

.schedule-card.disabled {
    opacity: 0.5;
}

.schedule-time {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-cyan);
    min-width: 80px;
    text-align: center;
}

.schedule-info {
    flex: 1;
}

.schedule-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.schedule-detail {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.schedule-days {
    display: flex;
    gap: 3px;
    margin-top: 6px;
}

.schedule-day {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    font-size: 0.65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

.schedule-day.active {
    background: rgba(6, 182, 212, 0.2);
    color: var(--accent-cyan);
}

.schedule-actions {
    display: flex;
    gap: 6px;
}

/* History List */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-primary);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    font-size: 0.85rem;
}

.history-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.history-icon.sent {
    background: rgba(59, 130, 246, 0.15);
}

.history-icon.success {
    background: rgba(34, 197, 94, 0.15);
}

.history-icon.failed {
    background: rgba(239, 68, 68, 0.15);
}

.history-icon.scheduler {
    background: rgba(6, 182, 212, 0.15);
}

.history-info {
    flex: 1;
}

.history-action {
    font-weight: 600;
}

.history-target {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.history-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.history-status {
    padding: 3px 8px;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.history-status.sent {
    background: rgba(59, 130, 246, 0.2);
    color: var(--accent-blue);
}

.history-status.success {
    background: rgba(34, 197, 94, 0.2);
    color: var(--accent-green);
}

.history-status.failed {
    background: rgba(239, 68, 68, 0.2);
    color: var(--accent-red);
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    padding: 40px 20px;
    font-size: 0.9rem;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 9000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    width: 100%;
    max-width: 480px;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.25s ease;
}

.modal-small {
    max-width: 380px;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 1rem;
    font-weight: 700;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--accent-cyan);
}

.form-group select option {
    background: var(--bg-secondary);
}

.days-picker {
    display: flex;
    gap: 6px;
}

.day-btn {
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: inherit;
    transition: all 0.2s;
}

.day-btn.active {
    background: rgba(6, 182, 212, 0.2);
    border-color: var(--accent-cyan);
    color: var(--accent-cyan);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stat-card,
.server-card {
    animation: fadeIn 0.3s ease;
}

@keyframes valueFlash {
    0% {
        text-shadow: 0 0 0 transparent;
    }

    30% {
        text-shadow: 0 0 8px rgba(56, 189, 248, 0.6);
    }

    100% {
        text-shadow: 0 0 0 transparent;
    }
}

.value-changed {
    animation: valueFlash 0.6s ease-out;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.btn.loading::after {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-left: 4px;
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }

    .header-right {
        flex-direction: column;
        gap: 10px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .servers-grid {
        grid-template-columns: 1fr;
    }

    .tab-bar {
        flex-wrap: wrap;
    }

    .tab {
        font-size: 0.8rem;
        padding: 8px 12px;
    }

    .devices-table {
        font-size: 0.75rem;
    }

    .devices-table th,
    .devices-table td {
        padding: 8px 6px;
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }
}

/* Devices toolbar */
.devices-toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    align-items: center;
}

/* Smooth transitions for realtime updates */
.devices-table td {
    transition: color 0.3s ease;
}

.device-status {
    transition: background 0.3s ease, color 0.3s ease;
}

/* Kill button */
.btn-kill {
    opacity: 1;
    font-size: 0.85rem !important;
    padding: 3px 6px !important;
    min-width: unset !important;
    transition: color 0.2s, background 0.2s;
}

.btn-kill:hover {
    color: #fff !important;
    background: #e53e3e !important;
}

/* Pagination */
.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 4px;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 0.85rem;
}

.pagination-bar:empty {
    display: none;
}

.pagination-info {
    color: var(--text-muted);
}

.pagination-buttons {
    display: flex;
    gap: 4px;
    align-items: center;
}

.pagination-buttons button {
    background: var(--card-bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.pagination-buttons button:hover:not(:disabled) {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.pagination-buttons button:disabled {
    opacity: 0.4;
    cursor: default;
}

.pagination-buttons button.pg-active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* V2 Additions */
.version {
    font-size: 0.7rem;
    background: rgba(6, 182, 212, 0.2);
    color: var(--accent-cyan);
    padding: 2px 8px;
    border-radius: 6px;
    margin-left: 8px;
    font-weight: 700;
    vertical-align: middle;
    -webkit-text-fill-color: var(--accent-cyan);
}

.server-card.online {
    border-color: var(--accent-green);
}

.server-card.offline {
    border-color: var(--accent-red);
    background: rgba(239, 68, 68, 0.05);
    opacity: 0.7;
}

.server-status.online {
    background: rgba(34, 197, 94, 0.2);
    color: var(--accent-green);
}

.server-status.offline {
    background: rgba(239, 68, 68, 0.2);
    color: var(--accent-red);
}

/* Charts */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.chart-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    min-height: 320px;
}

.chart-card h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.chart-card canvas {
    max-height: 280px;
}

.chart-controls {
    display: flex;
    gap: 8px;
}

.chart-controls select {
    padding: 6px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
    cursor: pointer;
}

.chart-controls select:focus {
    border-color: var(--accent-cyan);
}

.chart-controls select option {
    background: var(--bg-secondary);
}

/* 3-column charts grid */
.charts-3col {
    grid-template-columns: 1fr 1fr 300px;
}

.chart-small {
    min-height: 260px;
}

/* Summary section */
.summary-section {
    margin-top: 24px;
}

.summary-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.summary-row {
    background: rgba(6, 182, 212, 0.06) !important;
    border-top: 2px solid var(--accent-cyan) !important;
}

.summary-row td {
    border-bottom: none !important;
}

.text-green {
    color: var(--accent-green);
}

.text-red {
    color: var(--accent-red);
}

.text-cyan {
    color: var(--accent-cyan);
}

@media (max-width: 1200px) {
    .charts-3col {
        grid-template-columns: 1fr 1fr;
    }

    .chart-small {
        grid-column: 1 / -1;
        max-height: 250px;
        min-height: 200px;
    }
}

@media (max-width: 768px) {
    .charts-3col {
        grid-template-columns: 1fr;
    }
}

/* ==================== ACCOUNTS ==================== */
.accounts-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.chart-controls-select {
    padding: 6px 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
    cursor: pointer;
}

.chart-controls-select:focus {
    border-color: var(--accent-cyan);
}

.chart-controls-select option {
    background: var(--bg-secondary);
}

.accounts-summary {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.acc-badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.acc-live {
    background: rgba(34, 197, 94, 0.12);
    color: #22c55e;
}

.acc-banned {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
}

.acc-ban24h {
    background: rgba(234, 179, 8, 0.12);
    color: #eab308;
}

.acc-total {
    background: rgba(6, 182, 212, 0.12);
    color: #06b6d4;
}

.acc-index {
    text-align: center;
    width: 60px;
}

.acc-index-badge {
    display: inline-block;
    padding: 2px 10px;
    background: rgba(6, 182, 212, 0.12);
    color: var(--accent-cyan);
    border-radius: 12px;
    font-size: 0.78rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    min-width: 28px;
    text-align: center;
}

.acc-status-select {
    padding: 4px 8px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.8rem;
    font-family: inherit;
    outline: none;
    cursor: pointer;
    min-width: 120px;
}

.acc-status-select.status-live {
    border-color: rgba(34, 197, 94, 0.5);
    color: #22c55e;
}

.acc-status-select.status-banned {
    border-color: rgba(239, 68, 68, 0.5);
    color: #ef4444;
}

.acc-status-select.status-ban24h {
    border-color: rgba(234, 179, 8, 0.5);
    color: #eab308;
}

.acc-status-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.acc-notes {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* Bulk add */
.form-row {
    display: flex;
    gap: 12px;
}

.form-half {
    flex: 1;
}

.bulk-preview {
    padding: 10px 14px;
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.2);
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--accent-green);
    margin-bottom: 16px;
}

.bulk-preview-error {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.2);
    color: var(--accent-red);
}

.btn-success {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
    border: none;
}

/* Accounts stats */
.accounts-stats-row {
    display: grid;
    grid-template-columns: 200px 1fr 240px;
    gap: 16px;
    margin-bottom: 16px;
    align-items: start;
}

.acc-chart-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    height: 200px;
}

.acc-stats-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.acc-stat-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 6px;
    text-align: center;
    border-top: 3px solid var(--accent-cyan);
}

.acc-stat-number {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.acc-stat-label {
    font-size: 0.65rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.acc-stat-green {
    border-top-color: #22c55e;
}

.acc-stat-green .acc-stat-number {
    color: #22c55e;
}

.acc-stat-red {
    border-top-color: #ef4444;
}

.acc-stat-red .acc-stat-number {
    color: #ef4444;
}

.acc-stat-yellow {
    border-top-color: #eab308;
}

.acc-stat-yellow .acc-stat-number {
    color: #eab308;
}

.acc-stat-cyan {
    border-top-color: #06b6d4;
}

.acc-stat-cyan .acc-stat-number {
    color: #06b6d4;
}

.acc-stat-purple {
    border-top-color: #a855f7;
}

.acc-stat-purple .acc-stat-number {
    color: #a855f7;
}

.acc-chart-monthly {
    min-height: 180px;
}

.acc-actions {
    display: flex;
    gap: 4px;
    justify-content: center;
}

@media (max-width: 768px) {
    .accounts-stats-row {
        grid-template-columns: 1fr;
    }

    .acc-stats-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ==================== SERVERS TAB ==================== */
.srv-summary {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.servers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.srv-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 18px;
    border-left: 4px solid var(--border-color);
    transition: transform 0.2s, box-shadow 0.2s;
}

.srv-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.srv-card-online {
    border-left-color: #22c55e;
}

.srv-card-offline {
    border-left-color: #ef4444;
    opacity: 0.7;
}

.srv-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.srv-status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.srv-dot-online {
    background: #22c55e;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
    animation: srvPulse 2s infinite;
}

.srv-dot-offline {
    background: #ef4444;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.3);
}

@keyframes srvPulse {

    0%,
    100% {
        box-shadow: 0 0 4px rgba(34, 197, 94, 0.3);
    }

    50% {
        box-shadow: 0 0 12px rgba(34, 197, 94, 0.7);
    }
}

.srv-card-title {
    flex: 1;
    min-width: 0;
}

.srv-card-name {
    display: block;
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.srv-card-id {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.srv-status-badge {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    flex-shrink: 0;
}

.srv-badge-online {
    background: rgba(34, 197, 94, 0.12);
    color: #22c55e;
}

.srv-badge-offline {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
}

.srv-card-info {
    display: flex;
    gap: 16px;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.srv-info-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.srv-info-label {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.srv-info-value {
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
}

.srv-device-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 14px;
}

.srv-device-stat {
    text-align: center;
    padding: 8px 4px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
}

.srv-ds-num {
    display: block;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
}

.srv-ds-label {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.srv-ds-running .srv-ds-num {
    color: #22c55e;
}

.srv-ds-stopped .srv-ds-num {
    color: #ef4444;
}

.srv-ds-total .srv-ds-num {
    color: #06b6d4;
}

.srv-load-section {
    margin-bottom: 14px;
}

.srv-load-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.srv-load-pct {
    font-weight: 600;
    color: var(--accent-cyan);
}

.srv-load-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    overflow: hidden;
}

.srv-load-fill {
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, #22c55e, #06b6d4);
    transition: width 0.5s ease;
}

.srv-card-actions {
    display: flex;
    gap: 8px;
}

.srv-card-actions .btn {
    flex: 1;
}

/* Empty state */
.srv-empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.srv-empty-icon {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: 0.4;
}

.srv-empty-text {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.srv-empty-hint {
    font-size: 0.8rem;
}

@media (max-width: 768px) {
    .servers-grid {
        grid-template-columns: 1fr;
    }
}

/* ==================== DEVICES DETAIL ==================== */
.dev-layout {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 16px;
}

.dev-table-side {
    min-width: 0;
    overflow: auto;
}

.dev-detail-panel {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    display: none;
    flex-direction: column;
    max-height: 80vh;
    overflow-y: auto;
}

.dev-detail-panel.active {
    display: flex;
}

.dev-detail-empty {
    text-align: center;
    padding: 40px 16px;
    color: var(--text-muted);
}

.dev-detail-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.dev-detail-header h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--text-primary);
    flex: 1;
}

.dev-detail-header .modal-close {
    margin-left: auto;
}

.dev-detail-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 14px;
}

.dev-stat-item {
    text-align: center;
    padding: 8px 4px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
}

.dev-stat-num {
    display: block;
    font-size: 1.3rem;
    font-weight: 700;
}

.dev-stat-lbl {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.dev-stat-blue {
    color: #06b6d4;
}

.dev-stat-green {
    color: #22c55e;
}

.dev-stat-red {
    color: #ef4444;
}

.dev-detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}

.dev-detail-actions .btn {
    font-size: 0.72rem;
    padding: 5px 10px;
}

.btn-warning {
    background: linear-gradient(135deg, #eab308, #ca8a04);
    color: #000;
    border: none;
}

.dev-phone-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 200px;
}

.dev-phone-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.dev-phone-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.dev-phone-textarea {
    flex: 1;
    min-height: 250px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    line-height: 1.5;
    padding: 10px;
    resize: vertical;
}

.dev-phone-textarea:focus {
    outline: none;
    border-color: var(--accent-cyan);
}

.dev-row-selected {
    background: rgba(6, 182, 212, 0.08) !important;
    border-left: 3px solid var(--accent-cyan);
}

.dev-row-selected td:first-child {
    padding-left: 9px;
}

.dev-action-btns {
    display: flex;
    gap: 4px;
    justify-content: center;
}

#devicesTable tbody tr {
    cursor: pointer;
}

#devicesTable tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

@media (max-width: 1024px) {
    .dev-layout {
        grid-template-columns: 1fr;
    }

    .dev-detail-panel.active {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: 380px;
        z-index: 100;
        border-radius: 12px 0 0 12px;
        box-shadow: -4px 0 24px rgba(0, 0, 0, 0.5);
    }
}

/* ==================== SCHEDULE ENHANCED ==================== */
.sched-slider {
    width: 100%;
    accent-color: #06b6d4;
    cursor: pointer;
}

.sched-devices-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px;
    background: var(--bg-secondary);
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
}

.sched-dev-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.sched-dev-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.sched-dev-item input[type="checkbox"] {
    accent-color: #06b6d4;
    width: 14px;
    height: 14px;
}

.sched-dev-empty {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 0.8rem;
    grid-column: 1 / -1;
}

#schedConcurrencyVal {
    font-weight: 700;
    color: #06b6d4;
}

/* Language Switcher */
.lang-btn {
    font-size: 0.85rem;
    padding: 4px 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(6, 182, 212, 0.5);
}