:root {
    color-scheme: dark;
    --bg-primary: #070b14;
    --bg-secondary: rgba(14, 20, 34, 0.86);
    --bg-card: rgba(19, 28, 46, 0.82);
    --bg-hover: rgba(42, 55, 82, 0.72);
    --bg-elevated: rgba(58, 73, 105, 0.88);
    --text-primary: #f8fafc;
    --text-secondary: #a8b3c7;
    --text-muted: #6f7d95;
    --border: rgba(148, 163, 184, 0.14);
    --border-strong: rgba(148, 163, 184, 0.24);
    --accent: #36e0d1;
    --accent-hover: #7cf5e7;
    --accent-deep: #0ea5e9;
    --accent-soft: rgba(54, 224, 209, 0.12);
    --success: #34d399;
    --warning: #fbbf24;
    --danger: #fb7185;
    --shadow-soft: 0 24px 80px rgba(0, 0, 0, 0.34);
    --shadow-card: 0 16px 48px rgba(0, 0, 0, 0.22);
    --radius-xl: 22px;
    --radius-lg: 16px;
}

.light-mode {
    color-scheme: light;
    --bg-primary: #eef4f8;
    --bg-secondary: rgba(255, 255, 255, 0.88);
    --bg-card: rgba(255, 255, 255, 0.82);
    --bg-hover: rgba(226, 232, 240, 0.9);
    --bg-elevated: rgba(203, 213, 225, 0.92);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --border: rgba(15, 23, 42, 0.1);
    --border-strong: rgba(15, 23, 42, 0.17);
    --accent: #0891b2;
    --accent-hover: #06b6d4;
    --accent-deep: #2563eb;
    --accent-soft: rgba(8, 145, 178, 0.1);
    --shadow-soft: 0 24px 80px rgba(15, 23, 42, 0.16);
    --shadow-card: 0 16px 48px rgba(15, 23, 42, 0.1);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    background:
        radial-gradient(circle at 8% 8%, rgba(54, 224, 209, 0.16), transparent 32rem),
        radial-gradient(circle at 92% 4%, rgba(99, 102, 241, 0.18), transparent 34rem),
        linear-gradient(135deg, var(--bg-primary), #0b1020 62%, var(--bg-primary));
    color: var(--text-primary);
    min-height: 100vh;
    transition: background 0.25s ease, color 0.25s ease;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.light-mode body,
body.light-mode {
    background:
        radial-gradient(circle at 8% 8%, rgba(8, 145, 178, 0.12), transparent 30rem),
        radial-gradient(circle at 92% 4%, rgba(37, 99, 235, 0.1), transparent 32rem),
        linear-gradient(135deg, #eef4f8, #f8fafc 60%, #eef4f8);
}

h1,
h2,
h3,
h4,
h5,
h6,
.font-display {
    font-family: 'Sora', sans-serif;
    letter-spacing: -0.025em;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    user-select: none;
}

.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    background:
        linear-gradient(120deg, rgba(7, 11, 20, 0.86), rgba(7, 11, 20, 0.58)),
        radial-gradient(circle at top right, rgba(54, 224, 209, 0.22), transparent 24rem),
        radial-gradient(circle at bottom left, rgba(99, 102, 241, 0.18), transparent 26rem);
}

.auth-card {
    width: 100%;
    max-width: 440px;
    padding: 2.4rem;
    position: relative;
    overflow: hidden;
    isolation: isolate;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.085), rgba(255, 255, 255, 0.035)), var(--bg-secondary);
    border: 1px solid var(--border-strong);
    border-radius: 28px;
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(22px);
}

.auth-card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent), var(--accent-deep), transparent);
    opacity: 0.85;
}

.auth-card::after {
    content: '';
    position: absolute;
    width: 220px;
    height: 220px;
    right: -90px;
    top: -90px;
    background: var(--accent-soft);
    border-radius: 999px;
    filter: blur(18px);
    z-index: -1;
}

.input-group {
    margin-bottom: 1.15rem;
}

.input-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 650;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.input-group input,
input,
select,
textarea {
    width: 100%;
    background: rgba(7, 11, 20, 0.58);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: 14px;
    outline: none;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.input-group input {
    padding: 0.92rem 1rem;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    background: rgba(7, 11, 20, 0.7);
    box-shadow: 0 0 0 4px var(--accent-soft);
}

.light-mode input,
.light-mode select,
.light-mode textarea {
    background: rgba(255, 255, 255, 0.78);
}

.btn-auth,
.btn-primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-deep));
    color: #031014;
    font-family: 'Sora', sans-serif;
    font-weight: 750;
    border: 0;
    cursor: pointer;
    box-shadow: 0 14px 32px rgba(14, 165, 233, 0.22);
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.btn-auth {
    width: 100%;
    padding: 1rem;
    border-radius: 14px;
    font-size: 0.95rem;
}

.btn-auth:hover,
.btn-primary:hover {
    transform: translateY(-2px);
    filter: brightness(1.06);
    box-shadow: 0 18px 40px rgba(14, 165, 233, 0.28);
}

.btn-secondary {
    background: var(--bg-hover);
    color: var(--text-primary);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.btn-secondary:hover {
    background: var(--bg-elevated);
    border-color: var(--border-strong);
    transform: translateY(-1px);
}

.auth-switch {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.auth-switch button {
    color: var(--accent);
    background: none;
    border: none;
    font-weight: 750;
    cursor: pointer;
}

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 288px;
    min-width: 288px;
    height: 100vh;
    background: linear-gradient(180deg,
            rgba(255, 255, 255, .055),
            rgba(255, 255, 255, .02)), var(--bg-secondary);

    border-right: 1px solid var(--border);
    backdrop-filter: blur(22px);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 50;
}

.main-content {
    margin-left: 288px;
    min-height: 100vh;
}

.card,
.offer-card,
.earnings-item {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.052), rgba(255, 255, 255, 0.024)), var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
}

.card {
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.card:hover {
    border-color: var(--border-strong);
}

.nav-item {
    color: var(--text-secondary);
    border-radius: 12px;
    position: relative;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    transform: translateX(2px);
}

.nav-item.active {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 750;
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 26px;
    background: linear-gradient(180deg, var(--accent), var(--accent-deep));
    border-radius: 0 8px 8px 0;
}

.table-row {
    border-bottom: 1px solid var(--border);
    transition: background 0.15s ease;
}

.table-row:hover {
    background: var(--bg-hover);
}

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

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

.scrollbar::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 999px;
}

.badge-approved,
.badge-pending,
.badge-rejected,
.badge-sent,
.badge-failed,
.badge-completed {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 750;
}

.badge-approved,
.badge-sent,
.badge-completed {
    background: rgba(52, 211, 153, 0.12);
    color: var(--success);
    border: 1px solid rgba(52, 211, 153, 0.24);
}

.badge-pending {
    background: rgba(251, 191, 36, 0.12);
    color: var(--warning);
    border: 1px solid rgba(251, 191, 36, 0.24);
}

.badge-rejected,
.badge-failed {
    background: rgba(251, 113, 133, 0.12);
    color: var(--danger);
    border: 1px solid rgba(251, 113, 133, 0.24);
}

.offer-card {
    cursor: pointer;
    transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

.offer-card:hover {
    border-color: rgba(54, 224, 209, 0.46);
    transform: translateY(-5px);
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.28);
}

.modal-overlay {
    background: rgba(2, 6, 23, 0.76);
    backdrop-filter: blur(10px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 100;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    transform: scale(0.96) translateY(16px);
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    background: var(--bg-secondary);
    border: 1px solid var(--border-strong);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(22px);
    border-radius: 20px;
}

.modal-overlay.open .modal-content {
    transform: scale(1) translateY(0);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.animate-slide-up {
    animation: slideUp 0.34s ease forwards;
}

.animate-fade {
    animation: fadeIn 0.24s ease forwards;
}

.mobile-sidebar {
    transform: translateX(-100%);
    transition: transform 0.28s ease;
}

.mobile-sidebar.open {
    transform: translateX(0);
}

.mobile-overlay {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 40;
}

.mobile-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.tag {
    background: rgba(148, 163, 184, 0.1);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 999px;
    font-weight: 650;
}

.glow-accent {
    box-shadow: 0 0 0 1px rgba(54, 224, 209, 0.08), 0 18px 56px rgba(54, 224, 209, 0.1);
}

body,
body.light-mode {
    background: var(--bg-primary) !important;
}

.auth-container,
.auth-card,
.sidebar,
.card,
.offer-card,
.earnings-item,
.btn-auth,
.btn-primary,
.nav-item.active::before {
    background-image: none !important;
}

.btn-auth,
.btn-primary {
    background-color: var(--accent) !important;
    box-shadow: none;
}

.btn-auth:hover,
.btn-primary:hover {
    background-color: var(--accent-hover) !important;
    box-shadow: none;
}

.nav-item.active::before {
    background-color: var(--accent) !important;
}

.dashboard-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.dashboard-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.1rem;
    border-bottom: 1px solid var(--border);
}

.dashboard-panel-title {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.dashboard-panel-title h3 {
    font-family: 'Sora', sans-serif;
    font-weight: 700;
    font-size: 0.98rem;
    color: var(--text-primary);
}

.dashboard-panel-title p {
    font-size: 0.74rem;
    color: var(--text-muted);
}

.dashboard-list {
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    padding: 0.9rem;
}

.dashboard-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem;
    border: 1px solid var(--border);
    border-radius: 15px;
    background: var(--bg-primary);
    transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.dashboard-list-item:hover {
    background: var(--bg-hover);
    border-color: var(--border-strong);
    transform: translateY(-1px);
}

.dashboard-item-left {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    min-width: 0;
}

.dashboard-item-icon {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    font-size: 1.15rem;
    flex-shrink: 0;
}

.dashboard-item-main {
    min-width: 0;
}

.dashboard-item-main h4 {
    font-size: 0.88rem;
    font-weight: 750;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-item-main p {
    margin-top: 0.15rem;
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-item-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.35rem;
    flex-shrink: 0;
}

.dashboard-payout {
    font-family: 'Sora', sans-serif;
    font-weight: 800;
    color: var(--accent);
    font-size: 0.95rem;
}

.dashboard-empty {
    margin: 0.9rem;
    padding: 2.2rem 1rem;
    border: 1px dashed var(--border-strong);
    border-radius: 16px;
    color: var(--text-muted);
    text-align: center;
    background: var(--bg-primary);
}

@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }
}

@media (max-width: 640px) {
    .auth-card {
        padding: 1.6rem;
        border-radius: 24px;
    }

    .card,
    .offer-card,
    .earnings-item {
        border-radius: 14px;
    }
}

.wall-container {
    display: flex;
    min-height: 100vh;
}

.wall-main {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

.wall-sidebar {
    width: 360px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    padding: 1.5rem;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.code-block {
    background: rgba(0, 0, 0, 0.2);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-family: monospace;
    font-size: 0.85rem;
    overflow-x: auto;
    color: var(--accent);
    word-break: break-all;
}

.action-btn {
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s;
}

.action-btn-primary {
    background: var(--accent-soft);
    color: var(--accent);
    border: 1px solid rgba(54, 224, 209, 0.3);
}

.action-btn-danger {
    background: rgba(251, 113, 133, 0.1);
    color: var(--danger);
    border: 1px solid rgba(251, 113, 133, 0.2);
}

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

input,
select,
textarea {
    padding: 0.75rem 1rem;
    min-height: 44px;
}

select {
    appearance: auto;
}

input[type="checkbox"],
input[type="radio"] {
    width: auto;
    min-height: auto;
    padding: 0;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-wrap table {
    min-width: 760px;
}

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

@media (max-width: 640px) {
    .wall-container {
        display: block;
    }

    .wall-main {
        padding: 1rem;
    }

    .wall-sidebar {
        width: 100%;
        height: auto;
        position: relative;
        border-left: 0;
        border-top: 1px solid var(--border);
    }
}


/* Final responsive layout fixes */
@media (min-width: 1024px) {
    .mobile-sidebar {
        transform: translateX(0) !important;
    }

    .mobile-overlay {
        display: none !important;
    }
}

#appSection {
    width: 100%;
}

main {
    width: 100%;
}

.page-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.page-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 18px;
    overflow: hidden;
}

.clean-table {
    width: 100%;
    border-collapse: collapse;
}

.clean-table th {
    background: var(--bg-hover);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    padding: 0.9rem 1rem;
}

.clean-table td {
    padding: 1rem;
    vertical-align: middle;
    border-top: 1px solid var(--border);
}

.clean-table tr:first-child td {
    border-top: 0;
}

.placement-name {
    font-weight: 800;
    color: var(--text-primary);
}

.placement-muted {
    color: var(--text-muted);
    font-size: 0.78rem;
    margin-top: 0.2rem;
}

.placement-code {
    background: rgba(2, 6, 23, 0.36);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.75rem 0.85rem;
    color: var(--accent);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.8rem;
    word-break: break-all;
}

.placement-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    align-items: center;
}

.action-btn {
    min-height: 38px;
    padding: 0.5rem 0.8rem;
    border-radius: 10px;
}

.empty-state {
    padding: 3rem 1rem;
    text-align: center;
    color: var(--text-muted);
}

.mobile-placement-card {
    display: none;
}

@media (max-width: 767px) {
    .page-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .page-toolbar .btn-primary {
        width: 100%;
    }

    .desktop-placement-table {
        display: none !important;
    }

    .mobile-placement-card {
        display: grid;
        gap: 0.85rem;
    }

    .placement-actions {
        justify-content: stretch;
    }

    .placement-actions>* {
        flex: 1 1 0;
    }

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