/* ============================================================
   MERCELYSIC ERP — Design System
   Primary: #572D79 | Background: #F5F5F5 | White: #FFFFFF
   Font: Inter (body) + Playfair Display (headings)
   ============================================================ */

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

/* ── CSS Variables ───────────────────────────────────────── */
:root {
    --purple-900: #2D1647;
    --purple-800: #3E1F66;
    --purple-700: #4A2570;
    --purple:     #572D79;
    --purple-600: #6B3A91;
    --purple-500: #8049AB;
    --purple-400: #9D6BC0;
    --purple-300: #BFA0D5;
    --purple-100: #EFE8F5;
    --purple-50:  #F8F4FC;

    --smoke:      #F5F5F5;
    --smoke-dark: #EBEBEB;
    --white:      #FFFFFF;

    --text-primary:   #1A1A2E;
    --text-secondary: #5A5A72;
    --text-muted:     #9999B3;

    --success:  #0E9F6E;
    --warning:  #E3A008;
    --danger:   #E02424;
    --info:     #3F83F8;

    --sidebar-width: 265px;
    --topbar-height: 68px;
    --radius-sm: 8px;
    --radius:    12px;
    --radius-lg: 18px;
    --radius-xl: 24px;

    --shadow-sm:  0 1px 3px rgba(87,45,121,0.08), 0 1px 2px rgba(87,45,121,0.04);
    --shadow:     0 4px 16px rgba(87,45,121,0.10), 0 1px 4px rgba(87,45,121,0.06);
    --shadow-md:  0 8px 32px rgba(87,45,121,0.14), 0 2px 8px rgba(87,45,121,0.08);
    --shadow-lg:  0 16px 48px rgba(87,45,121,0.18), 0 4px 16px rgba(87,45,121,0.10);

    --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.38s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { font-size: 15px; -webkit-font-smoothing: antialiased; }

body {
    font-family: 'Inter', sans-serif;
    background: var(--smoke);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ═══════════════════════════════════════════════════════════
   CUSTOM SCROLLBARS - WEBKIT (Chrome, Safari, Edge)
   ═══════════════════════════════════════════════════════════ */

/* ── Body / Global Scrollbar ─────────────────────────────── */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

::-webkit-scrollbar-corner {
    background: #f1f1f1;
}

/* ── Sidebar Navigation Scrollbar ────────────────────────── */
.sidebar-nav::-webkit-scrollbar {
    width: 5px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    border: 1px solid transparent;
    background-clip: padding-box;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.35);
}

/* Firefox sidebar scrollbar */
.sidebar-nav {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

/* ── Table Responsive Scrollbar ──────────────────────────── */
.table-responsive::-webkit-scrollbar {
    height: 6px;
}

.table-responsive::-webkit-scrollbar-track {
    background: #f5f5f5;
    border-radius: 10px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 10px;
    border: 1px solid transparent;
    background-clip: padding-box;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

.table-responsive {
    scrollbar-width: thin;
    scrollbar-color: #d1d5db #f5f5f5;
}

/* ── Modal Scrollbar ─────────────────────────────────────── */
.modal::-webkit-scrollbar {
    width: 5px;
}

.modal::-webkit-scrollbar-track {
    background: #f5f5f5;
    border-radius: 10px;
}

.modal::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 10px;
    border: 1px solid transparent;
    background-clip: padding-box;
}

.modal::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

.modal {
    scrollbar-width: thin;
    scrollbar-color: #d1d5db #f5f5f5;
}

/* ── Searchable Dropdown Scrollbar ───────────────────────── */
.searchable-select-dropdown::-webkit-scrollbar {
    width: 5px;
}

.searchable-select-dropdown::-webkit-scrollbar-track {
    background: #f8f8f8;
    border-radius: 10px;
}

.searchable-select-dropdown::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 10px;
    border: 1px solid transparent;
    background-clip: padding-box;
}

.searchable-select-dropdown::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

.searchable-select-dropdown {
    scrollbar-width: thin;
    scrollbar-color: #d1d5db #f8f8f8;
}

/* ── Activity Feed Scrollbar ─────────────────────────────── */
.activity-feed-scroll::-webkit-scrollbar {
    width: 4px;
}

.activity-feed-scroll::-webkit-scrollbar-track {
    background: transparent;
    border-radius: 10px;
}

.activity-feed-scroll::-webkit-scrollbar-thumb {
    background: rgba(87, 45, 121, 0.15);
    border-radius: 10px;
}

.activity-feed-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(87, 45, 121, 0.3);
}

.activity-feed-scroll {
    scrollbar-width: thin;
    scrollbar-color: rgba(87, 45, 121, 0.15) transparent;
}

/* ── Form Textarea Scrollbar ─────────────────────────────── */
textarea::-webkit-scrollbar {
    width: 5px;
}

textarea::-webkit-scrollbar-track {
    background: #f5f5f5;
    border-radius: 10px;
}

textarea::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 10px;
}

/* ── Page Content Scrollbar ──────────────────────────────── */
.page-content::-webkit-scrollbar {
    width: 6px;
}

.page-content::-webkit-scrollbar-track {
    background: #f5f5f5;
    border-radius: 10px;
}

.page-content::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 10px;
}

/* ═══════════════════════════════════════════════════════════
   AUTH PAGES
   ═══════════════════════════════════════════════════════════ */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: stretch;
}

.auth-left {
    flex: 0 0 52%;
    background: linear-gradient(145deg, var(--purple-900) 0%, var(--purple) 50%, var(--purple-600) 100%);
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 60px 56px;
    overflow: hidden;
}

.auth-left::before {
    content: '';
    position: absolute;
    width: 480px; height: 480px;
    border-radius: 50%;
    background: rgba(255,255,255,0.04);
    top: -120px; left: -120px;
}
.auth-left::after {
    content: '';
    position: absolute;
    width: 320px; height: 320px;
    border-radius: 50%;
    background: rgba(255,255,255,0.05);
    bottom: -60px; right: -80px;
}

.auth-left-inner {
    position: relative;
    z-index: 1;
    color: #fff;
    text-align: center;
    max-width: 440px;
}

.auth-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 52px;
}

.auth-logo-img {
    width: 48px; height: 48px;
    border-radius: var(--radius);
    object-fit: contain;
}

.auth-brand-icon {
    width: 48px; height: 48px;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
}

.auth-brand-icon svg { width: 26px; height: 26px; color: #fff; }

.auth-brand-name {
    font-family: 'Playfair Display', serif;
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #fff;
}

.auth-headline {
    font-family: 'Playfair Display', serif;
    font-size: 2.4rem;
    font-weight: 700;
    line-height: 1.25;
    margin-bottom: 20px;
    color: #fff;
}

.auth-subtext {
    font-size: 1rem;
    color: rgba(255,255,255,0.70);
    line-height: 1.7;
    margin-bottom: 48px;
}

.auth-features {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
}

.auth-feature-item {
    display: flex;
    align-items: center;
    gap: 14px;
    background: rgba(255,255,255,0.07);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: var(--radius);
    padding: 14px 20px;
    text-align: left;
}

.auth-feature-icon {
    width: 36px; height: 36px;
    min-width: 36px;
    background: rgba(255,255,255,0.12);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
}

.auth-feature-icon svg { width: 18px; height: 18px; color: var(--purple-300); }

.auth-feature-text strong {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #fff;
}

.auth-feature-text span {
    font-size: 0.78rem;
    color: rgba(255,255,255,0.60);
}

/* Right panel */
.auth-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 32px;
    background: var(--white);
}

.auth-card {
    width: 100%;
    max-width: 420px;
}

.auth-card-header { margin-bottom: 36px; }

.auth-card-header h2 {
    font-family: 'Playfair Display', serif;
    font-size: 1.85rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.auth-card-header p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Form elements */
.form-group { margin-bottom: 22px; }

.form-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.4px;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.form-input-wrap { position: relative; }

.form-input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px; height: 18px;
    color: var(--text-muted);
    pointer-events: none;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 13px 14px 13px 44px;
    border: 1.5px solid var(--smoke-dark);
    border-radius: var(--radius);
    font-size: 0.93rem;
    color: var(--text-primary);
    background: var(--smoke);
    transition: all var(--transition);
    outline: none;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--purple);
    background: var(--white);
    box-shadow: 0 0 0 4px rgba(87,45,121,0.08);
}

.form-select { padding: 13px 14px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%239999B3'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; background-size: 18px; padding-right: 40px; }
.form-textarea { padding: 13px 14px; resize: vertical; min-height: 80px; }
.form-input.is-invalid { border-color: var(--danger); background: #FFF8F8; box-shadow: 0 0 0 4px rgba(224,36,36,0.06); }
.form-error { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--danger); margin-top: 6px; }
.form-error svg { width: 14px; height: 14px; flex-shrink: 0; }
.form-check-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
.form-check-label { display: flex; align-items: center; gap: 8px; font-size: 0.875rem; color: var(--text-secondary); cursor: pointer; }
.form-check-label input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--purple); cursor: pointer; }

.btn-primary {
    width: 100%;
    padding: 14px 24px;
    background: var(--purple);
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: 0.2px;
    cursor: pointer;
}

.btn-primary:hover { background: var(--purple-800); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary svg { width: 18px; height: 18px; }

.btn-secondary {
    padding: 10px 20px;
    background: var(--white);
    color: var(--purple);
    font-size: 0.875rem;
    font-weight: 600;
    border: 1.5px solid var(--purple-100);
    border-radius: var(--radius);
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.btn-secondary:hover { background: var(--purple-50); border-color: var(--purple-300); }
.btn-secondary svg { width: 16px; height: 16px; }

.btn-danger {
    padding: 10px 20px;
    background: var(--danger);
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.btn-danger:hover { background: #C81E1E; }

/* Alert */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 13px 16px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    font-size: 0.875rem;
}
.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.alert-danger  { background: #FEF3F2; border: 1px solid #FEE4E2; color: #B42318; }
.alert-success { background: #ECFDF3; border: 1px solid #D1FADF; color: #027A48; }
.alert-danger svg  { color: #F04438; }
.alert-success svg { color: #12B76A; }

/* ═══════════════════════════════════════════════════════════
   APP LAYOUT
   ═══════════════════════════════════════════════════════════ */
.app-layout { display: flex; min-height: 100vh; }

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    height: 100vh;
    background: linear-gradient(180deg, var(--purple-900) 0%, var(--purple-800) 100%);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    z-index: 100;
    transition: transform var(--transition-slow);
    box-shadow: 4px 0 24px rgba(0,0,0,0.15);
}

.sidebar-close-btn {
    display: none;
    position: absolute;
    top: 12px; right: 12px;
    width: 32px; height: 32px;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: var(--radius-sm);
    color: #fff;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
}

.sidebar-close-btn svg { width: 18px; height: 18px; }

.sidebar-brand {
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    text-decoration: none;
    flex-shrink: 0;
}

.sidebar-logo-img {
    width: 34px; height: 34px;
    border-radius: var(--radius-sm);
    object-fit: contain;
}

.sidebar-brand-icon {
    width: 38px; height: 38px;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.sidebar-brand-icon svg { width: 20px; height: 20px; color: #fff; }

.sidebar-brand-text {
    font-family: 'Playfair Display', serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.2;
}

.sidebar-brand-sub {
    font-size: 0.62rem;
    color: rgba(255,255,255,0.45);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0 20px;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

.sidebar-section-label {
    padding: 14px 20px 4px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 1.8px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.35);
}

.sidebar-item {
    padding: 0 10px;
    margin-bottom: 1px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius);
    color: rgba(255,255,255,0.62);
    font-size: 0.84rem;
    font-weight: 500;
    transition: all var(--transition);
    position: relative;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    cursor: pointer;
    text-decoration: none;
}

.sidebar-link:hover { background: rgba(255,255,255,0.07); color: rgba(255,255,255,0.92); }

.sidebar-link.active {
    background: rgba(255,255,255,0.12);
    color: #fff;
}

.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: 0; top: 50%;
    transform: translateY(-50%);
    width: 3px; height: 20px;
    background: var(--purple-300);
    border-radius: 0 3px 3px 0;
}

.sidebar-link-icon { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.75; }
.sidebar-link.active .sidebar-link-icon { opacity: 1; }

.sidebar-dropdown-toggle { justify-content: flex-start; }

.sidebar-dropdown-arrow {
    width: 14px; height: 14px;
    margin-left: auto;
    transition: transform var(--transition);
    flex-shrink: 0;
}

.sidebar-dropdown-toggle.open .sidebar-dropdown-arrow { transform: rotate(180deg); }

.sidebar-submenu {
    padding-left: 16px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.sidebar-submenu.open { max-height: 200px; }

.sidebar-sublink {
    display: flex;
    align-items: center;
    padding: 7px 14px 7px 38px;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.5);
    transition: all var(--transition);
    border-radius: var(--radius-sm);
    text-decoration: none;
}

.sidebar-sublink:hover {
    color: rgba(255,255,255,0.85);
    background: rgba(255,255,255,0.05);
}

.sidebar-badge {
    margin-left: auto;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 20px;
    background: var(--purple-500);
    color: #fff;
}

.sidebar-footer {
    padding: 12px 10px;
    border-top: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius);
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
}

.sidebar-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--purple-500);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    border: 2px solid rgba(255,255,255,0.2);
}

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-user-role {
    font-size: 0.68rem;
    color: rgba(255,255,255,0.45);
    text-transform: capitalize;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}

.sidebar-overlay.active { display: block; }

/* ── Main Area ───────────────────────────────────────────── */
.main-area {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ── Topbar ──────────────────────────────────────────────── */
.topbar {
    height: var(--topbar-height);
    background: var(--white);
    border-bottom: 1px solid rgba(87,45,121,0.08);
    display: flex;
    align-items: center;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}

.topbar-left { flex: 1; display: flex; align-items: center; gap: 12px; }

.topbar-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.topbar-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.topbar-breadcrumb-sep { opacity: 0.4; }

.topbar-right { display: flex; align-items: center; gap: 8px; }

.topbar-icon-btn {
    width: 38px; height: 38px;
    display: flex; align-items: center; justify-content: center;
    border: none;
    background: transparent;
    border-radius: var(--radius);
    color: var(--text-secondary);
    transition: all var(--transition);
    position: relative;
}

.topbar-icon-btn:hover { background: var(--purple-50); color: var(--purple); }
.topbar-icon-btn svg { width: 20px; height: 20px; }

.sidebar-toggle-btn { display: flex !important; }

.topbar-notif-dot {
    position: absolute;
    top: 6px; right: 7px;
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--danger);
    border: 2px solid var(--white);
}

.topbar-divider { width: 1px; height: 26px; background: var(--smoke-dark); margin: 0 4px; }

.btn-quick-action {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--purple);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}

.btn-quick-action:hover { background: var(--purple-800); box-shadow: var(--shadow); }
.btn-quick-action svg { width: 16px; height: 16px; }

/* ── Profile Dropdown ────────────────────────────────────── */
.profile-dropdown-wrap { position: relative; }

.profile-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 6px;
    border: none;
    background: transparent;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background var(--transition);
}

.profile-trigger:hover { background: var(--purple-50); }

.profile-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--purple), var(--purple-500));
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
    border: 2px solid var(--purple-100);
}

.profile-info { text-align: left; }

.profile-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
    white-space: nowrap;
}

.profile-role {
    font-size: 0.72rem;
    color: var(--purple);
    font-weight: 500;
    text-transform: capitalize;
}

.profile-chevron {
    width: 16px; height: 16px;
    color: var(--text-muted);
    transition: transform var(--transition);
}

.profile-dropdown-wrap.open .profile-chevron { transform: rotate(180deg); }

.profile-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 280px;
    background: var(--white);
    border: 1px solid rgba(87,45,121,0.1);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all var(--transition);
    z-index: 200;
}

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

.profile-dropdown-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
}

.profile-avatar-lg {
    width: 44px; height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--purple), var(--purple-500));
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    border: 2px solid var(--purple-100);
    flex-shrink: 0;
}

.profile-dropdown-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.profile-dropdown-email {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.profile-dropdown-role-badge {
    display: inline-block;
    margin-top: 4px;
    padding: 2px 8px;
    background: var(--purple-50);
    color: var(--purple);
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: capitalize;
}

.profile-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    text-decoration: none;
}

.profile-dropdown-item:hover { background: var(--purple-50); color: var(--purple); }
.profile-dropdown-item svg { width: 16px; height: 16px; }
.profile-dropdown-item.danger:hover { background: #FEF3F2; color: var(--danger); }
.profile-dropdown-sep { height: 1px; background: var(--smoke-dark); margin: 6px 0; }

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

/* ── Welcome Banner ──────────────────────────────────────── */
.welcome-banner {
    background: linear-gradient(135deg, var(--purple-900) 0%, var(--purple) 60%, var(--purple-500) 100%);
    border-radius: var(--radius-xl);
    padding: 28px 36px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    position: relative;
    overflow: hidden;
}

.welcome-text { position: relative; z-index: 1; }
.welcome-text h2 { font-family: 'Playfair Display', serif; font-size: 1.5rem; font-weight: 700; color: #fff; margin-bottom: 4px; }
.welcome-text p { font-size: 0.875rem; color: rgba(255,255,255,0.65); }
.welcome-date { position: relative; z-index: 1; text-align: right; }
.welcome-date-day { font-family: 'Playfair Display', serif; font-size: 2.2rem; font-weight: 700; color: rgba(255,255,255,0.9); line-height: 1; }
.welcome-date-month { font-size: 0.78rem; color: rgba(255,255,255,0.5); text-transform: uppercase; letter-spacing: 1.5px; font-weight: 600; }

/* ── Stats Grid ──────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(87,45,121,0.06);
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 80px; height: 80px;
    border-radius: 0 var(--radius-lg) 0 80px;
    opacity: 0.06;
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: rgba(87,45,121,0.12); }
.stat-card--purple::before { background: var(--purple); }
.stat-card--green::before  { background: var(--success); }
.stat-card--amber::before  { background: var(--warning); }
.stat-card--blue::before   { background: var(--info); }

.stat-card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; }
.stat-icon-wrap { width: 46px; height: 46px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; }
.stat-icon-wrap svg { width: 22px; height: 22px; }
.stat-icon-wrap--purple { background: var(--purple-100); color: var(--purple); }
.stat-icon-wrap--green  { background: #ECFDF3; color: var(--success); }
.stat-icon-wrap--amber  { background: #FFFBEB; color: var(--warning); }
.stat-icon-wrap--blue   { background: #EFF6FF; color: var(--info); }

.stat-badge { font-size: 0.72rem; font-weight: 600; padding: 3px 8px; border-radius: 20px; }
.stat-badge--up   { background: #ECFDF3; color: var(--success); }
.stat-badge--down { background: #FEF3F2; color: var(--danger); }
.stat-badge--neu  { background: var(--purple-50); color: var(--purple-500); }

.stat-value { font-family: 'Playfair Display', serif; font-size: 2rem; font-weight: 700; color: var(--text-primary); line-height: 1; margin-bottom: 6px; }
.stat-label { font-size: 0.82rem; color: var(--text-muted); font-weight: 500; }
.stat-sub { font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }

/* ── Dashboard Grid ──────────────────────────────────────── */
.dashboard-grid { display: grid; grid-template-columns: 1fr 380px; gap: 20px; }

.dash-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(87,45,121,0.06);
    overflow: hidden;
}

.dash-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 0;
    margin-bottom: 20px;
}

.dash-card-title { font-family: 'Playfair Display', serif; font-size: 1.05rem; font-weight: 700; color: var(--text-primary); }
.dash-card-subtitle { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.dash-card-action {
    font-size: 0.8rem; font-weight: 600; color: var(--purple);
    padding: 5px 12px; border-radius: var(--radius-sm);
    border: 1.5px solid var(--purple-100); transition: all var(--transition); white-space: nowrap;
    text-decoration: none;
}
.dash-card-action:hover { background: var(--purple-50); border-color: var(--purple-300); }

/* ── Chart ───────────────────────────────────────────────── */
.chart-placeholder { padding: 0 24px 24px; height: 280px; display: flex; align-items: flex-end; gap: 10px; }
.chart-bar-group { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 1; }
.chart-bar-wrap { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; height: 200px; }
.chart-bar { border-radius: 4px 4px 0 0; min-width: 16px; transition: all var(--transition); }
.chart-bar--primary { background: var(--purple); }
.chart-bar--light   { background: var(--purple-100); }
.chart-label { font-size: 0.72rem; color: var(--text-muted); font-weight: 500; }
.chart-y-axis { display: flex; flex-direction: column; justify-content: space-between; height: 200px; padding-right: 8px; padding-bottom: 20px; }
.chart-y-label { font-size: 0.68rem; color: var(--text-muted); }

/* ── Activity Feed ───────────────────────────────────────── */
.activity-list { padding: 0 24px 20px; }
.activity-item { display: flex; align-items: flex-start; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--smoke); }
.activity-item:last-child { border-bottom: none; }
.activity-icon { width: 36px; height: 36px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.activity-icon svg { width: 16px; height: 16px; }
.activity-icon--purple { background: var(--purple-50); color: var(--purple); }
.activity-icon--green  { background: #ECFDF3; color: var(--success); }
.activity-icon--amber  { background: #FFFBEB; color: var(--warning); }
.activity-icon--blue   { background: #EFF6FF; color: var(--info); }
.activity-icon--red    { background: #FEF3F2; color: #E02424; }
.activity-content { flex: 1; }
.activity-action { font-size: 0.85rem; font-weight: 500; color: var(--text-primary); line-height: 1.4; }
.activity-meta { font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1000; align-items: center; justify-content: center; }
.modal-overlay.active { display: flex; }
.modal { background: var(--white); border-radius: var(--radius-xl); width: 90%; max-width: 600px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 24px 28px; border-bottom: 1px solid var(--smoke-dark); }
.modal-title { font-family: 'Playfair Display', serif; font-size: 1.25rem; font-weight: 700; }
.modal-close { width: 32px; height: 32px; border: none; background: var(--smoke); border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all var(--transition); }
.modal-close:hover { background: var(--smoke-dark); }
.modal-close svg { width: 16px; height: 16px; }
.modal-body { padding: 24px 28px; }
.modal-footer { display: flex; gap: 12px; justify-content: flex-end; padding: 20px 28px; border-top: 1px solid var(--smoke-dark); }

/* ── Table ───────────────────────────────────────────────── */
.table-responsive { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { text-align: left; padding: 14px 16px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); background: var(--smoke); border-bottom: 2px solid var(--smoke-dark); white-space: nowrap; }
.data-table td { padding: 14px 16px; border-bottom: 1px solid var(--smoke); font-size: 0.875rem; }
.data-table tbody tr:hover { background: var(--purple-50); }

/* ── Empty State ─────────────────────────────────────────── */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 48px 24px; color: var(--text-muted); text-align: center; }
.empty-state svg { width: 42px; height: 42px; opacity: 0.3; margin-bottom: 12px; }
.empty-state p { font-size: 0.875rem; margin-bottom: 16px; }

/* ── Status Badges ───────────────────────────────────────── */
.status-badge { padding: 4px 12px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; display: inline-block; }
.status-draft { background: #FFFBEB; color: #B45309; }
.status-pending { background: #EFF6FF; color: #1E40AF; }
.status-paid { background: #D1FADF; color: #027A48; }
.status-cancelled { background: #FEF3F2; color: #B42318; }
.code-badge { padding: 4px 8px; background: var(--purple-50); color: var(--purple); border-radius: 4px; font-size: 0.75rem; font-weight: 600; font-family: monospace; }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
   ═══════════════════════════════════════════════════════════ */

/* ── 1400px: Large Desktop ───────────────────────────────── */
@media (max-width: 1400px) {
    .stats-grid { gap: 16px; }
    .stat-card { padding: 20px; }
    .stat-value { font-size: 1.7rem; }
}

/* ── 1200px: Desktop ─────────────────────────────────────── */
@media (max-width: 1200px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .dashboard-grid { grid-template-columns: 1fr; }
    div[style*="grid-template-columns:2fr 1fr"],
    div[style*="grid-template-columns:1fr 1fr"] { grid-template-columns: 1fr !important; }
}

/* ── 1024px: Tablet Landscape ────────────────────────────── */
@media (max-width: 1024px) {
    .page-content { padding: 24px 20px; }
    .welcome-banner { padding: 24px 28px; }
    .welcome-text h2 { font-size: 1.3rem; }
    .welcome-date-day { font-size: 1.8rem; }
}

/* ── 992px: Tablet Portrait ──────────────────────────────── */
@media (max-width: 992px) {
    :root { --topbar-height: 60px; }
    .topbar { padding: 0 20px; }
    .topbar-title { font-size: 1.1rem; }
    .stats-grid { gap: 12px; }
    .stat-card { padding: 18px; }
    .stat-value { font-size: 1.5rem; }
    .stat-icon-wrap { width: 40px; height: 40px; }
    .stat-icon-wrap svg { width: 18px; height: 18px; }
    .dash-card-header { padding: 16px 20px 0; margin-bottom: 16px; }
    .dash-card-title { font-size: 0.95rem; }
    .data-table th { padding: 10px 12px; font-size: 0.7rem; }
    .data-table td { padding: 10px 12px; font-size: 0.8rem; }
    .modal { max-width: 500px; }
    .modal-header { padding: 18px 20px; }
    .modal-body { padding: 18px 20px; }
    .modal-footer { padding: 16px 20px; }
}

/* ── 768px: Mobile ───────────────────────────────────────── */
@media (max-width: 768px) {
    :root { --sidebar-width: 0px; --topbar-height: 56px; }

    .sidebar {
        width: 280px;
        height: 100vh;
        height: 100dvh;
        transform: translateX(-100%);
        z-index: 1000;
    }
    .sidebar.mobile-open { transform: translateX(0); }
    .sidebar-close-btn { display: flex; position: sticky; top: 12px; z-index: 10; }
    .sidebar-nav { flex: 1; overflow-y: auto; padding-bottom: 30px; -webkit-overflow-scrolling: touch; }
    .sidebar-link { padding: 12px 14px; font-size: 0.85rem; }
    .sidebar-section-label { padding: 14px 20px 6px; font-size: 0.68rem; }
    .sidebar-submenu { max-height: 500px !important; overflow: visible !important; }
    .sidebar-sublink { padding: 10px 14px 10px 42px; font-size: 0.8rem; }
    .sidebar-overlay.active { display: block; z-index: 999; }

    .main-area { margin-left: 0; }
    .topbar { padding: 0 16px; }
    .topbar-title { font-size: 1rem; }
    .topbar-breadcrumb { display: none; }
    .btn-quick-text { display: none; }
    .btn-quick-action { padding: 8px 12px; }
    .profile-info { display: none; }
    .profile-trigger { padding: 6px; }

    .page-content { padding: 16px 12px; }
    .welcome-banner { flex-direction: column; gap: 16px; align-items: flex-start; padding: 20px; }
    .welcome-text h2 { font-size: 1.2rem; }
    .welcome-date { text-align: left; }
    .welcome-date-day { font-size: 1.6rem; }

    .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-card { padding: 14px; }
    .stat-value { font-size: 1.3rem; }
    .stat-label { font-size: 0.75rem; }
    .stat-sub { font-size: 0.68rem; }
    .stat-icon-wrap { width: 34px; height: 34px; }
    .stat-icon-wrap svg { width: 16px; height: 16px; }

    .data-table { font-size: 0.78rem; }
    .data-table th { padding: 8px 10px; font-size: 0.65rem; letter-spacing: 0.3px; }
    .data-table td { padding: 8px 10px; font-size: 0.75rem; }

    .form-input, .form-select, .form-textarea { padding: 10px 12px; font-size: 0.85rem; }
    .form-label { font-size: 0.75rem; }

    .modal { width: 95%; max-width: none; max-height: 85vh; }
    .modal-header { padding: 16px 18px; }
    .modal-body { padding: 16px 18px; }
    .modal-footer { padding: 14px 18px; flex-direction: column; }
    .modal-footer .btn-primary,
    .modal-footer .btn-secondary { width: 100%; justify-content: center; }

    .auth-page { flex-direction: column; }
    .auth-left { flex: 0 0 auto; min-height: 200px; padding: 24px 20px; }
    .auth-left::before, .auth-left::after { display: none; }
    .auth-features { display: none; }
    .auth-headline { font-size: 1.4rem; }
    .auth-brand { margin-bottom: 24px; }
    .auth-right { padding: 24px 20px; }
    .auth-card { max-width: 100%; }
    .auth-card-header h2 { font-size: 1.5rem; }
}

/* ── 480px: Small Mobile ─────────────────────────────────── */
@media (max-width: 480px) {
    :root { --topbar-height: 52px; }

    .sidebar { width: 100%; max-width: 300px; }
    .sidebar-link { padding: 13px 16px; font-size: 0.88rem; }
    .sidebar-link-icon { width: 20px; height: 20px; }

    .topbar { padding: 0 10px; }
    .topbar-right { gap: 4px; }
    .topbar-divider { display: none; }

    .stats-grid { grid-template-columns: 1fr; }
    .stat-value { font-size: 1.5rem; }

    .welcome-banner { border-radius: var(--radius-lg); padding: 16px; }
    .welcome-text h2 { font-size: 1.1rem; }

    .dash-card-header { flex-direction: column; gap: 8px; align-items: flex-start; }

    .data-table { font-size: 0.72rem; }
    .data-table th { padding: 6px 8px; font-size: 0.6rem; }
    .data-table td { padding: 6px 8px; font-size: 0.7rem; }

    .btn-primary { padding: 12px 20px; font-size: 0.88rem; }
    .btn-secondary { padding: 8px 16px; font-size: 0.8rem; }

    .page-content { padding: 12px 8px; }

    .auth-left { min-height: 150px; padding: 16px; }
    .auth-headline { font-size: 1.2rem; }
    .auth-subtext { font-size: 0.85rem; margin-bottom: 24px; }
    .auth-card-header h2 { font-size: 1.3rem; }
}

/* ── 360px: Tiny Mobile ──────────────────────────────────── */
@media (max-width: 360px) {
    .stat-card { padding: 12px; }
    .stat-value { font-size: 1.2rem; }
    .stat-icon-wrap { width: 30px; height: 30px; }
    .topbar-title { font-size: 0.9rem; }
    .form-input, .form-select { padding: 8px 10px; font-size: 0.8rem; }
}
