/**
 * Taleclip Admin Dashboard Styles
 */

/* Reset — admin page is standalone (no style.css dependency) */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }

:root {
    --tc-glass-bg:          rgba(255, 255, 255, 0.06);
    --tc-glass-bg-hover:    rgba(255, 255, 255, 0.10);
    --tc-glass-bg-active:   rgba(255, 255, 255, 0.14);
    --tc-glass-bg-input:    rgba(255, 255, 255, 0.05);
    --tc-glass-bg-sidebar:  rgba(255, 255, 255, 0.04);
    --tc-glass-bg-topbar:   rgba(255, 255, 255, 0.05);
    --tc-glass-blur:        16px;
    --tc-glass-blur-heavy:  24px;
    --tc-glass-blur-light:  8px;
    --tc-glass-border:      1px solid rgba(148, 163, 184, 0.08);
    --tc-glass-border-hover:1px solid rgba(148, 163, 184, 0.15);
    --tc-glass-border-focus:1px solid rgba(59, 130, 246, 0.4);
    --tc-glass-border-subtle:1px solid rgba(255, 255, 255, 0.04);
    --tc-radius-sm:   6px;
    --tc-radius-md:   10px;
    --tc-radius-lg:   18px;
    --tc-radius-xl:   24px;
    --tc-radius-pill:  9999px;
    --tc-shadow-sm:   0 2px 8px rgba(0, 0, 0, 0.15);
    --tc-shadow-md:   0 4px 16px rgba(0, 0, 0, 0.2);
    --tc-shadow-lg:   0 8px 32px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
}

/* Body */
.admin-body {
    background: #0a0f1e;
    background-image: linear-gradient(160deg, #0c1425 0%, #0e1a30 40%, #0b1222 100%);
    background-attachment: fixed;
    color: #e2e8f0;
    min-height: 100vh;
}

/* Header */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: var(--tc-glass-bg-topbar);
    backdrop-filter: blur(var(--tc-glass-blur-heavy)) saturate(140%);
    -webkit-backdrop-filter: blur(var(--tc-glass-blur-heavy)) saturate(140%);
    border-bottom: var(--tc-glass-border);
}

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

.admin-header-left h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #f1f5f9;
    margin: 0;
}

.admin-badge {
    background: linear-gradient(135deg, #3B82F6, #8B5CF6);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.admin-header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Theme toggle button */
.theme-toggle-btn {
    background: none;
    border: 1px solid rgba(148,163,184,0.3);
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: #94a3b8;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
    padding: 0;
}
.theme-toggle-btn:hover {
    color: #f1f5f9;
    background: rgba(255,255,255,0.08);
}
.theme-icon { display: none; }
[data-theme="dark"] .theme-icon-moon { display: block; }
[data-theme="light"] .theme-icon-sun { display: block; }
html:not([data-theme]) .theme-icon-moon { display: block; }
[data-theme="light"] .theme-toggle-btn { color: #64748b; }
[data-theme="light"] .theme-toggle-btn:hover { color: #1e293b; background: rgba(0,0,0,0.06); }

#adminEmail {
    color: #94a3b8;
}

/* Access Denied */
.admin-access-denied {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
}

.access-denied-content {
    text-align: center;
    padding: 3rem;
    background: var(--tc-glass-bg);
    backdrop-filter: blur(var(--tc-glass-blur)) saturate(140%);
    -webkit-backdrop-filter: blur(var(--tc-glass-blur)) saturate(140%);
    border-radius: var(--tc-radius-lg);
    border: var(--tc-glass-border);
}

.access-denied-content h2 {
    color: #ef4444;
    margin-bottom: 1rem;
}

/* Main Content */
.admin-main {
    padding: 2rem;
    max-width: 1600px;
    margin: 0 auto;
}

/* Stats Cards */
.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(139, 92, 246, 0.06));
    backdrop-filter: blur(var(--tc-glass-blur)) saturate(140%);
    -webkit-backdrop-filter: blur(var(--tc-glass-blur)) saturate(140%);
    border: var(--tc-glass-border);
    border-radius: var(--tc-radius-lg);
    padding: 1.5rem;
    text-align: center;
    will-change: transform;
    transition: transform 0.15s ease-out, box-shadow 0.15s ease-out;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

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

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #3B82F6;
}

.stat-label {
    color: #94a3b8;
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* Tabs */
.admin-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: var(--tc-glass-border);
    padding-bottom: 0.5rem;
}

.admin-tab-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    cursor: pointer;
    border-radius: var(--tc-radius-sm) var(--tc-radius-sm) 0 0;
    transition: all 0.2s;
}

.admin-tab-btn:hover {
    color: #e2e8f0;
    background: rgba(59, 130, 246, 0.1);
}

.admin-tab-btn.active {
    color: #3B82F6;
    background: rgba(59, 130, 246, 0.2);
    font-weight: 600;
}

.admin-tab-content {
    display: none;
    content-visibility: hidden;
}

.admin-tab-content.active {
    display: block;
    content-visibility: visible;
}

/* Toolbar */
.admin-toolbar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.admin-search {
    flex: 1;
    min-width: 200px;
    padding: 0.75rem 1rem;
    background: var(--tc-glass-bg-input);
    border: var(--tc-glass-border);
    border-radius: var(--tc-radius-sm);
    color: #e2e8f0;
    font-size: 1rem;
}

.admin-search:focus {
    outline: none;
    border: var(--tc-glass-border-focus);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.4), 0 0 16px rgba(59, 130, 246, 0.15);
}

.admin-select {
    padding: 0.75rem 1rem;
    background: var(--tc-glass-bg-input);
    border: var(--tc-glass-border);
    border-radius: var(--tc-radius-sm);
    color: #e2e8f0;
    font-size: 1rem;
    cursor: pointer;
}

/* Table */
.admin-table-container {
    background: var(--tc-glass-bg);
    backdrop-filter: blur(var(--tc-glass-blur)) saturate(140%);
    -webkit-backdrop-filter: blur(var(--tc-glass-blur)) saturate(140%);
    border: var(--tc-glass-border);
    border-radius: var(--tc-radius-lg);
    overflow: hidden;
    contain: content;
}

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

.admin-table th {
    background: var(--tc-glass-bg-sidebar);
    color: #94a3b8;
    font-weight: 600;
    text-align: left;
    padding: 1rem;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.admin-table td {
    padding: 1rem;
    border-top: var(--tc-glass-border);
    color: #e2e8f0;
}

.admin-table tr:hover {
    background: rgba(59, 130, 246, 0.05);
}

.admin-table tr.inactive {
    opacity: 0.6;
}

.admin-table tr.admin-user {
    background: rgba(59, 130, 246, 0.1);
}

.admin-table .loading,
.admin-table .no-data {
    text-align: center;
    padding: 2rem;
    color: #64748b;
}

.admin-table.compact th,
.admin-table.compact td {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
}

/* Status Badge */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-badge.active {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

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

.admin-badge-small {
    display: inline-block;
    background: #3B82F6;
    color: white;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.625rem;
    font-weight: 600;
    margin-left: 0.5rem;
    vertical-align: middle;
}

.credit-cell {
    font-weight: 600;
    color: #22c55e;
}

.mono {
    font-family: monospace;
    font-size: 0.875rem;
}

/* Buttons */
.btn-small {
    padding: 0.5rem 0.875rem;
    font-size: 0.875rem;
    border-radius: var(--tc-radius-sm);
    border: none;
    cursor: pointer;
    background: var(--tc-glass-bg-hover);
    color: #e2e8f0;
    transition: all 0.2s;
}

.btn-small:hover {
    background: var(--tc-glass-bg-active);
}

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

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

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

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

.btn-success {
    background: #22c55e;
    color: white;
}

.btn-success:hover {
    background: #16a34a;
}

.btn-secondary {
    background: var(--tc-glass-bg-hover);
    color: #e2e8f0;
}

.btn-secondary:hover {
    background: var(--tc-glass-bg-active);
}

.btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    border-radius: var(--tc-radius-sm);
    border: none;
    cursor: pointer;
    background: #3B82F6;
    color: white;
    font-weight: 600;
    transition: all 0.2s;
}

.btn:hover {
    background: #6d28d9;
}

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

.admin-modal-content {
    background: var(--tc-glass-bg);
    backdrop-filter: blur(var(--tc-glass-blur-heavy)) saturate(140%);
    -webkit-backdrop-filter: blur(var(--tc-glass-blur-heavy)) saturate(140%);
    border: var(--tc-glass-border);
    border-radius: var(--tc-radius-xl);
    width: 95%;
    max-width: 1200px;
    max-height: 90vh;
    overflow-y: auto;
}

.admin-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: var(--tc-glass-border);
}

.admin-modal-header h2 {
    margin: 0;
    color: #f1f5f9;
}

.admin-modal-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    line-height: 1;
}

.admin-modal-close:hover {
    color: #ef4444;
}

.admin-modal-body {
    padding: 1.5rem;
}

.admin-modal-footer {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    padding: 1.5rem;
    border-top: var(--tc-glass-border);
    flex-wrap: wrap;
}

/* User Detail Grid */
.user-detail-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.user-detail-section {
    background: var(--tc-glass-bg-sidebar);
    backdrop-filter: blur(var(--tc-glass-blur-light)) saturate(140%);
    -webkit-backdrop-filter: blur(var(--tc-glass-blur-light)) saturate(140%);
    padding: 1.25rem;
    border-radius: var(--tc-radius-lg);
    border: var(--tc-glass-border);
}

.user-detail-section h3 {
    color: #3B82F6;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 1rem 0;
    padding-bottom: 0.75rem;
    border-bottom: var(--tc-glass-border);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-detail-section h3::before {
    font-size: 1rem;
}

.user-detail-section:nth-child(1) h3::before { content: '👤'; }
.user-detail-section:nth-child(2) h3::before { content: '🔒'; }
.user-detail-section:nth-child(3) h3::before { content: '💰'; }
.user-detail-section:nth-child(4) h3::before { content: '📊'; }

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0;
    gap: 1rem;
    border-bottom: var(--tc-glass-border-subtle);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-row label {
    color: #94a3b8;
    font-size: 0.85rem;
    white-space: nowrap;
}

.detail-row span {
    color: #e2e8f0;
    font-weight: 500;
    text-align: right;
    word-break: break-all;
}

@media (max-width: 1200px) {
    .user-detail-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .user-detail-grid {
        grid-template-columns: 1fr;
    }
}

.credit-balance {
    font-size: 1.25rem;
    color: #22c55e !important;
}

.admin-input {
    padding: 0.5rem 0.75rem;
    background: var(--tc-glass-bg-input);
    border: var(--tc-glass-border);
    border-radius: var(--tc-radius-sm);
    color: #e2e8f0;
    font-size: 0.875rem;
}

.admin-input:focus {
    outline: none;
    border: var(--tc-glass-border-focus);
}

.credit-adjust {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.credit-adjust input {
    flex: 1;
    min-width: 80px;
}

/* User Sessions Section */
.user-sessions-section {
    background: var(--tc-glass-bg-sidebar);
    backdrop-filter: blur(var(--tc-glass-blur-light)) saturate(140%);
    -webkit-backdrop-filter: blur(var(--tc-glass-blur-light)) saturate(140%);
    padding: 1rem;
    border-radius: var(--tc-radius-sm);
    border: var(--tc-glass-border);
}

.user-sessions-section h3 {
    color: #3B82F6;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 1rem 0;
}

/* ==================== ACTIVITY LOG ==================== */

.activity-log-container {
    background: var(--tc-glass-bg);
    border: var(--tc-glass-border);
    border-radius: var(--tc-radius-lg);
    padding: 1rem;
    max-height: 600px;
    overflow-y: auto;
    contain: content;
}

.activity-log-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.activity-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: var(--tc-glass-bg-sidebar);
    border-radius: var(--tc-radius-sm);
    border-left: 3px solid rgba(255, 255, 255, 0.08);
}

.activity-item.activity-job {
    border-left-color: #3B82F6;
}

.activity-item.activity-login {
    border-left-color: #22c55e;
}

.activity-icon {
    font-size: 1.5rem;
}

.activity-content {
    flex: 1;
}

.activity-header {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.activity-user {
    font-weight: 600;
    color: #e2e8f0;
}

.activity-action {
    color: #94a3b8;
}

.activity-time {
    color: #64748b;
    font-size: 0.875rem;
    margin-left: auto;
}

.activity-details {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
}

.activity-status {
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.activity-status.status-completed { background: rgba(34, 197, 94, 0.2); color: #22c55e; }
.activity-status.status-pending { background: rgba(251, 191, 36, 0.2); color: #fbbf24; }
.activity-status.status-processing { background: rgba(59, 130, 246, 0.2); color: #3b82f6; }
.activity-status.status-failed { background: rgba(239, 68, 68, 0.2); color: #ef4444; }

.activity-credits {
    color: #22c55e;
    font-weight: 600;
}

.activity-prompt {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: var(--tc-glass-bg-sidebar);
    border-radius: var(--tc-radius-sm);
    font-size: 0.875rem;
    color: #94a3b8;
    font-style: italic;
}

.activity-location, .activity-ip {
    color: #94a3b8;
    font-size: 0.875rem;
}

/* ==================== USER JOB HISTORY ==================== */

.user-jobs-section {
    background: var(--tc-glass-bg-sidebar);
    backdrop-filter: blur(var(--tc-glass-blur-light)) saturate(140%);
    -webkit-backdrop-filter: blur(var(--tc-glass-blur-light)) saturate(140%);
    padding: 1rem;
    border-radius: var(--tc-radius-sm);
    border: var(--tc-glass-border);
    margin-top: 1.5rem;
}

.user-jobs-section h3 {
    color: #3B82F6;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 1rem 0;
}

.user-jobs-list {
    max-height: 300px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.job-item {
    background: var(--tc-glass-bg-input);
    border-radius: var(--tc-radius-sm);
    padding: 1rem;
    border-left: 3px solid #3B82F6;
}

.job-header {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 0.75rem;
}

.job-type {
    background: var(--tc-glass-bg-hover);
    padding: 0.125rem 0.5rem;
    border-radius: var(--tc-radius-sm);
    font-size: 0.75rem;
    color: #e2e8f0;
    text-transform: uppercase;
}

.job-status {
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.job-status.status-completed { background: rgba(34, 197, 94, 0.2); color: #22c55e; }
.job-status.status-pending { background: rgba(251, 191, 36, 0.2); color: #fbbf24; }
.job-status.status-processing { background: rgba(59, 130, 246, 0.2); color: #3b82f6; }
.job-status.status-failed { background: rgba(239, 68, 68, 0.2); color: #ef4444; }

.job-date {
    color: #64748b;
    font-size: 0.75rem;
    margin-left: auto;
}

.job-prompt {
    margin-bottom: 0.75rem;
}

.job-prompt strong {
    color: #94a3b8;
    font-size: 0.75rem;
    display: block;
    margin-bottom: 0.25rem;
}

.prompt-text {
    background: var(--tc-glass-bg-input);
    padding: 0.75rem;
    border-radius: var(--tc-radius-sm);
    font-size: 0.875rem;
    color: #e2e8f0;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 100px;
    overflow-y: auto;
}

.job-details {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 0.75rem;
    color: #94a3b8;
}

.job-error {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: rgba(239, 68, 68, 0.1);
    border-radius: var(--tc-radius-sm);
    color: #ef4444;
    font-size: 0.75rem;
}

/* ==================== USER GALLERY ==================== */

.user-gallery-section {
    background: var(--tc-glass-bg-sidebar);
    backdrop-filter: blur(var(--tc-glass-blur-light)) saturate(140%);
    -webkit-backdrop-filter: blur(var(--tc-glass-blur-light)) saturate(140%);
    padding: 1rem;
    border-radius: var(--tc-radius-sm);
    border: var(--tc-glass-border);
    margin-top: 1.5rem;
}

.user-gallery-section h3 {
    color: #3B82F6;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 1rem 0;
}

.gallery-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.gallery-tab-btn {
    background: var(--tc-glass-bg-hover);
    border: none;
    color: #94a3b8;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    cursor: pointer;
    border-radius: var(--tc-radius-sm);
    transition: all 0.2s;
}

.gallery-tab-btn:hover {
    background: var(--tc-glass-bg-active);
    color: #e2e8f0;
}

.gallery-tab-btn.active {
    background: #3B82F6;
    color: white;
}

.user-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1rem;
    max-height: 300px;
    overflow-y: auto;
}

.gallery-item {
    background: var(--tc-glass-bg-input);
    border-radius: var(--tc-radius-sm);
    overflow: hidden;
    border: var(--tc-glass-border);
}

.file-preview {
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--tc-glass-bg-sidebar);
}

.file-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: cover;
}

.file-icon {
    font-size: 2.5rem;
}

.file-info {
    padding: 0.5rem;
}

.file-name {
    font-size: 0.75rem;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.25rem;
}

.file-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.625rem;
    color: #64748b;
}

.no-data {
    text-align: center;
    padding: 2rem;
    color: #64748b;
}

.loading {
    text-align: center;
    padding: 2rem;
    color: #64748b;
}

/* Delete Button */
.btn-delete {
    background: linear-gradient(135deg, #991b1b, #dc2626);
    color: white;
    border: 2px solid #7f1d1d;
}

.btn-delete:hover {
    background: linear-gradient(135deg, #7f1d1d, #b91c1c);
}

/* Confirmation Modal */
.confirm-modal-content {
    background: var(--tc-glass-bg);
    backdrop-filter: blur(var(--tc-glass-blur-heavy)) saturate(140%);
    -webkit-backdrop-filter: blur(var(--tc-glass-blur-heavy)) saturate(140%);
    border: 1px solid #ef4444;
    border-radius: var(--tc-radius-xl);
    width: 90%;
    max-width: 450px;
    box-shadow: 0 0 30px rgba(239, 68, 68, 0.3);
}

.confirm-modal-header {
    padding: 1.5rem;
    border-bottom: var(--tc-glass-border);
    background: rgba(239, 68, 68, 0.1);
}

.confirm-modal-header h3 {
    margin: 0;
    color: #ef4444;
    font-size: 1.25rem;
}

.confirm-modal-body {
    padding: 1.5rem;
}

.confirm-modal-body p {
    margin: 0;
    color: #e2e8f0;
    white-space: pre-line;
    line-height: 1.6;
}

.confirm-modal-footer {
    padding: 1.5rem;
    border-top: var(--tc-glass-border);
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* Notification */
.admin-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: var(--tc-radius-md);
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 2000;
    animation: slideIn 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(var(--tc-glass-blur)) saturate(140%);
    -webkit-backdrop-filter: blur(var(--tc-glass-blur)) saturate(140%);
}

.admin-notification.success {
    background: linear-gradient(135deg, #065f46, #059669);
    border: 1px solid #10b981;
    color: white;
}

.admin-notification.error {
    background: linear-gradient(135deg, #7f1d1d, #dc2626);
    border: 1px solid #ef4444;
    color: white;
}

.admin-notification.warning {
    background: linear-gradient(135deg, #92400e, #d97706);
    border: 1px solid #f59e0b;
    color: white;
}

.admin-notification.info {
    background: linear-gradient(135deg, #1e40af, #3b82f6);
    border: 1px solid #60a5fa;
    color: white;
}

.admin-notification button {
    background: none;
    border: none;
    color: inherit;
    font-size: 1.25rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    padding: 0;
    line-height: 1;
}

.admin-notification button:hover {
    opacity: 1;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ==================== TOAST NOTIFICATIONS ==================== */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-width: 400px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-radius: var(--tc-radius-md);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    animation: toastSlideIn 0.3s ease-out forwards;
    pointer-events: auto;
    min-width: 280px;
    backdrop-filter: blur(var(--tc-glass-blur)) saturate(140%);
    -webkit-backdrop-filter: blur(var(--tc-glass-blur)) saturate(140%);
}

.toast.toast-dismissing {
    animation: toastSlideOut 0.3s ease-in forwards;
}

.toast-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

.toast-message {
    font-size: 0.85rem;
    opacity: 0.9;
}

.toast-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 1.25rem;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
}

.toast-close:hover {
    opacity: 1;
}

/* Toast Types */
.toast-info {
    background: linear-gradient(135deg, #1e40af, #3b82f6);
    border: 1px solid #60a5fa;
    color: white;
}

.toast-success {
    background: linear-gradient(135deg, #065f46, #059669);
    border: 1px solid #10b981;
    color: white;
}

.toast-warning {
    background: linear-gradient(135deg, #92400e, #d97706);
    border: 1px solid #f59e0b;
    color: white;
}

.toast-error {
    background: linear-gradient(135deg, #7f1d1d, #dc2626);
    border: 1px solid #ef4444;
    color: white;
}

/* Toast Animations */
@keyframes toastSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toastSlideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Toast Progress Bar (auto-dismiss indicator) */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 0 0 var(--tc-radius-md) var(--tc-radius-md);
    animation: toastProgress 5s linear forwards;
}

@keyframes toastProgress {
    from {
        width: 100%;
    }
    to {
        width: 0%;
    }
}

.toast {
    position: relative;
    overflow: hidden;
}

/* ============================================================
   MOBILE — iPhone Pro Max (~430px) and all phones
   ============================================================ */

@media (max-width: 768px) {

    /* --- Header --- */
    .admin-header {
        flex-direction: column;
        gap: 0.75rem;
        padding: 0.75rem 1rem;
    }

    .admin-header-left { justify-content: center; gap: 0.5rem; }
    .admin-header-left h1 { font-size: 1.1rem; }
    .admin-badge { font-size: 0.65rem; padding: 0.2rem 0.5rem; }

    .admin-header-right {
        width: 100%;
        justify-content: center;
        gap: 0.5rem;
        flex-wrap: wrap;
    }

    .admin-header-right .btn-small { padding: 0.3rem 0.6rem; font-size: 0.8rem; }
    #adminEmail { font-size: 0.7rem; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

    /* --- Main content --- */
    .admin-main { padding: 0.75rem; }

    /* --- Stats cards: 2-col grid --- */
    .admin-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
        margin-bottom: 1rem;
    }

    .stat-card { padding: 0.75rem; }
    .stat-value { font-size: 1.4rem; }
    .stat-label { font-size: 0.75rem; }

    /* --- Tabs: compact wrapping grid --- */
    .admin-tabs {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 4px;
        padding-bottom: 0;
        margin-bottom: 1rem;
        border-bottom: none;
    }

    .admin-tab-btn {
        padding: 0.45rem 0.25rem;
        font-size: 0.68rem;
        white-space: nowrap;
        text-align: center;
        border-radius: var(--tc-radius-sm);
        border-bottom: 2px solid transparent;
    }
    .admin-tab-btn.active {
        border-bottom: 2px solid #3B82F6;
        background: rgba(124, 58, 237, 0.15);
    }

    /* --- Toolbar --- */
    .admin-toolbar {
        flex-direction: column;
        gap: 0.5rem;
    }
    .admin-search { width: 100%; min-width: 0; padding: 0.6rem 0.75rem; font-size: 0.9rem; }
    .admin-select { width: 100%; font-size: 0.9rem; }

    /* --- Tables: horizontal scroll wrapper --- */
    .admin-table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }

    .admin-table th, .admin-table td { padding: 0.6rem 0.5rem; font-size: 0.8rem; white-space: nowrap; }
    .admin-table.compact th, .admin-table.compact td { padding: 0.4rem 0.5rem; font-size: 0.75rem; }

    /* --- Buttons --- */
    .btn { padding: 0.6rem 1rem; font-size: 0.9rem; }
    .btn-small { padding: 0.3rem 0.6rem; font-size: 0.8rem; }

    /* --- Modals: full-width --- */
    .admin-modal-content {
        width: 96%;
        max-width: none;
        max-height: 92vh;
        margin: 1rem auto;
        border-radius: var(--tc-radius-lg);
    }

    .admin-modal-header { padding: 1rem; }
    .admin-modal-header h2 { font-size: 1.1rem; }
    .admin-modal-body { padding: 1rem; }
    .admin-modal-footer { flex-direction: column; padding: 1rem; }
    .admin-modal-footer .btn { width: 100%; }

    /* --- User detail grid: single column --- */
    .user-detail-grid { grid-template-columns: 1fr !important; gap: 0.75rem; }

    .user-detail-section { padding: 0.75rem; }
    .user-detail-section h3 { font-size: 0.75rem; }
    .detail-row { padding: 0.4rem 0; }
    .detail-row label { font-size: 0.8rem; }
    .detail-row span { font-size: 0.8rem; }

    /* --- Gallery: 2-col on mobile --- */
    .user-gallery-grid { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
    .file-preview { height: 80px; }
    .file-name { font-size: 0.7rem; }

    /* --- Gallery tabs --- */
    .gallery-tabs { overflow-x: auto; scrollbar-width: none; }
    .gallery-tabs::-webkit-scrollbar { display: none; }
    .gallery-tab-btn { padding: 0.4rem 0.75rem; font-size: 0.8rem; flex-shrink: 0; }

    /* --- Activity log --- */
    .activity-log-container { max-height: 400px; padding: 0.75rem; }
    .activity-item { padding: 0.75rem; gap: 0.5rem; }
    .activity-icon { font-size: 1.2rem; }
    .activity-header { gap: 0.5rem; }
    .activity-user { font-size: 0.85rem; }
    .activity-time { font-size: 0.75rem; }

    /* --- Job history --- */
    .job-header { gap: 0.5rem; }
    .job-type { font-size: 0.7rem; }
    .prompt-text { font-size: 0.8rem; max-height: 80px; }

    /* --- Processes tab --- */
    .process-grid { grid-template-columns: 1fr !important; }
    .llm-card { min-width: 0; padding: 0.75rem; }
    .llm-name { font-size: 0.95rem; }

    /* --- Spark system --- */
    .spark-system-grid { grid-template-columns: 1fr !important; }
    .spark-info-bar { gap: 0.75rem; font-size: 0.8rem; padding: 0.6rem 0.75rem; }
    .spark-gpu-card { padding: 1rem; }
    .spark-metric { gap: 0.5rem; }
    .spark-metric-label { min-width: 60px; font-size: 0.75rem; }
    .spark-metric-value { min-width: 80px; font-size: 0.75rem; }
    .spark-service-list { gap: 0.75rem; }
    .spark-service { padding: 0.4rem 0.6rem; font-size: 0.85rem; }

    /* --- Tier settings --- */
    .tier-config-section { padding: 0.75rem; }
    .tier-config-section h3 { font-size: 0.95rem; }

    /* --- Model settings --- */
    .model-settings-grid { grid-template-columns: 1fr !important; }
    .model-settings-intro h2 { font-size: 1rem; }

    /* --- Notification & Toast: full-width --- */
    .admin-notification { left: 0.75rem; right: 0.75rem; top: 0.75rem; padding: 0.75rem; font-size: 0.85rem; }
    .toast-container { left: 0.75rem; right: 0.75rem; max-width: none; }
    .toast { min-width: auto; }

    /* --- Sessions --- */
    .session-detail-grid { grid-template-columns: 1fr; }
    .session-detail-modal { max-width: 96%; }

    /* --- Credit adjust --- */
    .credit-adjust { flex-direction: column; }
    .credit-adjust input { width: 100%; }
}

/* Small phones (under 480px) */
@media (max-width: 480px) {
    .admin-header { padding: 0.5rem 0.75rem; gap: 0.5rem; }
    .admin-header-right .btn-small { font-size: 0.7rem; padding: 0.25rem 0.5rem; }
    #adminEmail { max-width: 120px; font-size: 0.65rem; }

    .admin-tabs {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    }
    .admin-tab-btn { font-size: 0.6rem; padding: 0.4rem 0.15rem; }

    .admin-main { padding: 0.5rem; }

    .admin-modal-content { width: 98%; margin: 0.5rem auto; }
    .admin-modal-header h2 { font-size: 1rem; }
    .admin-modal-body { padding: 0.75rem; }
}

/* Extra-small phones (under 380px) */
@media (max-width: 380px) {
    .admin-stats { grid-template-columns: 1fr; }
    .stat-value { font-size: 1.2rem; }
    .admin-header-left h1 { font-size: 1rem; }
    .admin-header-right .btn-small { font-size: 0.7rem; padding: 0.25rem 0.5rem; }
    .user-gallery-grid { grid-template-columns: 1fr; }
    .admin-tabs { grid-template-columns: repeat(auto-fill, minmax(60px, 1fr)); }
}

/* Touch optimization */
@media (hover: none) and (pointer: coarse) {
    .admin-tab-btn { min-height: 40px; }
    .btn, button { min-height: 44px; }
    .admin-table th, .admin-table td { padding: 0.65rem 0.6rem; }
    input, select, textarea { font-size: 16px; }
}

/* Safe area insets for notched phones */
@supports (padding: max(0px)) {
    .admin-header {
        padding-top: max(0px, env(safe-area-inset-top));
        padding-left: max(0.75rem, env(safe-area-inset-left));
        padding-right: max(0.75rem, env(safe-area-inset-right));
    }
    .admin-main {
        padding-left: max(0.75rem, env(safe-area-inset-left));
        padding-right: max(0.75rem, env(safe-area-inset-right));
        padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
    }
}

/* ==================== SESSION TRACKING STYLES ==================== */

/* Guest badge for anonymous users */
.guest-badge {
    background: var(--tc-glass-bg-hover);
    color: white;
    padding: 2px 6px;
    border-radius: var(--tc-radius-sm);
    font-size: 0.7em;
    margin-left: 5px;
}

/* Session status badges */
.status-active {
    background: #22c55e !important;
    color: white;
}

.status-inactive {
    background: #6b7280 !important;
    color: white;
}

/* Session detail modal */
.session-detail-modal {
    max-width: 700px;
}

.session-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
    padding: 1rem;
    background: var(--tc-glass-bg);
    border-radius: var(--tc-radius-md);
}

.session-detail-grid .detail-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.session-detail-grid .detail-row label {
    color: #94a3b8;
    font-size: 0.85em;
}

.session-detail-grid .detail-row span {
    color: #f1f5f9;
}

/* Activity timeline in session details */
.activity-timeline {
    max-height: 400px;
    overflow-y: auto;
    border: var(--tc-glass-border);
    border-radius: var(--tc-radius-md);
    padding: 12px;
    background: var(--tc-glass-bg);
}

.activity-timeline-item {
    padding: 10px 0;
    border-bottom: var(--tc-glass-border);
}

.activity-timeline-item:last-child {
    border-bottom: none;
}

.activity-time {
    font-size: 0.8em;
    color: #64748b;
    margin-bottom: 4px;
}

.activity-action {
    font-weight: 600;
    color: #38bdf8;
    margin-bottom: 4px;
}

.activity-details-text {
    font-size: 0.85em;
    color: #94a3b8;
    margin-top: 4px;
    word-break: break-word;
    padding: 6px 8px;
    background: var(--tc-glass-bg-sidebar);
    border-radius: var(--tc-radius-sm);
    font-family: monospace;
}

/* Admin checkbox styling */
.admin-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: #94a3b8;
    font-size: 0.9em;
}

.admin-checkbox input[type="checkbox"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
    accent-color: #38bdf8;
}

/* Inactive row styling for disconnected sessions */
.admin-table tr.inactive {
    opacity: 0.6;
}

.admin-table tr.inactive:hover {
    opacity: 0.8;
}

/* Mono class for code-like text */
.mono {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Mono', monospace;
    font-size: 0.9em;
}

/* Session detail modal responsive */
@media (max-width: 768px) {
    .session-detail-grid {
        grid-template-columns: 1fr;
    }

    .session-detail-modal {
        max-width: 95%;
        margin: 10px;
    }

    .activity-timeline {
        max-height: 300px;
    }
}

/* ==================== PROCESSES TAB ==================== */

.process-section {
    margin-bottom: 1.5rem;
}

.process-section-title {
    color: #3B82F6;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 0.75rem 0;
    padding-bottom: 0.5rem;
    border-bottom: var(--tc-glass-border);
}

.process-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 900px) {
    .process-grid {
        grid-template-columns: 1fr;
    }
}

.process-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.llm-card {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.15), rgba(59, 130, 246, 0.1));
    border: 1px solid rgba(124, 58, 237, 0.3);
    border-radius: var(--tc-radius-lg);
    padding: 1rem 1.25rem;
    min-width: 250px;
    flex: 1;
}

.llm-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: #a78bfa;
    margin-bottom: 0.5rem;
}

.llm-details {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.llm-detail {
    font-size: 0.8rem;
    color: #94a3b8;
    background: var(--tc-glass-bg-input);
    padding: 0.2rem 0.5rem;
    border-radius: var(--tc-radius-sm);
}

.process-pct {
    font-weight: 700;
    color: #f1f5f9;
}

.process-cmd {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: monospace;
    font-size: 0.8rem;
}

.process-timestamp {
    text-align: right;
    color: #64748b;
    font-size: 0.8rem;
    margin-top: 1rem;
    padding-top: 0.5rem;
    border-top: var(--tc-glass-border-subtle);
}

/* ==================== SPARK SYSTEM TAB ==================== */

/* Hero Header */
.spark-hero-header {
    background: linear-gradient(135deg, rgba(118, 185, 0, 0.08) 0%, rgba(255, 255, 255, 0.04) 100%);
    border: 1px solid rgba(118, 185, 0, 0.2);
    border-radius: var(--tc-radius-lg);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.spark-hero-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.spark-hero-nvidia {
    font-weight: 900;
    font-size: 1.1rem;
    letter-spacing: 0.12em;
    color: #76b900;
    text-transform: uppercase;
}

.spark-hero-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #f1f5f9;
}

.spark-hero-details {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.spark-hero-detail {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.spark-hero-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
}

.spark-hero-detail > span:last-child {
    font-size: 0.8rem;
    color: #e2e8f0;
    font-weight: 500;
}

/* Gauge Grid */
.spark-gauge-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.spark-gauge-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    background: var(--tc-glass-bg);
    backdrop-filter: blur(8px) saturate(140%);
    -webkit-backdrop-filter: blur(8px) saturate(140%);
    border: var(--tc-glass-border);
    border-radius: var(--tc-radius-lg);
    padding: 1rem 0.5rem 0.75rem;
}

.spark-gauge-cell canvas {
    display: block;
}

.spark-gauge-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #94a3b8;
    text-align: center;
}

/* Section Card (glass) */
.spark-section-card {
    background: var(--tc-glass-bg);
    backdrop-filter: blur(8px) saturate(140%);
    -webkit-backdrop-filter: blur(8px) saturate(140%);
    border: var(--tc-glass-border);
    border-radius: var(--tc-radius-lg);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.spark-section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: var(--tc-glass-border);
}

.spark-section-title h3 {
    margin: 0;
    color: #3B82F6;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.spark-badge {
    font-size: 0.75rem;
    color: #64748b;
    background: var(--tc-glass-bg-sidebar);
    padding: 0.2rem 0.6rem;
    border-radius: var(--tc-radius-sm);
}

/* GPU Detail Grid */
.spark-gpu-detail-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.spark-detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.spark-detail-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
}

.spark-detail-val {
    font-size: 0.9rem;
    font-weight: 600;
    color: #e2e8f0;
}

.spark-mini-bar-wrap {
    height: 6px;
    background: rgba(255,255,255,0.06);
    border-radius: 3px;
    overflow: hidden;
}

.spark-mini-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

.spark-mini-bar.enc { background: linear-gradient(90deg, #76b900, #a3e635); }
.spark-mini-bar.dec { background: linear-gradient(90deg, #14b8a6, #5eead4); }

/* GPU Processes (reused) */
.spark-gpu-proc-section {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: var(--tc-glass-border);
}

.spark-gpu-proc-section h4 {
    color: #94a3b8;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 0.5rem 0;
}

.spark-gpu-proc-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.spark-gpu-proc {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    padding: 0.3rem 0.5rem;
    background: var(--tc-glass-bg-sidebar);
    border-radius: var(--tc-radius-sm);
    color: #e2e8f0;
}

.spark-gpu-proc .mono { color: #64748b; min-width: 60px; }
.spark-gpu-proc span:last-child { margin-left: auto; color: #3b82f6; font-weight: 600; }

/* CPU Layout */
.spark-cpu-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.spark-cpu-heatmap-wrap h4,
.spark-cpu-load-wrap h4 {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    margin: 0 0 0.75rem 0;
}

.spark-cpu-heatmap {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
}

.spark-heatmap-cell {
    aspect-ratio: 1;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: rgba(0,0,0,0.6);
    transition: background 0.5s ease;
    min-height: 36px;
}

.spark-heatmap-legend {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    font-size: 0.65rem;
    color: #64748b;
}

.spark-heatmap-gradient {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(90deg, #3B82F6, #14b8a6, #22c55e, #f59e0b, #ef4444);
}

.spark-cpu-freq {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: #94a3b8;
}

/* Memory Layout */
.spark-memory-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 1.5rem;
    align-items: start;
}

.spark-memory-chart-wrap {
    max-width: 280px;
}

.spark-memory-breakdown {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.spark-mem-row {
    display: flex;
    justify-content: space-between;
    padding: 0.3rem 0;
    font-size: 0.8rem;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}

.spark-mem-row span:first-child { color: #94a3b8; }
.spark-mem-row span:last-child { color: #e2e8f0; font-weight: 500; }

/* Thermal Tiles */
.spark-thermal-tiles {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.spark-thermal-tile {
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    min-width: 80px;
    text-align: center;
    transition: background 0.5s ease;
}

.spark-thermal-temp {
    font-size: 1.1rem;
    font-weight: 700;
    color: rgba(0,0,0,0.7);
}

.spark-thermal-name {
    font-size: 0.65rem;
    color: rgba(0,0,0,0.5);
    margin-top: 0.15rem;
}

.spark-thermal-legend {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    font-size: 0.65rem;
    color: #64748b;
}

.spark-thermal-gradient {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(90deg, #3B82F6, #14b8a6, #f59e0b, #ef4444);
}

/* Duo Grid (Disk + Network) */
.spark-duo-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.spark-disk-layout {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 1rem;
    align-items: start;
    margin-bottom: 0.75rem;
}

.spark-disk-details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.spark-disk-detail-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    padding: 0.25rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}

.spark-disk-detail-row .mono { color: #94a3b8; }
.spark-disk-detail-row span:last-child { color: #e2e8f0; }

.spark-io-rates {
    display: flex;
    gap: 1.5rem;
    padding-top: 0.75rem;
    border-top: var(--tc-glass-border);
    font-size: 0.8rem;
    color: #94a3b8;
}

.spark-net-ifaces {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: var(--tc-glass-border);
}

.spark-net-iface-row {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: #94a3b8;
    padding: 0.2rem 0;
}

.spark-net-iface-row .mono { color: #e2e8f0; min-width: 100px; }

/* Services v2 */
.spark-service-v2-list {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.spark-service-v2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 1rem;
    background: var(--tc-glass-bg-sidebar);
    border-radius: 999px;
    font-size: 0.85rem;
}

.spark-service-dot-v2 {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.spark-service-dot-v2.running {
    background: #22c55e;
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.5);
    animation: sparkPulse 2s ease-in-out infinite;
}

.spark-service-dot-v2.stopped {
    background: #ef4444;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

@keyframes sparkPulse {
    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); }
}

.spark-service-name-v2 {
    font-weight: 600;
    color: #e2e8f0;
    text-transform: capitalize;
}

/* Process Table */
.spark-proc-tabs {
    display: flex;
    gap: 0.5rem;
}

.spark-proc-tab {
    background: var(--tc-glass-bg-sidebar);
    border: var(--tc-glass-border);
    border-radius: var(--tc-radius-sm);
    color: #94a3b8;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.spark-proc-tab.active {
    background: rgba(59, 130, 246, 0.15);
    color: #3B82F6;
    border-color: rgba(59, 130, 246, 0.3);
}

.spark-proc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.spark-proc-table th {
    text-align: left;
    padding: 0.5rem 0.75rem;
    color: #64748b;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: var(--tc-glass-border);
    font-weight: 600;
}

.spark-proc-table td {
    padding: 0.4rem 0.75rem;
    color: #e2e8f0;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}

.spark-proc-table tr:hover td {
    background: rgba(255,255,255,0.03);
}

.spark-proc-cpu-bar-wrap {
    display: inline-block;
    width: 60px;
    height: 6px;
    background: rgba(255,255,255,0.06);
    border-radius: 3px;
    overflow: hidden;
    vertical-align: middle;
    margin-right: 0.5rem;
}

.spark-proc-cpu-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* Responsive */
@media (max-width: 1200px) {
    .spark-gauge-grid { grid-template-columns: repeat(3, 1fr); }
    .spark-gpu-detail-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 800px) {
    .spark-gauge-grid { grid-template-columns: repeat(2, 1fr); }
    .spark-duo-grid { grid-template-columns: 1fr; }
    .spark-cpu-layout { grid-template-columns: 1fr; }
    .spark-memory-layout { grid-template-columns: 1fr; }
    .spark-memory-chart-wrap { max-width: 100%; }
    .spark-disk-layout { grid-template-columns: 1fr; }
    .spark-hero-header { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 500px) {
    .spark-gauge-grid { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
    .spark-cpu-heatmap { grid-template-columns: repeat(4, 1fr); }
    .spark-hero-details { gap: 0.75rem; }
}

/* ==================== TIER SETTINGS TAB ==================== */

.tier-config-section {
    background: var(--tc-glass-bg);
    backdrop-filter: blur(var(--tc-glass-blur-light)) saturate(140%);
    -webkit-backdrop-filter: blur(var(--tc-glass-blur-light)) saturate(140%);
    border: var(--tc-glass-border);
    border-radius: var(--tc-radius-md);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.tier-config-section h3 {
    margin: 0 0 1rem 0;
    font-size: 1.1rem;
    color: #f1f5f9;
}

.tier-config-section .admin-input,
.tier-config-section .admin-select {
    background: var(--tc-glass-bg-input);
    border: var(--tc-glass-border);
    color: #e2e8f0;
    border-radius: var(--tc-radius-sm);
    padding: 6px 10px;
    font-size: 0.9rem;
}

.tier-config-section .admin-input:focus,
.tier-config-section .admin-select:focus {
    border: var(--tc-glass-border-focus);
    outline: none;
}

.tier-config-section .admin-select:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.tier-config-section input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #3B82F6;
}

/* ==================== Model Settings Tab ==================== */

.model-settings-intro {
    margin-bottom: 1.5rem;
}

.model-settings-intro h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #f1f5f9;
    margin: 0 0 0.5rem;
}

.admin-hint {
    color: #94a3b8;
    font-size: 0.85rem;
    margin: 0;
}

.model-settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.model-setting-card {
    background: var(--tc-glass-bg);
    backdrop-filter: blur(var(--tc-glass-blur-light)) saturate(140%);
    -webkit-backdrop-filter: blur(var(--tc-glass-blur-light)) saturate(140%);
    border: var(--tc-glass-border);
    border-radius: var(--tc-radius-md);
    padding: 1rem;
}

.model-setting-card label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: #94a3b8;
    margin-bottom: 0.5rem;
}

.model-setting-card .admin-select {
    width: 100%;
}

.model-settings-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 0;
    border-top: var(--tc-glass-border);
}
