/* ===== ADMIN DASHBOARD CSS (HIGH CONTRAST & PREMIUM DARK SLATE) ===== */

:root {
    --bg-primary: #0a0f1d;
    --bg-secondary: #0f172a;
    --bg-card: #162033;
    --bg-card-elevated: #1e293b;
    --bg-card-hover: #233149;
    --border-color: rgba(148, 163, 184, 0.2);
    --border-bright: rgba(148, 163, 184, 0.35);
    
    --text-primary: #ffffff;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    
    --accent-green: #10b981;
    --accent-green-bright: #34d399;
    --accent-green-dim: rgba(16, 185, 129, 0.18);
    
    --accent-gold: #f59e0b;
    --accent-gold-bright: #fbbf24;
    --accent-gold-dim: rgba(245, 158, 11, 0.18);
    
    --accent-blue: #3b82f6;
    --accent-blue-bright: #60a5fa;
    --accent-blue-dim: rgba(59, 130, 246, 0.18);
    
    --accent-red: #f43f5e;
    --accent-red-bright: #fb7185;
    --accent-red-dim: rgba(244, 63, 94, 0.18);
    
    --accent-purple: #8b5cf6;
    --accent-purple-dim: rgba(139, 92, 246, 0.18);
    
    --sidebar-width: 250px;
    --radius: 14px;
    --radius-sm: 8px;
    --shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(148, 163, 184, 0.12);
}

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

body {
    font-family: 'Be Vietnam Pro', 'Inter', 'Outfit', -apple-system, sans-serif;
    background: radial-gradient(circle at 50% 0%, #151e33 0%, #0b1120 50%, #060912 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== RUNE & COIN ICONS ===== */
.rune-icon {
    width: 20px;
    height: 20px;
    vertical-align: middle;
    fill: currentColor;
}
.rune-inline {
    width: 16px;
    height: 16px;
    vertical-align: -2px;
    fill: currentColor;
    display: inline-block;
}
.coin-icon {
    display: inline-block;
    vertical-align: -2px;
    filter: drop-shadow(0 0 5px rgba(251, 191, 36, 0.4));
}

/* ===== LOADING ===== */
.admin-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    gap: 16px;
    color: var(--text-secondary);
}
.admin-loading-spinner {
    width: 44px; height: 44px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-green-bright);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== ACCESS DENIED ===== */
.access-denied {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
}
.denied-card {
    text-align: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 48px 40px;
    box-shadow: var(--shadow);
}
.denied-icon { font-size: 64px; display: block; margin-bottom: 16px; }
.denied-card h2 { color: var(--accent-red-bright); margin-bottom: 8px; font-family: 'Outfit', sans-serif; }
.denied-card p { color: var(--text-secondary); margin-bottom: 24px; }
.denied-link {
    color: var(--accent-green-bright);
    text-decoration: none;
    font-weight: 700;
    transition: opacity 0.2s;
}
.denied-link:hover { opacity: 0.8; }

/* ===== LAYOUT ===== */
.admin-app {
    display: flex;
    min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.admin-sidebar {
    width: var(--sidebar-width);
    background: #0d1424;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
}
.sidebar-brand {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.2);
}
.brand-star {
    font-size: 28px;
    background: linear-gradient(135deg, #10b981, #06b6d4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: starPulse 3s ease-in-out infinite;
}
@keyframes starPulse {
    0%,100% { opacity:1; transform:scale(1); }
    50% { opacity:0.7; transform:scale(1.1); }
}
.brand-text {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 15px;
    letter-spacing: 2px;
    line-height: 1.2;
    background: linear-gradient(135deg, #34d399, #38bdf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    border: 1px solid transparent;
}
.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff;
    border-color: rgba(148, 163, 184, 0.15);
    transform: translateX(2px);
}
.nav-item.active {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(6, 182, 212, 0.12));
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.35);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.12);
}
.nav-icon { 
    font-size: 18px; 
    display: flex;
    align-items: center;
    justify-content: center;
}
.nav-badge {
    position: absolute;
    right: 12px;
    background: var(--accent-red);
    color: white;
    font-size: 11px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 12px;
    min-width: 20px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(244, 63, 94, 0.4);
}

.sidebar-footer {
    padding: 14px 10px;
    border-top: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.2);
}
.admin-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    margin-bottom: 6px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(148, 163, 184, 0.1);
}
.admin-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    border: 2px solid var(--accent-green-bright);
    object-fit: cover;
}
.admin-name {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sidebar-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* ===== MAIN CONTENT ===== */
.admin-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 28px 36px;
    max-width: calc(100vw - var(--sidebar-width));
}

/* ===== HEADER ===== */
.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}
.admin-header h1 {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 30px;
    color: #ffffff;
    letter-spacing: -0.5px;
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}
.search-box {
    position: relative;
    display: flex;
    align-items: center;
}
.search-icon {
    position: absolute;
    left: 14px;
    font-size: 14px;
    color: var(--text-muted);
    pointer-events: none;
}
.search-box input {
    background: var(--bg-card);
    border: 1px solid var(--border-bright);
    border-radius: var(--radius-sm);
    padding: 10px 14px 10px 38px;
    color: #ffffff;
    font-size: 13.5px;
    font-weight: 500;
    width: 250px;
    outline: none;
    transition: all 0.2s ease;
}
.search-box input:focus {
    border-color: var(--accent-green-bright);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
    background: var(--bg-card-elevated);
}
.search-box input::placeholder {
    color: var(--text-muted);
}
.filter-select {
    background: var(--bg-card);
    border: 1px solid var(--border-bright);
    border-radius: var(--radius-sm);
    padding: 10px 16px;
    color: #ffffff;
    font-size: 13.5px;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    transition: all 0.2s ease;
}
.filter-select:focus {
    border-color: var(--accent-green-bright);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
}
.filter-select option {
    background: var(--bg-secondary);
    color: #ffffff;
}

/* ===== STATS GRID ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 22px;
    display: flex;
    align-items: center;
    gap: 18px;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.stat-card:hover {
    transform: translateY(-3px);
    border-color: var(--border-bright);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}
.stat-icon {
    font-size: 30px;
    width: 58px; height: 58px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
}
.stat-card.accent-green .stat-icon { 
    background: var(--accent-green-dim); 
    border-color: rgba(16, 185, 129, 0.3);
}
.stat-card.accent-gold .stat-icon { 
    background: var(--accent-gold-dim); 
    border-color: rgba(245, 158, 11, 0.3);
}
.stat-card.accent-blue .stat-icon { 
    background: var(--accent-blue-dim); 
    border-color: rgba(59, 130, 246, 0.3);
}

.stat-info { display: flex; flex-direction: column; }
.stat-value {
    font-family: 'Outfit', sans-serif;
    font-size: 32px;
    font-weight: 800;
    line-height: 1;
    color: #ffffff;
}
.stat-card.accent-green .stat-value { color: var(--accent-green-bright); }
.stat-card.accent-gold .stat-value { color: var(--accent-gold-bright); }
.stat-card.accent-blue .stat-value { color: var(--accent-blue-bright); }

.stat-label {
    font-size: 13.5px;
    color: var(--text-secondary);
    font-weight: 600;
    margin-top: 6px;
}

/* ===== SOURCE BREAKDOWN CARDS ===== */
.source-breakdown-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 22px 24px;
    margin-bottom: 28px;
    box-shadow: var(--shadow);
}
.source-breakdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}
.source-breakdown-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 10px;
}
.source-total-badge {
    background: rgba(148, 163, 184, 0.16);
    border: 1px solid var(--border-bright);
    color: #cbd5e1;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 12px;
}
.source-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
}
.source-stat-item {
    background: var(--bg-card-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.source-stat-item:hover {
    transform: translateY(-2px);
    border-color: var(--border-bright);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}
.source-stat-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
.source-stat-icon {
    font-size: 18px;
    display: flex;
    align-items: center;
}
.source-stat-name {
    font-size: 13.5px;
    font-weight: 700;
    color: #ffffff;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.source-stat-count {
    font-family: 'Outfit', sans-serif;
    font-size: 16px;
    font-weight: 800;
    color: var(--accent-green-bright);
}
.source-stat-bar-bg {
    width: 100%;
    height: 5px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    overflow: hidden;
}
.source-stat-bar-fill {
    height: 100%;
    background: var(--accent-green-bright);
    border-radius: 3px;
    transition: width 0.4s ease;
}
.source-stat-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11.5px;
    color: var(--text-muted);
}
.source-stat-pct {
    font-weight: 700;
    color: var(--text-secondary);
}
.source-stat-hint {
    color: var(--accent-green-bright);
    opacity: 0;
    transition: opacity 0.2s ease;
    font-weight: 600;
}
.source-stat-item:hover .source-stat-hint {
    opacity: 1;
}

/* Individual Source Colors */
.source-stat-item.tiktok .source-stat-bar-fill { background: #00f2fe; }
.source-stat-item.tiktok:hover { border-color: rgba(0, 242, 254, 0.4); }

.source-stat-item.facebook .source-stat-bar-fill { background: #1877f2; }
.source-stat-item.facebook:hover { border-color: rgba(24, 119, 242, 0.4); }

.source-stat-item.youtube .source-stat-bar-fill { background: #ff4b4b; }
.source-stat-item.youtube:hover { border-color: rgba(255, 75, 75, 0.4); }

.source-stat-item.zalo .source-stat-bar-fill { background: #0068ff; }
.source-stat-item.zalo:hover { border-color: rgba(0, 104, 255, 0.4); }

.source-stat-item.threads .source-stat-bar-fill { background: #d946ef; }
.source-stat-item.threads:hover { border-color: rgba(217, 70, 239, 0.4); }

.source-stat-item.google .source-stat-bar-fill { background: #fbbf24; }
.source-stat-item.google:hover { border-color: rgba(251, 191, 36, 0.4); }

.source-stat-item.direct .source-stat-bar-fill { background: #94a3b8; }

/* ===== QUICK ACTIONS ===== */
.quick-actions {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px 24px;
    box-shadow: var(--shadow);
}
.quick-actions h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.action-grid {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}
.action-btn {
    background: var(--bg-card-elevated);
    border: 1px solid var(--border-bright);
    border-radius: var(--radius-sm);
    padding: 12px 22px;
    color: #ffffff;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}
.action-btn:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-green-bright);
    color: var(--accent-green-bright);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.2);
}
.action-btn.pulse {
    animation: btnPulse 1s ease;
    border-color: var(--accent-green-bright);
}
@keyframes btnPulse {
    0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6); }
    50% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
    100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

/* Live indicator */
.live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--accent-green-bright);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.live-dot {
    width: 8px; height: 8px;
    background: var(--accent-green-bright);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--accent-green-bright);
    animation: liveBlink 2s ease-in-out infinite;
}
@keyframes liveBlink {
    0%,100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ===== BULK ACTIONS BAR ===== */
.bulk-actions-bar {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 14px 20px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    box-shadow: var(--shadow);
    transition: all 0.25s ease;
}

.bulk-actions-bar.active {
    border-color: rgba(16, 185, 129, 0.4);
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.08), rgba(15, 23, 42, 0.95));
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 20px rgba(16, 185, 129, 0.15);
}

.bulk-selection-info {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.bulk-select-all-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    font-weight: 700;
    color: #ffffff;
    cursor: pointer;
    user-select: none;
}

.bulk-counter-pill {
    font-size: 12.5px;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    padding: 4px 12px;
    border-radius: 20px;
}

.bulk-counter-pill strong {
    color: var(--accent-green-bright);
    font-weight: 800;
}

.bulk-action-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.bulk-btn {
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
}

.bulk-btn:hover {
    transform: translateY(-1px);
}

.bulk-btn.ghost {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--text-muted);
}
.bulk-btn.ghost:hover {
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.3);
}

.bulk-btn.upgrade {
    background: rgba(234, 179, 8, 0.15);
    border-color: rgba(234, 179, 8, 0.4);
    color: #facc15;
}
.bulk-btn.upgrade:hover {
    background: #facc15;
    color: #451a03;
    box-shadow: 0 4px 14px rgba(234, 179, 8, 0.3);
}

.bulk-btn.trial {
    background: rgba(56, 189, 248, 0.15);
    border-color: rgba(56, 189, 248, 0.4);
    color: #38bdf8;
}
.bulk-btn.trial:hover {
    background: #38bdf8;
    color: #0c4a6e;
    box-shadow: 0 4px 14px rgba(56, 189, 248, 0.3);
}

.bulk-btn.reward {
    background: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.4);
    color: #34d399;
}
.bulk-btn.reward:hover {
    background: #10b981;
    color: #042f2e;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.3);
}

.bulk-btn.broadcast {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.4);
    color: #a78bfa;
}
.bulk-btn.broadcast:hover {
    background: #8b5cf6;
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(139, 92, 246, 0.3);
}

.bulk-btn.disable {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.4);
    color: #fbbf24;
}
.bulk-btn.disable:hover {
    background: #f59e0b;
    color: #451a03;
}

.bulk-btn.enable {
    background: rgba(34, 197, 94, 0.15);
    border-color: rgba(34, 197, 94, 0.4);
    color: #4ade80;
}
.bulk-btn.enable:hover {
    background: #22c55e;
    color: #052e16;
}

.bulk-btn.export {
    background: rgba(100, 116, 139, 0.15);
    border-color: rgba(100, 116, 139, 0.35);
    color: #94a3b8;
}
.bulk-btn.export:hover {
    background: #64748b;
    color: #ffffff;
}

.bulk-btn.danger {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
    color: #f87171;
}
.bulk-btn.danger:hover {
    background: #ef4444;
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.3);
}

/* Custom Checkbox */
.admin-custom-chk {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(148, 163, 184, 0.4);
    border-radius: 5px;
    background: rgba(15, 23, 42, 0.6);
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    vertical-align: middle;
    outline: none;
    display: inline-block;
}

.admin-custom-chk:checked {
    background: #10b981;
    border-color: #10b981;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

.admin-custom-chk:checked::after {
    content: '✔';
    font-size: 11px;
    color: #042f2e;
    font-weight: 900;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -52%);
}

.admin-custom-chk:indeterminate {
    background: #10b981;
    border-color: #10b981;
}

.admin-custom-chk:indeterminate::after {
    content: '';
    width: 8px;
    height: 2.5px;
    background: #042f2e;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 1px;
}

.user-table tr.selected-row td {
    background: rgba(16, 185, 129, 0.08) !important;
    border-bottom-color: rgba(16, 185, 129, 0.25);
}

/* ===== TABLE ===== */
.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}
.user-table {
    width: 100%;
    border-collapse: collapse;
}
.user-table th {
    background: #111a2e;
    padding: 14px 18px;
    font-size: 12.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #cbd5e1;
    text-align: left;
    border-bottom: 1px solid var(--border-bright);
}
.user-table td {
    padding: 14px 18px;
    font-size: 13.5px;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
    vertical-align: middle;
}
.user-table tr:last-child td { border-bottom: none; }
.user-table tr:hover td {
    background: rgba(255, 255, 255, 0.04);
}

/* User cell */
.user-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}
.user-cell img {
    width: 34px; height: 34px;
    border-radius: 50%;
    border: 2px solid rgba(148, 163, 184, 0.3);
    object-fit: cover;
}
.user-cell-name {
    font-weight: 700;
    color: #ffffff;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Plan badges */
.plan-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.plan-badge.premium {
    background: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
    border: 1px solid rgba(245, 158, 11, 0.5);
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.15);
}
.plan-badge.trial {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.5);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
}
.plan-badge.free {
    background: rgba(148, 163, 184, 0.16);
    color: #e2e8f0;
    border: 1px solid rgba(148, 163, 184, 0.3);
}

/* Status badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 700;
}
.status-badge.active {
    background: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.45);
}
.status-badge.disabled {
    background: rgba(244, 63, 94, 0.2);
    color: #fda4af;
    border: 1px solid rgba(244, 63, 94, 0.45);
}
.status-badge.expired {
    background: rgba(245, 158, 11, 0.2);
    color: #fde68a;
    border: 1px solid rgba(245, 158, 11, 0.45);
}

/* ===== SOURCE BADGES ===== */
.source-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 14px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.2px;
    white-space: nowrap;
}
.source-badge.tiktok {
    background: rgba(0, 242, 254, 0.12);
    color: #38bdf8;
    border: 1px solid rgba(0, 242, 254, 0.35);
}
.source-badge.facebook {
    background: rgba(24, 119, 242, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(24, 119, 242, 0.4);
}
.source-badge.youtube {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.4);
}
.source-badge.zalo {
    background: rgba(0, 104, 255, 0.15);
    color: #7dd3fc;
    border: 1px solid rgba(0, 104, 255, 0.4);
}
.source-badge.threads, .source-badge.instagram {
    background: rgba(217, 70, 239, 0.15);
    color: #f0abfc;
    border: 1px solid rgba(217, 70, 239, 0.4);
}
.source-badge.google {
    background: rgba(245, 158, 11, 0.15);
    color: #fcd34d;
    border: 1px solid rgba(245, 158, 11, 0.4);
}
.source-badge.twitter {
    background: rgba(14, 165, 233, 0.15);
    color: #7dd3fc;
    border: 1px solid rgba(14, 165, 233, 0.4);
}
.source-badge.telegram {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.4);
}
.source-badge.direct {
    background: rgba(148, 163, 184, 0.12);
    color: #cbd5e1;
    border: 1px solid rgba(148, 163, 184, 0.25);
}
.source-badge.other {
    background: rgba(168, 85, 247, 0.12);
    color: #d8b4fe;
    border: 1px solid rgba(168, 85, 247, 0.35);
}

.detail-item.full-width {
    grid-column: span 2;
}
.detail-link-text {
    font-size: 13px;
    word-break: break-all;
}

/* Action buttons */
.btn-sm {
    background: var(--bg-card-elevated);
    border: 1px solid var(--border-bright);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    color: #ffffff;
    font-weight: 600;
    transition: all 0.2s ease;
    margin-right: 4px;
}
.btn-sm:hover {
    border-color: var(--accent-green-bright);
    color: var(--accent-green-bright);
    background: var(--accent-green-dim);
    transform: translateY(-1px);
}
.btn-sm.danger:hover {
    border-color: var(--accent-red-bright);
    color: var(--accent-red-bright);
    background: var(--accent-red-dim);
    transform: translateY(-1px);
}
.btn-sm.upgrade {
    border-color: rgba(245, 158, 11, 0.5);
    color: #fbbf24;
    background: rgba(245, 158, 11, 0.12);
}
.btn-sm.upgrade:hover {
    background: var(--accent-gold-dim);
    border-color: #fbbf24;
    transform: translateY(-1px);
}

/* Table empty state */
.table-empty {
    text-align: center;
    padding: 56px 20px;
    color: var(--text-muted);
}
.table-empty span { font-size: 44px; display: block; margin-bottom: 14px; }
.table-empty p { font-size: 15px; color: var(--text-secondary); font-weight: 600; }

/* ===== PENDING SECTION ===== */
.pending-info {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 18px;
    box-shadow: var(--shadow);
}
.pending-info h3 { 
    font-family: 'Outfit', sans-serif; 
    font-size: 18px;
    color: #ffffff;
    margin-bottom: 6px; 
}
.pending-info p { 
    color: var(--text-secondary); 
    font-size: 13.5px; 
}

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }

.modal-card {
    background: #0f172a;
    border: 1px solid var(--border-bright);
    border-radius: var(--radius);
    width: 560px;
    max-width: 92vw;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(148, 163, 184, 0.2);
    animation: slideUp 0.3s ease;
}
@keyframes slideUp { from { transform:translateY(20px); opacity:0; } to { transform:translateY(0); opacity:1; } }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 26px;
    border-bottom: 1px solid var(--border-color);
    background: #141e34;
}
.modal-header h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 20px;
    font-weight: 800;
    color: #ffffff;
}
.modal-close {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 8px;
    transition: all 0.15s;
}
.modal-close:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.modal-body {
    padding: 26px;
}
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    background: #162033;
    padding: 18px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}
.detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.detail-item label {
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}
.detail-item span {
    font-size: 14.5px;
    font-weight: 600;
    color: #ffffff;
}
.detail-item .mono {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    color: var(--accent-blue-bright);
    word-break: break-all;
}

.modal-actions {
    padding: 18px 26px;
    border-top: 1px solid var(--border-color);
    background: #141e34;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.plan-select {
    background: #111827;
    border: 1px solid var(--border-bright);
    border-radius: 8px;
    padding: 10px 14px;
    color: #ffffff;
    font-size: 13.5px;
    font-weight: 600;
    outline: none;
    cursor: pointer;
}
.plan-select option {
    background: #111827;
    color: #ffffff;
}
.btn-action {
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}
.btn-action.save {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}
.btn-action.save:hover { 
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(16, 185, 129, 0.45);
}
.btn-action.toggle {
    background: rgba(244, 63, 94, 0.15);
    border: 1px solid rgba(244, 63, 94, 0.5);
    color: #fda4af;
}
.btn-action.toggle:hover {
    background: var(--accent-red);
    color: #ffffff;
}

/* Delete button in modal */
.btn-action.delete {
    background: rgba(244, 63, 94, 0.15);
    border: 1px solid rgba(244, 63, 94, 0.5);
    color: #fda4af;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}
.btn-action.delete:hover {
    background: var(--accent-red);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(244, 63, 94, 0.4);
}
.modal-actions-spacer {
    flex: 1;
}

/* Cancel button */
.btn-action.cancel {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-bright);
    color: var(--text-secondary);
}
.btn-action.cancel:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

/* Confirm delete button */
.btn-action.confirm-delete {
    background: var(--accent-red);
    color: #fff;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}
.btn-action.confirm-delete:hover:not(:disabled) {
    background: #e11d48;
    box-shadow: 0 4px 16px rgba(244, 63, 94, 0.5);
    transform: translateY(-1px);
}
.btn-action.confirm-delete:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ===== DELETE CONFIRMATION MODAL ===== */
.delete-confirm-card {
    max-width: 480px;
}
.delete-header h3 {
    color: var(--accent-red-bright);
}
.delete-warning {
    text-align: center;
}
.delete-warning-icon {
    font-size: 52px;
    margin-bottom: 14px;
    animation: deleteShake 0.6s ease-in-out;
}
@keyframes deleteShake {
    0%, 100% { transform: translateX(0); }
    15% { transform: translateX(-8px); }
    30% { transform: translateX(8px); }
    45% { transform: translateX(-6px); }
    60% { transform: translateX(6px); }
    75% { transform: translateX(-3px); }
    90% { transform: translateX(3px); }
}
.delete-warning-text {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 14px;
    line-height: 1.5;
}
.delete-warning-text strong {
    color: var(--accent-red-bright);
}
.delete-user-info {
    background: rgba(244, 63, 94, 0.15);
    border: 1px solid rgba(244, 63, 94, 0.35);
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    margin-bottom: 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.delete-user-name {
    font-size: 16px;
    font-weight: 800;
    color: #ffffff;
}
.delete-user-email {
    font-size: 13.5px;
    color: #fecdd3;
    font-family: 'JetBrains Mono', monospace;
}
.delete-warning-detail {
    font-size: 13.5px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}
.delete-items-list {
    list-style: none;
    padding: 0;
    margin: 0 0 22px 0;
    text-align: left;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 8px;
    padding: 8px 14px;
}
.delete-items-list li {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 6px 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}
.delete-items-list li:last-child {
    border-bottom: none;
}
.delete-confirm-input-wrapper {
    text-align: left;
}
.delete-confirm-input-wrapper label {
    display: block;
    font-size: 13.5px;
    color: #ffffff;
    font-weight: 600;
    margin-bottom: 10px;
}
.delete-confirm-input-wrapper label strong {
    color: var(--accent-red-bright);
    font-weight: 800;
    letter-spacing: 1px;
}
.delete-confirm-input-wrapper input {
    width: 100%;
    background: #111827;
    border: 2px solid var(--border-bright);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    color: #ffffff;
    font-size: 16px;
    font-weight: 700;
    text-align: center;
    letter-spacing: 2px;
    outline: none;
    transition: border-color 0.2s;
}
.delete-confirm-input-wrapper input:focus {
    border-color: var(--accent-red-bright);
    box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.2);
}
.delete-confirm-input-wrapper input::placeholder {
    color: var(--text-muted);
    font-weight: 400;
    letter-spacing: 0;
}
.delete-actions {
    justify-content: flex-end;
    gap: 12px;
}

/* ===== QUEST MANAGEMENT ===== */
.quest-create-form {
    background: #162033;
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 16px;
    padding: 22px;
    margin-top: 18px;
    box-shadow: var(--shadow);
}
.quest-create-form h4 {
    margin: 0 0 14px;
    color: #ffffff;
    font-size: 15px;
    font-weight: 700;
}
.form-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    align-items: center;
}
.form-input {
    background: #111827;
    border: 1px solid var(--border-bright);
    color: #ffffff;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13.5px;
    font-family: 'Inter', sans-serif;
    flex: 1;
    min-width: 0;
    transition: all 0.2s ease;
}
.form-input:focus {
    border-color: rgba(139, 92, 246, 0.6);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
    outline: none;
    background: #1a2234;
}
.form-input.small {
    max-width: 130px;
    flex: 0 0 130px;
}
textarea.form-input {
    resize: none;
    width: 100%;
    box-sizing: border-box;
}

/* ===== DP GRANT ===== */
.dp-grant-section {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.35);
    border-radius: 12px;
    padding: 16px;
    margin: 12px 0;
}
.dp-grant-section h4 {
    margin: 0 0 12px;
    color: #fcd34d;
    font-size: 14px;
    font-weight: 700;
}
.dp-grant-section .form-row {
    margin-bottom: 0;
}

/* ==========================================================================
   ADMIN DIRECT MESSAGING & SUPPORT SYSTEM (HỘP THƯ CHAT ADMIN)
   ========================================================================== */

.btn-sm.chat {
    background: rgba(139, 92, 246, 0.18);
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.35);
}
.btn-sm.chat:hover {
    background: #8b5cf6;
    color: #ffffff;
    border-color: #8b5cf6;
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.5);
}

.admin-chat-layout {
    display: flex;
    gap: 0;
    height: calc(100vh - 170px);
    min-height: 600px;
    background: var(--bg-card, #0f172a);
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow, 0 12px 36px rgba(0,0,0,0.4));
}

/* Chat Sidebar */
.admin-chat-sidebar {
    width: 350px;
    min-width: 350px;
    border-right: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
    display: flex;
    flex-direction: column;
    background: rgba(15, 23, 42, 0.6);
}

.admin-chat-sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.admin-chat-search-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #111827;
    border: 1px solid var(--border-bright, rgba(255, 255, 255, 0.12));
    border-radius: 10px;
    padding: 8px 14px;
}

.admin-chat-search-icon {
    font-size: 14px;
    color: var(--text-muted);
}

.admin-chat-search-wrap input {
    background: transparent;
    border: none;
    outline: none;
    color: #ffffff;
    font-size: 13.5px;
    width: 100%;
}

.admin-chat-tabs {
    display: flex;
    gap: 6px;
    background: rgba(0, 0, 0, 0.3);
    padding: 4px;
    border-radius: 10px;
}

.admin-chat-tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-secondary, #94a3b8);
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.admin-chat-tab-btn.active {
    background: #1e293b;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.admin-tab-badge {
    background: #ef4444;
    color: #ffffff;
    font-size: 10px;
    font-weight: 800;
    padding: 1px 6px;
    border-radius: 10px;
}

.admin-chat-threads-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.admin-chat-threads-list::-webkit-scrollbar {
    width: 5px;
}
.admin-chat-threads-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.admin-thread-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.18s ease;
    border: 1px solid transparent;
}

.admin-thread-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.admin-thread-item.active {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.4);
}

.admin-thread-avatar {
    position: relative;
    width: 42px;
    height: 42px;
    flex-shrink: 0;
}

.admin-thread-avatar img,
.admin-thread-avatar .avatar-fallback {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

.admin-thread-avatar .avatar-fallback {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
}

.admin-thread-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.admin-thread-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.admin-thread-name {
    font-size: 13.5px;
    font-weight: 700;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-thread-time {
    font-size: 11px;
    color: var(--text-muted);
    font-family: var(--font-mono, monospace);
    flex-shrink: 0;
}

.admin-thread-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.admin-thread-preview {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-thread-badge {
    background: #ef4444;
    color: #ffffff;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 10px;
    flex-shrink: 0;
}

/* Chat Main Pane */
.admin-chat-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: #090d16;
}

.admin-chat-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 32px;
}

.acp-icon {
    font-size: 56px;
    margin-bottom: 16px;
    filter: drop-shadow(0 0 20px rgba(139, 92, 246, 0.4));
}

.admin-chat-placeholder h3 {
    font-family: 'Outfit', sans-serif;
    font-size: 20px;
    color: #ffffff;
    margin: 0 0 8px;
}

.admin-chat-placeholder p {
    max-width: 420px;
    font-size: 13.5px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.admin-chat-active {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

/* Chat Header */
.admin-chat-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #0f172a;
}

.admin-chat-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.admin-chat-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.admin-chat-user-meta h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-chat-user-meta p {
    margin: 2px 0 0;
    font-size: 12px;
    color: var(--text-secondary);
}

.admin-chat-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Message Stream */
.admin-messages-stream {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.admin-messages-stream::-webkit-scrollbar {
    width: 6px;
}
.admin-messages-stream::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px;
}

.admin-msg-row {
    display: flex;
    flex-direction: column;
    max-width: 72%;
    animation: fadeIn 0.15s ease;
}

.admin-msg-row.outgoing {
    align-self: flex-end;
    align-items: flex-end;
}

.admin-msg-row.incoming {
    align-self: flex-start;
    align-items: flex-start;
}

.admin-msg-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
    white-space: pre-wrap;
    position: relative;
}

.admin-msg-row.outgoing .admin-msg-bubble {
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: #ffffff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 16px rgba(139, 92, 246, 0.35);
}

.admin-msg-row.incoming .admin-msg-bubble {
    background: #1e293b;
    color: #f1f5f9;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-bottom-left-radius: 4px;
}

.admin-msg-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #ffd700;
    margin-bottom: 4px;
}

.admin-msg-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Quick Response Chips */
.admin-quick-replies {
    padding: 8px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(15, 23, 42, 0.4);
    overflow: hidden;
}

.admin-quick-replies-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.admin-quick-replies-scroll::-webkit-scrollbar {
    height: 3px;
}
.admin-quick-replies-scroll::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.admin-reply-chip {
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.admin-reply-chip:hover {
    background: rgba(139, 92, 246, 0.2);
    border-color: rgba(139, 92, 246, 0.4);
    color: #ffffff;
    transform: translateY(-1px);
}

/* Chat Input Bar */
.admin-chat-input-area {
    padding: 14px 20px;
    border-top: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
    display: flex;
    align-items: flex-end;
    gap: 12px;
    background: #0f172a;
}

.admin-message-input {
    flex: 1;
    background: #111827;
    border: 1px solid var(--border-bright, rgba(255, 255, 255, 0.12));
    border-radius: 12px;
    padding: 12px 16px;
    color: #ffffff;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    outline: none;
    resize: none;
    max-height: 120px;
    line-height: 1.4;
    transition: all 0.2s ease;
}

.admin-message-input:focus {
    border-color: rgba(139, 92, 246, 0.6);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
    background: #162033;
}

.admin-chat-send-btn {
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 14px rgba(139, 92, 246, 0.4);
    flex-shrink: 0;
}

.admin-chat-send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.6);
}

.admin-chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ==========================================================================
   FLOATING MESSAGE TOAST NOTIFICATION FOR ADMIN
   ========================================================================== */
.admin-msg-toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    max-width: 400px;
    width: calc(100vw - 48px);
}

.admin-msg-toast-card {
    pointer-events: auto;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1.5px solid rgba(139, 92, 246, 0.5);
    border-radius: 16px;
    padding: 14px 18px;
    box-shadow: 0 14px 38px rgba(0, 0, 0, 0.7), 0 0 24px rgba(139, 92, 246, 0.25);
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    animation: adminToastSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    transition: all 0.2s ease;
}

.admin-msg-toast-card:hover {
    transform: translateY(-2px) scale(1.02);
    border-color: rgba(139, 92, 246, 0.9);
    box-shadow: 0 18px 46px rgba(0, 0, 0, 0.8), 0 0 32px rgba(139, 92, 246, 0.4);
}

.admin-msg-toast-card.hide {
    animation: adminToastSlideOut 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes adminToastSlideIn {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes adminToastSlideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(120%); opacity: 0; }
}

.admin-msg-toast-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(139, 92, 246, 0.6);
    flex-shrink: 0;
}

.admin-msg-toast-avatar-fallback {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: #fff;
    font-weight: 800;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.admin-msg-toast-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.admin-msg-toast-title {
    font-size: 13px;
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.admin-msg-toast-badge {
    font-size: 10px;
    font-weight: 800;
    color: #a78bfa;
    background: rgba(139, 92, 246, 0.2);
    padding: 1px 6px;
    border-radius: 6px;
}

.admin-msg-toast-text {
    font-size: 12.5px;
    color: var(--text-secondary, #94a3b8);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

/* ==========================================================================
   MOBILE RESPONSIVE SYSTEM & COMPONENTS (TỐI ƯU GIAO DIỆN DI ĐỘNG)
   ========================================================================== */

/* Mobile Topbar (Desktop: Hidden) */
.admin-mobile-topbar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(13, 20, 36, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    padding: 0 16px;
    z-index: 950;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.mobile-nav-toggle {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    color: #ffffff;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.mobile-nav-toggle:active {
    transform: scale(0.92);
    background: rgba(255, 255, 255, 0.12);
}

.mobile-unread-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background: var(--accent-red);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--accent-red);
    border: 1.5px solid #0d1424;
}

.mobile-brand {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mobile-brand-title {
    font-family: 'Outfit', sans-serif;
    font-size: 16px;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 170px;
}

.mobile-topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mobile-app-link {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-green-bright);
    text-decoration: none;
    transition: all 0.2s ease;
}

.mobile-app-link:active {
    transform: scale(0.92);
}

.mobile-admin-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2px solid var(--accent-green-bright);
    object-fit: cover;
}

/* Sidebar Backdrop */
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

/* Sidebar Close Button */
.sidebar-close-btn {
    display: none;
    margin-left: auto;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.sidebar-close-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

/* Mobile Bottom Navigation (Desktop: Hidden) */
.admin-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: rgba(13, 20, 36, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(148, 163, 184, 0.18);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px)) 8px;
    z-index: 940;
    align-items: center;
    justify-content: space-around;
    box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.6);
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 10.5px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    position: relative;
    padding: 6px 2px;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.bottom-nav-item:active {
    transform: scale(0.92);
}

.bottom-nav-item.active {
    color: var(--accent-green-bright);
}

.bottom-nav-item.active .bottom-nav-icon {
    transform: translateY(-2px);
    filter: drop-shadow(0 0 8px rgba(16, 185, 129, 0.6));
}

.bottom-nav-icon {
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.bottom-nav-label {
    line-height: 1;
    white-space: nowrap;
}

.bottom-nav-badge {
    position: absolute;
    top: 2px;
    right: calc(50% - 18px);
    background: var(--accent-red);
    color: #ffffff;
    font-size: 9px;
    font-weight: 900;
    padding: 1px 5px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(244, 63, 94, 0.5);
    border: 1px solid #0d1424;
}

/* Table Scroll Hint */
.table-scroll-hint {
    display: none;
    font-size: 11.5px;
    color: var(--accent-blue-bright);
    font-weight: 600;
    margin-bottom: 6px;
    text-align: right;
    padding: 0 4px;
    animation: hintPulse 2.5s infinite ease-in-out;
}

@keyframes hintPulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

/* Chat Back Button (Desktop: Hidden) */
.admin-chat-back-btn {
    display: none;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-bright);
    color: #ffffff;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 800;
    cursor: pointer;
    flex-shrink: 0;
    margin-right: 10px;
    transition: all 0.2s ease;
}

.admin-chat-back-btn:active {
    transform: scale(0.9);
    background: rgba(255, 255, 255, 0.16);
}

.admin-chat-header-left {
    display: flex;
    align-items: center;
    min-width: 0;
    flex: 1;
}

/* ==========================================================================
   MEDIA QUERIES (BREAKPOINTS)
   ========================================================================== */

/* ===== TABLETS & MEDIUM SCREENS (<= 1024px) ===== */
@media (max-width: 1024px) {
    .admin-content {
        padding: 24px 20px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }

    .source-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

/* ===== MOBILE DEVICES & SMARTPHONES (<= 768px) ===== */
@media (max-width: 768px) {
    /* Show Mobile Topbar & Bottom Nav */
    .admin-mobile-topbar {
        display: flex;
    }

    .admin-bottom-nav {
        display: flex;
    }

    .sidebar-close-btn {
        display: flex;
    }

    .table-scroll-hint {
        display: block;
    }

    /* Convert Sidebar into Off-canvas Drawer */
    .admin-sidebar {
        width: 290px;
        max-width: 85vw;
        transform: translateX(-100%);
        transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.35s ease;
        z-index: 999;
        box-shadow: none;
    }

    .admin-sidebar.open {
        transform: translateX(0);
        box-shadow: 12px 0 48px rgba(0, 0, 0, 0.85);
    }

    .admin-sidebar .sidebar-brand {
        padding: 18px 16px;
    }

    .admin-sidebar .nav-item {
        padding: 13px 16px;
        font-size: 14.5px;
    }

    /* Main Content Layout Adjustments */
    .admin-app {
        flex-direction: column;
    }

    .admin-content {
        margin-left: 0 !important;
        max-width: 100vw !important;
        padding: 72px 14px 84px 14px !important;
        overflow-x: hidden;
    }

    /* Header on Mobile */
    .admin-header {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        margin-bottom: 20px;
        padding-bottom: 14px;
    }

    .admin-header h1 {
        font-size: 24px;
    }

    .header-actions {
        display: flex;
        flex-direction: column;
        gap: 8px;
        width: 100%;
    }

    .search-box {
        width: 100%;
    }

    .search-box input {
        width: 100%;
        height: 42px;
        font-size: 14px;
    }

    .filter-select {
        width: 100%;
        height: 42px;
        font-size: 13.5px;
    }

    /* Stats Grid (2 Columns compact) */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        margin-bottom: 20px;
    }

    .stat-card {
        padding: 14px 12px;
        gap: 12px;
        border-radius: 12px;
    }

    .stat-icon {
        width: 44px;
        height: 44px;
        font-size: 22px;
        border-radius: 10px;
        flex-shrink: 0;
    }

    .stat-value {
        font-size: 22px;
    }

    .stat-label {
        font-size: 11.5px;
        margin-top: 4px;
    }

    /* Source breakdown card */
    .source-breakdown-card {
        padding: 16px 14px;
        margin-bottom: 20px;
        border-radius: 12px;
    }

    .source-breakdown-header h3 {
        font-size: 15.5px;
    }

    .source-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .source-stat-item {
        padding: 10px 12px;
        border-radius: 10px;
    }

    .source-stat-name {
        font-size: 12.5px;
    }

    .source-stat-count {
        font-size: 14px;
    }

    /* Recent users & Table Container */
    .recent-users-card {
        margin-bottom: 20px !important;
    }

    .recent-users-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 10px;
    }

    .recent-users-header button {
        width: 100%;
        text-align: center;
        justify-content: center;
    }

    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 12px;
        border: 1px solid var(--border-color);
        position: relative;
    }

    .table-container::-webkit-scrollbar {
        height: 6px;
    }

    .table-container::-webkit-scrollbar-thumb {
        background: rgba(148, 163, 184, 0.35);
        border-radius: 4px;
    }

    .user-table {
        min-width: 720px;
    }

    .user-table th {
        padding: 12px 14px;
        font-size: 11.5px;
        white-space: nowrap;
    }

    .user-table td {
        padding: 12px 14px;
        font-size: 13px;
        white-space: nowrap;
    }

    .user-cell {
        gap: 10px;
    }

    .btn-sm {
        min-height: 36px;
        padding: 6px 10px;
        font-size: 12.5px;
        border-radius: 8px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    /* Bulk Actions Bar on Mobile */
    .bulk-actions-bar {
        padding: 12px 14px;
        gap: 12px;
        flex-direction: column;
        align-items: stretch;
    }

    .bulk-selection-info {
        justify-content: space-between;
        width: 100%;
    }

    .bulk-action-buttons {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(105px, 1fr));
        gap: 6px;
        width: 100%;
    }

    .bulk-btn {
        justify-content: center;
        padding: 8px 6px;
        font-size: 11.5px;
        min-height: 38px;
    }

    /* Quick Actions */
    .quick-actions {
        padding: 16px 14px;
    }

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

    .action-btn {
        width: 100%;
        justify-content: center;
        min-height: 44px;
    }

    /* Quest Management */
    .quest-create-form {
        padding: 16px 14px;
        border-radius: 12px;
    }

    .form-row {
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
    }

    .form-input.small {
        max-width: 100%;
        flex: 1;
    }

    .form-input {
        min-height: 42px;
        font-size: 14px;
    }

    /* ===== ADMIN DIRECT CHAT ON MOBILE (1-PANE TOGGLE) ===== */
    .admin-chat-layout {
        height: calc(100dvh - 200px);
        min-height: 480px;
        border-radius: 14px;
        position: relative;
        flex-direction: column;
    }

    .admin-chat-sidebar {
        width: 100%;
        min-width: 100%;
        height: 100%;
        border-right: none;
    }

    .admin-chat-main {
        width: 100%;
        min-width: 100%;
        height: 100%;
        display: none;
    }

    /* Toggle State: When active chat is opened on mobile */
    .admin-chat-layout.in-chat .admin-chat-sidebar {
        display: none;
    }

    .admin-chat-layout.in-chat .admin-chat-main {
        display: flex;
    }

    .admin-chat-back-btn {
        display: inline-flex;
    }

    .admin-chat-header {
        padding: 10px 12px;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .admin-chat-header-actions {
        display: flex;
        justify-content: flex-end;
        gap: 6px;
        width: 100%;
    }

    .admin-chat-header-actions .btn-sm {
        flex: 1;
        text-align: center;
        justify-content: center;
    }

    .admin-messages-stream {
        padding: 12px 10px;
        gap: 10px;
    }

    .admin-msg-row {
        max-width: 88%;
    }

    .admin-msg-bubble {
        padding: 10px 14px;
        font-size: 13.5px;
        border-radius: 14px;
    }

    .admin-quick-replies {
        padding: 6px 10px;
    }

    .admin-reply-chip {
        font-size: 11.5px;
        padding: 5px 10px;
    }

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

    .admin-message-input {
        font-size: 14px;
        padding: 10px 12px;
        border-radius: 10px;
    }

    .admin-chat-send-btn {
        padding: 10px 14px;
        font-size: 13px;
        border-radius: 10px;
    }

    /* ===== MODALS (BOTTOM SHEET ON MOBILE) ===== */
    .modal-overlay {
        align-items: flex-end;
        padding: 0;
    }

    .modal-card {
        width: 100%;
        max-width: 100%;
        max-height: 88dvh;
        border-radius: 20px 20px 0 0;
        border-bottom: none;
        animation: slideUpMobile 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    }

    @keyframes slideUpMobile {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }

    .modal-header {
        padding: 16px 18px;
        position: sticky;
        top: 0;
        z-index: 10;
    }

    .modal-body {
        padding: 16px 18px;
    }

    .detail-grid {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 14px;
    }

    .detail-item.full-width {
        grid-column: span 1;
    }

    .detail-item .mono,
    .detail-link-text {
        word-break: break-all;
    }

    .modal-actions {
        padding: 14px 18px calc(14px + env(safe-area-inset-bottom, 0px)) 18px;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        position: sticky;
        bottom: 0;
        z-index: 10;
    }

    .plan-select {
        width: 100%;
        min-height: 44px;
        font-size: 14px;
    }

    .btn-action {
        width: 100%;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 14px;
    }

    .dp-grant-section {
        width: 100%;
        padding: 14px;
    }

    .dp-grant-section .form-row {
        flex-direction: column;
        align-items: stretch;
    }

    /* Floating Toast Notifications */
    .admin-msg-toast-container {
        top: 68px;
        left: 12px;
        right: 12px;
        width: auto;
        max-width: 100%;
    }

    .admin-msg-toast-card {
        padding: 12px 14px;
        border-radius: 14px;
    }
}

/* ===== EXTRA SMALL SCREENS (<= 480px) ===== */
@media (max-width: 480px) {
    .source-grid {
        grid-template-columns: 1fr;
    }

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

    .admin-thread-preview {
        max-width: 180px;
    }
}

/* ============================================================
   ===== RESEND EMAIL SYSTEM CSS (HIGH CONTRAST & LUXURY) =====
   ============================================================ */

/* --- Status Banner --- */
.email-status-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    background: linear-gradient(135deg, rgba(22, 32, 51, 0.9) 0%, rgba(15, 23, 42, 0.95) 100%);
    border: 1px solid var(--border-bright);
    border-radius: var(--radius);
    padding: 16px 22px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
}

.email-status-left {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.email-status-right {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.resend-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(16, 185, 129, 0.12);
    color: var(--accent-green-bright);
    border: 1px solid rgba(16, 185, 129, 0.35);
    transition: all 0.25s ease;
}

.resend-indicator.inactive {
    background: rgba(244, 63, 94, 0.12);
    color: var(--accent-red-bright);
    border-color: rgba(244, 63, 94, 0.35);
}

.status-pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 8px currentColor;
    animation: statusPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.85); }
}

.sender-info-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12.5px;
    color: var(--text-secondary);
    background: var(--bg-card-elevated);
    border: 1px solid var(--border-color);
    padding: 6px 14px;
    border-radius: 999px;
}

.sender-tag {
    font-size: 10.5px;
    font-weight: 800;
    color: var(--accent-blue-bright);
    letter-spacing: 0.5px;
}

.btn-resend-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-resend-action.primary {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

.btn-resend-action.primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.45);
}

.btn-resend-action.secondary {
    background: var(--bg-card-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-bright);
}

.btn-resend-action.secondary:hover {
    background: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

/* --- Main Workspace Grid --- */
.email-workspace-grid {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: 24px;
    margin-bottom: 28px;
    align-items: start;
}

@media (max-width: 1100px) {
    .email-workspace-grid {
        grid-template-columns: 1fr;
    }
}

.email-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.card-header-clean {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.02);
}

.clean-header-title h3 {
    font-size: 17px;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 3px;
    letter-spacing: -0.3px;
}

.clean-header-subtitle {
    font-size: 12px;
    color: var(--text-muted);
}

.btn-reset-form {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: 0.2s;
}

.btn-reset-form:hover {
    background: var(--bg-card-elevated);
    color: #ffffff;
    border-color: var(--border-bright);
}

/* --- Composer Form Body --- */
.composer-body {
    padding: 22px 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.composer-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.composer-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.composer-sub {
    font-size: 11.5px;
    color: var(--text-muted);
    font-weight: 400;
}

.composer-badge {
    font-size: 11.5px;
    font-weight: 600;
    color: var(--accent-blue-bright);
    background: rgba(59, 130, 246, 0.12);
    padding: 3px 12px;
    border-radius: 999px;
    border: 1px solid rgba(59, 130, 246, 0.25);
}

/* Targeting Tabs */
.target-mode-tabs {
    display: flex;
    gap: 6px;
    padding: 4px;
    background: var(--bg-secondary);
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.target-tab {
    flex: 1;
    padding: 8px 12px;
    border-radius: 7px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.target-tab:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.04);
}

.target-tab.active {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green-bright);
    border: 1px solid rgba(16, 185, 129, 0.35);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.target-input-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

@media (max-width: 600px) {
    .target-input-row {
        grid-template-columns: 1fr;
    }
}

.target-hint {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 6px;
}

.selected-users-summary {
    background: var(--bg-card-elevated);
    border: 1px dashed var(--border-bright);
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 12.5px;
    color: var(--text-secondary);
}

/* Template Chips */
.template-chips-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.template-chip {
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 600;
    background: var(--bg-card-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.18s ease;
}

.template-chip:hover {
    background: var(--bg-card-hover);
    color: #ffffff;
    border-color: var(--border-bright);
    transform: translateY(-1px);
}

.template-chip.active {
    background: rgba(16, 185, 129, 0.18);
    color: var(--accent-green-bright);
    border-color: var(--accent-green-bright);
    font-weight: 700;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.25);
}

/* Subject & Inputs */
.subject-input {
    font-size: 14.5px !important;
    font-weight: 700 !important;
    color: #ffffff !important;
    background: var(--bg-secondary) !important;
}

.composer-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.merge-tags-label {
    font-size: 11.5px;
    color: var(--text-muted);
}

/* Merge Tags Chips */
.merge-tags-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 2px;
}

.tag-chip {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11.5px;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-weight: 700;
    background: rgba(139, 92, 246, 0.12);
    color: #c4b5fd;
    border: 1px solid rgba(139, 92, 246, 0.3);
    cursor: pointer;
    transition: all 0.18s ease;
}

.tag-chip:hover {
    background: rgba(139, 92, 246, 0.25);
    color: #ffffff;
    transform: translateY(-1px);
    border-color: rgba(139, 92, 246, 0.5);
}

/* Toolbar */
.composer-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px 8px 0 0;
    padding: 6px 8px;
    border-bottom: none;
    margin-top: 8px;
}

.toolbar-btn {
    padding: 5px 10px;
    border-radius: 5px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
}

.toolbar-btn:hover {
    background: var(--bg-card-hover);
    color: #ffffff;
}

.email-textarea {
    border-radius: 0 0 8px 8px !important;
    border-top-color: var(--border-color) !important;
    min-height: 180px;
    font-family: inherit;
    line-height: 1.65;
    font-size: 13.5px;
    resize: vertical;
}

/* CTA Settings Box */
.cta-settings-card {
    background: var(--bg-card-elevated);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 14px 16px;
    margin-top: 6px;
}

.cta-header {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
}

.cta-inputs-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 600px) {
    .cta-inputs-row {
        grid-template-columns: 1fr;
    }
}

.cta-input-col label {
    display: block;
    font-size: 11.5px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

/* Actions Bar */
.composer-actions-bar {
    display: flex;
    gap: 12px;
    margin-top: 6px;
}

.btn-email-send {
    flex: 2;
    padding: 12px 20px;
    border-radius: 10px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    border: none;
    font-size: 14.5px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.35);
}

.btn-email-send:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 22px rgba(16, 185, 129, 0.45);
}

.btn-email-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-email-preview-send {
    flex: 1;
    padding: 12px 16px;
    border-radius: 10px;
    background: var(--bg-card-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-bright);
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-email-preview-send:hover {
    background: var(--bg-card-hover);
    transform: translateY(-1px);
    border-color: rgba(255, 255, 255, 0.25);
}

.email-send-status {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    margin-top: 8px;
    line-height: 1.5;
}

.email-send-status.status-success {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: var(--accent-green-bright);
}

.email-send-status.status-error {
    background: rgba(244, 63, 94, 0.12);
    border: 1px solid rgba(244, 63, 94, 0.35);
    color: var(--accent-red-bright);
}

/* --- Right Column: Live Email Client Mockup --- */
.preview-device-toggle {
    display: flex;
    gap: 4px;
    background: var(--bg-secondary);
    padding: 3px;
    border-radius: 8px;
}

.device-btn {
    border: none;
    background: transparent;
    padding: 5px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    opacity: 0.6;
    transition: 0.15s;
}

.device-btn:hover {
    opacity: 0.9;
}

.device-btn.active {
    background: var(--bg-card-elevated);
    opacity: 1;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.email-client-mockup {
    margin: 18px 20px;
    background: #060912;
    border: 1px solid var(--border-bright);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    transition: max-width 0.3s ease;
}

.email-client-mockup.mobile-mode {
    max-width: 380px;
    margin-left: auto;
    margin-right: auto;
}

.mockup-window-bar {
    background: #0f172a;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
    display: flex;
    align-items: center;
    gap: 12px;
}

.window-dots {
    display: flex;
    gap: 6px;
}

.window-dots .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.dot-red { background: #ef4444; }
.dot-yellow { background: #f59e0b; }
.dot-green { background: #10b981; }

.window-title-address {
    font-size: 11.5px;
    color: var(--text-muted);
    font-family: monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mockup-email-meta {
    padding: 14px 20px;
    background: #0b1120;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.mockup-email-meta .meta-row {
    display: flex;
    gap: 10px;
    font-size: 12.5px;
    margin-bottom: 5px;
    align-items: baseline;
}

.mockup-email-meta .meta-label {
    color: var(--text-muted);
    width: 75px;
    flex-shrink: 0;
    font-weight: 600;
}

.mockup-email-meta .meta-value {
    color: var(--text-secondary);
    word-break: break-word;
}

.from-highlight {
    color: #60a5fa !important;
    font-weight: 600;
}

.mockup-email-meta .meta-subject {
    color: #ffffff;
    font-weight: 700;
    font-size: 13.5px;
}

.mockup-scroll-viewport {
    padding: 22px 18px;
    max-height: 540px;
    overflow-y: auto;
    background: #eef1f5;
}

/* Template Render inside Preview */
.email-branded-template {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    overflow: hidden;
    color: #374151;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
    border-top: 4px solid #10b981;
}

.email-tpl-header {
    padding: 26px 20px 20px;
    text-align: center;
    border-bottom: 1px solid #edf1f6;
    background: #f7fdfb;
}

.email-tpl-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #e7f8f1;
    border: 1px solid #a7e3cd;
    padding: 5px 14px;
    border-radius: 999px;
    color: #047857;
    font-weight: 800;
    font-size: 11px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
}

.email-tpl-title {
    margin: 16px 0 0;
    font-size: 19px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.35;
    letter-spacing: -0.4px;
}

.email-tpl-body {
    padding: 22px 22px;
    font-size: 13.5px;
    line-height: 1.68;
}

.email-tpl-greeting {
    font-size: 14.5px;
    margin-bottom: 14px;
    color: #0f172a;
}

.email-tpl-content {
    min-height: 100px;
}

.email-tpl-content p {
    margin: 0 0 14px;
}

.email-tpl-content h2, .email-tpl-content h3 {
    color: #0f172a;
    margin: 18px 0 8px;
}

.email-tpl-content ul {
    padding-left: 20px;
    margin: 0 0 14px;
}

.email-tpl-content li {
    margin-bottom: 6px;
}

.email-tpl-cta-wrap {
    text-align: center;
    margin: 26px 0 12px;
}

.email-tpl-btn {
    display: inline-block;
    background: #047857;
    color: #ffffff !important;
    text-decoration: none;
    font-weight: 700;
    font-size: 14px;
    padding: 12px 28px;
    border-radius: 10px;
    text-align: center;
}

.email-tpl-footer {
    padding: 20px 22px;
    text-align: center;
    font-size: 11.5px;
    color: #6b7280;
    border-top: 1px solid #edf1f6;
    background: #fafbfc;
    line-height: 1.6;
}

.email-tpl-footer p {
    margin: 0 0 4px;
}

.email-tpl-links {
    margin-top: 8px !important;
    color: #047857;
}

/* Callout Boxes */
.highlight-box {
    background: #eff6ff;
    border-left: 4px solid #3b82f6;
    border-radius: 0 8px 8px 0;
    padding: 12px 16px;
    margin: 16px 0;
    font-size: 13px;
    color: #1e40af;
    line-height: 1.5;
}

.gold-box {
    background: #fffbeb;
    border-left: 4px solid #f59e0b;
    border-radius: 0 8px 8px 0;
    padding: 12px 16px;
    margin: 16px 0;
    font-size: 13px;
    color: #92400e;
    line-height: 1.5;
}

/* --- Resend Config Modal Styling --- */
.resend-config-guide-box {
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 18px;
    font-size: 12.5px;
    line-height: 1.6;
    color: #cbd5e1;
}

.guide-title {
    font-weight: 700;
    color: var(--accent-green-bright);
    margin-bottom: 6px;
}

.resend-config-guide-box code {
    background: rgba(0, 0, 0, 0.35);
    padding: 2px 6px;
    border-radius: 4px;
    color: #34d399;
    font-family: monospace;
}

.api-key-input-wrap {
    display: flex;
    gap: 6px;
    align-items: center;
}

.btn-toggle-eye {
    padding: 10px 14px;
    background: var(--bg-card-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: 0.15s;
}

.btn-toggle-eye:hover {
    background: var(--bg-card-hover);
    color: #ffffff;
}

.test-email-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 14px 16px;
}

/* --- Email Logs Table --- */
.email-logs-table td {
    vertical-align: middle;
    font-size: 13px;
}

.status-pill-log {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
}

.status-pill-log.success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-green-bright);
    border: 1px solid rgba(16, 185, 129, 0.35);
}

.status-pill-log.failed {
    background: rgba(244, 63, 94, 0.15);
    color: var(--accent-red-bright);
    border: 1px solid rgba(244, 63, 94, 0.35);
}

.status-pill-log.partial {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-gold-bright);
    border: 1px solid rgba(245, 158, 11, 0.35);
}



