/**
 * ═════════════════════════════════════════════════════════════════════════════
 *  Caelestris™ Server Dashboard — Styles
 *  Admin dashboard styling for the Caelestris Server monitoring interface
 * ═════════════════════════════════════════════════════════════════════════════
 *
 *  Copyright © 2025, 2026 Ex Apeirou Studios™, LLC. All rights reserved.
 *
 * ═════════════════════════════════════════════════════════════════════════════
 */

/* Caelestris Server Dashboard Styles */
@import url('https://fonts.googleapis.com/css2?family=Bangers&family=Comic+Neue:wght@400;700&display=swap');

/* Prevent page scroll */
html, body {
    overflow: hidden;
    height: 100vh;
}

/* Page-specific nav styling */
:root {
    --logo-width: 10rem;
}

.logo-block {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1001;
    padding: 0.5rem 1rem;
    background: rgba(10, 11, 15, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-subtle);
    width: var(--logo-width);
    box-sizing: border-box;
}

.logo-block::after {
    content: '';
    position: absolute;
    right: -1px;
    top: 2.3rem;
    bottom: 0;
    width: 1px;
    background: var(--border-subtle);
}

.logo-block img {
    height: 8rem;
    width: auto;
    max-width: 100%;
}

nav {
    padding: 0.4rem 2rem;
    justify-content: flex-end;
    background: rgba(10, 11, 15, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-subtle);
    left: 0;
    padding-left: calc(var(--logo-width) + 2rem);
}

nav.scrolled {
    padding: 0.4rem 2rem;
    padding-left: calc(var(--logo-width) + 2rem);
    background: rgba(10, 11, 15, 0.85);
}

.nav-links {
    gap: 1.5rem;
}

.nav-links a {
    font-size: 0.8rem;
}

.nav-links a.nav-active {
    color: var(--accent-primary);
}

/* Dashboard Layout */
.dashboard {
    position: relative;
    z-index: 1;
    padding-top: 2.3rem;
    height: 100vh;
    max-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.dashboard-content {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    padding-left: calc(var(--logo-width) + 1rem);
    height: calc(100vh - 2.3rem - 2.5rem);
    max-height: calc(100vh - 2.3rem - 2.5rem);
    overflow: hidden;
}

/* Menu Bar */
.menu-bar {
    display: flex;
    gap: 0;
    background: rgba(18, 20, 26, 0.95);
    border-bottom: 1px solid var(--border-subtle);
    margin-left: var(--logo-width);
    padding-left: 0;
    height: 2.5rem;
    align-items: stretch;
    position: relative;
}

/* Scrollable wrapper for menu items */
.menu-items-wrapper {
    display: flex;
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    align-items: stretch;
    scroll-behavior: smooth;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

.menu-items-wrapper::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

/* Menu scroll buttons */
.menu-scroll-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 100%;
    background: rgba(18, 20, 26, 0.98);
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
    z-index: 10;
}

.menu-scroll-btn:hover {
    color: var(--accent-primary);
    background: var(--bg-elevated);
}

.menu-scroll-btn:active {
    color: var(--text-primary);
}

.menu-scroll-btn.hidden {
    opacity: 0.3;
    pointer-events: none;
}

.menu-scroll-left {
    border-right: 1px solid var(--border-subtle);
}

.menu-scroll-right {
    border-left: 1px solid var(--border-subtle);
}

.menu-item {
    position: relative;
    display: flex;
    align-items: center;
}

.menu-label {
    padding: 0 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    height: 100%;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
}

.menu-label:hover,
.menu-item.active .menu-label {
    color: var(--text-primary);
    background: var(--bg-elevated);
}

/* Menu bar toggle item (like Tutorial) */
.menu-toggle-item .toggle-label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
}

.menu-toggle-item .toggle-label .toggle-check {
    width: 1rem;
    opacity: 0;
    color: var(--accent-primary);
    transition: opacity 0.15s ease;
}

.menu-toggle-item .toggle-label.active .toggle-check {
    opacity: 1;
}

.menu-toggle-item .toggle-label.active {
    color: var(--accent-primary);
}

.menu-dropdown {
    position: fixed;
    top: auto;
    left: auto;
    min-width: 180px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-top: none;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-5px);
    transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease;
    clip-path: polygon(
        0 0, calc(100% - 8px) 0,
        100% 8px, 100% calc(100% - 8px),
        calc(100% - 8px) 100%, 8px 100%,
        0 calc(100% - 8px), 0 0
    );
}

.menu-item.active .menu-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.menu-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.6rem 1rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.15s ease;
}

.menu-option:hover {
    background: var(--bg-surface);
    color: var(--text-primary);
}

.menu-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 0.25rem 0;
}

.toggle-check {
    width: 1rem;
    opacity: 0;
    color: var(--accent-primary);
}

.toggle-option.active .toggle-check {
    opacity: 1;
}

/* Panels - Chamfered style matching capabilities cards */
.panel {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    max-height: 100%;
    position: relative;
    clip-path: polygon(
        10px 0, calc(100% - 10px) 0,
        100% 10px, 100% calc(100% - 10px),
        calc(100% - 10px) 100%, 10px 100%,
        0 calc(100% - 10px), 0 10px
    );
}

.panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    height: 100%;
    background: linear-gradient(180deg, var(--accent-primary), #7b61ff);
    z-index: 10;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 1rem;
    padding-left: 1.25rem;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-subtle);
}

.panel-header h3 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.console-server-filter {
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--accent-primary);
}

.panel-controls {
    display: flex;
    gap: 0.4rem;
}

.icon-btn {
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    clip-path: polygon(
        4px 0, calc(100% - 4px) 0,
        100% 4px, 100% calc(100% - 4px),
        calc(100% - 4px) 100%, 4px 100%,
        0 calc(100% - 4px), 0 4px
    );
}

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

.icon-btn.active {
    background: var(--accent-primary);
    color: var(--bg-deep);
    border-color: var(--accent-primary);
}

/* Left Panels Column */
.left-panels {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex: 1;
    min-width: 350px;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
}

/* When left panels are empty (console hidden, history not shown), hide them */
.left-panels.panels-empty {
    display: none;
}

/* When left panels are empty, right panels expand to full width */
.dashboard-content.left-empty .right-panels {
    flex: 1 1 100%;
    min-width: 0;
}

/* Console Panel */
.console-panel {
    flex: 1;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
}

/* When history is visible, console shrinks to match stats height */
.left-panels.history-visible .console-panel {
    flex: 0 0 auto;
    min-height: 120px;
    max-height: 140px;
}

.filter-bar {
    display: none;
    padding: 0;
    background: rgba(26, 29, 36, 0.5);
    border-bottom: none;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: all 0.3s ease;
}

.filter-bar.visible {
    display: flex;
    max-height: 350px;
    opacity: 1;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
    overflow-y: auto;
    overflow-x: hidden;
}

.filter-section {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.filter-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-right: 0.25rem;
}

.filter-toggle {
    cursor: pointer;
}

.filter-toggle input {
    display: none;
}

.level-tag,
.component-tag {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 500;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    transition: all 0.2s ease;
    clip-path: polygon(
        3px 0, calc(100% - 3px) 0,
        100% 3px, 100% calc(100% - 3px),
        calc(100% - 3px) 100%, 3px 100%,
        0 calc(100% - 3px), 0 3px
    );
}

.filter-toggle input:checked + .level-tag,
.filter-toggle input:checked + .component-tag {
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.level-error { border-left: 2px solid #ff4d4d; }
.level-warn { border-left: 2px solid #ffaa00; }
.level-info { border-left: 2px solid #00aaff; }
.level-debug { border-left: 2px solid #aa66ff; }
.level-critical { border-left: 2px solid #ff1744; }

.filter-toggle input:checked + .level-error { background: rgba(255, 77, 77, 0.15); }
.filter-toggle input:checked + .level-warn { background: rgba(255, 170, 0, 0.15); }
.filter-toggle input:checked + .level-info { background: rgba(0, 170, 255, 0.15); }
.filter-toggle input:checked + .level-debug { background: rgba(170, 102, 255, 0.15); }
.filter-toggle input:checked + .level-critical { background: rgba(255, 23, 68, 0.15); }

/* Logging Subsystems Panel in Filter Bar */
.logging-subsystems-panel {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow: visible;
}

.logging-subsystems-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    overflow: visible;
}

.logging-subsystem-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    padding-left: 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    position: relative;
    transition: all 0.15s ease;
    clip-path: polygon(
        6px 0, calc(100% - 6px) 0,
        100% 6px, 100% calc(100% - 6px),
        calc(100% - 6px) 100%, 6px 100%,
        0 calc(100% - 6px), 0 6px
    );
}

.logging-subsystem-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    height: 100%;
    background: linear-gradient(180deg, var(--accent-primary), #7b61ff);
}

.logging-subsystem-item:hover {
    border-color: var(--accent-primary);
}

.subsystem-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: color 0.15s ease;
}

.subsystem-toggle:hover {
    color: var(--text-primary);
}

.subsystem-toggle .toggle-check {
    width: 1rem;
    opacity: 0;
    color: var(--accent-primary);
    transition: opacity 0.15s ease;
}

.subsystem-toggle.active .toggle-check {
    opacity: 1;
}

.subsystem-toggle .subsystem-name {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--text-secondary);
    transition: color 0.15s ease;
}

.subsystem-toggle.active .subsystem-name {
    color: var(--text-primary);
}

.subsystem-level-control {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    position: relative;
    cursor: pointer;
    padding: 0.2rem 0.4rem;
    border-radius: 3px;
    transition: background 0.15s ease;
}

.subsystem-level-control:hover {
    background: var(--bg-elevated);
}

.subsystem-level-control .current-level {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    color: var(--accent-primary);
    min-width: 55px;
    text-align: right;
}

.subsystem-level-control .level-arrow {
    font-size: 0.5rem;
    color: var(--text-muted);
    transition: transform 0.15s ease, color 0.15s ease;
}

.subsystem-level-control:hover .level-arrow {
    color: var(--accent-primary);
    transform: rotate(90deg);
}

.level-submenu {
    position: fixed;
    min-width: 100px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-5px);
    transition: opacity 0.15s ease, visibility 0.15s ease, transform 0.15s ease;
    border-radius: 4px;
}

.level-submenu.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.level-option {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    width: 100%;
    padding: 0.4rem 0.6rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.1s ease;
}

.level-option:hover {
    background: var(--bg-surface);
    color: var(--text-primary);
}

.level-option .level-check {
    width: 0.8rem;
    opacity: 0;
    color: var(--accent-primary);
    font-size: 0.65rem;
}

.level-option.selected {
    color: var(--accent-primary);
}

.level-option.selected .level-check {
    opacity: 1;
}

/* Filter bar scrollbar */
.filter-bar::-webkit-scrollbar {
    width: 6px;
}

.filter-bar::-webkit-scrollbar-track {
    background: var(--bg-deep);
}

.filter-bar::-webkit-scrollbar-thumb {
    background: var(--bg-elevated);
    border-radius: 3px;
}

.filter-bar::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.console-output {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0.5rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    line-height: 1.5;
    background: rgba(10, 11, 15, 0.5);
    min-height: 0;
}

.log-entry {
    display: flex;
    gap: 0.5rem;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    transition: background 0.15s ease;
}

.log-entry:hover {
    background: rgba(255, 255, 255, 0.03);
}

.log-timestamp {
    color: var(--text-muted);
    flex-shrink: 0;
}

.log-level {
    flex-shrink: 0;
    width: 60px;
    text-transform: uppercase;
    font-weight: 500;
}

.log-level.error { color: #ff4d4d; }
.log-level.warn { color: #ffaa00; }
.log-level.info { color: #00aaff; }
.log-level.debug { color: #aa66ff; }
.log-level.critical { color: #ff1744; font-weight: 700; }

.log-subsystem {
    color: var(--accent-primary);
    flex-shrink: 0;
    min-width: 90px;
}

.log-message {
    color: var(--text-primary);
    word-break: break-word;
}

.log-entry.hidden {
    display: none;
}

/* Right Panels */
.right-panels {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex: 1;
    min-width: 350px;
    min-height: 0;
    max-height: 100%;
    overflow: hidden;
}

/* Heatmap Panel */
.heatmap-panel {
    flex: 1;
    min-height: 200px;
    max-height: 100%;
    overflow: hidden;
}

.heatmap-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    min-height: 0;
}

#heatmap-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 11, 15, 0.5);
}

/* Legend button icon - three horizontal bars */
.bars-icon {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2px;
    width: 12px;
    height: 12px;
}

.bars-icon::before,
.bars-icon::after {
    content: '';
    width: 10px;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
}

.bars-icon::before {
    box-shadow: 0 4px 0 currentColor;
}

#legend-btn {
    position: relative;
}

.legend-panel {
    position: absolute;
    top: 3rem;
    right: 1rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    padding: 0.75rem;
    padding-left: 1rem;
    font-size: 0.75rem;
    z-index: 10;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    clip-path: polygon(
        8px 0, calc(100% - 8px) 0,
        100% 8px, 100% calc(100% - 8px),
        calc(100% - 8px) 100%, 8px 100%,
        0 calc(100% - 8px), 0 8px
    );
}

.legend-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    height: 100%;
    background: linear-gradient(180deg, var(--accent-primary), #7b61ff);
}

.legend-panel.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.legend-section {
    margin-bottom: 0.75rem;
}

.legend-section:last-child {
    margin-bottom: 0;
}

.legend-title {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.legend-gradient {
    width: 120px;
    height: 12px;
    background: linear-gradient(to right, #00d4aa, #ffaa00, #ff4d4d);
    border-radius: 2px;
    margin-bottom: 0.25rem;
}

.legend-labels {
    display: flex;
    justify-content: space-between;
    color: var(--text-muted);
    font-size: 0.65rem;
}

.size-examples {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    margin-top: 0.5rem;
}

.size-example {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.size-example span {
    color: var(--text-muted);
    font-size: 0.65rem;
}

.size-circle {
    border-radius: 50%;
    background: var(--accent-primary);
    opacity: 0.7;
}

.size-circle.small { width: 12px; height: 12px; }
.size-circle.medium { width: 20px; height: 20px; }
.size-circle.large { width: 30px; height: 30px; }

/* Stats Panel */
.stats-panel {
    flex: 0 0 auto;
    min-height: 120px;
    max-height: 140px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.stats-panel .panel-header {
    flex-shrink: 0;
}

.stats-server-filter {
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--accent-primary);
}

.stats-filter-container {
    position: relative;
}

/* Double bars icon */
.double-bars-icon {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 3px;
    width: 12px;
    height: 12px;
}

.double-bars-icon::before,
.double-bars-icon::after {
    content: '';
    width: 10px;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
}

.stats-filter-panel {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    padding: 0.5rem;
    z-index: 20;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-5px);
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    clip-path: polygon(
        6px 0, calc(100% - 6px) 0,
        100% 6px, 100% calc(100% - 6px),
        calc(100% - 6px) 100%, 6px 100%,
        0 calc(100% - 6px), 0 6px
    );
}

.stats-filter-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    height: 100%;
    background: linear-gradient(180deg, var(--accent-primary), #7b61ff);
}

.stats-filter-panel.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.stat-card.hidden {
    display: none;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    padding: 1rem;
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

/* Scrollbar for stats grid */
.stats-grid::-webkit-scrollbar {
    width: 6px;
}

.stats-grid::-webkit-scrollbar-track {
    background: var(--bg-deep);
}

.stats-grid::-webkit-scrollbar-thumb {
    background: var(--bg-elevated);
    border-radius: 3px;
}

.stats-grid::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    padding: 0.75rem;
    text-align: center;
    position: relative;
    clip-path: polygon(
        6px 0, calc(100% - 6px) 0,
        100% 6px, 100% calc(100% - 6px),
        calc(100% - 6px) 100%, 6px 100%,
        0 calc(100% - 6px), 0 6px
    );
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    height: 100%;
    background: linear-gradient(180deg, var(--accent-primary), #7b61ff);
}

.stat-value {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--accent-primary);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal.visible {
    opacity: 1;
    visibility: visible;
}

.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-surface);
    border: 1px solid var(--border-subtle);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    transform: translateY(-20px);
    transition: transform 0.3s ease;
    clip-path: polygon(
        12px 0, calc(100% - 12px) 0,
        100% 12px, 100% calc(100% - 12px),
        calc(100% - 12px) 100%, 12px 100%,
        0 calc(100% - 12px), 0 12px
    );
}

.modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    height: 100%;
    background: linear-gradient(180deg, var(--accent-primary), #7b61ff);
    z-index: 10;
}

.modal.visible .modal-content {
    transform: translateY(0);
}

.modal-small {
    max-width: 350px;
}

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

.modal-header h3 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s ease;
}

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

.modal-body {
    padding: 1.25rem;
    overflow-y: auto;
    max-height: 60vh;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--bg-elevated);
    border-top: 1px solid var(--border-subtle);
}

/* Settings */
.settings-section {
    margin-bottom: 1.5rem;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section h4 {
    font-size: 0.9rem;
    color: var(--accent-primary);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-subtle);
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
}

.setting-row span {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.setting-row input[type="number"],
.setting-row input[type="text"] {
    width: 120px;
    padding: 0.4rem 0.6rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    clip-path: polygon(
        4px 0, calc(100% - 4px) 0,
        100% 4px, 100% calc(100% - 4px),
        calc(100% - 4px) 100%, 4px 100%,
        0 calc(100% - 4px), 0 4px
    );
}

.setting-row input[type="number"]:focus,
.setting-row input[type="text"]:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.setting-toggle {
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 1px solid var(--border-subtle);
    background: var(--bg-surface);
    transition: all 0.15s ease;
    clip-path: polygon(
        4px 0, calc(100% - 4px) 0,
        100% 4px, 100% calc(100% - 4px),
        calc(100% - 4px) 100%, 4px 100%,
        0 calc(100% - 4px), 0 4px
    );
}

.setting-toggle:hover {
    border-color: var(--accent-primary);
}

.setting-toggle .toggle-check {
    color: var(--accent-primary);
    font-size: 0.9rem;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.setting-toggle.active .toggle-check {
    opacity: 1;
}

/* History Panel */
.history-panel {
    flex: 1;
    min-height: 200px;
    max-height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.history-panel .panel-header {
    flex-shrink: 0;
}

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

.history-dropdown {
    position: relative;
}

.history-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.5rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    font-family: 'Outfit', sans-serif;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.15s ease;
    clip-path: polygon(
        3px 0, calc(100% - 3px) 0,
        100% 3px, 100% calc(100% - 3px),
        calc(100% - 3px) 100%, 3px 100%,
        0 calc(100% - 3px), 0 3px
    );
}

.history-dropdown-btn:hover {
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.dropdown-arrow {
    font-size: 0.5rem;
    transition: transform 0.2s ease;
}

.history-dropdown.active .dropdown-arrow {
    transform: rotate(180deg);
}

.history-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 120px;
    margin-top: 0.25rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-5px);
    transition: all 0.15s ease;
    clip-path: polygon(
        4px 0, calc(100% - 4px) 0,
        100% 4px, 100% calc(100% - 4px),
        calc(100% - 4px) 100%, 4px 100%,
        0 calc(100% - 4px), 0 4px
    );
}

.history-dropdown.active .history-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-option {
    display: block;
    width: 100%;
    padding: 0.4rem 0.6rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-family: 'Outfit', sans-serif;
    font-size: 0.75rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.1s ease;
}

.dropdown-option:hover {
    background: var(--bg-surface);
    color: var(--text-primary);
}

.dropdown-option.active {
    color: var(--accent-primary);
}

.history-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0.75rem;
    min-height: 0;
    overflow: hidden;
}

.history-granularity {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
    flex-shrink: 0;
}

.granularity-btn {
    padding: 0.25rem 0.5rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    cursor: pointer;
    transition: all 0.15s ease;
    clip-path: polygon(
        3px 0, calc(100% - 3px) 0,
        100% 3px, 100% calc(100% - 3px),
        calc(100% - 3px) 100%, 3px 100%,
        0 calc(100% - 3px), 0 3px
    );
}

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

.granularity-btn.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: var(--bg-deep);
}

.history-chart-wrapper {
    flex: 1;
    position: relative;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

#history-canvas {
    flex: 1;
    width: 100%;
    min-height: 0;
}

.history-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    padding-top: 0.5rem;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border: 1px solid transparent;
    transition: all 0.15s ease;
    clip-path: polygon(
        3px 0, calc(100% - 3px) 0,
        100% 3px, 100% calc(100% - 3px),
        calc(100% - 3px) 100%, 3px 100%,
        0 calc(100% - 3px), 0 3px
    );
}

.legend-item:hover {
    background: var(--bg-surface);
    border-color: var(--border-subtle);
}

.legend-item.active {
    color: var(--text-secondary);
}

.legend-check {
    width: 0.75rem;
    color: var(--accent-primary);
    opacity: 0;
    transition: opacity 0.15s ease;
}

.legend-item.active .legend-check {
    opacity: 1;
}

.legend-color {
    width: 12px;
    height: 3px;
    border-radius: 1px;
    opacity: 0.4;
    transition: opacity 0.15s ease;
}

.legend-item.active .legend-color {
    opacity: 1;
}

.legend-label {
    transition: color 0.15s ease;
}

/* About Modal */
.about-body {
    text-align: center;
}

.about-logo {
    width: 150px;
    height: auto;
    margin-bottom: 1rem;
}

.about-title {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.about-version {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

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

/* Scrollbar */
.console-output::-webkit-scrollbar,
.modal-body::-webkit-scrollbar {
    width: 8px;
}

.console-output::-webkit-scrollbar-track,
.modal-body::-webkit-scrollbar-track {
    background: var(--bg-deep);
}

.console-output::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb {
    background: var(--bg-elevated);
    border-radius: 4px;
}

.console-output::-webkit-scrollbar-thumb:hover,
.modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============================================
   Command Palette Panel (Left Sidebar on wide screens)
   ============================================ */

.command-palette-panel {
    position: fixed;
    top: 10.5rem;
    left: 0.5rem;
    bottom: 1.5rem;
    width: calc(var(--logo-width) - 0.5rem);
    z-index: 100;
}

.command-palette-panel .panel-header h3 {
    font-size: 0.9rem;
}

.command-palette-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.command-palette-list::-webkit-scrollbar {
    width: 5px;
}

.command-palette-list::-webkit-scrollbar-track {
    background: var(--bg-deep);
}

.command-palette-list::-webkit-scrollbar-thumb {
    background: var(--bg-elevated);
    border-radius: 2px;
}

.command-palette-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.command-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.4rem;
    width: 100%;
    padding: 0.5rem 0.6rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
    clip-path: polygon(
        4px 0, calc(100% - 4px) 0,
        100% 4px, 100% calc(100% - 4px),
        calc(100% - 4px) 100%, 4px 100%,
        0 calc(100% - 4px), 0 4px
    );
}

.command-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    height: 100%;
    background: linear-gradient(180deg, var(--accent-primary), #7b61ff);
    opacity: 0;
    transition: opacity 0.15s ease;
}

.command-btn:hover {
    background: var(--bg-elevated);
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.command-btn:hover::before {
    opacity: 1;
}

.command-btn:active {
    transform: scale(0.98);
}

.command-btn .cmd-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.command-btn .cmd-arrow {
    font-size: 0.6rem;
    color: var(--text-muted);
    transition: transform 0.15s ease, color 0.15s ease;
}

.command-btn:hover .cmd-arrow {
    color: var(--accent-primary);
}

.command-btn.has-subcommands .cmd-arrow {
    opacity: 1;
}

.command-btn:not(.has-subcommands) .cmd-arrow {
    opacity: 0;
}

.command-btn.active {
    background: var(--bg-elevated);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.command-btn.active::before {
    opacity: 1;
}

/* Command placeholder when no commands loaded */
.command-palette-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 0.75rem;
    color: var(--text-muted);
    text-align: center;
}

.command-palette-empty .empty-icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

.command-palette-empty .empty-text {
    font-size: 0.7rem;
    line-height: 1.4;
}

/* Responsive - Single Column Layout */
@media (max-width: 1200px) {
    .dashboard-content {
        flex-direction: column;
        height: auto;
        max-height: none;
        overflow-y: auto;
        overflow-x: hidden;
    }

    .left-panels,
    .right-panels {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        flex: none;
        max-height: none;
    }

    .console-panel {
        min-width: auto;
        height: 350px;
        max-height: 350px;
        flex: none;
    }

    .left-panels.history-visible .console-panel {
        height: 200px;
        max-height: 200px;
    }

    .history-panel {
        height: 300px;
        max-height: 300px;
        flex: none;
    }

    .right-panels {
        flex-direction: row;
        gap: 1rem;
    }

    .heatmap-panel {
        flex: 1;
        min-height: 300px;
        max-height: 400px;
    }

    .stats-panel {
        flex: 0 0 auto;
        min-height: auto;
        max-height: none;
        width: auto;
        min-width: 280px;
    }
}

@media (max-width: 900px) {
    /* Stack all panels in a single column */
    .dashboard-content {
        flex-direction: column;
        padding-left: 1rem;
        gap: 0.75rem;
    }

    .left-panels,
    .right-panels {
        width: 100%;
        min-width: 0;
        max-height: none;
        overflow: visible;
        flex-direction: column;
        gap: 0.75rem;
    }

    .console-panel {
        height: 300px;
        max-height: 300px;
    }

    .left-panels.history-visible .console-panel {
        height: 180px;
        max-height: 180px;
    }

    .history-panel {
        height: 250px;
        max-height: 250px;
    }

    .heatmap-panel {
        min-height: 280px;
        max-height: 350px;
    }

    .stats-panel {
        min-width: 0;
        width: 100%;
        min-height: auto;
        max-height: none;
    }

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

    /* Adjust command palette for narrower screens */
    .command-palette-panel {
        width: 8rem;
        top: 9rem;
    }

    .dashboard-content {
        padding-left: calc(8rem + 1rem);
    }

    .menu-bar {
        margin-left: 8rem;
    }

    .logo-block {
        width: 8rem;
    }

    .logo-block img {
        height: 6rem;
    }
}

@media (max-width: 768px) {
    /* Dashboard content becomes scrollable column */
    .dashboard-content {
        flex-direction: column;
        padding-left: 1rem;
        padding-right: 1rem;
        height: auto;
        max-height: none;
        overflow-y: auto;
        overflow-x: hidden;
        gap: 0.75rem;
    }

    /* Command palette panel becomes inline, stacks with other panels */
    .command-palette-panel {
        position: static;
        width: 100%;
        height: auto;
        min-height: 80px;
        max-height: 150px;
        z-index: 1;
        flex-shrink: 0;
        overflow: hidden;
    }

    .command-palette-list {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.35rem;
        padding: 0.5rem;
        max-height: 110px;
        overflow-y: auto;
    }

    .command-btn {
        width: auto;
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .menu-bar {
        margin-left: 6rem;
    }

    .logo-block {
        width: 6rem;
        padding: 0.25rem 0.5rem;
    }

    .logo-block img {
        height: 5rem;
    }

    /* Show scroll buttons on narrow screens */
    .menu-scroll-btn {
        display: flex;
    }

    .menu-items-wrapper {
        overflow-x: auto;
        overflow-y: hidden;
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE/Edge */
    }

    .menu-items-wrapper::-webkit-scrollbar {
        display: none; /* Chrome/Safari */
    }

    .menu-item {
        flex-shrink: 0;
    }

    .menu-label {
        padding: 0 0.75rem;
        font-size: 0.8rem;
    }

    .left-panels,
    .right-panels {
        width: 100%;
        min-width: 0;
        max-height: none;
        overflow: visible;
        flex-direction: column;
        gap: 0.75rem;
    }

    .console-panel {
        height: 280px;
        max-height: 280px;
        flex: none;
    }

    .heatmap-panel {
        min-height: 375px;
        max-height: 450px;
        flex: none;
    }

    .stats-panel {
        min-width: 0;
        width: 100%;
        max-height: none;
        flex: none;
    }

    .history-panel {
        height: 400px;
        max-height: 400px;
        flex: none;
    }

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

    nav {
        padding-left: calc(6rem + 1rem);
    }

    nav.scrolled {
        padding-left: calc(6rem + 1rem);
    }

    .dashboard {
        padding-top: 2rem;
    }

    /* Copyright at bottom of scrollable content */
    .copyright-watermark {
        position: static;
        text-align: center;
        padding: 0.5rem;
        width: 100%;
        margin-top: 0.5rem;
    }

    /* Subcommand popup appears below button on narrow screens */
    .subcommand-popup {
        transform: translateY(-10px);
    }

    .subcommand-popup.visible {
        transform: translateY(0);
    }
}

@media (max-width: 600px) {
    /* Extra small screens - maximum compaction */
    .dashboard-content {
        padding: 0.5rem;
        gap: 0.5rem;
    }

    /* Command palette more compact but still visible */
    .command-palette-list {
        padding: 0.35rem;
        gap: 0.25rem;
    }

    .command-btn {
        padding: 0.4rem 0.5rem;
        font-size: 0.65rem;
    }

    .command-palette-panel .panel-header h3 {
        font-size: 0.8rem;
    }

    .console-panel {
        height: 250px;
        max-height: 250px;
    }

    .left-panels.history-visible .console-panel {
        height: 150px;
        max-height: 150px;
    }

    .history-panel {
        height: 440px;
        max-height: 440px;
    }

    .heatmap-panel {
        min-height: 330px;
        max-height: 420px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
        padding: 0.75rem;
    }

    .stat-card {
        padding: 0.5rem;
    }

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

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

    /* Simplify panel headers */
    .panel-header {
        padding: 0.5rem 0.75rem;
        padding-left: 1rem;
    }

    .panel-header h3 {
        font-size: 0.9rem;
    }

    /* Nav adjustments */
    .nav-links {
        gap: 0.75rem;
    }

    .nav-links a {
        font-size: 0.7rem;
    }

    /* Menu bar compact */
    .menu-bar {
        margin-left: 5rem;
    }

    .logo-block {
        width: 5rem;
        padding: 0.25rem 0.35rem;
    }

    .logo-block img {
        height: 4rem;
    }

    nav {
        padding-left: calc(5rem + 0.5rem);
    }

    nav.scrolled {
        padding-left: calc(5rem + 0.5rem);
    }

    .menu-label {
        padding: 0 0.6rem;
        font-size: 0.75rem;
    }

    /* Legend panel responsive */
    .legend-panel {
        right: 0.5rem;
        max-width: calc(100vw - 1rem);
    }
}

/* Tutorial Tooltip - Comic Book Style with Speech Bubble Tail */

.tutorial-tooltip {
    position: fixed;
    max-width: 280px;
    padding: 1rem 1.25rem;
    background: #2a2d38;
    border: 3px solid #d63384;
    border-radius: 18px;
    color: #f0f0f0;
    font-family: 'Comic Neue', 'Comic Sans MS', cursive, sans-serif;
    font-size: 0.9rem;
    line-height: 1.4;
    z-index: 10000;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.9);
    transition: opacity 0.15s ease, visibility 0.15s ease, transform 0.15s ease;
    box-shadow: 
        4px 4px 0 #d63384,
        inset 0 0 0 2px #3a3d48;
    filter: drop-shadow(2px 4px 8px rgba(0, 0, 0, 0.5));
}

/* Comic book speech bubble tail - pointing left by default (tooltip to the right of target) */
.tutorial-tooltip::before {
    content: '';
    position: absolute;
    top: 20px;
    left: -24px;
    width: 0;
    height: 0;
    border-top: 14px solid transparent;
    border-bottom: 14px solid transparent;
    border-right: 24px solid #d63384;
}

.tutorial-tooltip::after {
    content: '';
    position: absolute;
    top: 23px;
    left: -17px;
    width: 0;
    height: 0;
    border-top: 11px solid transparent;
    border-bottom: 11px solid transparent;
    border-right: 17px solid #2a2d38;
}

/* Tail pointing right (tooltip to the left of target) */
.tutorial-tooltip.tail-right::before {
    left: auto;
    right: -24px;
    border-right: none;
    border-left: 24px solid #d63384;
}

.tutorial-tooltip.tail-right::after {
    left: auto;
    right: -17px;
    border-right: none;
    border-left: 17px solid #2a2d38;
}

/* Angled tail pointing up-left at 45 degrees (for menu items) - hidden, using SVG instead */
.tutorial-tooltip.menu-tail::before,
.tutorial-tooltip.menu-tail::after {
    display: none;
}

/* Tail pointing left (tooltip to the right of target, e.g., command palette) */
.tutorial-tooltip.right-of-target::before {
    top: 50%;
    transform: translateY(-50%);
    left: -24px;
    border-top: 14px solid transparent;
    border-bottom: 14px solid transparent;
    border-right: 24px solid #d63384;
    border-left: none;
}

.tutorial-tooltip.right-of-target::after {
    top: 50%;
    transform: translateY(-50%);
    left: -17px;
    border-top: 11px solid transparent;
    border-bottom: 11px solid transparent;
    border-right: 17px solid #2a2d38;
    border-left: none;
}

/* SVG tail for menu tooltips */
.tutorial-menu-tail {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0.15s ease;
}

.tutorial-menu-tail.visible {
    opacity: 1;
    visibility: visible;
}

.tutorial-menu-tail line {
    stroke: #d63384;
    stroke-width: 4;
    stroke-linecap: round;
}

.tutorial-menu-tail .tail-fill {
    fill: #d63384;
}

.tutorial-menu-tail .tail-inner {
    fill: #2a2d38;
}

/* Tail pointing up (tooltip below target) */
.tutorial-tooltip.below::before {
    top: -24px;
    left: 42px;
    border-top: none;
    border-bottom: 24px solid #d63384;
    border-left: 14px solid transparent;
    border-right: 14px solid transparent;
}

.tutorial-tooltip.below::after {
    top: -17px;
    left: 45px;
    border-top: none;
    border-bottom: 17px solid #2a2d38;
    border-left: 11px solid transparent;
    border-right: 11px solid transparent;
}

.tutorial-tooltip.below.tail-right::before {
    left: auto;
    right: 42px;
}

.tutorial-tooltip.below.tail-right::after {
    left: auto;
    right: 45px;
}

/* Tail pointing down (tooltip above target) */
.tutorial-tooltip.above::before {
    top: auto;
    bottom: -24px;
    left: 42px;
    border-bottom: none;
    border-top: 24px solid #d63384;
    border-left: 14px solid transparent;
    border-right: 14px solid transparent;
}

.tutorial-tooltip.above::after {
    top: auto;
    bottom: -17px;
    left: 45px;
    border-bottom: none;
    border-top: 17px solid #2a2d38;
    border-left: 11px solid transparent;
    border-right: 11px solid transparent;
}

.tutorial-tooltip.above.tail-right::before {
    left: auto;
    right: 42px;
}

.tutorial-tooltip.above.tail-right::after {
    left: auto;
    right: 45px;
}

.tutorial-tooltip.visible {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

.tutorial-tooltip-title {
    font-family: 'Bangers', 'Impact', sans-serif;
    font-weight: 400;
    font-size: 1.2rem;
    color: #ff6eb4;
    margin-bottom: 0.4rem;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    text-shadow: 1px 1px 0 rgba(0,0,0,0.3);
}

.tutorial-tooltip-desc {
    color: #c0c0c0;
    font-weight: 400;
}

/* Tutorial welcome popup - centered, no tail */
.tutorial-welcome-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    max-width: 420px;
    width: 90%;
    padding: 1.5rem 1.75rem;
    background: #2a2d38;
    border: 3px solid #d63384;
    border-radius: 18px;
    color: #f0f0f0;
    font-family: 'Comic Neue', 'Comic Sans MS', cursive, sans-serif;
    font-size: 0.95rem;
    line-height: 1.5;
    z-index: 10001;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.25s ease;
    box-shadow:
        4px 4px 0 #d63384,
        inset 0 0 0 2px #3a3d48;
    filter: drop-shadow(2px 4px 12px rgba(0, 0, 0, 0.6));
    text-align: center;
}

.tutorial-welcome-popup.visible {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.tutorial-welcome-popup .tutorial-tooltip-title {
    font-size: 1.4rem;
    margin-bottom: 0.6rem;
}

.tutorial-welcome-popup .tutorial-tooltip-desc {
    margin-bottom: 1.25rem;
}

.tutorial-welcome-popup .tutorial-welcome-dismiss {
    display: inline-block;
    padding: 0.5rem 1.5rem;
    background: #d63384;
    color: #fff;
    border: 2px solid #ff6eb4;
    border-radius: 10px;
    font-family: 'Bangers', 'Impact', sans-serif;
    font-size: 1.05rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.1s ease;
    box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.3);
}

.tutorial-welcome-popup .tutorial-welcome-dismiss:hover {
    background: #e84393;
    transform: translateY(-1px);
}

.tutorial-welcome-popup .tutorial-welcome-dismiss:active {
    transform: translateY(1px);
    box-shadow: 1px 1px 0 rgba(0, 0, 0, 0.3);
}

/* Backdrop overlay for welcome popup */
.tutorial-welcome-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.tutorial-welcome-backdrop.visible {
    opacity: 1;
    visibility: visible;
}

/* Tutorial highlight effect on hover - only on panels and controls, not menus */
body.tutorial-active .panel[data-tutorial]:hover,
body.tutorial-active .stat-card[data-tutorial]:hover,
body.tutorial-active .icon-btn[data-tutorial]:hover {
    outline: 3px dashed #d63384;
    outline-offset: 4px;
}

/* Tutorial Disable Badge - matches "See our demo" badge style */
.tutorial-disable-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 0.75rem;
    padding: 0.5rem 1rem;
    background: var(--bg-deep);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    font-weight: 400;
    text-decoration: none;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.1), 0 0 30px rgba(255, 255, 255, 0.05);
    animation: tutorialBadgeBounce 1s ease-in-out infinite;
    z-index: 100;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    opacity: 0;
    visibility: hidden;
}

.tutorial-disable-badge:hover {
    animation-play-state: paused;
    border-color: var(--text-muted);
}

.tutorial-disable-badge .arrow {
    font-size: 1.1rem;
    font-weight: 300;
    transition: transform 0.2s ease;
}

.tutorial-disable-badge:hover .arrow {
    transform: translateX(-3px);
}

/* Show badge when tutorial is active */
body.tutorial-active .tutorial-disable-badge {
    opacity: 1;
    visibility: visible;
}

/* Hide badge permanently after tutorial has been disabled once */
body.tutorial-badge-hidden .tutorial-disable-badge {
    opacity: 0 !important;
    visibility: hidden !important;
}

@keyframes tutorialBadgeBounce {
    0%, 100% {
        transform: translateX(0);
    }
    50% {
        transform: translateX(-6px);
    }
}

/* ============================================
   Connection Mode Indicator
   ============================================ */

.connection-indicator {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-left: auto;
    padding: 0.35rem 0.75rem;
    background: var(--bg-deep);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: default;
    user-select: none;
}

.connection-indicator .indicator-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

.connection-indicator .indicator-label {
    color: var(--text-muted);
    transition: color 0.3s ease;
}

/* Connected state - green */
.connection-indicator.state-connected .indicator-dot {
    background: var(--accent-primary);
    box-shadow: 0 0 6px rgba(0, 212, 170, 0.5);
    animation: livePulse 2s ease-in-out infinite;
}

.connection-indicator.state-connected .indicator-label {
    color: var(--accent-primary);
}

/* Connecting/authenticating state - blue pulse */
.connection-indicator.state-connecting .indicator-dot,
.connection-indicator.state-authenticating .indicator-dot {
    background: #5bc0de;
    box-shadow: 0 0 6px rgba(91, 192, 222, 0.5);
    animation: connectingPulse 0.8s ease-in-out infinite;
}

.connection-indicator.state-connecting .indicator-label,
.connection-indicator.state-authenticating .indicator-label {
    color: #5bc0de;
}

/* Disconnected state - red, clickable */
.connection-indicator.state-disconnected .indicator-dot {
    background: #d9534f;
    box-shadow: none;
}

.connection-indicator.state-disconnected .indicator-label {
    color: #d9534f;
}

.connection-indicator.state-disconnected:hover {
    background: rgba(217, 83, 79, 0.15);
}

.connection-indicator.state-disconnected:hover .indicator-dot {
    box-shadow: 0 0 8px rgba(217, 83, 79, 0.6);
}

.connection-indicator.state-disconnected:active {
    background: rgba(217, 83, 79, 0.25);
}

@keyframes livePulse {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 6px rgba(0, 212, 170, 0.5);
    }
    50% {
        opacity: 0.7;
        box-shadow: 0 0 12px rgba(0, 212, 170, 0.8);
    }
}

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

/* ============================================
   Subcommand Popup
   ============================================ */

.subcommand-popup {
    position: fixed;
    min-width: 140px;
    max-width: 200px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-10px);
    transition: opacity 0.15s ease, visibility 0.15s ease, transform 0.15s ease;
    clip-path: polygon(
        6px 0, calc(100% - 6px) 0,
        100% 6px, 100% calc(100% - 6px),
        calc(100% - 6px) 100%, 6px 100%,
        0 calc(100% - 6px), 0 6px
    );
}

.subcommand-popup::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    height: 100%;
    background: linear-gradient(180deg, var(--accent-primary), #7b61ff);
}

.subcommand-popup.visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.subcommand-popup-header {
    padding: 0.4rem 0.6rem;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border-subtle);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    color: var(--accent-primary);
    font-weight: 500;
}

.subcommand-option {
    display: block;
    width: 100%;
    padding: 0.5rem 0.6rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    text-align: left;
    cursor: pointer;
    transition: all 0.1s ease;
}

.subcommand-option:hover {
    background: var(--bg-surface);
    color: var(--text-primary);
}

.subcommand-option:active {
    background: rgba(0, 212, 170, 0.1);
}

/* ============================================
   Command Input Modal
   ============================================ */

.command-input-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.command-input-modal.visible {
    opacity: 1;
    visibility: visible;
}

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

.command-input-content {
    position: relative;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    width: 90%;
    max-width: 360px;
    transform: translateY(-20px);
    transition: transform 0.2s ease;
    clip-path: polygon(
        10px 0, calc(100% - 10px) 0,
        100% 10px, 100% calc(100% - 10px),
        calc(100% - 10px) 100%, 10px 100%,
        0 calc(100% - 10px), 0 10px
    );
}

.command-input-modal.visible .command-input-content {
    transform: translateY(0);
}

.command-input-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    height: 100%;
    background: linear-gradient(180deg, var(--accent-primary), #7b61ff);
    z-index: 10;
}

.command-input-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    padding-left: 1.25rem;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-subtle);
}

.command-input-header h4 {
    font-family: 'Cormorant Garamond', serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.command-input-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    transition: color 0.15s ease;
    line-height: 1;
}

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

.command-input-body {
    padding: 1rem 1.25rem;
}

.command-input-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.4;
}

.command-input-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.command-input-field {
    width: 100%;
    padding: 0.6rem 0.75rem;
    background: var(--bg-deep);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    transition: border-color 0.15s ease;
    clip-path: polygon(
        4px 0, calc(100% - 4px) 0,
        100% 4px, 100% calc(100% - 4px),
        calc(100% - 4px) 100%, 4px 100%,
        0 calc(100% - 4px), 0 4px
    );
}

.command-input-field:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.command-input-field::placeholder {
    color: var(--text-muted);
}

.command-input-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--bg-elevated);
    border-top: 1px solid var(--border-subtle);
}

.command-input-cancel,
.command-input-submit {
    padding: 0.45rem 0.9rem;
    font-family: 'Outfit', sans-serif;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s ease;
    clip-path: polygon(
        4px 0, calc(100% - 4px) 0,
        100% 4px, 100% calc(100% - 4px),
        calc(100% - 4px) 100%, 4px 100%,
        0 calc(100% - 4px), 0 4px
    );
}

.command-input-cancel {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.command-input-cancel:hover {
    border-color: var(--text-muted);
    color: var(--text-primary);
}

.command-input-submit {
    background: var(--accent-primary);
    border: 1px solid var(--accent-primary);
    color: var(--bg-deep);
    font-weight: 500;
}

.command-input-submit:hover {
    background: #00e6b8;
    border-color: #00e6b8;
}

.command-input-submit:active {
    transform: scale(0.98);
}

/* Subtle copyright declaration */
.copyright-watermark {
    position: fixed;
    bottom: 0.2rem;
    left: 0.5rem; /* Against left page edge */
    font-family: var(--font-body);
    font-size: 0.65rem;
    color: var(--text-muted);
    opacity: 0.5;
    letter-spacing: 0.02em;
    z-index: 50; /* Below command palette */
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.copyright-watermark:hover {
    opacity: 0.8;
    pointer-events: auto;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   USER PERMISSIONS MODAL
   ═══════════════════════════════════════════════════════════════════════════════ */

.modal-permissions {
    width: 600px;
    max-width: 95vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.permissions-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow: hidden;
}

/* Player Input Section */
.permissions-player-input {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

.permissions-player-input label {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.permissions-player-input input {
    padding: 0.5rem 0.75rem;
    background: var(--bg-deep);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    clip-path: polygon(
        4px 0, calc(100% - 4px) 0,
        100% 4px, 100% calc(100% - 4px),
        calc(100% - 4px) 100%, 4px 100%,
        0 calc(100% - 4px), 0 4px
    );
}

.permissions-player-input input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* Player Info Card */
.permissions-player-info {
    padding: 0.75rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    clip-path: polygon(
        6px 0, calc(100% - 6px) 0,
        100% 6px, 100% calc(100% - 6px),
        calc(100% - 6px) 100%, 6px 100%,
        0 calc(100% - 6px), 0 6px
    );
}

.player-info-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.player-avatar {
    font-size: 1.75rem;
    opacity: 0.7;
}

.player-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.player-name {
    font-family: 'Outfit', sans-serif;
    font-weight: 500;
    font-size: 1rem;
    color: var(--text-primary);
}

.player-id-display {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.player-status {
    padding: 0.25rem 0.6rem;
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    clip-path: polygon(
        3px 0, calc(100% - 3px) 0,
        100% 3px, 100% calc(100% - 3px),
        calc(100% - 3px) 100%, 3px 100%,
        0 calc(100% - 3px), 0 3px
    );
}

.player-status.online {
    background: rgba(0, 210, 160, 0.2);
    color: var(--accent-primary);
}

.player-status.offline {
    background: rgba(255, 77, 77, 0.2);
    color: #ff6b6b;
}

/* Permissions List Container */
.permissions-list-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    border: 1px solid var(--border-subtle);
    clip-path: polygon(
        6px 0, calc(100% - 6px) 0,
        100% 6px, 100% calc(100% - 6px),
        calc(100% - 6px) 100%, 6px 100%,
        0 calc(100% - 6px), 0 6px
    );
}

.permissions-list-header {
    display: grid;
    grid-template-columns: 1fr 120px 100px;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.permissions-list {
    flex: 1;
    overflow-y: auto;
    max-height: 300px;
    background: var(--bg-surface);
}

/* Scrollbar styling */
.permissions-list::-webkit-scrollbar {
    width: 8px;
}

.permissions-list::-webkit-scrollbar-track {
    background: var(--bg-deep);
}

.permissions-list::-webkit-scrollbar-thumb {
    background: var(--border-subtle);
    border-radius: 4px;
}

.permissions-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Permission Categories */
.permissions-category {
    border-bottom: 1px solid var(--border-subtle);
}

.permissions-category:last-child {
    border-bottom: none;
}

.permissions-category-header {
    padding: 0.4rem 0.75rem;
    background: var(--bg-elevated);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent-primary);
    border-bottom: 1px solid var(--border-subtle);
}

/* Permission Row */
.permission-row {
    display: grid;
    grid-template-columns: 1fr 120px 100px;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    align-items: center;
    border-bottom: 1px solid var(--bg-deep);
    transition: background 0.15s ease;
}

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

.permission-row:hover {
    background: var(--bg-elevated);
}

.perm-info {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.perm-name {
    font-size: 0.85rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.perm-desc {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Permission Status Radio Buttons */
.perm-status {
    display: flex;
    gap: 0.25rem;
}

.perm-radio {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.perm-radio input {
    display: none;
}

.radio-label {
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 500;
    border: 1px solid var(--border-subtle);
    transition: all 0.15s ease;
}

.radio-label.off {
    border-radius: 3px 0 0 3px;
    border-right: none;
}

.radio-label.on {
    border-radius: 0 3px 3px 0;
}

.perm-radio input:checked + .radio-label.off {
    background: rgba(255, 77, 77, 0.2);
    border-color: #ff6b6b;
    color: #ff6b6b;
}

.perm-radio input:checked + .radio-label.on {
    background: rgba(0, 210, 160, 0.2);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

/* Permission Expiry Column */
.perm-expiry {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.perm-expiry.disabled {
    opacity: 0.4;
}

.expiry-value {
    flex: 1;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
}

.expiry-edit-btn {
    padding: 0.2rem 0.35rem;
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.15s ease;
    border-radius: 3px;
}

.expiry-edit-btn:hover:not(:disabled) {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

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

/* Expiry Panel */
.permissions-expiry-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 320px;
    background: var(--bg-surface);
    border: 2px solid var(--accent-primary);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 1010;
    clip-path: polygon(
        8px 0, calc(100% - 8px) 0,
        100% 8px, 100% calc(100% - 8px),
        calc(100% - 8px) 100%, 8px 100%,
        0 calc(100% - 8px), 0 8px
    );
}

.expiry-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-subtle);
}

.expiry-perm-name {
    font-weight: 500;
    color: var(--accent-primary);
}

.expiry-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    transition: color 0.15s ease;
    line-height: 1;
}

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

.expiry-panel-body {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.expiry-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: color 0.15s ease;
}

.expiry-option:hover {
    color: var(--text-primary);
}

.expiry-option input[type="radio"] {
    accent-color: var(--accent-primary);
    width: 14px;
    height: 14px;
}

.expiry-option input[type="radio"]:checked + span {
    color: var(--accent-primary);
}

.expiry-duration-inputs,
.expiry-datetime-inputs {
    display: flex;
    gap: 0.5rem;
    margin-left: 1.5rem;
    margin-top: 0.25rem;
}

.expiry-duration-value,
.expiry-duration-unit,
.expiry-date,
.expiry-time {
    padding: 0.4rem 0.6rem;
    background: var(--bg-deep);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
}

.expiry-duration-value {
    width: 60px;
}

.expiry-duration-unit {
    flex: 1;
    font-family: 'Outfit', sans-serif;
}

.expiry-date {
    flex: 1;
}

.expiry-time {
    width: 90px;
}

.expiry-duration-value:focus,
.expiry-duration-unit:focus,
.expiry-date:focus,
.expiry-time:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.expiry-panel-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: var(--bg-elevated);
    border-top: 1px solid var(--border-subtle);
}

/* User Action Modal Description */
.user-action-desc {
    margin-bottom: 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   SETTINGS - USER PERMISSIONS DISPLAY (Live Mode Only)
   ═══════════════════════════════════════════════════════════════════════════════ */

.settings-permissions-section {
    border-top: 1px solid var(--border-subtle);
    padding-top: 1rem;
    margin-top: 0.5rem;
}

.permissions-info-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.user-permissions-display {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 280px;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.user-permissions-display::-webkit-scrollbar {
    width: 6px;
}

.user-permissions-display::-webkit-scrollbar-track {
    background: var(--bg-deep);
}

.user-permissions-display::-webkit-scrollbar-thumb {
    background: var(--border-subtle);
    border-radius: 3px;
}

.user-permissions-display::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Permission Category */
.user-perm-category {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.user-perm-category-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent-primary);
    padding-bottom: 0.25rem;
    border-bottom: 1px solid var(--border-subtle);
}

.user-perm-category-header .category-icon {
    font-size: 0.85rem;
    opacity: 0.8;
}

.user-perm-category-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding-left: 0.25rem;
}

/* Individual Permission Tag */
.user-perm-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.5rem;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: var(--text-secondary);
    transition: all 0.15s ease;
    clip-path: polygon(
        3px 0, calc(100% - 3px) 0,
        100% 3px, 100% calc(100% - 3px),
        calc(100% - 3px) 100%, 3px 100%,
        0 calc(100% - 3px), 0 3px
    );
}

.user-perm-tag .perm-check {
    color: var(--accent-primary);
    font-size: 0.65rem;
}

.user-perm-tag .perm-text {
    color: var(--text-primary);
}

/* Wildcard/Superuser Permission - Special Styling */
.user-perm-tag.wildcard {
    background: rgba(0, 212, 170, 0.1);
    border-color: var(--accent-primary);
}

.user-perm-tag.wildcard .perm-text {
    color: var(--accent-primary);
    font-weight: 500;
}

/* Superuser badge */
.user-perm-superuser {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: linear-gradient(135deg, rgba(0, 212, 170, 0.15), rgba(123, 97, 255, 0.15));
    border: 1px solid var(--accent-primary);
    font-family: 'Outfit', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--accent-primary);
    margin-bottom: 0.5rem;
    clip-path: polygon(
        6px 0, calc(100% - 6px) 0,
        100% 6px, 100% calc(100% - 6px),
        calc(100% - 6px) 100%, 6px 100%,
        0 calc(100% - 6px), 0 6px
    );
}

.user-perm-superuser .superuser-icon {
    font-size: 1rem;
}

.user-perm-superuser .superuser-text {
    flex: 1;
}

.user-perm-superuser .superuser-desc {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* Empty permissions state */
.user-perm-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    text-align: center;
    color: var(--text-muted);
}

.user-perm-empty .empty-icon {
    font-size: 1.5rem;
    opacity: 0.5;
    margin-bottom: 0.5rem;
}

.user-perm-empty .empty-text {
    font-size: 0.8rem;
    line-height: 1.4;
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .modal-permissions {
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        clip-path: none;
    }
    
    .permissions-list-header,
    .permission-row {
        grid-template-columns: 1fr 100px 80px;
    }
    
    .permissions-expiry-panel {
        width: 90%;
        max-width: 320px;
    }
}
