:root {
    /* Default Theme: White (Light) Theme - Aligned with Brand Logo (#d22730 crimson & #1d262d slate) */
    --bg-dark: #f8fafc;
    --bg-card: #ffffff;
    --bg-input: #f1f5f9;
    --bg-hover: #e2e8f0;
    --border-color: #e2e8f0;
    --border-highlight: #cbd5e1;
    
    --cyan-accent: #d22730;
    --cyan-dim: rgba(210, 39, 48, 0.08);
    --cyan-glow: rgba(210, 39, 48, 0.22);
    
    --purple-accent: #1d262d;
    --purple-dim: rgba(29, 38, 45, 0.08);
    
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;

    --btn-cyan-text: #ffffff;
    --card-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
    --nav-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    --modal-overlay-bg: rgba(15, 23, 42, 0.6);
    --chat-bot-bg: #f8fafc;
    --chat-bot-border: #e2e8f0;
    --shimmer-base: rgba(226, 232, 240, 0.7);
    
    --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

[data-theme="dark"] {
    /* Dark Theme - Luminous Logo Accent & Dark Slate */
    --bg-dark: #090a0f;
    --bg-card: #0d0e14;
    --bg-input: #12141d;
    --bg-hover: #171926;
    --border-color: #1b1e2c;
    --border-highlight: #272c40;
    
    --cyan-accent: #ff3b47;
    --cyan-dim: rgba(255, 59, 71, 0.14);
    --cyan-glow: rgba(255, 59, 71, 0.30);
    
    --purple-accent: #cbd5e1;
    --purple-dim: rgba(203, 213, 225, 0.12);
    
    --text-primary: #f4f4f5;
    --text-secondary: #a1a1aa;
    --text-muted: #71717a;

    --btn-cyan-text: #ffffff;
    --card-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
    --nav-shadow: none;
    --modal-overlay-bg: rgba(0, 0, 0, 0.75);
    --chat-bot-bg: #11131f;
    --chat-bot-border: #1e2133;
    --shimmer-base: rgba(39, 44, 64, 0.4);
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    transition: background-color 0.25s ease, color 0.25s ease;
}

/* Header Navbar */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 28px;
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--nav-shadow);
    height: 64px;
    transition: background-color 0.25s ease, border-color 0.25s ease;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-box {
    width: 34px;
    height: 34px;
    background: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    flex-shrink: 0;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.logo-box:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(210, 39, 48, 0.25);
}

.logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.logo-dot {
    width: 8px;
    height: 8px;
    background: var(--cyan-accent);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--cyan-accent);
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.brand-sub {
    font-size: 0.72rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
    letter-spacing: -0.02em;
}

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

/* Status Pill */
.status-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.76rem;
    font-family: var(--font-mono);
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.status-pill.online .status-dot { background-color: #10b981; box-shadow: 0 0 8px #10b981; }
.status-pill.fallback .status-dot { background-color: #f59e0b; box-shadow: 0 0 8px #f59e0b; }
.status-pill.offline .status-dot { background-color: #ef4444; }

.provider-select-group select, #api-key-input {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.82rem;
    outline: none;
}

.btn-chat-toggle {
    background: var(--bg-input);
    border: 1px solid var(--border-highlight);
    color: #c4b5fd;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-chat-toggle:hover {
    background: var(--purple-dim);
    border-color: var(--purple-accent);
}

/* Theme Toggle Button on Navbar */
.theme-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--bg-input);
    border: 1px solid var(--border-highlight);
    color: var(--text-primary);
    cursor: pointer;
    position: relative;
    outline: none;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    flex-shrink: 0;
}

.theme-toggle-btn:hover {
    background: var(--bg-hover);
    border-color: var(--cyan-accent);
    color: var(--cyan-accent);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--cyan-glow);
}

.theme-toggle-btn:active {
    transform: translateY(0);
}

.theme-toggle-btn svg {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.theme-toggle-btn:hover svg {
    transform: rotate(18deg) scale(1.12);
}

/* Default White/Light Theme: Moon icon shown, Sun icon hidden */
.theme-toggle-btn .sun-icon {
    display: none;
}

.theme-toggle-btn .moon-icon {
    display: block;
    color: var(--text-primary);
}

/* Dark Theme: Sun icon shown, Moon icon hidden */
[data-theme="dark"] .theme-toggle-btn .sun-icon {
    display: block;
    color: #fbbf24;
}

[data-theme="dark"] .theme-toggle-btn .moon-icon {
    display: none;
}

[data-theme="dark"] .theme-toggle-btn:hover {
    border-color: #fbbf24;
    box-shadow: 0 0 14px rgba(251, 191, 36, 0.3);
    color: #fbbf24;
}

/* Main App Layout */
.app-layout {
    display: flex;
    flex: 1;
    height: calc(100vh - 64px);
    padding: 20px;
    gap: 20px;
    max-width: 1700px;
    margin: 0 auto;
    width: 100%;
    overflow: hidden;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    padding-right: 4px;
}

/* Video Player Card */
.video-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.video-player-wrapper {
    position: relative;
    width: 100%;
    padding-top: 54%; /* Aspect Ratio */
    background: #000;
    overflow: hidden;
}

.video-player-wrapper iframe, #player {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
}

.placeholder-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at center, #0f121d 0%, #08090d 100%);
    color: var(--text-secondary);
    gap: 8px;
    z-index: 2;
}

.placeholder-cam-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid var(--cyan-glow);
    background: var(--cyan-dim);
    color: var(--cyan-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
    box-shadow: 0 0 16px var(--cyan-glow);
}

.placeholder-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.placeholder-sub {
    font-size: 0.8rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
}

/* Waveform Visualizer Bar */
.waveform-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: var(--bg-dark);
    border-top: 1px solid var(--border-color);
}

.time-label {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-muted);
}

.waveform-spectrum {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 24px;
}

.waveform-spectrum .bar {
    width: 3px;
    background: var(--border-highlight);
    border-radius: 2px;
    transition: height 0.2s ease;
}

.bar-1 { height: 8px; }
.bar-2 { height: 16px; }
.bar-3 { height: 10px; }
.bar-4 { height: 20px; }
.bar-5 { height: 14px; }
.bar-6 { height: 22px; }
.bar-7 { height: 12px; }
.bar-8 { height: 18px; }
.bar-9 { height: 9px; }
.bar-10 { height: 15px; }

/* Session Setup Card */
.session-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 20px;
}

.session-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.step-pill {
    border: 1px solid var(--cyan-accent);
    color: var(--cyan-accent);
    border-radius: 6px;
    padding: 1px 7px;
    font-size: 0.72rem;
    font-family: var(--font-mono);
    font-weight: 600;
}

.session-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.session-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Dropzones Side by Side */
.dropzone-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.drop-box {
    background: var(--bg-input);
    border: 1px dashed var(--border-highlight);
    border-radius: 12px;
    padding: 20px;
    position: relative;
    transition: all 0.2s ease;
}

.drop-box:hover {
    border-color: var(--cyan-accent);
    background: var(--bg-hover);
}

.video-source-mode-toggle {
    display: flex;
    gap: 4px;
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 5;
}

.source-tab {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.72rem;
    padding: 2px 6px;
    border-radius: 4px;
    cursor: pointer;
}

.source-tab.active {
    background: var(--border-highlight);
    color: var(--text-primary);
}

.drop-box-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 90px;
    position: relative;
    overflow: hidden;
}

.icon-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
}

.drop-label {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
}

.drop-sub {
    font-size: 0.74rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
}

.hidden-file-input {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    opacity: 0;
    cursor: pointer;
}

.yt-input-wrapper {
    padding-top: 20px;
    width: 100%;
}

.yt-url-field {
    width: 100%;
    background: var(--bg-dark);
    border: 1px solid var(--border-highlight);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--text-primary);
    font-size: 0.85rem;
    outline: none;
}

/* Submit Row */
.action-submit-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 4px;
}

.btn-index-cyan {
    flex: 1;
    background: var(--cyan-accent);
    color: var(--btn-cyan-text);
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.92rem;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.2s ease;
}

.btn-index-cyan:hover {
    box-shadow: 0 0 16px var(--cyan-glow);
    transform: translateY(-1px);
}

.quick-links-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.link-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-family: var(--font-mono);
    cursor: pointer;
    text-decoration: underline;
}

.link-btn:hover {
    color: var(--text-secondary);
}

.textedit-link {
    color: #60a5fa;
}

/* Right Side Drawer / Chat Panel */
.chat-drawer {
    width: 390px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
    max-height: calc(100vh - 104px);
    box-shadow: var(--card-shadow);
    transition: all 0.3s ease;
}

.chat-drawer.collapsed {
    display: none;
}

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

.drawer-title-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.title-dot {
    color: var(--purple-accent);
    font-size: 1.2rem;
}

.drawer-title-group h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

.btn-close-drawer {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
}

.drawer-subtext {
    font-size: 0.78rem;
    color: var(--text-muted);
    padding: 12px 20px 0 20px;
    line-height: 1.4;
    flex-shrink: 0;
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    min-height: 0;
    padding: 16px 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
    scroll-behavior: smooth;
}

/* Custom Styled Scrollbar for Chat Messages */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--border-highlight);
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: var(--purple-accent);
}

.message {
    display: flex;
    gap: 10px;
    font-size: 0.88rem;
    line-height: 1.5;
}

.message.user-msg {
    flex-direction: row-reverse;
}

.msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-input);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.msg-body {
    background: var(--chat-bot-bg);
    border: 1px solid var(--chat-bot-border);
    padding: 12px 14px;
    border-radius: 12px;
    max-width: 88%;
    word-break: break-word;
    color: var(--text-primary);
    transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

.user-msg .msg-body {
    background: linear-gradient(135deg, #6d28d9, #4c1d95);
    border: none;
    color: white;
}

/* Timestamp Badges */
.timestamp-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(139, 92, 246, 0.2);
    color: #c4b5fd;
    border: 1px solid rgba(139, 92, 246, 0.4);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.78rem;
    font-family: var(--font-mono);
    font-weight: 600;
    cursor: pointer;
    margin: 2px 4px;
}

.timestamp-pill:hover {
    background: var(--purple-accent);
    color: white;
}

/* Chat Input Area */
.chat-input-area {
    padding: 14px 18px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-card);
    position: relative;
    flex-shrink: 0;
}

.badge-chunks-hidden {
    display: none;
}

/* ==========================================================================
   ChatGPT-Style Response Text Selection Tooltip & Quote Preview Box
   ========================================================================== */

/* Floating Selection Action Tooltip */
.selection-action-tooltip {
    position: fixed;
    z-index: 10000;
    pointer-events: auto;
    animation: tooltipFadeIn 0.16s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transform: translate(-50%, -100%);
    margin-top: -8px;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translate(-50%, -90%) scale(0.92);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -100%) scale(1);
    }
}

.btn-ask-selection {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #1e1b4b;
    color: #ede9fe;
    border: 1px solid rgba(139, 92, 246, 0.6);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.45), 0 0 10px rgba(124, 58, 237, 0.4);
    transition: all 0.18s ease;
    white-space: nowrap;
    user-select: none;
}

.btn-ask-selection:hover {
    background: #6d28d9;
    color: #ffffff;
    border-color: #a78bfa;
    box-shadow: 0 6px 22px rgba(109, 40, 217, 0.6), 0 0 14px rgba(167, 139, 250, 0.6);
    transform: translateY(-1px);
}

.btn-ask-selection svg {
    flex-shrink: 0;
}

/* Quote Selection Preview Box in Chat Input Area */
.quote-preview-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: rgba(109, 40, 217, 0.14);
    border: 1px solid rgba(139, 92, 246, 0.35);
    border-left: 3px solid #8b5cf6;
    border-radius: 8px;
    padding: 7px 10px;
    margin-bottom: 8px;
    animation: quoteSlideDown 0.18s ease-out;
}

@keyframes quoteSlideDown {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.quote-preview-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
}

.quote-reply-icon {
    font-size: 0.85rem;
    flex-shrink: 0;
}

.quote-preview-details {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.quote-preview-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: #c4b5fd;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.quote-preview-snippet {
    font-size: 0.8rem;
    color: #e2e8f0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-style: italic;
}

.btn-cancel-quote {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    padding: 3px 6px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.btn-cancel-quote:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.15);
}

/* User Message Quoted Bubble */
.msg-quote-snippet {
    background: rgba(0, 0, 0, 0.28);
    border-left: 2px solid rgba(255, 255, 255, 0.75);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.78rem;
    margin-bottom: 6px;
    color: rgba(255, 255, 255, 0.9);
    font-style: italic;
    word-break: break-word;
}

.msg-quote-snippet .quote-pin {
    font-size: 0.7rem;
    font-weight: 700;
    color: #ddd6fe;
    display: block;
    margin-bottom: 2px;
    font-style: normal;
}

.chat-form-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border-highlight);
    border-radius: 12px;
    padding: 6px 8px 6px 12px;
}

#chat-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.88rem;
    outline: none;
    resize: none;
}

.btn-send-purple {
    background: var(--purple-accent);
    color: white;
    border: none;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
}

.btn-send-purple:hover {
    background: #7c3aed;
}

.btn-send-purple:disabled {
    background: var(--border-color);
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.45;
    pointer-events: none;
}

/* Header View Navigation Switcher */
.nav-view-switcher {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 20px;
    background: var(--bg-input);
    padding: 3px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.nav-tab {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 600;
    padding: 5px 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-tab:hover {
    color: var(--text-primary);
}

.nav-tab.active {
    background: var(--border-highlight);
    color: var(--cyan-accent);
    box-shadow: 0 0 10px var(--cyan-glow);
}

/* Header "Go to Gallery" Button on /admin */
.btn-go-gallery {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 7px 15px;
    border-radius: 8px;
    font-size: 0.84rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    margin-left: 20px;
    user-select: none;
    font-family: inherit;
}

.btn-go-gallery:hover {
    background: var(--cyan-dim);
    border-color: var(--cyan-accent);
    color: var(--cyan-accent);
    box-shadow: 0 0 14px var(--cyan-glow);
    transform: translateX(-2px);
}

.btn-go-gallery svg {
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.btn-go-gallery:hover svg {
    transform: translateX(-2px);
}

.active-video-badge {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--cyan-accent);
    background: var(--cyan-dim);
    border: 1px solid var(--cyan-glow);
    padding: 3px 10px;
    border-radius: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 250px;
}

.badge-count {
    margin-left: auto;
    font-size: 0.76rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
    background: var(--bg-input);
    padding: 3px 9px;
    border-radius: 10px;
}

/* Video Library Section on Home Page */
.video-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
    max-height: 380px;
    overflow-y: auto;
}

.video-item-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px 18px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.video-item-card:hover {
    border-color: var(--border-highlight);
    background: var(--bg-hover);
    transform: translateY(-1px);
}

.video-item-card.active {
    border-color: var(--cyan-accent);
    background: radial-gradient(circle at top left, var(--cyan-dim), var(--bg-input));
    box-shadow: 0 0 12px var(--cyan-glow);
}

.card-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.play-icon-box {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--cyan-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.video-item-card.active .play-icon-box {
    background: var(--cyan-accent);
    color: var(--btn-cyan-text);
}

.video-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.video-title {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-primary);
}

.video-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.76rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.badge-source {
    padding: 2px 7px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.7rem;
}

.badge-source.local {
    background: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-source.yt {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-play-video {
    background: var(--bg-dark);
    border: 1px solid var(--border-highlight);
    color: var(--text-secondary);
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.video-item-card:hover .btn-play-video {
    background: var(--cyan-accent);
    color: var(--btn-cyan-text);
    border-color: var(--cyan-accent);
}

.btn-playing {
    background: var(--cyan-dim) !important;
    border-color: var(--cyan-accent) !important;
    color: var(--cyan-accent) !important;
}

.empty-video-state {
    text-align: center;
    padding: 30px;
    color: var(--text-muted);
    font-size: 0.88rem;
}

.btn-goto-admin {
    margin-top: 10px;
    background: var(--purple-accent);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
}

/* Admin Panel Section */
.admin-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
}

.admin-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.text-input-field {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-highlight);
    border-radius: 8px;
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
}

.text-input-field:focus {
    border-color: var(--cyan-accent);
}

.admin-manage-card {
    margin-top: 16px;
}

.admin-table-wrapper {
    overflow-x: auto;
    margin-top: 10px;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.84rem;
    text-align: left;
}

.admin-table th, .admin-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
}

.admin-table th {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 600;
}

.admin-table td {
    color: var(--text-secondary);
}

.btn-tokens {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: #10b981;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.76rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.btn-tokens:hover {
    background: #10b981;
    color: white;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35);
}

.btn-delete {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #f87171;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.76rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-delete:hover {
    background: #ef4444;
    color: white;
}

/* Home Gallery View & Thumbnail Card Grid */
.gallery-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
}

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

.gallery-title-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.gallery-title-group h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.gallery-sub {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.video-grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 22px;
    margin-top: 10px;
}

/* Individual Video Card */
.video-card-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    box-shadow: var(--card-shadow);
    transition: all 0.25s ease;
}

.video-card-item:hover {
    border-color: var(--cyan-accent);
    transform: translateY(-4px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4), 0 0 16px var(--cyan-glow);
}

/* Card Thumbnail Box */
.card-thumb-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    overflow: hidden;
}

.card-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.video-card-item:hover .card-thumb-img {
    transform: scale(1.05);
}

.card-thumb-fallback, .card-thumb-wrapper.local-gradient {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1e1b4b 0%, #0f172a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.local-thumb-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: #a5b4fc;
}

.local-cam-icon {
    font-size: 2.2rem;
}

.local-filename {
    font-size: 0.76rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
}

/* Hover Play Overlay */
.thumb-play-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(9, 10, 15, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.video-card-item:hover .thumb-play-overlay {
    opacity: 1;
}

.play-btn-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--cyan-accent);
    color: var(--btn-cyan-text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
    padding-left: 3px;
    box-shadow: 0 0 20px var(--cyan-glow);
    transform: scale(0.8);
    transition: transform 0.2s ease;
}

.video-card-item:hover .play-btn-circle {
    transform: scale(1);
}

/* Card Details */
.card-details {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
}

.card-details-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chunk-badge {
    font-size: 0.72rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
    background: var(--bg-input);
    padding: 2px 8px;
    border-radius: 6px;
}

.card-video-title {
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;

    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
    font-size: 0.76rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
    text-align: center;
}

.btn-launch-player {
    color: var(--cyan-accent);
    font-weight: 600;
    text-align: center;
}

/* Player Screen View (Opened on Click) */
.player-screen-container {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
}

.player-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 4px;
}

.btn-back-gallery {
    background: var(--bg-card);
    border: 1px solid var(--border-highlight);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-back-gallery:hover {
    background: var(--border-highlight);
    color: var(--cyan-accent);
    border-color: var(--cyan-accent);
}

/* Admin Table Action Buttons */
.action-buttons-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-edit {
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #60a5fa;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.76rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-edit:hover {
    background: #3b82f6;
    color: white;
}

/* Edit Video Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--modal-overlay-bg);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-card {
    background: var(--bg-card);
    border: 1px solid var(--border-highlight);
    border-radius: 14px;
    width: 480px;
    max-width: 90%;
    padding: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
    position: relative;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-color);
    position: relative;
    z-index: 10;
}

.modal-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 16px;
    position: relative;
}

.modal-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 10px;
    position: relative;
    z-index: 10;
}

.btn-secondary {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.84rem;
    cursor: pointer;
}

.btn-secondary:hover {
    background: var(--border-highlight);
    color: var(--text-primary);
}

/* ========================================================
   Token Usage Modal & Dialog Styles
   ======================================================== */
.modal-card-wide {
    width: 760px;
    max-width: 95vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.token-modal-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.token-video-pill {
    background: var(--cyan-dim);
    color: var(--cyan-accent);
    border: 1px solid var(--cyan-glow);
    font-size: 0.76rem;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 12px;
    max-width: 320px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
}

.token-modal-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 16px;
    overflow-y: auto;
    padding-right: 4px;
}

.token-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 10px;
}

.token-date-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.token-date-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.token-date-input {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-highlight);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-family: var(--font-sans);
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.token-date-input:focus {
    border-color: var(--cyan-accent);
    box-shadow: 0 0 0 2px var(--cyan-glow);
}

.btn-token-today {
    background: var(--bg-card);
    color: var(--cyan-accent);
    border: 1px solid var(--cyan-glow);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-token-today:hover {
    background: var(--cyan-accent);
    color: var(--btn-cyan-text);
}

.token-meta-chips {
    display: flex;
    align-items: center;
    gap: 8px;
}

.token-chip-lifetime {
    font-size: 0.78rem;
    color: var(--text-muted);
    background: var(--bg-card);
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.token-chip-lifetime strong {
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.token-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

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

.token-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px 16px;
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: transform 0.2s ease;
}

.token-card:hover {
    transform: translateY(-2px);
}

.token-card.card-cyan {
    border-top: 3px solid var(--cyan-accent);
    background: linear-gradient(180deg, var(--cyan-dim) 0%, var(--bg-card) 60%);
}

.token-card.card-purple {
    border-top: 3px solid var(--purple-accent);
    background: linear-gradient(180deg, var(--purple-dim) 0%, var(--bg-card) 60%);
}

.token-card.card-emerald {
    border-top: 3px solid #10b981;
    background: linear-gradient(180deg, rgba(16, 185, 129, 0.1) 0%, var(--bg-card) 60%);
}

.token-card-top {
    display: flex;
    align-items: center;
    gap: 6px;
}

.token-card-icon {
    font-size: 1rem;
}

.token-card-title {
    font-size: 0.74rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.token-card-num {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    font-family: var(--font-mono);
    line-height: 1.2;
    margin-top: 2px;
}

.token-card.card-cyan .token-card-num {
    color: var(--cyan-accent);
}

.token-card.card-purple .token-card-num {
    color: var(--purple-accent);
}

.token-card.card-emerald .token-card-num {
    color: #10b981;
}

.token-card-desc {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.token-table-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}

.token-table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2px;
}

.token-table-header h4 {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary);
}

.token-table-counter {
    font-size: 0.74rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    background: var(--bg-input);
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.token-table-scroll {
    max-height: 420px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-card);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
}

#panel-video-tokens .token-table-scroll {
    max-height: 480px;
}

.token-usage-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.81rem;
    text-align: left;
}

.token-usage-table th {
    position: sticky;
    top: 0;
    background: var(--bg-input);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.70rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 11px 14px;
    border-bottom: 1px solid var(--border-color);
    z-index: 2;
    white-space: nowrap;
}

.token-usage-table th.col-num,
.token-usage-table td.col-num {
    text-align: right;
}

.token-usage-table tbody tr {
    transition: background-color 0.15s ease;
}

.token-usage-table td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    vertical-align: middle;
}

.token-usage-table tbody tr:last-child td {
    border-bottom: none;
}

.token-usage-table tbody tr:hover td {
    background: var(--bg-hover);
}

.token-date-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-sans);
    font-size: 0.80rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
}

.token-date-icon {
    font-size: 0.85rem;
    opacity: 0.75;
}

.token-time-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: var(--font-mono);
    font-size: 0.74rem;
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary);
    background: var(--bg-input);
    padding: 3px 8px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    white-space: nowrap;
}

.token-num {
    font-family: var(--font-mono);
    font-size: 0.80rem;
    font-variant-numeric: tabular-nums;
}

.token-num-in {
    color: #2563eb;
    font-weight: 600;
}

[data-theme="dark"] .token-num-in {
    color: #60a5fa;
}

.token-num-out {
    color: #7c3aed;
    font-weight: 600;
}

[data-theme="dark"] .token-num-out {
    color: #a78bfa;
}

.token-num-tot {
    color: #059669;
    font-weight: 700;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.22);
    padding: 2px 7px;
    border-radius: 6px;
    display: inline-block;
}

[data-theme="dark"] .token-num-tot {
    color: #34d399;
    background: rgba(52, 211, 153, 0.12);
    border-color: rgba(52, 211, 153, 0.28);
}

.token-model-badge {
    display: inline-block;
    max-width: 155px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.72rem;
    font-weight: 500;
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.18);
    border-radius: 9999px;
    padding: 2px 10px;
    color: #4f46e5;
}

[data-theme="dark"] .token-model-badge {
    background: rgba(99, 102, 241, 0.16);
    border-color: rgba(99, 102, 241, 0.3);
    color: #a5b4fc;
}

.token-query-cell {
    max-width: 320px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
    font-size: 0.80rem;
    font-weight: 400;
    line-height: 1.4;
}

.token-empty-state {
    padding: 36px 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
}

.token-empty-icon {
    font-size: 2.2rem;
    opacity: 0.7;
    margin-bottom: 2px;
}

.token-empty-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-primary);
}

.token-empty-sub {
    font-size: 0.78rem;
    max-width: 440px;
    line-height: 1.4;
    color: var(--text-muted);
}

.token-loading-state {
    padding: 36px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.spinner-small {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-highlight);
    border-top-color: var(--cyan-accent);
    border-radius: 50%;
    animation: tokenSpin 0.8s linear infinite;
}

@keyframes tokenSpin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Gemini & YouTube Style Loading Animation with Theme Colors */
.gemini-yt-loader {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 4px 2px;
    min-width: 240px;
}

.loader-spark-head {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.spark-icon {
    display: inline-block;
    font-size: 0.95rem;
    animation: geminiSparkPulse 1.8s infinite ease-in-out;
}

@keyframes geminiSparkPulse {
    0%, 100% {
        transform: scale(1) rotate(0deg);
        filter: drop-shadow(0 0 3px var(--cyan-accent));
        opacity: 0.85;
    }
    50% {
        transform: scale(1.25) rotate(15deg);
        filter: drop-shadow(0 0 8px var(--purple-accent));
        opacity: 1;
    }
}

.loader-status-text {
    background: linear-gradient(90deg, var(--purple-accent), var(--cyan-accent), #60a5fa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 600;
    font-size: 0.84rem;
    letter-spacing: 0.2px;
}

/* Pulsing Dots (YouTube Style) */
.pulse-dots {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 2px;
}

.pulse-dots .dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    animation: dotPulse 1.4s infinite ease-in-out both;
}

.pulse-dots .dot-1 {
    animation-delay: 0s;
    background-color: var(--purple-accent);
}

.pulse-dots .dot-2 {
    animation-delay: 0.2s;
    background-color: var(--cyan-accent);
}

.pulse-dots .dot-3 {
    animation-delay: 0.4s;
    background-color: #60a5fa;
}

@keyframes dotPulse {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.35;
    }
    40% {
        transform: scale(1.3);
        opacity: 1;
        box-shadow: 0 0 6px currentColor;
    }
}

/* Gemini & YouTube Shimmer Skeleton Wave */
.shimmer-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    margin-top: 2px;
}

.shimmer-line {
    height: 10px;
    border-radius: 6px;
    background: linear-gradient(
        90deg,
        var(--shimmer-base) 0%,
        rgba(139, 92, 246, 0.25) 25%,
        var(--cyan-dim) 50%,
        rgba(139, 92, 246, 0.25) 75%,
        var(--shimmer-base) 100%
    );
    background-size: 200% 100%;
    animation: geminiShimmerWave 1.8s infinite linear;
}

.shimmer-line.line-1 {
    width: 85%;
}

.shimmer-line.line-2 {
    width: 95%;
    animation-delay: 0.2s;
}

.shimmer-line.line-3 {
    width: 60%;
    animation-delay: 0.4s;
}

@keyframes geminiShimmerWave {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ==========================================
   RESPONSIVE DESIGN & MOBILE OPTIMIZATIONS
   ========================================== */

/* Body Lock for Mobile Chat Drawer Overlay */
body.chat-drawer-open {
    overflow: hidden !important;
}

/* --- Large Tablets / Small Laptops (max-width: 1200px) --- */
@media (max-width: 1200px) {
    .app-layout {
        max-width: 100%;
        padding: 16px;
        gap: 16px;
    }

    .chat-drawer {
        width: 350px;
    }
    
    .video-grid-cards {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
        gap: 18px;
    }
}

/* --- Medium Tablets & Mobile Screens (max-width: 992px) --- */
@media (max-width: 992px) {
    body {
        overflow-y: auto;
    }

    .app-header {
        height: auto;
        min-height: 56px;
        padding: 10px 16px;
        flex-wrap: wrap;
        gap: 10px;
    }

    .header-left {
        gap: 10px;
        flex-wrap: wrap;
    }

    .nav-view-switcher {
        margin-left: 8px;
    }

    .header-right {
        gap: 8px;
        flex-wrap: wrap;
        margin-left: auto;
    }

    .status-pill {
        padding: 4px 10px;
        font-size: 0.72rem;
    }

    .provider-select-group select, #api-key-input {
        font-size: 0.8rem;
        padding: 5px 10px;
    }

    .app-layout {
        flex-direction: column;
        height: auto;
        min-height: calc(100vh - 64px);
        overflow: visible;
        padding: 14px;
        gap: 14px;
    }

    .main-content {
        overflow-y: visible;
        padding-right: 0;
        width: 100%;
    }

    /* Floating / Slide-over Chat Drawer on Tablet/Mobile */
    .chat-drawer {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: 380px;
        max-width: 90vw;
        height: 100vh;
        max-height: 100vh;
        z-index: 1000;
        border-radius: 0;
        border-top: none;
        border-bottom: none;
        border-right: none;
        box-shadow: -8px 0 24px rgba(0, 0, 0, 0.6);
    }
}

/* --- Small Tablets & Mobile Devices (max-width: 768px) --- */
@media (max-width: 768px) {
    .app-header {
        padding: 10px 12px;
        justify-content: space-between;
    }

    .header-left {
        width: 100%;
        justify-content: space-between;
    }

    .nav-view-switcher {
        margin-left: 0;
    }

    .header-right {
        width: 100%;
        justify-content: flex-start;
        gap: 8px;
    }

    .brand-name {
        font-size: 0.98rem;
    }

    .status-pill span:not(.status-dot) {
        max-width: 140px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .provider-select-group {
        flex: 1;
        min-width: 140px;
    }

    .provider-select-group select {
        width: 100%;
    }

    #api-key-input {
        width: 100% !important;
    }

    .btn-chat-toggle {
        margin-left: auto;
        padding: 6px 12px;
        font-size: 0.8rem;
    }

    /* Gallery View Responsive Layout */
    .gallery-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .badge-count {
        margin-left: 0;
    }

    .video-grid-cards {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 14px;
    }

    /* Player View Responsive Top Bar & Player */
    .player-top-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .btn-back-gallery {
        width: 100%;
        text-align: center;
    }

    .active-video-badge {
        max-width: 100%;
        width: 100%;
        text-align: center;
    }

    .waveform-bar {
        flex-wrap: wrap;
        gap: 10px;
        padding: 10px 14px;
        justify-content: center;
    }

    .waveform-spectrum {
        height: 20px;
    }

    .textedit-link {
        width: 100%;
        text-align: center;
    }

    /* Admin Panel Responsive Layout */
    .dropzone-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .drop-box {
        padding: 16px;
    }

    .admin-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 8px;
        border: 1px solid var(--border-color);
    }

    .admin-table th, .admin-table td {
        padding: 8px 10px;
        font-size: 0.78rem;
        white-space: nowrap;
    }

    /* Fullscreen Modal/Drawer on Mobile */
    .chat-drawer {
        width: 100vw;
        max-width: 100vw;
        height: 100vh;
        max-height: 100vh;
        left: 0;
        top: 0;
        right: 0;
        bottom: 0;
    }

    .drawer-header {
        padding: 12px 16px;
    }

    .btn-close-drawer {
        padding: 6px 12px;
        background: var(--bg-input);
        border: 1px solid var(--border-color);
        border-radius: 8px;
        color: var(--text-primary);
        font-size: 0.9rem;
    }

    .chat-messages {
        padding: 12px 14px;
    }

    .msg-body {
        max-width: 92%;
        font-size: 0.84rem;
    }

    .chat-input-area {
        padding: 10px 12px;
    }

    /* Edit Modal Responsive */
    .modal-card {
        width: 94%;
        max-width: 480px;
        padding: 18px;
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* --- Extra Small Mobile Phones (max-width: 480px) --- */
@media (max-width: 480px) {
    .app-header {
        padding: 8px 10px;
    }

    .logo-box {
        width: 28px;
        height: 28px;
        padding: 2px;
    }

    .brand-name {
        font-size: 0.9rem;
    }

    .nav-view-switcher {
        width: 100%;
        justify-content: center;
        margin-top: 4px;
    }

    .nav-tab {
        flex: 1;
        text-align: center;
        padding: 6px 8px;
        font-size: 0.78rem;
    }

    .header-right {
        gap: 6px;
    }

    .status-pill {
        padding: 3px 8px;
        font-size: 0.68rem;
    }

    .video-grid-cards {
        grid-template-columns: 1fr;
    }

    .card-video-title {
        font-size: 0.92rem;
    }

    .card-footer {
        font-size: 0.72rem;
    }

    .action-submit-row {
        flex-direction: column;
        gap: 8px;
    }

    .btn-index-cyan {
        width: 100%;
    }

    .modal-actions {
        flex-direction: column-reverse;
        gap: 8px;
    }

    .modal-actions button {
        width: 100%;
    }
}

/* ========================================================
   Admin Suite Sidebar & Tab Layout Styles
   ======================================================== */
.admin-layout-content {
    max-width: 1400px;
    width: 100%;
    padding: 0 16px;
    margin: 0 auto;
}

.admin-suite-container {
    display: flex;
    gap: 24px;
    width: 100%;
    align-items: flex-start;
    min-height: calc(100vh - 120px);
}

.admin-sidebar {
    width: 230px;
    flex-shrink: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: sticky;
    top: 80px;
    box-shadow: var(--card-shadow);
}

.admin-sidebar-brand {
    padding: 4px 8px 12px 8px;
    border-bottom: 1px solid var(--border-color);
}

.admin-sidebar-brand-group {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 10px;
}

.admin-sidebar-logo-box {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.admin-sidebar-logo {
    width: 18px;
    height: 18px;
    object-fit: contain;
    display: block;
}

.admin-sidebar-site-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.admin-sidebar-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--cyan-accent);
    background: var(--cyan-dim);
    border: 1px solid var(--cyan-glow);
    padding: 2px 8px;
    border-radius: 6px;
    margin-bottom: 6px;
}

.admin-sidebar-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}

.admin-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.admin-tab-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    width: 100%;
}

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

.admin-tab-btn.active {
    background: var(--cyan-dim);
    color: var(--cyan-accent);
    border-color: var(--cyan-glow);
    box-shadow: 0 2px 8px var(--cyan-glow);
}

.tab-icon {
    font-size: 1.1rem;
}

.admin-sidebar-footer {
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid var(--border-color);
}

.admin-sidebar-db-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.74rem;
    color: var(--text-muted);
    padding: 4px 6px;
}

.status-pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
}

.admin-panels-container {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.admin-panel-content {
    width: 100%;
}

.admin-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.panel-title-wrap h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.panel-subtitle {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.btn-refresh-analytics {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--cyan-accent);
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-refresh-analytics:hover {
    background: var(--cyan-dim);
    border-color: var(--cyan-glow);
}

.btn-refresh-analytics.spinning {
    opacity: 0.6;
    pointer-events: none;
}

/* ========================================================
   Analytics Card & Model Bar Chart Styles
   ======================================================== */
.analytics-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 20px;
    box-shadow: var(--card-shadow);
    margin-bottom: 20px;
}

.analytics-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.analytics-card-badge {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--cyan-accent);
    background: var(--cyan-dim);
    padding: 2px 8px;
    border-radius: 4px;
    margin-bottom: 4px;
    display: inline-block;
}

.card-title-group h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}

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

.chart-timeframe-toggle {
    display: inline-flex;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 2px;
    gap: 2px;
}

.btn-timeframe-mode {
    background: transparent;
    border: none;
    padding: 5px 12px;
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: var(--font-sans);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

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

.btn-timeframe-mode.active {
    background: linear-gradient(135deg, #d22730 0%, #a61a22 100%);
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(210, 39, 48, 0.3);
}

[data-theme="dark"] .btn-timeframe-mode.active {
    background: linear-gradient(135deg, #ff3b47 0%, #d22730 100%);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(255, 59, 71, 0.35);
}

.chart-view-toggle {
    display: inline-flex;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 2px;
}

.btn-chart-mode {
    background: transparent;
    border: none;
    padding: 5px 12px;
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--text-secondary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-sans);
}

.btn-chart-mode:hover {
    color: var(--text-primary);
}

.btn-chart-mode.active {
    background: var(--cyan-accent);
    color: #ffffff;
    box-shadow: 0 1px 4px rgba(6, 182, 212, 0.25);
}

/* Specific Timeframe Option Pickers Toolbar */
.chart-picker-toolbar {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 14px;
    transition: all 0.25s ease;
}

.picker-panel {
    display: block;
}

.picker-panel-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.picker-lead-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
}

.picker-lead-icon {
    font-size: 1.1rem;
}

.picker-controls-wrap {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.picker-field-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.picker-field-item label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
}

.analytics-picker-select,
.analytics-picker-date {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-primary);
    font-family: var(--font-sans);
    outline: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.analytics-picker-select:hover,
.analytics-picker-date:hover {
    border-color: var(--border-highlight);
}

.analytics-picker-select:focus,
.analytics-picker-date:focus {
    border-color: var(--cyan-accent);
    box-shadow: 0 0 0 3px var(--cyan-dim);
}

.model-chart-content-area {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chart-canvas-container {
    position: relative;
    width: 100%;
    height: 310px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 14px;
}

.model-cards-summary-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
}

.model-summary-badge-card {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.model-summary-badge-card:hover {
    border-color: var(--border-highlight);
    transform: translateY(-1px);
}

.msb-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.msb-icon {
    font-size: 1rem;
}

.msb-name {
    font-size: 0.84rem;
    color: var(--text-primary);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.msb-pct {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--cyan-accent);
    background: var(--cyan-dim);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
}

.msb-tokens-total {
    font-size: 1.15rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-primary);
}

.msb-unit {
    font-size: 0.74rem;
    color: var(--text-muted);
    font-weight: 500;
    font-family: var(--font-sans);
}

.msb-breakdown {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.72rem;
    color: var(--text-muted);
    flex-wrap: wrap;
    border-top: 1px dashed var(--border-color);
    padding-top: 8px;
    margin-top: 2px;
}

.msb-breakdown strong {
    font-family: var(--font-mono);
}

.msb-in strong { color: var(--cyan-accent); }
.msb-out strong { color: var(--purple-accent); }
.msb-queries strong { color: var(--text-secondary); }

/* ========================================================
   Quota & Remaining Tokens Section
   ======================================================== */
.analytics-quota-section {
    margin-bottom: 24px;
}

.quota-cards-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}

.quota-stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 18px 20px;
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    gap: 6px;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease;
}

.quota-stat-card:hover {
    transform: translateY(-2px);
}

.quota-stat-card.card-used {
    border-top: 4px solid var(--purple-accent);
    background: linear-gradient(180deg, var(--purple-dim) 0%, var(--bg-card) 60%);
}

.quota-stat-card.card-remaining {
    border-top: 4px solid #10b981;
    background: linear-gradient(180deg, rgba(16, 185, 129, 0.12) 0%, var(--bg-card) 60%);
}

.quota-stat-card.card-quota {
    border-top: 4px solid var(--cyan-accent);
    background: linear-gradient(180deg, var(--cyan-dim) 0%, var(--bg-card) 60%);
}

.quota-card-top {
    display: flex;
    align-items: center;
    gap: 8px;
}

.quota-card-icon {
    font-size: 1.1rem;
}

.quota-card-label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.quota-card-value {
    font-size: 1.85rem;
    font-weight: 800;
    font-family: var(--font-mono);
    color: var(--text-primary);
    line-height: 1.2;
}

.quota-stat-card.card-used .quota-card-value { color: var(--purple-accent); }
.quota-stat-card.card-remaining .quota-card-value { color: #10b981; }
.quota-stat-card.card-quota .quota-card-value { color: var(--cyan-accent); }

.quota-card-desc {
    font-size: 0.76rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.btn-edit-quota {
    background: var(--cyan-dim);
    border: 1px solid var(--cyan-glow);
    color: var(--cyan-accent);
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 0.74rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-edit-quota:hover {
    background: var(--cyan-accent);
    color: var(--btn-cyan-text);
}

.quota-model-badge {
    display: inline-flex;
    align-items: center;
    background: var(--cyan-dim);
    color: var(--cyan-accent);
    border: 1px solid var(--cyan-glow);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 600;
    font-family: var(--font-mono);
}

.quota-progress-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px 18px;
    margin-bottom: 16px;
    box-shadow: var(--card-shadow);
}

.quota-progress-labels {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.progress-label-right {
    font-family: var(--font-mono);
    color: var(--text-muted);
}

.quota-progress-track {
    width: 100%;
    height: 10px;
    background: var(--bg-input);
    border-radius: 5px;
    overflow: hidden;
}

.quota-progress-fill {
    height: 100%;
    border-radius: 5px;
    background: linear-gradient(90deg, var(--cyan-accent) 0%, #10b981 100%);
    transition: width 0.6s ease;
}

.analytics-meta-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.meta-pill {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.meta-pill strong {
    font-family: var(--font-mono);
    color: var(--text-primary);
}

/* ========================================================
   Tab 3: Token Usage Explorer Filters & Styles
   ======================================================== */
.token-tab-filter-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    padding: 14px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: var(--card-shadow);
}

.filter-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.tab-select-field {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-highlight);
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-family: var(--font-sans);
    outline: none;
    min-width: 250px;
    cursor: pointer;
}

.tab-select-field:focus {
    border-color: var(--cyan-accent);
}

.date-pick-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ========================================================
   Tab 4 & 5: Dummy Settings and Profile Styles
   ======================================================== */
.dummy-settings-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.settings-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    padding: 20px;
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.settings-card h3 {
    font-size: 1rem;
    color: var(--text-primary);
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.dummy-field-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dummy-field-row label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.dummy-val {
    font-size: 0.76rem;
    color: var(--text-muted);
}

.dummy-toggle-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.dummy-profile-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--card-shadow);
}

.profile-header-strip {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.profile-avatar-circle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--cyan-accent) 0%, var(--purple-accent) 100%);
    color: white;
    font-weight: 800;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px var(--cyan-glow);
}

.profile-meta h3 {
    font-size: 1.15rem;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.profile-email {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: block;
    margin-top: 4px;
}

.profile-details-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.profile-detail-item {
    background: var(--bg-input);
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-label {
    font-size: 0.74rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}

.detail-val {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
}

.text-emerald {
    color: #10b981;
}

/* ========================================================
   AI Model Credentials & Encrypted Key Manager Styles
   ======================================================== */
.ai-credentials-card {
    margin-bottom: 24px;
}

.ai-config-info-text {
    font-size: 0.84rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 18px;
}

.ai-config-info-text code {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: var(--font-mono);
    color: var(--cyan-accent);
}

.ai-config-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}

.config-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.config-field label {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.82rem;
    color: var(--text-primary);
}

.config-hint {
    font-size: 0.74rem;
    color: var(--text-muted);
}

.config-hint code {
    background: var(--bg-input);
    padding: 1px 4px;
    border-radius: 3px;
    font-family: var(--font-mono);
}

.key-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.key-input-wrapper input {
    padding-right: 90px;
    width: 100%;
}

.btn-toggle-key {
    position: absolute;
    right: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.74rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-toggle-key:hover {
    background: var(--cyan-dim);
    color: var(--cyan-accent);
    border-color: var(--cyan-glow);
}

.active-key-pill {
    margin-top: 8px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
}

.key-pill-label {
    color: var(--text-muted);
    font-size: 0.72rem;
}

.active-key-pill code {
    font-family: var(--font-mono);
    color: var(--cyan-accent);
    font-weight: 600;
}

.badge-encryption-status {
    font-size: 0.72rem;
    font-weight: 700;
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    padding: 3px 10px;
    border-radius: 6px;
}

.btn-save-ai-config,
.btn-settings-save {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--cyan-accent) 0%, #a61220 100%);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.18);
    padding: 11px 22px;
    border-radius: 9px;
    font-weight: 700;
    font-size: 0.9rem;
    font-family: var(--font-sans);
    letter-spacing: 0.01em;
    cursor: pointer;
    box-shadow: 0 4px 14px var(--cyan-glow);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-save-ai-config:hover,
.btn-settings-save:hover {
    background: linear-gradient(135deg, #e02437 0%, #b81525 100%);
    box-shadow: 0 6px 20px var(--cyan-glow);
    transform: translateY(-1px);
}

.btn-save-ai-config:active,
.btn-settings-save:active {
    transform: translateY(1px);
    box-shadow: 0 2px 8px var(--cyan-glow);
}

[data-theme="dark"] .btn-save-ai-config,
[data-theme="dark"] .btn-settings-save {
    background: linear-gradient(135deg, #ff3b47 0%, #cf1a2c 100%);
    box-shadow: 0 4px 16px rgba(255, 59, 71, 0.35);
}

[data-theme="dark"] .btn-save-ai-config:hover,
[data-theme="dark"] .btn-settings-save:hover {
    background: linear-gradient(135deg, #ff5560 0%, #e02437 100%);
    box-shadow: 0 6px 24px rgba(255, 59, 71, 0.5);
}

.ai-config-actions {
    margin-top: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.ai-config-status {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 6px;
}

.ai-config-status.success {
    color: #10b981;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.ai-config-status.error {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.25);
}

/* Responsive adjustments for Admin Suite */
@media (max-width: 900px) {
    .admin-suite-container {
        flex-direction: column;
    }
    .admin-sidebar {
        width: 100%;
        position: static;
    }
    .admin-sidebar-nav {
        flex-direction: row;
        overflow-x: auto;
    }
    .admin-tab-btn {
        white-space: nowrap;
    }
    .quota-cards-grid,
    .dummy-settings-grid,
    .profile-details-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Admin Authentication Gate & Security Styles
   ========================================================================== */
.admin-auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 140px);
    padding: 32px 16px;
    width: 100%;
}

.admin-auth-card {
    background: var(--bg-card);
    border: 1px solid rgba(207, 26, 44, 0.35);
    border-radius: 18px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35), 0 0 30px rgba(207, 26, 44, 0.12);
    width: 100%;
    max-width: 440px;
    padding: 36px 32px;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(16px);
}

.admin-auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #cf1a2c, #ff4d5a, #cf1a2c);
}

.admin-auth-header {
    text-align: center;
    margin-bottom: 24px;
}

.admin-auth-brand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 12px;
}

.admin-auth-logo-box {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(207, 26, 44, 0.08);
    border: 1px solid rgba(207, 26, 44, 0.22);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(207, 26, 44, 0.12);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.admin-auth-card:hover .admin-auth-logo-box {
    transform: scale(1.05);
}

.admin-auth-logo-img {
    width: 30px;
    height: 30px;
    object-fit: contain;
    display: block;
}

.admin-auth-site-name {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.admin-auth-badge-wrap {
    margin-bottom: 8px;
}

.admin-auth-shield {
    font-size: 2.4rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(207, 26, 44, 0.12);
    border: 1px solid rgba(207, 26, 44, 0.3);
    margin-bottom: 12px;
    box-shadow: 0 0 20px rgba(207, 26, 44, 0.2);
}

.admin-auth-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    color: #cf1a2c;
    background: rgba(207, 26, 44, 0.12);
    border: 1px solid rgba(207, 26, 44, 0.3);
    padding: 3px 10px;
    border-radius: 20px;
    margin-bottom: 8px;
}

.admin-auth-header h2 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 6px;
    letter-spacing: -0.02em;
}

.admin-auth-header p {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.45;
}

.admin-auth-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-group-modern {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group-modern label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.02em;
}

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon .input-icon {
    position: absolute;
    left: 12px;
    font-size: 1rem;
    color: var(--text-muted);
    pointer-events: none;
    z-index: 2;
}

.input-with-icon .text-input-field {
    padding-left: 38px;
    width: 100%;
    height: 44px;
    border-radius: 10px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.input-with-icon .text-input-field:focus {
    border-color: #cf1a2c;
    box-shadow: 0 0 0 3px rgba(207, 26, 44, 0.2);
    outline: none;
}

.password-input-wrap .text-input-field {
    padding-right: 42px;
}

.btn-pwd-toggle {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.05rem;
    padding: 6px 8px;
    border-radius: 6px;
    color: var(--text-muted);
    transition: opacity 0.2s ease;
}

.btn-pwd-toggle:hover {
    opacity: 0.8;
}

.btn-admin-auth-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: 46px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 700;
    color: #ffffff;
    background: linear-gradient(135deg, #cf1a2c 0%, #a61220 100%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(207, 26, 44, 0.35);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    margin-top: 6px;
}

.btn-admin-auth-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(207, 26, 44, 0.45);
    background: linear-gradient(135deg, #e02437 0%, #ba1626 100%);
}

.btn-admin-auth-submit:active {
    transform: translateY(1px);
}

.admin-login-alert {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.4;
}

.admin-login-alert.error {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.35);
    color: #ef4444;
}

.admin-login-alert.warning {
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.35);
    color: #f59e0b;
}

.admin-login-alert.success {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: #10b981;
}

.admin-auth-footer {
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.admin-auth-security-notice {
    font-size: 0.72rem;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-back-to-site {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s ease;
}

.btn-back-to-site:hover {
    color: var(--cyan-accent);
}

/* Sidebar User Badge & Logout Button */
.admin-user-profile-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 8px;
    width: 100%;
}

.user-badge-avatar {
    font-size: 1.2rem;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(207, 26, 44, 0.15);
    border: 1px solid rgba(207, 26, 44, 0.3);
    flex-shrink: 0;
}

.user-badge-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.user-badge-name {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.btn-admin-logout {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 700;
    background: rgba(207, 26, 44, 0.08);
    border: 1px solid rgba(207, 26, 44, 0.25);
    color: #cf1a2c;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 8px;
}

.btn-admin-logout:hover {
    background: rgba(207, 26, 44, 0.2);
    border-color: #cf1a2c;
    color: #ffffff;
    transform: translateY(-1px);
}

.btn-admin-logout:active {
    transform: translateY(1px);
}

/* Settings container */
.admin-settings-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Profile Tab Logged-in Admin Card */
.admin-account-overview-row {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-input);
    padding: 16px 20px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin-top: 10px;
    flex-wrap: wrap;
}

.admin-account-avatar {
    font-size: 2rem;
    width: 52px;
    height: 52px;
    border-radius: 12px;
    background: rgba(207, 26, 44, 0.15);
    border: 1px solid rgba(207, 26, 44, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(207, 26, 44, 0.15);
}

.admin-account-meta {
    flex: 1;
    min-width: 180px;
}

.admin-account-disp-name {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0 0 2px 0;
}

.admin-account-disp-email {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.admin-account-tags {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.role-tag {
    background: rgba(207, 26, 44, 0.12);
    color: #cf1a2c;
    border: 1px solid rgba(207, 26, 44, 0.3);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.status-tag-active {
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

/* Logout Confirmation Modal */
.logout-modal-card {
    width: 380px;
    max-width: 90vw;
    border: 1px solid rgba(207, 26, 44, 0.3);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 30px rgba(207, 26, 44, 0.12);
    animation: authCardIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.logout-modal-header-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logout-modal-icon {
    font-size: 1.15rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: rgba(207, 26, 44, 0.12);
    border: 1px solid rgba(207, 26, 44, 0.25);
}

.logout-modal-body {
    padding: 16px 0 6px 0;
}

.logout-modal-body p {
    font-size: 0.95rem;
    color: var(--text-primary);
    line-height: 1.45;
    margin: 0;
}

.logout-modal-actions {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.btn-logout-confirm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, #cf1a2c 0%, #a61220 100%);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(207, 26, 44, 0.3);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-logout-confirm:hover {
    background: linear-gradient(135deg, #e02437 0%, #ba1626 100%);
    box-shadow: 0 6px 18px rgba(207, 26, 44, 0.45);
    transform: translateY(-1px);
}

.btn-logout-confirm:active {
    transform: translateY(1px);
}
