/* ═══════════════════════════════════════════════
   NEXOFISCAL CRM — STYLESHEET
   Sistema de Gestión · Demo Dashboard
   ═══════════════════════════════════════════════ */


/* ── 1. THEME VARIABLES ─────────────────────── */

:root {
    /* Backgrounds */
    --bg-body:          #080b16;
    --bg-surface:       #0d1120;
    --bg-card:          #131829;
    --bg-card-hover:    #181e33;
    --bg-input:         #181e33;
    --bg-navbar:        rgba(8, 11, 22, 0.82);
    --bg-dropdown:      #151a2e;
    --bg-gradient-spot: rgba(0, 180, 216, 0.04);

    /* Borders */
    --border:           rgba(255, 255, 255, 0.06);
    --border-hover:     rgba(255, 255, 255, 0.12);

    /* Text */
    --text-primary:     #e8ecf4;
    --text-secondary:   #8892a8;
    --text-muted:       #555f75;

    /* Accent (celeste brand) */
    --accent:           #00b4d8;
    --accent-hover:     #22d3ee;
    --accent-subtle:    rgba(0, 180, 216, 0.12);

    /* Semantic */
    --success:          #10b981;
    --success-subtle:   rgba(16, 185, 129, 0.12);
    --warning:          #f59e0b;
    --warning-subtle:   rgba(245, 158, 11, 0.12);
    --danger:           #ef4444;
    --danger-subtle:    rgba(239, 68, 68, 0.12);
    --blue:             #6366f1;
    --blue-subtle:      rgba(99, 102, 241, 0.12);

    /* Shadows */
    --shadow-sm:        0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md:        0 4px 12px rgba(0, 0, 0, 0.35);
    --shadow-lg:        0 8px 32px rgba(0, 0, 0, 0.45);
    --shadow-glow:      0 0 40px rgba(0, 180, 216, 0.06);

    /* Radius */
    --radius-sm:        8px;
    --radius-md:        12px;
    --radius-lg:        16px;
    --radius-xl:        20px;

    /* Transitions */
    --transition-fast:  0.15s ease;
    --transition:       0.25s ease;
    --transition-slow:  0.4s ease;
}

/* ── Light Theme Override ── */
[data-theme="light"] {
    --bg-body:          #f0f4f8;
    --bg-surface:       #e8ecf2;
    --bg-card:          #ffffff;
    --bg-card-hover:    #f8fafc;
    --bg-input:         #f1f5f9;
    --bg-navbar:        rgba(255, 255, 255, 0.82);
    --bg-dropdown:      #ffffff;
    --bg-gradient-spot: rgba(0, 180, 216, 0.03);

    --border:           #e2e8f0;
    --border-hover:     #cbd5e1;

    --text-primary:     #0f172a;
    --text-secondary:   #475569;
    --text-muted:       #94a3b8;

    --accent:           #0891b2;
    --accent-hover:     #0e7490;
    --accent-subtle:    rgba(8, 145, 178, 0.08);

    --success:          #059669;
    --success-subtle:   rgba(5, 150, 105, 0.08);
    --warning:          #d97706;
    --warning-subtle:   rgba(217, 119, 6, 0.08);
    --danger:           #dc2626;
    --danger-subtle:    rgba(220, 38, 38, 0.08);
    --blue:             #4f46e5;
    --blue-subtle:      rgba(79, 70, 229, 0.08);

    --shadow-sm:        0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md:        0 4px 12px rgba(0, 0, 0, 0.06);
    --shadow-lg:        0 8px 32px rgba(0, 0, 0, 0.08);
    --shadow-glow:      0 0 40px rgba(0, 180, 216, 0.04);
}


/* ── 2. RESET & BASE ────────────────────────── */

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-body);
    background-image: radial-gradient(ellipse at 0% 0%, var(--bg-gradient-spot) 0%, transparent 50%);
    min-height: 100vh;
    transition: background var(--transition), color var(--transition);
}

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

button {
    font-family: inherit;
    border: none;
    background: none;
    cursor: pointer;
    color: inherit;
}

img {
    display: block;
    max-width: 100%;
}

input, select {
    font-family: inherit;
    font-size: inherit;
}

::selection {
    background: var(--accent);
    color: #fff;
}


/* ── 3. SCROLLBAR ───────────────────────────── */

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}


/* ── 4. ACCENT TOP LINE ─────────────────────── */

.accent-line {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), #6366f1, var(--accent));
    z-index: 1001;
}


/* ── 5. NAVBAR ──────────────────────────────── */

.navbar {
    position: sticky;
    top: 2px;
    z-index: 1000;
    background: var(--bg-navbar);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    transition: background var(--transition), border-color var(--transition);
}

.navbar-inner {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 24px;
    height: 64px;
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-right: 16px;
    flex-shrink: 0;
    text-decoration: none;
}

.logo-icon {
    flex-shrink: 0;
}

.logo-text {
    font-size: 17px;
    font-weight: 300;
    letter-spacing: 2px;
    color: var(--text-secondary);
    transition: color var(--transition);
}

.logo-bold {
    font-weight: 700;
    color: var(--text-primary);
}

.logo:hover .logo-text {
    color: var(--text-primary);
}

/* Hamburger */
.hamburger {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    transition: background var(--transition-fast), color var(--transition-fast);
}

.hamburger:hover {
    background: var(--accent-subtle);
    color: var(--accent);
}

/* Nav Links */
.nav-links {
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
}

.nav-item {
    position: relative;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.nav-link svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.nav-link .chevron {
    width: 14px;
    height: 14px;
    opacity: 0.5;
    transition: transform var(--transition-fast);
}

.nav-link:hover,
.nav-item.active .nav-link {
    color: var(--text-primary);
    background: var(--accent-subtle);
}

.nav-item.active .nav-link {
    color: var(--accent);
}

.nav-item.active .nav-link .chevron {
    transform: rotate(180deg);
}


/* ── 6. DROPDOWN MENUS ──────────────────────── */

.dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 220px;
    background: var(--bg-dropdown);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 6px;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all var(--transition-fast);
    z-index: 999;
}

.dropdown-menu.dropdown-right {
    left: auto;
    right: 0;
}

.nav-item.active > .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 400;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.dropdown-item svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.6;
}

.dropdown-item:hover {
    background: var(--accent-subtle);
    color: var(--text-primary);
}

.dropdown-item:hover svg {
    opacity: 1;
    color: var(--accent);
}

.dropdown-item.text-danger:hover {
    background: var(--danger-subtle);
    color: var(--danger);
}

.dropdown-item.text-danger:hover svg {
    color: var(--danger);
}

.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 6px 0;
}

/* User info in dropdown */
.dropdown-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
}

.dropdown-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.dropdown-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.dropdown-user-email {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 1px;
}


/* ── 7. NAV RIGHT ───────────────────────────── */

.nav-right {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.nav-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    position: relative;
}

.nav-icon-btn svg {
    width: 18px;
    height: 18px;
}

.nav-icon-btn:hover {
    background: var(--accent-subtle);
    color: var(--accent);
}

/* Theme toggle icons */
.icon-for-light { display: none; }
.icon-for-dark  { display: flex; }

[data-theme="light"] .icon-for-light { display: flex; }
[data-theme="light"] .icon-for-dark  { display: none; }

/* Notification badge */
.notification-btn {
    position: relative;
}

.notification-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    min-width: 16px;
    height: 16px;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50px;
    padding: 0 4px;
    line-height: 1;
}

/* Avatar button */
.avatar-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 4px;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.avatar-btn:hover {
    background: var(--accent-subtle);
}

.avatar-img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent-subtle);
}

.avatar-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.avatar-btn .chevron {
    width: 14px;
    height: 14px;
    color: var(--text-muted);
    transition: transform var(--transition-fast);
}


/* ── 8. MAIN CONTENT ────────────────────────── */

.main-content {
    max-width: 1600px;
    margin: 0 auto;
    padding: 28px 24px 48px;
}


/* ── 9. DASHBOARD HEADER ────────────────────── */

.dashboard-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 28px;
}

.greeting {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.date-text {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 4px;
}

.search-wrapper {
    position: relative;
    flex-shrink: 0;
}

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

.search-input {
    width: 340px;
    padding: 10px 16px 10px 42px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: all var(--transition-fast);
}

.search-input::placeholder {
    color: var(--text-muted);
}

.search-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}


/* ── 10. KPI CARDS ──────────────────────────── */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.kpi-card {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px;
    transition: all var(--transition), transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    position: relative;
    overflow: hidden;
    user-select: none;
}

.kpi-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    opacity: 0;
    transition: opacity var(--transition);
    pointer-events: none;
}

.kpi-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

.kpi-card:hover::after {
    opacity: 1;
}

/* ── Drag Handle ── */

.kpi-drag-handle {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: grab;
    opacity: 0;
    transition: all var(--transition-fast);
    z-index: 2;
}

.kpi-drag-handle svg {
    width: 16px;
    height: 16px;
}

.kpi-card:hover .kpi-drag-handle {
    opacity: 1;
}

.kpi-drag-handle:hover {
    color: var(--accent);
    background: var(--accent-subtle);
}

.kpi-drag-handle:active {
    cursor: grabbing;
}

/* ── Drag States ── */

.kpi-card.is-dragging {
    opacity: 0.4;
    transform: scale(0.97) !important;
    border-color: var(--accent);
    box-shadow: none;
}

.kpi-card.drag-over-left {
    border-left: 3px solid var(--accent);
    padding-left: 19px;
}

.kpi-card.drag-over-right {
    border-right: 3px solid var(--accent);
    padding-right: 19px;
}

.kpi-card.just-dropped {
    animation: dropBounce 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes dropBounce {
    0%   { transform: scale(0.92); opacity: 0.6; }
    50%  { transform: scale(1.03); }
    100% { transform: scale(1); opacity: 1; }
}

/* Drag ghost image enhancement - we handle this in JS */
.kpi-ghost {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.92;
    transform: rotate(2deg) scale(1.04);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35), 0 0 0 1px var(--accent);
    border-radius: var(--radius-lg);
}

.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.kpi-icon svg {
    width: 22px;
    height: 22px;
}

.kpi-icon-accent {
    background: var(--accent-subtle);
    color: var(--accent);
}

.kpi-icon-blue {
    background: var(--blue-subtle);
    color: var(--blue);
}

.kpi-icon-warning {
    background: var(--warning-subtle);
    color: var(--warning);
}

.kpi-icon-success {
    background: var(--success-subtle);
    color: var(--success);
}

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

.kpi-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.kpi-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    line-height: 1.1;
    margin-bottom: 8px;
}

.kpi-trend {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
}

.kpi-trend svg {
    width: 14px;
    height: 14px;
}

.trend-up {
    color: var(--success);
}

.trend-down {
    color: var(--danger);
}

.trend-period {
    font-weight: 400;
    color: var(--text-muted);
    margin-left: 4px;
}


/* ── 11. CARDS (generic) ────────────────────── */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.card:hover {
    border-color: var(--border-hover);
}

.card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.card-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.btn-link {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 500;
    color: var(--accent);
    transition: color var(--transition-fast);
    white-space: nowrap;
}

.btn-link svg {
    width: 16px;
    height: 16px;
}

.btn-link:hover {
    color: var(--accent-hover);
}

.chart-filter {
    padding: 6px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    outline: none;
    transition: border-color var(--transition-fast);
}

.chart-filter:hover,
.chart-filter:focus {
    border-color: var(--accent);
}


/* ── 12. CHARTS GRID ────────────────────────── */

.charts-grid {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 20px;
    margin-bottom: 24px;
}

.chart-container {
    position: relative;
}

.chart-container-lg {
    height: 300px;
}

.chart-container-donut {
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}


/* ── 13. BOTTOM GRID ────────────────────────── */

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


/* ── 14. DATA TABLE ─────────────────────────── */

.table-wrapper {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table thead th {
    padding: 10px 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table tbody td {
    padding: 14px 16px;
    font-size: 13px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
    background: var(--bg-card-hover);
}

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

.table-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.table-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.table-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

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

.table-amount {
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.table-date {
    white-space: nowrap;
    color: var(--text-muted);
}


/* ── 15. BADGES ─────────────────────────────── */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 50px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success {
    background: var(--success-subtle);
    color: var(--success);
}

.badge-warning {
    background: var(--warning-subtle);
    color: var(--warning);
}

.badge-accent {
    background: var(--accent-subtle);
    color: var(--accent);
}

.badge-danger {
    background: var(--danger-subtle);
    color: var(--danger);
}


/* ── 16. ACTIVITY FEED ──────────────────────── */

.activity-card {
    display: flex;
    flex-direction: column;
}

.activity-feed {
    display: flex;
    flex-direction: column;
    gap: 0;
    flex: 1;
    overflow-y: auto;
    max-height: 380px;
    padding-right: 4px;
}

.activity-item {
    display: flex;
    gap: 14px;
    padding: 14px 0;
    position: relative;
}

.activity-item:not(:last-child) {
    border-bottom: 1px solid var(--border);
}

/* Timeline connector line */
.activity-item:not(:last-child)::before {
    content: '';
    position: absolute;
    left: 5px;
    top: 36px;
    bottom: -2px;
    width: 1px;
    background: var(--border);
}

.activity-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 4px;
    position: relative;
    z-index: 1;
}

.dot-accent  { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-subtle); }
.dot-success { background: var(--success); box-shadow: 0 0 0 3px var(--success-subtle); }
.dot-warning { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-subtle); }
.dot-blue    { background: var(--blue); box-shadow: 0 0 0 3px var(--blue-subtle); }
.dot-danger  { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-subtle); }

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

.activity-text {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.activity-text strong {
    color: var(--text-primary);
    font-weight: 600;
}

.activity-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
    display: block;
}


/* ── 17. ANIMATIONS ─────────────────────────── */

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

.kpi-card        { animation: fadeInUp 0.5s ease both; }
.kpi-card:nth-child(1) { animation-delay: 0.05s; }
.kpi-card:nth-child(2) { animation-delay: 0.10s; }
.kpi-card:nth-child(3) { animation-delay: 0.15s; }
.kpi-card:nth-child(4) { animation-delay: 0.20s; }

.charts-grid .card { animation: fadeInUp 0.5s ease both; animation-delay: 0.25s; }
.bottom-grid .card { animation: fadeInUp 0.5s ease both; animation-delay: 0.35s; }


/* ── 18. RESPONSIVE ─────────────────────────── */

/* Tablet */
@media (max-width: 1200px) {
    .charts-grid,
    .bottom-grid {
        grid-template-columns: 1fr;
    }

    .search-input {
        width: 260px;
    }
}

@media (max-width: 1024px) {
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .nav-link span {
        display: none;
    }

    .nav-link .chevron {
        display: none;
    }

    .nav-link {
        padding: 8px 10px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }

    .nav-links {
        position: fixed;
        top: 66px;
        left: 0;
        right: 0;
        background: var(--bg-dropdown);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        padding: 8px;
        gap: 2px;
        box-shadow: var(--shadow-lg);
        transform: translateY(-10px);
        opacity: 0;
        visibility: hidden;
        transition: all var(--transition);
        z-index: 998;
    }

    .nav-links.mobile-open {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }

    .nav-links .nav-link span,
    .nav-links .nav-link .chevron {
        display: inline;
    }

    .nav-links .nav-link {
        padding: 10px 14px;
        width: 100%;
    }

    .nav-links .dropdown-menu {
        position: static;
        box-shadow: none;
        border: none;
        background: transparent;
        padding: 0 0 0 20px;
        opacity: 1;
        visibility: visible;
        transform: none;
        display: none;
    }

    .nav-links .nav-item.active .dropdown-menu {
        display: block;
    }

    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .search-wrapper {
        width: 100%;
    }

    .search-input {
        width: 100%;
    }

    .kpi-grid {
        grid-template-columns: 1fr;
    }

    .kpi-value {
        font-size: 24px;
    }

    .greeting {
        font-size: 22px;
    }

    .avatar-name {
        display: none;
    }

    .main-content {
        padding: 20px 16px 40px;
    }

    .navbar-inner {
        padding: 0 16px;
    }
}

@media (max-width: 480px) {
    .card {
        padding: 16px;
    }

    .card-header {
        flex-direction: column;
        gap: 8px;
    }
}


/* ═══════════════════════════════════════════════
   INTERNAL PAGES — EXTENDED COMPONENTS
   ═══════════════════════════════════════════════ */


/* ── 19. ACTIVE NAV SECTION ─────────────────── */

.nav-item.current-section > .nav-link,
.nav-link.section-active {
    color: var(--accent);
    background: var(--accent-subtle);
}

.dropdown-item.active {
    color: var(--accent);
    background: var(--accent-subtle);
}

.dropdown-item.active svg {
    opacity: 1;
    color: var(--accent);
}


/* ── 20. BREADCRUMB ─────────────────────────── */

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 20px;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.breadcrumb-item svg {
    width: 14px;
    height: 14px;
}

a.breadcrumb-item:hover {
    color: var(--accent);
}

.breadcrumb-item.current {
    color: var(--text-primary);
    font-weight: 500;
}

.breadcrumb-sep {
    width: 14px;
    height: 14px;
    color: var(--text-muted);
    opacity: 0.5;
}


/* ── 21. PAGE HEADER BAR ────────────────────── */

.page-header-bar {
    margin-bottom: 28px;
}

.page-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

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

.page-header-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: var(--accent-subtle);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.page-header-icon svg {
    width: 24px;
    height: 24px;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.page-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}


/* ── 22. BUTTONS ────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
    white-space: nowrap;
    text-decoration: none;
    line-height: 1.4;
}

.btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    box-shadow: 0 4px 12px rgba(0, 180, 216, 0.3);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-secondary);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--border-hover);
}

.btn-danger {
    background: var(--danger-subtle);
    color: var(--danger);
    border-color: transparent;
}

.btn-danger:hover {
    background: var(--danger);
    color: #fff;
}

.btn-success {
    background: var(--success);
    color: #fff;
    border-color: var(--success);
}

.btn-success:hover {
    opacity: 0.9;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-sm svg {
    width: 14px;
    height: 14px;
}

.btn-icon {
    padding: 8px;
    width: 36px;
    height: 36px;
    justify-content: center;
}

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

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
    padding: 8px;
}

.btn-ghost:hover {
    background: var(--accent-subtle);
    color: var(--accent);
}


/* ── 23. TOOLBAR / FILTER BAR ───────────────── */

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.filter-group {
    position: relative;
}

.filter-select {
    appearance: none;
    padding: 8px 36px 8px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    outline: none;
    transition: border-color var(--transition-fast);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%238892a8' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.filter-select:hover,
.filter-select:focus {
    border-color: var(--accent);
}

.search-box {
    position: relative;
}

.search-box .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    pointer-events: none;
}

.search-box input {
    padding: 8px 12px 8px 36px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    width: 260px;
    transition: border-color var(--transition-fast);
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.search-box input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}


/* ── 24. FORM COMPONENTS ────────────────────── */

.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-subtle);
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%238892a8' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

textarea.form-control {
    min-height: 80px;
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.form-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

/* Switch toggle */
.switch-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.switch-group:last-child {
    border-bottom: none;
}

.switch-label {
    font-size: 13px;
    color: var(--text-secondary);
}

.switch-label strong {
    display: block;
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 2px;
}

.switch {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    inset: 0;
    background: var(--border);
    border-radius: 50px;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.switch-slider::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: var(--bg-card);
    border-radius: 50%;
    transition: transform var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.switch input:checked + .switch-slider {
    background: var(--accent);
}

.switch input:checked + .switch-slider::before {
    transform: translateX(20px);
    background: #fff;
}


/* ── 25. MODAL ──────────────────────────────── */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition);
    padding: 24px;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px) scale(0.95);
    transition: transform var(--transition);
}

.modal-overlay.active .modal {
    transform: translateY(0) scale(1);
}

.modal-lg {
    max-width: 800px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 24px 0;
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
    background: none;
    border: none;
}

.modal-close svg {
    width: 20px;
    height: 20px;
}

.modal-close:hover {
    background: var(--danger-subtle);
    color: var(--danger);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 0 24px 24px;
}


/* ── 26. PAGINATION ─────────────────────────── */

.pagination-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.pagination-info {
    font-size: 13px;
    color: var(--text-muted);
}

.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pagination-btn {
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: none;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.pagination-btn:hover {
    background: var(--accent-subtle);
    color: var(--accent);
}

.pagination-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.pagination-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.pagination-btn svg {
    width: 16px;
    height: 16px;
}


/* ── 27. EMPTY STATE ────────────────────────── */

.empty-state {
    text-align: center;
    padding: 60px 24px;
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-lg);
    background: var(--accent-subtle);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.empty-state-icon svg {
    width: 28px;
    height: 28px;
}

.empty-state h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 20px;
}


/* ── 28. TABS ───────────────────────────────── */

.tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
    overflow-x: auto;
}

.tab-btn {
    padding: 12px 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-btn svg {
    width: 16px;
    height: 16px;
}

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

.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeInUp 0.3s ease both;
}


/* ── 29. STATUS INDICATORS ──────────────────── */

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
    flex-shrink: 0;
}

.status-dot-success { background: var(--success); box-shadow: 0 0 0 3px var(--success-subtle); }
.status-dot-warning { background: var(--warning); box-shadow: 0 0 0 3px var(--warning-subtle); }
.status-dot-danger  { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-subtle); }
.status-dot-accent  { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-subtle); }
.status-dot-blue    { background: var(--blue); box-shadow: 0 0 0 3px var(--blue-subtle); }

.badge-blue {
    background: var(--blue-subtle);
    color: var(--blue);
}


/* ── 30. PRODUCT GRID (catalogue) ───────────── */

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.product-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition);
}

.product-card:hover {
    border-color: var(--border-hover);
    box-shadow: var(--shadow-glow);
    transform: translateY(-2px);
}

.product-img {
    width: 100%;
    height: 180px;
    background: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.product-img svg {
    width: 48px;
    height: 48px;
    opacity: 0.3;
}

.product-info {
    padding: 16px;
}

.product-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.product-sku {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.product-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.product-price {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent);
}

.product-stock {
    font-size: 12px;
    font-weight: 500;
}

.product-actions {
    display: flex;
    gap: 6px;
    padding: 0 16px 16px;
}


/* ── 31. INTEGRATION CARDS ──────────────────── */

.integration-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.integration-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transition: border-color var(--transition);
}

.integration-card:hover {
    border-color: var(--border-hover);
}

.integration-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.integration-info {
    display: flex;
    align-items: center;
    gap: 14px;
}

.integration-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.integration-icon svg {
    width: 22px;
    height: 22px;
}

.integration-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.integration-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.integration-body {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
}


/* ── 32. PERMISSIONS MATRIX ─────────────────── */

.permissions-matrix {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.permissions-matrix thead th {
    padding: 10px 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    text-align: center;
    border-bottom: 1px solid var(--border);
}

.permissions-matrix thead th:first-child {
    text-align: left;
}

.permissions-matrix tbody td {
    padding: 12px 16px;
    text-align: center;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.permissions-matrix tbody td:first-child {
    text-align: left;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.permissions-matrix tbody tr:last-child td {
    border-bottom: none;
}

.checkbox-custom {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}


/* ── 33. PROFILE COMPONENTS ─────────────────── */

.profile-header {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 32px;
}

.profile-avatar-lg {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--accent-subtle);
}

.profile-name {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

.profile-role {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

.profile-edit-avatar {
    position: relative;
    cursor: pointer;
}

.profile-edit-avatar .edit-badge {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 24px;
    height: 24px;
    background: var(--accent);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bg-card);
}

.profile-edit-avatar .edit-badge svg {
    width: 12px;
    height: 12px;
}


/* ── 34. TABLE ACTIONS COLUMN ───────────────── */

.table-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.table-actions .btn-ghost {
    padding: 6px;
    width: 32px;
    height: 32px;
}

.table-actions .btn-ghost svg {
    width: 15px;
    height: 15px;
}


/* ── 35. KPI GRID — 3 columns variant ────────── */

.kpi-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}


/* ── 36. VIEW TOGGLE ────────────────────────── */

.view-toggle {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.view-toggle-btn {
    padding: 8px 12px;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.view-toggle-btn svg {
    width: 16px;
    height: 16px;
}

.view-toggle-btn:hover {
    color: var(--text-primary);
}

.view-toggle-btn.active {
    background: var(--accent-subtle);
    color: var(--accent);
}


/* ── 37. INVOICE LINE ITEMS ─────────────────── */

.line-items {
    margin-bottom: 16px;
}

.line-item-row {
    display: grid;
    grid-template-columns: 1fr 100px 120px 120px 40px;
    gap: 10px;
    align-items: end;
    margin-bottom: 10px;
}

.line-item-row .form-group {
    margin-bottom: 0;
}

.line-item-remove {
    margin-bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.line-items-total {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.line-items-total-row {
    display: flex;
    align-items: center;
    gap: 24px;
    font-size: 13px;
}

.line-items-total-row span:first-child {
    color: var(--text-muted);
    min-width: 120px;
    text-align: right;
}

.line-items-total-row span:last-child {
    font-weight: 600;
    color: var(--text-primary);
    min-width: 120px;
    text-align: right;
}

.line-items-total-row.total-final {
    font-size: 16px;
}

.line-items-total-row.total-final span:last-child {
    color: var(--accent);
    font-weight: 700;
}


/* ── 38. ACCOUNT STATEMENT ──────────────────── */

.account-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.account-summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    text-align: center;
}

.account-summary-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.account-summary-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.account-summary-value.positive {
    color: var(--success);
}

.account-summary-value.negative {
    color: var(--danger);
}


/* ── 39. FOOTER ─────────────────────────────── */

.site-footer {
    margin-top: 40px;
    padding: 24px 0;
    border-top: 1px solid var(--border);
}

.footer-inner {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

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

.footer-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 300;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    text-decoration: none;
}

.footer-logo strong {
    font-weight: 700;
    color: var(--text-secondary);
}

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

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

.footer-version {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    padding: 2px 8px;
    background: var(--accent-subtle);
    border-radius: 50px;
    color: var(--accent);
}

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

.footer-link {
    font-size: 12px;
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.footer-link:hover {
    color: var(--accent);
}


/* ── 40. RESPONSIVE — INTERNAL PAGES ────────── */

@media (max-width: 1024px) {
    .kpi-grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }

    .account-summary {
        grid-template-columns: repeat(2, 1fr);
    }

    .line-item-row {
        grid-template-columns: 1fr 80px 100px 100px 40px;
    }
}

@media (max-width: 768px) {
    .page-header-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-actions {
        width: 100%;
    }

    .page-actions .btn {
        flex: 1;
        justify-content: center;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-left,
    .toolbar-right {
        flex-wrap: wrap;
    }

    .search-box input {
        width: 100%;
    }

    .form-row,
    .form-row-3 {
        grid-template-columns: 1fr;
    }

    .kpi-grid-3 {
        grid-template-columns: 1fr;
    }

    .account-summary {
        grid-template-columns: 1fr;
    }

    .line-item-row {
        grid-template-columns: 1fr;
    }

    .product-grid {
        grid-template-columns: 1fr;
    }

    .integration-grid {
        grid-template-columns: 1fr;
    }

    .profile-header {
        flex-direction: column;
        text-align: center;
    }

    .footer-inner {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }

    .footer-left {
        flex-direction: column;
    }

    .pagination-wrapper {
        flex-direction: column;
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .tabs {
        gap: 0;
    }

    .tab-btn {
        padding: 10px 12px;
        font-size: 12px;
    }

    .modal {
        border-radius: var(--radius-lg);
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding-left: 16px;
        padding-right: 16px;
    }
}


/* ═══════════════════════════════════════════════
   PERSONALIZATION — NEW COMPONENTS
   ═══════════════════════════════════════════════ */


/* ── NAVBAR COMPACT MODE ─────────────────────── */

.navbar-compact .nav-link > span,
.navbar-compact .nav-link > .chevron {
    display: none;
}

.navbar-compact .nav-link {
    padding: 8px 10px;
    position: relative;
}

.navbar-compact .nav-link::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: -32px;
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    background: var(--bg-dropdown);
    color: var(--text-primary);
    font-size: 11px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 1100;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
}

.navbar-compact .nav-link:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.navbar-compact .logo-text {
    display: none;
}

/* Compact toggle icon states */
.icon-for-compact { display: none; }
.icon-for-expanded { display: inline-flex; }
.navbar-compact .icon-for-compact { display: inline-flex; }
.navbar-compact .icon-for-expanded { display: none; }


/* ── NAV EDITING MODE ────────────────────────── */

.nav-editing .nav-item[data-module] {
    cursor: grab;
    border: 2px dashed var(--accent-subtle);
    border-radius: var(--radius-sm);
    margin: 0 2px;
    transition: border-color var(--transition-fast), background var(--transition-fast);
}

.nav-editing .nav-item[data-module]:hover {
    border-color: var(--accent);
    background: var(--accent-subtle);
}

.nav-is-dragging {
    opacity: 0.35 !important;
    cursor: grabbing !important;
}

.nav-drag-over-left {
    border-left: 3px solid var(--accent) !important;
}

.nav-drag-over-right {
    border-right: 3px solid var(--accent) !important;
}

.nav-just-dropped {
    animation: navDropPulse 0.4s ease;
}

@keyframes navDropPulse {
    0% { transform: scale(1.08); box-shadow: 0 0 16px var(--accent-subtle); }
    100% { transform: scale(1); box-shadow: none; }
}

/* Nav edit banner */
.nav-edit-banner {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    background: var(--accent-subtle);
    color: var(--accent);
    font-size: 13px;
    font-weight: 500;
    border-bottom: 1px solid var(--accent);
}

.nav-edit-banner.visible {
    display: flex;
}

.nav-edit-banner kbd {
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-family: 'Inter', monospace;
    border: 1px solid var(--border);
}

.nav-edit-banner svg {
    width: 16px;
    height: 16px;
}


/* ── NAV ICON BUTTON (for edit/compact/search) ── */

.nav-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.nav-icon-btn:hover {
    color: var(--text-primary);
    background: var(--accent-subtle);
    border-color: var(--border);
}

.nav-icon-btn svg {
    width: 18px;
    height: 18px;
}


/* ── COMMAND PALETTE ─────────────────────────── */

.command-palette-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 15vh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.command-palette-overlay.active {
    display: flex;
}

.command-palette {
    width: 100%;
    max-width: 560px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: cmdFadeIn 0.15s ease;
}

@keyframes cmdFadeIn {
    from { opacity: 0; transform: translateY(-12px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.command-palette-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

.command-palette-header svg {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.command-palette-header input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    font-size: 15px;
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
}

.command-palette-header input::placeholder {
    color: var(--text-muted);
}

.command-palette-header kbd {
    background: var(--bg-input);
    color: var(--text-muted);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-family: 'Inter', monospace;
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.command-palette-results {
    max-height: 360px;
    overflow-y: auto;
    padding: 6px;
}

.command-result {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.command-result:hover,
.command-result.selected {
    background: var(--accent-subtle);
    color: var(--text-primary);
}

.command-result svg {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.command-result-label {
    flex: 1;
}

.command-result-label mark {
    background: var(--accent-subtle);
    color: var(--accent);
    border-radius: 2px;
    padding: 0 2px;
}

.command-result-module {
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg-input);
    padding: 2px 8px;
    border-radius: 10px;
    flex-shrink: 0;
}

.command-palette-footer {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 16px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-muted);
}

.command-palette-footer kbd {
    background: var(--bg-input);
    color: var(--text-muted);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-family: 'Inter', monospace;
    border: 1px solid var(--border);
    margin-right: 4px;
}


/* ── SHORTCUTS OVERLAY ───────────────────────── */

.shortcuts-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.shortcuts-overlay.active {
    display: flex;
}

.shortcuts-panel {
    width: 100%;
    max-width: 480px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: cmdFadeIn 0.15s ease;
}

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

.shortcuts-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.shortcuts-body {
    padding: 16px 20px;
    max-height: 400px;
    overflow-y: auto;
}

.shortcut-group {
    margin-bottom: 20px;
}

.shortcut-group:last-child {
    margin-bottom: 0;
}

.shortcut-group h4 {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin: 0 0 10px 0;
}

.shortcut-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    color: var(--text-secondary);
    font-size: 13px;
}

.shortcut-row kbd {
    background: var(--bg-input);
    color: var(--text-primary);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-family: 'Inter', monospace;
    border: 1px solid var(--border);
}

.shortcuts-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: color var(--transition-fast);
}

.shortcuts-close:hover {
    color: var(--text-primary);
}


/* ── PERSONALIZATION PAGE ────────────────────── */

.pz-section {
    padding: 24px 0;
    border-bottom: 1px solid var(--border);
}

.pz-section:first-child {
    padding-top: 8px;
}

.pz-section:last-child {
    border-bottom: none;
}

.pz-section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 4px 0;
}

.pz-section-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0 0 16px 0;
}

.pz-section-danger {
    border: 1px solid var(--danger-subtle);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-top: 8px;
    background: var(--danger-subtle);
}

.pz-section-danger .pz-section-title {
    color: var(--danger);
}

.pz-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 12px;
    padding: 10px 12px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.pz-hint svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.pz-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Module card */
.pz-module-card {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.pz-module-card:hover {
    border-color: var(--border-hover);
}

.pz-module-card.pz-dragging {
    opacity: 0.4;
}

.pz-module-card.pz-drag-over {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-subtle);
}

.pz-module-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
}

.pz-module-drag {
    cursor: grab;
    color: var(--text-muted);
    display: flex;
    align-items: center;
}

.pz-module-drag:active {
    cursor: grabbing;
}

.pz-module-drag svg {
    width: 18px;
    height: 18px;
}

.pz-module-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--accent-subtle);
    border-radius: var(--radius-sm);
    color: var(--accent);
    flex-shrink: 0;
}

.pz-module-icon svg {
    width: 16px;
    height: 16px;
}

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

.pz-module-label {
    width: 100%;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 14px;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
    transition: border-color var(--transition-fast), background var(--transition-fast);
}

.pz-module-label:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-card);
}

.pz-module-label:hover:not(:focus) {
    border-color: var(--border);
}

/* Switch toggle */
.pz-switch {
    position: relative;
    display: inline-flex;
    width: 42px;
    height: 24px;
    flex-shrink: 0;
}

.pz-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.pz-switch-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: 24px;
    transition: background var(--transition-fast), border-color var(--transition-fast);
}

.pz-switch-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 2px;
    top: 2px;
    background: var(--text-muted);
    border-radius: 50%;
    transition: transform var(--transition-fast), background var(--transition-fast);
}

.pz-switch input:checked + .pz-switch-slider {
    background: var(--accent-subtle);
    border-color: var(--accent);
}

.pz-switch input:checked + .pz-switch-slider::before {
    transform: translateX(18px);
    background: var(--accent);
}

.pz-switch.pz-disabled {
    opacity: 0.5;
    pointer-events: none;
}

.pz-switch-sm {
    width: 36px;
    height: 20px;
}

.pz-switch-sm .pz-switch-slider::before {
    width: 14px;
    height: 14px;
    left: 2px;
    top: 2px;
}

.pz-switch-sm input:checked + .pz-switch-slider::before {
    transform: translateX(16px);
}

/* Subpages */
.pz-module-subpages {
    padding: 0 14px 12px 56px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pz-subpage-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    color: var(--text-secondary);
    transition: background var(--transition-fast);
}

.pz-subpage-row:hover {
    background: var(--bg-card);
}

/* Toggle rows (KPIs, widgets) */
.pz-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-secondary);
    transition: background var(--transition-fast);
}

.pz-toggle-row:hover {
    background: var(--bg-input);
}

.pz-toggle-label {
    font-weight: 500;
    color: var(--text-primary);
}

.pz-toggle-desc {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Shortcut rows */
.pz-shortcut-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
    color: var(--text-secondary);
}

.pz-shortcut-input {
    width: 180px;
    text-align: center;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    font-size: 13px;
    font-family: 'Inter', monospace;
    color: var(--text-primary);
    cursor: pointer;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.pz-shortcut-input:hover {
    border-color: var(--border-hover);
}

.pz-shortcut-input.capturing {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-subtle);
    color: var(--accent);
    animation: shortcutPulse 1.5s ease infinite;
}

@keyframes shortcutPulse {
    0%, 100% { box-shadow: 0 0 0 3px var(--accent-subtle); }
    50% { box-shadow: 0 0 0 5px var(--accent-subtle); }
}

/* Btn outline variant */
.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all var(--transition-fast);
}

.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-subtle);
}

.btn-outline svg {
    width: 16px;
    height: 16px;
}

/* Btn danger variant */
.btn-danger {
    background: var(--danger);
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all var(--transition-fast);
}

.btn-danger:hover {
    background: #dc2626;
    box-shadow: 0 0 12px var(--danger-subtle);
}

.btn-danger svg {
    width: 16px;
    height: 16px;
}


/* ── RESPONSIVE FOR PERSONALIZATION ──────────── */

@media (max-width: 768px) {
    .pz-module-subpages {
        padding-left: 24px;
    }

    .pz-shortcut-input {
        width: 140px;
    }

    .command-palette {
        max-width: calc(100% - 32px);
        margin: 0 16px;
    }

    .shortcuts-panel {
        max-width: calc(100% - 32px);
        margin: 0 16px;
    }
}

@media (max-width: 480px) {
    .pz-shortcut-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .pz-shortcut-input {
        width: 100%;
    }
}
