:root {
    --primary: #8026E8;
    --primary-dark: #6419BD;
    --primary-light: #A855F7;
    --primary-soft: #F3E8FF;
    --bg-page: #F8FAFC;
    --bg-sidebar: #0F172A;
    --bg-card: #FFFFFF;
    --border-color: #E2E8F0;
    --border-soft: #F1F5F9;
    --text-main: #0F172A;
    --text-muted: #64748B;
    --text-light: #94A3B8;
    --success: #10B981;
    --success-bg: #DCFCE7;
    --warning: #F59E0B;
    --warning-bg: #FEF3C7;
    --danger: #EF4444;
    --danger-bg: #FEE2E2;
    --sidebar-width: 260px;
    --header-height: 70px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --shadow-card: 0 4px 20px -2px rgba(15, 23, 42, 0.05), 0 2px 6px -1px rgba(15, 23, 42, 0.03);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-page);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .brand-title {
    font-family: 'Poppins', sans-serif;
    color: var(--text-main);
}

a {
    color: inherit;
    text-decoration: none;
}

/* App Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    color: #F8FAFC;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 50;
    transition: transform 0.3s ease;
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.brand-badge {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #FFFFFF;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
    box-shadow: 0 4px 12px rgba(128, 38, 232, 0.35);
}

.brand-text {
    font-size: 16px;
    font-weight: 700;
    color: #FFFFFF;
    letter-spacing: -0.01em;
}

.brand-sub {
    font-size: 11px;
    color: #94A3B8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: block;
}

.sidebar-nav {
    flex: 1;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
}

.nav-section-title {
    font-size: 11px;
    text-transform: uppercase;
    color: #64748B;
    font-weight: 700;
    letter-spacing: 0.06em;
    padding: 12px 12px 6px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    color: #94A3B8;
    font-size: 14.5px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-link svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
    transition: transform 0.2s;
}

.nav-link:hover {
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.06);
}

.nav-link.active {
    color: #FFFFFF;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    box-shadow: 0 4px 15px rgba(128, 38, 232, 0.35);
    font-weight: 600;
}

.nav-badge {
    margin-left: auto;
    background: rgba(255, 255, 255, 0.2);
    color: #FFFFFF;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
}

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

.user-profile-box {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #A855F7, #6366F1);
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
}

.user-meta {
    flex: 1;
    overflow: hidden;
}

.user-name {
    font-size: 13.5px;
    font-weight: 600;
    color: #FFFFFF;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 11.5px;
    color: #94A3B8;
}

/* Main Content Area */
.main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Top Navbar */
.top-header {
    height: var(--header-height);
    background: #FFFFFF;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 40;
}

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

.page-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    padding: 6px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-header-site {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-page);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 13.5px;
    font-weight: 500;
    transition: all 0.15s;
}

.btn-header-site:hover {
    background: var(--border-soft);
    color: var(--text-main);
}

.btn-logout {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 600;
    transition: all 0.15s;
}

.btn-logout:hover {
    background: #FCA5A5;
    color: #991B1B;
}

/* Page Content Body */
.content-body {
    flex: 1;
    padding: 32px;
}

/* Metric KPI Cards Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.metric-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: 24px;
    box-shadow: var(--shadow-card);
    display: flex;
    align-items: center;
    gap: 18px;
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary);
}

.metric-card.success::before {
    background: var(--success);
}

.metric-card.warning::before {
    background: var(--warning);
}

.metric-card.revenue::before {
    background: linear-gradient(90deg, #10B981, #059669);
}

.metric-icon-wrap {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: var(--primary-soft);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.metric-icon-wrap.success {
    background: var(--success-bg);
    color: var(--success);
}

.metric-icon-wrap.warning {
    background: var(--warning-bg);
    color: var(--warning);
}

.metric-info {
    flex: 1;
}

.metric-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 4px;
}

.metric-value {
    font-size: 26px;
    font-weight: 800;
    color: var(--text-main);
    font-family: 'Poppins', sans-serif;
    line-height: 1.1;
}

.metric-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Card Containers */
.card-panel {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-card);
    margin-bottom: 32px;
    overflow: hidden;
}

.card-panel-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
}

.card-panel-title {
    font-size: 17px;
    font-weight: 700;
    margin: 0;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    text-align: left;
}

.data-table th {
    background: #F8FAFC;
    color: #475569;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.data-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-soft);
    color: var(--text-main);
    vertical-align: middle;
}

.data-table tr:hover td {
    background-color: #F8FAFC;
}

.founder-col {
    display: flex;
    flex-direction: column;
}

.founder-name {
    font-weight: 600;
    color: var(--text-main);
}

.company-name {
    font-size: 12px;
    color: var(--text-muted);
}

/* Status Badges */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-status.paid {
    background: var(--success-bg);
    color: #065F46;
}

.badge-status.pending, .badge-status.order_created {
    background: var(--warning-bg);
    color: #92400E;
}

.badge-status.submitted {
    background: #E0E7FF;
    color: #3730A3;
}

/* Buttons */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--primary);
    color: #FFFFFF;
    font-weight: 600;
    font-size: 14px;
    padding: 10px 20px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 14px rgba(128, 38, 232, 0.3);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 12.5px;
    border-radius: 8px;
}

.btn-outline-sm {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: #FFFFFF;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-outline-sm:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-soft);
}

/* Search and Filters Bar */
.filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.search-box {
    position: relative;
    min-width: 260px;
    flex: 1;
    max-width: 400px;
}

.search-box input {
    width: 100%;
    padding: 10px 14px 10px 38px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 14px;
    background: #FFFFFF;
    outline: none;
    transition: border-color 0.2s;
}

.search-box input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(128, 38, 232, 0.12);
}

.search-box svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    width: 18px;
    height: 18px;
}

.filter-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.filter-select {
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 13.5px;
    background: #FFFFFF;
    outline: none;
    color: var(--text-main);
    font-weight: 500;
    cursor: pointer;
}

/* Leads View Tabs & Filter Panel */
.leads-view-tabs {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 18px;
}

.leads-tabs-group {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #F1F5F9;
    padding: 4px;
    border-radius: 12px;
    border: 1px solid #E2E8F0;
}

.leads-filter-card {
    padding: 20px 24px;
    margin-bottom: 24px;
}

@media (max-width: 640px) {
    .leads-view-tabs {
        flex-direction: column;
        align-items: stretch;
    }
    .leads-tabs-group {
        width: 100%;
    }
    .leads-tabs-group a {
        flex: 1;
        justify-content: center;
        padding: 8px 10px !important;
        font-size: 12px !important;
    }
    .leads-filter-card {
        padding: 16px 14px;
        margin-bottom: 18px;
    }
}

/* Modal Popup */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}

.modal-overlay.open {
    display: flex;
}

.modal-card {
    background: #FFFFFF;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 620px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
    animation: modalSlide 0.2s ease-out;
}

@keyframes modalSlide {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    padding: 20px 26px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 22px;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
}

.modal-body {
    padding: 24px 26px;
    overflow-y: auto;
}

.modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.modal-field {
    display: flex;
    flex-direction: column;
}

.modal-field.full {
    grid-column: span 2;
}

.modal-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}

.modal-val {
    font-size: 14.5px;
    font-weight: 500;
    color: var(--text-main);
    word-break: break-word;
}

.story-box {
    background: #F8FAFC;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 14px 16px;
    font-size: 14px;
    line-height: 1.6;
    color: #334155;
    white-space: pre-wrap;
    max-height: 200px;
    overflow-y: auto;
}

/* Login Page Styling */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at 10% 20%, rgba(128, 38, 232, 0.15), transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(99, 102, 241, 0.12), transparent 40%),
        #F8FAFC;
    padding: 20px;
}

.login-card {
    background: #FFFFFF;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
    width: 100%;
    max-width: 420px;
    padding: 40px 36px;
    text-align: center;
}

.login-logo {
    height: 48px;
    margin-bottom: 20px;
}

.login-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 6px;
}

.login-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 28px;
}

.login-alert {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13.5px;
    margin-bottom: 20px;
    text-align: left;
}

.login-alert.error {
    background: var(--danger-bg);
    color: #991B1B;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.login-alert.success {
    background: var(--success-bg);
    color: #065F46;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.form-group {
    text-align: left;
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--border-color);
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s;
    background: #FFFFFF;
    font-family: inherit;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(128, 38, 232, 0.12);
}

.btn-block {
    width: 100%;
    justify-content: center;
    padding: 13px;
    font-size: 15px;
    margin-top: 8px;
}

/* ==========================================================================
   Mobile Responsive & Drawer Navigation System
   ========================================================================== */

body.sidebar-locked {
    overflow: hidden;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 45;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.sidebar-overlay.open {
    display: block;
    opacity: 1;
}

.sidebar-close-btn {
    display: none;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #F8FAFC;
    width: 36px;
    height: 36px;
    border-radius: 9px;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: auto;
}

.sidebar-close-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: rotate(90deg);
}

/* Mobile Bottom Navigation Bar (App-like navigation) */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 62px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--border-color);
    z-index: 40;
    justify-content: space-around;
    align-items: center;
    padding: 0 4px;
    box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.06);
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    height: 100%;
    color: #64748B;
    text-decoration: none;
    font-size: 10.5px;
    font-weight: 600;
    gap: 3px;
    border: none;
    background: none;
    cursor: pointer;
    transition: all 0.18s ease;
    padding: 6px 0;
}

.mobile-nav-item svg {
    width: 20px;
    height: 20px;
    stroke-width: 2.1;
    transition: transform 0.15s ease;
}

.mobile-nav-item.active {
    color: var(--primary);
    font-weight: 700;
}

.mobile-nav-item.active svg {
    transform: scale(1.1);
}

.mobile-nav-item:active {
    transform: scale(0.94);
}

/* --- Media Queries (Tablet & Mobile Breakpoints) --- */
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        box-shadow: none;
        z-index: 50;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 0 0 35px rgba(0, 0, 0, 0.45);
    }

    .sidebar-close-btn {
        display: flex;
    }

    .sidebar-header {
        justify-content: space-between;
    }

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

    .menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border-radius: 10px;
        background: #F1F5F9;
        border: 1px solid var(--border-color);
        color: var(--text-main);
        transition: all 0.2s;
    }

    .menu-toggle:hover {
        background: #E2E8F0;
    }

    .top-header {
        padding: 0 18px;
        height: 64px;
    }

    .content-body {
        padding: 20px 16px;
        padding-bottom: 84px; /* Space for mobile bottom bar */
    }
}

@media (max-width: 768px) {
    .mobile-bottom-nav {
        display: flex;
    }

    .card-panel-header {
        padding: 16px 18px;
        gap: 12px;
    }

    .card-panel-title {
        font-size: 16px;
    }

    /* Filter Bar */
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .search-box {
        max-width: 100%;
        width: 100%;
        min-width: 0;
    }

    .filter-actions {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .filter-actions .filter-select {
        flex: 1 1 100%;
        padding: 10px 14px;
    }

    .filter-actions .btn-outline-sm,
    .filter-actions .btn-primary {
        flex: 1 1 auto;
        justify-content: center;
        padding: 10px 14px;
    }

    /* Table adjustments */
    .data-table th,
    .data-table td {
        padding: 12px 14px;
        font-size: 13px;
    }

    .founder-name {
        font-size: 13.5px;
    }

    /* Media Manager Mobile */
    .media-breadcrumb-bar {
        padding: 12px 16px;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .media-crumbs {
        width: 100%;
    }

    .media-dropzone {
        padding: 24px 16px;
        border-radius: 14px;
    }

    .media-dropzone-icon {
        width: 44px;
        height: 44px;
        margin-bottom: 8px;
    }

    .media-dropzone-title {
        font-size: 14.5px;
    }

    .media-dropzone-sub {
        font-size: 12px;
    }

    .media-folders-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .media-items-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .media-item-thumb {
        height: 120px;
    }
}

@media (max-width: 640px) {
    .page-title {
        font-size: 16px;
        max-width: 150px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .header-left {
        gap: 10px;
    }

    .header-right {
        gap: 8px;
    }

    .btn-header-site,
    .btn-logout {
        padding: 8px 10px;
        font-size: 12px;
        gap: 0;
        border-radius: 8px;
    }

    .btn-header-text {
        display: none;
    }

    .btn-header-site svg,
    .btn-logout svg {
        width: 18px;
        height: 18px;
    }

    /* 2-Column Responsive KPI Cards on Mobile */
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        margin-bottom: 20px;
    }

    .metric-card {
        padding: 14px 12px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        border-radius: 14px;
    }

    .metric-icon-wrap {
        width: 38px;
        height: 38px;
        border-radius: 10px;
    }

    .metric-icon-wrap svg {
        width: 18px;
        height: 18px;
    }

    .metric-value {
        font-size: 19px;
    }

    .metric-label {
        font-size: 11.5px;
        line-height: 1.25;
    }

    .metric-meta {
        font-size: 10px;
        line-height: 1.25;
        margin-top: 2px;
    }

    /* Modals Mobile Sizing */
    .modal-card {
        width: calc(100% - 24px);
        max-height: calc(100vh - 40px);
        margin: 12px;
        border-radius: 16px;
        padding: 0;
    }

    .modal-header {
        padding: 16px 18px;
    }

    .modal-title {
        font-size: 16px;
    }

    .modal-body {
        padding: 16px 18px;
    }

    .modal-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .modal-field.full {
        grid-column: span 1;
    }
}

@media (max-width: 420px) {
    .page-title {
        max-width: 115px;
        font-size: 15px;
    }

    .media-folders-grid {
        grid-template-columns: 1fr;
    }

    .media-items-grid {
        grid-template-columns: 1fr;
    }

    .media-item-thumb {
        height: 160px;
    }
}

/* ==========================================================================
   PWA Mobile Install Popup Modal & Sheet
   ========================================================================== */
.pwa-install-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(15, 23, 42, 0.72);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

@media (min-width: 641px) {
    .pwa-install-overlay {
        align-items: center;
        padding: 20px;
    }
}

.pwa-install-overlay.open {
    opacity: 1;
    visibility: visible;
}

.pwa-install-card {
    width: 100%;
    max-width: 440px;
    background: #FFFFFF;
    border-radius: 26px 26px 0 0;
    padding: 26px 22px 28px;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.28);
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    max-height: 92vh;
    overflow-y: auto;
}

@media (min-width: 641px) {
    .pwa-install-card {
        border-radius: 24px;
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
        transform: scale(0.92);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }
}

.pwa-install-overlay.open .pwa-install-card {
    transform: translateY(0);
}

@media (min-width: 641px) {
    .pwa-install-overlay.open .pwa-install-card {
        transform: scale(1);
    }
}

.pwa-close-btn {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #F1F5F9;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    line-height: 1;
    color: #64748B;
    cursor: pointer;
    transition: all 0.15s ease;
}

.pwa-close-btn:hover {
    background: #E2E8F0;
    color: #0F172A;
}

.pwa-badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: #F3E8FF;
    color: #7C3AED;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 14px;
}

.pwa-pulse-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10B981;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pwaPulse 1.8s infinite;
}

@keyframes pwaPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

.pwa-header-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 12px;
}

.pwa-app-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    background: #0F172A;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: 0 6px 16px rgba(124, 58, 237, 0.25);
    border: 1.5px solid #DDD6FE;
    flex-shrink: 0;
}

.pwa-app-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pwa-header-text {
    flex: 1;
}

.pwa-title {
    font-size: 18px;
    font-weight: 800;
    color: #0F172A;
    margin: 0 0 2px 0;
    line-height: 1.25;
}

.pwa-subtitle {
    font-size: 12.5px;
    color: #64748B;
    margin: 0;
    font-weight: 500;
}

.pwa-desc {
    font-size: 13.5px;
    color: #334155;
    line-height: 1.45;
    margin: 0 0 16px 0;
}

.pwa-features-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 18px;
    background: #FAF8FE;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid #EDE9FE;
}

.pwa-feature-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.pwa-feature-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: #EDE4FD;
    color: #7C3AED;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pwa-feature-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.pwa-feature-info strong {
    font-size: 12.5px;
    color: #1E293B;
    font-weight: 700;
}

.pwa-feature-info span {
    font-size: 11.5px;
    color: #64748B;
    line-height: 1.35;
}

/* iOS Specific Guide */
.pwa-ios-instructions {
    background: #F5F3FF;
    border: 1px dashed #A78BFA;
    border-radius: 14px;
    padding: 12px 14px;
    margin-bottom: 16px;
    text-align: left;
}

.pwa-ios-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    color: #6D28D9;
    margin-bottom: 8px;
}

.pwa-ios-steps {
    margin: 0;
    padding-left: 20px;
    font-size: 12px;
    color: #334155;
    line-height: 1.55;
}

.pwa-ios-steps li {
    margin-bottom: 4px;
}

/* Action Buttons */
.pwa-actions-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-pwa-install {
    width: 100%;
    padding: 13px 20px;
    background: linear-gradient(135deg, #7C3AED 0%, #9333EA 100%);
    color: #FFFFFF;
    border: none;
    border-radius: 14px;
    font-size: 14.5px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 4px 18px rgba(124, 58, 237, 0.35);
    transition: all 0.2s ease;
}

.btn-pwa-install:hover {
    box-shadow: 0 6px 24px rgba(124, 58, 237, 0.45);
    transform: translateY(-1px);
}

.btn-pwa-install:active {
    transform: scale(0.98);
}

.btn-pwa-dismiss {
    width: 100%;
    background: transparent;
    border: none;
    color: #64748B;
    font-size: 12.5px;
    font-weight: 600;
    padding: 8px 12px;
    cursor: pointer;
    text-align: center;
    transition: color 0.15s ease;
}

.btn-pwa-dismiss:hover {
    color: #0F172A;
}

/* ==========================================================================
   Real-Time Push Notifications & Notification Bell Styles
   ========================================================================== */
.notif-bell-container {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.btn-notif-bell {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: #FFFFFF;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-notif-bell:hover {
    background: #F8FAFC;
    border-color: #D8B4FE;
    color: var(--primary);
    transform: translateY(-1px);
}

.notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    border-radius: 999px;
    background: #EF4444;
    color: #FFFFFF;
    font-size: 10px;
    font-weight: 800;
    line-height: 16px;
    text-align: center;
    border: 2px solid #FFFFFF;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
    animation: notifPulse 2s infinite;
}

@keyframes notifPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Notification Dropdown Menu */
.notif-dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 350px;
    max-width: 90vw;
    background: #FFFFFF;
    border: 1.5px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, 0.14);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.notif-dropdown-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.notif-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-soft);
    background: #FAFAFC;
}

.notif-header-title {
    font-size: 14.5px;
    font-weight: 700;
    color: #0F172A;
}

.notif-action-link {
    background: transparent;
    border: none;
    color: var(--primary);
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    transition: background 0.15s ease;
}

.notif-action-link:hover {
    background: #EDE4FD;
}

.notif-items-list {
    max-height: 330px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-soft);
    text-decoration: none;
    color: inherit;
    transition: background 0.15s ease;
    cursor: pointer;
    position: relative;
}

.notif-item:hover {
    background: #F8FAFC;
}

.notif-item.unread {
    background: #FAF7FE;
}

.notif-item.unread:hover {
    background: #F3EDFD;
}

.notif-item-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.notif-item-icon.lead {
    background: #EDE4FD;
    color: #7C3AED;
}

.notif-item-icon.payment {
    background: #DCFCE7;
    color: #16A34A;
}

.notif-item-icon.system {
    background: #E0F2FE;
    color: #0284C7;
}

.notif-item-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.notif-item-title {
    font-size: 12.5px;
    font-weight: 700;
    color: #0F172A;
    line-height: 1.3;
}

.notif-item-body {
    font-size: 11.5px;
    color: #475569;
    line-height: 1.35;
}

.notif-item-time {
    font-size: 10.5px;
    color: #94A3B8;
    margin-top: 3px;
}

.notif-unread-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #7C3AED;
    margin-top: 6px;
    flex-shrink: 0;
}

.notif-empty-state {
    padding: 32px 20px;
    text-align: center;
    font-size: 12.5px;
    color: #94A3B8;
}

.notif-dropdown-footer {
    padding: 11px 16px;
    background: #FAFAFC;
    border-top: 1px solid var(--border-soft);
    text-align: center;
}

.notif-dropdown-footer a {
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
}

.notif-dropdown-footer a:hover {
    text-decoration: underline;
}

/* Permission Banner */
.push-permission-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 13px 18px;
    background: linear-gradient(135deg, #FAF5FF 0%, #F5F3FF 100%);
    border: 1.5px solid #DDD6FE;
    border-radius: 14px;
    margin-bottom: 22px;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.05);
}

.push-banner-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.push-banner-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #EDE4FD;
    color: #7C3AED;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.push-banner-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.push-banner-text strong {
    font-size: 13.5px;
    color: #1E1B4B;
    font-weight: 700;
}

.push-banner-text span {
    font-size: 12px;
    color: #6B7280;
    line-height: 1.35;
}

.push-banner-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.btn-push-enable {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 15px;
    border-radius: 10px;
    background: #7C3AED;
    color: #FFFFFF;
    font-size: 12.5px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(124, 58, 237, 0.25);
    transition: all 0.15s ease;
}

.btn-push-enable:hover {
    background: #6D28D9;
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.35);
    transform: translateY(-1px);
}

.btn-push-dismiss {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: transparent;
    border: none;
    font-size: 18px;
    color: #9CA3AF;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.btn-push-dismiss:hover {
    background: #EDE9FE;
    color: #4B5563;
}

/* In-App Live Toast Notification */
.inapp-notif-toast {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999999;
    max-width: 380px;
    width: calc(100% - 48px);
    background: #0F172A;
    color: #FFFFFF;
    padding: 14px 18px;
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    transform: translateY(-40px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.inapp-notif-toast.show {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.inapp-toast-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, #7C3AED, #9333EA);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.inapp-toast-content {
    flex: 1;
}

.inapp-toast-title {
    font-size: 13.5px;
    font-weight: 700;
    color: #FFFFFF;
    margin-bottom: 2px;
}

.inapp-toast-body {
    font-size: 12px;
    color: #CBD5E1;
    line-height: 1.35;
}

.inapp-toast-close {
    background: transparent;
    border: none;
    color: #94A3B8;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
}

@media (max-width: 640px) {
    .notif-dropdown-menu {
        width: 320px;
        right: -80px;
    }

    .push-permission-banner {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .push-banner-actions {
        width: 100%;
        justify-content: space-between;
    }

    .btn-push-enable {
        flex: 1;
        justify-content: center;
    }
}


