/*
## Authors: AimCodex
## License: MIT
## Website: https://aimcodex.com
## Version: 3.0.0
## Source: https://github.com/AimCodex/Fynix
## Contact: https://www.linkedin.com/in/aimcodex
## Description: Fynix is a modern and responsive admin dashboard template built with HTML, CSS, and JavaScript. It provides a clean and intuitive user interface for managing various aspects of a web application or website. The template includes pre-designed components, charts, tables, forms, and other UI elements to help developers quickly build admin panels and dashboards. With its responsive design, Fynix ensures a seamless experience across different devices and screen sizes.
## Demo: https://aimcodex.github.io/Fynix
*/
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    color-scheme: dark;
    --divider: rgba(255, 255, 255, 0.05);
    --overlay: rgba(19, 21, 25, 0.8);
    --chip-bg: #131519;
    --bg-color: #1e2128;
    --text-main: #e2e8f0;
    --text-muted: #718096;
    --accent-blue: #63b3ed;
    --accent-green: #48bb78;
    --accent-red: #fc8181;
    --accent-purple: #b794f4;
    --shadow-light: #292d36;
    --shadow-dark: #131519;
    --sidebar-width: 260px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

/* ----- SIDEBAR ----- */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    background: var(--bg-color);
    box-shadow: 10px 0 30px var(--shadow-dark);
    display: flex;
    flex-direction: column;
    padding: 30px 20px;
    z-index: 100;
    transition: transform 0.3s ease;
    overflow-y: auto;
}

.sidebar::-webkit-scrollbar {
    width: 5px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--shadow-dark);
    border-radius: 10px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 24px;
    font-weight: 700;
    color: var(--accent-blue);
    margin-bottom: 30px;
    padding-left: 10px;
    text-shadow: 0 0 10px rgba(99, 179, 237, 0.3);
    text-decoration: none;
}

.brand-icon {
    width: 35px;
    height: 35px;
    background: var(--bg-color);
    border-radius: 10px;
    box-shadow: 4px 4px 8px var(--shadow-dark), -4px -4px 8px var(--shadow-light);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 18px;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 14px 20px;
    border-radius: 12px;
    color: var(--text-muted);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
    box-shadow: 4px 4px 10px var(--shadow-dark), -4px -4px 10px var(--shadow-light);
}

.nav-item i {
    width: 20px;
    text-align: center;
}

.nav-item:hover,
.nav-item.active {
    color: var(--accent-blue);
    box-shadow: inset 4px 4px 8px var(--shadow-dark), inset -4px -4px 8px var(--shadow-light);
    transform: translateX(5px);
}

.nav-item.active {
    font-weight: 600;
}

/* ----- MAIN CONTENT ----- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 30px 40px;
    transition: margin-left 0.3s ease;
    width: calc(100% - var(--sidebar-width));
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
    position: relative;
    z-index: 50;
}

.mobile-menu-btn {
    display: none;
    background: var(--bg-color);
    border: none;
    color: var(--text-main);
    font-size: 20px;
    padding: 10px 15px;
    border-radius: 10px;
    box-shadow: 4px 4px 8px var(--shadow-dark), -4px -4px 8px var(--shadow-light);
    cursor: pointer;
}

.page-title h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 5px;
}

.page-title p {
    color: var(--text-muted);
    font-size: 14px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
    position: relative;
}

/* PROFILE DROPDOWN */
.profile-dropdown-container {
    position: relative;
}

.profile-btn {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 8px 20px 8px 8px;
    background: var(--bg-color);
    border-radius: 50px;
    box-shadow: 6px 6px 12px var(--shadow-dark), -6px -6px 12px var(--shadow-light);
    cursor: pointer;
    border: none;
    color: var(--text-main);
    transition: all 0.3s ease;
}

.profile-btn:hover {
    box-shadow: inset 4px 4px 8px var(--shadow-dark), inset -4px -4px 8px var(--shadow-light);
}

.avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--bg-color);
    box-shadow: inset 3px 3px 6px var(--shadow-dark), inset -3px -3px 6px var(--shadow-light);
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--accent-blue);
    font-weight: bold;
    font-size: 16px;
}

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

.user-info-text p {
    font-size: 14px;
    font-weight: 600;
}

.user-info-text span {
    font-size: 12px;
    color: var(--text-muted);
}

.profile-btn .fa-chevron-down {
    font-size: 12px;
    color: var(--text-muted);
    margin-left: 10px;
    transition: transform 0.3s ease;
}

.profile-btn.active .fa-chevron-down {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 120%;
    right: 0;
    width: 220px;
    background: var(--bg-color);
    border-radius: 20px;
    box-shadow: 10px 10px 30px var(--shadow-dark), -10px -10px 30px var(--shadow-light);
    padding: 15px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 200;
}

.profile-dropdown-container.active .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: 10px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.dropdown-item:hover {
    background: var(--chip-bg);
    color: var(--accent-blue);
}

.dropdown-item.logout {
    color: var(--accent-red);
    margin-top: 5px;
    border-top: 1px solid var(--divider);
    border-radius: 0 0 10px 10px;
    padding-top: 15px;
}

.dropdown-item.logout:hover {
    background: rgba(252, 129, 129, 0.1);
    color: var(--accent-red);
}

/* ----- PAGE SECTIONS (SPA) ----- */
.page-section {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}

.page-section.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
    margin-bottom: 30px;
}

.card {
    background: var(--bg-color);
    border-radius: 20px;
    padding: 25px;
    box-shadow: 10px 10px 20px var(--shadow-dark), -10px -10px 20px var(--shadow-light);
    transition: transform 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
}

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

.card-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.summary-card h3 {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 15px;
    font-weight: 500;
}

.summary-card h2 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 10px;
}

.summary-card .trend {
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
}

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

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

.chart-card {
    grid-column: span 2;
    display: flex;
    flex-direction: column;
}

.chart-container-wrapper {
    position: relative;
    height: 300px;
    width: 100%;
}

.list-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--divider);
}

.list-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.item-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.item-icon {
    width: 45px;
    height: 45px;
    border-radius: 12px;
    background: var(--bg-color);
    box-shadow: inset 3px 3px 6px var(--shadow-dark), inset -3px -3px 6px var(--shadow-light);
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--accent-blue);
    font-size: 18px;
}

.item-details p {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 3px;
}

.item-details span {
    font-size: 13px;
    color: var(--text-muted);
}

.item-amount {
    font-weight: 700;
    font-size: 16px;
}

.amount-pos {
    color: var(--accent-green);
}

.amount-neg {
    color: var(--accent-red);
}

.progress-wrapper {
    margin-top: 10px;
}

.progress-labels {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.progress-bar {
    width: 100%;
    height: 10px;
    background: var(--bg-color);
    border-radius: 10px;
    box-shadow: inset 2px 2px 5px var(--shadow-dark), inset -2px -2px 5px var(--shadow-light);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(72, 187, 120, 0.5);
}

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

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    padding: 15px;
    font-size: 13px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--divider);
}

td {
    padding: 15px;
    font-size: 14px;
    border-bottom: 1px solid var(--divider);
}

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

.badge {
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background: var(--chip-bg);
    color: var(--accent-blue);
}

.badge i {
    margin-right: 6px;
    display: inline-block;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-bottom: 1px solid var(--divider);
}

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

.toggle-switch {
    width: 50px;
    height: 26px;
    background: var(--bg-color);
    border-radius: 15px;
    box-shadow: inset 3px 3px 6px var(--shadow-dark), inset -3px -3px 6px var(--shadow-light);
    position: relative;
    cursor: pointer;
}

.toggle-knob {
    width: 20px;
    height: 20px;
    background: var(--accent-blue);
    border-radius: 50%;
    position: absolute;
    top: 3px;
    left: 3px;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px rgba(99, 179, 237, 0.5);
}

.toggle-switch.active .toggle-knob {
    left: 27px;
    background: var(--accent-green);
    box-shadow: 0 0 10px rgba(72, 187, 120, 0.5);
}

/* ----- ACTION BUTTONS & MODALS ----- */
.floating-actions {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 90;
}

.fab {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    border: none;
    background: var(--bg-color);
    box-shadow: 6px 6px 15px var(--shadow-dark), -6px -6px 15px var(--shadow-light);
    color: var(--accent-blue);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s ease;
}

.fab:hover {
    color: var(--accent-green);
    transform: scale(1.05);
}

.fab:active {
    box-shadow: inset 4px 4px 10px var(--shadow-dark), inset -4px -4px 10px var(--shadow-light);
    transform: scale(0.95);
}

.fab.chat {
    color: var(--accent-purple);
}

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--overlay);
    backdrop-filter: blur(5px);
    z-index: 99;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 90%;
    max-width: 450px;
    background: var(--bg-color);
    border-radius: 25px;
    padding: 30px;
    box-shadow: 0px 0px 10px var(--shadow-dark), 0px 0px 10px var(--shadow-light);
    z-index: 1001;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal.active {
    opacity: 1;
    pointer-events: all;
    transform: translate(-50%, -50%) scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
}

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

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.input-group input,
.input-group select {
    width: 100%;
    height: 50px;
    background: var(--bg-color);
    border: none;
    border-radius: 12px;
    box-shadow: inset 4px 4px 8px var(--shadow-dark), inset -4px -4px 8px var(--shadow-light);
    padding: 0 15px;
    color: var(--text-main);
    outline: none;
    font-size: 14px;
}

.submit-btn {
    width: 100%;
    height: 55px;
    border: none;
    border-radius: 12px;
    background: var(--bg-color);
    box-shadow: 6px 6px 12px var(--shadow-dark), -6px -6px 12px var(--shadow-light);
    color: var(--accent-green);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.2s;
}

.submit-btn:active {
    box-shadow: inset 4px 4px 8px var(--shadow-dark), inset -4px -4px 8px var(--shadow-light);
}

.chat-drawer {
    position: fixed;
    top: 0;
    right: -400px;
    width: 100%;
    max-width: 380px;
    height: 100vh;
    background: var(--bg-color);
    box-shadow: -10px 0 30px var(--shadow-dark);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    transition: right 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chat-drawer.active {
    right: 0;
}

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

.chat-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chat-msg {
    max-width: 80%;
    padding: 15px;
    border-radius: 15px;
    font-size: 14px;
    line-height: 1.4;
}

.chat-msg.ai {
    background: var(--bg-color);
    box-shadow: 4px 4px 10px var(--shadow-dark), -4px -4px 10px var(--shadow-light);
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}

.chat-msg.user {
    background: var(--chip-bg);
    box-shadow: inset 2px 2px 5px var(--shadow-dark), inset -2px -2px 5px var(--shadow-light);
    align-self: flex-end;
    border-bottom-right-radius: 2px;
    color: var(--accent-blue);
}

.chat-input-area {
    padding: 20px;
    display: flex;
    gap: 10px;
}

.chat-input-area input {
    flex: 1;
    height: 50px;
    background: var(--bg-color);
    border: none;
    border-radius: 25px;
    box-shadow: inset 4px 4px 8px var(--shadow-dark), inset -4px -4px 8px var(--shadow-light);
    padding: 0 20px;
    color: var(--text-main);
    outline: none;
}

.chat-send {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: var(--bg-color);
    box-shadow: 4px 4px 8px var(--shadow-dark), -4px -4px 8px var(--shadow-light);
    color: var(--accent-purple);
    cursor: pointer;
}

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

    .chart-card {
        grid-column: span 2;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
        box-shadow: 20px 0 50px rgba(0, 0, 0, 0.5);
    }

    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 20px;
    }

    .mobile-menu-btn {
        display: block;
    }

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

    .chart-card {
        grid-column: span 1;
    }

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

    .user-info-text {
        display: none;
    }

    .profile-btn {
        padding: 8px;
    }

    .profile-btn .fa-chevron-down {
        display: none;
    }
}

/* ----- FORM ROWS & NEO BUTTONS (shared) ----- */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
    align-items: end;
}

.form-row .submit-btn {
    margin-top: 0;
}

.btn-neo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border: none;
    border-radius: 12px;
    background: var(--bg-color);
    color: var(--accent-blue);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 4px 4px 8px var(--shadow-dark), -4px -4px 8px var(--shadow-light);
    transition: all 0.2s ease;
}

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

.btn-neo:active {
    box-shadow: inset 3px 3px 6px var(--shadow-dark), inset -3px -3px 6px var(--shadow-light);
}

.btn-neo:focus-visible,
.fab:focus-visible,
.submit-btn:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 3px;
}

.btn-small {
    padding: 8px 14px;
}

.btn-icon {
    padding: 8px 12px;
}

/* ----- INVOICE ----- */
.modal-wide {
    max-width: 620px;
    max-height: 90vh;
    overflow-y: auto;
}

.items-label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.invoice-item-row {
    display: grid;
    grid-template-columns: 1fr 80px 110px 44px;
    gap: 10px;
    margin-bottom: 12px;
    align-items: center;
}

.invoice-item-row input {
    width: 100%;
    height: 46px;
    background: var(--bg-color);
    border: none;
    border-radius: 12px;
    box-shadow: inset 4px 4px 8px var(--shadow-dark), inset -4px -4px 8px var(--shadow-light);
    padding: 0 12px;
    color: var(--text-main);
    outline: none;
    font-size: 14px;
}

.invoice-item-row .remove-item {
    height: 40px;
    width: 40px;
    padding: 0;
    justify-content: center;
    color: var(--accent-red);
}

.invoice-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 50px;
    padding: 0 15px;
    font-size: 14px;
    color: var(--text-muted);
}

.invoice-total strong {
    font-size: 20px;
    color: var(--text-main);
}

.badge.paid {
    color: var(--accent-green);
}

.badge.pending {
    color: var(--accent-blue);
}

.badge.overdue {
    color: var(--accent-red);
}

.input-group input:focus,
.invoice-item-row input:focus {
    box-shadow: inset 4px 4px 8px var(--shadow-dark), inset -4px -4px 8px var(--shadow-light), 0 0 0 2px rgba(99, 179, 237, 0.4);
}

@media (max-width: 768px) {
    .invoice-item-row {
        grid-template-columns: 1fr 60px 90px 40px;
    }
}

@media (max-width: 520px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* ===== v3: data pages, filters, searchable dropdown, forms ===== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

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

.req {
    color: var(--accent-red);
}

select option {
    background: var(--bg-color);
    color: var(--text-main);
}

.color-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
    flex: none;
}

.cell-icon {
    color: var(--accent-blue);
    margin-right: 8px;
    width: 18px;
    text-align: center;
}

.amount-over {
    color: var(--accent-red);
    font-weight: 600;
}

.trend.good {
    color: var(--accent-green);
}

.trend.bad {
    color: var(--accent-red);
}

.badge {
    display: inline-flex;
    align-items: center;
}

.badge.warn {
    color: #f6ad55;
}

.badge.paid {
    color: var(--accent-green);
}

.badge.pending {
    color: var(--accent-blue);
}

.badge.overdue {
    color: var(--accent-red);
}

/* table helpers */
th.right,
td.right {
    text-align: right;
}

.actions-col {
    width: 1%;
    white-space: nowrap;
}

.row-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.row-actions .btn-icon {
    padding: 8px 11px;
    font-size: 12px;
}

.btn-neo.btn-danger {
    color: var(--accent-red);
}

.btn-neo.btn-danger:hover {
    color: #feb2b2;
}

.cell-progress {
    min-width: 150px;
}

.cell-progress small {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.list-count {
    margin-top: 15px;
    font-size: 13px;
    color: var(--text-muted);
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    list-style: none;
}

.empty-state i {
    font-size: 28px;
    margin-bottom: 12px;
    display: block;
}

/* filter bar */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-bottom: 20px;
}

.filter-field {
    flex: 1 1 170px;
    min-width: 150px;
    position: relative;
}

.filter-search {
    flex: 1 1 140px;
}

.filter-search i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 13px;
    pointer-events: none;
}

.filter-search input {
    padding-left: 38px !important;
}

.filter-bar input,
.filter-bar select {
    width: 100%;
    height: 44px;
    background: var(--bg-color);
    border: none;
    border-radius: 12px;
    box-shadow: inset 3px 3px 6px var(--shadow-dark), inset -3px -3px 6px var(--shadow-light);
    padding: 0 14px;
    color: var(--text-main);
    outline: none;
    font-size: 13px;
}

.filter-bar input:focus,
.filter-bar select:focus {
    box-shadow: inset 3px 3px 6px var(--shadow-dark), inset -3px -3px 6px var(--shadow-light), 0 0 0 2px rgba(99, 179, 237, 0.4);
}

.filter-date {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 190px;
}

.filter-date span {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}

/* searchable dropdown */
.ss {
    position: relative;
}

.ss .ss-input {
    padding-right: 38px;
    cursor: text;
}

.ss-caret {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 12px;
    pointer-events: none;
}

.ss-list {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    z-index: 300;
    list-style: none;
    margin: 0;
    padding: 8px;
    max-height: 220px;
    overflow-y: auto;
    background: var(--bg-color);
    border-radius: 14px;
    box-shadow: 8px 8px 20px var(--shadow-dark), -4px -4px 14px var(--shadow-light);
}

.ss-opt,
.ss-empty {
    padding: 10px 12px;
    border-radius: 9px;
    font-size: 14px;
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
}

.ss-opt.active {
    background: var(--chip-bg);
    color: var(--accent-blue);
}

.ss-opt.selected {
    font-weight: 600;
}

.ss-empty {
    color: var(--text-muted);
    cursor: default;
}

/* form modal */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px 20px;
    margin-bottom: 8px;
}

.form-grid .full {
    grid-column: 1 / -1;
}

.form-grid .input-group input,
.form-grid .input-group select {
    height: 48px;
}

.form-grid .input-group input.readonly {
    opacity: 0.6;
}

.input-group.invalid input,
.input-group.invalid select {
    box-shadow: inset 4px 4px 8px var(--shadow-dark), inset -4px -4px 8px var(--shadow-light), 0 0 0 2px rgba(252, 129, 129, 0.6);
}

.field-error,
.form-error {
    color: var(--accent-red);
    font-size: 12px;
    margin-top: 6px;
}

.form-error {
    margin: 6px 0 10px;
    font-size: 13px;
}

.input-group select {
    appearance: none;
    padding-right: 15px;
}

.items-field .add-item {
    margin-top: 4px;
}

.invoice-total.full {
    grid-column: 1 / -1;
}

.modal-wide {
    max-height: 92vh;
    overflow-y: auto;
    padding-bottom: 36px;
}

/* confirm modal + toast */
.modal-confirm {
    max-width: 400px;
    z-index: 1002;
}

.confirm-text {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 25px;
}

.confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 30px;
    transform: translate(-50%, 20px);
    opacity: 0;
    pointer-events: none;
    z-index: 2000;
    background: var(--bg-color);
    color: var(--text-main);
    padding: 14px 24px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 8px 8px 20px var(--shadow-dark), -6px -6px 16px var(--shadow-light);
    transition: all 0.3s ease;
}

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

/* profile + settings */
.profile-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.profile-row p {
    font-weight: 600;
    margin-bottom: 4px;
}

.toggle-switch:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 3px;
}

.chart-note {
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 10px;
}

.section-gap {
    margin-bottom: 30px;
}

.card-header .select-inline {
    height: 40px;
    width: auto;
    min-width: 150px;
    background: var(--bg-color);
    border: none;
    border-radius: 12px;
    color: var(--text-main);
    padding: 0 12px;
    box-shadow: inset 3px 3px 6px var(--shadow-dark), inset -3px -3px 6px var(--shadow-light);
}

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    .row-actions {
        flex-wrap: nowrap;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}

/* ===== Light theme ===== */
:root[data-theme="light"] {
    color-scheme: light;
    --bg-color: #e3e8ef;
    --text-main: #1f2937;
    --text-muted: #566174;
    --accent-blue: #2b6cb0;
    --accent-green: #276749;
    --accent-red: #c53030;
    --accent-purple: #6b46c1;
    --shadow-light: #ffffff;
    --shadow-dark: #b4bccb;
    --divider: rgba(0, 0, 0, 0.09);
    --overlay: rgba(90, 100, 120, 0.55);
    --chip-bg: #d3dae5;
}

:root[data-theme="light"] .brand {
    text-shadow: none;
}

:root[data-theme="light"] .toggle-knob,
:root[data-theme="light"] .progress-fill {
    box-shadow: none;
}

/* theme toggle button */
.theme-btn {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: none;
    background: var(--bg-color);
    color: var(--accent-blue);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 6px 6px 12px var(--shadow-dark), -6px -6px 12px var(--shadow-light);
    transition: all 0.2s ease;
}

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

.theme-btn:active {
    box-shadow: inset 4px 4px 8px var(--shadow-dark), inset -4px -4px 8px var(--shadow-light);
}

.theme-btn:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 3px;
}

/* ===== v4: API-connected additions ===== */
.sub {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.hint {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.logo-thumb {
    width: 22px;
    height: 22px;
    object-fit: contain;
    border-radius: 6px;
    vertical-align: middle;
    margin-right: 4px;
}

.logo-thumb.round {
    border-radius: 50%;
    object-fit: cover;
}

.item-icon .logo-thumb{
    margin-right: 0px;
}

.emi-icon.item-icon{
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
}

.avatar {
    overflow: hidden;
    position: relative;
}

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

.avatar-lg {
    width: 72px;
    height: 72px;
    font-size: 28px;
    flex: none;
}

.profile-id {
    display: flex;
    align-items: center;
    gap: 20px;
}

.btn-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.pager {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    margin-top: 14px;
    font-size: 13px;
    color: var(--text-muted);
}

.btn-neo:disabled {
    opacity: 0.5;
    cursor: default;
}

.input-group textarea {
    width: 100%;
    min-height: 84px;
    resize: vertical;
    background: var(--bg-color);
    border: none;
    border-radius: 12px;
    box-shadow: inset 4px 4px 8px var(--shadow-dark), inset -4px -4px 8px var(--shadow-light);
    padding: 12px 15px;
    color: var(--text-main);
    outline: none;
    font-size: 14px;
    font-family: inherit;
}

.input-group input[type="file"] {
    padding: 12px 15px;
    height: auto;
    font-size: 13px;
    color: var(--text-muted);
}

.input-group.invalid textarea {
    box-shadow: inset 4px 4px 8px var(--shadow-dark), inset -4px -4px 8px var(--shadow-light), 0 0 0 2px rgba(252, 129, 129, 0.6);
}

.nav-menu .nav-item[hidden] {
    display: none;
}

/* keep the last rows (and their action buttons) scrollable clear of the floating buttons */

/* the [hidden] attribute must always win over component display rules */
[hidden] {
    display: none !important;
}

/* =========================================
FLOATING DRAGGABLE CALCULATOR
========================================= */
.calc-container {
    position: fixed;
    top: 10px;
    left: 10px;
    background: var(--bg-color, #f4f7f6);
    width: 250px;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.2);
    border: 1px solid var(--border-color, rgba(0,0,0,0.05));
    z-index: 99999;
    display: none;
    user-select: none;
    transition: box-shadow 0.2s ease;
}

.calc-container.active {
    display: block;
}

.calc-container.dragging {
    box-shadow: 0 30px 70px var(--shadow-dark), 0 -20px 70px var(--shadow-light);
    transition: none;
}

/* Drag Handle (Header) */
.calc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-color, rgba(0,0,0,0.06));
    cursor: grab;
}

.calc-header:active {
    cursor: grabbing;
}

.calc-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main, #333);
    display: flex;
    align-items: center;
    gap: 8px;
}

.calc-title i {
    color: var(--accent-purple, #6c5ce7);
}

.calc-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted, #888);
    font-size: 1rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.calc-close-btn:hover {
    background: var(--bg-color, #f4f7f6);
    color: #e74c3c;
}

/* Display Screen */
.calc-display {
    background: var(--bg-color, #f4f7f6);
    border-radius: 15px;
    padding: 10px 20px;
    margin-bottom: 15px;
    text-align: right;
    box-shadow: inset 2px 2px 5px var(--shadow-dark), inset -2px -2px 5px var(--shadow-light);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
}

.calc-history {
    font-size: 0.9rem;
    color: var(--text-muted, #888);
    min-height: 20px;
    word-wrap: break-word;
    overflow-x: auto;
    white-space: nowrap;
}

.calc-current {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-main, #333);
    overflow-x: auto;
    white-space: nowrap;
}

/* Keypad Grid */
.calc-keys {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.calc-btn {
    border: none;
    outline: none;
    background: var(--bg-color, #f4f7f6);
    color: var(--text-main, #333);
    font-size: 1.1rem;
    font-weight: 500;
    padding: 5px 0;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 3px 3px 6px var(--shadow-dark), -3px -3px 6px var(--shadow-light);
    transition: all 0.1s ease;
}

.calc-btn:active {
    box-shadow: inset 2px 2px 4px var(--shadow-dark), inset -2px -2px 4px var(--shadow-light);
    transform: scale(0.95);
}

.calc-btn.operator {
    color: var(--accent-purple, #6c5ce7);
    font-weight: 600;
}

.calc-btn.equal {
    background: var(--accent-purple, #6c5ce7);
    color: white;
    box-shadow: 3px 3px 6px rgba(108, 92, 231, 0.3);
}
.calc-btn.equal:active {
    box-shadow: inset 2px 2px 4px rgba(0,0,0,0.2);
}

.calc-btn.clear {
    color: #e74c3c;
}

.calc-btn.span-2 {
    grid-column: span 2;
}

.badge.partial { color: var(--accent-blue); }