:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: rgba(30, 41, 59, 0.7);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-primary: #3b82f6;
    --accent-hover: #2563eb;
    --danger: #ef4444;
    --warning: #f59e0b;
    --success: #10b981;
    --border-color: rgba(255, 255, 255, 0.08);
    --sidebar-width: 260px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body.dark-theme {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ═══════════════════════════════════════════
   Sidebar
═══════════════════════════════════════════ */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    padding: 2rem 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 10;
}

.sidebar-header {
    padding: 0 2rem 2rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

.sidebar-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(90deg, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-header p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.4rem;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0 1rem;
}

.nav-link {
    padding: 0.7rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 0.5rem;
    transition: all 0.2s;
    font-weight: 500;
    font-size: 0.9rem;
}

.nav-link:hover,
.nav-link.active {
    background-color: rgba(59, 130, 246, 0.12);
    color: var(--accent-primary);
}

/* ═══════════════════════════════════════════
   Main Content
═══════════════════════════════════════════ */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2rem 3rem;
}

.section-header {
    margin-bottom: 2rem;
}

.section-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
}

.section-header p {
    color: var(--text-secondary);
    margin-top: 0.4rem;
    font-size: 0.9rem;
}

.tab-content {
    display: none;
    animation: fadeIn 0.25s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ═══════════════════════════════════════════
   Cards
═══════════════════════════════════════════ */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    border-radius: 1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transition: border-color 0.2s;
}

.stat-card:hover {
    border-color: rgba(99, 130, 246, 0.3);
}

.stat-card h3 {
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}

.stat-value {
    font-size: 2.25rem;
    font-weight: 700;
    margin-top: 0.5rem;
    color: var(--text-primary);
}

.stat-value--sm {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.panel-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    overflow: hidden;
}

.card-header {
    padding: 1.1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background-color: rgba(255, 255, 255, 0.02);
}

.card-header h2 {
    font-size: 1rem;
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
}

.mt-20 {
    margin-top: 2rem;
}

.mb-10 {
    margin-bottom: 1rem;
}

/* ═══════════════════════════════════════════
   Forms
═══════════════════════════════════════════ */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    margin-bottom: 0.4rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.form-hint {
    display: block;
    margin-top: 0.35rem;
    color: var(--text-secondary);
    font-size: 0.75rem;
    opacity: 0.7;
}

input[type="text"],
input[type="number"],
input[type="file"],
select {
    width: 100%;
    padding: 0.7rem 1rem;
    background-color: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* ═══════════════════════════════════════════
   Radio Group (replaces checkboxes)
═══════════════════════════════════════════ */
.radio-group {
    display: flex;
    gap: 0.75rem;
}

.radio-option {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1.5px solid var(--border-color);
    border-radius: 0.65rem;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: none;
    letter-spacing: normal;
    font-size: inherit;
}

.radio-option input[type="radio"] {
    display: none;
}

.radio-option:hover {
    border-color: rgba(59, 130, 246, 0.4);
}

.radio-option.selected {
    border-color: var(--accent-primary);
    background: rgba(59, 130, 246, 0.1);
}

.radio-option--disabled {
    opacity: 0.45;
    pointer-events: none;
}

.radio-icon {
    font-size: 1.1rem;
}

.radio-option strong {
    display: block;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.radio-option small {
    display: block;
    color: var(--text-secondary);
    font-size: 0.72rem;
    margin-top: 0.1rem;
}

/* ═══════════════════════════════════════════
   Buttons
═══════════════════════════════════════════ */
.btn {
    padding: 0.7rem 1.4rem;
    border: none;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
}

.btn-primary {
    background: var(--accent-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

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

.btn-warning {
    background: var(--warning);
    color: #0f172a;
}

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

.btn-success {
    background: var(--success);
    color: white;
}

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

.btn-info {
    background: #0ea5e9;
    color: white;
}

.btn-info:hover {
    background: #0284c7;
}

.button-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* ═══════════════════════════════════════════
   Tables
═══════════════════════════════════════════ */
.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 0.85rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.85rem;
}

.data-table th {
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.06em;
}

.data-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

/* ═══════════════════════════════════════════
   Badges
═══════════════════════════════════════════ */
.badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 9999px;
    font-size: 0.7rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-active {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

.badge-frozen {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
}

.badge-inactive {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

.badge-arch-64 {
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
}

.badge-arch-32 {
    background: rgba(251, 146, 60, 0.15);
    color: #fdba74;
}

.badge-driver {
    background: rgba(239, 68, 68, 0.12);
    color: #fca5a5;
}

.badge-dll {
    background: rgba(14, 165, 233, 0.12);
    color: #7dd3fc;
}

.action-buttons {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.mono-tag {
    background: rgba(255, 255, 255, 0.06);
    padding: 0.2rem 0.5rem;
    border-radius: 0.35rem;
    font-family: monospace;
    font-size: 0.8rem;
}

.filter-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* ═══════════════════════════════════════════
   Server Log Console
═══════════════════════════════════════════ */
.log-console {
    background: #080d1a;
    font-family: 'Cascadia Code', 'Consolas', 'Fira Code', monospace;
    font-size: 0.78rem;
    height: 420px;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    scroll-behavior: smooth;
}

.log-line {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    line-height: 1.5;
    word-break: break-all;
}

.log-line--info {
    color: #cbd5e1;
}

.log-line--warn {
    color: #fde68a;
    background: rgba(251, 191, 36, 0.04);
}

.log-line--error {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.06);
}

.log-line--debug {
    color: #6b7280;
}

.log-ts {
    white-space: nowrap;
    color: #475569;
    font-size: 0.72rem;
    flex-shrink: 0;
}

.log-level {
    font-weight: 700;
    font-size: 0.68rem;
    text-transform: uppercase;
    flex-shrink: 0;
    letter-spacing: 0.05em;
    min-width: 42px;
}

.log-level--info {
    color: #60a5fa;
}

.log-level--warn {
    color: #fbbf24;
}

.log-level--error {
    color: #f87171;
}

.log-level--debug {
    color: #64748b;
}

.log-msg {
    flex: 1;
}

.log-placeholder {
    color: #475569;
    font-style: italic;
    padding: 0.5rem 0;
}

.log-live-badge {
    display: inline-block;
    background: rgba(16, 185, 129, 0.2);
    color: #34d399;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    margin-left: 0.5rem;
    vertical-align: middle;
    animation: livePulse 2s infinite;
}

@keyframes livePulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* ═══════════════════════════════════════════
   Modal
═══════════════════════════════════════════ */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal {
    background: #1a2744;
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    width: min(900px, 92vw);
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 1.1rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    padding: 0.2rem 0.4rem;
    border-radius: 0.35rem;
    transition: background 0.2s;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

/* ═══════════════════════════════════════════
   Toast
═══════════════════════════════════════════ */
#toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 9999;
}

.toast {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.75rem 1.25rem;
    border-radius: 0.65rem;
    font-size: 0.875rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    transform: translateX(120%);
    transition: transform 0.3s ease;
    max-width: 380px;
}

.toast--show {
    transform: translateX(0);
}

.toast--success {
    border-left: 3px solid var(--success);
}

.toast--error {
    border-left: 3px solid var(--danger);
}

.toast--info {
    border-left: 3px solid var(--accent-primary);
}

/* ═══════════════════════════════════════════
   Responsive
═══════════════════════════════════════════ */
@media (max-width: 900px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .radio-group {
        flex-direction: column;
    }
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 1rem;
    }

    .sidebar-nav {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .main-content {
        margin-left: 0;
        padding: 1.5rem;
    }

    .cards-grid {
        grid-template-columns: 1fr 1fr;
    }
}