/* ═══════════════════════════════════════════════════════
   NeedTexting Premium Design System
   Inspired by NinjaChat — Deep dark, card-first, bold
   ═══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Inter:wght@400;500;600&display=swap');

:root {
    /* ── Core Palette ── */
    --nt-void: #000000;
    --nt-deep: #0a0a0a;
    --nt-surface: #1c1c1e;
    --nt-card: rgba(28, 28, 30, 0.6);
    --nt-card-hover: rgba(44, 44, 46, 0.7);
    --nt-card-border: rgba(255, 255, 255, 0.08);
    --nt-card-border-hover: rgba(255, 255, 255, 0.15);

    /* ── Text ── */
    --nt-text: #e5e5e7;
    --nt-text-secondary: #8e8e93;
    --nt-text-muted: #636366;
    --nt-text-bright: #ffffff;

    /* ── Accent ── */
    --nt-accent: #3b82f6;
    --nt-accent-glow: rgba(59, 130, 246, 0.3);
    --nt-accent-subtle: rgba(59, 130, 246, 0.1);
    --nt-gradient: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    --nt-gradient-vibrant: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);

    /* ── Semantic ── */
    --nt-success: #34d399;
    --nt-success-bg: rgba(52, 211, 153, 0.1);
    --nt-warning: #fbbf24;
    --nt-warning-bg: rgba(251, 191, 36, 0.1);
    --nt-danger: #f87171;
    --nt-danger-bg: rgba(248, 113, 113, 0.1);
    --nt-info: #60a5fa;
    --nt-info-bg: rgba(96, 165, 250, 0.1);

    /* ── Layout ── */
    --nt-rail-width: 72px;
    --nt-rail-expanded: 260px;
    --nt-radius: 16px;
    --nt-radius-sm: 10px;
    --nt-radius-lg: 20px;
    --nt-radius-xl: 24px;

    /* ── Motion ── */
    --nt-ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --nt-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --nt-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ═══ RESET & BASE ═══ */

*, *::before, *::after {
    box-sizing: border-box;
}

body.nt-premium {
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--nt-void);
    color: var(--nt-text);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ═══ BACKGROUND ATMOSPHERE ═══ */

.nt-atmosphere {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.nt-atmosphere::before {
    content: '';
    position: absolute;
    top: -20%;
    left: -10%;
    width: 60%;
    height: 60%;
    background: radial-gradient(ellipse, rgba(59, 130, 246, 0.03) 0%, transparent 70%);
    animation: nt-drift 25s ease-in-out infinite;
}

.nt-atmosphere::after {
    content: '';
    position: absolute;
    bottom: -20%;
    right: -10%;
    width: 50%;
    height: 50%;
    background: radial-gradient(ellipse, rgba(37, 99, 235, 0.02) 0%, transparent 70%);
    animation: nt-drift 30s ease-in-out infinite reverse;
}

@keyframes nt-drift {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(3%, -2%) scale(1.05); }
    66% { transform: translate(-2%, 3%) scale(0.95); }
}

/* Subtle noise texture overlay */
.nt-noise {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat;
}

/* ═══ SLIM ICON RAIL (SIDEBAR) ═══ */

.nt-rail {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--nt-rail-width);
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(24px);
    border-right: 1px solid var(--nt-card-border);
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 0;
    transition: width 0.3s var(--nt-ease);
    overflow: hidden;
}

.nt-rail:hover {
    width: var(--nt-rail-expanded);
}

.nt-rail-brand {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--nt-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-weight: 800;
    font-size: 18px;
    color: white;
    margin-bottom: 28px;
    flex-shrink: 0;
    transition: all 0.3s var(--nt-ease);
}

.nt-rail:hover .nt-rail-brand {
    width: calc(var(--nt-rail-expanded) - 32px);
    border-radius: var(--nt-radius-sm);
}

.nt-rail-brand-text {
    display: none;
    font-size: 15px;
    font-weight: 700;
    margin-left: 10px;
    white-space: nowrap;
}

.nt-rail:hover .nt-rail-brand-text {
    display: inline;
}

.nt-rail-nav {
    flex: 1;
    width: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 12px;
    scrollbar-width: none;
}

.nt-rail-nav::-webkit-scrollbar {
    display: none;
}

.nt-rail-section {
    margin-bottom: 8px;
}

.nt-rail-label {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--nt-text-muted);
    padding: 12px 14px 6px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s var(--nt-ease);
}

.nt-rail:hover .nt-rail-label {
    opacity: 1;
}

.nt-rail-item {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    border-radius: var(--nt-radius-sm);
    color: var(--nt-text-secondary);
    text-decoration: none;
    transition: all 0.2s var(--nt-ease);
    margin-bottom: 2px;
    position: relative;
    white-space: nowrap;
}

.nt-rail-item:hover {
    color: var(--nt-text-bright);
    background: rgba(255, 255, 255, 0.06);
}

.nt-rail-item.active {
    color: var(--nt-text-bright);
    background: rgba(255, 255, 255, 0.08);
}

.nt-rail-item.active::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: #ffffff;
    border-radius: 0 3px 3px 0;
}

.nt-rail-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
    opacity: 0.8;
}

.nt-rail-item:hover .nt-rail-icon,
.nt-rail-item.active .nt-rail-icon {
    opacity: 1;
}

.nt-rail-text {
    margin-left: 14px;
    font-size: 13px;
    font-weight: 500;
    opacity: 0;
    transition: opacity 0.2s var(--nt-ease);
}

.nt-rail:hover .nt-rail-text {
    opacity: 1;
}

.nt-rail-badge {
    margin-left: auto;
    padding: 2px 7px;
    font-size: 10px;
    font-weight: 600;
    border-radius: 6px;
    opacity: 0;
    transition: opacity 0.2s var(--nt-ease);
}

.nt-rail:hover .nt-rail-badge {
    opacity: 1;
}

.nt-rail-badge.accent { background: var(--nt-accent-subtle); color: var(--nt-accent); }
.nt-rail-badge.success { background: var(--nt-success-bg); color: var(--nt-success); }
.nt-rail-badge.warning { background: var(--nt-warning-bg); color: var(--nt-warning); }

/* Rail user section at bottom */
.nt-rail-user {
    width: 100%;
    padding: 16px 12px 0;
    border-top: 1px solid var(--nt-card-border);
    margin-top: auto;
    flex-shrink: 0;
}

/* Collapsible multi-account switcher — single row collapsed, flyout list when toggled */
.nt-switcher { position: relative; padding: 0 0 8px; }
.nt-switch-toggle {
    width: 100%;
    background: transparent;
    border: 0;
    text-align: left;
    cursor: pointer;
    color: var(--nt-text);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    border-radius: 10px;
    position: relative;
}
.nt-switch-toggle:hover { background: var(--nt-card); }
.nt-switch-toggle .nt-switch-count {
    margin-left: auto;
    min-width: 18px;
    height: 18px;
    padding: 0 6px;
    border-radius: 9px;
    background: var(--nt-accent-subtle);
    color: var(--nt-accent);
    font-size: 10px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.nt-rail:not(:hover) .nt-switch-toggle .nt-switch-count { display: none; }

.nt-switch-list {
    /* position:fixed so we escape .nt-rail's overflow:hidden clip; coords
       set in JS from the toggle button's bounding rect. */
    position: fixed;
    min-width: 240px;
    max-width: 280px;
    background: var(--nt-card);
    border: 1px solid var(--nt-card-border);
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.45);
    padding: 6px;
    z-index: 10050;
}
.nt-switch-list[hidden] { display: none; }

.nt-switch-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--nt-text);
}
.nt-switch-row:hover { background: var(--nt-surface); color: var(--nt-text); }
.nt-switch-avatar {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--nt-gradient);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
}
.nt-switch-meta { overflow: hidden; }
.nt-switch-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--nt-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nt-switch-email {
    font-size: 11px;
    color: var(--nt-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nt-rail-avatar {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--nt-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: white;
    flex-shrink: 0;
    cursor: pointer;
    transition: transform 0.2s var(--nt-ease);
}

.nt-rail-avatar:hover {
    transform: scale(1.05);
}

/* ═══ MAIN CONTENT ═══ */

.nt-main {
    margin-left: var(--nt-rail-width);
    min-height: 100vh;
    position: relative;
    padding: 40px 48px;
    transition: margin-left 0.3s var(--nt-ease);
}

/* ═══ TYPOGRAPHY ═══ */

.nt-h1 {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 32px;
    font-weight: 800;
    color: var(--nt-text-bright);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.nt-h2 {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: var(--nt-text-bright);
    letter-spacing: -0.01em;
}

.nt-h3 {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 16px;
    font-weight: 700;
    color: var(--nt-text-bright);
}

.nt-subtitle {
    font-size: 15px;
    color: var(--nt-text-secondary);
    line-height: 1.5;
}

.nt-section-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--nt-text-muted);
    margin-bottom: 16px;
}

/* ═══ CARDS ═══ */

.nt-card {
    background: var(--nt-card);
    border: 1px solid var(--nt-card-border);
    border-radius: var(--nt-radius);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    transition: all 0.3s var(--nt-ease);
    position: relative;
    overflow: hidden;
}

.nt-card:hover {
    background: var(--nt-card-hover);
    border-color: var(--nt-card-border-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

/* ── Feature Cards (launchpad) ── */

.nt-feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.nt-feature-card,
a.nt-feature-card {
    background: var(--nt-card);
    border: 1px solid var(--nt-card-border);
    border-radius: var(--nt-radius);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 28px 24px;
    text-decoration: none;
    color: var(--nt-text) !important;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    transition: all 0.3s var(--nt-ease);
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.nt-feature-card:hover,
a.nt-feature-card:hover {
    background: var(--nt-card-hover);
    border-color: var(--nt-card-border-hover);
    transform: translateY(-3px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    color: var(--nt-text) !important;
}

.nt-feature-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.nt-feature-icon.accent { background: var(--nt-accent-subtle); }
.nt-feature-icon.success { background: var(--nt-success-bg); }
.nt-feature-icon.warning { background: var(--nt-warning-bg); }
.nt-feature-icon.danger { background: var(--nt-danger-bg); }
.nt-feature-icon.info { background: var(--nt-info-bg); }

.nt-feature-title {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: var(--nt-text-bright);
}

.nt-feature-desc {
    font-size: 13px;
    color: var(--nt-text-secondary);
    line-height: 1.4;
}

.nt-feature-meta {
    font-size: 12px;
    color: var(--nt-text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ── Hero Card (Need Votes) ── */

.nt-hero-card {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(37, 99, 235, 0.06) 100%);
    border: 1px solid rgba(59, 130, 246, 0.15);
    border-radius: var(--nt-radius-lg);
    padding: 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-decoration: none;
    color: var(--nt-text);
    transition: all 0.3s var(--nt-ease);
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

a.nt-hero-card,
a.nt-hero-card:hover {
    color: var(--nt-text) !important;
}

.nt-hero-card:hover {
    border-color: rgba(59, 130, 246, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
}

.nt-hero-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: var(--nt-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    flex-shrink: 0;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
}

.nt-hero-arrow {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--nt-text-secondary);
    transition: all 0.3s var(--nt-ease);
    flex-shrink: 0;
}

.nt-hero-card:hover .nt-hero-arrow {
    background: rgba(255, 255, 255, 0.12);
    color: var(--nt-text-bright);
    transform: translateX(4px);
}

/* ── Stat Cards ── */

.nt-stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.nt-stat-card {
    background: var(--nt-card);
    border: 1px solid var(--nt-card-border);
    border-radius: var(--nt-radius);
    padding: 24px;
    position: relative;
    overflow: hidden;
}

.nt-stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    border-radius: 2px 2px 0 0;
}

.nt-stat-card.accent::before { background: var(--nt-gradient); }
.nt-stat-card.success::before { background: linear-gradient(90deg, #34d399, #6ee7b7); }
.nt-stat-card.info::before { background: linear-gradient(90deg, #60a5fa, #93c5fd); }
.nt-stat-card.warning::before { background: linear-gradient(90deg, #fbbf24, #fcd34d); }

.nt-stat-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--nt-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.nt-stat-value {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 28px;
    font-weight: 800;
    color: var(--nt-text-bright);
    letter-spacing: -0.02em;
    line-height: 1;
}

.nt-stat-change {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    margin-top: 8px;
    padding: 3px 8px;
    border-radius: 6px;
}

.nt-stat-change.up {
    color: var(--nt-success);
    background: var(--nt-success-bg);
}

.nt-stat-change.down {
    color: var(--nt-danger);
    background: var(--nt-danger-bg);
}

/* ── Quick Action Pills ── */

.nt-pills {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.nt-pill,
a.nt-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 100px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--nt-card-border);
    color: var(--nt-text-secondary) !important;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.25s var(--nt-ease);
    cursor: pointer;
}

.nt-pill:hover,
a.nt-pill:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--nt-card-border-hover);
    color: var(--nt-text-bright) !important;
}

.nt-pill i {
    font-size: 14px;
    opacity: 0.7;
}

/* ── Activity List ── */

.nt-activity-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--nt-card-border);
    transition: background 0.2s var(--nt-ease);
}

.nt-activity-item:last-child {
    border-bottom: none;
}

.nt-activity-item:hover {
    background: rgba(255, 255, 255, 0.02);
}

.nt-activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 6px;
    flex-shrink: 0;
}

.nt-activity-dot.sent { background: var(--nt-success); box-shadow: 0 0 8px var(--nt-success-bg); }
.nt-activity-dot.pending { background: var(--nt-warning); box-shadow: 0 0 8px var(--nt-warning-bg); }
.nt-activity-dot.failed { background: var(--nt-danger); box-shadow: 0 0 8px var(--nt-danger-bg); }

/* ── Chart Container ── */

.nt-chart-card {
    background: var(--nt-card);
    border: 1px solid var(--nt-card-border);
    border-radius: var(--nt-radius);
    padding: 24px;
}

.nt-chart-card canvas {
    border-radius: 8px;
}

.nt-chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.nt-period-btn {
    padding: 5px 12px;
    border-radius: 8px;
    background: none;
    border: none;
    color: var(--nt-text-muted);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s var(--nt-ease);
}

.nt-period-btn:hover {
    color: var(--nt-text-secondary);
    background: rgba(255, 255, 255, 0.04);
}

.nt-period-btn.active {
    color: var(--nt-accent);
    background: var(--nt-accent-subtle);
}

/* ═══ ANIMATIONS ═══ */

@keyframes nt-fade-up {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes nt-scale-in {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.nt-animate {
    opacity: 0;
    animation: nt-fade-up 0.5s var(--nt-ease) forwards;
}

.nt-animate-d1 { animation-delay: 0.05s; }
.nt-animate-d2 { animation-delay: 0.1s; }
.nt-animate-d3 { animation-delay: 0.15s; }
.nt-animate-d4 { animation-delay: 0.2s; }
.nt-animate-d5 { animation-delay: 0.25s; }
.nt-animate-d6 { animation-delay: 0.3s; }
.nt-animate-d7 { animation-delay: 0.35s; }
.nt-animate-d8 { animation-delay: 0.4s; }

/* ═══ RESPONSIVE ═══ */

@media (max-width: 1200px) {
    .nt-stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
    .nt-feature-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    /* ── Rail: off-screen drawer on mobile ── */
    .nt-rail {
        transform: translateX(-100%);
        width: var(--nt-rail-expanded) !important;
        z-index: 1000;
        transition: transform 0.3s var(--nt-ease);
    }
    .nt-rail .nt-rail-text,
    .nt-rail .nt-rail-brand-text,
    .nt-rail .nt-rail-label,
    .nt-rail .nt-rail-badge {
        opacity: 1 !important;
        width: auto !important;
    }
    .nt-rail .nt-rail-brand {
        width: calc(var(--nt-rail-expanded) - 32px) !important;
    }
    .nt-rail.open {
        transform: translateX(0);
    }

    /* Overlay behind open rail */
    .nt-rail-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
    }
    .nt-rail-overlay.active {
        display: block;
    }

    /* ── Main: full width ── */
    .nt-main {
        margin-left: 0 !important;
        padding: 16px;
        padding-top: 60px; /* space for mobile topbar */
    }

    /* ── Mobile topbar with hamburger ── */
    .nt-mobile-bar {
        display: flex !important;
        position: fixed;
        top: 0; left: 0; right: 0;
        height: 52px;
        background: var(--nt-deep);
        border-bottom: 1px solid var(--nt-card-border);
        z-index: 998;
        align-items: center;
        padding: 0 16px;
        gap: 12px;
        backdrop-filter: blur(16px);
    }
    .nt-mobile-burger {
        width: 36px; height: 36px;
        display: flex; align-items: center; justify-content: center;
        background: rgba(255,255,255,0.04);
        border: 1px solid var(--nt-card-border);
        border-radius: 8px;
        color: var(--nt-text-secondary);
        cursor: pointer;
        flex-shrink: 0;
    }
    .nt-mobile-burger:hover {
        background: rgba(255,255,255,0.08);
        color: var(--nt-text-bright);
    }
    .nt-mobile-title {
        font-size: 14px;
        font-weight: 700;
        color: var(--nt-text-bright);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* ── Layout: stack everything ── */
    .nt-stats-row {
        grid-template-columns: 1fr;
    }
    .nt-feature-grid {
        grid-template-columns: 1fr;
    }
    .nt-hero-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    /* ── Cards: reduce padding ── */
    .nt-card, .card {
        padding: 16px;
    }

    /* ── Tables: horizontal scroll ── */
    .table-responsive, .nt-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* ── Command bar: stack ── */
    .nt-cmd-bar {
        flex-wrap: wrap;
        gap: 10px;
        padding: 12px 14px;
    }
    .nt-cmd-campaign {
        margin-left: 0;
        width: 100%;
    }

    /* ── Command tabs: scroll ── */
    .nt-cmd-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
    }
    .nt-cmd-tab {
        padding: 8px 12px;
        font-size: 12px;
    }

    /* ── Command stats: 2-col on mobile ── */
    .nt-cmd-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    /* ── Pill rows: scroll ── */
    .nt-pill-group, .nt-pills {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .nt-pill-group::-webkit-scrollbar,
    .nt-pills::-webkit-scrollbar {
        display: none;
    }
}

/* ═══ COMPREHENSIVE MOBILE FIXES ═══ */

/* ── Inbox: stack conversation list + message view ── */
@media (max-width: 768px) {
    .inbox-container {
        height: auto !important;
        min-height: calc(100vh - 80px);
    }
    .inbox-container > .d-flex,
    .inbox-container > div[style*="display:flex"],
    .inbox-container > div[style*="display: flex"] {
        flex-direction: column !important;
    }
    .conversation-list {
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        max-height: 45vh;
        overflow-y: auto;
        border-right: none !important;
        border-bottom: 1px solid var(--nt-card-border);
    }
    .message-view {
        min-height: 50vh;
    }
    /* When a conversation is selected, hide the list and show the thread */
    .inbox-container.thread-active .conversation-list {
        display: none;
    }
    .inbox-container.thread-active .message-view {
        min-height: calc(100vh - 80px);
    }
    .inbox-container.thread-active .inbox-mobile-back {
        display: block !important;
    }

    /* Message bubbles: less margin on mobile */
    .msg-bubble.outgoing { margin-left: 20px !important; }
    .msg-bubble.incoming { margin-right: 20px !important; }

    /* Inbox filters: horizontal scroll */
    .inbox-filters {
        overflow-x: auto;
        flex-wrap: nowrap !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding: 6px 12px;
    }
    .inbox-filters::-webkit-scrollbar { display: none; }
    .inbox-filter-btn {
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* Reply box: full width, larger touch target */
    .reply-box textarea,
    .reply-box input[type="text"] {
        font-size: 16px !important; /* prevents iOS zoom */
    }
}

/* ── Dashboard: stack grids ── */
@media (max-width: 768px) {
    /* Any inline grid with fr columns → stack */
    [style*="grid-template-columns: 1.5fr"],
    [style*="grid-template-columns: 1fr 1fr 1fr"],
    [style*="grid-template-columns:1.5fr"],
    [style*="grid-template-columns:repeat(3"],
    [style*="grid-template-columns:repeat(4"],
    [style*="grid-template-columns:repeat(auto-fit"] {
        grid-template-columns: 1fr !important;
    }

    /* 2-col stat grids stay 2-col */
    .nt-stats-row,
    [style*="grid-template-columns: repeat(2"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Dashboard hero card */
    .nt-hero-card {
        padding: 16px !important;
    }
    .nt-hero-card h1 {
        font-size: 1.3rem !important;
    }
}

/* ── Forms: touch-friendly inputs ── */
@media (max-width: 768px) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="tel"],
    input[type="number"],
    input[type="search"],
    input[type="url"],
    select,
    textarea {
        font-size: 16px !important; /* prevents iOS auto-zoom */
        min-height: 44px; /* Apple HIG touch target */
        padding: 10px 12px !important;
    }

    /* Buttons: larger touch targets */
    .btn, button, .nt-pill, .nt-btn,
    [class*="nvd-btn"], [class*="dd-party-chip"] {
        min-height: 40px;
        padding: 10px 16px !important;
        font-size: 14px !important;
    }
    .btn-sm, .btn-group-sm > .btn {
        min-height: 36px;
        padding: 8px 12px !important;
    }

    /* Fix inline-flex buttons not wrapping */
    .d-flex, [style*="display:flex"], [style*="display: flex"] {
        flex-wrap: wrap;
    }
}

/* ── Campaign compose: full width ── */
@media (max-width: 768px) {
    .compose-container,
    .campaign-builder,
    [style*="max-width: 1000px"],
    [style*="max-width:1000px"] {
        max-width: 100% !important;
        padding: 0 8px !important;
    }

    /* Phone preview mockups: scale down */
    .phone-preview, .phone-frame {
        transform: scale(0.75);
        transform-origin: top center;
    }
}

/* ── Modals: full screen on mobile ── */
@media (max-width: 768px) {
    .modal-dialog {
        margin: 8px !important;
        max-width: calc(100vw - 16px) !important;
    }
    .modal-content {
        border-radius: 12px !important;
    }
    .modal-body {
        padding: 16px !important;
        max-height: 70vh;
        overflow-y: auto;
    }
}

/* ── Tables: always scrollable ── */
@media (max-width: 768px) {
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }
    table thead { display: table-header-group; }
    table tbody { display: table-row-group; }
    table tr { display: table-row; }
    table td, table th {
        display: table-cell;
        padding: 8px 10px !important;
        font-size: 13px !important;
    }

    /* Wrap long text in table cells */
    .nvd-table td, .nvd-table th,
    .nt-table td, .nt-table th {
        white-space: normal;
        max-width: 200px;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* ── Tabs: horizontal scroll ── */
@media (max-width: 768px) {
    .nav-tabs, .nvd-tabs, .nt-tabs,
    [class*="-tabs"] {
        overflow-x: auto !important;
        flex-wrap: nowrap !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        white-space: nowrap;
        padding-bottom: 2px;
    }
    .nav-tabs::-webkit-scrollbar,
    .nvd-tabs::-webkit-scrollbar,
    [class*="-tabs"]::-webkit-scrollbar {
        display: none;
    }
    .nav-tabs .nav-link, .nvd-tab, .nt-tab,
    [class*="-tabs"] > button,
    [class*="-tabs"] > a {
        flex-shrink: 0;
        white-space: nowrap;
        padding: 8px 14px !important;
        font-size: 13px !important;
    }
}

/* ── Header actions: wrap on mobile ── */
@media (max-width: 768px) {
    .nvd-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px;
    }
    .nvd-header-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        width: 100%;
    }
    .nvd-header-actions .nvd-btn,
    .nvd-header-actions a,
    .nvd-header-actions button {
        flex: 1;
        min-width: 0;
        text-align: center;
        font-size: 12px !important;
        padding: 8px 10px !important;
    }
}

/* ── Stat cards: 2-col grid ── */
@media (max-width: 768px) {
    .nvd-stats {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }
    .nvd-stat {
        padding: 12px !important;
    }
    .nvd-stat-value {
        font-size: 1.2rem !important;
    }
    .nvd-stat-label {
        font-size: 0.7rem !important;
    }
}

/* ── Filter toolbars: scroll not wrap ── */
@media (max-width: 768px) {
    [style*="display:flex"][style*="flex-wrap:wrap"],
    [style*="display: flex"][style*="flex-wrap: wrap"] {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
}

/* ── Billing / settings pages ── */
@media (max-width: 768px) {
    .billing-cards, .settings-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ── Typography: scale down on mobile ── */
@media (max-width: 768px) {
    h1, .h1 { font-size: 1.4rem !important; }
    h2, .h2 { font-size: 1.2rem !important; }
    h3, .h3 { font-size: 1rem !important; }

    /* Page descriptions */
    .nt-main > p:first-of-type,
    .page-description {
        font-size: 0.85rem !important;
    }
}

/* ── Prevent horizontal overflow on body ── */
@media (max-width: 768px) {
    body.nt-premium,
    body.nt-command,
    body.nt-inbox {
        overflow-x: hidden !important;
    }
    .nt-main {
        overflow-x: hidden;
        word-break: break-word;
    }
}

/* ── Donor dashboard specific ── */
@media (max-width: 768px) {
    /* District donor cards */
    #nvd-dd-cards > div {
        font-size: 0.85rem;
    }
    #nvd-dd-cards > div [style*="display:flex"][style*="justify-content:space-between"] {
        flex-direction: column !important;
        gap: 8px;
    }

    /* Geo filter dropdowns */
    #nvd-dd-geo-filters select {
        min-width: 0 !important;
        width: 100%;
    }
    #nvd-dd-geo-filters {
        flex-direction: column !important;
    }
}

/* ── Email unlock page ── */
@media (max-width: 768px) {
    .nt-main[style*="max-width: 860px"],
    .nt-main[style*="max-width: 800px"],
    .nt-main[style*="max-width:860px"],
    .nt-main[style*="max-width:800px"] {
        padding: 16px !important;
    }
}

/* Extra-small screens */
@media (max-width: 480px) {
    .nt-main {
        padding: 10px;
        padding-top: 58px;
    }
    .nt-cmd-stats {
        grid-template-columns: 1fr 1fr;
    }
    .nt-cmd-stat {
        padding: 10px;
    }
    .nt-cmd-stat-value {
        font-size: 18px;
    }

    /* Single column stats on very small screens */
    .nvd-stats {
        grid-template-columns: 1fr !important;
    }

    /* Conversation list: full height */
    .conversation-list {
        max-height: 35vh !important;
    }

    /* Even smaller buttons */
    .nvd-header-actions .nvd-btn,
    .nvd-header-actions a,
    .nvd-header-actions button {
        font-size: 11px !important;
        padding: 6px 8px !important;
    }
}

/* Desktop: hide mobile bar */
@media (min-width: 769px) {
    .nt-mobile-bar {
        display: none !important;
    }
    .nt-rail-overlay {
        display: none !important;
    }
}

/* ═══ LIGHT MODE ═══ */

[data-theme="light"] body.nt-premium {
    --nt-void: #f5f5f7;
    --nt-deep: #ffffff;
    --nt-surface: #ffffff;
    --nt-card: rgba(255, 255, 255, 0.8);
    --nt-card-hover: rgba(255, 255, 255, 0.95);
    --nt-card-border: rgba(0, 0, 0, 0.08);
    --nt-card-border-hover: rgba(0, 0, 0, 0.15);

    --nt-text: #1d1d1f;
    --nt-text-secondary: #6e6e73;
    --nt-text-muted: #aeaeb2;
    --nt-text-bright: #000000;

    --nt-accent: #2563eb;
    --nt-accent-glow: rgba(37, 99, 235, 0.2);
    --nt-accent-subtle: rgba(37, 99, 235, 0.08);
    --nt-gradient: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    --nt-gradient-vibrant: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);

    --nt-success: #16a34a;
    --nt-success-bg: rgba(22, 163, 74, 0.08);
    --nt-warning: #d97706;
    --nt-warning-bg: rgba(217, 119, 6, 0.08);
    --nt-danger: #dc2626;
    --nt-danger-bg: rgba(220, 38, 38, 0.08);
    --nt-info: #2563eb;
    --nt-info-bg: rgba(37, 99, 235, 0.08);
}

/* Light mode atmosphere — very subtle warm tint */
[data-theme="light"] body.nt-premium .nt-atmosphere::before {
    background: radial-gradient(ellipse, rgba(37, 99, 235, 0.03) 0%, transparent 70%);
}
[data-theme="light"] body.nt-premium .nt-atmosphere::after {
    background: radial-gradient(ellipse, rgba(147, 51, 234, 0.02) 0%, transparent 70%);
}

/* Light mode noise — invert and reduce */
[data-theme="light"] body.nt-premium .nt-noise {
    opacity: 0.015;
    filter: invert(1);
}

/* Light mode rail */
[data-theme="light"] body.nt-premium .nt-rail {
    background: rgba(255, 255, 255, 0.95);
    border-right-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] body.nt-premium .nt-rail-item:hover {
    background: rgba(0, 0, 0, 0.04);
}
[data-theme="light"] body.nt-premium .nt-rail-item.active {
    background: rgba(0, 0, 0, 0.06);
}
[data-theme="light"] body.nt-premium .nt-rail-item.active::before {
    background: var(--nt-accent);
}

/* Light mode mobile */
[data-theme="light"] body.nt-premium .nt-mobile-bar {
    background: rgba(255, 255, 255, 0.95);
}
[data-theme="light"] body.nt-premium .nt-mobile-burger {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.08);
}
[data-theme="light"] body.nt-premium .nt-rail-overlay.active {
    background: rgba(0, 0, 0, 0.3);
}

/* Light mode cards — subtle shadow instead of glow */
[data-theme="light"] body.nt-premium .nt-card:hover,
[data-theme="light"] body.nt-premium .nt-feature-card:hover,
[data-theme="light"] body.nt-premium a.nt-feature-card:hover {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

/* Light mode hero card */
[data-theme="light"] body.nt-premium .nt-hero-card {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.06) 0%, rgba(29, 78, 216, 0.03) 100%);
    border-color: rgba(37, 99, 235, 0.12);
}
[data-theme="light"] body.nt-premium .nt-hero-card:hover {
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.08);
}
[data-theme="light"] body.nt-premium .nt-hero-arrow {
    background: rgba(0, 0, 0, 0.04);
}

/* Light mode pills */
[data-theme="light"] body.nt-premium .nt-pill,
[data-theme="light"] body.nt-premium a.nt-pill {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.08);
}
[data-theme="light"] body.nt-premium .nt-pill:hover,
[data-theme="light"] body.nt-premium a.nt-pill:hover {
    background: rgba(0, 0, 0, 0.06);
}

/* Light mode activity items */
[data-theme="light"] body.nt-premium .nt-activity-item:hover {
    background: rgba(0, 0, 0, 0.02);
}

/* Light mode scrollbar */
[data-theme="light"] body.nt-premium ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
}
[data-theme="light"] body.nt-premium ::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

/* Light mode period button */
[data-theme="light"] body.nt-premium .nt-period-btn:hover {
    background: rgba(0, 0, 0, 0.04);
}

/* ── Theme toggle button ── */
.nt-theme-toggle {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--nt-card-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--nt-text-secondary);
    cursor: pointer;
    transition: all 0.2s var(--nt-ease);
    flex-shrink: 0;
    font-size: 14px;
}

.nt-theme-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--nt-text-bright);
}

[data-theme="light"] body.nt-premium .nt-theme-toggle {
    background: rgba(0, 0, 0, 0.04);
}
[data-theme="light"] body.nt-premium .nt-theme-toggle:hover {
    background: rgba(0, 0, 0, 0.08);
}

/* ═══ SCROLLBAR ═══ */

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ═══ UTILITIES ═══ */

.nt-gap-sm { gap: 8px; }
.nt-gap { gap: 16px; }
.nt-gap-lg { gap: 24px; }
.nt-gap-xl { gap: 32px; }

.nt-mt-xs { margin-top: 8px; }
.nt-mt-sm { margin-top: 12px; }
.nt-mt { margin-top: 16px; }
.nt-mt-lg { margin-top: 24px; }
.nt-mt-xl { margin-top: 32px; }
.nt-mt-2xl { margin-top: 48px; }

.nt-mb-sm { margin-bottom: 12px; }
.nt-mb { margin-bottom: 16px; }
.nt-mb-lg { margin-bottom: 24px; }
.nt-mb-xl { margin-bottom: 32px; }

.nt-flex { display: flex; }
.nt-flex-col { flex-direction: column; }
.nt-items-center { align-items: center; }
.nt-justify-between { justify-content: space-between; }
.nt-flex-1 { flex: 1; }

.nt-text-accent { color: var(--nt-accent); }
.nt-text-success { color: var(--nt-success); }
.nt-text-warning { color: var(--nt-warning); }
.nt-text-danger { color: var(--nt-danger); }

.nt-divider {
    border: none;
    border-top: 1px solid var(--nt-card-border);
    margin: 24px 0;
}
