:root {
    --bg-dark: #0f172a;
    --bg-darker: #020617;
    --primary: #3b82f6;
    --primary-glow: rgba(59, 130, 246, 0.5);
    --secondary: #8b5cf6;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --success: #22c55e;
    --danger: #ef4444;
    --accent: #f59e0b;
    --accent-rgb: 245, 158, 11;
    --secondary-rgb: 139, 92, 246;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-darker);
    color: var(--text-main);
    overflow-x: hidden;
}

/* Base UI Elements */
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -10px var(--primary-glow);
}

.btn-primary.large {
    padding: 1rem 2rem;
    font-size: 1.125rem;
    border-radius: 12px;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    border: 1px solid var(--glass-border);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.project-card.inactive {
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(15, 23, 42, 0.8);
    cursor: default;
}

.project-card.inactive:hover {
    transform: none;
    box-shadow: none;
}

.project-card.inactive h3 {
    color: var(--text-muted);
}

/* Blob Backgrounds */
.blob-bg {
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.15) 0%, rgba(0, 0, 0, 0) 70%);
    top: -200px;
    left: -200px;
    border-radius: 50%;
    z-index: -1;
    filter: blur(40px);
}

.blob-2 {
    background: radial-gradient(circle, rgba(139, 92, 246, 0.15) 0%, rgba(0, 0, 0, 0) 70%);
    top: 20%;
    right: -200px;
    left: auto;
}

/* Landing Header */
.glass-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 5%;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.logo span {
    color: var(--primary);
}

.desktop-nav a {
    color: var(--text-muted);
    text-decoration: none;
    margin: 0 1rem;
    font-weight: 500;
    transition: color 0.3s ease;
}

.desktop-nav a:hover {
    color: var(--text-main);
}

/* Hero Section */
.hero-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    padding: 6rem 5%;
    min-height: calc(100vh - 80px);
    align-items: center;
}

.hero-content h1 {
    font-size: 4rem;
    line-height: 1.1;
    margin: 1.5rem 0;
    font-weight: 800;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.blink-badge {
    animation: pulse 1.5s infinite ease-in-out;
}

.hero-content p {
    font-size: 1.25rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
    max-width: 500px;
    line-height: 1.6;
}

.text-gradient {
    background: linear-gradient(to right, #60a5fa, #c084fc);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero-content p {
    font-size: 1.25rem;
    color: var(--text-muted);
    margin-bottom: 2.5rem;
    line-height: 1.6;
}

.badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: rgba(59, 130, 246, 0.1);
    color: #60a5fa;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.test-user-hint {
    margin-top: 1rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Settings UI Enhancements */
.chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem;
    min-height: 44px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    align-items: center;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #93c5fd;
    padding: 0.25rem 0.5rem 0.25rem 0.75rem;
    border-radius: 16px;
    font-size: 0.85rem;
}

.chip .chip-remove {
    background: transparent;
    border: none;
    color: #93c5fd;
    cursor: pointer;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.2s;
}

.chip .chip-remove:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

.time-picker-container {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 1rem;
}

.time-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.time-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(168, 85, 247, 0.15);
    border: 1px solid rgba(168, 85, 247, 0.3);
    color: #d8b4fe;
    padding: 0.5rem 0.75rem 0.5rem 1rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
}

.time-chip:hover {
    border-color: rgba(168, 85, 247, 0.6);
}

.time-chip .chip-remove {
    background: transparent;
    border: none;
    color: #d8b4fe;
    cursor: pointer;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.2s;
}

.time-chip .chip-remove:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

/* Animations Core */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-up {
    opacity: 0;
    animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.delay-1 {
    animation-delay: 0.1s;
}

.delay-2 {
    animation-delay: 0.2s;
}

.delay-3 {
    animation-delay: 0.3s;
}

/* Mockup Visual */
.glass-container {
    position: relative;
}

.mockup {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    padding: 0;
    overflow: hidden;
    max-width: 400px;
    margin: 0 auto;
}

.mockup-header {
    background: rgba(255, 255, 255, 0.02);
    padding: 1rem;
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.dot.red {
    background: #ef4444;
}

.dot.yellow {
    background: #f59e0b;
}

.dot.green {
    background: #10b981;
}

.mockup-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.mockup-post {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: 12px;
    transition: transform 0.3s ease;
}

.mockup-post:hover {
    transform: translateX(5px);
}

.mockup-post.ai-rewrite {
    background: rgba(139, 92, 246, 0.05);
    border-color: rgba(139, 92, 246, 0.2);
}

.ai-badge {
    color: #c084fc;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.skeleton-title {
    height: 12px;
    width: 60%;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    margin-bottom: 0.75rem;
}

.skeleton-text {
    height: 8px;
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.skeleton-text.short {
    width: 40%;
}

.ai-shimmering {
    background: rgba(139, 92, 246, 0.2);
}

.shimmering {
    position: relative;
    overflow: hidden;
}

.shimmering::after {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    background-image: linear-gradient(90deg,
            rgba(255, 255, 255, 0) 0,
            rgba(255, 255, 255, 0.05) 20%,
            rgba(255, 255, 255, 0.1) 60%,
            rgba(255, 255, 255, 0));
    animation: shimmer-effect 2s infinite;
    content: '';
}

@keyframes shimmer-effect {
    100% {
        transform: translateX(100%);
    }
}

.status-badge {
    color: var(--success);
    font-size: 0.875rem;
    font-weight: 500;
}

/* Floating bubbles */
.floating-bubble {
    position: absolute;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 0.75rem 1.5rem;
    border-radius: 9999px;
    backdrop-filter: blur(12px);
    font-weight: 600;
    font-size: 0.875rem;
    animation: float 6s ease-in-out infinite;
}

.bubble-1 {
    top: -20px;
    right: -20px;
}

.bubble-2 {
    bottom: 20px;
    left: -40px;
    animation-delay: -3s;
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-15px);
    }

    100% {
        transform: translateY(0px);
    }
}

/* Spinner */
.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
    display: inline-block;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 768px) {
    .hero-section {
        grid-template-columns: 1fr;
        padding: 4rem 5%;
        text-align: center;
    }

    .hero-content h1 {
        font-size: 2.5rem;
    }

    .hero-actions {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .desktop-nav {
        display: none;
    }
}

/* Dashboard Global Styles */
.dashboard-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--glass-bg);
    border-right: 1px solid var(--glass-border);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}

.sidebar h2 {
    margin-bottom: 2rem;
}

.nav-item {
    display: block;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.2s;
    margin-bottom: 0.5rem;
    cursor: pointer;
    font-weight: 500;
}

.nav-item:hover,
.nav-item.active {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary);
}

.main-content {
    padding: 2rem 3rem;
    max-width: 1200px;
    width: 100%;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.avatar {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.view-section {
    display: none;
    animation: fadeInUp 0.3s ease;
}

.view-section.active {
    display: block;
}

/* Forms & Inputs */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.form-control {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    color: white;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

/* Cards */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.project-card {
    transition: transform 0.2s;
    cursor: pointer;
}

.project-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-glow);
}

.project-card h3 {
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
}

.project-card p {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    border-top: 1px solid var(--glass-border);
    padding-top: 1rem;
}

/* Post Container */
.post-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.post-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    padding: 1.25rem;
    border-radius: 12px;
    display: flex;
    gap: 1rem;
    transition: all 0.2s;
}

.post-item.selected {
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.05);
}

.post-checkbox {
    width: 20px;
    height: 20px;
    margin-top: 0.25rem;
    accent-color: var(--primary);
    cursor: pointer;
}

.post-content {
    flex: 1;
}

.post-text {
    margin-top: 0.5rem;
    color: #e2e8f0;
    font-size: 0.95rem;
    line-height: 1.5;
}

.post-meta {
    margin-top: 0.75rem;
    font-size: 0.75rem;
    color: #64748b;
    display: flex;
    justify-content: space-between;
}

.action-bar {
    display: flex;
    justify-content: space-between;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--glass-border);
}

/* Alert */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    display: none;
    font-weight: 500;
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
    min-width: 250px;
    text-align: center;
    backdrop-filter: blur(10px);
}

.alert.success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.2);
    color: #4ade80;
    display: block;
}

.alert.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #f87171;
    display: block;
}

/* Loading overlays / spinners within dashboard */
.loading-overlay {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

/* Telegram-like Media Grid */
.tg-media-container.single {
    display: block;
    width: 100%;
    margin-bottom: 0.75rem;
}

.tg-media-container.multiple {
    display: grid;
    gap: 2px;
    margin-bottom: 0.75rem;
    border-radius: 8px;
    overflow: hidden;
}

.tg-media-container.single .tg-media-item,
.tg-media-container.single .tg-video-wrapper {
    width: 100%;
    max-height: 400px;
    object-fit: cover;
}

.tg-video-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    width: 100%;
    height: 100%;
}

.tg-video-wrapper video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tg-video-wrapper::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
    background: rgba(0, 0, 0, 0.4);
    border: 2px solid #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 5;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M8 5v14l11-7z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 20px;
    backdrop-filter: blur(2px);
    transition: opacity 0.2s, background-image 0.2s;
}

/* Hide play icon when video is playing */
.tg-video-wrapper.playing::after {
    opacity: 0;
}

/* Show pause icon on hover when playing */
.tg-video-wrapper.playing:hover::after {
    opacity: 1;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M6 19h4V5H6v14zm8-14v14h4V5h-4z'/%3E%3C/svg%3E");
}

.tg-phone-frame .tg-video-wrapper::after {
    width: 34px;
    height: 34px;
    background-size: 16px;
}

.tg-media-container.multiple {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-auto-rows: 150px;
    gap: 2px;
}

.tg-media-container.multiple .tg-media-item,
.tg-media-container.multiple .tg-video-wrapper {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 2 items: 3+3 (50/50) */
.tg-media-container.count-2 {
    grid-template-rows: 200px;
}

.tg-media-container.count-2>*:nth-child(n) {
    grid-column: span 3;
}

/* 3 items: 1 top (100%), 2 bottom (50/50) */
.tg-media-container.count-3 {
    grid-template-rows: 180px 140px;
}

.tg-media-container.count-3>*:nth-child(1) {
    grid-column: span 6;
}

.tg-media-container.count-3>*:nth-child(n+2) {
    grid-column: span 3;
}

/* 4 items: 2x2 grid */
.tg-media-container.count-4 {
    grid-template-rows: 140px 140px;
}

.tg-media-container.count-4>*:nth-child(n) {
    grid-column: span 3;
}

/* 5 items: 1 top (full), 1 mid (full), 3 bottom (1/3 each) - User Request */
.tg-media-container.count-5 {
    grid-template-rows: 180px 180px 100px;
}

.tg-media-container.count-5>*:nth-child(1),
.tg-media-container.count-5>*:nth-child(2) {
    grid-column: span 6;
}

.tg-media-container.count-5>*:nth-child(n+3) {
    grid-column: span 2;
}

/* 6 items: 3x2 grid */
.tg-media-container.count-6 {
    grid-template-rows: 120px 120px;
}

.tg-media-container.count-6>*:nth-child(n) {
    grid-column: span 2;
}

/* 7 items: 3 + 2 + 2 */
.tg-media-container.count-7 {
    grid-template-rows: 100px 120px 120px;
}

.tg-media-container.count-7>*:nth-child(1),
.tg-media-container.count-7>*:nth-child(2),
.tg-media-container.count-7>*:nth-child(3) {
    grid-column: span 2;
}

.tg-media-container.count-7>*:nth-child(n+4) {
    grid-column: span 3;
}

/* 8 items: 3 + 3 + 2 */
.tg-media-container.count-8 {
    grid-template-rows: 100px 100px 120px;
}

.tg-media-container.count-8>*:nth-child(1),
.tg-media-container.count-8>*:nth-child(2),
.tg-media-container.count-8>*:nth-child(3),
.tg-media-container.count-8>*:nth-child(4),
.tg-media-container.count-8>*:nth-child(5),
.tg-media-container.count-8>*:nth-child(6) {
    grid-column: span 2;
}

.tg-media-container.count-8>*:nth-child(n+7) {
    grid-column: span 3;
}

/* 9 items: 3x3 grid */
.tg-media-container.count-9 {
    grid-template-rows: repeat(3, 100px);
}

.tg-media-container.count-9>*:nth-child(n) {
    grid-column: span 2;
}

/* 10 items: 2 + 3 + 3 + 2? Or just 3 rows. 3+4+3. */
.tg-media-container.count-10 {
    grid-template-rows: 100px 100px 100px 100px;
}

.tg-media-container.count-10>*:nth-child(n) {
    grid-column: span 2;
}

.tg-media-container.count-10>*:nth-child(1),
.tg-media-container.count-10>*:nth-child(2) {
    grid-column: span 3;
}

.tg-media-container.count-10>*:nth-child(n+9) {
    grid-column: span 3;
}

/* Fallback for others */
.tg-media-container.multiple:not(.count-2):not(.count-3):not(.count-4):not(.count-5):not(.count-6):not(.count-7):not(.count-8):not(.count-9):not(.count-10) {
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 100px;
}


/* Quote Styling */
.tg-message-text blockquote,
.queue-card-editor blockquote {
    margin: 8px 0;
    padding: 6px 0 6px 14px;
    border-left: 3px solid #e1306c;
    /* Magenta/Pink like in screenshot */
    background: rgba(225, 48, 108, 0.05);
    border-radius: 2px 4px 4px 2px;
    color: #000;
    position: relative;
    overflow: hidden;
    line-height: 1.5;
}

.tg-message-text blockquote::before,
.queue-card-editor blockquote::before {
    content: '”';
    position: absolute;
    right: 4px;
    top: -10px;
    font-size: 40px;
    color: #3b82f6;
    font-family: serif;
    pointer-events: none;
}

.tg-media-item.video-placeholder {
    background: #1e293b;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

/* ===== Telegram Phone Preview ===== */
.tg-phone-frame {
    width: 360px;
    background: #0e1621;
    border-radius: 32px;
    border: 3px solid #2a3444;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
    overflow: hidden;
    position: relative;
    margin: 0 auto;
}

.tg-phone-notch {
    height: 28px;
    background: #0e1621;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.tg-phone-notch::after {
    content: '';
    width: 60px;
    height: 4px;
    background: #2a3444;
    border-radius: 4px;
}

.tg-channel-header {
    background: #17212b;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.tg-channel-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    overflow: hidden;
    /* Added to ensure image doesn't bleed out */
}

.tg-channel-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tg-channel-info {
    overflow: hidden;
}

.tg-channel-name {
    font-size: 14px;
    font-weight: 600;
    color: #e1e8ef;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tg-channel-subs {
    font-size: 11px;
    color: #6d7f8f;
}

.tg-chat-bg {
    background-image: url("/img/pattern.svg"), linear-gradient(135deg, #e8f9b9 0%, #6aac91 100%);
    background-size: 350px, cover;
    background-position: center;
    background-repeat: repeat, no-repeat;
    background-blend-mode: soft-light, normal;
    padding: 14px 12px;
    min-height: 160px;
}

/* Telegram Message Layout */
.tg-message-wrap {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin-bottom: 4px;
    position: relative;
    max-width: 95%;
}

.tg-message-bubble {
    background: #ffffff;
    border-radius: 12px 12px 12px 4px;
    /* Native Telegram non-tail radius */
    padding: 2px 10px;
    max-width: 100%;
    position: relative;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    /* Ensure square media matches rounded corners */
}

.tg-message-author {
    color: #2481cc;
    font-weight: 500;
    font-size: 14.5px;
    padding: 4px 0 2px 0;
}

.tg-message-bubble .tg-media-container {
    margin: 4px -10px;
    width: calc(100% + 20px);
    /* Explicitly counteract the parent padding */
    border-radius: 0;
}

.tg-message-bubble .tg-media-container .tg-media-item {
    border-radius: 0;
    width: 100%;
    display: block;
}

.tg-message-text {
    padding: 4px 2px 6px 2px;
    font-size: 14px;
    line-height: 1.45;
    word-break: break-word;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #000000;
}

.tg-message-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 6px;
    margin-top: 0;
    padding-bottom: 4px;
    font-size: 11px;
    color: #707579;
}

.tg-message-footer .tg-views svg {
    width: 13px;
    height: 13px;
    margin-right: 2px;
    vertical-align: -2px;
    stroke: #707579;
}

.tg-message-text a {
    color: #6ab3f3;
    text-decoration: none;
}

/* Code overrides link */
.tg-message-text code a,
.tg-message-text a code {
    color: inherit;
    text-decoration: none;
}

.tg-message-text b,
.tg-message-text strong {
    font-weight: 700;
    color: #000;
}

.tg-message-time {
    display: flex;
    justify-content: flex-end;
    padding: 2px 10px 6px;
    font-size: 11px;
    color: #707579;
}

.tg-message-time .tg-views {
    margin-right: 6px;
}

.tg-phone-bottom {
    height: 24px;
    background: #0e1621;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tg-phone-bottom::after {
    content: '';
    width: 100px;
    height: 4px;
    background: #3a4a5a;
    border-radius: 4px;
}

/* Queue card wrapper */
.queue-card {
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    position: relative;
}

.ai-processing-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.queue-card-preview {
    flex-shrink: 0;
}

.queue-card-controls {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-width: 0;
}

.queue-card-controls .queue-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.queue-card-controls .queue-actions button {
    flex: 1;
    min-width: 100px;
}

.queue-card-editor {
    width: 100%;
    min-height: 200px;
    background: #1e293b;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 12px;
    color: var(--text-main);
    font-size: 0.9rem;
    line-height: 1.5;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    outline: none;
    transition: border-color 0.2s;
    overflow-y: auto;
}

.queue-card-editor:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.queue-card-editor a {
    color: #6ab3f3;
    text-decoration: none;
}

.queue-card-editor code a,
.queue-card-editor a code {
    color: inherit;
    text-decoration: none;
}

.queue-source-info {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Responsive: stack on smaller screens */
@media (max-width: 900px) {
    .queue-card {
        flex-direction: column;
        align-items: center;
    }
}

/* ===== Formatting Toolbar ===== */
.editor-toolbar {
    display: flex;
    gap: 2px;
    padding: 6px 8px;
    background: #151f2e;
    border: 1px solid var(--glass-border);
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    flex-wrap: wrap;
}

.editor-toolbar+.queue-card-editor,
.editor-toolbar+.link-input-panel+.queue-card-editor {
    border-radius: 0 0 8px 8px;
}

.link-input-panel {
    display: flex;
    gap: 6px;
    padding: 8px 10px;
    background: #1a2536;
    border: 1px solid var(--glass-border);
    border-top: none;
    border-bottom: none;
    align-items: center;
}

.link-input-panel input {
    flex: 1;
    background: #0e1621;
    border: 1px solid rgba(59, 130, 246, 0.4);
    border-radius: 6px;
    padding: 6px 10px;
    color: #e1e8ef;
    font-size: 13px;
    outline: none;
    font-family: 'Inter', sans-serif;
}

.link-input-panel input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.link-input-panel button {
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #7cb3f4;
    padding: 5px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.15s;
    height: auto;
    width: auto;
}

.link-input-panel button:hover {
    background: rgba(59, 130, 246, 0.35);
}

.link-input-panel .link-remove-btn {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
    color: #f87171;
}

.link-input-panel .link-remove-btn:hover {
    background: rgba(239, 68, 68, 0.3);
}

.editor-toolbar button {
    background: transparent;
    border: 1px solid transparent;
    color: #8899aa;
    width: 32px;
    height: 30px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    font-weight: 400;
    font-family: 'Inter', sans-serif;
}

.editor-toolbar button:hover {
    background: rgba(59, 130, 246, 0.15);
    color: #aabbcc;
    border-color: rgba(59, 130, 246, 0.3);
}

.editor-toolbar button:active {
    background: rgba(59, 130, 246, 0.3);
}

.editor-toolbar button.active {
    background: rgba(59, 130, 246, 0.25);
    color: #7cb3f4;
    border-color: rgba(59, 130, 246, 0.4);
}

.editor-toolbar .tb-plain {
    font-size: 11px;
    width: auto;
    padding: 0 8px;
    letter-spacing: 0.3px;
}

.editor-toolbar .tb-sep {
    width: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 2px 4px;
    border: none;
}

/* Telegram Spoiler in preview and editor */
.tg-spoiler,
tg-spoiler {
    background: #c7ced3;
    color: transparent;
    border-radius: 4px;
    padding: 0 3px;
    cursor: pointer;
    transition: all 0.3s;
    user-select: none;
}

.tg-spoiler:hover,
tg-spoiler:hover,
.tg-spoiler.revealed,
tg-spoiler.revealed {
    color: inherit;
    background: rgba(59, 130, 246, 0.15);
}

/* In editor, always show spoiler text */
.queue-card-editor .tg-spoiler,
.queue-card-editor tg-spoiler {
    color: #e1e8ef;
    background: rgba(100, 100, 100, 0.3);
    border: 1px dashed rgba(255, 255, 255, 0.2);
}

/* Telegram Blockquote */
.tg-blockquote,
blockquote {
    border-left: 3px solid #3b82f6;
    padding: 4px 10px;
    margin: 6px 0;
    background: rgba(59, 130, 246, 0.08);
    border-radius: 0 4px 4px 0;
    font-style: normal;
}

.tg-message-text blockquote,
.queue-card-editor blockquote {
    border-left: 3px solid #3b82f6;
    padding: 4px 10px;
    margin: 6px 0;
    background: rgba(59, 130, 246, 0.08);
    border-radius: 0 4px 4px 0;
}

/* Monospace / Code */
.tg-message-text code,
.queue-card-editor code {
    background: rgba(0, 0, 0, 0.05);
    padding: 1px 5px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

/* Underline */
.tg-message-text u,
.queue-card-editor u {
    text-decoration: underline;
}

/* Strikethrough */
.tg-message-text s,
.tg-message-text strike,
.tg-message-text del,
.queue-card-editor s,
.queue-card-editor strike,
.queue-card-editor del {
    text-decoration: line-through;
}

/* Source Posts Grid */
.source-posts-grid {
    column-count: 1;
    column-gap: 1.5rem;
    margin-top: 1rem;
}

.source-posts-grid>* {
    break-inside: avoid;
    margin-bottom: 1.5rem;
    display: inline-block;
    width: 100%;
}

@media (min-width: 768px) {
    .source-posts-grid {
        column-count: 2;
    }
}

@media (min-width: 1200px) {
    .source-posts-grid {
        column-count: 3;
    }
}

/* Floating Action Bar */
.floating-action-bar {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem 2rem;
    border-radius: 999px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.selectable-card {
    position: relative;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}



.selectable-card.selected {
    box-shadow: 0 0 0 2px var(--primary);
}

.selection-checkbox {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: rgba(15, 23, 42, 0.8);
    z-index: 10;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.selectable-card.selected .selection-checkbox {
    background: var(--primary);
    border-color: var(--primary);
}

.selectable-card.selected .selection-checkbox::after {
    content: "✓";
    color: white;
    font-size: 14px;
    font-weight: bold;
}

/* Notification System */
.notification-wrapper {
    position: relative;
    margin-right: 0.5rem;
}

.notification-bell {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.notification-bell:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border-color: rgba(59, 130, 246, 0.4);
}

.bell-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: bold;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #0f172a;
    padding: 0 4px;
}

.nav-badge {
    background: var(--primary);
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 0.5rem;
    font-weight: bold;
}

.notification-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 320px;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: none;
    overflow: hidden;
}

.notification-dropdown.active {
    display: block;
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.notification-header {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
}

.btn-text {
    background: transparent;
    border: none;
    color: var(--primary);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}

.btn-text:hover {
    background: rgba(59, 130, 246, 0.1);
}

.notification-list {
    max-height: 400px;
    overflow-y: auto;
}

.notification-item {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.2s;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.notification-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.notification-item.unread {
    background: rgba(59, 130, 246, 0.05);
}

.notification-item.unread:hover {
    background: rgba(59, 130, 246, 0.08);
}

.notification-msg {
    font-size: 0.85rem;
    line-height: 1.4;
    color: var(--text-main);
}

.notification-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.notification-empty {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Transaction Table */
.transaction-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.transaction-table th {
    text-align: left;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.transaction-table td {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.transaction-table tr:last-child td {
    border-bottom: none;
}

.transaction-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.transaction-amount {
    font-family: 'Inter', monospace;
    font-weight: 700;
}

.amount-plus {
    color: #10b981;
}

.amount-minus {
    color: #ef4444;
}

.transaction-type-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-topup {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.badge-deduction {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}