*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    --bg-color: #0d1117;
    --panel-bg: #161b22;
    --header-bg: #1f2428;
    --sidebar-bg: #161b22;
    --sidebar-active: #21262d;
    --border-color: #30363d;
    --text-color: #c9d1d9;
    --text-muted: #8b949e;
    --accent-color: #58a6ff;
    --accent-hover: #1f6feb;
    --error-color: #f85149;
    --success-color: #238636;
    --success-hover: #2ea043;
    --char-width: 9.6px;
    --char-height: 19px;
    --z-sidebar: 1000;
    --z-overlay: 2000;
}

body.no-glass .panel,
body.no-glass .terminal-container,
body.no-glass .settings-card,
body.no-glass .terminal-settings-menu {
    backdrop-filter: none !important;
    background: #161b22 !important;
}

body {
    background-color: #0d1117;
    background: radial-gradient(circle at top left, #1a1f2e, #0d1117);
    color: var(--text-color);
    font-family: 'Outfit', 'Inter', -apple-system, sans-serif;
    margin: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: auto;
}

#app {
    display: grid;
    grid-template-columns: 80px 1fr;
    grid-template-rows: 1fr;
    grid-template-areas:
        "sidebar main";
    height: 100vh;
}

/* Header removed for ultra-compact UI */

.sidebar {
    grid-area: sidebar;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: var(--z-sidebar);
}

.sidebar-header {
    height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--border-color);
    padding: 10px 0;
}

.sidebar-logo {
    width: 40px;
    height: auto;
    margin-bottom: 5px;
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.1));
}

.sidebar-add-btn {
    background: transparent;
    border: none;
    color: var(--accent-color);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border-radius: 50%;
}

.sidebar-add-btn:hover {
    background: rgba(88, 166, 255, 0.1);
    transform: rotate(90deg) scale(1.1);
    color: var(--accent-hover);
}

.sidebar-pcc {
    font-size: 16px;
    color: var(--accent-color);
    font-weight: bold;
    margin-top: -5px;
    margin-bottom: 5px;
    background: rgba(88, 166, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    pointer-events: none;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-btn {
    background: transparent;
    border: none;
    color: var(--text-color);
    padding: 16px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
    font-size: 22px;
    position: relative;
}

.nav-btn span {
    display: none;
}

.nav-btn:hover {
    background-color: var(--sidebar-active);
    color: var(--accent-color);
    transform: scale(1.1);
}

.nav-btn.active {
    background-color: var(--sidebar-active);
    color: var(--accent-color);
    border-right: 4px solid var(--accent-color);
    box-shadow: inset -10px 0 20px rgba(88, 166, 255, 0.05);
    text-shadow: 0 0 15px rgba(88, 166, 255, 0.6);
}

.nav-btn.logout {
    margin-top: auto;
    color: var(--error-color);
}

.nav-btn.logout:hover {
    color: #ff5f56;
    text-shadow: 0 0 15px rgba(255, 95, 86, 0.4);
}

.sidebar-svg,
.terminal-header-svg,
.header-settings-svg {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    stroke-width: 2;
}

.nav-btn.disabled,
.sidebar-add-btn.disabled {
    opacity: 0.15;
    pointer-events: none;
    filter: grayscale(1);
    cursor: default;
}

.sidebar-svg,
.terminal-header-svg {
    width: 24px;
    height: 24px;
}

.nav-btn:hover .sidebar-svg {
    transform: scale(1.1);
}

.nav-btn.active .sidebar-svg {
    filter: drop-shadow(0 0 8px rgba(88, 166, 255, 0.6));
}

.nav-btn.logout:hover .sidebar-svg {
    color: #ff5f56;
    filter: drop-shadow(0 0 8px rgba(255, 95, 86, 0.6));
}

.sidebar-footer {
    padding: 10px 0;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.sidebar-user-info {
    padding: 12px 0;
    width: 100%;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    border-bottom: 1px solid rgba(48, 54, 61, 0.5);
    margin-bottom: 5px;
}

.sidebar-user-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    max-width: 70px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

main {
    grid-area: main;
    position: relative;
    padding: 40px;
    overflow: auto;
}

.role-badge {
    font-size: 11px;
    background: var(--accent-color);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 8px;
    text-transform: uppercase;
    font-weight: 600;
}

.mobile-ui header {
    display: none !important;
}

/* Mobile Enhanced Selection */
.selection-handle {
    position: absolute;
    width: 14px;
    height: 14px;
    background: #00ff00;
    border-radius: 50%;
    z-index: 2000;
    box-shadow: 0 0 8px rgba(0, 255, 0, 0.6);
    pointer-events: auto;
    touch-action: none;
    transform: translate(-50%, -50%);
}

.selection-handle::after {
    content: '';
    position: absolute;
    top: -15px;
    left: -15px;
    right: -15px;
    bottom: -15px;
}

.selection-loupe {
    position: fixed;
    width: 120px;
    height: 120px;
    border: 2px solid #00ff00;
    border-radius: 50%;
    background: #0d1117;
    z-index: 3000;
    pointer-events: none;
    display: none;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
    transform: translate(-50%, -130%);
}

.loupe-content {
    position: absolute;
    transform-origin: 0 0;
    background: inherit;
}

.mobile-selection-toolbar {
    position: fixed;
    background: #ffffff;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid #ddd;
    border-radius: 25px;
    padding: 8px 16px;
    display: none;
    flex-direction: row;
    gap: 16px;
    z-index: 2500;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.3);
    transform: translate(-50%, -100%);
    margin-top: -10px;
}

.toolbar-btn {
    background: none;
    border: none;
    outline: none;
    color: #000;
    font-size: 14px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.toolbar-btn:active {
    background: rgba(0, 0, 0, 0.05);
}

.toolbar-divider {
    width: 1px;
    height: 16px;
    background: rgba(0, 0, 0, 0.1);
    align-self: center;
}

.mobile-ui #addTerminalBtn {
    display: none !important;
}

.mobile-ui .terminal-container {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100%;
    /* Removed !important to allow JS resizing */
    min-width: 0 !important;
    max-width: 100vw !important;
    border-radius: 0 !important;
    border-left: none !important;
    border-right: none !important;
    border-bottom: none !important;
    box-shadow: none !important;
    z-index: 100 !important;
    display: flex !important;
    flex-direction: column !important;
    touch-action: auto !important;
    font-size: 14px !important;
}

.mobile-ui .terminal-header {
    cursor: default !important;
    border-radius: 0 !important;
}

.mobile-ui .terminal-dots,
.mobile-ui .close-btn,
.mobile-ui .resize-handle {
    display: none !important;
}

.mobile-ui .terminal-content {
    flex: 1;
    height: auto;
    min-height: 100px;
    order: 2;
    overflow-x: auto !important;
    overflow-y: auto !important;
    padding-bottom: 2px !important;
    margin-bottom: 0 !important;
}

.mobile-ui .terminal-tabs {
    order: 1;
}

.mobile-ui .availability-popup {
    position: relative !important;
    bottom: 0 !important;
    margin-left: auto !important;
    width: fit-content !important;
    height: 24px !important;
    /* Balanced height for mobile */
    order: 3;
    /* Above virtual keyboard */
    border-radius: 8px 0 0 0 !important;
    z-index: 10 !important;
    background: #3498db !important;
    border-right: none !important;
    border-bottom: none !important;
}

.mobile-ui .terminal-history-area,
.mobile-ui .history-entry {
    font-size: 12px !important;
}

.mobile-ui #historyPanel {
    display: none !important;
}

/* Virtual Keyboard Styling */
.virtual-keyboard {
    display: none;
    /* Hidden on desktop */
}

.terminal-history-area {
    font-family: monospace;
    font-size: 110%;
    line-height: normal;
    color: var(--text-color);
    padding: 5px;
    overflow-x: auto;
    white-space: pre;
}

.history-entry {
    margin-bottom: 8px;
    white-space: pre;
    width: fit-content;
    display: block;
    font-family: monospace;
    font-variant-ligatures: none;
    transition: background 0.2s;
}

.history-entry.selected {
    background: rgba(88, 166, 255, 0.6);
    box-shadow: 0 0 4px rgba(88, 166, 255, 0.4);
}

.selection-hl {
    background: rgba(88, 166, 255, 0.7);
    color: white;
    border-radius: 2px;
}

.kb-key {
    background: #373e47;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 6px;
    /* Reduced vertical footprint */
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    /* Slightly smaller font */
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: all 0.1s;
    user-select: none;
    touch-action: manipulation;
}

.mobile-ui .kb-key {
    padding: 4px !important;
    font-size: 11px !important;
    min-width: 0 !important;
}

.kb-key:active {
    background: #58a6ff;
    transform: translateY(2px);
    box-shadow: none;
}

h1 {
    font-size: 1.2rem;
    margin: 0;
    font-weight: 600;
    color: var(--accent-color);
}

main {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: radial-gradient(circle at center, #1a202c, #0d1117);
}

.panel {
    position: absolute;
    background: rgba(22, 27, 34, 0.98);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 10;
    min-width: 200px;
    min-height: 150px;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.panel.active {
    border-color: rgba(88, 166, 255, 0.5);
    box-shadow: 0 0 20px rgba(88, 166, 255, 0.2), 0 12px 48px rgba(0, 0, 0, 0.7);
}

.terminal-container.active {
    border-color: rgba(88, 166, 255, 0.6);
}

.panel-header {
    background-color: var(--border-color);
    padding: 0.6rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
    user-select: none;
    flex-shrink: 0;
    touch-action: none;
}

.panel-title {
    font-size: 11px;
    font-weight: 600;
    color: #8b949e;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.panel-controls {
    display: flex;
    gap: 8px;
}

.panel-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.panel-dot.yellow {
    background-color: #ffbd2e;
}

.panel-dot.green {
    background-color: #27c93f;
}

.dock-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #8b949e;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    padding: 2px 6px;
    transition: all 0.2s;
}

.dock-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #58a6ff;
}

.panel.docked,
.terminal-container.docked {
    box-shadow: none !important;
}

.panel.docked-br,
.terminal-container.docked-br {
    bottom: 0 !important;
    right: 0 !important;
    top: auto !important;
    left: auto !important;
    border-radius: 8px 0 0 0 !important;
    border-bottom: none !important;
    border-right: none !important;
}

.panel.docked-bl,
.terminal-container.docked-bl {
    bottom: 0 !important;
    left: 0 !important;
    top: auto !important;
    right: auto !important;
    border-radius: 0 8px 0 0 !important;
    border-bottom: none !important;
    border-left: none !important;
}

.panel.docked-tr,
.terminal-container.docked-tr {
    top: 0 !important;
    right: 0 !important;
    bottom: auto !important;
    left: auto !important;
    border-radius: 0 0 0 8px !important;
    border-top: none !important;
    border-right: none !important;
}

.panel.docked-tl,
.terminal-container.docked-tl {
    top: 0 !important;
    left: 0 !important;
    bottom: auto !important;
    right: auto !important;
    border-radius: 0 0 8px 0 !important;
    border-top: none !important;
    border-left: none !important;
}

.panel.docking-preview,
.terminal-container.docking-preview {
    opacity: 0.6;
    border: 2px dashed var(--accent-color);
    transition: all 0.2s;
}

.panel:not(.dragging) {
    transition: top 0.3s, left 0.3s, width 0.3s, height 0.3s, opacity 0.3s, transform 0.3s;
}

.panel-content {
    flex: 1;
    padding: 1px;
    overflow-y: auto;
    user-select: text !important;
    cursor: text !important;
    -webkit-user-select: text !important;
    -webkit-touch-callout: default !important;
}

.resize-handle {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 15px;
    height: 15px;
    cursor: se-resize;
    background: linear-gradient(135deg, transparent 50%, rgba(255, 255, 255, 0.2) 50%);
    z-index: 11;
    touch-action: none;
}

.terminal-container {
    position: absolute;
    width: 600px;
    height: 440px;
    min-width: 400px;
    min-height: 250px;
    max-width: 95vw;
    background: var(--term-bg-color, #0a3536);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    cursor: default;
    z-index: 10;
    user-select: text !important;
    -webkit-user-select: text !important;
    -webkit-touch-callout: default !important;

    /* Scoped variables for customization */
    --term-font-size: 16px;
    --term-bg-color: #0a3536;
    --term-text-color: #dfd3d3;
}

.terminal-header {
    background-color: var(--border-color);
    padding: 0.6rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
    user-select: none;
    flex-shrink: 0;
    touch-action: none;
}

.terminal-dots {
    display: flex;
    gap: 8px;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    cursor: pointer;
}

.dot.red {
    background-color: #ff5f56;
}

.dot.yellow {
    background-color: #ffbd2e;
}

.dot.green {
    background-color: #27c93f;
}

.dot.highlighted {
    opacity: 1;
    box-shadow: 0 0 12px currentColor;
    transform: scale(1.1);
}

.dot.dimmed {
    opacity: 0.3;
    filter: grayscale(0.5);
}

.close-btn {
    color: #8b949e;
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
    transition: color 0.2s;
}

.terminal-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.terminal-ui-toggle-btn {
    display: none !important;
}

.mobile-ui .terminal-ui-toggle-btn {
    display: flex !important;
}

/* Hide toggle icon in header on narrow screens (<=768px) */
@media (max-width: 768px) {
    .terminal-ui-toggle-btn {
        display: none !important;
    }
}

.terminal-settings-btn,
.terminal-history-toggle-btn,
.terminal-ui-toggle-btn,
.terminal-logout-btn,
.modifier-btn {
    cursor: pointer;
    opacity: 0.7;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    border-radius: 4px;
    color: #8b949e;
    font-size: 11px;
    font-weight: bold;
    border: 1px solid transparent;
}

.terminal-settings-btn:hover,
.terminal-history-toggle-btn:hover,
.terminal-ui-toggle-btn:hover,
.terminal-logout-btn:hover,
.modifier-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent-color);
}

.modifier-btn.active {
    opacity: 1;
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-hover);
    box-shadow: 0 0 10px rgba(88, 166, 255, 0.4);
}

.close-btn:hover {
    color: #ff5f56;
}

.terminal-container.loading {
    pointer-events: none;
    opacity: 1.0;
}

.availability-popup {
    position: absolute;
    bottom: 0px;
    right: 0px;
    left: auto;
    height: 22px;
    background: #3498db;
    display: flex;
    align-items: center;
    padding: 0 10px;
    font-size: 10px;
    color: white;
    box-shadow: none;
    z-index: 100;
    display: none;
    border-top-left-radius: 4px;
    border-bottom-right-radius: 12px;
    width: fit-content;
    gap: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-bottom: none;
    border-right: none;
}

.popup-elements-right {
    display: flex;
    align-items: center;
    gap: 4px;
}

.availability-popup.visible {
    display: flex;
}

.pax-selector {
    position: relative;
    background: rgba(255, 255, 255, 0.15);
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    height: 24px;
}

.pax-selector:hover {
    background: rgba(255, 255, 255, 0.25);
}

.pax-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    background: white;
    color: #333;
    border: 1px solid #ccc;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    min-width: 90px;
    z-index: 10;
    border-radius: 4px 4px 0 0;
}

.pax-dropdown.visible {
    display: flex;
}

.pax-item {
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.pax-item:hover {
    background: #f4f4f4;
}

.pax-item.active {
    background: #eef7ff;
    color: #3498db;
    font-weight: bold;
}

.date-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.date-btn {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    height: 24px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
    min-width: 32px;
}

.date-btn:hover {
    background: rgba(255, 255, 255, 0.35);
}

.current-date {
    font-weight: bold;
    background: rgba(0, 0, 0, 0.15);
    height: 24px;
    padding: 0 12px;
    border-radius: 4px;
    display: flex;
    align-items: center;
}

.terminal-container.with-popup .terminal-content {
    margin-bottom: 0;
    padding-bottom: 48px;
    /* Protect content from floating popup */
}

.mobile-ui .terminal-container.with-popup .terminal-content {
    margin-bottom: 0 !important;
}

.terminal-title {
    font-size: 11px;
    font-weight: 600;
    color: #8b949e;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* TERMINAL CONTENT */
.terminal-content {
    flex: 1;
    height: 400px;
    /* Fixed 20 lines on desktop (20 * 20px) */
    padding: 10px;
    font-family: monospace;
    font-size: var(--term-font-size, 16px) !important;
    background-color: var(--term-bg-color, #0a3536) !important;
    color: var(--term-text-color, #dfd3d3) !important;
    line-height: normal;
    /* Use specific px height for lines in JS to matches 20px */
    overflow-y: auto;
    /* Allow auto-scroll */
    overflow-x: hidden;
    white-space: pre;
    position: relative;
    outline: none;
    user-select: text !important;
    cursor: text !important;
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    -webkit-touch-callout: default !important;
    /* Pixel-perfect sharpness */
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    -webkit-font-smoothing: none;
    -moz-osx-font-smoothing: grayscale;
    touch-action: auto !important;
    pointer-events: auto !important;
}

.hidden-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    z-index: 1000;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: none;
    outline: none;
    resize: none;
    padding: 0;
    margin: 0;
    overflow: hidden;
    /* Ensure no visual artifacts but still detectable by browser for focus */
}

.cursor {
    width: 9.1px;
    height: 1.2em;
    background-color: yellow;
    position: absolute;
    pointer-events: none;
    opacity: 0;
    transition: width 0.1s, background-color 0.1s;
}

.cursor.insert-mode {
    width: 2px;
    background-color: red;
}


.terminal-container.active .cursor {
    animation: blink 0.8s step-end infinite;
    opacity: 1;
}

@keyframes blink {
    from,
    to {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

.cursor.loading {
    background-color: ff2e36 !important; /* Red loading cursor */
    animation: cursor-loading-pulse 0.5s ease-in-out infinite alternate !important;
    opacity: 1 !important;
    box-shadow: 0 0 10px ff2e36;
    width: 9.1px !important; /* Force block mode during loading */
}

@keyframes cursor-loading-pulse {
    from { transform: scale(0.9); opacity: 0.6; }
    to { transform: scale(1.1); opacity: 1; }
}

/* Status Dot Loading Spinner (Desktop) */
.dot.loading-spinner {
    display: inline-block !important;
    width: 14px !important;
    height: 14px !important;
    border: 2px solid rgba(255, 255, 255, 0.2) !important;
    border-top-color: #fff !important;
    border-radius: 50% !important;
    background-color: transparent !important;
    animation: rotate-spinner 2.5s linear infinite !important;
    box-shadow: none !important;
}

@keyframes rotate-spinner {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Generic Loading Spinner (for Mobile Title Bar, etc) */
.loading-spinner {
    display: none;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: rotate-spinner 0.8s linear infinite;
    vertical-align: middle;
    margin-left: 10px;
    flex-shrink: 0;
}

/* Show spinner next to title ONLY on mobile when terminal is loading */
.mobile-ui .loading .loading-spinner {
    display: inline-block;
}


.add-btn {
    background: var(--accent-color);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.add-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 15px var(--accent-color);
}

.terminal-line {
    display: block;
    height: 1.25em;
    width: 100%;
    user-select: text;
    -webkit-user-select: text;
}

.mobile-ui .terminal-line {
    user-select: none !important;
    -webkit-user-select: none !important;
    -webkit-touch-callout: none !important;
}

.clickable-cell {
    display: inline-block;
    width: var(--char-width, 9.046875px);
    height: 1.25em;
    vertical-align: top;
    font-size: var(--term-font-size, 16px) !important;

    /* Ensure no subpixel blur on cells */
    image-rendering: pixelated;
    -webkit-font-smoothing: none;
    user-select: text !important;
}

/* Sharp clickable regions */
.segment-class {
    font-weight: normal;
    cursor: pointer;
    text-decoration: none;
}

.segment-class.unclickable {
    cursor: default !important;
    pointer-events: none !important;
    opacity: 0.8;
}

.segment-class:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.tabstop {
    color: #5b6673;
    font-weight: bold;
}

/* Terminal Tabs Styling */
.mobile-ui .terminal-tabs {
    display: flex !important;
}

.terminal-tabs {
    display: none;
    /* Hidden on desktop */
    background: #1e2229;
    border-bottom: 2px solid var(--border-color);
    padding: 0 4px;
    gap: 4px;
    align-items: flex-end;
    /* Align tabs to baseline */
    height: 38px;
    overflow-x: auto;
    overflow-y: hidden;
}

.terminal-tab {
    padding: 6px 14px;
    font-size: 11px;
    color: #8b949e;
    background: #2d333b;
    border: 1px solid var(--border-color);
    border-bottom: none;
    cursor: pointer;
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
    white-space: nowrap;
    transition: all 0.2s;
    user-select: none;
    margin-bottom: -1px;
    /* Overlap border */
    position: relative;
    /* For close button positioning */
}

.terminal-tab.active {
    color: #58a6ff;
    background: var(--terminal-bg);
    border-color: var(--border-color);
    border-bottom: 2px solid var(--terminal-bg);
    font-weight: 600;
    z-index: 2;
}

.terminal-tab:hover:not(.active) {
    background: #373e47;
    color: #c9d1d9;
}

.tab-add-btn {
    padding: 4px 10px;
    color: #8b949e;
    cursor: pointer;
    font-size: 18px;
    border-radius: 4px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.tab-add-btn:hover {
    background: #21262d;
    color: #58a6ff;
}

/* Tab Close Button */
.tab-close {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 18px;
    height: 18px;
    background: #ff5f56;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    border: 2px solid #1e2229;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    z-index: 5;
    transition: transform 0.2s;
}

.tab-close:hover {
    transform: scale(1.2);
    background: #ff3b30;
}

.popup-close-btn {
    transition: color 0.2s, transform 0.2s;
}

.popup-close-btn:hover {
    color: #ff5f56;
    transform: scale(1.2);
}

/* Availability Coloring - Sharp & Vibrant */
.class-available {
    color: #07e938 !important;
}

.class-waitlist {
    color: #ffa500 !important;
}

.class-restricted {
    color: #8b8b8b !important;
    pointer-events: none !important;
    cursor: default !important;
}

.class-selected {
    background-color: rgba(255, 255, 255, 0.5) !important;
    border-radius: 1px;
}

/* FINAL OVERRIDE FOR MOBILE KEYBOARD GRID */
.mobile-ui .terminal-container .virtual-keyboard {
    display: grid !important;
    grid-template-columns: repeat(5, 1fr) !important;
    grid-template-rows: repeat(2, 1fr) !important;
    gap: 4px !important;
    padding: 4px !important;
    background: #1e2229 !important;
    border-top: 1px solid var(--border-color) !important;
    order: 4;
}

/* Terminal Customization Menu */
.terminal-settings-btn,
.terminal-logout-btn {
    color: #8b949e;
    cursor: pointer;
    font-size: 18px;
    padding: 0 4px;
    transition: color 0.2s;
    display: flex;
    align-items: center;
}

.terminal-settings-btn:hover,
.terminal-logout-btn:hover {
    color: var(--accent-color);
}

.terminal-settings-menu {
    position: absolute;
    top: 45px;
    right: 15px;
    background: #161b22;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    z-index: 1000;
    width: 220px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
    display: none;
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.terminal-settings-menu.visible {
    display: block;
}

.settings-section {
    margin-bottom: 16px;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-label {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    color: #8b949e;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.color-palette {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.color-option {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.1);
    transition: transform 0.1s, border-color 0.2s;
}

.color-option:hover {
    transform: scale(1.15);
    border-color: rgba(255, 255, 255, 0.4);
}

.color-option.active {
    border-color: var(--accent-color);
    box-shadow: 0 0 8px var(--accent-color);
}

.font-controls {
    display: flex;
    gap: 8px;
}

.font-btn {
    background: #21262d;
    color: white;
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    flex: 1;
    font-weight: bold;
    font-size: 16px;
    transition: all 0.2s;
}

.font-btn:hover {
    background: var(--accent-color);
    border-color: var(--accent-color);
}

.font-value {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-family: monospace;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
}

.color-picker {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px;
    background: #21262d;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    margin-top: 8px;
}

.color-picker-sat-val {
    position: relative;
    width: 100%;
    height: 120px;
    border-radius: 4px;
    cursor: crosshair;
    overflow: hidden;
    /* Base color is set via JS */
    background-image: linear-gradient(to top, #000, transparent),
        linear-gradient(to right, #fff, transparent);
}

.color-picker-marker {
    position: absolute;
    width: 12px;
    height: 12px;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 2;
}

.color-picker-hue {
    position: relative;
    width: 100%;
    height: 12px;
    border-radius: 6px;
    cursor: pointer;
    background: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);
}

.color-picker-hue-handle {
    position: absolute;
    top: 50%;
    width: 16px;
    height: 16px;
    background: #fff;
    border: 2px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.color-picker-footer {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-preview-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.1);
    background: #f00;
    flex-shrink: 0;
}

.color-inputs-grid {
    display: flex;
    gap: 4px;
    flex: 1;
}

.color-input-field {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
}

.color-input-field input {
    width: 100%;
    background: #0d1117;
    border: 1px solid var(--border-color);
    color: #fff;
    padding: 4px 0;
    text-align: center;
    border-radius: 4px;
    font-size: 11px;
    font-family: monospace;
}

.color-input-field span {
    font-size: 9px;
    color: #8b949e;
    margin-top: 2px;
    font-weight: 600;
}

.hex-input-section {
    display: flex;
    flex-direction: column;
    width: 60px;
}

.hex-input-section input {
    background: #0d1117;
    border: 1px solid var(--border-color);
    color: #fff;
    padding: 4px;
    text-align: center;
    border-radius: 4px;
    font-size: 11px;
    font-family: monospace;
}

.hex-input-section span {
    font-size: 9px;
    color: #8b949e;
    margin-top: 2px;
    text-align: center;
    font-weight: 600;
}

/* Update settings section to accommodate picker */
.settings-section-picker {
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
    margin-top: 12px;
}

/* Button to toggle between palette and advanced */
.picker-toggle-btn {
    background: none;
    border: none;
    color: var(--accent-color);
    font-size: 10px;
    text-transform: uppercase;
    font-weight: 700;
    cursor: pointer;
    padding: 4px 0;
    margin-bottom: 8px;
    display: inline-block;
    transition: opacity 0.2s;
}

.picker-toggle-btn:hover {
    opacity: 0.8;
}

#history,
.panel-content {
    user-select: text !important;
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    cursor: text !important;
}

/* Overlay Views */
.view-overlay {
    position: fixed;
    top: 0;
    left: 80px;
    right: 0;
    bottom: 0;
    background-color: var(--bg-color);
    z-index: var(--z-overlay);
    display: flex;
    flex-direction: column;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(0);
    }
}

.overlay-header {
    height: 60px;
    padding: 0 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
}

.close-overlay {
    background: transparent;
    border: none;
    color: var(--text-color);
    font-size: 24px;
    cursor: pointer;
}

.overlay-content {
    flex: 1;
    padding: 40px;
    overflow: auto;
}



/* Premium Loading Spinner (used in full-page loading containers) */
.loading-container .loading-spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: var(--accent-color);
    animation: spin 1s ease-in-out infinite;
    margin-right: 10px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-container {
    display: flex;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    font-size: 14px;
}

/* Management & Reports UI */
.management-tabs {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    padding: 10px 5px;
    position: relative;
    transition: color 0.3s;
}

.tab-btn.active {
    color: var(--accent-color);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -11px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent-color);
}

.action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.action-bar-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.filter-select {
    width: auto !important;
    min-width: 140px;
    padding: 8px 12px !important;
    background-color: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid var(--border-color) !important;
    height: 38px !important;
}

.btn-primary {
    background: #136491;
    color: white;
    border: none;
    padding: 0px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    /*display: flex;*/
    align-items: center;
    gap: 8px;
    transition: transform 0.2s, opacity 0.2s;
    height: 30px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    opacity: 0.9;
}

.mgmt-table-container {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.mgmt-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.mgmt-table th {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px 20px;
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
}

.mgmt-table th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background 0.2s, color 0.2s;
}

.mgmt-table th.sortable:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent-color);
}

.mgmt-table th.sortable::after {
    content: '↕';
    margin-left: 8px;
    opacity: 0.3;
    font-size: 10px;
    display: inline-block;
    transition: transform 0.2s, opacity 0.2s;
}

.mgmt-table th.sortable.asc::after {
    content: '↑';
    opacity: 1;
    color: var(--accent-color);
}

.mgmt-table th.sortable.desc::after {
    content: '↓';
    opacity: 1;
    color: var(--accent-color);
}

.mgmt-table td {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
}

.mgmt-table tr:last-child td {
    border-bottom: none;
}

.mgmt-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.status-badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.status-badge.active {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.status-badge.inactive {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.action-btns {
    display: flex;
    gap: 10px;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 16px;
    transition: color 0.2s;
}

.icon-btn:hover {
    color: var(--accent-color);
}

.icon-btn.delete:hover {
    color: #ef4444;
}

/* Dashboard Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);
    border: 1px solid var(--border-color);
    padding: 25px;
    border-radius: 16px;
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-label {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    display: block;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 32px;
    font-weight: 800;
    color: var(--accent-color);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: none;
    z-index: 10000;
    opacity: 0;
    animation: fadeIn 0.3s forwards;
}

.modal-content {
    background: #1a1f2e;
    border: 1px solid var(--border-color);
    /*width: 100%;*/
    max-width: 400px;
    border-radius: 5px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    position: absolute;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    to {
        transform: translateY(0);
    }
}

.modal-header {
	touch-action: none;
    padding: 15px 30px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
    user-select: none;
    height: 40px;
    background-color: #136491;
    font-size: 12px;
}

.modal-body {
    padding: 35px;
    font-size: 12px;
}

.modal-footer {
    padding: 0px 30px;
    /*border-top: 1px solid var(--border-color);*/
    display: flex;
    justify-content: flex-end;
    gap: 35px;
    background: rgb(26 31 46);
    height: 35px;
    font-size: 12px;
}

.form-group {
    margin-bottom: 5px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    background: #252a36 !important;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px 15px;
    color: #e6edf3 !important;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
    color-scheme: dark;
}

select.form-control option {
    background-color: #161b22 !important;
    color: #e6edf3 !important;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.btn-secondary {
    background: transparent;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    padding: 0px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    height: 30px;
    width: 80px;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
}

.btn-success {
    background: var(--success-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-success:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
    box-shadow: 0 0 15px rgba(35, 134, 54, 0.4);
}

.btn-success:active {
    transform: translateY(0);
}

.btn-danger {
    background: var(--error-color, #f85149);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-danger:hover {
    filter: brightness(1.1);
    transform: translateY(-2px);
    box-shadow: 0 0 15px rgba(248, 81, 73, 0.4);
}

.btn-danger:active {
    transform: translateY(0);
}

.warning-text {
    color: var(--error-color);
    font-size: 11px;
    margin-top: 5px;
    display: block;
    font-weight: 500;
}

.is-invalid {
    border-color: var(--error-color) !important;
    box-shadow: 0 0 0 3px rgba(248, 81, 73, 0.1) !important;
}

/* Replay Entries Styles */
.replay-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 10px;
    padding: 0px;
    background: #111;
    /* Consistent dark terminal background */
    color: #00ff41;
    /* Classic terminal green */
}

.replay-list-container {
    flex: 1;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(0, 255, 65, 0.2);
    border-radius: 4px;
    overflow-y: auto;
    min-height: 400px;
    display: flex;
    flex-direction: column;
    font-family: 'JetBrains Mono', monospace;
}

/* Ensure the internal list scrollbar is visible and themed */
.replay-list-container::-webkit-scrollbar {
    width: 8px;
    display: block !important;
}

.replay-list-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

.replay-list-container::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 65, 0.3);
    border-radius: 4px;
}

.replay-list-container::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 255, 65, 0.5);
}

/* Hide scrollbar for the Replay panel window and its content container */
#replayPanel,
#replayPanel .panel-content {
    scrollbar-width: none;
    /* Firefox */
    -ms-overflow-style: none;
    /* IE and Edge */
}

#replayPanel::-webkit-scrollbar,
#replayPanel .panel-content::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari and Opera */
}

.replay-item {
    padding: 8px 15px;
    border-bottom: 1px solid rgba(0, 255, 65, 0.05);
    cursor: pointer;
    transition: all 0.1s ease;
    user-select: none;
    font-size: 13px;
    display: flex;
    align-items: center;
    color: #00ff41;
}

.replay-item:hover {
    background: rgba(0, 255, 65, 0.08);
}

.replay-item.selected {
    background: rgba(0, 255, 65, 0.2);
    color: #fff;
    border-left: 3px solid #00ff41;
}

.replay-item::before {
    content: '>';
    margin-right: 12px;
    color: #00ff41;
    opacity: 0.6;
    font-weight: bold;
}

.replay-actions {
    display: flex;
    align-items: center;
    gap: 0px;
    padding: 0px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 6px;
    border: 1px solid rgba(0, 255, 65, 0.1);
}

.btn-replay {
    padding: 6px 15px;
    border: 1px solid rgba(0, 255, 65, 0.4);
    background: rgba(0, 255, 65, 0.05);
    color: #00ff41;
    border-radius: 3px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: 'JetBrains Mono', monospace;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
}

.btn-replay:hover:not(:disabled) {
    background: #00ff41;
    color: #000;
    box-shadow: 0 0 10px rgba(0, 255, 65, 0.3);
}

.btn-replay:disabled {
    opacity: 0.5;
    cursor: wait;
    border-color: rgba(255, 255, 255, 0.2);
    color: #888;
}

.btn-replay.delete {
    border-color: rgba(255, 82, 82, 0.4);
    color: #ff5252;
    background: rgba(255, 82, 82, 0.05);
}

.btn-replay.delete:hover:not(:disabled) {
    background: #ff5252;
    color: #fff;
    box-shadow: 0 0 10px rgba(255, 82, 82, 0.3);
}

.recording-limit-group {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
    color: var(--text-color);
    font-size: 14px;
    font-weight: 600;
}

.limit-input {
    width: 40px;
    padding: 0px 0px;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    border-radius: 6px;
    font-family: 'JetBrains Mono', monospace;
    text-align: center;
    font-weight: bold;
}

/* --- High Specificity Highlighting & Mobile Overrides --- */

/* Active Terminal Container & Header Highlight */
.terminal-container.active {
    border: 1px solid rgba(88, 166, 255, 0.5) !important;
}

.terminal-container.active .terminal-header {
    background: linear-gradient(to right, #21262d, #2d333b) !important;
    border-bottom: 2px solid var(--accent-color) !important;
}

.terminal-container.active .terminal-title {
    color: var(--accent-color) !important;
    text-shadow: 0 0 8px rgba(88, 166, 255, 0.5);
}


/* Management Form Constraints */
#marketName {
    width: 18ch !important;
}

#agencyName {
    width: 42ch !important;
}

#agencyPcc {
    width: 8ch !important;
    text-align: center;
    font-family: 'JetBrains Mono', monospace;
}

#agencyMarketId {
    width: 16ch !important;
}

#agencyIpcs {
    width: 16ch !important;
}

#agencyRegion {
    width: 22ch !important;
}

#userNameInput {
    width: 42ch !important;
}

#userEmail {
    width: 42ch !important;
}

#userPassword {
    width: 42ch !important;
}

#userRoleSelect {
    width: 15ch !important;
}

#userAgencyId {
    width: 42ch !important;
}

#userClientId {
    width: 18ch !important;
    font-family: 'JetBrains Mono', monospace;
}

/* Pro Settings Dashboard Layout */
.settings-layout {
    display: flex;
    height: 100%;
    gap: 0;
    margin: -40px;
    /* Offset parent padding */
}

.settings-sidebar {
    width: 240px;
    background: rgba(22, 27, 34, 0.4);
    border-right: 1px solid var(--border-color);
    padding: 20px 0;
    display: flex;
    flex-direction: column;
}

.settings-main {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
    background: radial-gradient(circle at top right, rgba(88, 166, 255, 0.03), transparent);
}

.settings-nav-item {
    padding: 12px 24px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    text-align: left;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 12px;
}

.settings-nav-item:hover {
    color: var(--text-color);
    background: rgba(255, 255, 255, 0.05);
}

.settings-nav-item.active {
    color: var(--accent-color);
    background: rgba(88, 166, 255, 0.1);
    border-right: 3px solid var(--accent-color);
}

.settings-category-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 30px;
    color: var(--text-color);
    letter-spacing: -0.5px;
}

.settings-group {
    margin-bottom: 40px;
    animation: fadeIn 0.3s ease-out;
}

.settings-card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    transition: all 0.3s;
}

.settings-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(88, 166, 255, 0.2);
    transform: translateY(-2px);
}

.settings-card h4 {
    margin: 0 0 16px 0;
    color: var(--accent-color);
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 800;
}

.settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.settings-row:last-child {
    border-bottom: none;
}

.settings-info {
    flex: 1;
    padding-right: 20px;
}

.settings-info label {
    display: block;
    color: var(--text-color);
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 14px;
}

.settings-info p {
    color: var(--text-muted);
    font-size: 12px;
    margin: 0;
}

/* Premium Switches */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #373e47;
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked+.slider {
    background: linear-gradient(135deg, var(--accent-color), var(--accent-hover));
}

input:checked+.slider:before {
    transform: translateX(20px);
}

.settings-action-btn {
    background: rgba(88, 166, 255, 0.1);
    color: var(--accent-color);
    border: 1px solid rgba(88, 166, 255, 0.2);
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 13px;
}

.settings-action-btn:hover {
    background: var(--accent-color);
    color: white;
    box-shadow: 0 0 15px rgba(88, 166, 255, 0.3);
}

.terminal-history-area {
    padding: 1px;
    height: 100%;
    overflow-y: auto;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.settings-nav-icon {
    width: 18px;
    height: 18px;
    opacity: 0.7;
}

.settings-nav-item.active .settings-nav-icon {
    opacity: 1;
}

.terminal-selection {
    background-color: #023FA9 !important;
    color: white !important;
    border-radius: 1px;
}

/* Global Mobile Overrides (Consolidated) */
.mobile-ui #app {
    grid-template-columns: 1fr !important;
}

.mobile-ui aside#sidebar.sidebar {
    display: none !important;
}

.mobile-ui .view-overlay {
    left: 0 !important;
    width: 100vw !important;
}

.mobile-ui header {
    display: none !important;
}