.ta-admin-panel { background: #0f0f0f; color: #e5e7eb; padding: 30px; border-radius: 12px; font-family: system-ui, -apple-system, sans-serif; max-width: 1200px; margin: 20px auto; border: 1px solid #222; }
.ta-admin-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid #222; padding-bottom: 20px; margin-bottom: 25px; flex-wrap: wrap; gap: 15px; }
.ta-admin-header h2 { color: #C9FF00; margin: 0; font-size: 24px; font-weight: 800; }
.ta-admin-header span { color: #9ca3af; font-size: 14px; }

.ta-admin-tabs { display: flex; gap: 10px; margin-bottom: 25px; border-bottom: 1px solid #222; padding-bottom: 10px; flex-wrap: wrap; }
.ta-admin-tab-btn { background: #181818; color: #9ca3af; border: 1px solid #333; padding: 10px 18px; border-radius: 6px; cursor: pointer; font-weight: 700; font-size: 13px; transition: all 0.2s; }
.ta-admin-tab-btn.active, .ta-admin-tab-btn:hover { background: #C9FF00; color: #000; border-color: #C9FF00; }

.ta-tab-content { display: none; }
.ta-tab-content.active { display: block; }

.ta-stats-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px; margin-bottom: 25px; }
.ta-stat-card { background: #181818; border: 1px solid #222; padding: 20px; border-radius: 10px; }
.ta-stat-card strong { display: block; font-size: 26px; color: #C9FF00; font-weight: 800; }
.ta-stat-card span { font-size: 12px; color: #9ca3af; text-transform: uppercase; letter-spacing: 0.5px; }

.ta-filter-bar { background: #181818; padding: 18px; border-radius: 8px; border: 1px solid #222; margin-bottom: 20px; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.ta-filter-bar form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.ta-filter-bar input, .ta-filter-bar select { background: #121212; border: 1px solid #333; color: #fff; padding: 8px 12px; border-radius: 6px; font-size: 13px; }
.ta-filter-bar button { background: #C9FF00; color: #000; border: none; padding: 8px 16px; border-radius: 6px; font-weight: bold; cursor: pointer; }

.ta-table-wrap { overflow-x: auto; background: #121212; border: 1px solid #222; border-radius: 8px; }
.ta-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 13px; }
.ta-table th { background: #181818; color: #C9FF00; padding: 14px; text-transform: uppercase; font-size: 11px; letter-spacing: 0.5px; border-bottom: 1px solid #222; }
.ta-table td { padding: 14px; border-bottom: 1px solid #1a1a1a; color: #d1d5db; vertical-align: middle; }
.ta-table tr:hover { background: #161616; }

.ta-status-select { background: #181818; color: #fff; border: 1px solid #333; padding: 6px; border-radius: 4px; font-size: 12px; }
.ta-save-btn { background: #C9FF00; color: #000; border: none; padding: 6px 12px; border-radius: 4px; font-weight: bold; cursor: pointer; font-size: 11px; transition: 0.2s; }
.ta-save-btn:hover { background: #aee000; }
.ta-delete-btn { background: rgba(255, 68, 68, 0.1); color: #ff6b6b; border: 1px solid rgba(255, 68, 68, 0.3); padding: 6px 12px; border-radius: 4px; font-weight: bold; cursor: pointer; font-size: 11px; margin-top: 5px; transition: 0.2s; }
.ta-delete-btn:hover { background: #ff6b6b; color: #000; }

.ta-badge { padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: bold; text-transform: uppercase; }
.ta-badge-paid { background: rgba(201, 255, 0, 0.15); color: #C9FF00; border: 1px solid rgba(201, 255, 0, 0.3); }
.ta-badge-pending { background: rgba(255, 170, 0, 0.15); color: #ffb732; border: 1px solid rgba(255, 170, 0, 0.3); }

.ta-revenue-bar-wrap { background: #222; border-radius: 10px; width: 100%; height: 8px; overflow: hidden; margin-top: 6px; }
.ta-revenue-bar-fill { background: #C9FF00; height: 100%; border-radius: 10px; }

/* --- TASK SCHEDULER STYLES --- */
.ta-task-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; margin-top: 20px; }
.ta-task-card { background: #181818; border: 1px solid #333; border-radius: 12px; padding: 20px; position: relative; transition: all 0.3s; box-shadow: 0 4px 12px rgba(0,0,0,0.3); }
.ta-task-card:hover { border-color: #555; }
.ta-task-card.paused { opacity: 0.6; border-style: dashed; }
.ta-task-card h4 { color: #fff; margin: 0 0 8px 0; font-size: 16px; font-weight: 700; padding-right: 50px; }
.ta-task-card code { background: #111; color: #C9FF00; padding: 3px 8px; border-radius: 4px; font-size: 11px; font-family: monospace; }

.ta-task-meta { margin-top: 15px; font-size: 12px; color: #9ca3af; line-height: 1.7; background: #121212; padding: 10px 12px; border-radius: 6px; border: 1px solid #222; }
.ta-task-meta strong { color: #e5e7eb; }

.ta-task-actions { display: flex; gap: 10px; margin-top: 15px; }

/* Custom Toggle Switch */
.ta-switch { position: absolute; top: 20px; right: 20px; display: inline-block; width: 44px; height: 24px; }
.ta-switch input { opacity: 0; width: 0; height: 0; }
.ta-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #333; transition: .3s; border-radius: 24px; }
.ta-slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 4px; bottom: 4px; background-color: #888; transition: .3s; border-radius: 50%; }
.ta-switch input:checked + .ta-slider { background-color: rgba(201, 255, 0, 0.2); border: 1px solid #C9FF00; }
.ta-switch input:checked + .ta-slider:before { transform: translateX(20px); background-color: #C9FF00; }

/* Modal Overlay & Card */
.ta-modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.85); z-index: 999999; justify-content: center; align-items: center; backdrop-filter: blur(4px); }
.ta-modal-content { background: #181818; padding: 30px; border-radius: 12px; border: 1px solid #333; width: 90%; max-width: 440px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
.ta-modal-content label { display: block; margin-bottom: 6px; color: #e5e7eb; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.ta-modal-content input, .ta-modal-content select { width: 100%; background: #121212; border: 1px solid #374151; color: #fff; padding: 10px 12px; border-radius: 6px; margin-bottom: 15px; font-size: 13px; box-sizing: border-box; }
.ta-modal-content input:focus, .ta-modal-content select:focus { border-color: #C9FF00; outline: none; }

/* Segmented Mode Switch */
.ta-rev-toggle-group {
    display: inline-flex;
    background: #121212;
    padding: 4px;
    border-radius: 8px;
    border: 1px solid #333;
}
.ta-rev-toggle-btn {
    background: transparent;
    border: none;
    color: #888;
    padding: 8px 18px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}
.ta-rev-toggle-btn.active {
    background: #222;
    color: #C9FF00;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
.ta-rev-toggle-btn:hover:not(.active) {
    color: #fff;
}

/* Clickable Drill-Down Cards */
.ta-stat-card.ta-clickable {
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease;
}
.ta-stat-card.ta-clickable:hover {
    transform: translateY(-2px);
    border-color: #C9FF00;
}

/* Drill-Down Row Elements */
.ta-drill-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px dashed #262626;
    font-size: 13px;
}
.ta-drill-row:last-child {
    border-bottom: none;
}
.ta-drill-row span {
    color: #aaa;
}
.ta-drill-row strong {
    color: #fff;
}

/* ==============================================================
   MOBILE RESPONSIVENESS & TOUCH-FRIENDLY UI
   ============================================================== */

@media screen and (max-width: 768px) {
    /* 1. Global Spacing & Layout */
    .ta-admin-panel {
        padding: 15px;
        margin: 10px;
    }

    /* 2. Header & Top Bar */
    .ta-admin-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    .ta-admin-header > div:last-child {
        width: 100%;
        display: flex;
        justify-content: space-between;
    }

    /* 3. Swipeable Tabs (Saves vertical space) */
    .ta-admin-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch; /* Smooth iOS scroll */
        padding-bottom: 10px;
        border-bottom: none;
        scrollbar-width: none; /* Firefox */
    }
    .ta-admin-tabs::-webkit-scrollbar {
        display: none; /* Chrome/Safari */
    }
    .ta-admin-tab-btn {
        white-space: nowrap;
        flex-shrink: 0;
        padding: 12px 18px; /* Larger tap target for fingers */
    }

    /* 4. Stats Cards Optimization */
    .ta-stats-cards {
        grid-template-columns: repeat(2, 1fr) !important; /* 2x2 grid on mobile */
        gap: 10px;
    }
    .ta-stat-card {
        padding: 15px;
    }
    .ta-stat-card strong {
        font-size: 20px;
    }

    /* 5. Filter Bars & Forms (Stack elements vertically) */
    .ta-filter-bar form {
        flex-direction: column;
        width: 100%;
        align-items: stretch !important;
    }
    .ta-filter-bar input,
    .ta-filter-bar select,
    .ta-filter-bar button {
        width: 100%;
        min-width: 100% !important; 
        padding: 12px; /* Touch friendly */
        margin-bottom: 5px;
    }

    /* 6. Tables - Edge-to-Edge Swipeable Scroll */
    .ta-table-wrap {
        margin: 0 -15px; /* Bleeds table to the edge of the phone screen */
        padding: 0 15px;
        border-radius: 0;
        border-left: none;
        border-right: none;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .ta-table {
        min-width: 900px; /* Forces table to keep structure so users can swipe sideways */
    }
    .ta-table td button,
    .ta-table td select {
        padding: 10px; /* Touch friendly action buttons */
        font-size: 13px;
    }

    /* 7. Modals & Popups */
    .ta-modal-content {
        width: 95%;
        padding: 20px;
        max-height: 85vh;
        overflow-y: auto;
        margin: 0 auto;
    }

    /* 8. Reusable Responsive Grid Classes */
    .ta-grid-2-1,
    .ta-grid-1-1 {
        grid-template-columns: 1fr !important; /* Collapse side-by-side grids to 1 column */
        gap: 15px !important;
    }

    /* 9. Task Scheduler Fix */
    .ta-task-grid {
        grid-template-columns: 1fr;
    }
    
    /* 10. SweetAlert overrides for mobile */
    .swal2-popup {
        width: 95% !important;
        padding: 15px !important;
    }
}

/* Extra Small Devices */
@media screen and (max-width: 480px) {
    .ta-stats-cards {
        grid-template-columns: 1fr !important; /* 1 card per row for very small screens */
    }
}
/* Fix Task Scheduler Buttons (Screenshot 1) */
    #ta-tab-scheduler > div:first-child {
        flex-direction: column;
        align-items: stretch !important;
    }
    #ta-tab-scheduler > div:first-child > div:last-child {
        flex-wrap: wrap !important;
        width: 100%;
    }
    #ta-tab-scheduler > div:first-child > div:last-child button {
        flex: 1 1 calc(50% - 10px); /* Makes buttons stack 2x2 */
        min-width: 140px;
        justify-content: center;
        text-align: center;
    }

    /* Fix Promo Codes Overflowing (Screenshot 2) */
    #ta-tab-influencers form {
        flex-direction: column;
        align-items: stretch !important;
    }
    #ta-tab-influencers form > div,
    #ta-tab-influencers form > button {
        width: 100% !important;
        min-width: 100% !important;
        flex: none !important;
    }