/* Open Relay Portal - Shared Styles */

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

/* Custom scrollbar for dark theme */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #12162b;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

::-webkit-scrollbar-corner {
    background: #12162b;
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) #12162b;
}

html {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) #12162b;
}

:root {
    --bg-gradient: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --surface-color: #1e2a4a;
    --text-primary: #e4e4e7;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;
    --accent-blue: #60a5fa;
    --accent-blue-rgb: 96, 165, 250;
    --accent-red: #ef4444;
    --accent-green: #22c55e;
    --accent-yellow: #fbbf24;
    --accent-purple: #a78bfa;
    --card-bg: rgba(255, 255, 255, 0.05);
    --card-border: rgba(255, 255, 255, 0.1);
    --card-hover: rgba(255, 255, 255, 0.08);
    --code-bg: rgba(0, 0, 0, 0.3);
    --code-text: #a5f3fc;
    --focus-ring: 0 0 0 3px rgba(96, 165, 250, 0.4);
    --status-connected: var(--accent-green);
    --status-connecting: #eab308;
    --status-disconnected: var(--accent-red);
    --offline-badge-bg: rgba(113, 113, 122, 0.9);
}

/* Accessibility - Focus states */
:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

/* Skip link for accessibility */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--accent-blue);
    color: #fff;
    padding: 8px 16px;
    z-index: 10000;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 0;
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Touch-friendly defaults for mobile devices */
@media (pointer: coarse) {
    .btn, .btn-sm, .btn-icon, button,
    .tab-btn, select, .toggle,
    .navbar-menu a, .context-menu-item {
        min-height: 44px;
    }
    .btn-sm {
        padding: 0.5rem 0.75rem;
    }
    input, select, textarea {
        font-size: 16px; /* Prevent iOS auto-zoom */
    }
    * {
        -webkit-tap-highlight-color: rgba(96, 165, 250, 0.15);
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.5;
}

/* Layout */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Portal Branding */
.portal-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    color: var(--accent-blue);
    margin-bottom: 1.5rem;
}

.portal-brand svg {
    width: 14px;
    height: 14px;
}

/* Cards */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1.5rem;
}

.card:hover {
    background: var(--card-hover);
}

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

.form-group label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--code-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:hover:not(:focus) {
    border-color: rgba(255, 255, 255, 0.2);
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--code-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23a1a1aa'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.25rem;
    padding-right: 2.5rem;
}

.form-group select:hover:not(:focus) {
    border-color: rgba(255, 255, 255, 0.2);
}

.form-group select:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2);
}

.form-group select option,
.form-group select optgroup {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.form-group select optgroup {
    font-weight: 600;
    color: var(--accent-blue);
}

.form-group small {
    display: block;
    margin-top: 0.25rem;
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-primary {
    background: var(--accent-blue);
    color: #fff;
}

.btn-block {
    width: 100%;
}

.btn-primary:hover:not(:disabled) {
    background: #3b82f6;
    transform: translateY(-1px);
}

.btn-primary:focus-visible {
    box-shadow: var(--focus-ring);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

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

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

.btn-danger {
    background: rgba(239, 68, 68, 0.2);
    color: var(--accent-red);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.3);
}

/* Login Container */
.login-container {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
}

.login-container .card {
    padding: 2rem;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 1rem;
}

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

.login-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto;
    background: rgba(96, 165, 250, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(96, 165, 250, 0.3);
}

.login-icon svg {
    width: 40px;
    height: 40px;
    stroke: var(--accent-blue);
}

/* Error Message */
.error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--accent-red);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    margin-bottom: 1.25rem;
}

/* Navbar */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--card-border);
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.navbar-brand svg {
    width: 24px;
    height: 24px;
    color: var(--accent-blue);
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.navbar-menu a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s;
}

.navbar-menu a:hover {
    color: var(--text-primary);
}

.navbar-terminal {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    color: var(--text-secondary);
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    transition: all 0.2s;
}

.navbar-terminal:hover {
    color: var(--accent-blue);
    background: var(--card-hover);
    border-color: var(--accent-blue);
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Navbar Hamburger Toggle */
.navbar-toggle {
    display: none;
    background: none;
    border: 1px solid var(--card-border);
    border-radius: 6px;
    padding: 0.4rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s, border-color 0.2s;
}

.navbar-toggle:hover {
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.2);
}

.navbar-toggle svg {
    width: 20px;
    height: 20px;
    display: block;
}

/* Dashboard Layout */
.dashboard {
    display: flex;
    min-height: calc(100vh - 65px);
    padding-bottom: 1.5rem;
}

.sidebar {
    width: 240px;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.1);
    border-right: 1px solid var(--card-border);
}

.sidebar h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.sidebar ul {
    list-style: none;
}

.sidebar li {
    margin-bottom: 0.5rem;
}

.sidebar a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.2s;
}

.sidebar a:hover,
.sidebar a.active {
    background: var(--card-bg);
    color: var(--text-primary);
}

.sidebar a svg {
    width: 18px;
    height: 18px;
}

.main-content {
    flex: 1;
    padding: 2rem;
    padding-bottom: 3rem;
}

.main-content h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

/* Services Grid */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.service-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple));
    opacity: 0;
    transition: opacity 0.2s ease;
}

.service-card:hover {
    background: var(--card-hover);
    transform: translateY(-2px);
    border-color: var(--accent-blue);
    box-shadow: 0 8px 25px -5px rgba(59, 130, 246, 0.15);
}

.service-card:hover::before {
    opacity: 1;
}

.service-card-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.service-icon {
    width: 48px;
    height: 48px;
    background: rgba(96, 165, 250, 0.1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.service-icon svg {
    width: 24px;
    height: 24px;
    color: var(--accent-blue);
}

.service-info {
    flex: 1;
    min-width: 0;
}

.service-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

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

.service-status {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
}

.service-status.online {
    background: rgba(34, 197, 94, 0.1);
    color: var(--accent-green);
}

.service-status.offline {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-red);
}

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

.service-status.online .service-status-dot {
    animation: pulse-green 2s ease-in-out infinite;
}

@keyframes pulse-green {
    0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4); }
    50% { box-shadow: 0 0 0 4px rgba(34, 197, 94, 0); }
}

/* Service type badges */
.service-type-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.6rem;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    margin-left: 0.5rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    vertical-align: middle;
}

.service-type-badge.managed {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(168, 85, 247, 0.2));
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.service-type-badge.proxy {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(96, 165, 250, 0.2));
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

/* Service process control buttons */
.service-start-btn,
.service-stop-btn {
    padding: 0.375rem;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.service-start-btn svg,
.service-stop-btn svg {
    width: 18px;
    height: 18px;
    transition: transform 0.15s ease;
}

.service-start-btn {
    color: var(--accent-green);
}

.service-start-btn:hover {
    background: rgba(34, 197, 94, 0.2);
    transform: scale(1.1);
}

.service-start-btn:hover svg {
    transform: scale(1.05);
}

.service-stop-btn {
    color: var(--accent-red);
}

.service-stop-btn:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* Terminal Page */
.terminal-page {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.terminal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid var(--card-border);
}

.terminal-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.terminal-title svg {
    width: 20px;
    height: 20px;
    color: var(--accent-blue);
}

.terminal-title span {
    font-weight: 500;
}

.terminal-controls {
    display: flex;
    gap: 0.5rem;
}

#terminal-container {
    flex: 1;
    padding: 0.5rem;
    background: #000;
}

/* VNC Page */
.vnc-page {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.vnc-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid var(--card-border);
}

.vnc-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.vnc-title svg {
    width: 20px;
    height: 20px;
    color: var(--accent-blue);
}

.vnc-title span {
    font-weight: 500;
}

.vnc-controls {
    display: flex;
    gap: 0.5rem;
}

#vnc-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    overflow: hidden;
}

/* Loading Spinner */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    color: var(--text-secondary);
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--card-border);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-size: 1.125rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

/* Admin Badge */
.admin-badge {
    background: rgba(96, 165, 250, 0.2);
    color: var(--accent-blue);
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
}

.modal-content {
    position: relative;
    background: var(--bg-primary);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    width: 100%;
    max-width: 450px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn 0.2s ease;
}

.modal-large {
    max-width: 700px;
}

.modal-xlarge {
    max-width: 900px;
    height: 80vh;
    display: flex;
    flex-direction: column;
}

.modal-xlarge .modal-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

.modal-header h3 {
    font-size: 1.125rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

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

.modal-body {
    padding: 1.5rem;
}

.modal-content form {
    padding: 1.5rem;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--card-border);
    margin-top: 0.5rem;
}

/* Responsive table wrapper */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Data Table */
.data-table {
    width: 100%;
    min-width: 500px;
    border-collapse: collapse;
}

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

.data-table th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.2);
}

.data-table td {
    font-size: 0.875rem;
    color: var(--text-primary);
}

.data-table tbody tr:hover {
    background: var(--card-hover);
}

/* Toggle Switch */
.toggle {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

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

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

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background: var(--text-secondary);
    border-radius: 50%;
    transition: 0.2s;
}

.toggle input:checked + .toggle-slider {
    background: rgba(96, 165, 250, 0.3);
    border-color: var(--accent-blue);
}

.toggle input:checked + .toggle-slider:before {
    transform: translateX(18px);
    background: var(--accent-blue);
}

.toggle input:disabled + .toggle-slider {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Small button variant */
.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
}

/* Invite Code Display */
.invite-code-display {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--accent-blue);
    background: var(--code-bg);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--card-border);
    letter-spacing: 0.1em;
    user-select: all;
}

/* Service Card Delete Button */
.service-card {
    position: relative;
}

.service-admin-btns {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.service-card:hover .service-admin-btns {
    opacity: 1;
}

.service-edit-btn,
.service-delete-btn {
    width: 24px;
    height: 24px;
    padding: 0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.service-edit-btn {
    background: rgba(96, 165, 250, 0.1);
    border: 1px solid rgba(96, 165, 250, 0.3);
    color: var(--accent-blue);
}

.service-edit-btn:hover {
    background: rgba(96, 165, 250, 0.2);
    border-color: var(--accent-blue);
}

.service-delete-btn {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--accent-red);
}

.service-delete-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--accent-red);
}

.service-edit-btn svg,
.service-delete-btn svg {
    width: 14px;
    height: 14px;
}

/* Select Input */
select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--code-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23a1a1aa'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
}

select:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2);
}

select option {
    background: var(--bg-primary);
    color: var(--text-primary);
}

/* Logs Viewer */
.logs-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.logs-controls-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.logs-controls-right {
    display: flex;
    gap: 0.5rem;
}

.logs-controls select {
    width: auto;
    padding: 0.5rem 2rem 0.5rem 0.75rem;
    font-size: 0.875rem;
}

.logs-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.logs-checkbox input {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.logs-container {
    flex: 1;
    background: #0d1117;
    border: 1px solid var(--card-border);
    border-radius: 8px;
    overflow: auto;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.75rem;
    line-height: 1.5;
}

.logs-content {
    padding: 0.75rem;
    white-space: pre;
    color: #c9d1d9;
}

.log-line {
    padding: 0.125rem 0;
}

.log-line.level-DEBUG { color: #8b949e; }
.log-line.level-INFO { color: #c9d1d9; }
.log-line.level-WARNING { color: #d29922; }
.log-line.level-ERROR { color: #f85149; }
.log-line.level-CRITICAL { color: #ff7b72; font-weight: bold; }

/* Responsive */
@media (max-width: 768px) {
    .dashboard {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--card-border);
    }

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

    .navbar {
        padding: 1rem;
        flex-wrap: wrap;
    }

    .navbar-toggle {
        display: block;
    }

    .navbar-menu {
        display: none;
        width: 100%;
        flex-direction: column;
        gap: 0;
        padding-top: 0.75rem;
        margin-top: 0.75rem;
        border-top: 1px solid var(--card-border);
    }

    .navbar-menu.open {
        display: flex;
    }

    .navbar-menu a {
        padding: 0.6rem 0.5rem;
        border-radius: 6px;
    }

    .navbar-menu a:hover {
        background: var(--card-hover);
    }

    .navbar-terminal {
        width: auto;
        height: auto;
        background: none;
        border: none;
        justify-content: flex-start;
        gap: 0.5rem;
        padding: 0.6rem 0.5rem;
    }

    .navbar-terminal::after {
        content: 'Terminal';
        font-size: 0.875rem;
    }

    .navbar-user {
        padding: 0.6rem 0.5rem;
    }

    .modal-content {
        margin: 1rem;
        max-height: calc(100vh - 2rem);
    }

    .modal-large {
        max-width: calc(100vw - 2rem);
    }

    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .stat-card {
        padding: 0.5rem 0.625rem;
    }

    .stat-icon {
        width: 28px;
        height: 28px;
    }

    .stat-icon svg {
        width: 14px;
        height: 14px;
    }

    .stat-value {
        font-size: 0.875rem;
    }

    .content-tabs {
        gap: 0.25rem;
    }

    .tab-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }

    .quick-access-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .quick-card {
        padding: 1rem;
    }

    .quick-icon {
        width: 44px;
        height: 44px;
    }

    .quick-icon svg {
        width: 22px;
        height: 22px;
    }
}

/* SSH Keys Styles */
.ssh-keys-actions {
    margin-bottom: 1.5rem;
}

.create-key-form {
    background: var(--code-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.create-key-form h4 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.form-row {
    display: flex;
    gap: 1rem;
}

.form-row .form-group {
    flex: 1;
}

.new-key-display {
    background: var(--code-bg);
    border: 1px solid var(--accent-blue);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.alert {
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.alert-warning {
    background: rgba(234, 179, 8, 0.15);
    border: 1px solid rgba(234, 179, 8, 0.3);
    color: #fbbf24;
}

.key-info {
    margin-bottom: 1rem;
}

.key-info p {
    margin-bottom: 0.5rem;
}

.key-textarea {
    width: 100%;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
    font-size: 0.75rem;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    color: var(--code-text);
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    resize: vertical;
    min-height: 150px;
}

.key-textarea-small {
    min-height: 80px;
}

.monospace {
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Code', monospace;
}

.fingerprint {
    font-size: 0.75rem;
    color: var(--code-text);
    word-break: break-all;
}

.badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
}

.empty-state-small {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

.empty-state-small p {
    margin: 0;
}

/* Button icon alignment */
.btn svg {
    vertical-align: middle;
    margin-right: 0.25rem;
}

.btn-sm svg {
    margin-right: 0;
}

/* Profile Modal */
.profile-info {
    background: var(--code-bg);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.profile-info p {
    margin: 0.5rem 0;
}

.navbar-user {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s;
}

.navbar-user:hover {
    color: var(--accent-blue);
}

/* Session timeout banner */
.session-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 0.75rem 1rem;
    background: rgba(251, 191, 36, 0.95);
    color: #1a1a2e;
    text-align: center;
    font-size: 0.875rem;
    font-weight: 500;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    animation: slideDown 0.3s ease;
}

.session-banner.hidden {
    display: none;
}

.session-banner button {
    background: #1a1a2e;
    color: #fff;
    border: none;
    padding: 0.375rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    cursor: pointer;
}

.session-banner button:hover {
    background: #16213e;
}

@keyframes slideDown {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}

/* Info banner */
.info-banner {
    background: rgba(96, 165, 250, 0.1);
    border: 1px solid rgba(96, 165, 250, 0.3);
    color: var(--accent-blue);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.info-banner svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Warning banner */
.warning-banner {
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.3);
    color: var(--accent-yellow);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.warning-banner svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --card-border: rgba(255, 255, 255, 0.3);
        --text-muted: #a1a1aa;
    }

    .btn-primary {
        border: 2px solid #fff;
    }
}

/* Status indicators */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-dot.online {
    background: var(--accent-green);
}

.status-dot.offline {
    background: var(--accent-red);
    animation: none;
}

.status-dot.warning {
    background: var(--accent-yellow);
}

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

/* Traffic metrics styles */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.metric-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 1rem;
}

.metric-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.metric-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.metric-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.metric-change {
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.metric-change.positive {
    color: var(--accent-green);
}

.metric-change.negative {
    color: var(--accent-red);
}

/* Shodan/security scan styles */
.scan-results {
    background: var(--code-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    overflow: hidden;
}

.scan-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--card-border);
}

.scan-header h4 {
    font-size: 0.875rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.scan-body {
    padding: 1rem;
    max-height: 300px;
    overflow-y: auto;
}

.port-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    background: rgba(255, 255, 255, 0.02);
}

.port-number {
    font-family: monospace;
    font-size: 0.875rem;
    color: var(--accent-blue);
    min-width: 60px;
}

.port-service {
    font-size: 0.875rem;
    color: var(--text-primary);
}

.port-product {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: auto;
}

.vulnerability-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
}

.vulnerability-badge.critical {
    background: rgba(239, 68, 68, 0.2);
    color: var(--accent-red);
}

.vulnerability-badge.high {
    background: rgba(249, 115, 22, 0.2);
    color: #f97316;
}

.vulnerability-badge.medium {
    background: rgba(251, 191, 36, 0.2);
    color: var(--accent-yellow);
}

.vulnerability-badge.low {
    background: rgba(34, 197, 94, 0.2);
    color: var(--accent-green);
}

/* =============================================================================
   API Keys & User Connections Styles
   ============================================================================= */

/* API Keys actions */
.api-keys-actions,
.connections-actions {
    margin-bottom: 1.5rem;
}

/* Badge variants */
.badge-success {
    background: rgba(34, 197, 94, 0.2);
    color: var(--accent-green);
}

.badge-warning {
    background: rgba(251, 191, 36, 0.2);
    color: var(--accent-yellow);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: var(--accent-red);
}

/* Inactive row styling */
.row-inactive {
    opacity: 0.6;
}

.row-inactive:hover {
    opacity: 0.8;
}

/* Connections Grid */
.connections-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.connection-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: all 0.2s;
    position: relative;
}

.connection-card-pinned {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 1px var(--accent-blue);
}

.connection-card:hover {
    background: var(--card-hover);
    border-color: var(--accent-blue);
    transform: translateY(-2px);
}

.connection-card-actions {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.2s;
}

.connection-card:hover .connection-card-actions {
    opacity: 1;
}

.btn-icon {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-secondary);
    padding: 0.375rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
}

.btn-icon-danger:hover {
    background: rgba(239, 68, 68, 0.2);
    color: var(--accent-red);
}

.connection-icon {
    width: 48px;
    height: 48px;
    background: rgba(96, 165, 250, 0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
}

.connection-icon svg {
    width: 24px;
    height: 24px;
    color: var(--accent-blue);
}

.connection-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.connection-type {
    font-size: 0.75rem;
    color: var(--accent-blue);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.connection-host {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-family: monospace;
    margin-bottom: 1rem;
    word-break: break-all;
}

.connection-connect-btn {
    width: 100%;
}

/* Connection type specific fields */
.connection-type-fields {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--card-border);
}

/* Warning button */
.btn-warning {
    background: rgba(251, 191, 36, 0.2);
    color: var(--accent-yellow);
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.btn-warning:hover {
    background: rgba(251, 191, 36, 0.3);
}

/* ============================================
   Dashboard Stats Cards
   ============================================ */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.stat-card:hover {
    background: var(--card-hover);
}

.stat-card-clickable {
    cursor: pointer;
}

.stat-card-clickable:hover {
    border-color: var(--accent-blue);
    transform: translateY(-2px);
}

.stat-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon svg {
    width: 16px;
    height: 16px;
}

.stat-icon-blue {
    background: rgba(96, 165, 250, 0.15);
    color: var(--accent-blue);
}

.stat-icon-green {
    background: rgba(34, 197, 94, 0.15);
    color: var(--accent-green);
}

.stat-icon-purple {
    background: rgba(168, 85, 247, 0.15);
    color: #a855f7;
}

.stat-icon-yellow {
    background: rgba(251, 191, 36, 0.15);
    color: var(--accent-yellow);
}

.stat-icon-red {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

.stat-content {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.stat-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.625rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ============================================
   Content Tabs
   ============================================ */
.content-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 0.5rem;
    overflow-x: auto;
}

.tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

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

.tab-btn.active {
    background: rgba(96, 165, 250, 0.15);
    color: var(--accent-blue);
}

.tab-btn svg {
    flex-shrink: 0;
}

.tab-content {
    display: none;
}

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

.tab-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.tab-header h2 {
    margin-bottom: 0;
}

.tab-actions {
    display: flex;
    gap: 0.5rem;
}

.tab-description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

/* ============================================
   Quick Access Grid
   ============================================ */
.quick-access-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.quick-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.quick-card:hover {
    background: var(--card-hover);
    transform: translateY(-2px);
    border-color: var(--accent-blue);
}

.quick-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 1rem;
    background: rgba(96, 165, 250, 0.15);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-blue);
}

.quick-icon svg {
    width: 28px;
    height: 28px;
}

.quick-icon-admin {
    background: rgba(251, 191, 36, 0.15);
    color: var(--accent-yellow);
}

.quick-card h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.quick-card p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.4;
}

/* Inline connections grid (in tab) */
#inline-connections-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

/* Mid-size phones */
@media (max-width: 600px) {
    .form-row {
        flex-direction: column;
    }

    .services-grid,
    .connections-grid {
        grid-template-columns: 1fr;
    }

    .stream-key-display {
        flex-direction: column;
        align-items: stretch;
    }

    .obs-setting-row {
        flex-direction: column;
        gap: 0.25rem;
    }

    .vod-file-row {
        padding: 0.65rem 0.75rem 0.65rem 1.25rem;
    }

    .vod-file-size, .vod-file-date {
        display: none;
    }
}

@media (max-width: 480px) {
    .dashboard-stats {
        grid-template-columns: 1fr 1fr;
    }

    .stat-label {
        font-size: 0.65rem;
    }

    .quick-access-grid {
        grid-template-columns: 1fr;
    }

    .navbar {
        padding: 0.75rem 1rem;
    }

    .navbar-brand {
        font-size: 1rem;
    }

    .card {
        padding: 1rem;
        border-radius: 8px;
    }

    .modal-content {
        margin: 0.5rem;
        border-radius: 8px;
        max-height: calc(100vh - 1rem);
    }

    .modal-large, .modal-xlarge {
        max-width: calc(100vw - 1rem);
        height: auto;
        max-height: calc(100vh - 1rem);
    }

    .modal-header {
        padding: 1rem;
    }

    .modal-body {
        padding: 1rem;
    }

    .log-container {
        white-space: pre-wrap;
        word-break: break-all;
    }
}

/* Ultra-small phones */
@media (max-width: 360px) {
    .dashboard-stats {
        grid-template-columns: 1fr;
    }

    .tab-btn {
        padding: 0.4rem 0.5rem;
        font-size: 0.75rem;
    }

    .content-tabs {
        flex-wrap: wrap;
    }

    .navbar-brand span {
        display: none;
    }
}

/* =====================
   Streaming Components
   ===================== */

/* Stream Cards */
.stream-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1.25rem;
    transition: transform 0.2s, border-color 0.2s;
}

.stream-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent-blue);
}

.stream-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.stream-card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.stream-card-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.stream-status {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.stream-status.live {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.stream-status.offline {
    background: rgba(113, 113, 122, 0.15);
    color: var(--text-muted);
}

.stream-status.encoding {
    background: rgba(217, 119, 6, 0.15);
    color: #d97706;
}

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

.stream-status.live .stream-status-dot {
    animation: pulse 1.5s infinite;
}

.stream-meta {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.stream-meta-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.stream-meta-item svg {
    width: 14px;
    height: 14px;
}

.stream-card-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.stream-visibility-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
}

.stream-visibility-badge.public {
    background: rgba(34, 197, 94, 0.15);
    color: var(--accent-green);
}

.stream-visibility-badge.private {
    background: rgba(251, 191, 36, 0.15);
    color: var(--accent-yellow);
}

/* Stream Details Modal Content */
.stream-details-section {
    margin-bottom: 1.5rem;
}

.stream-details-section h4 {
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.stream-key-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--code-bg);
    padding: 0.75rem;
    border-radius: 8px;
    font-family: monospace;
    font-size: 0.85rem;
}

.stream-key-display input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--code-text);
    font-family: monospace;
    font-size: 0.85rem;
}

.stream-key-display input:focus {
    outline: none;
}

.obs-settings {
    background: var(--code-bg);
    padding: 1rem;
    border-radius: 8px;
}

.obs-setting-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

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

.obs-setting-label {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.obs-setting-value {
    color: var(--text-primary);
    font-family: monospace;
    font-size: 0.85rem;
    user-select: all;
}

/* Stream Viewer (Fullscreen Modal) */
.modal-fullscreen {
    width: 95vw;
    max-width: 1600px;
    height: 90vh;
    max-height: 90vh;
}

.stream-viewer {
    display: flex;
    height: calc(90vh - 60px);
    gap: 1rem;
}

.stream-video-container {
    flex: 1;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stream-video-container video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.stream-chat-container {
    width: 320px;
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
}

.stream-chat-container .chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stream-chat-container .chat-input-form {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem;
    border-top: 1px solid var(--card-border);
}

.stream-chat-container .chat-input-form input {
    flex: 1;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.stream-chat-container .chat-input-form input:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.chat-message {
    padding: 0.5rem;
    border-radius: 6px;
    background: rgba(0,0,0,0.2);
}

.chat-message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.25rem;
}

.chat-message-user {
    font-weight: 600;
    color: var(--accent-blue);
    font-size: 0.8rem;
}

.chat-message-time {
    color: var(--text-muted);
    font-size: 0.7rem;
}

.chat-message-content {
    color: var(--text-primary);
    font-size: 0.875rem;
    word-wrap: break-word;
}

/* Community stream cards */
.community-stream-card {
    cursor: pointer;
    position: relative;
}

.community-stream-card:hover {
    border-color: var(--accent-green);
}

.community-stream-thumbnail {
    width: 100%;
    aspect-ratio: 16/9;
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    overflow: hidden;
}

.community-stream-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.community-stream-thumbnail svg {
    width: 48px;
    height: 48px;
}

/* Stream cards with thumbnails */
.stream-card.has-thumbnail {
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
}

.stream-card.has-thumbnail .stream-thumbnail {
    width: 100%;
    aspect-ratio: 16/9;
    background: rgba(0,0,0,0.4);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.stream-card.has-thumbnail .stream-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.stream-card.has-thumbnail .stream-thumbnail-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--text-muted);
}

.stream-card.has-thumbnail .stream-thumbnail-placeholder svg {
    width: 48px;
    height: 48px;
    opacity: 0.5;
}

.stream-card.has-thumbnail .stream-live-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: var(--accent-red);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.stream-card.has-thumbnail .stream-live-badge .pulse {
    width: 6px;
    height: 6px;
    background: white;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

.stream-card.has-thumbnail .stream-offline-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: var(--offline-badge-bg);
    color: rgba(255, 255, 255, 0.8);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
}

.stream-card.has-thumbnail .stream-encoding-badge,
.stream-card .stream-encoding-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: #d97706;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.stream-encoding-badge .encoding-spinner {
    width: 6px;
    height: 6px;
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.stream-card.has-thumbnail .stream-viewers {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

.stream-card.has-thumbnail .stream-card-content {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stream-card.has-thumbnail .connection-header {
    padding: 0;
    border: none;
    margin: 0;
}

.stream-card.has-thumbnail .stream-description {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stream-card.has-thumbnail .stream-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.stream-card.has-thumbnail .connection-actions {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

/* Thumbnail upload styles */
.thumbnail-upload-area {
    border: 2px dashed rgba(255,255,255,0.2);
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: rgba(0,0,0,0.2);
}

.thumbnail-upload-area:hover {
    border-color: var(--accent-blue);
    background: rgba(var(--accent-blue-rgb), 0.1);
}

.thumbnail-upload-area.has-thumbnail {
    padding: 0;
    border-style: solid;
}

.thumbnail-upload-area img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    border-radius: 6px;
}

.thumbnail-upload-area .upload-placeholder {
    color: var(--text-muted);
}

.thumbnail-upload-area .upload-placeholder svg {
    width: 32px;
    height: 32px;
    margin-bottom: 0.5rem;
}

/* Admin Stats Row */
.admin-stats {
    border-top: 1px solid rgba(167, 139, 250, 0.2);
    padding-top: 0.75rem;
    margin-top: -0.25rem;
}

.stat-card-admin {
    border: 1px solid rgba(167, 139, 250, 0.15);
}

/* Activity Feed */
.activity-feed {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.activity-feed-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.activity-feed-header:hover {
    background: var(--card-hover);
}

.activity-feed-header h3 {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.activity-chevron {
    color: var(--text-muted);
    transition: transform 0.2s;
}

.activity-feed-body {
    padding: 0 1rem 0.75rem;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    font-size: 0.8125rem;
}

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

.activity-icon {
    color: var(--text-muted);
    flex-shrink: 0;
    display: flex;
}

.activity-text {
    color: var(--text-secondary);
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.activity-text strong {
    color: var(--text-primary);
    font-weight: 500;
}

.activity-time {
    color: var(--text-muted);
    font-size: 0.75rem;
    flex-shrink: 0;
}

/* Connection type badges */
.conn-type-badge {
    display: inline-block;
    font-size: 0.625rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
    vertical-align: middle;
    margin-left: 0.25rem;
    letter-spacing: 0.5px;
    background: rgba(96, 165, 250, 0.15);
    color: var(--accent-blue);
}

.conn-type-ssh { background: rgba(34, 197, 94, 0.15); color: var(--accent-green); }
.conn-type-vnc { background: rgba(168, 85, 247, 0.15); color: #a855f7; }
.conn-type-rdp { background: rgba(251, 191, 36, 0.15); color: var(--accent-yellow); }

.conn-ssh-key {
    color: var(--accent-green);
    vertical-align: middle;
    margin-left: 0.25rem;
}

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

/* Stream card enhancements */
.stream-card .stream-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.25rem;
}

.stream-viewers {
    font-size: 0.75rem;
    color: var(--accent-green);
    font-weight: 500;
}

.stream-badge {
    display: inline-block;
    font-size: 0.625rem;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
    vertical-align: middle;
    margin-left: 0.25rem;
    letter-spacing: 0.5px;
}

.stream-badge-public {
    background: rgba(34, 197, 94, 0.15);
    color: var(--accent-green);
}

.stream-badge-private {
    background: rgba(251, 191, 36, 0.15);
    color: var(--accent-yellow);
}

.stream-key-display {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-family: monospace;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.thumbnail-upload-area .upload-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.stream-broadcaster {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.stream-broadcaster svg {
    width: 16px;
    height: 16px;
}

/* Responsive stream viewer */
@media (max-width: 900px) {
    .stream-viewer {
        flex-direction: column;
        height: auto;
    }

    .stream-video-container {
        aspect-ratio: 16/9;
    }

    .stream-chat-container {
        width: 100%;
        height: 300px;
    }

    .modal-fullscreen {
        width: 100vw;
        height: 100vh;
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }
}

/* Checkbox label styling */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Connection Status Badge (shared across viewer pages) */
.connection-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.3s;
}

.connection-status.connected {
    background: rgba(34, 197, 94, 0.1);
    color: var(--status-connected);
}

.connection-status.connecting {
    background: rgba(234, 179, 8, 0.1);
    color: var(--status-connecting);
}

.connection-status.disconnected {
    background: rgba(239, 68, 68, 0.1);
    color: var(--status-disconnected);
}

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

.connection-status.connected .status-dot {
    animation: pulse 2s infinite;
}

/* Navbar Section Divider (shared across pages) */
.navbar-divider {
    width: 1px;
    height: 20px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 0.75rem;
}

.navbar-section {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--accent-blue);
    font-weight: 500;
    font-size: 0.95rem;
}

.navbar-section svg {
    opacity: 0.9;
}

/* VOD Session-Grouped Manager */
.vod-session {
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    margin-bottom: 0.75rem;
    background: rgba(255, 255, 255, 0.02);
    overflow: hidden;
}

.vod-session-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    cursor: pointer;
    gap: 0.75rem;
    transition: background 0.15s;
}

.vod-session-header:hover {
    background: rgba(255, 255, 255, 0.04);
}

.vod-session-arrow {
    font-size: 0.65rem;
    color: var(--text-muted);
    transition: transform 0.2s;
    flex-shrink: 0;
}

.vod-session.collapsed .vod-session-arrow {
    transform: rotate(-90deg);
}

.vod-session.collapsed .vod-session-files {
    display: none;
}

.vod-session-title {
    font-weight: 600;
    font-size: 0.925rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.vod-session-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

.vod-session-actions {
    display: flex;
    gap: 0.4rem;
    flex-shrink: 0;
}

.vod-session-files {
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.vod-file-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 1rem 0.45rem 2.25rem;
    font-size: 0.825rem;
    transition: background 0.1s;
}

.vod-file-row:hover {
    background: rgba(255, 255, 255, 0.03);
}

.vod-file-row.selected {
    background: rgba(96, 165, 250, 0.08);
}

.vod-file-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-secondary);
}

.vod-file-size,
.vod-file-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
    width: 80px;
    text-align: right;
}

.vod-file-actions {
    display: flex;
    gap: 0.3rem;
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.15s;
}

.vod-file-row:hover .vod-file-actions {
    opacity: 1;
}

.vod-session-checkbox,
.vod-file-checkbox {
    accent-color: var(--accent-blue);
    cursor: pointer;
    flex-shrink: 0;
}

/* ===== Ease-of-Use: kbd, button spinner, validation, shortcuts, command palette, welcome ===== */

kbd {
    display: inline-block;
    padding: 0.125rem 0.375rem;
    font-size: 0.75rem;
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
    color: var(--text-primary);
    background: var(--bg-secondary);
    border: 1px solid var(--card-border);
    border-radius: 4px;
    line-height: 1.4;
}

/* Button spinner (inline) */
.btn-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
}

/* Inline field validation */
.field-error {
    border-color: var(--accent-red) !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2) !important;
}

.field-error-msg {
    color: var(--accent-red);
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

/* Keyboard shortcuts overlay */
.shortcuts-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

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

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

.shortcut-keys {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.shortcut-desc {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Command palette */
.cmd-palette-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 20vh;
    z-index: 10003;
}

.cmd-palette-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
}

.cmd-palette {
    position: relative;
    width: 100%;
    max-width: 560px;
    background: var(--bg-primary);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    box-shadow: 0 16px 64px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    animation: modalIn 0.15s ease;
}

.cmd-palette-input-wrap {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--card-border);
    color: var(--text-muted);
}

.cmd-palette-input-wrap input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
}

.cmd-palette-input-wrap input::placeholder {
    color: var(--text-muted);
}

.cmd-palette-input-wrap kbd {
    flex-shrink: 0;
}

.cmd-palette-results {
    max-height: 360px;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.cmd-palette-category {
    padding: 0.375rem 1rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.cmd-palette-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: background 0.1s;
}

.cmd-palette-item-active {
    background: var(--card-hover);
}

.cmd-palette-item-name {
    font-size: 0.875rem;
    color: var(--text-primary);
}

.cmd-palette-item-detail {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: 0.75rem;
}

.cmd-palette-empty,
.cmd-palette-loading {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* Welcome tour */
.welcome-features {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.welcome-feature-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
}

.welcome-feature-card h4 {
    font-size: 0.875rem;
    margin: 0.5rem 0 0.25rem;
    color: var(--text-primary);
}

.welcome-feature-card p {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.4;
}

.welcome-feature-icon {
    color: var(--accent-blue);
}

@media (max-width: 640px) {
    .cmd-palette-overlay {
        padding-top: 10vh;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
}

@media (max-width: 480px) {
    .welcome-features {
        grid-template-columns: 1fr;
    }
}
