@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg: #0a0a0b;
    --panel-bg: rgba(255, 255, 255, 0.02);
    --border: rgba(255, 255, 255, 0.05);
    --text: #ffffff;
    --text-dim: #94a3b8;
    --accent: #ffffff;
    --item-radius: 0.8rem;
    --sidebar-width: 350px;
    --token-panel-width: 380px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background: #0d0d0f;
    color: var(--text);
    height: 100vh;
    overflow: hidden;
    position: relative;
}

body.easter-egg-mode {
    background-image: url('../assets/background.jpg');
    background-color: #000;
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -5;
    background: transparent;
    pointer-events: none;
    transition: all 0.5s ease;
    opacity: 0;
}

body.easter-egg-mode::after {
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 1;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.035;
    pointer-events: none;
    mix-blend-mode: overlay;
    transition: opacity 0.5s ease;
}

@keyframes gradientBG {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.glass {
    background: var(--panel-bg);
    backdrop-filter: blur(25px);
    border: 1px solid var(--border);
}

/* Login */
/* Login Overhaul */
#login-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #08080a;
    overflow: hidden;
}

#login-overlay::before,
#login-overlay::after {
    content: '';
    position: absolute;
    width: 140vw;
    height: 140vh;
    background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.02) 0%, transparent 50%);
    animation: rotate 30s linear infinite;
}

#login-overlay::after {
    background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.01) 0%, transparent 40%);
    animation: rotate 45s linear infinite reverse;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.login-card {
    padding: 3.5rem;
    border-radius: 1.5rem;
    width: 420px;
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(40px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    position: relative;
    z-index: 1;
}

.login-card::after {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: 1.5rem;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), transparent, rgba(255, 255, 255, 0.05));
    z-index: -1;
    pointer-events: none;
}

.login-error {
    background: rgba(255, 59, 48, 0.1);
    border: 1px solid rgba(255, 59, 48, 0.2);
    color: #ff3b30;
    padding: 0.8rem;
    border-radius: 0.6rem;
    font-size: 0.75rem;
    margin-bottom: 1.5rem;
    display: none;
    /* Shown via JS */
    text-align: center;
}

.login-error.shake-anim {
    animation: shake 0.4s ease-in-out;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

.login-card h1 {
    font-size: 2rem;
    font-weight: 900;
    letter-spacing: 12px;
    text-align: center;
    margin-bottom: 3rem;
    background: linear-gradient(to bottom, #fff, #888);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.1));
}

.form-group input:focus {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.05);
}

.btn-primary {
    width: 100%;
    padding: 1.1rem;
    background: #fff;
    color: #000;
    border: none;
    border-radius: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    cursor: pointer;
    transition: 0.3s;
    margin-top: 1rem;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3), 0 0 20px rgba(255, 255, 255, 0.1);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 0.5rem;
    letter-spacing: 1px;
}

.form-group input {
    width: 100%;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 0.6rem;
    color: #fff;
    outline: none;
    font-size: 0.9rem;
    transition: 0.3s;
}

/* Main Layout */
.app-container {
    display: none;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    /* Restored overflow hidden to prevent scrollbars */
    flex-direction: row;
}

.app-container.active {
    display: flex !important;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    overflow-y: auto;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

/* Global Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
    background-clip: content-box;
}

.sidebar-top h3,
.section-label,
.label,
.log-label {
    font-size: 0.65rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.25);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
}

.sidebar-top {
    flex: 1;
    padding: 2rem 1.5rem;
}

.sidebar-section {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.interval-control {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.interval-value {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 0.5rem;
}

.btn-apply {
    width: 100%;
    padding: 0.6rem;
    background: transparent;
    color: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: 0.3s;
}

.btn-apply:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
}

#interval-display {
    color: #fff;
    font-weight: 800;
}

/* Custom Range Slider */
input[type=range] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    background: transparent;
}

input[type=range]:focus {
    outline: none;
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
}

input[type=range]::-webkit-slider-thumb {
    height: 20px;
    width: 20px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    margin-top: -8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    transition: 0.2s;
}

.easter-egg-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 0;
    margin-top: 0.5rem;
    min-height: 40px;
    /* Force minimum height for alignment */
}

/* Custom Switch Styling */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 22px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.05);
    transition: .4s;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: #fff;
    transition: .4s;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

input:checked+.slider {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

input:focus+.slider {
    box-shadow: 0 0 1px #fff;
}

input:checked+.slider:before {
    transform: translateX(22px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

.sidebar-bottom {
    padding: 2.5rem 2rem;
    border-top: 1px solid var(--border);
}

.token-controls {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-bottom: 2rem;
}

/* Settings Items Restored */
.settings-item {
    padding: 0.8rem 1rem;
    margin-bottom: 0.3rem;
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--item-radius);
    transition: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.settings-item:hover,
.settings-item.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.04);
}

.preset-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    padding-right: 0.5rem;
}

.preset-actions {
    display: flex;
    gap: 0.5rem;
    opacity: 0;
    transition: 0.2s;
}

.preset-item:hover .preset-actions {
    opacity: 1;
}

.preset-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    padding: 0.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}

.preset-btn:hover {
    color: #fff;
}

.preset-btn.star-btn.active {
    color: #ffcc00;
}

.preset-btn.star-btn.active svg {
    filter: drop-shadow(0 0 5px rgba(255, 204, 0, 0.4));
}

.sidebar-btn {
    width: 100%;
    height: 45px;
    box-sizing: border-box;
    /* Re-ensure border-box */
    padding: 0 1rem;
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--item-radius);
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    outline: none;
}

.sidebar-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.btn-create-preset {
    border: 1px dashed rgba(255, 255, 255, 0.2);
}

.btn-save-presets {
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Modal Stylings */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: 0.3s;
}

.modal-overlay.active {
    display: flex;
    opacity: 1;
}

.modal-card {
    width: 500px;
    padding: 2rem;
    border-radius: 1.5rem;
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header h2 {
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.6);
}

/* AI Settings Redesign - Personas */
.ai-settings-modal {
    width: 750px;
    /* Slightly wider */
    max-width: 95vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.ai-settings-modal .modal-body {
    padding: 1.5rem 2rem;
    overflow-y: auto;
    flex: 1;
}

.personas-list {
    margin-bottom: 1.5rem;
    max-height: 350px;
    overflow-y: auto;
    padding-right: 5px;
}

.personas-list:empty {
    display: none;
}

.persona-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.persona-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.2rem;
    transition: 0.3s;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.persona-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.persona-card.active {
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.05);
}

.persona-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
}

.persona-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: #fff;
}

.persona-vibe {
    font-size: 0.75rem;
    color: var(--text-dim);
    line-height: 1.4;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.persona-slang-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.slang-chip {
    font-size: 0.65rem;
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    color: rgba(255, 255, 255, 0.4);
}

.persona-actions {
    position: absolute;
    top: 1.2rem;
    right: 1.2rem;
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: 0.2s;
}

.persona-card:hover .persona-actions {
    opacity: 1;
}

.action-icon {
    color: var(--text-dim);
    cursor: pointer;
    transition: 0.2s;
    background: rgba(0, 0, 0, 0.3);
    padding: 4px;
    border-radius: 4px;
}

.action-icon:hover {
    color: #fff;
}

.action-icon.delete:hover {
    color: #ff3b30;
}

/* Custom scrollbars for the AI modal */
.ai-settings-modal .modal-body::-webkit-scrollbar {
    width: 6px;
}

.ai-settings-modal .modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.ai-settings-modal .modal-body::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.ai-settings-modal .modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

#ai-global-rules-input::-webkit-scrollbar {
    width: 4px;
}

#ai-global-rules-input::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.compact-btn {
    background: rgba(255, 255, 255, 0.08);
    /* More visible background */
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    /* White text */
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.compact-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.compact-btn:active {
    transform: translateY(0);
}

#ai-global-rules-input {
    min-height: 120px;
    font-size: 0.85rem;
    line-height: 1.5;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    color: #fff;
    width: 100%;
    resize: vertical;
    outline: none;
    font-family: inherit;
}

.header-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-title-group svg {
    color: var(--text-dim);
}

.ai-section {
    margin-bottom: 2rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
}

.section-header label {
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: rgba(255, 255, 255, 0.4);
}

.section-hint {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.2);
}

.preset-ai-settings {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.glass-select,
.glass-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.6rem 0.8rem;
    color: #fff;
    font-size: 0.8rem;
    outline: none;
    transition: 0.2s;
}

.glass-select option {
    background: #111;
    color: #fff;
}

.glass-select:focus,
.glass-input:focus {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
}

.ai-styles-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 0.8rem;
    min-height: 80px;
}

.style-tag {
    padding: 0.4rem 0.8rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: 0.2s;
}

.style-tag:hover {
    background: rgba(255, 59, 48, 0.1);
    color: #ff3b30;
    border-color: rgba(255, 59, 48, 0.3);
}

.ai-style-add-row {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.ai-style-add-row input {
    flex: 1;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.6rem 1rem;
    color: #fff;
    outline: none;
    font-size: 0.85rem;
}

.variable-guide {
    display: flex;
    gap: 12px;
}

.variable-guide span {
    font-family: monospace;
    font-size: 0.75rem;
    color: #4CAF50;
    background: rgba(76, 175, 80, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

.ai-field-desc {
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-top: 0.6rem;
}

.modal-body textarea {
    width: 100%;
    min-height: 150px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0.8rem;
    padding: 1.2rem;
    color: #fff;
    resize: none;
    outline: none;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    transition: all 0.3s ease;
}

.modal-body textarea:focus {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.03);
}

.modal-body textarea::-webkit-scrollbar {
    width: 5px;
}

.modal-body textarea::-webkit-scrollbar-track {
    background: transparent;
}

.modal-body textarea::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.modal-body textarea::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.btn-generate {
    width: 100%;
    height: 45px;
    padding: 0 1rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--item-radius);
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
}

.btn-generate.active {
    background: rgba(255, 59, 48, 0.1);
    color: #ff3b30;
    border-color: rgba(255, 59, 48, 0.3);
    box-shadow: 0 0 15px rgba(255, 59, 48, 0.1);
}

.btn-generate:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
}

.confirm-card {
    width: 350px;
    text-align: center;
}

.confirm-card p {
    color: var(--text-dim);
    margin-bottom: 2rem;
    line-height: 1.5;
}

.btn-secondary {
    padding: 0.9rem;
    background: transparent;
    color: #fff;
    border: 1px solid var(--border);
    border-radius: 0.8rem;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s;
}

.btn-secondary:hover {
    background: #fff;
    color: #000;
}

.token-stats {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    font-size: 0.9rem;
    color: var(--text-dim);
}

.stat {
    display: flex;
    justify-content: space-between;
}

.stat .val {
    color: #fff;
    font-weight: 700;
}

/* Chat Area */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 2rem 3rem 1rem;
    background: transparent;
}

.proposals-container {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    padding-bottom: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    /* Slightly more gap */
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 1.2rem;
    margin-bottom: 1rem;
    --chat-scale: 1;
    font-size: calc(1rem * var(--chat-scale));
}

.proposals-container::-webkit-scrollbar {
    width: 6px;
}

.proposals-container::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

.proposal,
.system-log {
    padding: 0.8em 1.2em;
    display: flex;
    align-items: center;
    gap: 1.5em;
    /* Proportional gap */
    transition: all 0.3s ease;
    flex-wrap: wrap;
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 0.8em;
    margin-bottom: 0.5em;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.proposal:hover,
.system-log:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
}

.prefix-tag {
    font-size: 0.65em;
    font-weight: 900;
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 0.4em 1em;
    border-radius: 4px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    flex-shrink: 0;
    min-width: 7em;

    text-align: center;
}

#add-quick-item-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.4);
    font-weight: 700;
    font-size: 1.2rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

#add-quick-item-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
}

.prefix-tag.user {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    color: #fff;
}

.prefix-tag.log {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.5);
}

.content {
    font-size: 0.9em;
    /* Changed from rem to em */
    font-weight: 400;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.6);
    /* Slightly brighter for better contrast when small */
    letter-spacing: 0.2px;
}

.proposal-actions {
    display: flex;
    gap: 0.8em;
}

.action-btn {
    padding: 0.5em 1.5em;
    border-radius: 6px;
    font-size: 0.75em;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid transparent;
}

.action-btn.accept {
    background: #fff;
    color: #000;
    opacity: 0.9;
}

.action-btn.reject {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.action-btn.accept:hover {
    opacity: 1;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.4);
    transform: translateY(-1px);
}

.action-btn.reject:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.proposal.processed {
    opacity: 0.5;
    filter: grayscale(0.5);
}

.status-tag {
    display: inline-flex;
    align-items: center;
    font-size: 0.65em;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0.3em 1em;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    margin-left: 0.5em;
    /* Small gap from content */
}

.proposal.accepted {
    background: rgba(46, 204, 113, 0.05);
    border-color: rgba(46, 204, 113, 0.2);
}

.proposal.accepted .status-tag {
    background: rgba(46, 204, 113, 0.2);
    border-color: rgba(46, 204, 113, 0.4);
    color: #2ecc71;
}

.proposal.rejected {
    background: rgba(231, 76, 60, 0.05);
    border-color: rgba(231, 76, 60, 0.2);
}

.proposal.rejected .status-tag {
    background: rgba(231, 76, 60, 0.2);
    border-color: rgba(231, 76, 60, 0.4);
    color: #e74c3c;
}

/* Unfied into .proposal, .system-log above */

@keyframes logFadeIn {
    from {
        opacity: 0;
        transform: translateX(-5px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ==========================================================================
   RE-ENGINEERED INPUT PANEL (PREMIUM SLAB)
   ========================================================================== */

.main-input-bar {
    position: relative;
    padding: 0 4rem 1.2rem;
    display: flex;
    justify-content: center;
    z-index: 100;
}

.input-glow {
    position: absolute;
    bottom: 20%;
    width: 60%;
    height: 100px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.03) 0%, transparent 70%);
    filter: blur(40px);
    pointer-events: none;
    z-index: -1;
}

.input-panel-inner {
    width: 100%;
    max-width: 800px;
    background: rgba(18, 18, 20, 0.6);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1.5rem;
    padding: 0.6rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow:
        0 10px 40px -10px rgba(0, 0, 0, 0.5),
        inset 0 1px 1px rgba(255, 255, 255, 0.05);
}

.input-panel-inner:hover {
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(22, 22, 24, 0.7);
    transform: translateY(-2px);
}

.input-panel-inner:focus-within {
    border-color: rgba(255, 255, 255, 0.25);
    background: rgba(25, 25, 28, 0.8);
    box-shadow:
        0 20px 60px -15px rgba(0, 0, 0, 0.7),
        inset 0 1px 2px rgba(255, 255, 255, 0.1);
    transform: translateY(-4px);
}

.input-panel-inner textarea {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 400;
    line-height: 1.6;
    padding: 0.4rem 0;
    resize: none;
    height: 40px;
    min-height: 40px;
    /* Matches one line approx */
    overflow-y: hidden;
    transition: height 0.2s ease;
}

.input-panel-inner textarea::placeholder {
    color: rgba(255, 255, 255, 0.2);
    text-transform: uppercase;
    letter-spacing: 5px;
    font-size: 0.75rem;
    font-weight: 800;
    transition: all 0.4s ease;
}

.input-panel-inner:focus-within textarea::placeholder {
    letter-spacing: 8px;
    opacity: 0.5;
}

.send-action-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    flex-shrink: 0;
}

.send-action-btn:hover {
    background: #fff;
    color: #000;
    border-color: #fff;
    transform: scale(1.1) rotate(-10deg);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
}

.send-action-btn svg {
    width: 20px;
    height: 20px;
    margin-right: -2px;
    margin-top: 2px;
}


/* Utils */
.fade-in {
    animation: fadeIn 0.4s ease-out forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Chat Control Buttons */
.chat-control-btn {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.6rem;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.chat-control-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* Channel Input */
.channel-input {
    width: 100%;
    padding: 0.8rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0.6rem;
    color: #fff;
    font-size: 0.85rem;
    outline: none;
    transition: all 0.3s ease;
}

.channel-input:focus {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
}

.channel-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.channel-input-wrapper {
    display: flex;
    gap: 0.5rem;
}

.channel-input-wrapper .channel-input {
    flex: 1;
}

.channel-confirm-btn {
    width: 40px;
    min-width: 40px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.6rem;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.channel-confirm-btn:hover {
    background: rgba(76, 175, 80, 0.2);
    border-color: rgba(76, 175, 80, 0.4);
    color: #4CAF50;
}

.channel-confirm-btn.confirmed {
    background: rgba(76, 175, 80, 0.2);
    border-color: rgba(76, 175, 80, 0.5);
    color: #4CAF50;
}

/* Preset items with borders */
.preset-item {
    padding: 0.8rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    background: rgba(255, 255, 255, 0.02);
    transition: all 0.2s ease;
}

.preset-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
}

.preset-item.active {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.status-text {
    font-size: 0.8em;
    color: rgba(255, 255, 255, 0.5);
    margin-left: 1em;
    font-style: italic;
    opacity: 0.8;
}

/* Chat Area - ensure it doesn't grow with children */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 2rem 3rem 1.5rem;
    background: transparent;
    min-width: 0;
    position: relative;
    overflow: hidden;
}

/* Quick Messages Bar - Fixed containment */
.quick-messages-bar {
    display: flex;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.4rem 0;
    overflow-x: auto;
    overflow-y: hidden;
    margin-bottom: 0.2rem;
    width: 100%;
    max-width: 100%;
    /* Force it to stay within parent */
    min-width: 0;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    position: relative;
    z-index: 10;
}

/* Custom Scrollbar for Quick Bar - Always visible when overflow */
.quick-messages-bar::-webkit-scrollbar {
    height: 6px;
}

.quick-messages-bar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 10px;
}

.quick-messages-bar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 10px;
}

.quick-messages-bar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Cleaned up redundant block */

.quick-chip {
    padding: 0.6rem 1.2rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    /* Prevent chips from shrinking */
}

.quick-chip:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.quick-chip:active {
    transform: translateY(0);
}

/* Quick Management List */
.quick-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 0.8rem;
    margin-bottom: 0.5rem;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

.quick-item-delete {
    background: rgba(255, 59, 48, 0.1);
    border: 1px solid rgba(255, 59, 48, 0.2);
    color: #ff3b30;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 1rem;
    line-height: 1;
}

.quick-item-delete:hover {
    background: #ff3b30;
    color: #fff;
    transform: scale(1.1);
}

.prefix-tag.quick {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    color: #fff;
}

.prefix-tag.bundle {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    color: #fff;
    font-weight: 800;
}

/* Quick Management List Scrollbar */
.quick-list::-webkit-scrollbar {
    width: 4px;
}

.quick-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}

.quick-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

/* Redesign Modal Add Buttons */
#add-quick-item-btn,
#add-blacklist-word-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.4);
    width: 45px;
    height: 44px;
    /* Matches input height more closely */
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

#add-quick-item-btn:hover,
#add-blacklist-word-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
}

#chat-input::placeholder {
    color: rgba(255, 255, 255, 0.2);
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 400;
    text-transform: none;
    letter-spacing: normal;
}

.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 2rem 3rem 1.5rem;
    background: transparent;
    min-width: 0;
    position: relative;
    overflow: hidden;
}

.input-actions-group {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.chat-control-btn {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-control-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
}

/* Token Panel Styles */
.token-panel {
    width: var(--token-panel-width);
    height: 100vh;
    border-left: 1px solid var(--border);
    position: relative;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), margin-right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    z-index: 100;
    flex-shrink: 0;
    background: rgba(10, 10, 11, 0.4);
    /* Slightly darker background */
    display: flex !important;
}

.token-panel.collapsed {
    margin-right: calc(var(--token-panel-width) * -1 + 40px);
}

.token-panel.collapsed .panel-content {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.token-panel.collapsed .panel-toggle {
    left: 6px;
    /* (40px - 28px) / 2 */
    top: 24px;
    transform: rotate(180deg);
}

.panel-toggle {
    position: absolute;
    left: -28px;
    top: 24px;
    /* Move to top */
    width: 28px;
    height: 48px;
    /* Smaller height */
    background: rgba(40, 40, 45, 0.8);
    border: 1px solid var(--border);
    border-right: none;
    border-radius: 8px 0 0 8px;
    color: var(--text-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: 0.3s;
    z-index: 1000;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.3);
}

.token-panel.collapsed .panel-toggle {
    left: 6px;
    top: 24px;
    transform: rotate(180deg);
}

.panel-toggle:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.panel-content {
    padding: 1.2rem 1rem;
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

.token-top-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid var(--border);
}

.token-btn-row {
    display: flex;
    gap: 0.4rem;
}

.compact-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.compact-btn:hover,
.compact-btn.active-state {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.compact-btn svg {
    min-width: 16px;
    min-height: 16px;
    width: 16px;
    height: 16px;
    stroke: currentColor !important;
    stroke-width: 2 !important;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none !important;
    opacity: 1 !important;
    display: block !important;
    color: inherit;
}

.compact-btn:hover svg {
    opacity: 1;
}

.delete-action-btn {
    width: 120px !important;
    background: linear-gradient(135deg, #ff416c, #ff4b2b) !important;
    color: #fff !important;
    border: none !important;
    box-shadow: 0 4px 15px rgba(255, 75, 43, 0.3) !important;
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: 1px;
    cursor: pointer;
    transition: 0.3s;
    border-radius: var(--item-radius);
    display: flex;
    align-items: center;
    justify-content: center;
}

.delete-action-btn:hover {
    box-shadow: 0 6px 20px rgba(255, 75, 43, 0.5) !important;
    transform: translateY(-2px);
    opacity: 0.9;
}

.compact-btn.primary {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.4);
}

.token-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.8rem;
}

.token-search-field {
    flex: 1;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: 0.4rem 0.8rem;
    color: #fff;
    font-size: 0.75rem;
    outline: none;
    transition: all 0.3s ease;
}

.token-search-field:focus {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.05);
}

.token-tiny-stats {
    font-size: 0.75rem;
    color: var(--text-dim);
    font-weight: 600;
    letter-spacing: 1px;
    white-space: nowrap;
}

.token-tiny-stats .val {
    color: #fff;
}

.resize-handle {
    position: absolute;
    left: 0;
    top: 0;
    width: 6px;
    /* Slightly wider for better grip */
    height: 100%;
    cursor: ew-resize;
    z-index: 1001;
    transition: background 0.2s;
}

.token-panel.collapsed .resize-handle {
    display: none;
    /* Hide resize handle when collapsed */
}

.resize-handle:hover,
.resize-handle.resizing {
    background: rgba(255, 255, 255, 0.1);
}

.token-actions-top {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
    margin-bottom: 1.5rem;
}

.token-stats-panel {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 2.5rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    padding: 1rem;
    border-radius: var(--item-radius);
}

.token-stats-panel .stat {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.token-stats-panel .stat span:first-child {
    font-size: 0.65rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.25);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.token-stats-panel .stat .val {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
}

.panel-btn {
    padding: 0.8rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    border-radius: var(--item-radius);
    color: var(--text-dim);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    cursor: pointer;
    transition: 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.panel-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
}

.panel-btn.primary {
    background: #fff;
    color: #000;
    border: none;
    font-weight: 800;
}

.panel-btn.primary:hover {
    background: #e2e2e2;
    transform: translateY(-1px);
}

.valid-tokens-list {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 1.5rem;
    padding-right: 0.5rem;
}

.valid-tokens-list::-webkit-scrollbar {
    width: 3px;
}

.valid-tokens-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

.empty-list-hint {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--text-dim);
    font-size: 0.8rem;
    opacity: 0.4;
    line-height: 1.6;
}

.token-item-entry {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: var(--item-radius);
    padding: 1rem 1.2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.token-item-entry:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.1);
}

.token-user-info {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    overflow: hidden;
}

.token-username {
    font-size: 0.95rem;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.token-hint {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.25);
    font-family: 'JetBrains Mono', monospace;
}

.token-entry-actions {
    display: flex;
    gap: 0.5rem;
}

.token-entry-btn {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.2s ease;
}

.token-entry-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.token-item-entry.is-locked {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.02);
}

.token-entry-btn.lock-btn:hover,
.token-entry-btn.lock-btn.active {
    color: #ffb340;
    background: rgba(255, 179, 64, 0.1);
    border-color: rgba(255, 179, 64, 0.3);
}

.token-entry-btn.single-msg-btn:hover,
.token-entry-btn.single-msg-btn.active {
    color: #4099ff;
    background: rgba(64, 153, 255, 0.1);
    border-color: rgba(64, 153, 255, 0.3);
    box-shadow: 0 0 10px rgba(64, 153, 255, 0.2);
}

.token-entry-btn.delete:hover {
    background: rgba(255, 59, 48, 0.15);
    color: #ff3b30;
    border-color: rgba(255, 59, 48, 0.2);
}

.panel-footer {
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

/* ==========================================================================
   FLOATING CHAT WIDGET
   ========================================================================== */

.floating-widget {
    position: fixed;
    top: 50px;
    right: 400px;
    width: 350px;
    height: 500px;
    z-index: 2000;
    display: none;
    flex-direction: column;
    border-radius: 1.2rem;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    transition: opacity 0.3s ease, transform 0.3s ease;
    min-width: 250px;
    min-height: 200px;
}

.floating-widget.active {
    display: flex;
    animation: widgetAppear 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes widgetAppear {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.widget-header {
    padding: 0.8rem 1.2rem;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: grab;
    user-select: none;
}

.widget-header:active {
    cursor: grabbing;
}

.widget-title {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.8);
}

.widget-controls button {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    padding: 4px;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.widget-controls button:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.widget-body {
    flex: 1;
    background: #000;
    /* Standard Kick chat background is dark */
    position: relative;
    overflow: hidden;
}

.widget-body iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.widget-resizer {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 15px;
    height: 15px;
    cursor: nwse-resize;
    background: linear-gradient(135deg, transparent 50%, rgba(255, 255, 255, 0.1) 50%);
    border-radius: 0 0 1.2rem 0;
}

/* Close Modal Button Refinement */
.close-modal {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1.2rem;
    line-height: 1;
    padding-bottom: 2px;
}

.close-modal:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Generation Stats Panel */
.gen-stats-panel {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin: 1rem 0;
    padding: 0.8rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.gen-stats-panel .stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
}

.gen-stats-panel .stat-value {
    font-size: 1.2rem;
    font-weight: 800;
    color: #fff;
}

.gen-stats-panel .stat-label {
    font-size: 0.55rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255, 255, 255, 0.3);
}

.gen-stats-panel .stat-item.accepted .stat-value {
    color: #4CAF50;
}

.gen-stats-panel .stat-item.rejected .stat-value {
    color: #ff3b30;
}

.gen-stats-panel .stat-item.pending .stat-value {
    color: #ffb340;
}

/* Auto-Send Toggle Row */
.auto-send-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    margin-bottom: 1rem;
}

.auto-send-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 24px;
    transition: all 0.3s ease;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.toggle-switch input:checked+.toggle-slider {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.toggle-switch input:checked+.toggle-slider::before {
    transform: translateX(20px);
    background: #fff;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.4);
}

/* AUTO Prefix Tag */
.prefix-tag.auto {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: #fff;
    border-color: rgba(76, 175, 80, 0.5);
}

/* Widget Toggles Section */
.widget-toggles .auto-send-row {
    margin-bottom: 0.5rem;
}

.widget-toggles .auto-send-row:last-child {
    margin-bottom: 0;
}

/* Token Row Clickable Feedback */
.token-user-info:hover {
    opacity: 0.8;
}

.token-item-entry.is-locked .token-user-info {
    border-left: 3px solid #ffb340;
    padding-left: 0.5rem;
    margin-left: -0.5rem;
}

/* Message Bundles Bar */
.bundles-bar {
    display: flex;
    justify-content: flex-start;
    gap: 0.6rem;
    padding: 0.4rem 1.5rem;
    overflow-x: auto;
    overflow-y: hidden;
    margin-bottom: 0.2rem;
    margin-top: 1rem;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    position: relative;
    z-index: 10;
}

/* Custom scrollbar for bundles bar */
.bundles-bar::-webkit-scrollbar {
    height: 4px;
}

.bundles-bar::-webkit-scrollbar-track {
    background: transparent;
}

.bundles-bar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.bundle-btn {
    padding: 0.6rem 1.4rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 100px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    position: relative;
    user-select: none;
}

.bundle-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.bundle-btn.active {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    color: #fff;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.05);
}

.bundle-stop-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    margin-right: -4px;
    opacity: 0.8;
}

.bundle-stop-icon svg {
    fill: currentColor;
}

.bundle-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
    font-weight: 500;
}

.bundle-list-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 1rem 1.2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
    transition: 0.2s;
}

.bundle-list-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.bundle-actions {
    display: flex;
    gap: 0.5rem;
}

.bundle-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: 0.2s;
}

.bundle-action-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.bundle-action-btn.delete:hover {
    background: rgba(255, 59, 48, 0.1);
    color: #ff3b30;
    border-color: rgba(255, 59, 48, 0.2);
}

/* Dual Range Slider Premium */
.dual-range-container {
    position: relative;
    width: 100%;
    height: 50px;
    display: flex;
    align-items: center;
    padding: 0 5px;
}

.range-track {
    position: absolute;
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 20px;
    z-index: 1;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* We will set the background using JS linear-gradient */

.range-input {
    position: absolute;
    width: 100%;
    background: none;
    pointer-events: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    z-index: 2;
    margin: 0;
}

.range-input::-webkit-slider-thumb {
    height: 24px;
    width: 24px;
    border-radius: 50%;
    background: #fff;
    pointer-events: auto;
    -webkit-appearance: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
    border: 5px solid #1a1a1c;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    z-index: 5;
}

.range-input::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    background: #fff;
    border-color: #222;
}

.range-input::-webkit-slider-thumb:active {
    transform: scale(0.95);
}

.range-input::-moz-range-thumb {
    height: 22px;
    width: 22px;
    border-radius: 50%;
    background: #fff;
    pointer-events: auto;
    -moz-appearance: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    border: 4px solid #111;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Segmented Toggle */
.segmented-toggle {
    position: relative;
    display: flex;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 4px;
    width: 100%;
    height: 48px;
    overflow: hidden;
}

.segmented-toggle input {
    display: none;
}

.segmented-toggle label {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    z-index: 2;
    transition: color 0.3s ease;
    letter-spacing: 1px;
    margin: 0 !important;
}

.segmented-toggle input:checked+label {
    color: #000;
}

.selection-pill {
    position: absolute;
    top: 4px;
    left: 4px;
    bottom: 4px;
    width: calc(50% - 4px);
    background: linear-gradient(135deg, #fff, #e0e0e0);
    border-radius: 6px;
    z-index: 1;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.2);
}

#mode-loop:checked~.selection-pill,
#model-non-thinking:checked~.selection-pill {
    transform: translateX(100%);
}

/* Radio Customization */
.radio-label {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    user-select: none;
}

.radio-label input {
    display: none;
}

.radio-custom {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.radio-label:hover .radio-custom {
    border-color: rgba(255, 255, 255, 0.4);
}

.radio-label input:checked+.radio-custom {
    border-color: #fff;
    background: #fff;
}

.radio-label input:checked+.radio-custom::after {
    content: '';
    width: 8px;
    height: 8px;
    background: #000;
    border-radius: 50%;
}

/* Textarea Resizing Limits */
textarea {
    resize: none;
    min-height: 80px !important;
    max-height: 400px !important;
}

/* Specific overrides */
#preset-prompt,
#persona-desc-input {
    min-height: 60px !important;
    max-height: 150px !important;
    resize: none !important;
    overflow: auto !important;
    display: block !important;
    width: 100% !important;
}

#system-prompt-input {
    min-height: 150px !important;
    max-height: 600px !important;
    background: transparent !important;
    position: relative;
    z-index: 2;
}

/* Variable Highlighter */
.highlighter-wrapper {
    position: relative;
    width: 100%;
}

.highlighter-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 180px;
    /* Will be set by JS */
    padding: 16px;
    margin: 0;
    border: none;
    background: transparent;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
    box-sizing: border-box;
    color: transparent;
}

#system-prompt-input {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 250px;
    padding: 16px;
    margin: 0;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 0.6rem;
    color: #fff;
    resize: none;
    font-family: 'JetBrains Mono', 'Consolas', monospace;
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
    box-sizing: border-box;
    outline: none;
    overflow: auto;
}

.variable-highlight {
    background: rgba(76, 175, 80, 0.4);
    color: transparent;
    border-radius: 3px;
}

/* Collapsible Section Refinement */
.collapsible-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    user-select: none;
    padding: 0.9rem 1.2rem;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.collapsible-header:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.collapsible-header span {
    font-size: 0.75rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.collapsible-header .collapse-icon {
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.5;
}

.collapsible-header:hover .collapse-icon {
    opacity: 1;
}

.collapsible-header.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.collapsible-content {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    max-height: 800px;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
        opacity 0.3s ease,
        padding 0.3s ease;
    opacity: 1;
    padding: 0.5rem 0.2rem;
}

.collapsible-content.collapsed {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
}

.collapsible-content .auto-send-row {
    margin-bottom: 0;
    padding: 0.7rem 0.9rem;
    background: rgba(255, 255, 255, 0.015);
    border-color: rgba(255, 255, 255, 0.05);
}

/* Blacklist Word Tags */
.blacklist-tag {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.8rem;
    background: rgba(255, 59, 48, 0.1);
    border: 1px solid rgba(255, 59, 48, 0.2);
    border-radius: 6px;
    font-size: 0.8rem;
    color: #ff3b30;
    transition: all 0.2s ease;
}

.blacklist-tag:hover {
    background: rgba(255, 59, 48, 0.2);
    transform: scale(1.05);
}

.blacklist-tag span.remove {
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    opacity: 0.6;
}

.blacklist-tag span.remove:hover {
    opacity: 1;
    font-weight: bold;
}