/* ==========================================================================
   CARDYLA DESIGN SYSTEM (Phase 2 Foundations)
   Guiding Principle: Restraint, visual hierarchy, purposeful whitespace.
   The interface steps back and lets the greeting card artwork be the star.
   ========================================================================== */

:root {
    /* ── 2a. Color Palette Tokens ────────────────────────────────────────── */
    --color-primary: #c026d3;          /* Cardyla Signature Magenta */
    --color-primary-hover: #a21caf;    /* Magenta Darker */
    --color-primary-active: #86198f;   /* Magenta Deep */
    --color-primary-subtle: #fdf4ff;   /* Soft Magenta Tint */
    --color-primary-border: #f5d0fe;   /* Magenta Light Border */
    --color-primary-gradient: linear-gradient(135deg, #ec4899 0%, #c026d3 50%, #7e22ce 100%);

    --color-secondary: #7e22ce;        /* Deep Violet */
    --color-secondary-hover: #6b21a8;
    --color-secondary-subtle: #f5f3ff;

    /* Backgrounds & Surfaces */
    --color-bg-app: #f8fafc;           /* Crisp, clean slate-50 background */
    --color-bg-surface: #ffffff;       /* Pure white panels & cards */
    --color-bg-elevated: #ffffff;      /* Dropdowns & dialogs */
    --color-bg-subtle: #f1f5f9;        /* Neutral hover & input bg */
    --color-bg-muted: #e2e8f0;         /* Dividing lines & track bg */

    /* Typography Color Hierarchy */
    --color-text-primary: #0f172a;     /* Deep slate (High contrast) */
    --color-text-secondary: #334155;   /* Slate 700 (Readable body copy) */
    --color-text-muted: #64748b;       /* Slate 500 (Subtitles & metadata) */
    --color-text-dim: #94a3b8;         /* Slate 400 (Placeholders & disabled) */
    --color-text-inverse: #ffffff;     /* White text on dark/brand surfaces */

    /* Borders */
    --color-border: #e2e8f0;           /* Standard clean border */
    --color-border-subtle: #f1f5f9;    /* Light inner divider */
    --color-border-strong: #cbd5e1;    /* Strong boundary */
    --color-border-focus: #c026d3;     /* Focus state */

    /* State & Status Colors */
    --color-success: #059669;          /* Emerald */
    --color-success-bg: #ecfdf5;
    --color-success-border: #a7f3d0;

    --color-warning: #d97706;          /* Amber */
    --color-warning-bg: #fffbeb;
    --color-warning-border: #fde68a;

    --color-danger: #dc2626;           /* Rose / Red */
    --color-danger-bg: #fef2f2;
    --color-danger-border: #fecaca;

    --color-info: #2563eb;             /* Blue */
    --color-info-bg: #eff6ff;
    --color-info-border: #bfdbfe;

    /* ── 2a. Typography Scale & Fonts ────────────────────────────────────── */
    --font-heading: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    --text-display: 2.25rem;           /* 36px - Main Landing Titles */
    --text-h1: 1.45rem;                /* 23px - Page Main Headings */
    --text-h2: 1.25rem;                /* 20px - Section Headings */
    --text-h3: 1.05rem;                /* 16.8px - Sub-section Headings */
    --text-h4: 0.9375rem;              /* 15px - Card Titles & Dialog Headings */
    --text-body-lg: 1rem;              /* 16px - Featured body */
    --text-body: 0.875rem;             /* 14px - Standard UI text */
    --text-body-sm: 0.8125rem;         /* 13px - Compact UI text & tables */
    --text-caption: 0.75rem;           /* 12px - Footers & timestamps */
    --text-badge: 0.6875rem;           /* 11px - Micro tags & role pills */

    /* ── 2a. Spacing Scale ───────────────────────────────────────────────── */
    --space-1: 0.25rem;                /* 4px */
    --space-2: 0.5rem;                 /* 8px */
    --space-3: 0.75rem;                /* 12px */
    --space-4: 1rem;                   /* 16px */
    --space-5: 1.25rem;                /* 20px */
    --space-6: 1.5rem;                 /* 24px */
    --space-8: 2rem;                   /* 32px */
    --space-10: 2.5rem;                /* 40px */
    --space-12: 3rem;                  /* 48px */
    --space-16: 4rem;                  /* 64px */

    /* ── 2a. Border Radius Scale ─────────────────────────────────────────── */
    --radius-sm: 6px;                  /* Badges, tooltips, action pills */
    --radius-md: 8px;                  /* Inputs, buttons, dropdown items */
    --radius-lg: 12px;                 /* Template cards, stat cards, dialogs */
    --radius-xl: 16px;                 /* Modals, prominent containers */
    --radius-full: 9999px;             /* Avatars, status pills, filter chips */

    /* ── 2a. Restrained Elevation & Shadows ──────────────────────────────── */
    --shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
    --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.06), 0 1px 2px -1px rgba(15, 23, 42, 0.04);
    --shadow-card: 0 4px 12px -2px rgba(15, 23, 42, 0.05), 0 2px 4px -2px rgba(15, 23, 42, 0.02);
    --shadow-hover: 0 10px 24px -4px rgba(15, 23, 42, 0.08), 0 4px 8px -2px rgba(15, 23, 42, 0.03);
    --shadow-modal: 0 20px 40px -8px rgba(15, 23, 42, 0.16), 0 8px 16px -4px rgba(15, 23, 42, 0.04);
    --shadow-popover: 0 16px 32px -4px rgba(15, 23, 42, 0.12), 0 4px 8px -2px rgba(15, 23, 42, 0.04);

    /* Layout Dimensions */
    --sidebar-width: 230px;
    --header-height: 56px;
    --footer-height: 48px;

    /* Transition standard */
    --transition-fast: 0.15s ease;
    --transition-base: 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Base Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: var(--font-body);
    background-color: var(--color-bg-app);
    color: var(--color-text-primary);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ── 2b. Standard Icon System ────────────────────────────────────────────── */
svg {
    max-width: 100%;
    max-height: 100%;
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

.icon-xs { width: 14px !important; height: 14px !important; }
.icon-sm { width: 16px !important; height: 16px !important; }
.icon-md { width: 18px !important; height: 18px !important; }
.icon-lg { width: 20px !important; height: 20px !important; }
.icon-xl { width: 24px !important; height: 24px !important; }

/* ── 2c. Core Button Hierarchy ───────────────────────────────────────────── */
.btn-cardyla-primary,
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    background: var(--color-primary);
    color: var(--color-text-inverse) !important;
    border: 1px solid var(--color-primary);
    padding: 0.45rem 0.95rem;
    border-radius: var(--radius-md);
    font-family: var(--font-heading);
    font-size: var(--text-body-sm);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    line-height: 1.25;
    white-space: nowrap;
    user-select: none;
}

.btn-cardyla-primary:hover,
.btn-primary:hover {
    background: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-cardyla-primary:active,
.btn-primary:active {
    background: var(--color-primary-active);
    transform: translateY(0);
}

.btn-cardyla-primary:focus-visible,
.btn-primary:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--color-primary-border);
}

/* Secondary Button (Bordered / Clean Surface) */
.btn-cardyla-outline,
.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    background: var(--color-bg-surface);
    color: var(--color-text-secondary) !important;
    border: 1px solid var(--color-border);
    padding: 0.45rem 0.95rem;
    border-radius: var(--radius-md);
    font-family: var(--font-heading);
    font-size: var(--text-body-sm);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    line-height: 1.25;
    white-space: nowrap;
    user-select: none;
}

.btn-cardyla-outline:hover,
.btn-secondary:hover {
    background: var(--color-bg-subtle);
    color: var(--color-text-primary) !important;
    border-color: var(--color-border-strong);
    transform: translateY(-1px);
}

.btn-cardyla-outline:focus-visible,
.btn-secondary:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--color-bg-muted);
}

/* Tertiary Button (Ghost / Minimal) */
.btn-ghost,
.btn-tertiary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    background: transparent;
    color: var(--color-text-muted);
    border: 1px solid transparent;
    padding: 0.45rem 0.8rem;
    border-radius: var(--radius-md);
    font-family: var(--font-heading);
    font-size: var(--text-body-sm);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    line-height: 1.25;
    white-space: nowrap;
}

.btn-ghost:hover,
.btn-tertiary:hover {
    background: var(--color-bg-subtle);
    color: var(--color-text-primary);
}

/* Destructive Button */
.btn-destructive,
.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    background: var(--color-danger-bg);
    color: var(--color-danger) !important;
    border: 1px solid var(--color-danger-border);
    padding: 0.45rem 0.95rem;
    border-radius: var(--radius-md);
    font-family: var(--font-heading);
    font-size: var(--text-body-sm);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    line-height: 1.25;
    white-space: nowrap;
}

.btn-destructive:hover,
.btn-danger:hover {
    background: #fee2e2;
    border-color: #f87171;
    color: #991b1b !important;
    transform: translateY(-1px);
}

/* Button Sizing Modifiers */
.btn-sm { padding: 0.3rem 0.65rem; font-size: var(--text-caption); border-radius: var(--radius-sm); }
.btn-lg { padding: 0.65rem 1.35rem; font-size: var(--text-body); border-radius: var(--radius-md); }
.btn-icon-only { padding: 0.45rem; border-radius: var(--radius-md); }

/* ── 2c. Core Form Controls ──────────────────────────────────────────────── */
.form-input,
.form-select,
.form-textarea {
    width: 100%;
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 0.5rem 0.75rem;
    font-family: var(--font-body);
    font-size: var(--text-body-sm);
    color: var(--color-text-primary);
    transition: all var(--transition-fast);
    outline: none;
}

.form-input { height: 38px; }
.form-select { height: 38px; cursor: pointer; }
.form-textarea { resize: vertical; min-height: 80px; }

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-subtle);
}

.form-label {
    display: block;
    font-family: var(--font-heading);
    font-size: var(--text-caption);
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-bottom: 0.35rem;
}

/* ── 2c. Badges & Status Pills ───────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-family: var(--font-heading);
    font-size: var(--text-badge);
    font-weight: 700;
    padding: 2px 7px;
    border-radius: var(--radius-full);
    line-height: 1.2;
    white-space: nowrap;
}

.badge-pro { background: var(--color-warning-bg); color: #92400e; border: 1px solid var(--color-warning-border); }
.badge-free { background: var(--color-bg-subtle); color: var(--color-text-muted); border: 1px solid var(--color-border); }
.badge-active { background: var(--color-success-bg); color: var(--color-success); border: 1px solid var(--color-success-border); }
.badge-locked { background: var(--color-danger-bg); color: var(--color-danger); border: 1px solid var(--color-danger-border); }
.badge-trial { background: var(--color-secondary-subtle); color: var(--color-secondary); border: 1px solid #ddd6fe; }
.badge-due { background: #fff7ed; color: #c2410c; border: 1px solid #ffedd5; }

/* ── 2c. Filter Chip System ──────────────────────────────────────────────── */
.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-full);
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    font-family: var(--font-heading);
    font-size: var(--text-body-sm);
    font-weight: 600;
    color: var(--color-text-secondary);
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    user-select: none;
    white-space: nowrap;
}

.filter-chip:hover {
    background: var(--color-bg-subtle);
    color: var(--color-text-primary);
    border-color: var(--color-border-strong);
    transform: translateY(-1px);
}

.filter-chip.active {
    background: var(--color-primary);
    color: var(--color-text-inverse);
    border-color: var(--color-primary);
    box-shadow: 0 2px 6px rgba(192, 38, 211, 0.25);
}

.filter-chip .chip-remove-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.25);
    color: var(--color-text-inverse);
    border: none;
    cursor: pointer;
    font-size: 10px;
    line-height: 1;
    margin-left: 2px;
}

.filter-chip .chip-remove-btn:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* ── 2c. User Avatar System ─────────────────────────────────────────────── */
.cardyla-avatar {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    background: var(--color-primary-subtle);
    color: var(--color-primary);
    font-family: var(--font-heading);
    font-weight: 700;
    overflow: hidden;
    flex-shrink: 0;
    user-select: none;
    border: 2px solid var(--color-bg-surface);
}

.cardyla-avatar-xs { width: 22px; height: 22px; font-size: 10px; }
.cardyla-avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.cardyla-avatar-md { width: 36px; height: 36px; font-size: 13px; }
.cardyla-avatar-lg { width: 48px; height: 48px; font-size: 16px; }
.cardyla-avatar-xl { width: 64px; height: 64px; font-size: 20px; }

.cardyla-avatar img,
.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.avatar-initials {
    line-height: 1;
    text-transform: uppercase;
}

.avatar-status-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 25%;
    height: 25%;
    min-width: 6px;
    min-height: 6px;
    border-radius: 50%;
    background: var(--color-success);
    border: 2px solid var(--color-bg-surface);
}

/* ── 2c. Search Bar Component ────────────────────────────────────────────── */
.cardyla-search-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--color-bg-subtle);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 0.4rem 0.75rem;
    transition: all var(--transition-fast);
    width: 100%;
}

.cardyla-search-bar:focus-within {
    background: var(--color-bg-surface);
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-subtle);
}

.cardyla-search-bar .search-icon {
    width: 16px;
    height: 16px;
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.cardyla-search-bar .search-input {
    border: none;
    background: transparent;
    outline: none;
    font-size: var(--text-body-sm);
    color: var(--color-text-primary);
    width: 100%;
    font-family: inherit;
}

.cardyla-search-bar .search-clear-btn {
    background: transparent;
    border: none;
    color: var(--color-text-dim);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    border-radius: 50%;
    transition: color var(--transition-fast);
}

.cardyla-search-bar .search-clear-btn:hover {
    color: var(--color-text-primary);
}

/* ── 2c. Tabs Component ─────────────────────────────────────────────────── */
.cardyla-tabs-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: var(--space-4);
    overflow-x: auto;
}

.cardyla-tab-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 0.9rem;
    font-family: var(--font-heading);
    font-size: var(--text-body-sm);
    font-weight: 600;
    color: var(--color-text-muted);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    text-decoration: none;
    margin-bottom: -1px;
}

.cardyla-tab-item:hover {
    color: var(--color-text-primary);
}

.cardyla-tab-item.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
    font-weight: 700;
}

/* ── 2c. Pagination Component ────────────────────────────────────────────── */
.cardyla-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    margin: var(--space-6) 0;
}

.pagination-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 0.5rem;
    border-radius: var(--radius-md);
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    color: var(--color-text-secondary);
    font-family: var(--font-heading);
    font-size: var(--text-caption);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.pagination-item:hover:not(.disabled):not(.active) {
    background: var(--color-bg-subtle);
    border-color: var(--color-border-strong);
    color: var(--color-text-primary);
}

.pagination-item.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--color-text-inverse);
    cursor: default;
}

.pagination-item.disabled {
    opacity: 0.45;
    cursor: not-allowed;
    background: var(--color-bg-subtle);
}

/* ── 2c. Tooltip Component ───────────────────────────────────────────────── */
[data-tooltip] {
    position: relative;
    cursor: pointer;
}

[data-tooltip]::before,
[data-tooltip]::after {
    position: absolute;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
    pointer-events: none;
    z-index: 1000;
}

[data-tooltip]::before {
    content: '';
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-2px);
    border: 4px solid transparent;
    border-top-color: var(--color-text-primary);
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(2px);
    background: var(--color-text-primary);
    color: var(--color-text-inverse);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    font-size: var(--text-badge);
    font-family: var(--font-body);
    font-weight: 500;
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
}

[data-tooltip]:hover::before,
[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* ── 2c. Empty States & Skeletons ────────────────────────────────────────── */
.cardyla-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--space-10) var(--space-4);
    background: var(--color-bg-surface);
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-lg);
}

.empty-state-icon {
    width: 44px;
    height: 44px;
    color: var(--color-text-dim);
    margin-bottom: var(--space-3);
    stroke-width: 1.5;
}

.empty-state-title {
    font-family: var(--font-heading);
    font-size: var(--text-h3);
    font-weight: 700;
    color: var(--color-text-primary);
    margin-bottom: 0.25rem;
}

.empty-state-desc {
    font-size: var(--text-body-sm);
    color: var(--color-text-muted);
    max-width: 360px;
    margin-bottom: var(--space-4);
    line-height: 1.45;
}

.skeleton-box,
.skeleton {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 37%, #f1f5f9 63%);
    background-size: 400% 100%;
    animation: skeletonShimmer 1.4s ease infinite;
    border-radius: var(--radius-sm);
}

.skeleton-text { height: 14px; margin-bottom: 6px; width: 80%; }
.skeleton-text.sm { height: 10px; width: 60%; }
.skeleton-circle { border-radius: 50% !important; }
.skeleton-card { aspect-ratio: 5 / 7; border-radius: var(--radius-md); }

@keyframes skeletonShimmer {
    0% { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

/* ── 2d. Layout Architecture (Sidebar + Main + Top Header) ───────────────── */
.cardyla-body {
    background-color: var(--color-bg-app);
    overflow: hidden;
    height: 100vh;
}

.cardyla-app-layout {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    position: relative;
}

/* Sidebar Desktop */
.cardyla-sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    background: var(--color-bg-surface);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
    z-index: 100;
    flex-shrink: 0;
    transition: transform var(--transition-base);
}

.sidebar-brand {
    padding: 0.85rem 1rem 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--color-border-subtle);
    flex-shrink: 0;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.brand-logo {
    height: 30px;
    width: auto;
    object-fit: contain;
    transition: transform var(--transition-fast);
}

.brand-link:hover .brand-logo {
    transform: scale(1.02);
}

.sidebar-nav-scroll {
    flex: 1 1 0%;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 0.75rem 0.6rem 2rem 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.sidebar-nav-scroll::-webkit-scrollbar { width: 4px; }
.sidebar-nav-scroll::-webkit-scrollbar-thumb { background: var(--color-bg-muted); border-radius: 4px; }

.nav-section-label {
    font-size: var(--text-badge);
    font-weight: 700;
    color: var(--color-text-dim);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 0.5rem 0.65rem 0.2rem;
    font-family: var(--font-heading);
}

.sidebar-admin-divider {
    height: 1px;
    background: linear-gradient(90deg, rgba(226, 232, 240, 0) 0%, #cbd5e1 50%, rgba(226, 232, 240, 0) 100%);
    margin: 1.15rem 0.35rem 0.65rem;
    border: none;
}

.sidebar-admin-group {
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    padding: 0.35rem 0.3rem 0.45rem;
    margin-top: 0.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.admin-nav-label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: #334155 !important;
    font-weight: 800 !important;
    font-size: var(--text-badge);
    letter-spacing: 0.05em;
    padding: 0.3rem 0.45rem 0.2rem;
}

.admin-badge-indicator {
    font-size: 0.85rem;
    line-height: 1;
}

.sidebar-admin-group .sidebar-nav-item:hover {
    background-color: rgba(15, 23, 42, 0.06);
    color: #0f172a;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.sidebar-nav-item,
.cardyla-nav-item {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: var(--text-body-sm);
    font-weight: 500;
    color: var(--color-text-muted);
    text-decoration: none;
    transition: all var(--transition-fast);
    cursor: pointer;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    white-space: nowrap;
    user-select: none;
}

.sidebar-nav-item svg,
.cardyla-nav-item svg {
    width: 17px !important;
    height: 17px !important;
    stroke-width: 1.75;
    color: var(--color-text-muted);
    transition: color var(--transition-fast);
}

.sidebar-nav-item:hover,
.cardyla-nav-item:hover {
    background-color: var(--color-bg-subtle);
    color: var(--color-text-primary);
}

.sidebar-nav-item:hover svg,
.cardyla-nav-item:hover svg {
    color: var(--color-text-primary);
}

.sidebar-nav-item.active,
.cardyla-nav-item.active {
    background: var(--color-primary) !important;
    color: var(--color-text-inverse) !important;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(192, 38, 211, 0.25);
}

.sidebar-nav-item.active svg,
.cardyla-nav-item.active svg {
    stroke: var(--color-text-inverse) !important;
    color: var(--color-text-inverse) !important;
}

/* Sidebar Bottom Upgrade/Pro Card */
.sidebar-promo {
    padding: 0.65rem;
    margin-top: auto;
    border-top: 1px solid var(--color-border-subtle);
    background: var(--color-bg-surface);
    flex-shrink: 0;
    width: 100%;
    position: relative;
    z-index: 10;
}

.go-premium-card {
    background: linear-gradient(135deg, #fdf4ff 0%, #fae8ff 100%);
    border: 1px solid var(--color-primary-border);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    text-align: left;
}

.premium-title {
    font-family: var(--font-heading);
    font-size: var(--text-body-sm);
    font-weight: 700;
    color: #86198f;
    margin-bottom: 0.15rem;
}

.premium-desc {
    font-size: var(--text-caption);
    color: #a21caf;
    line-height: 1.35;
    margin-bottom: 0.5rem;
}

.btn-upgrade-now {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    background: var(--color-primary);
    color: var(--color-text-inverse);
    border: none;
    padding: 0.35rem 0.65rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-heading);
    font-size: var(--text-caption);
    font-weight: 700;
    text-decoration: none;
    transition: all var(--transition-fast);
    width: 100%;
}

.btn-upgrade-now:hover {
    background: var(--color-primary-hover);
}

.sidebar-admin-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md, 10px);
    padding: 0.5rem 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    transition: all var(--transition-fast, 0.15s ease);
}

.sidebar-admin-card:hover {
    border-color: #cbd5e1;
    background: #ffffff;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
}

.sidebar-admin-card-header {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.sidebar-admin-icon-wrap {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: #f3e8ff;
    color: #7e22ce;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    flex-shrink: 0;
}

.sidebar-subadmin-icon-wrap {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    background: #f0fdfa;
    color: #0d9488;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    flex-shrink: 0;
}

.sidebar-admin-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sidebar-admin-title {
    font-family: var(--font-heading, inherit);
    font-size: 0.78rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.sidebar-admin-sub {
    font-size: 0.68rem;
    font-weight: 500;
    color: #64748b;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-admin-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    background: #7e22ce;
    color: #ffffff !important;
    text-decoration: none !important;
    font-family: var(--font-heading, inherit);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.35rem 0.5rem;
    border-radius: var(--radius-sm, 6px);
    transition: all 0.15s ease;
    border: none;
    cursor: pointer;
    line-height: 1;
}

.sidebar-admin-btn:hover {
    background: #6b21a8;
    color: #ffffff !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(126, 34, 206, 0.25);
}

.sidebar-subadmin-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    background: #0f766e;
    color: #ffffff !important;
    text-decoration: none !important;
    font-family: var(--font-heading, inherit);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.35rem 0.5rem;
    border-radius: var(--radius-sm, 6px);
    transition: all 0.15s ease;
    border: none;
    cursor: pointer;
    line-height: 1;
}

.sidebar-subadmin-btn:hover {
    background: #115e59;
    color: #ffffff !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(15, 118, 110, 0.25);
}

.pro-active-card {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: var(--radius-md, 10px);
    padding: 0.5rem 0.6rem;
}

.pro-badge-header {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.35rem;
}

.pro-card-title {
    font-family: var(--font-heading, inherit);
    font-weight: 700;
    font-size: 0.78rem;
    color: #92400e;
}

.pro-card-sub {
    font-size: 0.68rem;
    color: #b45309;
}

.pro-card-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    background: #d97706;
    color: #ffffff !important;
    text-decoration: none !important;
    font-family: var(--font-heading, inherit);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.35rem 0.5rem;
    border-radius: var(--radius-sm, 6px);
    transition: all 0.15s ease;
    border: none;
    cursor: pointer;
    line-height: 1;
}

.pro-card-btn:hover {
    background: #b45309;
    color: #ffffff !important;
    transform: translateY(-1px);
}

/* ── 2d. Main Viewport & Header ──────────────────────────────────────────── */
.cardyla-main-viewport {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    background-color: var(--color-bg-app);
    min-width: 0;
}

.cardyla-header {
    height: var(--header-height);
    min-height: var(--header-height);
    background: var(--color-bg-surface);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    z-index: 90;
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    flex: 1;
    max-width: 480px;
}

.header-search-wrap {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    background: var(--color-bg-subtle);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    padding: 0.35rem 0.75rem;
    width: 100%;
    transition: all var(--transition-fast);
}

.header-search-wrap:focus-within {
    background: var(--color-bg-surface);
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-subtle);
}

.header-search-icon {
    width: 15px !important;
    height: 15px !important;
    color: var(--color-text-muted);
    flex-shrink: 0;
}

.header-search-input {
    border: none;
    background: transparent;
    outline: none;
    font-size: var(--text-body-sm);
    color: var(--color-text-primary);
    width: 100%;
    font-family: inherit;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}

/* Responsive Mobile Navigation Drawer */
.mobile-nav-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.mobile-nav-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.btn-mobile-nav-toggle {
    display: none;
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 0.4rem;
    cursor: pointer;
    color: var(--color-text-primary);
}

@media (max-width: 1023px) {
    .btn-mobile-nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
    .cardyla-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        transform: translateX(-100%);
        box-shadow: var(--shadow-modal);
        z-index: 999;
    }
    .cardyla-sidebar.mobile-open {
        transform: translateX(0);
    }
}

.btn-template-studio-ai {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: transparent;
    border: 1px solid var(--border, #e2e8f0);
    border-radius: var(--radius-full);
    padding: 0.35rem 0.75rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted, #64748b);
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}

.btn-template-studio-ai:hover {
    background: #f1f5f9;
    color: var(--text-main, #0f172a);
    border-color: #cbd5e1;
}

.btn-template-studio-ai svg {
    width: 15px !important;
    height: 15px !important;
    color: var(--primary, #c026d3);
}

.btn-need-help {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    padding: 0.35rem 0.75rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-need-help:hover {
    background: #f1f5f9;
    color: var(--text-main);
    border-color: #cbd5e1;
}

.btn-need-help svg {
    width: 15px !important;
    height: 15px !important;
    color: var(--primary);
}

.btn-icon-circle {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    position: relative;
    transition: all 0.15s ease;
}

.btn-icon-circle:hover {
    background: #f1f5f9;
    color: var(--text-main);
}

.btn-icon-circle svg {
    width: 16px !important;
    height: 16px !important;
}

.notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 16px;
    height: 16px;
    background: #ef4444;
    color: #ffffff;
    border-radius: 50%;
    font-size: 0.6rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #ffffff;
}

.header-profile-pill {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    background: #f1f5f9;
    padding: 0.25rem 0.6rem 0.25rem 0.3rem;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.header-profile-pill:hover {
    background: #e2e8f0;
}

.header-avatar-img {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
}

.header-profile-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-main);
}

.pro-tag-mini {
    background: #fef3c7;
    color: #b45309;
    font-size: 0.6rem;
    font-weight: 800;
    padding: 1px 4px;
    border-radius: 3px;
}

.header-profile-pill svg {
    width: 13px !important;
    height: 13px !important;
}

/* --------------------------------------------------------------------------
   CONTENT SCROLL AREA
   -------------------------------------------------------------------------- */
.cardyla-content-area {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem 1.5rem 2.5rem;
    background-color: var(--bg-main);
}

.cardyla-content-area::-webkit-scrollbar {
    width: 5px;
}
.cardyla-content-area::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

/* Tab System */
.tab-content {
    display: none;
}
.tab-content.active {
    display: block;
    animation: fadeIn 0.2s ease;
}

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

/* --------------------------------------------------------------------------
   DASHBOARD COMPONENTS
   -------------------------------------------------------------------------- */
/* Welcome Banner */
.dashboard-welcome-banner {
    background: linear-gradient(135deg, #ffffff 0%, #fdf4ff 100%);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.15rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-sm);
}

.banner-title {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.2rem;
}

.banner-subtitle {
    font-size: 0.825rem;
    color: var(--text-muted);
}

/* Quick Actions Grid (4 Cards) */
.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.85rem;
    margin-bottom: 1.5rem;
}

.action-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
}

.action-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-card);
    border-color: #cbd5e1;
}

.action-icon-wrap {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.action-icon-wrap svg {
    width: 18px !important;
    height: 18px !important;
}

.action-content {
    flex: 1;
    min-width: 0;
}

.action-title {
    font-family: var(--font-heading);
    font-size: 0.825rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.15rem;
}

.action-desc {
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Section Header */
.cardyla-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.85rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.section-title {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main);
}

.section-count {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-dim);
}

.section-badge {
    font-size: 0.65rem;
    font-weight: 700;
    background: #f0fdf4;
    color: #16a34a;
    padding: 2px 7px;
    border-radius: var(--radius-full);
}

.section-link-action {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
}

.section-link-action:hover {
    text-decoration: underline;
}

.section-link-action svg {
    width: 13px !important;
    height: 13px !important;
}

.page-main-heading {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.2rem;
}

.page-sub-heading {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* KPI Cards Grid (Admin) */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.85rem;
    margin-bottom: 1.5rem;
}

.kpi-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.85rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: var(--shadow-sm);
}

.kpi-icon-wrap {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.kpi-icon-wrap svg {
    width: 18px !important;
    height: 18px !important;
}

.kpi-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.15rem;
}

.kpi-value {
    font-size: 1.25rem;
    font-weight: 800;
    font-family: var(--font-heading);
    color: var(--text-main);
}

.kpi-trend {
    font-size: 0.7rem;
    font-weight: 600;
}
.trend-up {
    color: #16a34a;
}

/* --------------------------------------------------------------------------
   CARDYLA TEMPLATE & PROJECT CARDS GRID (COMPACT CANVA-SCALE)
   -------------------------------------------------------------------------- */
.cardyla-template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.85rem;
}

.cardyla-card-item {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    position: relative;
}

.cardyla-card-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-card);
    border-color: #cbd5e1;
}

.card-preview-wrap {
    aspect-ratio: 5 / 7;
    background: #f8fafc;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
}

.card-preview-img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    background-color: #ffffff;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.cardyla-card-item:hover .card-preview-img {
    transform: scale(1.02);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.card-preview-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    color: var(--text-dim);
    font-size: 0.75rem;
    font-weight: 600;
}

.card-preview-placeholder svg {
    width: 28px !important;
    height: 28px !important;
}

.cardyla-pro-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #ffffff;
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    padding: 2px 7px;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.15);
    z-index: 23;
    line-height: 1.2;
    text-transform: uppercase;
}

.cardyla-pro-badge.is-pro {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #ffffff;
}

.cardyla-pro-badge.is-free {
    background: #059669;
    color: #ffffff;
}

/* Card Primary CTA (Always Visible & Visually Dominant) */
.card-primary-cta-wrap {
    position: absolute;
    bottom: 8px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 8px;
    z-index: 21;
    pointer-events: auto;
}

.btn-card-primary-cta {
    background: linear-gradient(135deg, #c026d3, #9333ea);
    color: #ffffff !important;
    border: none;
    border-radius: 9999px;
    padding: 0.38rem 0.85rem;
    font-size: 0.74rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    cursor: pointer;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(192, 38, 211, 0.38), 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
    max-width: 92%;
}

.btn-card-primary-cta:hover {
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 6px 18px rgba(192, 38, 211, 0.5), 0 2px 6px rgba(0,0,0,0.15);
    background: linear-gradient(135deg, #a21caf, #7e22ce);
}

.btn-card-primary-cta:active {
    transform: translateY(0) scale(0.98);
}

.btn-card-primary-cta svg {
    flex-shrink: 0;
}

/* Card Secondary Actions (Hidden until hover/focus on card) */
.card-secondary-actions,
.card-overlay-actions {
    position: absolute;
    inset: 0;
    bottom: 40px;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.5rem;
    opacity: 0;
    pointer-events: none;
    transform: translateY(4px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 20;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.cardyla-card-item:hover .card-secondary-actions,
.cardyla-card-item:hover .card-overlay-actions,
.cardyla-card-item:focus-within .card-secondary-actions,
.cardyla-card-item:focus-within .card-overlay-actions {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.btn-card-secondary-action,
.btn-card-action {
    position: relative;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #ffffff;
    color: var(--text-main);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    text-decoration: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    transition: transform 0.15s ease, background-color 0.15s, color 0.15s;
    padding: 0;
}

.btn-card-secondary-action:hover,
.btn-card-action:hover {
    transform: scale(1.12);
    background: #c026d3 !important;
    color: #ffffff !important;
    z-index: 35;
}

.btn-card-secondary-action.delete:hover,
.btn-card-action.delete:hover {
    background: #ef4444 !important;
    color: #ffffff !important;
}

.btn-card-secondary-action svg,
.btn-card-action svg {
    width: 13px !important;
    height: 13px !important;
}

/* Micro-Tooltips bounded to each icon - Never bleed into adjacent cards */
.card-action-tooltip {
    position: absolute;
    bottom: calc(100% + 7px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: rgba(15, 23, 42, 0.95);
    color: #ffffff;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 3px 6px;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, transform 0.15s ease;
    box-shadow: 0 3px 8px rgba(0,0,0,0.25);
    z-index: 40;
}

.card-action-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 4px;
    border-style: solid;
    border-color: rgba(15, 23, 42, 0.95) transparent transparent transparent;
}

.btn-card-secondary-action:hover .card-action-tooltip,
.btn-card-action:hover .card-action-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.card-item-info {
    padding: 0.45rem 0.6rem;
    background: #ffffff;
    border-top: 1px solid var(--border-subtle);
}

.card-item-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.1rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-item-meta {
    font-size: 0.68rem;
    color: var(--text-muted);
}

/* Blank Canvas Card */
.blank-canvas-card .blank-preview {
    background: #f8fafc;
    border: 2px dashed #cbd5e1;
    flex-direction: column;
    gap: 0.35rem;
}

.plus-circle-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(192, 38, 211, 0.1);
    color: var(--primary);
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.blank-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
}

/* Category Filter Pills Bar */
.template-filter-pills-bar {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.template-filter-pills-bar::-webkit-scrollbar {
    height: 3px;
}
.template-filter-pills-bar::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 3px;
}

.category-filter-pill {
    padding: 0.32rem 0.75rem;
    border-radius: var(--radius-full);
    background: #ffffff;
    border: 1px solid var(--border);
    font-size: 0.775rem;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.15s ease;
    cursor: pointer;
}

.category-filter-pill:hover {
    background: #f1f5f9;
    color: var(--text-main);
    border-color: #cbd5e1;
}

.category-filter-pill.active {
    background: #1e293b;
    color: #ffffff;
    border-color: #1e293b;
    box-shadow: 0 2px 5px rgba(15, 23, 42, 0.14);
}

.pill-active-filter {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #334155;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-full);
}

.pill-active-filter a {
    color: #64748b;
    text-decoration: none;
    font-weight: 800;
    margin-left: 2px;
    transition: color 0.15s ease;
}

.pill-active-filter a:hover {
    color: #0f172a;
}

.clear-filters-link {
    font-size: 0.72rem;
    font-weight: 700;
    color: #ef4444;
    text-decoration: none;
    margin-left: 0.4rem;
}

/* Empty State */
.cardyla-empty-state {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 2.25rem 1.5rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.empty-icon-wrap {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.empty-title {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.25rem;
}

.empty-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    max-width: 380px;
    margin: 0 auto 1rem;
}

/* Wide Premium Banner */
.premium-wide-banner {
    background: linear-gradient(135deg, #7e22ce 0%, #c026d3 50%, #ec4899 100%);
    border-radius: 12px;
    padding: 1.35rem 1.5rem;
    color: #ffffff;
    box-shadow: 0 6px 20px rgba(192, 38, 211, 0.2);
    position: relative;
    overflow: hidden;
}

.premium-crown-badge {
    display: inline-block;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(4px);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    margin-bottom: 0.5rem;
}

.premium-banner-heading {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.premium-banner-text {
    font-size: 0.8rem;
    opacity: 0.9;
    max-width: 550px;
    line-height: 1.4;
    margin-bottom: 0.85rem;
}

.btn-upgrade-banner {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: #ffffff;
    color: #86198f;
    padding: 0.45rem 1.15rem;
    border-radius: var(--radius-full);
    font-size: 0.825rem;
    font-weight: 800;
    text-decoration: none;
    box-shadow: 0 3px 10px rgba(0,0,0,0.12);
    transition: all 0.2s ease;
}

.btn-upgrade-banner:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.18);
    background: #fdf4ff;
}

.btn-upgrade-banner svg {
    width: 14px !important;
    height: 14px !important;
}

/* --------------------------------------------------------------------------
   PROFILE POPOVER MODAL (GLOBAL REUSABLE DROPDOWN)
   -------------------------------------------------------------------------- */
.cardyla-profile-popover-panel {
    position: fixed;
    top: 68px;
    right: 1.5rem;
    width: 320px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 20px 40px -15px rgba(15, 23, 42, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.04);
    z-index: 2000;
    overflow: hidden;
    animation: popIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes popIn {
    from { opacity: 0; transform: translateY(-8px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.popover-brand-header {
    padding: 1.15rem 1.25rem 0.65rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.popover-brand-header .popover-brand-logo {
    height: 28px;
    width: auto;
    object-fit: contain;
}

.btn-close-popover {
    background: transparent;
    border: none;
    cursor: pointer;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    transition: all 0.15s ease;
}

.btn-close-popover:hover {
    background: #f1f5f9;
    color: #0f172a;
}

.btn-close-popover:focus-visible {
    outline: 2px solid #c026d3;
    outline-offset: 1px;
}

.btn-close-popover svg {
    width: 16px !important;
    height: 16px !important;
}

.popover-user-info {
    padding: 0.85rem 1.25rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    background: #f8fafc;
    border-bottom: 1px solid #f1f5f9;
}

.popover-avatar-wrap {
    flex-shrink: 0;
}

.popover-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid #fdf4ff;
    box-shadow: 0 2px 8px rgba(192, 38, 211, 0.12);
    object-fit: cover;
}

.popover-user-details {
    flex: 1;
    min-width: 0;
}

.popover-user-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.25;
}

.popover-user-email {
    font-size: 0.775rem;
    color: #64748b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin: 2px 0 6px;
    line-height: 1.2;
}

.popover-plan-badge-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.plan-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.plan-upgrade-link {
    font-size: 0.75rem;
    font-weight: 700;
    color: #c026d3;
    text-decoration: none;
    transition: color 0.15s;
}

.plan-upgrade-link:hover {
    color: #7e22ce;
    text-decoration: underline;
}

.popover-nav-list {
    padding: 0.5rem 0.65rem;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.popover-nav-list::-webkit-scrollbar {
    width: 4px;
}
.popover-nav-list::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 4px;
}

.popover-divider {
    height: 1px;
    background: #f1f5f9;
    margin: 0.35rem 0.25rem;
}

.popover-nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #334155;
    text-decoration: none;
    transition: all 0.15s ease;
    cursor: pointer;
    user-select: none;
}

.popover-nav-item:hover {
    background: #f8fafc;
    color: #0f172a;
    transform: translateX(2px);
}

.popover-nav-item:focus-visible {
    outline: 2px solid #c026d3;
    outline-offset: -2px;
}

.popover-nav-item svg {
    width: 17px !important;
    height: 17px !important;
    min-width: 17px;
    max-width: 17px;
    color: #64748b;
    flex-shrink: 0;
    transition: color 0.15s;
}

.popover-nav-item:hover svg {
    color: #c026d3;
}

.popover-vault-footer {
    padding: 0.75rem 1rem;
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
}

.vault-link-card {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    background: #eff6ff;
    border: 1px solid #dbeafe;
    padding: 0.5rem 0.75rem;
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.15s ease;
}

.vault-link-card:hover {
    background: #dbeafe;
    border-color: #bfdbfe;
    transform: translateY(-1px);
}

.vault-link-card:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 1px;
}

.vault-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vault-icon svg {
    width: 18px !important;
    height: 18px !important;
}

.vault-text {
    flex: 1;
}

.vault-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: #1e40af;
}

.vault-subtitle {
    font-size: 0.68rem;
    color: #3b82f6;
}

.vault-arrow {
    width: 15px !important;
    height: 15px !important;
    color: #3b82f6;
    flex-shrink: 0;
}

.popover-logout-wrap {
    padding: 0.4rem 0.65rem;
}

.popover-logout-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    color: #dc2626;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s ease;
    cursor: pointer;
}

.popover-logout-btn:hover {
    background: #fef2f2;
    color: #b91c1c;
    transform: translateX(2px);
}

.popover-logout-btn:focus-visible {
    outline: 2px solid #dc2626;
    outline-offset: -2px;
}

.popover-logout-btn svg {
    width: 17px !important;
    height: 17px !important;
    min-width: 17px;
    max-width: 17px;
    color: #dc2626;
    flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   HELP & NOTIFICATION MODALS
   -------------------------------------------------------------------------- */
.cardyla-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.cardyla-modal-content {
    background: #ffffff;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 540px;
    box-shadow: var(--shadow-popover);
    overflow: hidden;
    animation: modalScale 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalScale {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

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

.cardyla-popover-menu {
    position: absolute;
    top: 110%;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-popover);
    z-index: 1000;
    overflow: hidden;
}

.popover-header-bar {
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}

.notification-list {
    max-height: 250px;
    overflow-y: auto;
}

.notification-item {
    padding: 0.75rem 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    border-bottom: 1px solid var(--border-subtle);
}

.notification-item.unread {
    background: #fdf4ff;
}

.notification-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    margin-top: 5px;
    flex-shrink: 0;
}

.notification-dot.read {
    background: #cbd5e1;
}

.notification-title {
    font-size: 0.825rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 2px;
}

.notification-time {
    font-size: 0.725rem;
    color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   GENERAL COMPONENTS & FORM STYLES
   -------------------------------------------------------------------------- */
.cardyla-panel {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.cardyla-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    text-align: left;
}

.cardyla-table th {
    background: #f8fafc;
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
}

.cardyla-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-main);
}

.cardyla-table tr:last-child td {
    border-bottom: none;
}

/* Table and general panel utilities */

/* Toast Alerts */
.cardyla-toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    box-shadow: var(--shadow-popover);
    z-index: 9999;
    transition: opacity 0.3s ease;
}

.cardyla-toast.success {
    background: #16a34a;
    color: #ffffff;
}

.cardyla-toast.error {
    background: #ef4444;
    color: #ffffff;
}

/* ==========================================================================
   CARDYLA PERSISTENT OCCASION NAVIGATION STRIP & POPUP SUBMENUS
   ========================================================================== */

.cardyla-occasion-nav-strip {
    position: sticky;
    top: var(--header-height, 56px);
    z-index: 90;
    width: 100%;
    background: #ffffff;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 4px 16px -6px rgba(0, 0, 0, 0.03);
    padding: 0.4rem 0 0.5rem;
    transition: all 0.2s ease;
}

.occasion-nav-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.occasion-line-1,
.occasion-line-2 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
}

.occasion-line-2 {
    display: none;
    padding-top: 0.35rem;
    border-top: 1px dashed #f1f5f9;
    width: 100%;
}
.occasion-line-2.show {
    display: block;
    animation: fadeInDropdown 0.2s ease forwards;
}

.occasion-expanded-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    width: 100%;
    padding: 0.2rem 0;
}

.step-nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-heading, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.22rem 0.6rem;
    border-radius: 9999px;
    background: linear-gradient(135deg, #7e22ce, #c026d3);
    color: #ffffff;
    box-shadow: 0 2px 5px rgba(126, 34, 206, 0.22);
    white-space: nowrap;
    flex-shrink: 0;
    line-height: 1.1;
    user-select: none;
}

.step-nav-badge.step-1-badge {
    background: linear-gradient(135deg, #7c3aed, #9333ea);
    box-shadow: 0 2px 6px rgba(124, 58, 237, 0.25);
    margin-right: 0.15rem;
}

.step-nav-badge.step-2-badge {
    background: linear-gradient(135deg, #c026d3, #db2777);
    box-shadow: 0 2px 6px rgba(192, 38, 211, 0.25);
    margin-right: 0.25rem;
}

.step-nav-badge.step-3-badge {
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.25);
    font-size: 0.68rem;
    padding: 0.22rem 0.6rem;
    margin-right: 0.25rem;
}

.occasion-tab-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--primary, #c026d3);
    background: #fdf4ff;
    border: 1.5px solid #f5d0fe;
    padding: 0.35rem 0.8rem;
    border-radius: 9999px;
    white-space: nowrap;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s ease;
    font-family: var(--font-heading, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
}
.occasion-tab-primary:hover,
.occasion-tab-primary.active {
    background: #fae8ff;
    border-color: #e879f9;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(192, 38, 211, 0.12);
}

.occasion-chips-group {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    flex: 1;
    padding: 0.1rem 0;
}
.occasion-chips-group::-webkit-scrollbar {
    display: none;
}

.occasion-chip-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    border-radius: 9999px;
    font-family: var(--font-heading, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-main, #0f172a);
    text-decoration: none;
    background: rgba(0, 0, 0, 0.025);
    border: 1px solid rgba(0, 0, 0, 0.06);
    cursor: pointer;
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
    user-select: none;
}

.occasion-chip-btn:hover,
.occasion-chip-btn.active {
    background: #ffffff;
    color: var(--primary, #c026d3);
    border-color: #f5d0fe;
    box-shadow: 0 4px 14px rgba(192, 38, 211, 0.12);
    transform: translateY(-1px);
}

.occasion-chip-btn .chip-icon {
    font-size: 1.05rem;
    line-height: 1;
}

.occasion-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.8rem;
    border-radius: 9999px;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    font-family: var(--font-heading, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
    font-size: 0.8125rem;
    font-weight: 700;
    color: #475569;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.2s ease;
}
.occasion-more-btn:hover,
.occasion-more-btn.expanded {
    background: #f1f5f9;
    color: #0f172a;
    border-color: #94a3b8;
}
.occasion-more-btn .more-chevron {
    width: 13px;
    height: 13px;
    transition: transform 0.2s ease;
}
.occasion-more-btn.expanded .more-chevron {
    transform: rotate(180deg);
}

/* Line 3: Who are you celebrating ? (Step 2) */
.celebrating-line-3 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding-top: 0.45rem;
    border-top: 1px solid #f1f5f9;
    width: 100%;
}

.celebrating-chips-group {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    flex: 1;
    padding: 0.1rem 0;
}
.celebrating-chips-group::-webkit-scrollbar {
    display: none;
}

.celebrating-line-2 {
    display: none;
    padding-top: 0.5rem;
    border-top: 1px dashed #e2e8f0;
    width: 100%;
}
.celebrating-line-2.show {
    display: block;
    animation: fadeInDropdown 0.2s ease forwards;
}

.celebrating-expanded-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
    width: 100%;
    padding: 0.15rem 0;
}

.celebrating-label-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8125rem;
    font-weight: 700;
    color: #0f172a;
    font-family: var(--font-heading, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
    white-space: nowrap;
    flex-shrink: 0;
    padding-right: 0.35rem;
}

.celebrating-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.75rem;
    border-radius: 9999px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    font-family: var(--font-heading, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
    font-size: 0.8125rem;
    font-weight: 600;
    color: #475569;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.15s ease;
    cursor: pointer;
    flex-shrink: 0;
}

.celebrating-chip:hover,
.celebrating-chip.active {
    background: #fdf4ff;
    color: #7e22ce;
    border-color: #f5d0fe;
    box-shadow: 0 2px 8px rgba(192, 38, 211, 0.1);
    transform: translateY(-1px);
}

/* Full-width Mega Dropdown Popup Window */
.occasion-mega-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.18);
    z-index: 1000;
    padding: 1.25rem 0 1.5rem;
    display: none;
    transform: translateY(-6px);
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.occasion-mega-dropdown.open {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.occasion-dropdown-panel {
    display: none;
    animation: fadeInDropdown 0.2s ease forwards;
}

.occasion-dropdown-panel.active {
    display: block;
}

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

.mega-dropdown-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
    width: 100%;
    box-sizing: border-box;
}

.mega-dropdown-header {
    width: 100%;
    margin: 0 0 1rem;
    padding: 0 0 0.85rem;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    box-sizing: border-box;
}

.mega-dropdown-header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mega-dropdown-header-title {
    font-family: var(--font-heading, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
    font-size: 0.8125rem;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
    line-height: 1.25;
}

.mega-dropdown-header-desc {
    font-family: var(--font-body, var(--font-heading, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif));
    font-size: 0.75rem;
    color: #64748b;
    margin: 0.15rem 0 0;
    line-height: 1.35;
    font-weight: 400;
}

.mega-dropdown-header-actions {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.mega-dropdown-close-btn {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #64748b;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 1rem;
    line-height: 1;
}

.mega-dropdown-close-btn:hover {
    background: #f1f5f9;
    color: #0f172a;
    border-color: #cbd5e1;
}

.mega-dropdown-grid {
    width: 100%;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1.25rem;
    box-sizing: border-box;
}

.mega-dropdown-grid.cols-5 {
    grid-template-columns: repeat(5, 1fr);
}

.mega-dropdown-grid.cols-4 {
    grid-template-columns: repeat(4, 1fr);
}

.mega-dropdown-grid.cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.mega-dropdown-col {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.mega-dropdown-title {
    font-family: var(--font-heading, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #0f172a;
    padding-bottom: 0.35rem;
    margin-bottom: 0.4rem;
    border-bottom: 1px solid #f1f5f9;
}

.mega-dropdown-link {
    font-family: var(--font-body, var(--font-heading, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif));
    font-size: 0.78rem;
    font-weight: 500;
    color: #475569;
    text-decoration: none;
    padding: 0.12rem 0;
    transition: all 0.15s ease;
    line-height: 1.35;
    display: inline-flex;
    align-items: center;
}

.mega-dropdown-link:hover {
    color: #7c3aed;
    transform: translateX(2px);
}

.mega-dropdown-link.active {
    background: #fdf4ff;
    color: #7e22ce;
    font-weight: 600;
    border-radius: 6px;
    padding: 0.15rem 0.45rem;
    box-shadow: 0 1px 4px rgba(126, 34, 206, 0.12);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.mega-dropdown-link.active::before {
    content: '✓';
    font-size: 0.7rem;
    color: #a855f7;
    font-weight: 800;
}

.mega-dropdown-link.incompatible-subcat {
    opacity: 0.35;
    pointer-events: none;
    cursor: not-allowed;
    text-decoration: line-through;
    color: #94a3b8;
    position: relative;
}

.mega-dropdown-link.incompatible-subcat::after {
    content: ' (N/A)';
    font-size: 0.65rem;
    color: #ef4444;
    font-style: italic;
    text-decoration: none;
    display: inline;
}

.mega-dropdown-see-all {
    font-family: var(--font-heading, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
    font-size: 0.78rem;
    font-weight: 600;
    color: #0284c7;
    text-decoration: none;
    margin-top: 0.25rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    transition: all 0.15s ease;
}

.mega-dropdown-see-all:hover {
    color: #0369a1;
    text-decoration: none;
    transform: translateX(2px);
}

.mega-dropdown-header-actions .mega-dropdown-see-all {
    margin-top: 0;
    color: #0284c7;
    font-weight: 600;
    font-size: 0.8125rem;
}

@media (max-width: 1100px) {
    .mega-dropdown-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.25rem;
    }
}
@media (max-width: 650px) {
    .mega-dropdown-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}

/* ==========================================================================
   PHASE 8: STATES, INTERACTIONS, AND ACCESSIBILITY
   ========================================================================== */

/* ── 8a. Universal Accessibility & Focus Ring System ─────────────────────── */
:focus-visible {
    outline: 2px solid var(--color-primary) !important;
    outline-offset: 2px !important;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--color-primary) !important;
    outline-offset: 2px !important;
}

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

/* ── 8b. Unified Skeleton Loading State System ──────────────────────────── */
@keyframes cardylaShimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.skeleton-shimmer,
.skeleton-box,
.skeleton-text,
.skeleton-card-5x7,
.skeleton-avatar,
.skeleton-table-row {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: cardylaShimmer 1.6s ease-in-out infinite;
    border-radius: var(--radius-md);
}

.skeleton-text {
    height: 14px;
    margin-bottom: 6px;
    width: 80%;
}
.skeleton-text.sm { height: 10px; width: 60%; }
.skeleton-text.lg { height: 20px; width: 90%; }

.skeleton-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
}

.skeleton-card-5x7 {
    width: 100%;
    aspect-ratio: 5 / 7;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
}

.skeleton-table-row {
    height: 52px;
    width: 100%;
    margin-bottom: 4px;
    border-radius: 0;
}

/* ── 8c. Professional Empty State Component ─────────────────────────────── */
.cardyla-empty-state {
    padding: 3rem 1.5rem;
    text-align: center;
    background: var(--color-bg-surface);
    border: 1px dashed var(--color-border-strong);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 1rem 0;
}

.empty-state-icon-wrap {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--color-primary-subtle);
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(192, 38, 211, 0.12);
}

.empty-state-title {
    font-family: var(--font-heading);
    font-size: var(--text-h3);
    font-weight: 800;
    color: var(--color-text-primary);
    margin: 0 0 0.35rem 0;
}

.empty-state-desc {
    font-size: var(--text-body-sm);
    color: var(--color-text-muted);
    max-width: 440px;
    margin: 0 0 1.25rem 0;
    line-height: 1.5;
}

.empty-state-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* ── 8d. Human-Readable Error State Component ───────────────────────────── */
.cardyla-error-state {
    padding: 2.5rem 1.5rem;
    text-align: center;
    background: var(--color-danger-bg);
    border: 1px solid var(--color-danger-border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 1rem 0;
}

.error-state-icon-wrap {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #ffffff;
    color: var(--color-danger);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    margin-bottom: 0.75rem;
    box-shadow: var(--shadow-sm);
}

.error-state-title {
    font-family: var(--font-heading);
    font-size: var(--text-h3);
    font-weight: 800;
    color: var(--color-danger);
    margin: 0 0 0.35rem 0;
}

.error-state-desc {
    font-size: var(--text-body-sm);
    color: var(--color-text-secondary);
    max-width: 420px;
    margin: 0 0 1rem 0;
    line-height: 1.5;
}

/* ── 8e. Universal Toast Notification System ────────────────────────────── */
.cardyla-toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    pointer-events: none;
}

.cardyla-toast {
    pointer-events: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    background: #0f172a;
    color: #ffffff;
    padding: 0.75rem 1.15rem;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.25), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    font-family: var(--font-heading);
    font-size: var(--text-body-sm);
    font-weight: 600;
    animation: toastSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transition: opacity 0.25s ease, transform 0.25s ease;
    max-width: 380px;
}

.cardyla-toast.success {
    background: #064e3b;
    border-left: 4px solid #10b981;
}

.cardyla-toast.error {
    background: #7f1d1d;
    border-left: 4px solid #ef4444;
}

.cardyla-toast.info {
    background: #1e1b4b;
    border-left: 4px solid #818cf8;
}

.cardyla-toast.warning {
    background: #78350f;
    border-left: 4px solid #f59e0b;
}

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

/* ── 8f. Micro-Interactions ─────────────────────────────────────────────── */
.card-floating-love-btn .heart-icon {
    display: inline-block;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.card-floating-love-btn:hover .heart-icon {
    transform: scale(1.25);
}

.card-floating-love-btn.is-favorited .heart-icon {
    transform: scale(1.1);
}

/* ==========================================================================
   Phase 10b — Comprehensive Responsive Breakpoints & Viewport Rules
   Validated across 1920px, 1440px, 1280px, 1024px, 768px, 430px, 390px, 375px
   ========================================================================== */

/* ── 1. Large Displays (1440px - 1920px+) ───────────────────────────────── */
@media (min-width: 1440px) {
    .container-wide,
    .public-nav-container,
    .public-footer-container {
        max-width: 1400px;
    }
    .templates-grid {
        grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
        gap: 1.5rem;
    }
}

/* ── 2. Standard Desktops & Laptops (1025px - 1280px) ───────────────────── */
@media (max-width: 1280px) {
    .container-wide,
    .public-nav-container,
    .public-footer-container {
        max-width: 1140px;
        padding-left: 1.25rem;
        padding-right: 1.25rem;
    }
    .templates-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1.25rem;
    }
}

/* ── 3. Tablets & Small Laptops (769px - 1024px) ────────────────────────── */
@media (max-width: 1024px) {
    .cardyla-shell {
        flex-direction: column;
    }
    .cardyla-main-content {
        margin-left: 0 !important;
        padding: 1.25rem;
    }
    .public-nav-links {
        gap: 1.15rem;
    }
    .templates-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
    }
    .stats-summary-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    .hero-showcase {
        gap: 0.75rem;
    }
    .showcase-card {
        width: 160px;
    }
}

/* ── 4. Small Tablets & Phablets (431px - 768px) ─────────────────────────── */
@media (max-width: 768px) {
    body {
        overflow-x: hidden;
    }
    .public-nav-container {
        flex-wrap: wrap;
        padding: 0.75rem 1rem;
        gap: 0.75rem;
    }
    .public-nav-links {
        order: 3;
        width: 100%;
        overflow-x: auto;
        padding-bottom: 0.35rem;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
        gap: 1rem;
    }
    .hero-section {
        padding: 2.5rem 1rem 2rem;
    }
    .hero-title {
        font-size: 2rem !important;
    }
    .hero-subtext {
        font-size: 1rem !important;
    }
    .hero-cta-group {
        flex-direction: column;
        width: 100%;
        gap: 0.75rem;
    }
    .hero-cta-group .btn-primary,
    .hero-cta-group .btn-secondary,
    .hero-cta-group button,
    .hero-cta-group a {
        width: 100%;
        justify-content: center;
    }
    .templates-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.85rem;
    }
    .stats-summary-grid {
        grid-template-columns: 1fr !important;
    }
    .showcase-card.card-left-2,
    .showcase-card.card-right-2 {
        display: none;
    }
    .showcase-card {
        width: 140px;
    }
    .dialog-content-inner,
    .cardyla-modal-body {
        padding: 1.25rem !important;
        max-width: 95vw !important;
    }
    .cardyla-toast-container {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
    }
    .cardyla-toast {
        max-width: 100%;
        width: 100%;
    }
}

/* ── 5. Standard Mobile (375px - 430px) ─────────────────────────────────── */
@media (max-width: 430px) {
    .public-nav-container {
        padding: 0.5rem 0.75rem;
    }
    .hero-section {
        padding: 2rem 0.75rem 1.5rem;
    }
    .hero-title {
        font-size: 1.75rem !important;
        line-height: 1.2;
    }
    .hero-subtext {
        font-size: 0.9375rem !important;
        margin-bottom: 1.5rem;
    }
    .templates-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.65rem;
    }
    .template-card-preview {
        aspect-ratio: 5 / 7 !important;
    }
    .btn-primary,
    .btn-secondary,
    .btn-ghost {
        min-height: 44px; /* Accessible mobile touch target */
    }
    .cardyla-filter-bar {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.5rem;
        flex-wrap: nowrap;
    }
    .filter-chip {
        flex-shrink: 0;
    }
    .public-footer-grid {
        grid-template-columns: 1fr !important;
        gap: 1.75rem;
    }
    .showcase-card.card-left-1,
    .showcase-card.card-right-1 {
        display: none;
    }
    .showcase-card.card-center {
/* ==========================================================================
   Universal Modal System (.modal-overlay, .modal-content, .cardyla-modal-overlay)
   ========================================================================== */
.modal-overlay,
.cardyla-modal-overlay {
    position: fixed !important;
    inset: 0 !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(15, 23, 42, 0.72) !important;
    backdrop-filter: blur(6px) !important;
    -webkit-backdrop-filter: blur(6px) !important;
    z-index: 99999 !important;
    display: none;
    align-items: center !important;
    justify-content: center !important;
    padding: 1.25rem !important;
    overflow-y: auto !important;
}

.modal-overlay.active,
.modal-overlay.open,
.cardyla-modal-overlay.active,
.cardyla-modal-overlay.open {
    display: flex !important;
}

.modal-content,
.cardyla-modal-content {
    background: #ffffff !important;
    border-radius: var(--radius-xl, 16px) !important;
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(226, 232, 240, 0.8) !important;
    position: relative !important;
    max-width: 460px;
    width: 100% !important;
    margin: auto !important;
    overflow: hidden;
}




