/* DockPilot — Dark Theme */

:root {
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-card: #16213e;
    --bg-hover: #1e2a4a;
    --bg-input: #0d1b2a;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --accent-glow: rgba(99, 102, 241, 0.3);
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border: #1e293b;
    --border-light: #2d3a52;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --radius: 14px;
    --radius-sm: 8px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
    --transition: 0.2s ease;
    --sidebar-width: 240px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* --- Login --- */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    background: radial-gradient(ellipse at 50% 0%, rgba(99,102,241,0.08) 0%, transparent 60%);
}

.login-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    width: 100%;
    max-width: 400px;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.login-box h1 {
    font-size: 1.8rem;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-box p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.login-box .form-group {
    margin-bottom: 16px;
    text-align: left;
}

.login-box label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.login-box input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
    transition: border var(--transition);
}

.login-box input:focus {
    border-color: var(--accent);
}

.login-box .btn-login {
    width: 100%;
    padding: 12px;
    margin-top: 8px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition);
}

.login-box .btn-login:hover { background: var(--accent-hover); }

.login-error {
    color: var(--danger);
    font-size: 0.85rem;
    margin-top: 12px;
    display: none;
}

/* --- Layout --- */
.app-layout {
    display: none;
    min-height: 100vh;
}

.app-layout.active { display: flex; }
.login-container.hidden { display: none; }

/* --- Sidebar --- */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform var(--transition);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.sidebar-header h1 {
    font-size: 1.3rem;
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-header span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.sidebar-nav {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    margin-bottom: 2px;
    font-size: 0.9rem;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(99, 102, 241, 0.15);
    color: var(--accent);
}

.nav-item i { width: 20px; height: 20px; stroke-width: 1.5; }

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
}

.btn-logout {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 14px;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-logout:hover {
    border-color: var(--danger);
    color: var(--danger);
}

/* --- Main content --- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* --- Header --- */
.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-title {
    font-size: 1.2rem;
    font-weight: 600;
}

.system-stats {
    display: flex;
    gap: 20px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
}

.stat-item .stat-label {
    color: var(--text-muted);
}

.stat-item .stat-value {
    font-weight: 600;
    min-width: 42px;
}

.stat-bar {
    width: 60px;
    height: 6px;
    background: var(--bg-primary);
    border-radius: 3px;
    overflow: hidden;
}

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

.stat-bar-fill.cpu { background: var(--info); }
.stat-bar-fill.ram { background: var(--accent); }
.stat-bar-fill.disk { background: var(--warning); }

/* --- Content area --- */
.content {
    flex: 1;
    padding: 24px;
}

/* --- Search bar --- */
.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 10px 16px;
    padding-left: 40px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    transition: border var(--transition);
}

.search-input:focus { border-color: var(--accent); }

.search-wrapper {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.search-wrapper i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    width: 18px;
    height: 18px;
}

.filter-btn {
    padding: 7px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.8rem;
    transition: all var(--transition);
    white-space: nowrap;
}

.filter-btn:hover, .filter-btn.active {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(99, 102, 241, 0.1);
}

/* --- App grid --- */
.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

/* --- App card --- */
.app-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0;
    transition: all var(--transition);
    cursor: default;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.app-card:hover {
    border-color: var(--accent);
    box-shadow: 0 0 20px var(--accent-glow);
    transform: translateY(-2px);
}

.app-card-body {
    padding: 18px 20px 14px;
    flex: 1;
}

.app-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.app-card-info {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

/* --- App icon (favicon) --- */
.app-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: var(--bg-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    flex-shrink: 0;
    overflow: hidden;
}

.app-icon img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.app-icon img.round {
    border-radius: 6px;
}

.app-icon i { width: 22px; height: 22px; }

.app-name {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-category {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* --- OIDC badge --- */
.oidc-badge {
    display: inline-flex;
    align-items: center;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    vertical-align: middle;
    margin-left: 4px;
}

.oidc-badge.provider {
    background: rgba(168, 85, 247, 0.15);
    color: #a855f7;
    border: 1px solid rgba(168, 85, 247, 0.3);
}

.oidc-badge.native {
    background: rgba(34, 197, 94, 0.12);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.25);
}

.oidc-badge.forward {
    background: rgba(59, 130, 246, 0.12);
    color: var(--info);
    border: 1px solid rgba(59, 130, 246, 0.25);
}

/* --- Passkey login --- */
.passkey-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.passkey-divider::before, .passkey-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.btn-passkey {
    width: 100%;
    padding: 11px;
    margin-top: 4px;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-passkey:hover {
    border-color: var(--accent);
    background: var(--bg-hover);
}

.btn-passkey svg {
    width: 18px;
    height: 18px;
}

/* --- Profile avatar --- */
.profile-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    text-transform: uppercase;
}

/* --- Status badge --- */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    flex-shrink: 0;
}

.status-badge.running {
    background: rgba(34, 197, 94, 0.12);
    color: var(--success);
}

.status-badge.stopped {
    background: rgba(239, 68, 68, 0.12);
    color: var(--danger);
}

.status-badge.partial {
    background: rgba(245, 158, 11, 0.12);
    color: var(--warning);
}

.status-badge.unknown {
    background: rgba(100, 116, 139, 0.12);
    color: var(--text-muted);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: currentColor;
}

.status-badge.running .status-dot {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.app-card-url {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
}

.app-card-url a { color: var(--text-muted); }
.app-card-url a:hover { color: var(--accent); }

/* --- Card actions bar --- */
.app-card-actions {
    display: flex;
    border-top: 1px solid var(--border);
    background: rgba(0,0,0,0.12);
}

.app-card-actions .action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 9px 4px;
    background: none;
    border: none;
    border-right: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.app-card-actions .action-btn:last-child {
    border-right: none;
}

.app-card-actions .action-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.app-card-actions .action-btn.start:hover { color: var(--success); }
.app-card-actions .action-btn.stop:hover { color: var(--danger); }
.app-card-actions .action-btn.restart:hover { color: var(--warning); }

.app-card-actions .action-btn i {
    width: 14px;
    height: 14px;
}

/* --- Generic buttons --- */
.btn {
    padding: 7px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

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

.btn i { width: 14px; height: 14px; }

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

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

.btn-danger {
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--danger);
}

.btn-success {
    color: var(--success);
    border-color: rgba(34, 197, 94, 0.3);
}

.btn-success:hover {
    background: rgba(34, 197, 94, 0.1);
    border-color: var(--success);
}

/* --- Modal --- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active { display: flex; }

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 700px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

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

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

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    transition: color var(--transition);
}

.modal-close:hover { color: var(--text-primary); }

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* --- Logs --- */
.log-container {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.78rem;
    line-height: 1.6;
    max-height: 500px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
    color: var(--text-secondary);
}

.log-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

/* --- Env editor --- */
.env-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
}

.env-row.comment {
    opacity: 0.5;
}

.env-key {
    width: 200px;
    min-width: 140px;
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--accent);
    font-family: monospace;
    font-size: 0.85rem;
    outline: none;
}

.env-value {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: monospace;
    font-size: 0.85rem;
    outline: none;
}

.env-key:focus, .env-value:focus { border-color: var(--accent); }

.btn-reveal {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
}

.btn-reveal:hover { color: var(--text-primary); }

/* --- Catalog --- */
.catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.catalog-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
}

.catalog-card:hover {
    border-color: var(--accent);
    box-shadow: 0 0 20px var(--accent-glow);
}

.catalog-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.catalog-card .app-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 14px;
    line-height: 1.5;
    flex: 1;
}

.catalog-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.badge-category {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent);
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.badge-installed {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.2);
}

/* --- Install form / Wizard --- */
.install-field {
    margin-bottom: 16px;
}

.install-field label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 500;
}

.install-field input, .install-field textarea, .install-field select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
    font-family: inherit;
    transition: border var(--transition);
}

.install-field select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.install-field textarea {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.8rem;
    resize: vertical;
    min-height: 200px;
}

.install-field input:focus, .install-field textarea:focus, .install-field select:focus {
    border-color: var(--accent);
}

.install-field .hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.4;
}

/* Wizard stepper */
.wizard-stepper {
    display: flex;
    gap: 0;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
}

.wizard-step-indicator {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all var(--transition);
}

.wizard-step-indicator.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.wizard-step-indicator.done {
    color: var(--success);
    border-bottom-color: var(--success);
}

.step-number {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    flex-shrink: 0;
}

.wizard-step-indicator.active .step-number {
    background: var(--accent);
    color: white;
}

.wizard-step-indicator.done .step-number {
    background: var(--success);
    color: white;
}

.wizard-page {
    display: none;
    animation: fadeIn 0.2s ease;
}

.wizard-page.active {
    display: block;
}

/* Wizard app header */
.wizard-app-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    border: 1px solid var(--border);
}

.wizard-app-header .app-icon {
    width: 48px;
    height: 48px;
}

.wizard-app-header .app-icon img {
    width: 34px;
    height: 34px;
}

.wizard-app-header .wizard-app-meta h3 {
    font-size: 1.05rem;
    margin-bottom: 2px;
}

.wizard-app-header .wizard-app-meta p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Review summary */
.review-section {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    margin-bottom: 12px;
}

.review-section h4 {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.review-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    font-size: 0.85rem;
}

.review-row .review-label {
    color: var(--text-secondary);
}

.review-row .review-value {
    color: var(--text-primary);
    font-weight: 500;
    font-family: monospace;
    font-size: 0.82rem;
}

.review-row .review-value.secret {
    color: var(--text-muted);
}

/* Toggle switch */
.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

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

.toggle-label {
    font-size: 0.85rem;
}

.toggle-label small {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.toggle-switch {
    position: relative;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--border);
    border-radius: 22px;
    transition: 0.2s;
}

.toggle-slider:before {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--accent);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(18px);
}

/* Wizard footer */
.wizard-footer {
    display: flex;
    justify-content: space-between;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

.wizard-footer .wizard-footer-left,
.wizard-footer .wizard-footer-right {
    display: flex;
    gap: 8px;
}

/* --- Backups --- */

/* Tab navigation */
.backup-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
}

.backup-tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 18px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    margin-bottom: -1px;
    white-space: nowrap;
}

.backup-tab-btn i { width: 15px; height: 15px; }

.backup-tab-btn:hover {
    color: var(--text-primary);
}

.backup-tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* Tab panes */
.backup-tab-pane { display: none; }
.backup-tab-pane.active { display: block; animation: fadeIn 0.2s ease; }

/* Select controls */
.backup-select-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.backup-select-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-left: auto;
}

/* Preview list */
.backup-preview-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 18px;
    max-height: 420px;
    overflow-y: auto;
    padding-right: 4px;
}

.backup-preview-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border var(--transition);
    flex-wrap: wrap;
}

.backup-preview-row:hover { border-color: var(--border-light); }

.backup-checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    flex-shrink: 0;
}

.backup-checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
    flex-shrink: 0;
}

.backup-app-name {
    font-weight: 600;
    font-size: 0.9rem;
    min-width: 120px;
}

.backup-app-items {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex: 1;
}

/* Badges for backup items */
.backup-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 500;
    white-space: nowrap;
}

.backup-badge.env {
    background: rgba(99, 102, 241, 0.12);
    color: var(--accent);
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.backup-badge.config {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.backup-badge.volume {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.backup-badge.db {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.backup-badge.empty {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
}

/* Backup form footer */
.backup-form-footer {
    display: flex;
    align-items: flex-end;
    gap: 14px;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    flex-wrap: wrap;
}

/* Progress log */
.backup-progress-log {
    margin-top: 14px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.78rem;
    line-height: 1.6;
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
    color: var(--text-secondary);
}

/* History tab */
.backup-history-header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin-bottom: 14px;
}

.backup-stats {
    display: flex;
    gap: 16px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.backup-stats span strong {
    color: var(--text-primary);
}

.backup-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.backup-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border var(--transition);
    gap: 12px;
}

.backup-item:hover { border-color: var(--accent); }

.backup-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    flex: 1;
}

.backup-name {
    font-weight: 500;
    font-family: monospace;
    font-size: 0.9rem;
    word-break: break-all;
}

.backup-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.backup-meta i { width: 13px; height: 13px; vertical-align: -2px; margin-right: 2px; }

/* Destinations tab */
.backup-destinations-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}

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

/* Destination type selector */
.dest-type-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}

.dest-type-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--transition);
}

.dest-type-btn i { width: 14px; height: 14px; }

.dest-type-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.dest-type-btn.active {
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--accent);
    color: var(--accent);
}

/* --- Settings --- */
.settings-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}

.settings-section h3 {
    font-size: 1rem;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.settings-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

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

.settings-label { color: var(--text-secondary); }
.settings-value { color: var(--text-primary); font-weight: 500; }

/* --- Loading spinner --- */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* --- Toast notifications --- */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    color: white;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
    max-width: 400px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--info); }

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

/* --- Empty state --- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i { width: 48px; height: 48px; margin-bottom: 16px; }
.empty-state p { font-size: 0.95rem; }

/* --- Responsive --- */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

    .main-content {
        margin-left: 0;
    }

    .header {
        padding: 12px 16px;
    }

    .system-stats {
        display: none;
    }

    .content {
        padding: 16px;
    }

    .app-grid, .catalog-grid {
        grid-template-columns: 1fr;
    }
}

/* --- Page transitions --- */
.page { display: none; }
.page.active { display: block; animation: fadeIn 0.2s ease; }

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
