/* ===========================================================
   Dashboard CSS — Pitech Scan v3.0
   Material Design 3 · Mobile-First Architecture
   =========================================================== */

/* === MD3 DESIGN TOKENS === */
:root {
    /* Design system matching register.php */
    --primary: #0066FF;
    --primary-hover: #0052CC;
    --primary-light: rgba(0, 102, 255, 0.08);
    --bg-base: #F8FAFC;
    --text-main: #0F172A;
    --text-muted: #475569;
    --border-color: #E2E8F0;
    --font-brand: 'Plus Jakarta Sans', 'Inter', sans-serif;
    --font-body: 'Inter', sans-serif;

    /* MD3 Primary Tonal Palette overrides */
    --m3-primary: #0066FF;
    --m3-on-primary: #FFFFFF;
    --m3-primary-container: rgba(0, 102, 255, 0.08);
    --m3-on-primary-container: #0066FF;
    --m3-inverse-primary: #D0BCFF;

    /* MD3 Secondary overrides */
    --m3-secondary: #475569;
    --m3-on-secondary: #FFFFFF;
    --m3-secondary-container: #E2E8F0;
    --m3-on-secondary-container: #0F172A;

    /* MD3 Tertiary overrides */
    --m3-tertiary: #10B981;
    --m3-on-tertiary: #FFFFFF;
    --m3-tertiary-container: rgba(16, 185, 129, 0.08);

    /* MD3 Error / Success overrides */
    --m3-error: #EF4444;
    --m3-error-container: #FEE2E2;
    --m3-success: #10B981;
    --m3-success-container: rgba(16, 185, 129, 0.08);

    /* MD3 Surface Tonal System overrides */
    --m3-surface: #F8FAFC;
    --m3-surface-dim: #E2E8F0;
    --m3-surface-bright: #FFFFFF;
    --m3-surface-container-lowest: #FFFFFF;
    --m3-surface-container-low: #F8FAFC;
    --m3-surface-container: #FFFFFF;
    --m3-surface-container-high: #FFFFFF;
    --m3-surface-container-highest: #FFFFFF;
    --m3-on-surface: #0F172A;
    --m3-on-surface-variant: #475569;
    --m3-outline: #94A3B8;
    --m3-outline-variant: #E2E8F0;

    /* MD3 Elevation Shadows overrides */
    --m3-elevation-0: none;
    --m3-elevation-1: 0 2px 4px rgba(0,0,0,0.02), 0 1px 2px rgba(0,0,0,0.02);
    --m3-elevation-2: 0 4px 8px rgba(0,0,0,0.04), 0 2px 4px rgba(0,0,0,0.04);
    --m3-elevation-3: 0 12px 24px rgba(0,0,0,0.04), 0 4px 8px rgba(0,0,0,0.04);
    --m3-elevation-4: 0 20px 40px rgba(0,0,0,0.06), 0 8px 16px rgba(0,0,0,0.06);
    --m3-elevation-5: 0 30px 60px rgba(0,0,0,0.08), 0 12px 24px rgba(0,0,0,0.08);

    /* Transitions (MD3 motion spec) */
    --m3-motion-standard: cubic-bezier(0.4, 0, 0.2, 1);
    --m3-motion-emphasized: cubic-bezier(0.4, 0, 0.2, 1);
    --m3-motion-emphasized-decelerate: cubic-bezier(0, 0, 0.2, 1);
    --m3-motion-emphasized-accelerate: cubic-bezier(0.4, 0, 1, 1);
    --m3-duration-short: 150ms;
    --m3-duration-medium: 300ms;
    --m3-duration-long: 450ms;

    /* Shape Scale (MD3) */
    --m3-shape-xs: 8px;
    --m3-shape-sm: 12px;
    --m3-shape-md: 16px;
    --m3-shape-lg: 24px;
    --m3-shape-xl: 32px;
    --m3-shape-full: 9999px;
}

/* === RESET & BASE (Mobile-First) === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Google Sans', 'Roboto', system-ui, -apple-system, sans-serif;
    background-color: var(--m3-surface);
    color: var(--m3-on-surface);
    line-height: 1.5;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    position: relative;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Subtle animated mesh background */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(ellipse at 15% 10%, rgba(103, 80, 164, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 85% 70%, rgba(125, 82, 96, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 90%, rgba(103, 80, 164, 0.03) 0%, transparent 50%);
    animation: meshShift 30s ease infinite alternate;
    will-change: transform;
}

@keyframes meshShift {
    0% { transform: scale(1) translate(0, 0); }
    50% { transform: scale(1.03) translate(-0.5%, 0.5%); }
    100% { transform: scale(1) translate(0.5%, -0.5%); }
}

h1, h2, h3, .link-title { font-family: 'Google Sans', sans-serif; font-weight: 700; }

/* === LAYOUT (Mobile-First) === */
.main-content {
    flex: 1;
    padding: 16px;
    padding-top: 80px;
    padding-bottom: 100px;
    min-height: 100vh;
    min-height: 100dvh;
    max-width: 1100px;
    transition: margin-left var(--m3-duration-medium) var(--m3-motion-standard);
}

/* Tablet */
@media (min-width: 600px) {
    .main-content {
        padding: 24px 20px;
        padding-top: 88px;
        padding-bottom: 120px;
    }
}

/* Desktop */
@media (min-width: 1024px) {
    .main-content {
        margin-left: 280px;
        padding: 40px 48px;
        padding-top: 40px;
        padding-bottom: 48px;
    }
}

@media (min-width: 1200px) {
    .main-content {
        padding: 48px 56px;
    }
}

body:has(.sidebar.collapsed) .main-content {
    margin-left: 88px;
}

@media (max-width: 1023px) {
    body:has(.sidebar.collapsed) .main-content {
        margin-left: 0 !important;
    }
}

/* === HEADER (Mobile-First) === */
.header {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
    align-items: flex-start;
}

.header h1 {
    font-size: 24px;
    color: var(--m3-on-surface);
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--m3-primary) 0%, var(--m3-tertiary) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.2;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    width: 100%;
}

@media (min-width: 600px) {
    .header {
        flex-direction: row;
        align-items: flex-end;
        justify-content: space-between;
        gap: 20px;
        margin-bottom: 32px;
    }

    .header h1 {
        font-size: clamp(26px, 3.5vw, 34px);
    }

    .header-actions {
        width: auto;
        flex-wrap: nowrap;
    }
}

@media (min-width: 768px) {
    .header {
        margin-bottom: 36px;
    }
}

/* === MD3 BUTTONS === */
.btn-primary, .btn-add {
    background: var(--m3-primary);
    color: white !important;
    border: none;
    padding: 10px 20px;
    border-radius: var(--m3-shape-full);
    font-family: 'Google Sans', sans-serif;
    font-weight: 600;
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: var(--m3-elevation-1);
    transition: all var(--m3-duration-short) var(--m3-motion-standard);
    text-decoration: none;
    white-space: nowrap;
    min-height: 40px;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.1px;
}

.btn-primary:hover, .btn-add:hover {
    box-shadow: var(--m3-elevation-3);
    filter: brightness(1.06);
}

.btn-primary:active, .btn-add:active {
    transform: scale(0.97);
    box-shadow: var(--m3-elevation-1);
}

.btn-text {
    background: none;
    border: none;
    color: var(--m3-primary);
    font-weight: 600;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: var(--m3-shape-full);
    transition: all var(--m3-duration-short) var(--m3-motion-standard);
    font-family: 'Google Sans', sans-serif;
    text-decoration: none;
    font-size: 14px;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    letter-spacing: 0.1px;
}

.btn-text:hover { background: var(--m3-primary-container); }
.btn-text:active { transform: scale(0.97); }

@media (min-width: 600px) {
    .btn-primary, .btn-add {
        padding: 12px 24px;
    }
}

/* === PROFILE CARD (Mobile-First) === */
.profile-card-premium {
    background: var(--m3-surface-container-lowest);
    border-radius: var(--m3-shape-xl);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    border: 1px solid var(--m3-outline-variant);
    box-shadow: var(--m3-elevation-1);
    transition: all var(--m3-duration-medium) var(--m3-motion-standard);
    position: relative;
    overflow: hidden;
}

.profile-card-premium::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 3px;
    background: linear-gradient(90deg, var(--m3-primary), var(--m3-tertiary));
    opacity: 0;
    transition: opacity var(--m3-duration-short) var(--m3-motion-standard);
}

.profile-card-premium:hover::before { opacity: 1; }

.profile-card-premium:hover {
    box-shadow: var(--m3-elevation-3);
    border-color: var(--m3-outline);
}

.profile-card-premium .avatar-large {
    width: 56px;
    height: 56px;
    border-radius: var(--m3-shape-lg);
    object-fit: cover;
    border: 2px solid var(--m3-surface-container-lowest);
    box-shadow: var(--m3-elevation-2);
    flex-shrink: 0;
}

.profile-card-premium .info { flex: 1; min-width: 0; }

.profile-card-premium .name {
    font-size: 18px;
    font-weight: 700;
    color: var(--m3-on-surface);
    font-family: 'Google Sans', sans-serif;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-card-premium .email {
    font-size: 13px;
    color: var(--m3-on-surface-variant);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (min-width: 480px) {
    .profile-card-premium {
        padding: 24px;
        gap: 20px;
    }
    .profile-card-premium .avatar-large {
        width: 68px;
        height: 68px;
        border-radius: 20px;
    }
    .profile-card-premium .name { font-size: 20px; }
}

@media (min-width: 600px) {
    .profile-card-premium {
        padding: 28px 32px;
        gap: 24px;
        margin-bottom: 32px;
    }
    .profile-card-premium .avatar-large {
        width: 80px;
        height: 80px;
        border-radius: 24px;
    }
    .profile-card-premium .name { font-size: 22px; }
    .profile-card-premium .email { font-size: 14px; }
}

/* === STATS GRID (Mobile-First) === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--m3-surface-container-lowest);
    padding: 16px;
    border-radius: var(--m3-shape-xl);
    border: 1px solid var(--m3-outline-variant);
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: all var(--m3-duration-medium) var(--m3-motion-emphasized);
    position: relative;
    overflow: hidden;
    cursor: default;
    box-shadow: var(--m3-elevation-1);
}

.stat-card::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0;
    width: 100%; height: 3px;
    background: linear-gradient(90deg, var(--m3-primary), var(--m3-tertiary));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--m3-duration-medium) var(--m3-motion-emphasized);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--m3-elevation-4);
    border-color: var(--m3-outline);
}

.stat-card:hover::after { transform: scaleX(1); }

.stat-card .icon-box {
    width: 40px;
    height: 40px;
    border-radius: var(--m3-shape-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--m3-primary-container);
    color: var(--m3-on-primary-container);
    transition: all var(--m3-duration-short) var(--m3-motion-standard);
}

.stat-card .icon-box .material-symbols-rounded { font-size: 20px; }

.stat-card:hover .icon-box {
    background: var(--m3-primary);
    color: var(--m3-on-primary);
}

.stat-card .val {
    font-size: 24px;
    font-weight: 800;
    font-family: 'Google Sans', sans-serif;
    color: var(--m3-on-surface);
    line-height: 1;
}

.stat-card .label {
    font-size: 11px;
    color: var(--m3-on-surface-variant);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

@media (min-width: 480px) {
    .stats-grid { gap: 14px; }
    .stat-card { padding: 20px; gap: 12px; }
    .stat-card .icon-box { width: 44px; height: 44px; border-radius: var(--m3-shape-lg); }
    .stat-card .icon-box .material-symbols-rounded { font-size: 22px; }
    .stat-card .val { font-size: 28px; }
    .stat-card .label { font-size: 12px; }
}

@media (min-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 16px;
        margin-bottom: 36px;
    }
    .stat-card { padding: 24px; }
    .stat-card .icon-box { width: 48px; height: 48px; }
    .stat-card .icon-box .material-symbols-rounded { font-size: 24px; }
    .stat-card .val { font-size: 32px; }
}

@media (min-width: 1024px) {
    .stats-grid { margin-bottom: 40px; gap: 20px; }
}

/* === QUICK ACTIONS (Mobile-First) === */
.quick-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
}

.quick-actions::-webkit-scrollbar { display: none; }

.quick-action-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--m3-shape-sm);
    background: var(--m3-surface-container-lowest);
    border: 1px solid var(--m3-outline-variant);
    color: var(--m3-on-surface);
    font-family: 'Google Sans', sans-serif;
    font-weight: 600;
    font-size: 13px;
    text-decoration: none;
    transition: all var(--m3-duration-short) var(--m3-motion-standard);
    cursor: pointer;
    white-space: nowrap;
    min-height: 36px;
    scroll-snap-align: start;
    flex-shrink: 0;
    box-shadow: var(--m3-elevation-0);
}

.quick-action-chip:hover {
    background: var(--m3-primary-container);
    border-color: var(--m3-primary);
    color: var(--m3-on-primary-container);
    box-shadow: var(--m3-elevation-1);
}

.quick-action-chip:active {
    transform: scale(0.96);
}

.quick-action-chip .material-symbols-rounded { font-size: 18px; }

@media (min-width: 600px) {
    .quick-actions {
        gap: 10px;
        margin-bottom: 28px;
        overflow-x: visible;
        flex-wrap: wrap;
    }

    .quick-action-chip {
        padding: 10px 20px;
        font-size: 13px;
        min-height: 40px;
        border-radius: var(--m3-shape-md);
    }
}

@media (min-width: 768px) {
    .quick-actions { gap: 12px; margin-bottom: 32px; }
}

/* === LINK LIST (Mobile-First) === */
#link-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.link-item {
    background: var(--m3-surface-container-lowest);
    border: 1px solid var(--m3-outline-variant);
    padding: 14px;
    border-radius: var(--m3-shape-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--m3-elevation-1);
    position: relative;
    overflow: hidden;
    transition: all var(--m3-duration-short) var(--m3-motion-standard);
}

.link-item::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 3px; height: 100%;
    background: linear-gradient(180deg, var(--m3-primary), var(--m3-tertiary));
    opacity: 0;
    transition: opacity var(--m3-duration-short) var(--m3-motion-standard);
}

.link-item:hover {
    box-shadow: var(--m3-elevation-3);
    border-color: var(--m3-outline);
    transform: translateX(2px);
}

.link-item:hover::before { opacity: 1; }

.drag-handle {
    cursor: grab;
    color: var(--m3-outline);
    opacity: 0.2;
    transition: opacity var(--m3-duration-short);
    font-size: 20px;
    display: none;
}

.link-item:hover .drag-handle { opacity: 0.6; }

.brand-preview {
    width: 40px;
    height: 40px;
    background: var(--m3-surface-container);
    border-radius: var(--m3-shape-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--m3-duration-short) var(--m3-motion-standard);
    border: 1px solid var(--m3-outline-variant);
}

.link-item:hover .brand-preview {
    background: var(--m3-primary-container);
    border-color: var(--m3-primary);
}

.brand-preview img { width: 22px; height: 22px; object-fit: contain; }

.link-info { flex: 1; min-width: 0; }

.title-row {
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.link-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--m3-on-surface);
}

.link-url {
    font-size: 12px;
    color: var(--m3-on-surface-variant);
    opacity: 0.6;
    font-family: 'Google Sans', sans-serif;
    word-break: break-all;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

@media (min-width: 480px) {
    .link-item { padding: 16px; gap: 14px; }
    .brand-preview { width: 44px; height: 44px; }
    .brand-preview img { width: 24px; height: 24px; }
    .link-url { max-width: 200px; }
    .drag-handle { display: block; }
}

@media (min-width: 600px) {
    #link-list { gap: 14px; }
    .link-item { padding: 18px 20px; gap: 16px; border-radius: 20px; }
    .brand-preview { width: 48px; height: 48px; border-radius: 14px; }
    .brand-preview img { width: 26px; height: 26px; }
    .link-title { font-size: 16px; }
    .link-url { max-width: 250px; font-size: 13px; }
}

@media (min-width: 768px) {
    #link-list { gap: 16px; }
    .link-item { padding: 20px 24px; gap: 20px; border-radius: 24px; }
    .brand-preview { width: 52px; height: 52px; }
    .brand-preview img { width: 28px; height: 28px; }
    .link-title { font-size: 17px; }
    .link-url { max-width: 300px; }
}

/* === ACTION BUTTONS === */
.action-btns {
    display: flex;
    gap: 6px;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--m3-shape-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--m3-duration-short) var(--m3-motion-standard);
    color: var(--m3-on-surface-variant);
    background: var(--m3-surface-container);
    border: none;
    font-size: 18px;
}

.icon-btn:hover {
    background: var(--m3-primary-container);
    color: var(--m3-on-primary-container);
    transform: scale(1.08);
}

.icon-btn:active { transform: scale(0.95); }

.icon-btn.delete:hover {
    background: var(--m3-error-container);
    color: var(--m3-error);
}

@media (min-width: 480px) {
    .action-btns { gap: 8px; }
    .icon-btn { width: 40px; height: 40px; font-size: 20px; }
}

/* === STATUS BADGES (MD3 Chips) === */
.status-badge {
    padding: 2px 10px;
    border-radius: var(--m3-shape-full);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.status-live {
    background: var(--m3-success-container);
    color: var(--m3-success);
}

.status-scheduled {
    background: #FFF3E0;
    color: #E65100;
}

/* === FLOATING ACTION BUTTON (MD3 FAB) === */
.fab-add {
    position: fixed;
    bottom: 88px;
    right: 16px;
    width: 56px;
    height: 56px;
    background: var(--m3-primary-container);
    color: var(--m3-on-primary-container);
    border-radius: var(--m3-shape-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--m3-elevation-3);
    cursor: pointer;
    transition: all var(--m3-duration-medium) var(--m3-motion-emphasized);
    z-index: 100;
    border: none;
}

.fab-add:hover {
    box-shadow: var(--m3-elevation-5);
    transform: scale(1.05);
    background: var(--m3-primary);
    color: var(--m3-on-primary);
}

.fab-add:active {
    transform: scale(0.95);
}

.fab-add .material-symbols-rounded { font-size: 24px; }

@media (min-width: 600px) {
    .fab-add { bottom: 92px; right: 24px; }
}

@media (min-width: 1024px) {
    .fab-add {
        bottom: 32px;
        right: 32px;
        width: 56px;
        height: 56px;
        border-radius: var(--m3-shape-lg);
    }
}

/* === ANALYTICS MINI CARD === */
.analytics-card-mini {
    background: var(--m3-surface-container-lowest);
    border-radius: var(--m3-shape-xl);
    padding: 16px;
    border: 1px solid var(--m3-outline-variant);
    box-shadow: var(--m3-elevation-1);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    text-decoration: none !important;
    transition: all var(--m3-duration-short) var(--m3-motion-standard);
}

.analytics-card-mini:hover {
    box-shadow: var(--m3-elevation-3);
    border-color: var(--m3-outline);
    transform: translateY(-2px);
}

.analytics-card-mini .icon-box {
    width: 48px;
    height: 48px;
    background: var(--m3-primary-container);
    border-radius: var(--m3-shape-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--m3-on-primary-container);
    flex-shrink: 0;
}

.analytics-card-mini .val {
    font-size: 20px;
    font-family: 'Google Sans', sans-serif;
    font-weight: 800;
    color: var(--m3-primary);
    line-height: 1;
    margin-bottom: 2px;
}

.analytics-card-mini .label {
    color: var(--m3-on-surface-variant);
    font-size: 13px;
    font-weight: 500;
}

@media (min-width: 600px) {
    .analytics-card-mini {
        padding: 20px 24px;
        gap: 20px;
        margin-bottom: 20px;
    }
    .analytics-card-mini .icon-box { width: 56px; height: 56px; }
    .analytics-card-mini .val { font-size: 24px; }
}

@media (min-width: 768px) {
    .analytics-card-mini {
        padding: 24px 28px;
        gap: 24px;
        margin-bottom: 24px;
    }
    .analytics-card-mini .icon-box { width: 64px; height: 64px; border-radius: 20px; }
    .analytics-card-mini .val { font-size: 28px; }
}

/* === CTA SETTINGS CARD === */
.cta-settings-card {
    background: var(--m3-surface-container-lowest);
    border-radius: var(--m3-shape-xl);
    padding: 20px;
    border: 1px solid var(--m3-outline-variant);
    box-shadow: var(--m3-elevation-1);
    margin-top: 24px;
    margin-bottom: 24px;
}

.cta-settings-card .card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.cta-settings-card .highlight-icon { color: #FFB300; font-size: 28px; }
.cta-settings-card h2 { font-size: 18px; color: var(--m3-on-surface); }
.cta-settings-card .description {
    color: var(--m3-on-surface-variant);
    font-size: 13px;
    max-width: 600px;
    margin-bottom: 20px;
    line-height: 1.6;
}

.cta-form { display: flex; flex-direction: column; gap: 12px; }

@media (min-width: 600px) {
    .cta-settings-card {
        padding: 28px;
        margin-top: 28px;
        margin-bottom: 28px;
    }
    .cta-settings-card .card-header { gap: 16px; margin-bottom: 16px; }
    .cta-settings-card .highlight-icon { font-size: 32px; }
    .cta-settings-card h2 { font-size: 20px; }
    .cta-settings-card .description { font-size: 14px; margin-bottom: 24px; }
    .cta-form { gap: 16px; }
}

@media (min-width: 768px) {
    .cta-settings-card { padding: 32px; margin-top: 32px; margin-bottom: 32px; }
    .cta-settings-card h2 { font-size: 22px; }
}

/* === MD3 FILLED TEXT FIELD === */
.m3-input, .m3-field {
    margin-bottom: 16px;
    background: var(--m3-surface-container);
    padding: 12px 16px;
    border-bottom: 2px solid var(--m3-outline);
    border-radius: var(--m3-shape-xs) var(--m3-shape-xs) 0 0;
    transition: all var(--m3-duration-short) var(--m3-motion-standard);
}

.m3-input:focus-within, .m3-field:focus-within {
    background: var(--m3-surface-container-high);
    border-bottom-color: var(--m3-primary);
}

.m3-input label, .m3-field label {
    display: block;
    font-size: 11px;
    color: var(--m3-primary);
    margin-bottom: 4px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.m3-input input, .m3-field input {
    width: 100%;
    background: none;
    border: none;
    outline: none;
    font-size: 15px;
    font-family: 'Google Sans', sans-serif;
    font-weight: 500;
    color: var(--m3-on-surface);
    padding: 2px 0;
}

@media (min-width: 600px) {
    .m3-input, .m3-field {
        margin-bottom: 20px;
        padding: 14px 20px;
    }
    .m3-input input, .m3-field input { font-size: 16px; }
}

/* === MODAL (Mobile-First) === */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 5, 20, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: flex-end;
    z-index: 2000;
    padding: 0;
}

.modal-content {
    background: var(--m3-surface-container-lowest);
    padding: 24px;
    border-radius: var(--m3-shape-xl) var(--m3-shape-xl) 0 0;
    width: 100%;
    max-width: 100%;
    box-shadow: var(--m3-elevation-5);
    animation: modalSlideUp var(--m3-duration-medium) var(--m3-motion-emphasized-decelerate);
    max-height: 90vh;
    max-height: 90dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(100%); }
    to { opacity: 1; transform: translateY(0); }
}

@media (min-width: 600px) {
    .modal-overlay {
        align-items: center;
        padding: 24px;
    }

    .modal-content {
        padding: 32px;
        border-radius: var(--m3-shape-xl);
        width: 95%;
        max-width: 520px;
        animation: modalScaleIn var(--m3-duration-medium) var(--m3-motion-emphasized-decelerate);
    }

    @keyframes modalScaleIn {
        from { opacity: 0; transform: translateY(24px) scale(0.95); }
        to { opacity: 1; transform: translateY(0) scale(1); }
    }
}

@media (min-width: 768px) {
    .modal-content { padding: 40px; }
}

/* === PLATFORM GRID (Mobile-First) === */
.platform-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 2px;
}

.platform-item {
    background: var(--m3-surface-container);
    padding: 12px 8px;
    border-radius: var(--m3-shape-lg);
    border: 2px solid transparent;
    text-align: center;
    cursor: pointer;
    transition: all var(--m3-duration-short) var(--m3-motion-emphasized);
    min-height: 72px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.platform-item:hover {
    background: var(--m3-primary-container);
    transform: translateY(-2px);
    box-shadow: var(--m3-elevation-1);
}

.platform-item.selected {
    border-color: var(--m3-primary);
    background: var(--m3-primary-container);
    box-shadow: 0 0 0 2px rgba(103,80,164,0.15);
}

.platform-item img {
    width: 24px;
    height: 24px;
}

.platform-item span {
    font-size: 9px;
    font-weight: 700;
    color: var(--m3-on-surface-variant);
    display: block;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    line-height: 1.2;
}

@media (min-width: 480px) {
    .platform-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 10px;
    }
    .platform-item { padding: 14px 10px; }
    .platform-item img { width: 28px; height: 28px; }
    .platform-item span { font-size: 10px; }
}

@media (min-width: 600px) {
    .platform-grid { gap: 12px; }
    .platform-item { padding: 14px 10px; border-radius: 18px; min-height: 80px; }
}

/* === ACTIVITY SECTION (Mobile-First) === */
.activity-section { margin-top: 28px; }

.activity-card {
    background: var(--m3-surface-container-lowest);
    border-radius: var(--m3-shape-xl);
    padding: 16px;
    border: 1px solid var(--m3-outline-variant);
    box-shadow: var(--m3-elevation-1);
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--m3-outline-variant);
}

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

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--m3-shape-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--m3-surface-container);
    color: var(--m3-primary);
    flex-shrink: 0;
    border: 1px solid var(--m3-outline-variant);
}

.activity-icon.brand-icon-wrap {
    background: var(--m3-surface-container);
}

.activity-icon img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.brand-preview img {
    width: 22px;
    height: 22px;
    object-fit: contain;
}

.priority-cta img {
    filter: brightness(0) invert(1);
    width: 28px;
    height: 28px;
}

.activity-info { flex: 1; min-width: 0; }
.activity-info .title {
    font-size: 13px;
    font-weight: 600;
    color: var(--m3-on-surface);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.activity-info .time { font-size: 11px; color: var(--m3-on-surface-variant); opacity: 0.6; }

@media (min-width: 480px) {
    .activity-icon { width: 44px; height: 44px; }
    .activity-icon img { width: 24px; height: 24px; }
    .activity-info .title { font-size: 14px; }
    .activity-info .time { font-size: 12px; }
}

@media (min-width: 600px) {
    .activity-section { margin-top: 36px; }
    .activity-card { padding: 20px; }
    .activity-item { gap: 16px; padding: 14px 0; }
}

@media (min-width: 768px) {
    .activity-section { margin-top: 40px; }
    .activity-card { padding: 24px; }
}

/* === PREMIUM TOP BAR SYSTEM === */

/* --- Top Bar Layout --- */
.dashboard-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 20px;
    margin: -8px -8px 28px -8px;
    border-radius: 20px;
    position: sticky;
    top: 8px;
    z-index: 100;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    background: transparent;
}

.dashboard-top-bar.scrolled {
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(226, 232, 240, 0.6);
    margin: -8px -8px 28px -8px;
    padding: 10px 20px;
}

body.dark-mode .dashboard-top-bar.scrolled {
    background: rgba(15, 23, 42, 0.72);
    border-color: rgba(51, 65, 85, 0.5);
}

/* --- Left: Breadcrumb --- */
.top-bar-left {
    display: flex;
    align-items: center;
    min-width: 0;
    flex-shrink: 0;
}

.top-bar-breadcrumb {
    display: flex;
    align-items: center;
    gap: 10px;
}

.breadcrumb-icon {
    font-size: 22px;
    color: var(--primary);
    background: var(--primary-light);
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-variation-settings: 'FILL' 1;
}

.breadcrumb-label {
    font-family: var(--font-brand);
    font-weight: 700;
    font-size: 17px;
    color: var(--text-main);
    letter-spacing: -0.2px;
}

/* --- Center: Search --- */
.search-wrapper {
    display: flex;
    align-items: center;
    background: rgba(241, 245, 249, 0.8);
    border: 1.5px solid transparent;
    border-radius: 14px;
    padding: 9px 16px;
    max-width: 400px;
    width: 100%;
    gap: 10px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.search-wrapper:hover {
    background: rgba(241, 245, 249, 1);
    border-color: var(--border-color);
}

.search-wrapper.focused {
    background: #FFFFFF;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1), 0 4px 12px rgba(0, 102, 255, 0.06);
}

body.dark-mode .search-wrapper {
    background: rgba(30, 41, 59, 0.6);
}

body.dark-mode .search-wrapper.focused {
    background: rgba(30, 41, 59, 0.9);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.15);
}

.search-icon {
    color: #94A3B8;
    font-size: 20px;
    flex-shrink: 0;
    transition: color 0.2s ease;
}

.search-wrapper.focused .search-icon {
    color: var(--primary);
}

.search-input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 14px;
    font-family: var(--font-body);
    font-weight: 500;
    color: var(--text-main);
    width: 100%;
}

.search-input::placeholder {
    color: #94A3B8;
    font-weight: 400;
}

.search-shortcut-badge {
    display: flex;
    align-items: center;
    gap: 3px;
    flex-shrink: 0;
}

.search-shortcut-badge kbd {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 5px;
    background: #FFFFFF;
    border: 1px solid #CBD5E1;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    color: #94A3B8;
    font-family: var(--font-body);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

body.dark-mode .search-shortcut-badge kbd {
    background: rgba(51, 65, 85, 0.6);
    border-color: rgba(71, 85, 105, 0.5);
    color: #64748B;
}

/* --- Right: Actions --- */
.top-bar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.top-action-btn {
    position: relative;
    background: transparent;
    border: none;
    color: #94A3B8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    transition: all 0.2s ease;
}

.top-action-btn:hover {
    color: var(--text-main);
    background: rgba(0, 0, 0, 0.04);
}

body.dark-mode .top-action-btn:hover {
    background: rgba(255, 255, 255, 0.06);
}

.top-action-btn .material-symbols-rounded {
    font-size: 22px;
}

.top-action-btn .badge {
    position: absolute;
    top: 6px;
    right: 6px;
    background: #EF4444;
    color: white;
    font-size: 0;
    border-radius: 50%;
    width: 8px;
    height: 8px;
    border: 2px solid #FFFFFF;
}

/* Top bar divider */
.top-bar-divider {
    width: 1px;
    height: 28px;
    background: var(--border-color);
    margin: 0 6px;
    opacity: 0.6;
}

/* --- User Menu Trigger (Premium Pill) --- */
.profile-dropdown-container {
    position: relative;
}

.top-user-menu-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(241, 245, 249, 0.6);
    border: 1.5px solid transparent;
    cursor: pointer;
    padding: 5px 12px 5px 5px;
    border-radius: 100px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}

.top-user-menu-trigger:hover {
    background: rgba(241, 245, 249, 1);
    border-color: var(--border-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.top-user-menu-trigger.active {
    background: var(--primary-light);
    border-color: rgba(0, 102, 255, 0.2);
}

body.dark-mode .top-user-menu-trigger {
    background: rgba(30, 41, 59, 0.5);
}

body.dark-mode .top-user-menu-trigger:hover {
    background: rgba(30, 41, 59, 0.8);
    border-color: rgba(51, 65, 85, 0.5);
}

/* Avatar with status ring */
.top-user-avatar-ring {
    position: relative;
    padding: 2px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #10B981);
    flex-shrink: 0;
}

.top-user-avatar {
    width: 32px !important;
    height: 32px !important;
    border-radius: 50% !important;
    background: var(--primary) !important;
    color: white !important;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-family: var(--font-brand);
    font-size: 13px !important;
    overflow: hidden;
    border: 2px solid #FFFFFF !important;
    box-shadow: none !important;
}

.top-user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* User info text */
.top-user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.2;
}

.top-user-name {
    font-family: var(--font-brand);
    font-weight: 700;
    font-size: 13px;
    color: var(--text-main);
    white-space: nowrap;
}

.top-user-role {
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 11px;
    color: #94A3B8;
    white-space: nowrap;
}

.top-bar-chevron {
    font-size: 18px !important;
    color: #94A3B8;
    transition: transform 0.25s ease;
}

.top-user-menu-trigger.active .top-bar-chevron {
    transform: rotate(180deg);
    color: var(--primary);
}

/* --- Sign In Button (for logged-out state) --- */
.top-bar-signin-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 20px;
    background: var(--primary);
    color: white;
    border-radius: 12px;
    font-weight: 700;
    font-size: 14px;
    font-family: var(--font-brand);
    text-decoration: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 102, 255, 0.2);
}

.top-bar-signin-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 102, 255, 0.3);
}

.top-bar-signin-btn .material-symbols-rounded {
    font-size: 20px;
}

/* --- Profile Dropdown Menu --- */
.profile-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 280px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-radius: 20px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(226, 232, 240, 0.7);
    padding: 8px;
    display: none;
    z-index: 2000;
    animation: topBarDropIn 0.2s cubic-bezier(0, 0, 0.2, 1);
    transform-origin: top right;
}

body.dark-mode .profile-menu {
    background: rgba(15, 23, 42, 0.92);
    border-color: rgba(51, 65, 85, 0.5);
}

.profile-menu.show {
    display: block;
}

@keyframes topBarDropIn {
    from { opacity: 0; transform: translateY(-6px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Menu Header with Avatar */
.menu-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(0, 102, 255, 0.04) 0%, rgba(16, 185, 129, 0.02) 100%);
    margin-bottom: 4px;
}

.menu-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.menu-header-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.menu-avatar-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
    font-family: var(--font-brand);
    font-size: 16px;
}

.menu-header-info {
    min-width: 0;
}

.menu-name {
    font-weight: 700;
    color: var(--text-main);
    font-size: 14px;
    font-family: var(--font-brand);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.menu-email {
    font-size: 12px;
    color: #94A3B8;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.menu-divider {
    height: 1px;
    background: var(--border-color);
    margin: 4px 8px;
    opacity: 0.6;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-main);
    font-weight: 600;
    font-size: 14px;
    font-family: var(--font-body);
    transition: all 0.15s ease;
    min-height: 42px;
    position: relative;
}

.menu-item:hover {
    background: rgba(0, 0, 0, 0.04);
}

body.dark-mode .menu-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.menu-item.logout {
    color: var(--m3-error);
}

.menu-item .material-symbols-rounded {
    font-size: 20px;
    color: #94A3B8;
}

.menu-item.logout .material-symbols-rounded {
    color: var(--m3-error);
}

.menu-item:hover .material-symbols-rounded {
    color: var(--primary);
}

.menu-item.logout:hover .material-symbols-rounded {
    color: var(--m3-error);
}

/* Live badge on "View Live Profile" */
.menu-item-badge {
    margin-left: auto;
    font-size: 10px;
    font-weight: 700;
    color: #10B981;
    background: rgba(16, 185, 129, 0.1);
    padding: 2px 8px;
    border-radius: 100px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* --- Responsive Top Bar --- */
@media (max-width: 900px) {
    .top-user-info { display: none; }
    .top-user-menu-trigger { padding: 4px; }
    .top-bar-chevron { display: none !important; }
    .breadcrumb-label { display: none; }
}

@media (max-width: 640px) {
    .dashboard-top-bar {
        padding: 10px 12px;
        gap: 8px;
        margin: -4px -4px 20px -4px;
        border-radius: 16px;
    }
    .dashboard-top-bar.scrolled {
        margin: -4px -4px 20px -4px;
        padding: 8px 12px;
    }
    .search-wrapper {
        max-width: 100%;
        padding: 8px 12px;
    }
    .search-shortcut-badge { display: none; }
    .top-bar-divider { display: none; }
    .top-action-btn { width: 36px; height: 36px; }
    .breadcrumb-icon { width: 34px; height: 34px; font-size: 20px; }
    .profile-menu { width: 260px; right: -8px; }
}

/* Legacy search-shortcut compat */
.search-shortcut { display: none; }

/* === EMPTY STATE === */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    background: var(--m3-surface-container-lowest);
    border-radius: var(--m3-shape-xl);
    border: 2px dashed var(--m3-outline-variant);
}

.empty-state span {
    font-size: 56px;
    background: linear-gradient(135deg, var(--m3-primary), var(--m3-tertiary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    opacity: 0.25;
    margin-bottom: 16px;
    display: block;
}

.empty-state p {
    font-family: 'Google Sans', sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: var(--m3-on-surface-variant);
}

@media (min-width: 600px) {
    .empty-state { padding: 64px 40px; border-radius: 32px; }
    .empty-state span { font-size: 72px; margin-bottom: 20px; }
    .empty-state p { font-size: 18px; }
}

@media (min-width: 768px) {
    .empty-state { padding: 80px 40px; }
    .empty-state span { font-size: 80px; margin-bottom: 24px; }
}

/* === TOAST NOTIFICATION === */
.toast {
    position: fixed;
    bottom: 96px;
    left: 50%;
    transform: translateX(-50%) translateY(120px);
    background: var(--m3-on-surface);
    color: var(--m3-surface);
    padding: 12px 20px;
    border-radius: var(--m3-shape-sm);
    font-family: 'Google Sans', sans-serif;
    font-weight: 600;
    font-size: 14px;
    box-shadow: var(--m3-elevation-5);
    z-index: 3000;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0;
    transition: all var(--m3-duration-medium) var(--m3-motion-emphasized-decelerate);
    pointer-events: none;
    max-width: calc(100% - 32px);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.success { background: var(--m3-success); color: white; }
.toast.error { background: var(--m3-error); color: white; }

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

/* === ANIMATIONS === */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-16px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Reveal on scroll */
.reveal {
    opacity: 0;
    transform: translateY(16px);
    animation: revealUp var(--m3-duration-long) var(--m3-motion-emphasized-decelerate) forwards;
}

.reveal-delay-1 { animation-delay: 0.08s; }
.reveal-delay-2 { animation-delay: 0.16s; }
.reveal-delay-3 { animation-delay: 0.24s; }
.reveal-delay-4 { animation-delay: 0.32s; }

@keyframes revealUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

/* === SPINNING ANIMATION === */
.spinning { animation: rotate 1s linear infinite; display: inline-block; }
@keyframes rotate { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ===========================================================
   DARK MODE — Material Design 3 Dark Theme
   =========================================================== */
body.dark-mode {
    --m3-surface: #141218;
    --m3-surface-dim: #141218;
    --m3-surface-bright: #3B383E;
    --m3-surface-container-lowest: #0F0D13;
    --m3-surface-container-low: #1D1B20;
    --m3-surface-container: #211F26;
    --m3-surface-container-high: #2B2930;
    --m3-surface-container-highest: #36343B;
    --m3-on-surface: #E6E0E9;
    --m3-on-surface-variant: #CAC4D0;
    --m3-outline: #938F99;
    --m3-outline-variant: #49454F;
    --m3-primary-container: #4F378B;
    --m3-on-primary-container: #EADDFF;
    --m3-secondary-container: #4A4458;
    --m3-on-secondary-container: #E8DEF8;
    --m3-error-container: #8C1D18;
    --m3-success-container: #1B5E20;
    color-scheme: dark;
}

body.dark-mode::before {
    background:
        radial-gradient(ellipse at 15% 10%, rgba(208, 188, 255, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 85% 70%, rgba(255, 216, 228, 0.03) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 90%, rgba(208, 188, 255, 0.02) 0%, transparent 50%);
}

/* Dark Mode — Card surfaces */
body.dark-mode .profile-card-premium,
body.dark-mode .stat-card,
body.dark-mode .link-item,
body.dark-mode .quick-action-chip,
body.dark-mode .profile-menu,
body.dark-mode .modal-content,
body.dark-mode .activity-card,
body.dark-mode .empty-state,
body.dark-mode .cta-settings-card,
body.dark-mode .analytics-card-mini {
    background: var(--m3-surface-container-high) !important;
    border-color: var(--m3-outline-variant) !important;
    color: var(--m3-on-surface) !important;
}

/* Dark Mode — Text colors */
body.dark-mode .profile-card-premium .name,
body.dark-mode .stat-card .val,
body.dark-mode .link-title,
body.dark-mode .quick-action-chip,
body.dark-mode .menu-name,
body.dark-mode .empty-state p,
body.dark-mode .activity-info .title,
body.dark-mode .cta-settings-card h2,
body.dark-mode .m3-input input,
body.dark-mode .m3-field input {
    color: var(--m3-on-surface) !important;
}

body.dark-mode .profile-card-premium .email,
body.dark-mode .link-url,
body.dark-mode .menu-email,
body.dark-mode .activity-info .time,
body.dark-mode .stat-card .label {
    color: var(--m3-on-surface-variant) !important;
    opacity: 0.8;
}

body.dark-mode .menu-divider {
    background: var(--m3-outline-variant);
}

body.dark-mode .brand-preview,
body.dark-mode .activity-icon {
    background: var(--m3-surface-container) !important;
    border-color: var(--m3-outline-variant) !important;
}

body.dark-mode .m3-input,
body.dark-mode .m3-field {
    background: var(--m3-surface-container-low) !important;
    border-bottom-color: var(--m3-outline) !important;
}

body.dark-mode .m3-input:focus-within,
body.dark-mode .m3-field:focus-within {
    background: var(--m3-surface-container-high) !important;
    border-bottom-color: var(--m3-primary) !important;
}

body.dark-mode .icon-btn {
    background: var(--m3-surface-container) !important;
    color: var(--m3-on-surface-variant) !important;
}

body.dark-mode .icon-btn:hover {
    background: var(--m3-primary-container) !important;
    color: var(--m3-on-primary-container) !important;
}

body.dark-mode .stat-card .icon-box {
    background: var(--m3-primary-container);
    color: var(--m3-on-primary-container);
}

body.dark-mode .platform-item {
    background: var(--m3-surface-container) !important;
    color: var(--m3-on-surface) !important;
}

body.dark-mode .platform-item:hover,
body.dark-mode .platform-item.selected {
    background: var(--m3-primary-container) !important;
}

body.dark-mode .menu-item {
    color: var(--m3-on-surface) !important;
}

body.dark-mode .menu-item:hover {
    background: var(--m3-surface-container) !important;
}

body.dark-mode .menu-item.logout {
    color: #F2B8B5 !important;
}

/* ===========================================================
   Accessibility — Reduced Motion
   =========================================================== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    body::before { animation: none; }
}

/* ===========================================================
   Safe Area Padding (iPhone Notch / Dynamic Island)
   =========================================================== */
@supports (padding: env(safe-area-inset-bottom)) {
    .fab-add {
        bottom: calc(88px + env(safe-area-inset-bottom));
    }

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

/* ===========================================================
   Unified Platform Design Overrides (Harmonized with register.php)
   =========================================================== */
body {
    font-family: var(--font-body) !important;
    background: var(--bg-base) !important;
    color: var(--text-main) !important;
}

h1, h2, h3, h4, h5, h6, .logo-text, .nav-item-m3 span:not(.material-symbols-rounded) {
    font-family: var(--font-brand) !important;
}

/* Ambient background blobs */
.ambient-blob {
    position: fixed;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(140px);
    z-index: -1;
    opacity: 0.35;
    pointer-events: none;
}
.blob-blue {
    top: -100px;
    right: 15%;
    background: radial-gradient(circle, rgba(0, 102, 255, 0.15) 0%, transparent 70%);
}
.blob-green {
    bottom: -100px;
    left: -100px;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.1) 0%, transparent 70%);
}

/* Sidebar Redesign */
.sidebar {
    background: #FFFFFF !important;
    border-right: 1px solid var(--border-color) !important;
    box-shadow: none !important;
}

.logo-text {
    color: var(--text-main) !important;
    font-size: 20px !important;
    font-weight: 800 !important;
    letter-spacing: -0.5px !important;
}

.logo-accent {
    color: var(--primary) !important;
}

.nav-item-m3 {
    margin: 4px 16px !important;
    padding: 12px 16px !important;
    border-radius: 12px !important;
    color: var(--text-muted) !important;
    font-weight: 600 !important;
    height: 48px !important;
    transition: all 0.2s ease !important;
}

.nav-item-m3:hover {
    background: var(--primary-light) !important;
    color: var(--primary) !important;
}

.nav-item-m3.active {
    background: var(--primary-light) !important;
    color: var(--primary) !important;
    font-weight: 700 !important;
}

.nav-item-m3.active .material-symbols-rounded {
    color: var(--primary) !important;
    font-variation-settings: 'FILL' 1 !important;
}

.sidebar-premium-demo-card {
    background: var(--primary-light) !important;
    border: 1px solid rgba(0, 102, 255, 0.1) !important;
    border-radius: 12px !important;
    padding: 12px 16px !important;
    margin: 4px 16px 16px !important;
}

.sidebar-premium-demo-card .card-title {
    font-family: var(--font-brand) !important;
    font-weight: 800 !important;
    font-size: 13px !important;
    color: var(--primary) !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    text-transform: uppercase !important;
    margin-bottom: 2px !important;
}

.sidebar-premium-demo-card .card-subtitle {
    font-size: 11px !important;
    color: var(--text-muted) !important;
    font-weight: 600 !important;
}

/* Main Hero Banner Card */
.hero-banner-card {
    background: linear-gradient(135deg, rgba(0, 102, 255, 0.04) 0%, rgba(16, 185, 129, 0.02) 100%);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 32px;
    display: grid;
    grid-template-columns: 1.2fr 1.1fr 1fr;
    gap: 24px;
    align-items: center;
    margin-bottom: 32px;
    position: relative;
    overflow: hidden;
}

.banner-left-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.banner-greeting {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.banner-title {
    font-family: var(--font-brand);
    font-weight: 800;
    font-size: clamp(24px, 3vw, 36px);
    color: var(--text-main);
    line-height: 1.15;
}

.banner-desc {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-muted);
    max-width: 320px;
}

/* Custom CSS Browser Mockup Graphic */
.banner-browser-graphic {
    display: flex;
    justify-content: center;
    align-items: center;
}

.browser-mock-window {
    width: 250px;
    height: 160px;
    background: #FFFFFF;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.04);
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.browser-mock-titlebar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-color);
}

.browser-mock-dots {
    display: flex;
    gap: 4px;
}

.browser-mock-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #E2E8F0;
}

.browser-mock-body {
    flex-grow: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.browser-mock-left {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
}

.browser-mock-left svg {
    color: var(--primary);
    width: 28px;
    height: 28px;
}

.browser-mock-right {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.browser-mock-chart-box {
    flex-grow: 1;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px;
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
}

.browser-mock-bar {
    width: 8px;
    border-radius: 2px;
    background: #10B981;
}

.browser-mock-bar-1 { height: 60%; opacity: 0.5; }
.browser-mock-bar-2 { height: 90%; }
.browser-mock-bar-3 { height: 40%; opacity: 0.7; }

.browser-mock-pie-box {
    height: 40px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #FFF;
}

.browser-mock-pie {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: conic-gradient(var(--primary) 0% 60%, #E2E8F0 60% 100%);
}

/* Plan Card Inside Banner */
.banner-plan-card {
    background: #FFFFFF;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.02);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.plan-card-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.plan-card-tier {
    font-family: var(--font-brand);
    font-weight: 800;
    font-size: 16px;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.plan-card-time {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-plan-upgrade-new {
    background: var(--primary);
    color: #FFFFFF !important;
    text-decoration: none;
    border-radius: 100px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 18px;
    font-family: var(--font-brand);
    font-weight: 700;
    font-size: 13px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 102, 255, 0.15);
}

.btn-plan-upgrade-new:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(0, 102, 255, 0.25);
}

.btn-plan-upgrade-new span.arrow-wrap {
    width: 20px;
    height: 20px;
    background: #FFFFFF;
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-plan-upgrade-new span.arrow-wrap .material-symbols-rounded {
    font-size: 12px;
    font-weight: 800;
}

/* Quick Actions Row */
.quick-actions-row-new {
    display: flex;
    gap: 12px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.action-chip-new {
    background: #FFFFFF;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 10px 20px;
    border-radius: 100px;
    font-family: var(--font-brand);
    font-weight: 700;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    transition: all 0.2s ease;
    text-decoration: none;
}

.action-chip-new:hover {
    border-color: #CBD5E1;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
    transform: translateY(-1px);
}

.action-chip-new .material-symbols-rounded {
    font-size: 16px;
    color: var(--text-muted);
}

/* Profile Identity Card */
.profile-identity-card-new {
    background: #FFFFFF;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.01);
}

.profile-identity-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.profile-identity-avatar-box {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-family: var(--font-brand);
    font-size: 26px;
    overflow: hidden;
}

.profile-identity-avatar-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-identity-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.profile-identity-name-text {
    font-family: var(--font-brand);
    font-weight: 800;
    font-size: 18px;
    color: var(--text-main);
}

.profile-identity-email-text {
    font-size: 13px;
    color: var(--text-muted);
}

.profile-identity-badges-row {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}

.badge-new {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-new.demo {
    background: var(--primary-light);
    color: var(--primary);
}

.badge-new.verified {
    background: rgba(16, 185, 129, 0.08);
    color: #10B981;
}

.badge-new.verified .material-symbols-rounded {
    font-size: 11px;
}

.btn-edit-profile-new {
    color: var(--primary);
    text-decoration: none;
    font-family: var(--font-brand);
    font-weight: 700;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: transform 0.2s ease;
}

.btn-edit-profile-new:hover {
    transform: translateX(3px);
}

/* Stats Cards */
.stats-grid-new {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card-new {
    background: #FFFFFF;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.01);
    transition: all 0.2s ease;
}

.stat-card-new:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.04);
}

.stat-card-header-new {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.stat-icon-circle-new {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon-circle-new .material-symbols-rounded {
    font-size: 18px;
}

.stat-icon-circle-new.blue {
    background: var(--primary-light);
    color: var(--primary);
}

.stat-icon-circle-new.green {
    background: rgba(16, 185, 129, 0.08);
    color: #10B981;
}

.stat-icon-circle-new.orange {
    background: rgba(245, 158, 11, 0.08);
    color: #F59E0B;
}

.stat-icon-circle-new.purple {
    background: rgba(139, 92, 246, 0.08);
    color: #8B5CF6;
}

.btn-stat-menu {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-card-val-new {
    font-family: var(--font-brand);
    font-weight: 800;
    font-size: 24px;
    color: var(--text-main);
    line-height: 1;
    margin-bottom: 4px;
}

.stat-card-label-new {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 12px;
}

.stat-card-trend-row {
    display: flex;
    align-items: center;
}

.stat-card-trend-badge {
    background: rgba(16, 185, 129, 0.08);
    color: #10B981;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 100px;
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.stat-card-trend-badge .material-symbols-rounded {
    font-size: 10px;
    font-weight: 800;
}

.stat-card-trend-text-new {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    margin-left: 6px;
}

/* Responsive Overrides */
@media (max-width: 1200px) {
    .stats-grid-new {
        grid-template-columns: repeat(2, 1fr);
    }
    .hero-banner-card {
        grid-template-columns: 1fr 1fr;
    }
    .banner-browser-graphic {
        display: none;
    }
}

@media (max-width: 768px) {
    .stats-grid-new {
        grid-template-columns: 1fr;
    }
    .hero-banner-card {
        grid-template-columns: 1fr;
        padding: 24px;
    }
    .profile-identity-card-new {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    .btn-edit-profile-new {
        align-self: flex-end;
    }
}

/* Real-time Trend badge color variations */
.stat-card-trend-badge.negative {
    background: rgba(239, 68, 68, 0.08) !important;
    color: #EF4444 !important;
}
.stat-card-trend-badge.neutral {
    background: rgba(100, 116, 139, 0.08) !important;
    color: #64748B !important;
}

/* Sidebar links footer collapsing */
.sidebar-premium.collapsed .sidebar-links-footer {
    display: none !important;
}


