@import url('style.css');

@media (min-width: 481px) {
    :root {
        --sidebar-width: 240px;
        --navbar-height: 64px;
        --footer-height: 40px;
    }

    html, body {
        background: var(--bg);
        min-height: 100vh;
        overflow-x: hidden;
    }

    #app {
        max-width: none;
        width: 100%;
        min-height: 100vh;
        border-radius: 0;
        border: none;
        box-shadow: none;
        overflow: visible;
        display: flex;
        flex-direction: row;
        padding-bottom: 0;
    }

    .page {
        min-height: auto;
    }

    .page.active {
        padding-bottom: 20px;
    }

    .bottom-spacer {
        height: 20px;
    }

    /* SIDEBAR */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: var(--sidebar-width);
        height: 100vh;
        background: var(--white);
        border-right: 1px solid var(--border);
        display: flex;
        flex-direction: column;
        z-index: 200;
        box-shadow: 2px 0 12px rgba(30, 58, 95, 0.06);
        transition: width 0.25s ease;
    }

    .sidebar.collapsed {
        width: 72px;
    }

    .sidebar-brand {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 20px 20px 16px;
        border-bottom: 1px solid var(--border);
        transition: padding 0.25s ease;
    }

    .sidebar.collapsed .sidebar-brand {
        padding: 16px;
        justify-content: center;
    }

    .sidebar-logo {
        width: 36px;
        height: 36px;
        border-radius: 10px;
        background: var(--primary-light);
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

    .sidebar-logo img {
        width: 28px;
        height: 28px;
        object-fit: contain;
    }

    .sidebar-title {
        font-size: 18px;
        font-weight: 700;
        color: var(--primary-dark);
        letter-spacing: -0.3px;
        white-space: nowrap;
        overflow: hidden;
        transition: opacity 0.2s ease;
    }

    .sidebar.collapsed .sidebar-title {
        display: none;
    }

    .sidebar-nav {
        flex: 1;
        overflow-y: auto;
        padding: 12px 10px;
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .sidebar-nav .nav-item {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 12px;
        width: 100%;
        padding: 12px 14px;
        border-radius: 12px;
        color: var(--text-light);
        font-size: 14px;
        font-weight: 500;
        transition: all 0.2s ease;
        min-width: auto;
        text-align: left;
        justify-content: flex-start;
    }

    .sidebar.collapsed .sidebar-nav .nav-item {
        justify-content: center;
        padding: 12px;
    }

    .sidebar.collapsed .sidebar-nav .nav-item span {
        display: none;
    }

    .sidebar-nav .nav-item svg {
        flex-shrink: 0;
    }

    .sidebar-nav .nav-item:hover {
        background: var(--primary-light);
        color: var(--primary);
    }

    .sidebar-nav .nav-item.active {
        color: var(--primary);
        background: var(--primary-light);
        font-weight: 600;
    }

    .sidebar-bottom {
        padding: 12px 10px;
        border-top: 1px solid var(--border);
        transition: padding 0.25s ease;
    }

    .sidebar.collapsed .sidebar-bottom {
        padding: 12px 10px;
    }

    .sidebar-logout {
        display: flex;
        align-items: center;
        gap: 10px;
        width: 100%;
        padding: 10px 14px;
        border: none;
        background: none;
        color: var(--danger);
        font-family: 'Poppins', sans-serif;
        font-size: 14px;
        font-weight: 500;
        cursor: pointer;
        border-radius: 10px;
        transition: background 0.2s ease;
    }

    .sidebar.collapsed .sidebar-logout {
        justify-content: center;
        padding: 10px;
    }

    .sidebar.collapsed .sidebar-logout span {
        display: none;
    }

    .sidebar-logout:hover {
        background: var(--danger-light);
    }

    .sidebar-collapse-btn {
        position: absolute;
        top: 20px;
        right: -14px;
        width: 28px;
        height: 28px;
        border-radius: 50%;
        background: var(--white);
        border: 1px solid var(--border);
        color: var(--text-gray);
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        z-index: 210;
        box-shadow: 0 2px 6px var(--shadow);
        transition: all 0.2s ease;
    }

    .sidebar-collapse-btn:hover {
        background: var(--bg-light);
        border-color: var(--primary);
        color: var(--primary);
    }

    .sidebar.collapsed .sidebar-collapse-btn {
        right: -14px;
        transform: rotate(180deg);
    }

    /* MAIN WRAPPER */
    #main-wrapper {
        margin-left: var(--sidebar-width);
        flex: 1;
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        transition: margin-left 0.25s ease;
    }

    .sidebar.collapsed ~ #main-wrapper {
        margin-left: 72px;
    }

    /* TOP NAVBAR */
    .top-navbar {
        position: sticky;
        top: 0;
        height: var(--navbar-height);
        background: var(--white);
        border-bottom: 1px solid var(--border);
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 24px;
        z-index: 150;
        box-shadow: 0 1px 4px rgba(30, 58, 95, 0.04);
    }

    .navbar-brand {
        display: flex;
        align-items: center;
        gap: 10px;
    }

    .navbar-brand img {
        width: 28px;
        height: 28px;
        object-fit: contain;
    }

    #page-title {
        font-size: 16px;
        font-weight: 600;
        color: var(--text);
    }

    .navbar-actions {
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .navbar-menu-btn {
        width: 36px;
        height: 36px;
        border-radius: 8px;
        border: 1px solid var(--border);
        background: var(--white);
        color: var(--text-gray);
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .navbar-menu-btn:hover {
        background: var(--bg-light);
        border-color: var(--primary);
        color: var(--primary);
    }

    .navbar-dropdown {
        position: absolute;
        top: calc(var(--navbar-height) - 4px);
        right: 12px;
        background: var(--white);
        border: 1px solid var(--border);
        border-radius: 12px;
        box-shadow: 0 8px 24px rgba(30, 58, 95, 0.12);
        z-index: 160;
        display: none;
        min-width: 200px;
        padding: 6px;
        animation: fadeIn 0.15s ease;
    }

    .navbar-dropdown.open {
        display: block;
    }

    .navbar-dropdown-item {
        display: flex;
        align-items: center;
        gap: 10px;
        width: 100%;
        padding: 10px 12px;
        border: none;
        background: none;
        color: var(--text);
        font-family: 'Poppins', sans-serif;
        font-size: 14px;
        font-weight: 500;
        cursor: pointer;
        border-radius: 8px;
        text-align: left;
        transition: background 0.2s ease;
    }

    .navbar-dropdown-item:hover {
        background: var(--bg-light);
    }

    .navbar-dropdown-logout {
        color: var(--danger);
    }

    .navbar-dropdown-logout:hover {
        background: var(--danger-light);
    }

    /* CONTENT */
    #content {
        flex: 1;
        max-width: 900px;
        width: 100%;
        margin: 0 auto;
        padding: 24px;
    }

    #toast {
        position: fixed;
        top: 16px;
        left: 50%;
        transform: translateX(-50%) translateY(-20px);
        z-index: 9999;
    }

    /* HEADER */
    .header {
        background: none;
        border: none;
        padding: 0 0 20px 0;
        position: static;
        box-shadow: none;
    }

    .header h2 {
        font-size: 26px;
        font-weight: 700;
        color: var(--primary-dark);
    }

    .header-logo {
        width: 40px;
        height: 40px;
        border-radius: 12px;
        object-fit: contain;
    }

    .header-top {
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .header-greeting {
        display: flex;
        flex-direction: column;
        gap: 2px;
    }

    .header-bienvenue {
        font-size: 13px;
        color: var(--text-light);
        font-weight: 500;
        margin: 0;
    }

    .header-user {
        font-size: 15px;
        color: var(--text);
        font-weight: 600;
        margin: 0;
    }

    .header-subtitle {
        font-size: 14px;
        color: var(--text-light);
        margin-top: 4px;
    }

    .header-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
    }

    /* METRICS */
    .metrics-grid {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 14px;
        padding: 0;
        margin-bottom: 24px;
    }

    .metric-card {
        background: var(--white);
        border-radius: 16px;
        padding: 18px;
        box-shadow: 0 2px 8px var(--shadow);
        display: flex;
        flex-direction: column;
        gap: 8px;
        border: 1px solid var(--border);
        transition: transform 0.15s ease, box-shadow 0.2s ease;
    }

    .metric-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 16px rgba(30, 58, 95, 0.08);
    }

    .metric-card-full {
        grid-column: span 2;
    }

    .metric-label {
        font-size: 11px;
        font-weight: 600;
        color: var(--text-light);
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .metric-value {
        font-size: 24px;
        font-weight: 700;
        color: var(--text);
    }

    /* SECTIONS */
    .section {
        margin-bottom: 24px;
    }

    .section-title {
        font-size: 15px;
        font-weight: 600;
        color: var(--text);
        margin-bottom: 12px;
    }

    /* SPLIT */
    .split-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .split-item {
        background: var(--white);
        border-radius: 14px;
        padding: 14px 16px;
        display: flex;
        align-items: center;
        gap: 10px;
        font-size: 13px;
        font-weight: 500;
        box-shadow: 0 2px 6px var(--shadow);
        border: 1px solid var(--border);
    }

    /* FORMS */
    .form-page {
        padding: 0;
        max-width: 600px;
    }

    .input-group {
        margin-bottom: 18px;
    }

    .input-group label {
        display: block;
        font-size: 13px;
        font-weight: 600;
        color: var(--text);
        margin-bottom: 6px;
    }

    .input-group input,
    .input-group select {
        width: 100%;
        padding: 12px 14px;
        border: 2px solid var(--border);
        border-radius: 12px;
        font-family: 'Poppins', sans-serif;
        font-size: 14px;
        background: var(--white);
        color: var(--text);
        transition: border-color 0.2s ease, box-shadow 0.2s ease;
    }

    .input-group input:focus,
    .input-group select:focus {
        outline: none;
        border-color: var(--primary);
        box-shadow: 0 0 0 3px var(--primary-light);
    }

    .retour-ligne {
        margin-bottom: 18px;
    }

    .retour-qte-grid {
        display: grid;
        grid-template-columns: 1fr 1fr 1fr;
        gap: 10px;
    }

    .retour-qte-grid input {
        width: 100%;
        padding: 12px 14px;
        border: 2px solid var(--border);
        border-radius: 12px;
        font-family: 'Poppins', sans-serif;
        font-size: 14px;
        background: var(--white);
        color: var(--text);
        transition: border-color 0.2s ease, box-shadow 0.2s ease;
    }

    .retour-qte-grid input:focus {
        outline: none;
        border-color: var(--primary);
        box-shadow: 0 0 0 3px var(--primary-light);
    }

    .retour-obs {
        width: 100%;
        padding: 10px 14px;
        border: 2px solid var(--border);
        border-radius: 10px;
        font-family: 'Poppins', sans-serif;
        font-size: 13px;
        background: var(--white);
        color: var(--text);
        margin-top: 8px;
    }

    .retour-obs:focus {
        outline: none;
        border-color: var(--primary);
        box-shadow: 0 0 0 3px var(--primary-light);
    }

    /* BUTTONS */
    .btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        padding: 12px 20px;
        border-radius: 12px;
        font-family: 'Poppins', sans-serif;
        font-size: 14px;
        font-weight: 600;
        border: none;
        cursor: pointer;
        transition: transform 0.15s ease, box-shadow 0.2s ease;
        min-height: 44px;
    }

    .btn:active {
        transform: scale(0.97);
    }

    .btn-primary {
        background: var(--primary);
        color: var(--white);
        box-shadow: 0 4px 14px var(--shadow-primary);
    }

    .btn-primary:hover {
        background: var(--primary-dark);
    }

    .btn-success {
        background: var(--primary);
        color: var(--white);
        box-shadow: 0 4px 14px var(--shadow-primary);
    }

    .btn-danger {
        background: var(--primary-dark);
        color: var(--white);
        box-shadow: 0 4px 14px var(--shadow-primary-dark);
    }

    .btn-full {
        width: 100%;
    }

    .btn-back {
        background: none;
        border: none;
        color: var(--primary);
        padding: 8px;
        margin-left: -8px;
        margin-bottom: 8px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .btn-secondary {
        background: var(--white);
        color: var(--text);
        border: 2px solid var(--border);
        box-shadow: none;
    }

    .btn-secondary:hover {
        border-color: var(--primary);
        color: var(--primary);
    }

    /* FILTERS */
    .filter-bar {
        display: flex;
        gap: 8px;
        padding: 0;
        margin-bottom: 16px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .filter-bar::-webkit-scrollbar {
        display: none;
    }

    .filter-btn {
        padding: 8px 16px;
        border-radius: 10px;
        border: 2px solid var(--border);
        background: var(--white);
        font-family: 'Poppins', sans-serif;
        font-size: 13px;
        font-weight: 500;
        color: var(--text);
        cursor: pointer;
        white-space: nowrap;
        transition: all 0.2s ease;
    }

    .filter-btn:hover {
        border-color: var(--primary);
        color: var(--primary);
    }

    .filter-btn.active {
        background: var(--primary);
        color: var(--white);
        border-color: var(--primary);
    }

    /* LISTS */
    .list-container {
        padding: 0;
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .list-item {
        background: var(--white);
        border-radius: 14px;
        padding: 16px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        box-shadow: 0 2px 6px var(--shadow);
        border: 1px solid var(--border);
        transition: transform 0.15s ease, box-shadow 0.2s ease;
    }

    .list-item:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(30, 58, 95, 0.08);
    }

    .list-item-info {
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .list-item-title {
        font-size: 14px;
        font-weight: 600;
        color: var(--text);
    }

    .list-item-meta {
        font-size: 12px;
        color: var(--text-light);
    }

    .list-item-amount {
        font-size: 15px;
        font-weight: 700;
        text-align: right;
    }

    .list-item-amount.positive {
        color: var(--primary);
    }

    .list-item-amount.negative {
        color: var(--danger);
    }

    .list-item-actions {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-left: 8px;
    }

    .list-item-actions .btn {
        min-height: 36px;
        padding: 8px 14px;
        font-size: 13px;
    }

    .list-item-column {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    /* BADGES */
    .badge {
        display: inline-flex;
        align-items: center;
        padding: 2px 8px;
        border-radius: 6px;
        font-size: 11px;
        font-weight: 600;
        text-transform: capitalize;
    }

    .badge-actif,
    .badge-role {
        background: var(--primary-light);
        color: var(--primary-dark);
    }

    .badge-inactif {
        background: var(--danger-light);
        color: var(--danger-dark);
    }

    .badge-en_attente {
        background: var(--bg-warning);
        color: var(--text-warning);
    }

    .badge-expire {
        background: var(--bg-light);
        color: var(--text-gray);
    }

    .badge-suspendu {
        background: var(--danger-light);
        color: var(--danger-dark);
    }

    .badge-en_cours { background: var(--bg-success); color: var(--text-success); }
    .badge-terminee { background: var(--bg-info); color: var(--text-info); }
    .badge-retard { background: var(--danger-light); color: var(--danger-dark); }

    /* CHARTS */
    .chart-tabs {
        display: flex;
        gap: 8px;
        margin-bottom: 16px;
    }

    .chart-tab {
        flex: 1;
        padding: 8px 10px;
        border-radius: 10px;
        border: 2px solid var(--border);
        background: var(--white);
        font-family: 'Poppins', sans-serif;
        font-size: 13px;
        font-weight: 500;
        color: var(--text);
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .chart-tab:hover {
        border-color: var(--primary);
        color: var(--primary);
    }

    .chart-tab.active {
        background: var(--primary);
        color: var(--white);
        border-color: var(--primary);
    }

    .chart-container {
        background: var(--white);
        border-radius: 16px;
        padding: 20px;
        box-shadow: 0 2px 8px var(--shadow);
        border: 1px solid var(--border);
        transition: box-shadow 0.2s ease;
    }

    .chart-container:hover {
        box-shadow: 0 4px 12px rgba(30, 58, 95, 0.08);
    }

    .chart-container canvas {
        width: 100% !important;
        height: 220px !important;
    }

    .chart-legend {
        display: flex;
        justify-content: center;
        gap: 16px;
        margin-top: 12px;
        font-size: 12px;
        color: var(--text-light);
    }

    .chart-legend-item {
        display: flex;
        align-items: center;
        gap: 6px;
    }

    .chart-legend-dot {
        width: 10px;
        height: 10px;
        border-radius: 3px;
    }

    .chart-legend-dot.sales { background: var(--primary); }
    .chart-legend-dot.expenses { background: var(--danger); }

    /* CASH */
    .cash-summary {
        background: var(--white);
        border-radius: 16px;
        padding: 20px;
        box-shadow: 0 2px 8px var(--shadow);
        display: flex;
        flex-direction: column;
        gap: 14px;
        border: 1px solid var(--border);
    }

    .cash-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 14px;
        color: var(--text-light);
    }

    .cash-row strong {
        font-size: 15px;
        font-weight: 600;
        color: var(--text);
    }

    .cash-row-total strong {
        font-size: 18px;
        color: var(--primary);
        font-weight: 700;
    }

    /* MODALS */
    .modal-overlay {
        align-items: center;
        justify-content: center;
        padding: 20px;
    }

    .modal-sheet {
        max-width: 520px;
        width: 100%;
        max-height: 85vh;
        border-radius: 20px;
        border: 1px solid var(--border);
        box-shadow: 0 25px 60px rgba(30, 58, 95, 0.2);
        animation: fadeIn 0.2s ease;
    }

    .modal-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 16px 20px;
        background: var(--white);
        border-bottom: 1px solid var(--border);
    }

    .modal-header h3 {
        font-size: 17px;
        font-weight: 700;
        color: var(--primary-dark);
    }

    .modal-close {
        background: none;
        border: none;
        color: var(--text-light);
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 4px;
        border-radius: 6px;
        transition: background 0.2s ease;
    }

    .modal-close:hover {
        background: var(--bg-light);
    }

    .modal-body {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .confirm-sheet {
        padding: 24px 20px 28px;
        text-align: center;
    }

    .confirm-body {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 12px;
        margin-bottom: 20px;
    }

    .confirm-icon {
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: var(--danger-light);
        color: var(--danger);
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .confirm-title {
        font-size: 17px;
        font-weight: 700;
        color: var(--text);
    }

    .confirm-message {
        font-size: 14px;
        color: var(--text-light);
    }

    .confirm-actions {
        display: flex;
        gap: 10px;
    }

    .confirm-actions .btn {
        flex: 1;
    }

    /* DETAIL MODALS */
    .detail-section {
        padding: 14px 20px;
        border-bottom: 1px solid var(--border);
    }

    .detail-section:last-child {
        border-bottom: none;
    }

    .detail-title {
        font-size: 12px;
        font-weight: 600;
        color: var(--text-light);
        text-transform: uppercase;
        letter-spacing: 0.5px;
        margin-bottom: 10px;
    }

    .detail-grid {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .detail-item {
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 14px;
        color: var(--text-light);
    }

    .detail-item strong {
        font-weight: 600;
        color: var(--text);
        text-align: right;
        max-width: 60%;
        word-break: break-word;
    }

    .detail-transactions {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .detail-transactions-scroll {
        max-height: 320px;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .detail-actions {
        display: flex;
        gap: 10px;
        margin-top: 14px;
    }

    .detail-actions .btn {
        flex: 1;
    }

    /* DEV SEARCH */
    .dev-search-bar {
        display: flex;
        gap: 8px;
        padding: 0 0 12px 0;
    }

    .dev-search-input {
        flex: 1;
        padding: 10px 14px;
        border: 2px solid var(--border);
        border-radius: 10px;
        font-family: 'Poppins', sans-serif;
        font-size: 13px;
        background: var(--white);
        color: var(--text);
        transition: border-color 0.2s ease, box-shadow 0.2s ease;
    }

    .dev-search-input:focus {
        outline: none;
        border-color: var(--primary);
        box-shadow: 0 0 0 3px var(--primary-light);
    }

    /* LOAD MORE */
    .btn-load-more {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        width: 100%;
        padding: 12px;
        border-radius: 12px;
        border: 2px solid var(--border);
        background: var(--white);
        color: var(--text);
        font-family: 'Poppins', sans-serif;
        font-size: 14px;
        font-weight: 500;
        cursor: pointer;
        transition: all 0.2s ease;
        margin: 8px 0 16px;
    }

    .btn-load-more:hover {
        border-color: var(--primary);
        color: var(--primary);
    }

    .btn-search-trigger {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        width: 100%;
        padding: 12px;
        border-radius: 12px;
        border: 1.5px solid var(--border);
        background: var(--white);
        color: var(--text-light);
        font-family: 'Poppins', sans-serif;
        font-size: 14px;
        font-weight: 500;
        cursor: pointer;
        margin-top: 8px;
        transition: border-color 0.2s ease, color 0.2s ease;
    }

    .btn-search-trigger:hover {
        border-color: var(--primary);
        color: var(--primary);
    }

    /* EMPTY STATE */
    .empty-state {
        text-align: center;
        padding: 40px 20px;
        color: var(--text-light);
        font-size: 14px;
    }

    .empty-state svg {
        width: 48px;
        height: 48px;
        margin-bottom: 12px;
        opacity: 0.4;
    }

    /* UTILITY */
    .text-center {
        text-align: center;
    }

    /* LOADER */
    .loader-overlay {
        position: fixed;
        inset: 0;
        background: rgba(255, 255, 255, 0.7);
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 250;
        backdrop-filter: blur(3px);
    }

    .loader-spinner {
        width: 40px;
        height: 40px;
        border: 3px solid var(--border);
        border-top-color: var(--primary);
        border-radius: 50%;
        animation: spin 0.8s linear infinite;
    }

    /* SKELETON */
    .skeleton {
        background: linear-gradient(90deg, var(--border) 25%, var(--bg-light) 50%, var(--border) 75%);
        background-size: 200% 100%;
        animation: skeleton-pulse 1.4s ease-in-out infinite;
        border-radius: 10px;
    }

    .skeleton-card {
        background: var(--white);
        border-radius: 16px;
        padding: 20px;
        box-shadow: 0 2px 8px var(--shadow);
        display: flex;
        flex-direction: column;
        gap: 12px;
        border: 1px solid var(--border);
    }

    .skeleton-line {
        height: 14px;
    }

    .skeleton-line.w-60 { width: 60%; }
    .skeleton-line.w-80 { width: 80%; }
    .skeleton-line.w-40 { width: 40%; }
    .skeleton-line.h-24 { height: 24px; }
    .skeleton-line.h-20 { height: 20px; }

    .skeleton-metric {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .skeleton-list {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    .skeleton-list-item {
        background: var(--white);
        border-radius: 14px;
        padding: 16px;
        box-shadow: 0 2px 6px var(--shadow);
        display: flex;
        align-items: center;
        gap: 12px;
        border: 1px solid var(--border);
    }

    .skeleton-avatar {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        flex-shrink: 0;
    }

    .skeleton-content {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    /* SELECTED CHIP */
    .selected-chip {
        display: inline-flex;
        align-items: center;
        gap: 10px;
        background: var(--bg-info);
        color: var(--text-blue);
        padding: 10px 14px;
        border-radius: 10px;
        font-weight: 600;
        margin-top: 8px;
    }

    .selected-chip button {
        background: none;
        border: none;
        color: inherit;
        font-size: 16px;
        cursor: pointer;
        line-height: 1;
    }

    /* LIGNE ROW */
    .ligne-row {
        display: grid;
        grid-template-columns: 1fr 64px 80px auto;
        gap: 8px;
        align-items: center;
        background: var(--white);
        padding: 10px;
        border-radius: 10px;
        box-shadow: 0 1px 4px var(--shadow);
        margin-bottom: 8px;
        border: 1px solid var(--border);
    }

    .ligne-row .ligne-remove {
        background: var(--danger-light);
        color: var(--danger-dark);
        border: none;
        border-radius: 8px;
        width: 28px;
        height: 28px;
        cursor: pointer;
        font-size: 14px;
    }

    .readonly-amount {
        font-size: 22px;
        font-weight: 700;
        color: var(--text-blue);
        padding: 8px 0;
    }

    /* REABONNEMENT */
    .abonnement-statut {
        width: 100%;
        padding: 10px 14px;
        border: 2px solid var(--border);
        border-radius: 10px;
        font-family: 'Poppins', sans-serif;
        font-size: 14px;
        font-weight: 500;
        background: var(--white);
        color: var(--text);
    }

    .abonnement-statut:focus {
        outline: none;
        border-color: var(--primary);
        box-shadow: 0 0 0 3px var(--primary-light);
    }

    .reabonnement-row {
        display: flex;
        gap: 10px;
        align-items: center;
    }

    .reabonnement-row .abonnement-statut {
        flex: 1;
    }

    .reabonnement-row .btn {
        min-height: 44px;
        padding: 10px 18px;
        white-space: nowrap;
    }

    /* EXPIRED BOX */
    .expired-box {
        text-align: center;
        padding: 24px 16px;
    }

    .expired-icon {
        width: 64px;
        height: 64px;
        border-radius: 50%;
        background: var(--primary-light);
        color: var(--primary);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin-bottom: 16px;
    }

    .expired-title {
        font-size: 18px;
        font-weight: 700;
        color: var(--primary-dark);
        margin-bottom: 8px;
    }

    .expired-message {
        font-size: 14px;
        color: var(--text-light);
        margin-bottom: 20px;
        line-height: 1.5;
    }

    .expired-contact {
        display: flex;
        flex-direction: column;
        gap: 10px;
        text-align: left;
    }

    .expired-contact-item {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
        background: var(--white);
        border: 2px solid var(--border);
        border-radius: 12px;
        padding: 14px 16px;
        text-decoration: none;
        color: var(--text);
        font-size: 14px;
        font-weight: 500;
    }

    .expired-contact-item strong {
        color: var(--primary-dark);
        font-weight: 600;
    }

    .list-item-delete {
        background: none;
        border: none;
        color: var(--danger);
        padding: 8px;
        margin-left: 8px;
        cursor: pointer;
        display: flex;
        align-items: center;
        border-radius: 6px;
        transition: background 0.2s ease;
    }

    .list-item-delete:hover {
        background: var(--danger-light);
    }

    /* HIDE MOBILE ELEMENTS ON DESKTOP */
    .bottom-nav,
    .fab-container,
    .top-menu-btn,
    .top-menu-dropdown {
        display: none !important;
    }

    /* TOAST */
    .toast {
        position: fixed;
        top: 16px;
        left: 50%;
        transform: translateX(-50%) translateY(-20px);
        padding: 12px 20px;
        border-radius: 12px;
        font-family: 'Poppins', sans-serif;
        font-size: 14px;
        font-weight: 500;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease, transform 0.3s ease;
        z-index: 9999;
        max-width: 90%;
        text-align: center;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        box-shadow: 0 8px 24px rgba(30, 58, 95, 0.2);
    }

    .toast.show {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }

    .toast.toast-success {
        background: var(--primary);
        color: var(--white);
        box-shadow: 0 4px 12px var(--shadow-primary);
    }

    .toast.toast-error {
        background: var(--danger);
        color: var(--white);
        box-shadow: 0 4px 12px var(--shadow-danger);
    }

    /* FOOTER */
    .app-footer {
        height: var(--footer-height);
        background: var(--white);
        border-top: 1px solid var(--border);
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0 24px;
        font-size: 12px;
        color: var(--text-light);
        flex-shrink: 0;
    }

    /* SCROLLBAR */
    ::-webkit-scrollbar {
        width: 6px;
    }

    ::-webkit-scrollbar-track {
        background: transparent;
    }

    ::-webkit-scrollbar-thumb {
        background: var(--border);
        border-radius: 6px;
    }

    ::-webkit-scrollbar-thumb:hover {
        background: var(--text-light);
    }

    .detail-transactions-scroll::-webkit-scrollbar,
    .modal-body::-webkit-scrollbar {
        width: 4px;
    }

    .detail-transactions-scroll::-webkit-scrollbar-thumb,
    .modal-body::-webkit-scrollbar-thumb {
        background: var(--border);
        border-radius: 4px;
    }

    /* LOGIN PAGE */
    .login-container {
        min-height: auto;
        padding: 40px 24px;
    }

    .login-form {
        box-shadow: 0 4px 20px rgba(30, 58, 95, 0.1);
    }

    /* DOWNLOAD PAGE */
    .download-hero {
        text-align: center;
        padding: 32px 20px;
    }

    .download-icon {
        width: 96px;
        height: 96px;
        background: var(--primary-light);
        border-radius: 28px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        color: var(--primary);
        margin-bottom: 16px;
    }

    .download-title {
        font-size: 28px;
        font-weight: 700;
        color: var(--primary-dark);
    }

    .download-version {
        font-size: 14px;
        color: var(--text-light);
        margin-top: 4px;
    }

    .download-features {
        display: flex;
        flex-direction: column;
        gap: 12px;
        margin-bottom: 24px;
    }

    .download-feature {
        display: flex;
        align-items: center;
        gap: 12px;
        background: var(--white);
        border-radius: 14px;
        padding: 14px 16px;
        font-size: 14px;
        font-weight: 500;
        color: var(--text);
        box-shadow: 0 2px 6px var(--shadow);
        border: 1px solid var(--border);
    }

    .download-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
    }

    .download-note {
        text-align: center;
        font-size: 12px;
        color: var(--text-light);
        margin-top: 12px;
    }

    /* FAB MENU (mobile only) */
    .fab-menu {
        display: none !important;
    }

    /* DEV ACTIONS */
    .dev-actions {
        display: flex;
        gap: 10px;
        margin-top: 4px;
    }

    .dev-actions .btn {
        flex: 1;
    }

    /* CLIENT PICKER */
    .client-picker {
        position: relative;
    }

    .client-picker .list-container {
        margin-top: 8px;
        max-height: 220px;
        overflow-y: auto;
    }

    /* BTN LOADING */
    .btn-loading {
        pointer-events: none;
        opacity: 0.7;
        position: relative;
    }

    .btn-loading::after {
        content: '';
        width: 20px;
        height: 20px;
        border: 2px solid var(--white-30);
        border-top-color: var(--white);
        border-radius: 50%;
        animation: spin 0.8s linear infinite;
        margin-left: 8px;
    }
}

/* TABLETTE */
@media (min-width: 768px) {
    :root {
        --sidebar-width: 260px;
        --navbar-height: 64px;
    }

    .sidebar {
        width: var(--sidebar-width);
    }

    #main-wrapper {
        margin-left: var(--sidebar-width);
    }

    .sidebar.collapsed ~ #main-wrapper {
        margin-left: 72px;
    }

    #content {
        max-width: 1000px;
        padding: 28px;
    }

    #page-login.active {
        display: flex;
        align-items: center;
        justify-content: center;
        padding-bottom: 0;
    }

    #page-login.active .login-container {
        min-height: auto;
        width: 100%;
        max-width: 420px;
    }

    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }

    .metric-card {
        padding: 20px;
    }

    .metric-value {
        font-size: 26px;
    }

    .split-grid {
        grid-template-columns: 1fr 1fr;
        gap: 14px;
    }

    .list-item {
        padding: 18px;
    }

    .header h2 {
        font-size: 28px;
    }
}

/* DESKTOP AVANCE */
@media (min-width: 1024px) {
    :root {
        --sidebar-width: 280px;
    }

    .sidebar {
        width: var(--sidebar-width);
    }

    #main-wrapper {
        margin-left: var(--sidebar-width);
    }

    .sidebar.collapsed ~ #main-wrapper {
        margin-left: 72px;
    }

    #content {
        max-width: 1100px;
        padding: 32px;
    }

    .metrics-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 18px;
    }

    .metric-card {
        padding: 22px;
    }

    .metric-value {
        font-size: 28px;
    }

    .split-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}
