/* ==========================================================
   Ttrafik Ads OS — Design System v2
   A modern, light, card-driven UI for the client + admin
   portals. Mobile-first; desktop styles are additive.
   ========================================================== */

:root {
    /* ---- Brand ---- */
    --brand-ink:    #05005B;   /* deep navy — logo / wordmark */
    --brand-gold:   #F5B42A;   /* signature accent — CTAs, highlights */
    --brand-gold-2: #FFCE5C;

    /* ---- Functional palette (modern indigo, light surface) ---- */
    --primary:        #4F46E5;
    --primary-dark:   #3F37C9;
    --primary-light:  #6D62F0;
    --primary-tint:   #EEEDFD;
    --accent:         var(--brand-gold);
    --accent-hover:   var(--brand-gold-2);

    --bg:           #F5F6FB;
    --bg-shell:     #EFF1F9;
    --card:         #FFFFFF;
    --text:         #14152B;
    --text-muted:   #6C7086;
    --text-faint:   #9AA0B4;
    --border:       #E9EAF4;
    --border-soft:  #F1F2F9;

    --success:      #16A34A;
    --success-tint: #E9F9EF;
    --error:        #DC2626;
    --error-tint:   #FDECEC;
    --warning:      #D97706;
    --warning-tint: #FEF3E2;
    --info:         #2563EB;
    --info-tint:    #EAF1FE;

    /* Platform brand chips (used for social channel dots/badges) */
    --plat-instagram: #E1306C;
    --plat-facebook:  #1877F2;
    --plat-linkedin:  #0A66C2;
    --plat-tiktok:    #111827;
    --plat-x:         #111827;

    /* Sidebar — light, modern (matches app surface, not full-bleed dark) */
    --sidebar-bg: #FFFFFF;
    --sidebar-border: var(--border);
    --sidebar-text: #6C7086;
    --sidebar-text-active: var(--primary);
    --sidebar-active-bg: var(--primary-tint);
    --sidebar-icon-active-bg: var(--primary);

    --radius-lg: 20px;
    --radius: 16px;
    --radius-sm: 12px;
    --radius-xs: 8px;

    --shadow-sm: 0 1px 2px rgba(20,21,43,0.04);
    --shadow: 0 4px 16px rgba(20,21,43,0.06);
    --shadow-lg: 0 16px 40px rgba(20,21,43,0.14);
    --shadow-brand: 0 10px 24px rgba(79,70,229,0.25);

    --space-mobile: 16px;
    --space-tablet: 24px;
    --space-desktop: 32px;

    --font: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    --sidebar-width-mobile: min(85vw, 300px);
    --sidebar-width-desktop: 264px;

    --topnav-height: 64px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    font-size: 15.5px;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; height: auto; display: block; }
hr { border: none; border-top: 1px solid var(--border); margin: 24px 0; }

/* ---------------- Typography ---------------- */
h1 { font-size: 24px; line-height: 1.25; margin: 0 0 6px; font-weight: 800; letter-spacing: -0.02em; color: var(--text); }
h2 { font-size: 17px; margin: 28px 0 14px; font-weight: 800; letter-spacing: -0.01em; color: var(--text); }
h3 { font-size: 15px; font-weight: 700; margin: 0 0 8px; }
p, label, input, select, textarea, button { font-size: 15.5px; }
p.subtitle, .page-subtitle { color: var(--text-muted); margin-top: -2px; margin-bottom: 20px; font-size: 14.5px; }

@media (min-width: 768px) {
    h1 { font-size: 27px; }
}
@media (min-width: 1024px) {
    h1 { font-size: 30px; }
}

/* ---------------- Focus visibility ---------------- */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
    outline: 2.5px solid var(--primary);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Utility */
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-error { color: var(--error); }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* ==========================================================
   Auth / Onboarding pages
   ========================================================== */
.auth-page, .onboarding-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: var(--space-mobile);
    background:
        radial-gradient(circle at 12% 8%, rgba(79,70,229,0.10), transparent 42%),
        radial-gradient(circle at 88% 92%, rgba(245,180,42,0.14), transparent 40%),
        var(--bg);
}

.auth-card, .onboarding-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 32px 28px;
    width: 100%;
    max-width: 440px;
}
.onboarding-card { max-width: 580px; }

@media (min-width: 480px) {
    .auth-card, .onboarding-card { padding: 40px 36px; }
}

.auth-card h1, .onboarding-card h1 { margin-bottom: 4px; }
.subtitle { color: var(--text-muted); margin-top: -8px; margin-bottom: 20px; }

/* Brand lockup shown above the login/onboarding form */
.brand-mark {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
}
.brand-mark-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 13px;
    background: linear-gradient(135deg, var(--brand-ink), var(--primary));
    color: var(--brand-gold);
    font-weight: 800;
    font-size: 19px;
    flex-shrink: 0;
    box-shadow: var(--shadow-brand);
}
.brand-mark-text { line-height: 1.15; }
.brand-mark-text strong { display: block; font-size: 16px; font-weight: 800; color: var(--text); }
.brand-mark-text span { display: block; font-size: 12.5px; color: var(--text-muted); font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; }

/* ==========================================================
   Forms — single column, large tap-friendly fields
   ========================================================== */
label { display: block; margin: 14px 0 6px; font-size: 13.5px; font-weight: 700; color: var(--text); }

input[type=text], input[type=email], input[type=password], input[type=tel],
input[type=url], input[type=number], input[type=date], input[type=file],
select, textarea {
    width: 100%;
    min-height: 48px;
    padding: 12px 14px;
    background: var(--card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 15.5px;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 4px var(--primary-tint);
}
textarea { resize: vertical; min-height: 90px; }
::placeholder { color: var(--text-faint); }

.checkbox { display: flex; align-items: center; gap: 10px; font-size: 14.5px; min-height: 44px; color: var(--text-muted); }
.checkbox input { width: 19px; height: 19px; flex-shrink: 0; accent-color: var(--primary); }

.form-row { display: flex; flex-direction: column; }
@media (min-width: 600px) {
    .form-row-pair { display: flex; gap: 16px; }
    .form-row-pair > * { flex: 1; }
}

/* ==========================================================
   Buttons
   ========================================================== */
.btn-primary, .btn-secondary, .btn-small {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 0 20px;
    border-radius: var(--radius-sm);
    border: none;
    font-family: inherit;
    font-weight: 700;
    font-size: 14.5px;
    cursor: pointer;
    margin-top: 14px;
    margin-right: 8px;
    transition: background-color 150ms ease, transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
    text-decoration: none;
    white-space: nowrap;
}
.btn-primary:active, .btn-secondary:active, .btn-small:active { transform: scale(0.98); }

.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 6px 16px rgba(79,70,229,0.28); }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-secondary { background: var(--card); border: 1.5px solid var(--border); color: var(--text); }
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.btn-small { min-height: 38px; padding: 0 14px; font-size: 13px; margin-top: 0; border-radius: var(--radius-xs); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--error); color: #fff; }
.btn-warning { background: var(--accent); color: #1A1A1A; }
.btn-warning:hover { background: var(--accent-hover); }

.btn-block { width: 100%; }
@media (max-width: 480px) {
    form > .btn-primary:last-child,
    .results-submit-btn { width: 100%; }
}

.alert { display: flex; align-items: center; gap: 10px; padding: 13px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 14px; font-weight: 500; }
.alert-error { background: var(--error-tint); border: 1px solid rgba(220,38,38,0.25); color: #a7231e; }
.alert-success { background: var(--success-tint); border: 1px solid rgba(22,163,74,0.25); color: #147a4c; }

.auth-links { text-align: center; margin-top: 22px; font-size: 14px; color: var(--text-muted); }

/* Onboarding steps */
.step-dots { display: flex; justify-content: center; gap: 8px; margin-bottom: 22px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); transition: all 200ms ease; }
.dot.active { background: var(--primary); width: 22px; border-radius: 5px; }
.radio-group { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.radio-group label {
    display: flex; align-items: center; gap: 10px; color: var(--text); font-size: 15px; font-weight: 500;
    min-height: 46px; margin: 0; padding: 0 14px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
}
.radio-group label:has(input:checked) { border-color: var(--primary); background: var(--primary-tint); }
.radio-group input { width: 19px; height: 19px; accent-color: var(--primary); }

/* ==========================================================
   App Shell — sidebar + topnav
   ========================================================== */
.app-shell { min-height: 100vh; background: var(--bg); }

.topnav {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--topnav-height);
    padding: 0 var(--space-mobile);
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    gap: 12px;
}
.topnav-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topnav-title { font-weight: 800; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -0.01em; }
.topnav-right { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }

/* Search box in topnav (desktop) */
.topnav-search {
    display: none;
    align-items: center;
    gap: 8px;
    background: var(--bg-shell);
    border: 1.5px solid transparent;
    border-radius: 12px;
    padding: 0 14px;
    height: 42px;
    width: 100%;
    max-width: 340px;
    color: var(--text-faint);
    transition: border-color 150ms ease, background 150ms ease;
}
.topnav-search:focus-within { background: var(--card); border-color: var(--primary); color: var(--text-muted); }
.topnav-search svg { flex-shrink: 0; }
.topnav-search input {
    border: none; min-height: unset; height: 100%; padding: 0; background: transparent;
    font-size: 14.5px; color: var(--text);
}
.topnav-search input:focus { box-shadow: none; }
@media (min-width: 1024px) { .topnav-search { display: flex; } }

.icon-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--text-muted);
}
.icon-btn svg { width: 21px; height: 21px; }
.icon-btn:hover { background: var(--bg-shell); color: var(--text); }

.notif-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--error);
    border: 2px solid var(--card);
}

/* User chip in topnav (desktop) */
.user-chip {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 6px 10px 6px 6px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--card);
    cursor: pointer;
    margin-left: 4px;
}
.user-chip:hover { border-color: var(--primary); }
.user-chip .avatar { width: 30px; height: 30px; font-size: 12.5px; }
.user-chip-meta { text-align: left; line-height: 1.2; }
.user-chip-name { font-size: 13px; font-weight: 700; color: var(--text); display: block; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip-role { font-size: 11px; color: var(--text-muted); text-transform: capitalize; }
.user-chip svg { color: var(--text-faint); }
@media (min-width: 1024px) { .user-chip { display: flex; } }

.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--brand-ink));
    color: #fff;
    font-weight: 800;
    font-size: 13.5px;
    flex-shrink: 0;
}

/* Hamburger */
.hamburger-btn {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 42px;
    height: 42px;
    background: none;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    flex-shrink: 0;
}
.hamburger-btn:hover { background: var(--bg-shell); }
.hamburger-btn span {
    display: block;
    width: 19px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform 300ms ease, opacity 200ms ease;
}
.hamburger-btn span + span { margin-top: 5px; }
.hamburger-btn[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger-btn[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.hamburger-btn[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Sidebar overlay (mobile off-canvas) */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10,10,40,0.45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 45;
    opacity: 0;
    pointer-events: none;
    transition: opacity 300ms ease;
}
.sidebar-overlay.visible { opacity: 1; pointer-events: auto; }

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width-mobile);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    padding: 20px 14px;
    z-index: 50;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 300ms ease-in-out;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
}
.sidebar.nav-open { transform: translateX(0); }

.sidebar-brand {
    font-weight: 800;
    margin-bottom: 22px;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 11px;
    color: var(--text);
    padding: 4px 6px;
}
.sidebar-brand-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--brand-ink), var(--primary));
    color: var(--brand-gold);
    font-weight: 800;
    font-size: 16px;
    flex-shrink: 0;
    box-shadow: var(--shadow-brand);
}
.sidebar-brand-text { line-height: 1.2; flex: 1; min-width: 0; }
.sidebar-brand-text small { display: block; color: var(--text-muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.03em; }

.sidebar-close-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    border-radius: 10px;
    flex-shrink: 0;
}
.sidebar-close-btn:hover { background: var(--bg-shell); }

.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar-section-label {
    font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--text-faint); margin: 16px 10px 6px;
}
.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 44px;
    padding: 0 12px;
    border-radius: 12px;
    color: var(--sidebar-text);
    font-weight: 600;
    font-size: 14.5px;
}
.sidebar nav a svg { flex-shrink: 0; opacity: 0.85; }
.sidebar nav a.active {
    background: var(--sidebar-active-bg);
    color: var(--sidebar-text-active);
    font-weight: 700;
}
.sidebar nav a.active svg { opacity: 1; }
.sidebar nav a:hover { background: var(--bg-shell); color: var(--text); }
.sidebar nav a.logout-link { color: var(--error); margin-top: 4px; }
.sidebar nav a.logout-link:hover { background: var(--error-tint); }

.sidebar-footer-card {
    margin-top: 14px;
    padding: 14px;
    border-radius: var(--radius);
    background: linear-gradient(135deg, var(--brand-ink), #14126e);
    color: #fff;
}
.sidebar-footer-card strong { display: block; font-size: 13px; margin-bottom: 4px; }
.sidebar-footer-card p { margin: 0 0 10px; font-size: 12px; color: rgba(255,255,255,0.75); }
.sidebar-footer-card a {
    display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700;
    color: var(--brand-gold);
}

.main-content {
    padding: var(--space-mobile);
    max-width: 1180px;
    min-width: 0;
    padding-bottom: calc(var(--space-mobile) + env(safe-area-inset-bottom));
}

/* ---- Desktop: permanent sidebar ---- */
@media (min-width: 1024px) {
    .app-shell { display: flex; }
    .topnav { display: flex; }
    .hamburger-btn, .sidebar-close-btn, .sidebar-overlay { display: none !important; }
    .sidebar {
        position: sticky;
        top: 0;
        height: 100vh;
        width: var(--sidebar-width-desktop);
        transform: none;
        flex-shrink: 0;
        padding: 22px 14px;
    }
    .main-content { flex: 1; padding: var(--space-desktop); }
}

@media (min-width: 768px) and (max-width: 1023px) {
    .main-content { padding: var(--space-tablet); }
}

/* ==========================================================
   Notification drawer & profile bottom sheet
   ========================================================== */
.notif-drawer, .profile-sheet {
    position: fixed;
    z-index: 60;
    background: var(--card);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms ease, transform 220ms ease;
    border: 1px solid var(--border);
}
.notif-drawer {
    top: var(--topnav-height);
    left: 0;
    right: 0;
    border-radius: 0 0 var(--radius) var(--radius);
    padding: 14px;
    transform: translateY(-10px);
    max-height: 70vh;
    overflow-y: auto;
}
.notif-drawer.open { opacity: 1; pointer-events: auto; transform: translateY(0); }
.notif-drawer h2 { display: flex; align-items: center; justify-content: space-between; font-size: 15px; }

.profile-sheet {
    left: 0; right: 0; bottom: 0;
    border-radius: 20px 20px 0 0;
    padding: 12px 14px calc(16px + env(safe-area-inset-bottom));
    transform: translateY(20px);
}
.profile-sheet.open { opacity: 1; pointer-events: auto; transform: translateY(0); }
.profile-sheet-handle { width: 36px; height: 4px; background: var(--border); border-radius: 4px; margin: 4px auto 14px; }
.profile-sheet a, .profile-sheet button {
    display: flex; align-items: center; gap: 10px; width: 100%;
    min-height: 46px; padding: 0 10px; background: none; border: none;
    font-size: 15px; color: var(--text); text-align: left; cursor: pointer; border-radius: var(--radius-sm); font-weight: 600;
}
.profile-sheet a:hover, .profile-sheet button:hover { background: var(--bg-shell); }

@media (min-width: 1024px) {
    .notif-drawer { top: 60px; right: 16px; left: auto; width: 340px; border-radius: var(--radius); }
    .profile-sheet {
        left: auto; right: 16px; bottom: auto; top: 60px;
        width: 230px; border-radius: var(--radius);
        transform: translateY(-8px);
    }
    .profile-sheet.open { transform: translateY(0); }
}

.notif-item { padding: 10px 6px; border-bottom: 1px solid var(--border-soft); font-size: 13.5px; border-radius: 10px; }
.notif-item:hover { background: var(--bg-shell); }
.notif-item:last-child { border-bottom: none; }
.notif-empty { color: var(--text-muted); font-size: 14px; padding: 20px 6px; text-align: center; }

/* ==========================================================
   Page header (title + subtitle + action) — new utility
   ========================================================== */
.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}
.page-head h1 { margin-bottom: 4px; }
.page-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.page-head-actions .btn-primary, .page-head-actions .btn-secondary { margin-top: 0; }

.greeting-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    background: linear-gradient(120deg, var(--brand-ink) 0%, var(--primary) 100%);
    color: #fff;
    border-radius: var(--radius-lg);
    padding: 24px 26px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    position: relative;
    overflow: hidden;
}
.greeting-banner::after {
    content: "";
    position: absolute;
    right: -40px; top: -60px;
    width: 200px; height: 200px;
    background: radial-gradient(circle, rgba(245,180,42,0.35), transparent 70%);
}
.greeting-banner h1 { color: #fff; margin-bottom: 6px; }
.greeting-banner p { color: rgba(255,255,255,0.78); margin: 0; max-width: 480px; font-size: 14.5px; }
.greeting-banner .btn-primary { background: var(--accent); color: #1A1A1A; margin-top: 0; box-shadow: none; }
.greeting-banner .btn-primary:hover { background: var(--accent-hover); }

/* ==========================================================
   Cards, stats
   ========================================================== */
.stat-grid { display: grid; grid-template-columns: 1fr; gap: 14px; margin-bottom: 26px; }
@media (min-width: 480px) { .stat-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px) { .stat-grid { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); } }

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 180ms ease, transform 180ms ease;
    position: relative;
}
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.stat-card-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 14px; }
.stat-icon {
    width: 40px; height: 40px; border-radius: 12px;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--primary-tint); color: var(--primary);
}
.stat-icon.gold { background: var(--warning-tint); color: #A6710F; }
.stat-icon.green { background: var(--success-tint); color: var(--success); }
.stat-icon.red { background: var(--error-tint); color: var(--error); }
.stat-icon.blue { background: var(--info-tint); color: var(--info); }
.stat-trend { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 20px; }
.stat-trend.up { color: var(--success); background: var(--success-tint); }
.stat-trend.down { color: var(--error); background: var(--error-tint); }
.stat-label { display: block; color: var(--text-muted); font-size: 13px; font-weight: 600; }
.stat-value { display: block; font-size: 25px; font-weight: 800; margin-top: 4px; letter-spacing: -0.01em; }
.stat-link { display: inline-flex; align-items: center; gap: 4px; margin-top: 10px; font-size: 13px; font-weight: 700; }

.filter-bar { display: flex; gap: 8px; margin-bottom: 18px; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
.filter-bar a {
    flex-shrink: 0; min-height: 38px; display: inline-flex; align-items: center; padding: 0 16px;
    border-radius: 20px; background: var(--card); border: 1px solid var(--border); color: var(--text-muted);
    font-size: 13.5px; font-weight: 600;
}
.filter-bar a.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Generic content card wrapper (used for chart panels, activity lists, etc.) */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 20px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; }
.card-head h2 { margin: 0; font-size: 15.5px; }
.card-head-link { font-size: 13px; font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }
.dashboard-grid { display: grid; grid-template-columns: 1fr; gap: 20px; margin-bottom: 24px; }
@media (min-width: 1024px) { .dashboard-grid { grid-template-columns: 1.3fr 1fr; align-items: start; } }
.dashboard-grid-3 { display: grid; grid-template-columns: 1fr; gap: 20px; }
@media (min-width: 1024px) { .dashboard-grid-3 { grid-template-columns: repeat(3, 1fr); } }

/* Simple CSS bar chart used on dashboards */
.bar-chart { display: flex; align-items: flex-end; justify-content: space-around; gap: 18px; height: 200px; padding: 8px 4px 0; }
.bar-chart-col { display: flex; flex-direction: column; align-items: center; gap: 10px; flex: 1; height: 100%; justify-content: flex-end; }
.bar-chart-bar { width: 100%; max-width: 56px; border-radius: 10px 10px 4px 4px; background: var(--primary); position: relative; transition: opacity 150ms ease; }
.bar-chart-bar:hover { opacity: 0.85; }
.bar-chart-bar span { position: absolute; top: -22px; left: 50%; transform: translateX(-50%); font-size: 12px; font-weight: 700; color: var(--text); white-space: nowrap; }
.bar-chart-label { font-size: 12.5px; color: var(--text-muted); font-weight: 600; }

/* Activity / list rows (shared by "recent activity", "upcoming posts", messages) */
.list-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 4px;
    border-bottom: 1px solid var(--border-soft);
}
.list-row:last-child { border-bottom: none; }
.list-row-icon {
    width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--primary-tint); color: var(--primary); font-weight: 800; font-size: 13px; text-transform: uppercase;
}
.list-row-icon.ig { background: rgba(225,48,108,0.12); color: var(--plat-instagram); }
.list-row-icon.fb { background: rgba(24,119,242,0.12); color: var(--plat-facebook); }
.list-row-icon.li { background: rgba(10,102,194,0.12); color: var(--plat-linkedin); }
.list-row-body { flex: 1; min-width: 0; }
.list-row-title { font-weight: 700; font-size: 14px; color: var(--text); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row-meta { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; text-transform: capitalize; }
.list-row-side { flex-shrink: 0; }

/* ==========================================================
   Tables → cards on mobile
   ========================================================== */
.data-table-wrap { width: 100%; }
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); border: 1px solid var(--border); }
.data-table th, .data-table td { padding: 13px 16px; text-align: left; border-bottom: 1px solid var(--border-soft); font-size: 13.5px; }
.data-table th { background: var(--bg-shell); color: var(--text-muted); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; }
.data-table tbody tr:hover { background: var(--bg-shell); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table .actions { display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 767px) {
    .data-table thead { display: none; }
    .data-table, .data-table tbody, .data-table tr, .data-table td { display: block; width: 100%; }
    .data-table tr {
        margin-bottom: 12px;
        border: 1px solid var(--border);
        border-radius: var(--radius);
        padding: 4px 0;
        background: var(--card);
    }
    .data-table td {
        border-bottom: none;
        padding: 8px 16px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        text-align: right;
    }
    .data-table td[data-label]::before {
        content: attr(data-label);
        font-weight: 700;
        color: var(--text-muted);
        font-size: 12px;
        text-align: left;
        flex-shrink: 0;
    }
    .data-table td.actions { justify-content: flex-start; }
    .data-table td.actions::before { display: none; }
}

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px; border-radius: 20px; font-size: 11.5px; font-weight: 700; text-transform: capitalize; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.badge-active, .badge-paid, .badge-approved { background: var(--success-tint); color: #147a4c; }
.badge-lead { background: var(--warning-tint); color: #8a6110; }
.badge-pending, .badge-draft { background: var(--warning-tint); color: #8a6110; }
.badge-suspended, .badge-rejected, .badge-cancelled, .badge-overdue { background: var(--error-tint); color: #a7231e; }
.badge-completed, .badge-paused { background: var(--border-soft); color: var(--text-muted); }
.badge-scheduled { background: var(--info-tint); color: var(--info); }

.panel-form { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 22px; max-width: 100%; margin-bottom: 20px; }
@media (min-width: 480px) { .panel-form { padding: 26px; max-width: 520px; } }

.message-thread { margin-bottom: 20px; }
.message { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 12px 16px; margin-bottom: 10px; }
.message-admin { border-left: 3px solid var(--accent); }
.message-client { border-left: 3px solid var(--primary); }

.file-list { list-style: none; padding: 0; }
.file-list li {
    background: var(--card); border: 1px solid var(--border); border-radius: 12px;
    padding: 12px 16px; margin-bottom: 8px; font-size: 14px;
    display: flex; align-items: center; gap: 10px;
}

/* ==========================================================
   Empty states
   ========================================================== */
.empty-state {
    text-align: center;
    padding: 52px 20px;
    color: var(--text-muted);
    background: var(--card);
    border: 1.5px dashed var(--border);
    border-radius: var(--radius);
}
.empty-state-icon { font-size: 36px; margin-bottom: 12px; opacity: 0.8; }
.empty-state-title { font-weight: 800; color: var(--text); margin-bottom: 4px; font-size: 15.5px; }

/* ==========================================================
   Kanban board
   ========================================================== */
.kanban-board { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: start; }
@media (min-width: 600px) { .kanban-board { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px) { .kanban-board { grid-template-columns: repeat(4, 1fr); } }

.kanban-column { background: var(--bg-shell); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; min-height: 100px; }
.kanban-column h3 { margin: 0 0 12px; font-size: 14px; display: flex; justify-content: space-between; align-items: center; }
.kanban-count { background: var(--card); color: var(--text-muted); font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: 10px; border: 1px solid var(--border); }
.kanban-empty { color: var(--text-faint); font-size: 13.5px; }
.kanban-card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin-bottom: 10px; font-size: 14px; border-left: 3px solid var(--border); box-shadow: var(--shadow-sm); }
.kanban-card.priority-urgent { border-left-color: var(--error); }
.kanban-card.priority-high { border-left-color: var(--warning); }
.kanban-card.priority-normal { border-left-color: var(--primary); }
.kanban-card.priority-low { border-left-color: var(--text-faint); }
.kanban-meta { color: var(--text-muted); font-size: 12px; margin-top: 4px; }
.kanban-desc { margin: 6px 0; color: var(--text-muted); font-size: 13px; }
.kanban-actions { display: flex; gap: 8px; margin-top: 8px; align-items: center; flex-wrap: wrap; }
.kanban-actions select { width: auto; min-height: 38px; padding: 4px 8px; font-size: 13px; }

/* ==========================================================
   Results logging (campaign performance)
   ========================================================== */
.results-form-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 22px;
    max-width: 480px;
    margin-bottom: 28px;
}
.results-submit-btn { width: 100%; font-size: 15px; }
.results-history { display: flex; flex-direction: column; gap: 12px; max-width: 480px; }
.results-entry { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow-sm); }
.results-entry-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.results-entry-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 480px) { .results-entry-grid { grid-template-columns: repeat(3, 1fr); } }
.results-label { display: block; color: var(--text-muted); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.02em; }
.results-value { display: block; font-size: 16px; font-weight: 800; margin-top: 2px; }
.results-notes { margin: 8px 0 0; color: var(--text-muted); font-size: 13px; font-style: italic; }

/* ==========================================================
   Floating action button
   ========================================================== */
.fab {
    position: fixed;
    right: 20px;
    bottom: calc(20px + env(safe-area-inset-bottom));
    z-index: 35;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 52px;
    padding: 0 22px;
    background: var(--accent);
    color: #1A1A1A;
    border-radius: 30px;
    font-weight: 800;
    font-size: 14.5px;
    box-shadow: 0 10px 26px rgba(245,180,42,0.45);
    border: none;
    cursor: pointer;
    text-decoration: none;
}
.fab:hover { background: var(--accent-hover); color: #1A1A1A; }
.fab-icon { font-size: 20px; line-height: 1; }

@media (min-width: 1024px) {
    .fab { right: 32px; bottom: 32px; }
}

.skeleton { background: linear-gradient(90deg, var(--border) 25%, #f4f5fb 37%, var(--border) 63%); background-size: 400% 100%; animation: skeleton-loading 1.4s ease infinite; border-radius: 8px; }
.skeleton-line { height: 14px; margin-bottom: 8px; }
@keyframes skeleton-loading { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.page-fade-in { animation: page-fade 220ms ease; }
@keyframes page-fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* ==========================================================
   Client Performance Reports (screen + print)
   ========================================================== */
.report-container { max-width: 820px; }
.report-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 22px; padding-bottom: 18px; border-bottom: 2px solid var(--primary); }
.report-brand { font-weight: 800; color: var(--brand-ink); font-size: 18px; }
.report-summary { margin-bottom: 8px; }
.report-campaign-block { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 12px; box-shadow: var(--shadow-sm); }
.report-footer { color: var(--text-muted); font-size: 12px; text-align: center; margin-top: 32px; }

@media print {
    .no-print, .sidebar, .topnav, .sidebar-overlay, .notif-drawer, .profile-sheet, .fab { display: none !important; }
    .app-shell { display: block !important; }
    .main-content { padding: 0 !important; max-width: 100% !important; }
    body { background: #fff !important; }
    .report-container { max-width: 100% !important; }
    .stat-card, .report-campaign-block, .data-table { box-shadow: none !important; border: 1px solid #ccc !important; }
    a { color: var(--text) !important; text-decoration: none !important; }
    .data-table thead { display: table-header-group !important; }
    .data-table, .data-table tbody, .data-table tr, .data-table td { display: revert !important; width: revert !important; }
    .data-table td[data-label]::before { display: none !important; }
}
