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

/* =============================================
   RESET & BASE
============================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: #0f172a;
    color: #f8fafc;
    font-size: 14px;
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* App pages get light bg */
body.app-page { background: #f0f4f8; color: #0f172a; }

a { text-decoration: none; }
button { font-family: inherit; cursor: pointer; transition: all 0.2s ease; }

/* =============================================
   AUTH LAYOUT (login / otp)
   DCOBuilder-inspired: dark split screen
============================================= */
.auth-root {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* LEFT PANEL – brand/visual */
.auth-left {
    flex: 1;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 60%, #0f4c81 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    padding: 60px 64px;
    position: relative;
    overflow: hidden;
}
.auth-left::before {
    content: '';
    position: absolute;
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(37,99,235,0.18) 0%, transparent 70%);
    top: -100px; right: -100px;
    pointer-events: none;
}
.auth-left::after {
    content: '';
    position: absolute;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(16,185,129,0.12) 0%, transparent 70%);
    bottom: -80px; left: -80px;
    pointer-events: none;
}

.auth-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 64px;
}
.auth-logo-icon {
    width: 44px; height: 44px;
    background: linear-gradient(135deg, #2563eb, #10b981);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
}
.auth-logo-text {
    font-size: 20px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.03em;
}

.auth-headline {
    font-size: 44px;
    font-weight: 900;
    line-height: 1.1;
    letter-spacing: -0.03em;
    color: #fff;
    margin-bottom: 20px;
    position: relative;
}
.auth-headline span {
    background: linear-gradient(90deg, #38bdf8, #10b981);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.auth-tagline {
    font-size: 16px;
    color: #94a3b8;
    max-width: 380px;
    line-height: 1.6;
    position: relative;
    margin-bottom: 48px;
}
.auth-stats {
    display: flex;
    gap: 40px;
    position: relative;
    z-index: 1;
}
.auth-stat-val {
    font-size: 28px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.02em;
}
.auth-stat-label {
    font-size: 12px;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 2px;
}

/* Decorative grid dots */
.auth-grid {
    position: absolute;
    right: -20px; top: 60px;
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 14px;
    opacity: 0.12;
}
.auth-grid span {
    width: 4px; height: 4px;
    border-radius: 50%;
    background: #60a5fa;
    display: block;
}

/* RIGHT PANEL – form */
.auth-right {
    width: 480px;
    flex-shrink: 0;
    background: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 60px 52px;
}

.auth-form-title {
    font-size: 28px;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.03em;
    margin-bottom: 6px;
}
.auth-form-sub {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 36px;
}
.auth-divider {
    height: 1px;
    background: #e2e8f0;
    margin: 28px 0;
}

/* Form elements (inside auth panel) */
.auth-field { margin-bottom: 20px; }
.auth-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 7px;
}
.auth-field input {
    width: 100%;
    height: 50px;
    padding: 0 16px;
    border-radius: 10px;
    border: 1.5px solid #e2e8f0;
    font-size: 15px;
    color: #0f172a;
    background: #f8fafc;
    outline: none;
    transition: all 0.2s;
    font-family: inherit;
}
.auth-field input:focus {
    border-color: #2563eb;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(37,99,235,0.1);
}
.auth-field input::placeholder { color: #94a3b8; }

/* OTP Input special styling */
.otp-input {
    width: 100%;
    height: 60px !important;
    font-size: 28px !important;
    letter-spacing: 0.3em;
    text-align: center;
    font-weight: 700 !important;
}

.auth-btn {
    width: 100%;
    height: 52px;
    background: #0f172a;
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 4px;
    font-family: inherit;
}
.auth-btn:hover { background: #1e293b; transform: translateY(-1px); box-shadow: 0 8px 20px rgba(15,23,42,0.2); }
.auth-btn:active { transform: translateY(0); }

.auth-msg {
    margin-top: 16px;
    font-size: 13px;
    font-weight: 500;
    min-height: 20px;
    border-radius: 8px;
    padding: 10px 14px;
    display: none;
}
.auth-msg.error { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; display: block; }
.auth-msg.success { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; display: block; }
.auth-msg.info { background: #eff6ff; color: #2563eb; border: 1px solid #bfdbfe; display: block; }

.auth-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #64748b;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 32px;
    cursor: pointer;
    transition: color 0.2s;
}
.auth-back-link:hover { color: #0f172a; }

.auth-footer-text {
    margin-top: 32px;
    font-size: 12px;
    color: #94a3b8;
    text-align: center;
}

/* Responsive auth */
@media (max-width: 900px) {
    .auth-left { display: none; }
    .auth-right { width: 100%; padding: 40px 28px; }
}

/* =============================================
   APP LAYOUT (dashboard / index)
============================================= */
.app-layout {
    display: flex;
    min-height: 100vh;
    background: #f0f4f8;
}

/* =============================================
   SIDEBAR
============================================= */
.sidebar {
    width: 260px;
    background: #0f172a;
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0; top: 0;
    z-index: 200;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-header {
    padding: 28px 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
}
.sidebar-brand-icon {
    width: 34px; height: 34px;
    background: linear-gradient(135deg, #2563eb, #10b981);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.sidebar-brand-text {
    font-size: 16px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.02em;
}
.sidebar-brand-sub {
    font-size: 10px;
    color: #64748b;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.sidebar-user {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    padding: 12px 14px;
    border-radius: 10px;
}
.sidebar-user .s-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    display: flex; align-items: center; justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    margin-bottom: 8px;
}
.sidebar-user .s-name {
    font-size: 13px;
    font-weight: 600;
    color: #f1f5f9;
    word-break: break-all;
    line-height: 1.3;
}
.sidebar-user .s-role {
    font-size: 11px;
    color: #38bdf8;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 3px;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-section-label {
    font-size: 10px;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 4px 8px;
    margin-top: 12px;
    margin-bottom: 4px;
}

.nav-item {
    padding: 10px 14px;
    border-radius: 8px;
    color: #94a3b8;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    border: none;
    background: transparent;
    text-align: left;
    width: 100%;
    position: relative;
}
.nav-item:hover {
    background: rgba(255,255,255,0.07);
    color: #f1f5f9;
}
.nav-item.active {
    background: rgba(37,99,235,0.18);
    color: #60a5fa;
}
.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0; top: 20%; bottom: 20%;
    width: 3px;
    background: #2563eb;
    border-radius: 0 2px 2px 0;
}
.nav-item.create-btn {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    padding: 12px;
    margin-bottom: 12px;
    box-shadow: 0 4px 15px rgba(16,185,129,0.25);
}
.nav-item.create-btn::before { display: none; }
.nav-item.create-btn:hover { background: linear-gradient(135deg, #059669, #047857); box-shadow: 0 6px 20px rgba(16,185,129,0.3); transform: translateY(-1px); }

.sidebar-footer {
    padding: 14px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

/* =============================================
   MAIN CONTENT
============================================= */
.main-content {
    flex: 1;
    margin-left: 230px;
    padding: 7px 21px;
    min-width: 0;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
}
.page-header h1 {
    font-size: 26px;
    font-weight: 800;
    color: #0f172a;
    letter-spacing: -0.03em;
    margin: 0 0 4px 0;
}
.page-header p {
    color: #64748b;
    font-size: 13px;
    margin: 0;
}

/* =============================================
   FILTER BAR
============================================= */
.filter-bar {
    background: #fff;
    padding: 14px 18px;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    margin-bottom: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}
.filter-bar input,
.filter-bar select {
    height: 38px;
    padding: 0 12px;
    border-radius: 8px;
    border: 1.5px solid #e2e8f0;
    font-size: 13px;
    background: #f8fafc;
    color: #0f172a;
    outline: none;
    transition: all 0.2s;
    font-family: inherit;
    width: auto;
    min-width: 0;
}
.filter-bar input:focus, .filter-bar select:focus {
    border-color: #2563eb;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
#searchInput { min-width: 200px; }

/* =============================================
   TOP FILTER CHIPS
============================================= */
#topFilters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
    align-items: center;
}
.chip {
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background: #fff;
    color: #475569;
    border: 1.5px solid #e2e8f0;
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}
.chip:hover { border-color: #2563eb; color: #2563eb; background: #eff6ff; }
.chip.active { background: #0f172a; color: #fff; border-color: #0f172a; }
.chip .chip-count {
    background: rgba(255,255,255,0.2);
    border-radius: 20px;
    padding: 1px 7px;
    font-size: 11px;
}
.chip.active .chip-count { background: rgba(255,255,255,0.2); }

/* =============================================
   CAMPAIGN CARDS
============================================= */
#campaignList {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.campaign-card {
    background: #fff;
    border-radius: 14px;
    padding: 20px 24px;
    border: 1px solid #e8edf4;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
    transition: box-shadow 0.2s, transform 0.2s;
    cursor: pointer;
}
.campaign-card:hover { box-shadow: 0 8px 24px rgba(0,0,0,0.07); transform: translateY(-2px); }

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 10px;
}
.card-title {
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.3;
    flex: 1;
}
.card-actions { display: flex; gap: 8px; flex-shrink: 0; align-items: center; }

.edit-btn {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1.5px solid #dbeafe;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.15s;
}
.edit-btn:hover { background: #dbeafe; border-color: #93c5fd; }
.edit-btn.orange { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.edit-btn.orange:hover { background: #ffedd5; }

.badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.badge {
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: #f1f5f9;
    color: #475569;
}
.badge.blue { background: #dbeafe; color: #1e40af; }
.badge.green { background: #dcfce7; color: #166534; }
.badge.orange { background: #ffedd5; color: #9a3412; }
.badge.red { background: #fee2e2; color: #991b1b; }
.badge.purple { background: #f3e8ff; color: #7e22ce; }

.card-meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #f1f5f9;
}
.card-meta span { display: flex; align-items: center; gap: 4px; }

.card-stats {
    display: flex;
    gap: 20px;
    margin-top: 10px;
    flex-wrap: wrap;
}
.card-stat {
    font-size: 12px;
    color: #64748b;
}
.card-stat strong { color: #0f172a; font-weight: 700; font-size: 13px; }

.empty-state {
    text-align: center;
    padding: 64px 24px;
    color: #94a3b8;
}
.empty-state svg { margin-bottom: 16px; opacity: 0.4; }
.empty-state h3 { font-size: 18px; font-weight: 700; color: #475569; margin-bottom: 8px; }
.empty-state p { font-size: 14px; line-height: 1.6; }

/* Pagination */
#pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 24px;
    flex-wrap: wrap;
}
.page-btn {
    padding: 8px 14px;
    border-radius: 8px;
    border: 1.5px solid #e2e8f0;
    background: #fff;
    color: #475569;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
}
.page-btn:hover, .page-btn.active { background: #0f172a; color: #fff; border-color: #0f172a; }

/* =============================================
   GLOBAL LOADER
============================================= */
#globalLoader {
    position: fixed; inset: 0;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 999999;
}
#globalLoader.show { display: flex; }
.loader-spinner {
    width: 44px; height: 44px;
    border: 4px solid #e2e8f0;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
.loader-text {
    margin-top: 14px;
    font-size: 14px;
    font-weight: 600;
    color: #475569;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =============================================
   MODALS — ALL HIDDEN BY DEFAULT
============================================= */
/* Base: every modal = fixed overlay, hidden.
   NO !important so JS inline styles can override naturally. */
/* .modal,
.app-modal,
.mocks-modal,
.tracker-modal,
#appModal,
#campaignModal,
#dcoEditModal,
#templateModal,
#adtagPreviewModal,
#trackerModal,
#mockModal {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(15,23,42,0.65);
    backdrop-filter: blur(5px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    overflow: hidden;
} */

/* .show class (for app-modal) */
.app-modal.show { display: flex; }

/* When JS sets display:flex or display:block via inline style — override to flex
   so the modal is always centered regardless of which value JS uses */
.modal[style*="display: flex"],
.modal[style*="display:flex"],
.modal[style*="display: block"],
.modal[style*="display:block"],
#appModal[style*="display: flex"],
#appModal[style*="display:flex"],
#appModal[style*="display: block"],
#campaignModal[style*="display: flex"],
#campaignModal[style*="display:flex"],
#campaignModal[style*="display: block"],
#campaignModal[style*="display:block"],
#dcoEditModal[style*="display: flex"],
#dcoEditModal[style*="display:flex"],
#dcoEditModal[style*="display: block"],
#dcoEditModal[style*="display:block"],
#templateModal[style*="display: flex"],
#templateModal[style*="display:flex"],
#templateModal[style*="display: block"],
#templateModal[style*="display:block"],
#adtagPreviewModal[style*="display: flex"],
#adtagPreviewModal[style*="display:flex"],
#adtagPreviewModal[style*="display: block"],
#mockModal[style*="display: flex"],
#mockModal[style*="display:flex"],
#mockModal[style*="display: block"],
.mocks-modal[style*="display: flex"],
.mocks-modal[style*="display:flex"],
.mocks-modal[style*="display: block"],
.tracker-modal[style*="display: flex"],
.tracker-modal[style*="display:flex"],
.tracker-modal[style*="display: block"],
#trackerModal[style*="display: flex"],
#trackerModal[style*="display:flex"],
#trackerModal[style*="display: block"],
#trackerModal[style*="display:block"] {
    display: flex !important;
}

/* Modal content box */
.modal-content,
.modal-box,
.app-modal-content,
.mocks-modal-content,
.tracker-modal-content {
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(0,0,0,0.18);
    width: 920px;
    max-width: 94vw;
    max-height: 92vh;
    overflow-y: auto;
    position: relative;
    animation: modalIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.app-modal-content { width: 440px; padding: 28px; }

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.96) translateY(12px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header,
.mocks-header,
.app-modal-header,
.tracker-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #f1f5f9;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 10;
    border-radius: 18px 18px 0 0;
}
.modal-header h2, .modal-header h3, .app-modal-header h3, .mocks-header h2 {
    font-size: 18px;
    font-weight: 800;
    color: #0f172a;
    margin: 0;
}
.close-btn, .mocks-close {
    background: #f1f5f9;
    border: none;
    color: #64748b;
    width: 32px; height: 32px;
    border-radius: 8px;
    font-size: 18px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: all 0.15s;
}
.close-btn:hover, .mocks-close:hover { background: #fee2e2; color: #dc2626; }

.modal-body { padding: 24px; }
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid #f1f5f9;
    position: sticky;
    bottom: 0;
    background: #fff;
    border-radius: 0 0 18px 18px;
}

/* =============================================
   FORM SECTIONS (index page)
============================================= */
/* Remove old body padding for app pages */
.app-layout body { padding: 0; }

.field_group, .form-section {
    background: #fff;
    border: 1px solid #e8edf4;
    border-radius: 14px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}
.head, .form-section h3 {
    font-size: 14px;
    font-weight: 800;
    color: #0f172a;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 8px;
}
.body, .form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
}
.field, .form-field { display: flex; flex-direction: column; gap: 6px; position: relative; }
.field.full { grid-column: 1 / -1; }
label, .form-label {
    font-size: 12px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.req-star { color: #ef4444; }

/* General inputs */
input, select, textarea {
    height: 44px;
    padding: 0 14px;
    border-radius: 9px;
    border: 1.5px solid #e2e8f0;
    font-size: 14px;
    font-family: inherit;
    background: #f8fafc;
    color: #0f172a;
    outline: none;
    transition: all 0.2s;
    width: 100%;
}
textarea { min-height: 100px; height: auto; resize: vertical; padding: 12px 14px; }
input:focus, select:focus, textarea:focus {
    border-color: #2563eb;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}
.is-disabled { opacity: 0.55; pointer-events: none; }

/* select-trigger (custom dropdowns) */
.select-trigger {
    height: 44px; padding: 0 14px;
    border-radius: 9px; border: 1.5px solid #e2e8f0;
    display: flex; align-items: center; justify-content: space-between;
    cursor: pointer; background: #f8fafc;
    font-size: 14px; transition: all 0.2s;
}
.select-trigger:hover { border-color: #94a3b8; }
.dropdown {
    position: absolute; top: calc(100% + 6px); left: 0; width: 100%;
    background: #fff; border-radius: 12px;
    box-shadow: 0 12px 30px rgba(0,0,0,0.1);
    border: 1.5px solid #e2e8f0; padding: 10px; display: none; z-index: 500;
}
.dropdown.open { display: block; }
.dropdown .search { margin-bottom: 8px; height: 36px; background: #f8fafc; }
.dropdown .list { max-height: 200px; overflow-y: auto; }
.dropdown .item { padding: 9px 12px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.dropdown .item:hover { background: #f1f5f9; }
.dropdown .item.selected { background: #eff6ff; color: #1d4ed8; font-weight: 600; }
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* =============================================
   BUTTONS
============================================= */
.btn-primary, #updateBtn {
    background: linear-gradient(135deg, #1d4ed8, #2563eb);
    color: #fff; border: none;
    padding: 11px 22px; border-radius: 9px;
    font-weight: 700; font-size: 14px; font-family: inherit;
}
.btn-primary:hover, #updateBtn:hover { background: linear-gradient(135deg, #1e40af, #1d4ed8); transform: translateY(-1px); }

.btn-secondary {
    background: #f1f5f9; color: #334155;
    border: 1.5px solid #e2e8f0;
    padding: 10px 20px; border-radius: 9px;
    font-weight: 600; font-size: 14px; font-family: inherit;
    text-decoration: none; display: inline-flex; align-items: center;
}
.btn-secondary:hover { background: #e2e8f0; }

.btn-save, .approve-btn {
    background: linear-gradient(135deg, #059669, #10b981);
    color: #fff; border: none;
    padding: 10px 20px; border-radius: 9px;
    font-weight: 700; font-size: 14px; font-family: inherit;
}
.btn-save:hover, .approve-btn:hover { background: linear-gradient(135deg, #047857, #059669); }

.reject-btn {
    background: #fee2e2; color: #dc2626;
    border: 1.5px solid #fecaca;
    padding: 6px 12px; border-radius: 7px;
    font-size: 12px; font-weight: 700; font-family: inherit;
}

/* =============================================
   ALERTS
============================================= */
#errorBox, #successBox, #updateBox, #emptyFieldBox {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 16px;
    font-size: 14px;
    font-weight: 500;
    display: none;
}
#errorBox { background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c; display: none; }
#successBox { background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; display: none; }
#updateBox { background: #eff6ff; border: 1px solid #bfdbfe; color: #1d4ed8; display: none; }
#emptyFieldBox { background: #fffbeb; border: 1px solid #fde68a; color: #b45309; display: none; }
[style*="display: block"].errorBox,
[style*="display: block"].successBox,
[style*="display: block"].updateBox,
[style*="display: block"].emptyFieldBox { display: block !important; }

/* Toast */
#toast {
    position: fixed; top: 20px; right: 20px;
    z-index: 999999; padding: 12px 20px;
    border-radius: 10px; font-weight: 600; font-size: 14px;
    background: #10b981; color: #fff;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
    display: none; animation: toastIn 0.3s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

/* =============================================
   TABLES
============================================= */
.table, .dco-table, .tracker-main-table {
    width: 100%; border-collapse: separate; border-spacing: 0;
    border: 1px solid #e2e8f0; border-radius: 12px;
    overflow: hidden; background: #fff;
}
.table th, .dco-table th, .tracker-main-table th {
    background: #f8fafc; color: #475569;
    font-weight: 700; font-size: 12px; text-align: left;
    padding: 12px 16px; border-bottom: 1px solid #e2e8f0;
    text-transform: uppercase; letter-spacing: 0.04em;
}
.table td, .dco-table td, .tracker-main-table td {
    padding: 14px 16px; border-bottom: 1px solid #f1f5f9;
    font-size: 14px; color: #1e293b; vertical-align: top;
}
.table tr:last-child td, .dco-table tr:last-child td { border-bottom: none; }
.dco-table a, .table a { color: #2563eb; font-weight: 600; }
.tracker-table-wrapper, .dco-scroll-wrapper { overflow: auto; max-height: 500px; border-radius: 10px; }
.textarea-view {
    background: #f8fafc; border: 1px solid #e2e8f0;
    border-radius: 9px; padding: 14px;
    font-size: 14px; color: #0f172a;
    min-height: 60px; word-break: break-word; line-height: 1.5;
}

/* =============================================
   STATUS / ERROR CARDS (error/unauth pages)
============================================= */
.error-page {
    min-height: 100vh;
    background: #0f172a;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}
.error-card {
    background: #1e293b;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 20px;
    padding: 48px 40px;
    max-width: 480px;
    width: 100%;
    text-align: center;
}
.error-code {
    font-size: 96px;
    font-weight: 900;
    letter-spacing: -0.05em;
    line-height: 1;
    background: linear-gradient(135deg, #ef4444, #f97316);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 12px;
}
.error-code.warning {
    background: linear-gradient(135deg, #f59e0b, #f97316);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.error-title { font-size: 24px; font-weight: 800; color: #f1f5f9; margin-bottom: 12px; }
.error-text { font-size: 14px; color: #94a3b8; line-height: 1.7; margin-bottom: 32px; }
.error-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.error-btn-primary {
    padding: 11px 22px; background: #2563eb; color: #fff;
    border-radius: 9px; font-weight: 700; font-size: 14px;
    text-decoration: none; transition: all 0.2s;
}
.error-btn-primary:hover { background: #1d4ed8; transform: translateY(-1px); }
.error-btn-secondary {
    padding: 11px 22px; background: rgba(255,255,255,0.08); color: #94a3b8;
    border: 1px solid rgba(255,255,255,0.12); border-radius: 9px;
    font-weight: 600; font-size: 14px; text-decoration: none; transition: all 0.2s;
}
.error-btn-secondary:hover { background: rgba(255,255,255,0.12); color: #f1f5f9; }
.error-footer { margin-top: 24px; font-size: 12px; color: #475569; }

/* keep legacy card class working */
.card { background: #1e293b; color: #f1f5f9; padding: 40px; border-radius: 16px; max-width: 460px; width: 90vw; margin: 100px auto; text-align: center; }
.code { font-size: 80px; font-weight: 900; color: #ef4444; line-height: 1; margin-bottom: 8px; }
.footer { margin-top: 20px; font-size: 12px; color: #475569; }

/* =============================================
   CPM ESTIMATOR
============================================= */
.cpm-estimator { background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; overflow: hidden; margin-bottom: 20px; }
.cpm-toggle { width: 100%; text-align: left; background: #f8fafc; border: none; padding: 16px 20px; font-size: 14px; font-weight: 700; color: #0f172a; display: flex; justify-content: space-between; cursor: pointer; align-items: center; font-family: inherit; }
.cpm-estimator-panel { padding: 24px; display: none; }
.cpm-estimator.is-open .cpm-estimator-panel { display: block; }
.cpm-estimator.is-open .cpm-toggle-arrow { transform: rotate(180deg); }
.cpm-estimator-subtitle { font-size: 13px; color: #64748b; margin-bottom: 20px; }
.cpm-grid { display: grid; gap: 16px; }
.cpm-card { border: 1px solid #e2e8f0; padding: 16px; border-radius: 12px; }
.cpm-card-head { font-size: 11px; font-weight: 800; color: #2563eb; letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 14px; }
.cpm-card-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; align-items: end; }
.cpm-output { height: 44px; display: flex; align-items: center; padding: 0 14px; border-radius: 9px; background: #f1f5f9; border: 1px solid #e2e8f0; font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cpm-total { background: #0f172a; color: #fff; padding: 20px; border-radius: 12px; display: flex; justify-content: space-between; align-items: center; margin-top: 20px; }
.cpm-total-label { font-size: 13px; font-weight: 700; letter-spacing: 0.02em; }
.cpm-total-value { font-size: 22px; font-weight: 900; color: #38bdf8; }

/* =============================================
   WORKFLOW BADGES
============================================= */
.workflow { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.wf-step { display: flex; align-items: center; gap: 6px; }
.wf-dot { width: 8px; height: 8px; border-radius: 50%; background: #cbd5e1; }
.wf-label { font-size: 12px; color: #94a3b8; font-weight: 600; }
.wf-done .wf-dot { background: #10b981; }
.wf-done .wf-label { color: #10b981; }
.wf-active .wf-dot { background: #2563eb; }
.wf-active .wf-label { color: #2563eb; }
.wf-rejected .wf-dot { background: #ef4444; }
.wf-rejected .wf-label { color: #ef4444; }

/* =============================================
   MISC / TEMPLATES / MOCKS
============================================= */
#templateGrid, .mocks-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; max-height: 580px; overflow-y: auto; }
.template-card, .mock-card {
    border: 1.5px solid #e2e8f0; border-radius: 12px; padding: 16px;
    background: #fff; transition: all 0.2s; display: flex; flex-direction: column;
}
.template-card:hover, .mock-card:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(0,0,0,0.07); border-color: #2563eb; }
.template-name, .mock-name { font-size: 14px; font-weight: 700; color: #0f172a; margin-bottom: 8px; word-break: break-all; }
.template-desc { font-size: 12px; color: #64748b; line-height: 1.6; margin-bottom: 12px; }
.mock-card img { width: 100%; border-radius: 8px; aspect-ratio: 1/1; object-fit: contain; margin-bottom: 8px; background: #f8fafc; }
.template-select-btn { margin-top: auto; padding: 9px; border-radius: 8px; background: #2563eb; color: #fff; font-weight: 700; text-align: center; border: none; cursor: pointer; font-family: inherit; }
.template-select-btn:hover { background: #1d4ed8; }
#templateChips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }

/* Tooltips */
.info-tooltip { position: relative; display: inline-flex; align-items: center; margin-left: 5px; cursor: pointer; color: #94a3b8; font-size: 14px; }
.tooltip-box { position: absolute; bottom: 140%; left: 50%; transform: translateX(-50%); width: 240px; background: #0f172a; color: #fff; font-size: 12px; line-height: 1.5; padding: 10px 14px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,0.15); opacity: 0; visibility: hidden; transition: all 0.15s; z-index: 100; pointer-events: none; }
.tooltip-box::after { content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); border: 7px solid transparent; border-top-color: #0f172a; }
.info-tooltip:hover .tooltip-box { opacity: 1; visibility: visible; }

/* Miscellaneous */
.show-more { font-size: 12px; font-weight: 700; color: #2563eb; cursor: pointer; margin-top: 6px; display: inline-block; }
.wys-toolbar { display: flex; gap: 6px; margin-bottom: 6px; }
.wys-toolbar button { border: 1px solid #e2e8f0; background: #fff; padding: 5px 10px; border-radius: 6px; cursor: pointer; font-size: 12px; }
.wys-editor { border: 1.5px solid #e2e8f0; padding: 12px; min-height: 120px; border-radius: 9px; background: #fff; font-size: 14px; }
.cm-toolbar { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.cm-toolbar button { border: 1px solid #e2e8f0; background: #fff; padding: 5px 9px; border-radius: 6px; cursor: pointer; font-size: 12px; font-family: inherit; }
.cm-editor { border: 1.5px solid #e2e8f0; padding: 12px; min-height: 200px; border-radius: 9px; background: #fff; font-size: 14px; outline: none; }
.cm-input { width: 100%; height: 44px; padding: 0 14px; border-radius: 9px; border: 1.5px solid #e2e8f0; font-size: 14px; font-family: inherit; margin-bottom: 12px; background: #f8fafc; outline: none; }
.cm-btn { padding: 10px 20px; border-radius: 9px; font-weight: 700; font-size: 14px; font-family: inherit; cursor: pointer; border: none; transition: all 0.2s; }
.cm-btn-primary { background: #2563eb; color: #fff; }
.cm-btn-primary:hover { background: #1d4ed8; }
.cm-btn-secondary { background: #f1f5f9; color: #374151; border: 1.5px solid #e2e8f0; }
.cm-btn-secondary:hover { background: #e2e8f0; }
.cm-footer { display: flex; justify-content: flex-end; gap: 10px; padding-top: 12px; border-top: 1px solid #f1f5f9; margin-top: 12px; }

/* Legacy compat */
.filter-bar input { width: auto; }
.modal-footer .btn-secondary, .modal-footer .btn-save, .modal-footer .btn-primary { height: auto; }
.back { margin-bottom: 16px; }
.back button { background: #fff; border: 1.5px solid #e2e8f0; color: #0f172a; padding: 8px 16px; border-radius: 9px; font-weight: 600; font-size: 13px; font-family: inherit; }
.form-grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.form-input, .form-input2 { height: 44px; }
.logoutbtn { background: #fff; border: 1.5px solid #e2e8f0; color: #334155; padding: 8px 16px; border-radius: 9px; font-weight: 600; font-size: 13px; font-family: inherit; }

/* Flatpickr */
.flatpickr-calendar { border-radius: 12px !important; box-shadow: 0 10px 30px rgba(0,0,0,0.1) !important; border: 1px solid #e2e8f0 !important; font-family: 'Inter', sans-serif !important; }
.flatpickr-day.selected, .flatpickr-day.startRange, .flatpickr-day.endRange { background: #2563eb !important; border-color: #2563eb !important; }
.flatpickr-day.inRange { background: #eff6ff !important; border-color: #eff6ff !important; }

/* =============================================
   UI LOGS
============================================= */
.filters { background: #fff; padding: 20px; border-radius: 12px; border: 1px solid #e2e8f0; display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.table-wrap { background: #fff; border-radius: 12px; overflow: auto; border: 1px solid #e2e8f0; }
.changes { background: #f8fafc; border-radius: 8px; padding: 12px; border: 1px solid #e2e8f0; font-family: monospace; font-size: 12px; max-width: 500px; max-height: 200px; overflow: auto; white-space: pre-wrap; word-break: break-word; }
.pagination { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin: 24px auto; }
.pagination a { padding: 9px 14px; border-radius: 8px; background: #fff; border: 1px solid #e2e8f0; color: #475569; font-weight: 600; font-size: 13px; text-decoration: none; transition: all 0.2s; }
.pagination a.active, .pagination a:hover { background: #0f172a; color: #fff; border-color: #0f172a; }
/* =============================================
   RESPONSIVE OVERRIDES
   ============================================= */

/* Mobile Header (Hamburger) */
.mobile-header {
    display: none;
    height: 64px;
    background: #0f172a;
    align-items: center;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 1000;
    justify-content: space-between;
}

.hamburger {
    width: 40px;
    height: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    background: rgba(255,255,255,0.06);
    border-radius: 8px;
    padding: 10px;
}
.hamburger span {
    display: block;
    width: 100%;
    height: 2.5px;
    background: #fff;
    border-radius: 2px;
    transition: 0.3s;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,0.6);
    backdrop-filter: blur(4px);
    z-index: 150;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

@media (max-width: 1024px) {
  body{
    padding:0px !important;
  }
  .sidebar-brand {
        margin-bottom: 0px;
  }
    .sidebar {
        left: -260px;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: none;
    }
    .sidebar.active {
        left: 0;
        box-shadow: 20px 0 50px rgba(0,0,0,0.5);
    }
    .main-content {
        margin-left: 0;
        padding: 24px 20px;
    }
    .mobile-header {
        display: flex;
    }
    
    /* Layout adjustments */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    .page-header .header-actions {
        width: 100%;
        display: flex;
        gap: 10px;
    }
    
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .filter-bar input, .filter-bar select {
        width: 100% !important;
    }
}

@media (max-width: 768px) {
    /* Auth */
    .auth-left { display: none; }
    .auth-right { width: 100%; padding: 40px 24px; }
    .auth-headline { font-size: 32px; }
    
    /* Grids */
    .cpm-grid, .cpm-card-grid, .form-grid, .form-grid2, .body, .grid, .card-header {
        grid-template-columns: 1fr !important;
    }
    
    /* Inline grid overrides */
    [style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }

    /* Modals */
    .modal-content, .modal-box, .app-modal-content, .mocks-modal-content, .tracker-modal-content {
        width: 96vw !important;
        max-width: 96vw !important;
        padding: 20px 16px !important;
        margin: 10px auto !important;
    }
    
    .modal-header, .app-modal-header {
        padding: 16px;
    }
    
    .modal-footer {
        flex-direction: column;
        gap: 8px;
    }
    .modal-footer button {
        width: 100%;
    }
    
    /* Dashboard Cards */
    .card-header {
        flex-direction: column;
        gap: 12px;
    }
    .card-actions {
        width: 100%;
        justify-content: flex-end;
    }
    .card-stats {
        gap: 12px;
    }
    
    /* Tables */
    .table-wrap, .tracker-table-wrapper, .dco-scroll-wrapper {
        margin: 0 -16px;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    
    /* Templates/Mocks */
    #templateGrid, .mocks-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)) !important;
    }
}

@media (max-width: 480px) {
    .auth-form-title { font-size: 24px; }
    .auth-logo-text { font-size: 18px; }
    
    .page-header h1 { font-size: 22px; }
    
    .chip {
        padding: 4px 10px;
        font-size: 11px;
    }
    
    .campaign-card {
        padding: 16px;
    }
}
