:root {
    /* Color Palette */
    --slate-50: #f8fafc;
    --slate-100: #f1f5f9;
    --slate-200: #e2e8f0;
    --slate-300: #cbd5e1;
    --slate-400: #94a3b8;
    --slate-500: #64748b;
    --slate-600: #475569;
    --slate-700: #334155;
    --slate-800: #1e293b;
    --slate-900: #0f172a;

    --indigo-500: #6366f1;
    --indigo-600: #4f46e5;
    --indigo-700: #4338ca;
    --emerald-500: #10b981;
    --rose-500: #f43f5e;
    --amber-500: #f59e0b;

    /* Teal / Emerald accent (2026 Modern-Minimal redesign) */
    --teal-50:  #f0fdfa;
    --teal-100: #ccfbf1;
    --teal-400: #2dd4bf;
    --teal-500: #14b8a6;
    --teal-600: #0d9488;
    --teal-700: #0f766e;
    --teal-800: #115e59;

    /* Theme Variables */
    --primary: var(--teal-600);
    --primary-hover: var(--teal-700);
    --primary-soft: var(--teal-50);
    --ring: 0 0 0 3px rgba(13, 148, 136, 0.18);
    --bg-main: #f7f8fa;
    --bg-sidebar: #ffffff;
    --card-bg: #ffffff;
    --text-main: var(--slate-900);
    --text-muted: var(--slate-500);
    --border: #e9edf1;
    --border-strong: var(--slate-200);
    --terminal-header-bg: #0f766e;
    --terminal-bg: #0b0f19;
    --terminal-text: #e2e8f0;
    --terminal-border: #134e4a;
    --terminal-system: #5eead4;
    --terminal-success: #34d399;
    --terminal-error: #fb7185;
    --accent: var(--teal-600);
    --font-main: 'Inter', sans-serif;
    --font-mono: 'Fira Code', monospace;

    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04);
    --shadow: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
    --shadow-lg: 0 12px 32px -8px rgba(16, 24, 40, 0.14);
    --radius: 0.625rem;
}

/* --- CYBERPUNK (NEON) THEME --- */
[data-theme="cyberpunk"] {
    --primary: #00f3ff;
    --primary-hover: #bc00ff;
    --bg-main: #050505;
    --bg-sidebar: #0a0a0a;
    --card-bg: #0f0f0f;
    --text-main: #00f3ff;
    --text-muted: #bc00ff;
    --border: #bc00ff44;
    --terminal-header-bg: #170024;
    --terminal-bg: #000000;
    --terminal-text: #00f3ff;
    --terminal-border: #bc00ff;
    --terminal-system: #bc00ff;
    --terminal-success: #39ff14;
    --terminal-error: #ff2a6d;
    --accent: #bc00ff;
    --font-main: 'Orbitron', sans-serif;
    --shadow: 0 0 10px rgba(0, 243, 255, 0.3);
    --shadow-lg: 0 0 20px rgba(188, 0, 255, 0.4);
}
[data-theme="cyberpunk"] .card, 
[data-theme="cyberpunk"] .metric-card,
[data-theme="cyberpunk"] .admin-form-box { 
    border: 1px solid var(--primary); 
    box-shadow: 0 0 8px var(--primary), inset 0 0 8px rgba(0, 243, 255, 0.1); 
}
[data-theme="cyberpunk"] .sidebar { border-bottom: 2px solid var(--accent); box-shadow: 0 0 15px var(--accent); }
[data-theme="cyberpunk"] .nav-item.active { background: var(--accent); box-shadow: 0 0 15px var(--accent); }

/* --- AURA (AI DARK) THEME --- */
[data-theme="aura"] {
    --primary: #facc15;
    --primary-hover: #f472b6;
    --bg-main: #0a0a0c;
    --bg-sidebar: #141414;
    --card-bg: rgba(20, 20, 20, 0.8);
    --text-main: #ffffff;
    --text-muted: #a3a3a3;
    --border: rgba(250, 204, 21, 0.15);
    --terminal-header-bg: #1f1f12;
    --terminal-bg: #050505;
    --terminal-text: #facc15;
    --terminal-border: rgba(250, 204, 21, 0.35);
    --terminal-system: #f472b6;
    --terminal-success: #facc15;
    --terminal-error: #fb7185;
    --accent: #f472b6;
    --font-main: 'Plus Jakarta Sans', sans-serif;
}
[data-theme="aura"] .card,
[data-theme="aura"] .metric-card,
[data-theme="aura"] .admin-form-box { 
    backdrop-filter: blur(12px); 
    border: 1px solid var(--border); 
    box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 0 15px rgba(250, 204, 21, 0.05);
}
[data-theme="aura"] .sidebar-logo { color: var(--primary); }

/* --- AYSCRIM (TACTICAL) THEME --- */
[data-theme="ayscrim"] {
    --primary: #111111;
    --primary-hover: #ff3333;
    --bg-main: #F9F5E3;
    --bg-sidebar: #111111;
    --card-bg: #FFFDF5;
    --text-main: #111111;
    --text-muted: #666666;
    --border: 2px solid #111;
    --terminal-header-bg: #111111;
    --terminal-bg: #111111;
    --terminal-text: #F9F5E3;
    --terminal-border: #ff3333;
    --terminal-system: #ff3333;
    --terminal-success: #10b981;
    --terminal-error: #ff3333;
    --accent: #ff3333;
    --font-main: 'Chakra Petch', sans-serif;
    --radius: 0;
}
[data-theme="ayscrim"] .card,
[data-theme="ayscrim"] .metric-card,
[data-theme="ayscrim"] .admin-form-box { 
    border: 3px solid #111; 
    box-shadow: 10px 10px 0 rgba(17, 17, 17, 1); 
    outline: 1px solid #111;
    outline-offset: 3px;
}

/* Dark Theme (Classic) */
[data-theme="dark"] {
    --bg-main: var(--slate-900);
    --bg-sidebar: #020617;
    --card-bg: var(--slate-800);
    --text-main: var(--slate-100);
    --text-muted: var(--slate-400);
    --border: var(--slate-700);
    --terminal-header-bg: #020617;
    --terminal-bg: #000000;
    --terminal-text: #e2e8f0;
    --terminal-border: var(--slate-700);
    --terminal-system: #93c5fd;
    --terminal-success: #34d399;
    --terminal-error: #fb7185;
    --primary: var(--teal-500);
    --primary-hover: var(--teal-400);
    --accent: var(--teal-500);
    --ring: 0 0 0 3px rgba(20, 184, 166, 0.22);
}
[data-theme="dark"] .card,
[data-theme="dark"] .metric-card,
[data-theme="dark"] .admin-form-box {
    border: 1px solid var(--border);
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
}

[data-theme="light"] .card,
[data-theme="light"] .metric-card,
[data-theme="light"] .admin-form-box {
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

[data-theme="light"] .terminal-section {
    border-color: var(--border);
    box-shadow: var(--shadow-sm);
}

[data-theme="light"] .terminal-header {
    background: var(--teal-50);
    color: var(--slate-800);
    border-bottom: 1px solid var(--teal-100);
}

[data-theme="light"] .terminal-header h2 {
    color: var(--teal-700);
}

[data-theme="light"] .terminal-body {
    background: #ffffff;
    color: var(--slate-800);
}

[data-theme="light"] .terminal-section .clear-btn {
    background: #ffffff;
    color: var(--teal-700);
    border-color: var(--teal-100);
}

[data-theme="light"] .terminal-section .clear-btn:hover {
    background: var(--teal-50);
    color: var(--teal-800);
}

[data-theme="light"] .sidebar {
    background-color: #ffffff;
    box-shadow: none;
    border-right: 1px solid var(--border);
}

[data-theme="light"] .nav-item {
    color: var(--slate-500);
}

[data-theme="light"] .nav-item:hover {
    background-color: var(--slate-100);
    color: var(--slate-900);
}

/* Soft-tinted active nav with a sliding accent bar (light) */
[data-theme="light"] .nav-item.active {
    background-color: var(--teal-50);
    color: var(--teal-700);
}
[data-theme="light"] .nav-item.active::before {
    content: "";
    position: absolute;
    left: -1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    border-radius: 0 3px 3px 0;
    background: var(--primary);
}
[data-theme="light"] .nav-item.active i { color: var(--teal-600); }

[data-theme="light"] .btn-secondary:hover {
    background-color: var(--slate-50);
    border-color: var(--primary);
    color: var(--primary);
}

/* Unified AI Button Base Styles */
.ai-btn {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    border: none;
    border-radius: 0.5rem;
}

/* Theme-specific AI Button Styles */
[data-theme="light"] .ai-btn { background: linear-gradient(135deg, #0d9488, #10b981); color: white; box-shadow: 0 4px 12px rgba(13, 148, 136, 0.22); }
[data-theme="light"] .ai-btn:hover { background: linear-gradient(135deg, #0f766e, #059669); transform: translateY(-1px); box-shadow: 0 6px 16px rgba(13, 148, 136, 0.3); }

[data-theme="dark"] .ai-btn { background: linear-gradient(135deg, #6366f1, #d946ef); color: white; box-shadow: 0 0 15px rgba(99, 102, 241, 0.4); }
[data-theme="dark"] .ai-btn:hover { filter: brightness(1.2); transform: translateY(-1px); box-shadow: 0 0 25px rgba(99, 102, 241, 0.6); }

[data-theme="cyberpunk"] .ai-btn { background: transparent; border: 2px solid #bc00ff; color: #bc00ff; text-shadow: 0 0 8px #bc00ff; box-shadow: 0 0 15px rgba(188, 0, 255, 0.5); font-family: 'Orbitron', sans-serif; }
[data-theme="cyberpunk"] .ai-btn:hover { background: #bc00ff; color: #000; box-shadow: 0 0 25px #bc00ff; text-shadow: none; }

[data-theme="aura"] .ai-btn { background: linear-gradient(135deg, #facc15, #f472b6); color: #000; font-weight: 800; }
[data-theme="aura"] .ai-btn:hover { transform: scale(1.05); box-shadow: 0 0 20px rgba(250, 204, 21, 0.4); }

[data-theme="ayscrim"] .ai-btn { background: #ff3333; color: #000; border: 2px solid #000; font-weight: 900; text-transform: uppercase; border-radius: 0; }
[data-theme="ayscrim"] .ai-btn:hover { background: #000; color: #ff3333; transform: translate(4px, 4px); box-shadow: -4px -4px 0 #ff3333; }

.log-entry.system { color: var(--teal-700); }
[data-theme="light"] .log-entry.success { color: #047857; }
[data-theme="light"] .log-entry.error { color: #be123c; }

.theme-opt {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.875rem;
    transition: background 0.2s;
    border-bottom: 1px solid var(--border);
}

.theme-opt:last-child { border-bottom: none; }

.theme-opt:hover {
    background: var(--bg-main);
    color: var(--primary);
}

[data-theme="cyberpunk"] .theme-opt:hover { background: #bc00ff22; color: #00f3ff; }
[data-theme="aura"] .theme-opt:hover { background: rgba(250, 204, 21, 0.1); color: #facc15; }
[data-theme="ayscrim"] .theme-opt:hover { background: #111; color: #ff3333; }

/* --- LOGIN SCREEN --- */
.login-wrapper {
    position: fixed;
    inset: 0;
    z-index: 5000;
    background: var(--bg-main);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-box {
    width: 100%;
    max-width: 450px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 1.5rem;
    padding: 3rem;
    box-shadow: var(--shadow-lg);
}

[data-theme="dark"] .login-box {
    background: var(--slate-800);
}

[data-theme="cyberpunk"] .login-box {
    border: 2px solid var(--primary);
    box-shadow: 0 0 20px var(--primary);
}

[data-theme="ayscrim"] .login-box {
    border: 3px solid #111;
    box-shadow: 15px 15px 0 #111;
    border-radius: 0;
}

/* Body */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font-main); background-color: var(--bg-main); color: var(--text-main); line-height: 1.5; min-height: 100vh; overflow-x: hidden; overflow-y: auto; transition: background-color 0.3s, color 0.3s; }

/* Dashboard Wrapper — true left-sidebar layout */
.dashboard-wrapper {
    display: flex;
    flex-direction: row; /* Sidebar on the left, content on the right */
    min-height: 100vh;
    width: 100%;
}

.sidebar {
    width: 264px;
    flex-shrink: 0;
    height: 100vh;
    padding: 1.5rem 1rem;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column; /* Stacked vertically */
    align-items: stretch;
    gap: 1.5rem;
    box-sizing: border-box;
    position: sticky;
    top: 0;
    align-self: flex-start;
    z-index: 1000;
}

.sidebar-logo {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    color: var(--primary);
    white-space: nowrap;
    flex-shrink: 0;
    padding: 0.35rem 0.65rem 1.1rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo i {
    font-size: 1.35rem;
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column; /* Stacked items */
    align-items: stretch;
    justify-content: flex-start;
    gap: 0.25rem;
    padding: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
}

.sidebar-nav::-webkit-scrollbar { display: none; }

.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.9rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 0.55rem;
    transition: background 0.18s ease, color 0.18s ease, transform 0.12s ease;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.nav-item:hover, .nav-item.active { background-color: rgba(255,255,255,0.05); color: #fff; }
.nav-item.active { background-color: var(--primary); color: white; }
.nav-item i { font-size: 0.95em; width: 20px; text-align: center; flex-shrink: 0; }

.sidebar-footer {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.85rem;
    flex-shrink: 0;
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

/* Main Content Adjustment */
.main-content {
    flex: 1;
    margin-left: 0;
    padding: 2rem 2.5rem;
    overflow: visible;
    min-width: 0;
}
.top-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem; }
.top-actions { display: flex; gap: 1rem; }
.page-title h1 { font-size: 1.55rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; }
.page-title p { margin-top: 0.25rem; color: var(--text-muted); font-size: 0.9rem; }

.hidden { display: none !important; }

.content-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1.5rem;
}

.full-width,
.metrics-section,
.command-section,
.terminal-section,
#history-section {
    grid-column: 1 / -1;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

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

.card-header h2 {
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

[data-theme="light"] .page-title h1 {
    color: var(--slate-900);
    letter-spacing: -0.02em;
}

[data-theme="light"] .page-title p {
    color: var(--slate-500);
}

[data-theme="light"] .card-header {
    background: var(--card-bg);
}

[data-theme="light"] .card-header h2 {
    color: var(--slate-900);
    letter-spacing: -0.01em;
}

/* Flat, soft-tinted icon chips (minimal look — no gradients) */
[data-theme="light"] .card-header h2 i {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    color: var(--teal-600);
    background: var(--teal-50);
    box-shadow: none;
}

[data-theme="light"] #command-section .card-header h2 i {
    color: #b45309;
    background: #fffbeb;
}

[data-theme="light"] #deployment-form-section .card-header h2 i {
    color: var(--teal-600);
    background: var(--teal-50);
}

[data-theme="light"] #progress-tracker-section .card-header h2 i {
    color: #047857;
    background: #ecfdf5;
}

[data-theme="light"] #terminal-section .card-header h2 i {
    color: var(--slate-600);
    background: var(--slate-100);
}

[data-theme="light"] #history-section .card-header h2 i {
    color: #be123c;
    background: #fff1f2;
}

.card-body {
    padding: 1.25rem;
}

.metrics-section {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}

.metric-card,
.presence-card {
    min-height: 96px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.metric-icon {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 0.85rem;
    font-size: 1.25rem;
    color: white;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
}

.cpu-icon {
    background: linear-gradient(135deg, #4f46e5, #06b6d4);
}

.ram-icon {
    background: linear-gradient(135deg, #f59e0b, #ec4899);
}

.disk-icon {
    background: linear-gradient(135deg, #10b981, #0f766e);
}

/* Minimal light theme: flat soft-tinted metric chips with colored glyphs */
[data-theme="light"] .metric-icon {
    box-shadow: none;
}
[data-theme="light"] .cpu-icon  { background: var(--teal-50); color: var(--teal-600); }
[data-theme="light"] .ram-icon  { background: #fffbeb; color: #b45309; }
[data-theme="light"] .disk-icon { background: #ecfdf5; color: #047857; }

.metric-card canvas {
    width: 120px !important;
    height: 48px !important;
}

.metric-label {
    display: block;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.metric-card strong {
    display: block;
    margin-top: 0.25rem;
    color: var(--primary);
    font-size: 1.65rem;
    line-height: 1;
}

.presence-list {
    display: flex;
    align-items: center;
}

.presence-avatar {
    width: 34px;
    height: 34px;
    margin-left: -8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 2px solid var(--card-bg);
    background: var(--slate-200);
    color: var(--slate-700);
    font-size: 0.75rem;
    font-weight: 800;
}

.presence-avatar.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 0 0 6px color-mix(in srgb, var(--primary) 15%, transparent);
}

.command-bar {
    display: flex;
    gap: 1rem;
    padding: 1rem 1.25rem;
}

.command-bar input,
.input-group input,
.input-group select {
    width: 100%;
    border: 1px solid var(--border-strong);
    border-radius: 0.5rem;
    background: var(--card-bg);
    color: var(--text-main);
    padding: 0.8rem 1rem;
    font-family: inherit;
    font-size: 0.9rem;
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.command-bar input:focus,
.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--ring);
}

.input-group input::placeholder { color: var(--slate-400); }

/* Checkboxes & radios shouldn't inherit the full-width text-input styling */
.input-group input[type="checkbox"],
.input-group input[type="radio"] {
    width: auto;
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
    accent-color: var(--primary);
}

/* Fix for select background in dark/themed modes */
.input-group select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1em;
}


.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    margin-bottom: 1rem;
}

.input-group label {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 700;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: 0;
    border-radius: 0.5rem;
    padding: 0.7rem 1rem;
    cursor: pointer;
    font-weight: 600;
    font-family: inherit;
    font-size: 0.9rem;
    letter-spacing: -0.01em;
    transition: background 0.18s ease, box-shadow 0.18s ease, transform 0.05s ease, color 0.18s ease, border-color 0.18s ease;
}

.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }

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

.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary {
    background: var(--card-bg);
    color: var(--text-main);
    border: 1px solid var(--border-strong);
}

.btn-block { width: 100%; }

.avatar-circle {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    font-weight: 900;
}

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

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    color: var(--text-muted);
    min-width: 70px;
}

.step-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--slate-100);
    border: 1px solid var(--border);
}

.step.active .step-icon,
.step.completed .step-icon {
    background: var(--primary);
    color: white;
}

.step-line {
    flex: 1;
    height: 2px;
    background: var(--border);
}

.status-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    background: var(--bg-main);
}

.status-card.success { border-color: var(--emerald-500); }
.status-card.error { border-color: var(--rose-500); }
.status-card.active { border-color: var(--primary); }

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

.clear-btn,
.mini-btn,
.icon-btn {
    border: 1px solid var(--border);
    border-radius: 0.45rem;
    background: var(--card-bg);
    color: var(--text-main);
    padding: 0.45rem 0.7rem;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.2s;
}

.clear-btn:hover,
.mini-btn:hover,
.icon-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--bg-main);
}

.log-entry { white-space: pre-wrap; }
.log-entry.error { color: var(--terminal-error); }
.log-entry.success { color: var(--terminal-success); }
.log-entry.system { color: var(--terminal-system); }

.table-wrap { overflow-x: auto; }
.history-table {
    width: 100%;
    border-collapse: collapse;
}

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

.history-table th {
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--bg-main);
    border-bottom: 1px solid var(--border-strong);
}

.history-table tbody tr { transition: background 0.15s ease; }
.history-table tbody tr:hover { background: var(--bg-main); }

.highlight-row {
    background-color: rgba(13, 148, 136, 0.08); /* subtle teal highlight */
}

.highlight-row td {
    font-weight: 600;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(2, 6, 23, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    backdrop-filter: blur(8px);
}

.modal-card {
    width: min(720px, 100%);
    max-height: 82vh;
    overflow: auto;
    background: var(--card-bg);
    color: var(--text-main);
    border: 1px solid var(--border);
    border-radius: 1rem;
    box-shadow: var(--shadow-lg);
}

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

.ai-response { padding: 1.25rem; line-height: 1.65; }

.skeleton {
    height: 16px;
    margin-bottom: 0.85rem;
    border-radius: 999px;
    background: linear-gradient(90deg, transparent, rgba(148,163,184,0.22), transparent);
    background-size: 200% 100%;
    animation: shimmer 1.4s infinite;
}

.skeleton.short { width: 76%; }
.skeleton.tiny { width: 48%; }

@keyframes shimmer {
    from { background-position: 200% 0; }
    to { background-position: -200% 0; }
}

#notification-container {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 3000;
    display: grid;
    gap: 0.75rem;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-block;
}
.status-badge.online { background: #dcfce7; color: #166534; }
.status-badge.offline { background: #fee2e2; color: #991b1b; }

.toast {
    min-width: 260px;
    border-radius: 0.75rem;
    padding: 0.9rem 1rem;
    background: var(--slate-900);
    color: white;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease-out;
}

.toast-success { background: #059669; }
.toast-error { background: #dc2626; }
.toast-info { background: #2563eb; }
.toast-warning { background: #d97706; }

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

/* Terminal */
.terminal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--terminal-header-bg);
    color: var(--terminal-text);
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--terminal-border);
}

.terminal-body {
    background-color: var(--terminal-bg);
    color: var(--terminal-text);
    padding: 1.5rem;
    height: 300px;
    overflow-y: auto;
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
}

.terminal-section {
    border-color: var(--terminal-border);
}

.terminal-section .clear-btn {
    border-color: color-mix(in srgb, var(--terminal-border) 55%, transparent);
    background: color-mix(in srgb, var(--terminal-header-bg) 75%, transparent);
    color: var(--terminal-text);
}

.terminal-section .clear-btn:hover {
    border-color: var(--terminal-border);
    color: var(--terminal-system);
}

/* Theme-specific Input Styling */
.theme-input {
    background: var(--card-bg);
    color: var(--text-main);
    border: 1px solid var(--border);
    padding: 0.4rem 0.7rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-family: inherit;
    transition: all 0.2s ease;
    outline: none;
}

.theme-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 20%, transparent);
}

[data-theme="cyberpunk"] .theme-input {
    border-color: var(--primary);
    background: #000;
    text-shadow: 0 0 5px var(--primary);
    box-shadow: 0 0 5px rgba(0, 243, 255, 0.2);
}

[data-theme="aura"] .theme-input {
    background: rgba(20, 20, 20, 0.6);
    backdrop-filter: blur(4px);
}

[data-theme="ayscrim"] .theme-input {
    border: 2px solid #111;
    border-radius: 0;
    box-shadow: 4px 4px 0 #111;
}

[data-theme="ayscrim"] .theme-input:focus {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 #111;
}

/* ================================================================
   ADVANCED UI LAYER — motion, depth & micro-interactions (2026)
   Scoped so it enriches the Modern-Minimal look without touching
   any markup, IDs, or JS behaviour.
   ================================================================ */

html { scroll-behavior: smooth; }

/* NOTE: uses `top` (not transform) so animated cards don't become a
   containing block for the position:fixed custom-dropdown lists inside them. */
@keyframes sl-fade-up { from { opacity: 0; top: 12px; } to { opacity: 1; top: 0; } }
@keyframes sl-fade    { from { opacity: 0; } to { opacity: 1; } }
@keyframes sl-pop     { from { opacity: 0; transform: scale(0.965); } to { opacity: 1; transform: none; } }
@keyframes sl-pulse-dot   { 0% { box-shadow: 0 0 0 0 rgba(16,185,129,0.5); } 70% { box-shadow: 0 0 0 7px rgba(16,185,129,0); } 100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); } }
@keyframes sl-pulse-teal  { 0% { box-shadow: 0 0 0 0 rgba(13,148,136,0.45); } 70% { box-shadow: 0 0 0 8px rgba(13,148,136,0); } 100% { box-shadow: 0 0 0 0 rgba(13,148,136,0); } }
@keyframes sl-grow-x  { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes sl-sheen   { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@keyframes sl-arrow   { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(4px); } }
@keyframes sl-spin    { to { transform: rotate(360deg); } }
@keyframes sl-count-in{ from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Subtle brand wash behind the app (light) */
[data-theme="light"] body {
    background:
        radial-gradient(900px 380px at 100% -8%, rgba(13,148,136,0.06), transparent 60%),
        radial-gradient(720px 320px at -6% 0%, rgba(16,185,129,0.05), transparent 55%),
        var(--bg-main);
    background-attachment: fixed;
}

/* View / card entrance — replays on view switch for a page-transition feel.
   Longer + more travel so it's clearly visible, and staggered across the grid. */
.main-content .card { position: relative; animation: sl-fade-up 0.6s cubic-bezier(0.16,0.84,0.44,1) both; }
.metrics-section .metric-card { position: relative; animation: sl-fade-up 0.6s cubic-bezier(0.16,0.84,0.44,1) both; }

/* Stagger every direct child of the dashboard grid */
.content-grid > *:nth-child(1) { animation-delay: 0.00s; }
.content-grid > *:nth-child(2) { animation-delay: 0.08s; }
.content-grid > *:nth-child(3) { animation-delay: 0.16s; }
.content-grid > *:nth-child(4) { animation-delay: 0.24s; }
.content-grid > *:nth-child(5) { animation-delay: 0.32s; }
.metrics-section .metric-card:nth-child(1) { animation-delay: 0.04s; }
.metrics-section .metric-card:nth-child(2) { animation-delay: 0.12s; }
.metrics-section .metric-card:nth-child(3) { animation-delay: 0.20s; }
.metrics-section .metric-card:nth-child(4) { animation-delay: 0.28s; }

/* Metric bars visibly fill from the left on load */
.metric-bar-fill {
    transform-origin: left center;
    animation: sl-grow-x 1s cubic-bezier(0.16,0.84,0.44,1) 0.35s both;
}

/* Metric numbers count up into place */
.metric-card strong { animation: sl-count-in 0.6s ease 0.3s both; }

/* Main Deploy CTA only: animated gradient sheen sweeping across, and the
   rocket icon gently nudges forward — clearly-visible idle motion on the
   primary action (kept off other buttons so it doesn't look gimmicky) */
#deploy_btn {
    background-image: linear-gradient(110deg,
        var(--primary) 0%,
        color-mix(in srgb, #ffffff 24%, var(--primary)) 45%,
        var(--primary) 90%);
    background-size: 220% 100%;
    animation: sl-sheen 3.2s linear infinite;
}
#deploy_btn i { animation: sl-arrow 1.6s ease-in-out infinite; }

/* Refresh / sync icon buttons spin on hover */
.clear-btn:hover .fa-sync,
.icon-btn:hover .fa-sync { animation: sl-spin 0.7s linear infinite; }

/* Depth on hover */
.card { transition: box-shadow 0.25s ease, transform 0.25s ease, border-color 0.25s ease; }
.metric-card { transition: box-shadow 0.25s ease, transform 0.25s ease, border-color 0.25s ease; }
.metric-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--primary) 28%, var(--border)); }
[data-theme="light"] .card:hover { box-shadow: 0 14px 34px -16px rgba(16,24,40,0.22); border-color: color-mix(in srgb, var(--primary) 16%, var(--border)); }

/* Nav micro-interaction */
.nav-item:hover { transform: translateX(2px); }

/* Glass sticky header that bleeds to the content edges */
.top-bar {
    position: sticky;
    top: 0;
    z-index: 40;
    margin: -2rem -2.5rem 2rem;
    padding: 1.25rem 2.5rem;
    background: color-mix(in srgb, var(--bg-main) 80%, transparent);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

/* Primary button: subtle top sheen + lift */
.btn-primary { background-image: linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0)); box-shadow: 0 1px 2px rgba(16,24,40,0.10); }
.btn-primary:hover { box-shadow: 0 8px 20px -8px color-mix(in srgb, var(--primary) 70%, transparent); transform: translateY(-1px); }

/* Live status dot keeps a gentle heartbeat */
.status-indicator .dot { animation: sl-pulse-dot 2.4s ease-out infinite; }

/* Stepper polish */
.step-icon { transition: background 0.3s ease, color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease; }
.step.active .step-icon { animation: sl-pulse-teal 1.9s ease-out infinite; transform: scale(1.06); }
.step.completed .step-icon { box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--primary) 65%, transparent); }

/* Modal entrance */
.modal { animation: sl-fade 0.2s ease both; }
.modal-card { animation: sl-pop 0.28s cubic-bezier(0.16,0.84,0.44,1) both; }

/* Login screen entrance + wash */
[data-theme="light"] .login-wrapper {
    background:
        radial-gradient(700px 360px at 80% -10%, rgba(13,148,136,0.10), transparent 60%),
        radial-gradient(620px 320px at 10% 110%, rgba(16,185,129,0.08), transparent 55%),
        var(--bg-main);
}
.login-box { animation: sl-pop 0.5s cubic-bezier(0.16,0.84,0.44,1) both; }
.login-box .sidebar-logo { border-bottom: none; padding: 0; }

/* Table rows fade in a touch nicer already via hover; add link affordance */
.nav-item:focus-visible,
a:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 0.4rem; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}

/* ---------------- Responsive: collapse sidebar to a top bar --------------- */
@media (max-width: 900px) {
    html, body { overflow-x: hidden; height: auto; }
    .dashboard-wrapper { flex-direction: column; }
    .sidebar {
        width: 100%;
        height: auto;
        flex-direction: row;
        align-items: center;
        gap: 0.75rem;
        padding: 0.7rem 1rem;
        border-right: none;
        border-bottom: 1px solid var(--border);
        overflow-x: auto;
    }
    .sidebar-logo { border-bottom: none; padding: 0 0.5rem 0 0; font-size: 1.1rem; }
    .sidebar-nav { flex-direction: row; align-items: center; gap: 0.35rem; overflow-x: auto; }
    .sidebar-footer { flex-direction: row; align-items: center; margin-top: 0; margin-left: auto; padding-top: 0; border-top: none; gap: 0.6rem; }
    [data-theme="light"] .nav-item.active::before { display: none; }
    .content-grid,
    .metrics-section,
    .form-row {
        grid-template-columns: 1fr;
    }
    .main-content { padding: 1rem; }
    .top-bar { align-items: flex-start; flex-direction: column; gap: 0.75rem; margin: 0 0 1rem; padding: 0; position: static; background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; border-bottom: none; }
    .top-actions { flex-wrap: wrap; }
}
