:root {
    --bg-base: #080b11;
    --bg-surface: #0f1523;
    --bg-surface-elevated: #161f33;
    --bg-card: rgba(18, 26, 43, 0.7);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(56, 189, 248, 0.3);
    
    --primary: #0284c7;
    --primary-hover: #0369a1;
    --accent-cyan: #38bdf8;
    --accent-emerald: #10b981;
    --accent-rose: #f43f5e;
    --accent-amber: #f59e0b;
    --accent-purple: #8b5cf6;
    
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --text-dim: #64748b;
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    --shadow-subtle: 0 4px 20px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 25px rgba(56, 189, 248, 0.15);
    --font-main: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

body {
    background-color: var(--bg-base);
    color: var(--text-main);
    font-family: var(--font-main);
    height: 100vh;
    overflow: hidden;
    background-image: 
        radial-gradient(at 0% 0%, rgba(2, 132, 199, 0.12) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.08) 0px, transparent 50%);
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* App Layout */
.app-layout {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    gap: 24px;
    flex-shrink: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 8px;
}

.brand-icon {
    position: relative;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #0284c7, #8b5cf6);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 0 15px rgba(2, 132, 199, 0.4);
}

.pulse-dot {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 10px;
    height: 10px;
    background: var(--accent-emerald);
    border-radius: 50%;
    border: 2px solid var(--bg-surface);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.brand-text h2 {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: 1px;
    background: linear-gradient(90deg, #f1f5f9, #38bdf8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.version-tag {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--accent-cyan);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Nav Menu */
.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-main);
}

.nav-item.active {
    background: linear-gradient(90deg, rgba(2, 132, 199, 0.2), rgba(2, 132, 199, 0.05));
    color: var(--accent-cyan);
    border-left: 3px solid var(--accent-cyan);
    font-weight: 600;
}

.badge {
    margin-left: auto;
    font-size: 0.75rem;
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    color: var(--text-main);
}

.badge.script-badge {
    background: rgba(139, 92, 246, 0.2);
    color: #c4b5fd;
}

/* Sidebar Footer */
.sidebar-footer {
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.tunnel-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.status-indicator-mini {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-dim);
}

.status-indicator-mini.online {
    background: var(--accent-emerald);
    box-shadow: 0 0 8px var(--accent-emerald);
}

.tunnel-info {
    display: flex;
    flex-direction: column;
}

.tunnel-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-dim);
}

.tunnel-address {
    font-size: 0.8rem;
    font-family: var(--font-mono);
    color: var(--accent-cyan);
}

/* Main Content Area */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 24px 32px;
    gap: 24px;
}

/* Top Header */
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.header-left h1 {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.quick-stats {
    display: flex;
    gap: 12px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(12px);
    padding: 8px 16px;
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
}

.stat-title {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-dim);
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    font-family: var(--font-mono);
}

.text-emerald { color: var(--accent-emerald); }
.text-cyan { color: var(--accent-cyan); }
.text-rose { color: var(--accent-rose); }
.text-amber { color: var(--accent-amber); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    font-family: var(--font-main);
}

.btn-primary {
    background: linear-gradient(135deg, #0284c7, #0369a1);
    color: white;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0369a1, #075985);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(2, 132, 199, 0.4);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

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

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
}

.btn-ghost:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.btn-lg {
    padding: 12px 24px;
    font-size: 1rem;
}

/* Tabs */
.content-tab {
    display: none;
}

.content-tab.active {
    display: block;
    animation: fadeIn 0.25s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Toolbar */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 8px 14px;
    border-radius: var(--radius-md);
    width: 320px;
}

.search-bar input {
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 0.85rem;
    width: 100%;
    outline: none;
}

.filter-group {
    display: flex;
    gap: 6px;
    background: rgba(0, 0, 0, 0.25);
    padding: 4px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.filter-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: 500;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-btn.active {
    background: var(--bg-surface-elevated);
    color: var(--text-main);
    font-weight: 600;
}

/* Device Cards Grid */
.devices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.device-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(12px);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.device-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--text-dim);
}

.device-card.online::before {
    background: linear-gradient(90deg, var(--accent-emerald), var(--accent-cyan));
}

.device-card:hover {
    transform: translateY(-4px);
    border-color: rgba(56, 189, 248, 0.3);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4), 0 0 20px rgba(2, 132, 199, 0.1);
}

.device-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.device-os-icon {
    font-size: 1.8rem;
}

.device-name-wrap {
    flex: 1;
    margin-left: 12px;
}

.device-hostname {
    font-size: 1.05rem;
    font-weight: 700;
}

.device-os-text {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.status-pill.online {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-emerald);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-pill.offline {
    background: rgba(244, 63, 94, 0.15);
    color: var(--accent-rose);
    border: 1px solid rgba(244, 63, 94, 0.3);
}

/* Device Telemetry Bars */
.device-metrics {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: rgba(0, 0, 0, 0.2);
    padding: 12px;
    border-radius: var(--radius-md);
}

.metric-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.metric-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.progress-track {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #0284c7, #38bdf8);
    border-radius: 3px;
    transition: width 0.4s ease;
}

.device-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

.device-ip {
    font-size: 0.75rem;
    font-family: var(--font-mono);
    color: var(--text-dim);
}

/* Empty State */
.empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    background: var(--bg-card);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-lg);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 12px;
}

.empty-state h3 {
    font-size: 1.2rem;
    margin-bottom: 6px;
}

.empty-state p {
    font-size: 0.85rem;
    color: var(--text-muted);
    max-width: 400px;
    margin-bottom: 16px;
}

.quick-code-snippet {
    background: rgba(0, 0, 0, 0.4);
    padding: 10px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--accent-cyan);
}

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

.script-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    position: relative;
}

.script-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.script-title {
    font-size: 1rem;
    font-weight: 700;
}

.os-tag {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--accent-cyan);
}

.script-preview {
    background: #06090e;
    padding: 10px;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: #94a3b8;
    max-height: 100px;
    overflow: hidden;
    white-space: pre-wrap;
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.script-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
}

/* Cards & Tables */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(12px);
    border-radius: var(--radius-lg);
    padding: 24px;
}

.card-header {
    margin-bottom: 20px;
}

.card-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
}

.card-header p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-dim);
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
}

.table td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

/* Forms */
.form-group {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

.form-control {
    background: #06090e;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    color: var(--text-main);
    font-size: 0.85rem;
    outline: none;
    font-family: var(--font-main);
}

.form-control:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.2);
}

.code-editor {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.4;
    resize: vertical;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Radio Cards (Broadcast Target) */
.radio-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.radio-card {
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.radio-card input {
    accent-color: var(--accent-cyan);
}

.radio-content {
    display: flex;
    flex-direction: column;
}

.radio-title {
    font-size: 0.85rem;
    font-weight: 600;
}

.radio-desc {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Interactive Consent Toggle Box */
.consent-box {
    background: rgba(139, 92, 246, 0.08);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-top: 16px;
}

.consent-header {
    display: flex;
    align-items: center;
    gap: 14px;
}

.consent-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: #c4b5fd;
}

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

/* Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

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

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .3s;
    border-radius: 24px;
}

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

input:checked + .slider {
    background-color: var(--accent-purple);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

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

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

.modal-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 540px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
}

.modal-card.modal-lg {
    max-width: 720px;
}

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

.modal-title-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.modal-sub {
    font-size: 0.75rem;
    color: var(--accent-cyan);
    font-family: var(--font-mono);
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
}

.modal-body {
    padding: 24px;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.2);
}

.tab-pill-group {
    display: flex;
    gap: 8px;
}

.tab-pill {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 8px 12px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
}

.tab-pill.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Interactive Terminal Window (Modal) */
.terminal-window-modal {
    width: 900px;
    max-width: 95vw;
    height: 620px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    background: #05080f;
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(56, 189, 248, 0.1);
    transition: all 0.2s ease;
}

.terminal-window-modal.fullscreen {
    width: 98vw !important;
    height: 95vh !important;
    max-width: 98vw !important;
    max-height: 95vh !important;
}

.terminal-window-header {
    background: #0a0e1a;
    padding: 10px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.terminal-window-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent-cyan);
}

.interactive-terminal-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #030509;
    padding: 12px 16px;
}

.inter-terminal-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.5;
    color: #f1f5f9;
}

.inter-screen-content {
    white-space: pre-wrap;
    word-break: break-all;
}

.inter-input-line {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}

.inter-prompt-symbol {
    color: var(--accent-cyan);
    font-weight: 700;
    font-family: var(--font-mono);
}

.inter-cmd-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #ffffff;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    padding: 2px 0;
}

.inter-cmd-input::placeholder {
    color: rgba(255, 255, 255, 0.25);
}

.terminal-window-footer {
    background: #070a12;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding: 8px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.72rem;
    color: var(--text-muted);
}

.inter-hints code {
    background: rgba(255, 255, 255, 0.08);
    padding: 2px 5px;
    border-radius: 3px;
    color: var(--accent-cyan);
}

.inter-status-text {
    font-weight: 600;
    color: #10b981;
}

/* Floating Terminal Drawer */
.terminal-drawer {
    position: fixed;
    bottom: 0;
    right: 32px;
    width: 720px;
    height: 420px;
    background: #05080f;
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: 12px 12px 0 0;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.7);
    z-index: 500;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    transform: translateY(100%);
}

.terminal-drawer.open {
    transform: translateY(0);
}

.terminal-drawer.minimized {
    transform: translateY(calc(100% - 44px));
}

.terminal-drawer.expanded {
    width: 95vw !important;
    height: 85vh !important;
    right: 2.5vw !important;
    bottom: 15px !important;
    border-radius: 12px !important;
    border-bottom: 1px solid var(--border-color) !important;
}

.terminal-drawer.grid-mode {
    width: 90vw;
    height: 600px;
    right: 5vw;
}

.terminal-header {
    background: #0a0e1a;
    padding: 8px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 12px 12px 0 0;
    user-select: none;
}

.terminal-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--accent-cyan);
    font-family: var(--font-mono);
}

.term-view-toggle {
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 2px;
    gap: 2px;
}

.term-view-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.term-view-btn.active {
    background: var(--primary);
    color: #ffffff;
}

.terminal-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-icon {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.15s ease;
}

.btn-icon:hover {
    color: white;
    background: rgba(255, 255, 255, 0.15);
}

/* Terminal Tabs Bar */
.terminal-tabs-bar {
    display: flex;
    background: #070b14;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    overflow-x: auto;
    padding: 4px 8px 0 8px;
    gap: 4px;
    scrollbar-width: thin;
}

.term-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    padding: 6px 12px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.term-tab:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.term-tab.active {
    background: #04060a;
    color: var(--accent-cyan);
    border-color: rgba(56, 189, 248, 0.3);
    font-weight: 700;
}

.term-tab-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #38bdf8;
}

.term-tab-dot.running {
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
    animation: pulse 1.5s infinite;
}

.term-tab-dot.failed {
    background: #f43f5e;
}

.term-tab-close {
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-left: 4px;
    padding: 0 4px;
    border-radius: 3px;
}

.term-tab-close:hover {
    background: rgba(244, 63, 94, 0.2);
    color: #f43f5e;
}

/* Terminal Panels */
.terminal-views-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #04060a;
    position: relative;
}

.term-panel {
    display: none;
    flex: 1;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.term-panel.active {
    display: flex;
}

.terminal-body {
    flex: 1;
    padding: 14px;
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    line-height: 1.5;
    background: #04060a;
}

/* Grid Mode Layout (Multi-Console View) */
.terminal-views-container.grid-layout {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 12px;
    padding: 12px;
    overflow-y: auto;
}

.terminal-views-container.grid-layout .term-panel {
    display: flex !important;
    height: 280px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: #070b14;
    overflow: hidden;
}

.term-card-header {
    background: #0d1322;
    padding: 6px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent-cyan);
}

.term-card-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.term-line {
    word-break: break-all;
    white-space: pre-wrap;
    margin-bottom: 2px;
}

.term-line.system { color: #38bdf8; }
.term-line.stdout { color: #f1f5f9; }
.term-line.stderr { color: #f43f5e; }
.term-line.success { color: #10b981; font-weight: 700; }
.term-line.warning { color: #f59e0b; }

/* Login Overlay */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(15, 23, 42, 0.95) 0%, rgba(8, 11, 17, 0.98) 100%);
    backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.login-card {
    background: rgba(18, 26, 43, 0.85);
    border: 1px solid rgba(56, 189, 248, 0.2);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 30px rgba(2, 132, 199, 0.2);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 420px;
    padding: 36px 32px;
    text-align: center;
    animation: fadeInScale 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}

.login-header h2 {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: 1px;
    background: linear-gradient(90deg, #f1f5f9, #38bdf8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 4px;
}

.login-header p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 24px;
}

.login-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
    text-align: left;
}

.login-error {
    background: rgba(244, 63, 94, 0.15);
    border: 1px solid rgba(244, 63, 94, 0.3);
    color: var(--accent-rose);
    font-size: 0.8rem;
    padding: 10px;
    border-radius: var(--radius-md);
    text-align: center;
}

.login-footer {
    margin-top: 24px;
    font-size: 0.7rem;
    color: var(--text-dim);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

