/**
 * Swissapp · Mon espace — Main Styles
 * Design system aligné sur admin_invoices, palette Swiss Red 🇨🇭
 */

/* =====================================================
   VARIABLES & THEME
   ===================================================== */
:root {
    --primary: #D52B1E;
    --primary-dark: #B81F13;
    --primary-light: #E85A4F;
    --primary-50: rgba(213, 43, 30, 0.05);
    --primary-100: rgba(213, 43, 30, 0.10);
    --primary-200: rgba(213, 43, 30, 0.20);
    --secondary: #1f2937;
    --success: #16a34a;
    --warning: #f59e0b;
    --danger: #dc2626;
    --info: #2563eb;
    --purple: #7c3aed;

    --bg-primary: #f9fafb;
    --bg-card: #ffffff;
    --border-color: #e5e7eb;
    --border-soft: #f1f5f9;

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

    --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
    --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 12px 30px rgba(15, 23, 42, 0.12);

    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;

    --sidebar-w: 256px;
}

/* =====================================================
   BASE
   ===================================================== */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: 'cv02','cv03','cv04','cv11';
}

.num, .stat-value, .pack-price, .plan-price { font-variant-numeric: tabular-nums; }

/* =====================================================
   BUTTONS
   ===================================================== */
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-lg);
    font-weight: 600;
    font-size: 0.875rem;
    box-shadow: 0 4px 12px rgba(213, 43, 30, 0.25);
    transition: all 0.18s;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    line-height: 1.2;
    white-space: nowrap;
    font-family: inherit;
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(213, 43, 30, 0.35);
}
.btn-primary:disabled {
    background: #D1D5DB;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background-color: #F3F4F6;
    color: var(--secondary);
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-lg);
    transition: all 0.2s;
    border: none;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: inherit;
    line-height: 1.2;
}
.btn-secondary:hover { background-color: #E5E7EB; }

.btn-outline {
    background: white;
    color: var(--text-secondary);
    padding: 0.6rem 1.25rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.18s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: inherit;
}
.btn-outline:hover {
    color: var(--primary);
    border-color: var(--primary-light);
    background: var(--primary-50);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 0.5rem 0.875rem;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.15s;
    font-family: inherit;
}
.btn-ghost:hover { background: var(--border-soft); color: var(--text-primary); }

.btn-danger {
    background-color: var(--danger);
    color: white;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-lg);
    transition: all 0.2s;
    border: none;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.875rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: inherit;
}
.btn-danger:hover { background-color: #b91c1c; }

.btn-google {
    background: white;
    color: #374151;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-lg);
    font-weight: 500;
    border: 2px solid var(--border-color);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    transition: all 0.2s;
    width: 100%;
    font-size: 0.875rem;
    font-family: inherit;
}
.btn-google:hover {
    background-color: #f9fafb;
    border-color: #d1d5db;
    box-shadow: var(--shadow-md);
}

.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.8rem; border-radius: var(--radius-md); }
.btn-lg { padding: 0.875rem 1.75rem; font-size: 1rem; }

/* =====================================================
   CARDS
   ===================================================== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow: hidden;
    margin-bottom: 1.25rem;
}
.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    background: white;
}
.card-header h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.card-body { padding: 1.25rem; }

/* =====================================================
   FORMS
   ===================================================== */
.form-group { margin-bottom: 1rem; }
.form-label, .form-group label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
}
.input-field {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    transition: all 0.2s;
    background: white;
    color: var(--text-primary);
    font-family: inherit;
}
.input-field:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-100);
}
.input-field::placeholder { color: var(--text-muted); }
.input-field:disabled { background: var(--bg-primary); color: var(--text-muted); cursor: not-allowed; }
textarea.input-field { min-height: 80px; resize: vertical; }
select.input-field { cursor: pointer; padding-right: 2rem; }

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

/* SIDEBAR */
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-card);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 30;
    flex-shrink: 0;
}
.sidebar-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.125rem 1.125rem 0.875rem;
}
.sidebar-logo {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    box-shadow: 0 6px 16px rgba(213, 43, 30, 0.3);
}
.sidebar-brand {
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
    display: flex;
    flex-direction: column;
}
.sidebar-brand small {
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-top: 2px;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}
.nav-section {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.875rem 0.875rem 0.375rem;
}
.sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem 0.875rem;
    border-radius: var(--radius-lg);
    color: var(--text-secondary);
    transition: all 0.15s ease;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
}
.sidebar-item i { width: 1.25rem; text-align: center; flex-shrink: 0; }
.sidebar-item:hover {
    background-color: var(--primary-50);
    color: var(--primary);
}
.sidebar-item.active {
    background-color: var(--primary-100);
    color: var(--primary);
    font-weight: 600;
}

.sidebar-user {
    border-top: 1px solid var(--border-color);
    padding: 0.875rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    transition: background 0.15s;
}
.sidebar-user:hover { background: var(--bg-primary); }
.sidebar-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-info b {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sidebar-user-info small {
    font-size: 0.72rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
}

/* MAIN */
.main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.topbar {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border-color);
    padding: 0.875rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    position: sticky;
    top: 0;
    z-index: 20;
}
.topbar-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}
.topbar-subtitle {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: -2px;
}
.menu-btn {
    display: none;
    background: white;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    cursor: pointer;
    align-items: center;
    justify-content: center;
}
.wrap { padding: 1.5rem; max-width: 1280px; margin: 0 auto; width: 100%; }

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    z-index: 25;
    backdrop-filter: blur(2px);
}

/* =====================================================
   GRIDS / TILES / STATS
   ===================================================== */
.tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.875rem;
    margin-bottom: 1.5rem;
}
.tile {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 1rem 1.125rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    text-decoration: none;
    color: inherit;
}
.tile-icon { font-size: 1.4rem; color: var(--primary); }
.tile-label { font-size: 0.9rem; font-weight: 600; color: var(--text-primary); }
.tile-hint { font-size: 0.75rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.tile:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.875rem;
    margin-bottom: 1.25rem;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 1rem 1.125rem;
    display: flex;
    align-items: center;
    gap: 0.875rem;
    transition: all 0.15s;
}
.stat-card:hover { box-shadow: var(--shadow-md); }
.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.05rem;
}
.stat-value { font-size: 1.35rem; font-weight: 700; color: var(--text-primary); line-height: 1.1; }
.stat-label { font-size: 0.78rem; color: var(--text-muted); font-weight: 500; margin-top: 2px; }

/* Sub strip */
.sub-strip {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border-radius: var(--radius-xl);
    padding: 1.125rem 1.375rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
    box-shadow: 0 8px 24px rgba(213, 43, 30, 0.18);
    flex-wrap: wrap;
}
.sub-strip-info strong { font-size: 1rem; font-weight: 700; display: block; }
.sub-strip-info small { opacity: 0.85; font-size: 0.82rem; }
.sub-strip-price { font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.sub-strip-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.sub-strip-actions .btn-secondary { background: rgba(255,255,255,0.18); color: white; }
.sub-strip-actions .btn-secondary:hover { background: rgba(255,255,255,0.28); }

/* =====================================================
   TABLES
   ===================================================== */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.data-table th, .data-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-soft);
}
.data-table th {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    background: var(--bg-primary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.data-table tbody tr:hover { background: var(--bg-primary); }
.data-table tbody tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; }

/* =====================================================
   STATUS BADGES
   ===================================================== */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.18rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 600;
    background: var(--border-soft);
    color: var(--text-secondary);
}
.status-success { background: #dcfce7; color: #166534; }
.status-warning { background: #fef3c7; color: #92400e; }
.status-info    { background: #dbeafe; color: #1e40af; }
.status-danger  { background: #fee2e2; color: #991b1b; }
.status-purple  { background: #f3e8ff; color: #6b21a8; }
.status-primary { background: var(--primary-100); color: var(--primary); }

/* =====================================================
   MODALS / POPUPS
   ===================================================== */
.popup-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(15, 23, 42, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 1rem;
    backdrop-filter: blur(6px);
    animation: fadeIn 0.18s ease-out;
}
.popup-container {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: scaleIn 0.18s ease-out;
}
.popup-container.popup-lg { max-width: 760px; }
.popup-container.popup-sm { max-width: 400px; }
.popup-header {
    padding: 1.125rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    background: white;
}
.popup-header h2, .popup-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.popup-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.4rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.popup-close:hover { background: var(--border-soft); color: var(--text-primary); }
.popup-body { padding: 1.25rem; overflow-y: auto; flex: 1; }
.popup-footer {
    padding: 0.875rem 1.25rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    background: var(--bg-primary);
}

/* =====================================================
   LOGIN
   ===================================================== */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    background: linear-gradient(135deg, #fef2f2 0%, #ffffff 50%, #fff1f2 100%);
}
.login-card {
    background: white;
    width: 100%;
    max-width: 420px;
    padding: 2.25rem;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}
.login-logo { text-align: center; margin-bottom: 1.5rem; }
.login-logo .icon {
    width: 56px; height: 56px;
    border-radius: var(--radius-xl);
    margin: 0 auto 1rem;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem; font-weight: 800;
    color: white;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    box-shadow: 0 12px 30px rgba(213, 43, 30, 0.30);
}
.login-logo h1 { font-size: 1.4rem; font-weight: 800; color: var(--text-primary); margin: 0 0 0.25rem; }
.login-logo p { font-size: 0.875rem; color: var(--text-secondary); margin: 0; }
.login-divider {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.72rem;
    margin: 1.25rem 0;
    position: relative;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}
.login-divider::before, .login-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: calc(50% - 24px);
    height: 1px;
    background: var(--border-color);
}
.login-divider::before { left: 0; }
.login-divider::after  { right: 0; }
.login-footer {
    text-align: center;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 1.5rem;
    line-height: 1.5;
}
.login-footer a { color: var(--primary); }
.login-footer a:hover { text-decoration: underline; }

/* =====================================================
   SUBSCRIPTION (Plans pickers)
   ===================================================== */
.subscription-screen {
    min-height: 100vh;
    background: linear-gradient(135deg, #fef2f2 0%, #ffffff 50%, #fff1f2 100%);
    padding: 3rem 1.5rem;
}
.subscription-header { text-align: center; margin-bottom: 2rem; }
.subscription-header h1 { font-size: 1.95rem; font-weight: 800; color: var(--text-primary); margin: 0 0 0.5rem; }
.subscription-header p { color: var(--text-secondary); font-size: 1rem; }

.billing-toggle {
    display: inline-flex;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 4px;
    margin: 0 auto 2rem;
    gap: 4px;
}
.billing-toggle button {
    border: none;
    background: transparent;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.875rem;
    transition: all 0.18s;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.billing-toggle button.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 10px rgba(213, 43, 30, 0.25);
}

.plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
    max-width: 880px;
    margin: 0 auto;
}
.plan-card {
    background: white;
    border-radius: var(--radius-xl);
    padding: 1.75rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: all 0.25s;
    display: flex;
    flex-direction: column;
    position: relative;
}
.plan-card.popular {
    border-color: var(--primary);
    box-shadow: 0 12px 24px rgba(213, 43, 30, 0.15);
}
.plan-card.popular::before {
    content: 'POPULAIRE';
    position: absolute;
    top: -10px;
    right: 1.5rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    padding: 4px 10px;
    border-radius: 6px;
}
.plan-name { font-size: 1rem; font-weight: 700; color: var(--text-primary); }
.plan-price {
    font-size: 2.4rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0.25rem 0;
}
.plan-price small { font-size: 0.85rem; font-weight: 500; color: var(--text-muted); }
.plan-cycle { font-size: 0.78rem; color: var(--text-muted); margin-bottom: 1rem; }
.plan-features { list-style: none; padding: 0; margin: 0 0 1.5rem; flex: 1; }
.plan-features li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
    font-size: 0.875rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-soft);
}
.plan-features li:last-child { border-bottom: none; }
.plan-features li i { color: var(--success); font-size: 0.78rem; }
.save-badge {
    background: #dcfce7;
    color: #166534;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
}

/* =====================================================
   PACK CARDS (recharge, storage)
   ===================================================== */
.pack-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}
.pack-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.125rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    background: white;
    transition: all 0.18s;
}
.pack-row:hover { border-color: var(--primary-light); background: var(--primary-50); }
.pack-info { flex: 1; min-width: 0; }
.pack-name { font-weight: 700; color: var(--text-primary); font-size: 0.95rem; }
.pack-meta { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.pack-price {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
}

.pack-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}
.pack-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    transition: all 0.18s;
    position: relative;
}
.pack-card.is-current {
    border-color: var(--primary);
    background: var(--primary-50);
}
.pack-card.is-current::before {
    content: 'PACK ACTUEL';
    position: absolute;
    top: -8px;
    right: 1rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    padding: 3px 8px;
    border-radius: 5px;
}
.pack-card .pack-features {
    list-style: none;
    padding: 0;
    margin: 0.25rem 0 0.75rem;
    font-size: 0.82rem;
}
.pack-card .pack-features li {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.2rem 0;
    color: var(--text-secondary);
}
.pack-card .pack-features li i { color: var(--success); font-size: 0.7rem; }

/* =====================================================
   MODULES
   ===================================================== */
.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}
.module-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: all 0.18s;
}
.module-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--primary-light); }
.module-card.is-disabled { opacity: 0.65; }
.module-card-head {
    padding: 1rem 1.125rem;
    display: flex;
    gap: 0.875rem;
    align-items: flex-start;
}
.module-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}
.module-meta { flex: 1; min-width: 0; }
.module-name { font-weight: 700; color: var(--text-primary); font-size: 0.95rem; }
.module-desc { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; line-height: 1.4; }
.module-price { font-weight: 700; font-size: 0.9rem; color: var(--primary); font-variant-numeric: tabular-nums; text-align: right; }
.module-card-footer {
    padding: 0.75rem 1.125rem;
    border-top: 1px solid var(--border-soft);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    background: var(--bg-primary);
}
.module-status {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    font-weight: 600;
}
.module-status .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.module-status.is-active { color: var(--success); }
.module-status.is-inactive { color: var(--text-muted); }
.module-card-actions {
    padding: 0.75rem 1.125rem;
    display: flex;
    gap: 0.5rem;
    border-top: 1px solid var(--border-soft);
}
.module-card-actions button { flex: 1; }

/* =====================================================
   API KEYS
   ===================================================== */
.api-key-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 0.75rem 0.875rem;
}
.api-key-display code {
    flex: 1;
    font-family: 'SF Mono', Menlo, Consolas, monospace;
    font-size: 0.82rem;
    color: var(--text-primary);
    word-break: break-all;
}
.api-key-display button {
    background: white;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    padding: 0.4rem 0.6rem;
    cursor: pointer;
}
.api-key-display button:hover { color: var(--primary); border-color: var(--primary-light); }

.mono { font-family: 'SF Mono', Menlo, Consolas, monospace; font-size: 0.82rem; }

/* =====================================================
   PROGRESS
   ===================================================== */
.progress {
    height: 8px;
    background: var(--border-soft);
    border-radius: 9999px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    border-radius: 9999px;
    transition: width 0.4s ease;
    background: var(--primary);
}

/* =====================================================
   TABS (maps test)
   ===================================================== */
.tabs {
    display: flex;
    gap: 0.25rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
    overflow-x: auto;
}
.tab {
    background: none;
    border: none;
    padding: 0.75rem 0.875rem;
    font-family: inherit;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.85rem;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* =====================================================
   EMPTY STATE
   ===================================================== */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
}
.empty-state-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    border-radius: var(--radius-xl);
    background: var(--border-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 1.5rem;
}
.empty-state-title { font-weight: 700; color: var(--text-secondary); margin-bottom: 0.25rem; font-size: 0.95rem; }
.empty-state-desc { font-size: 0.85rem; }

/* =====================================================
   TOAST
   ===================================================== */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}
.toast {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 0.75rem 1rem;
    border-left: 4px solid var(--primary);
    min-width: 240px;
    max-width: 360px;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    animation: slideInRight 0.25s ease-out;
    pointer-events: auto;
    font-size: 0.875rem;
    font-weight: 500;
}
.toast.toast-success { border-left-color: var(--success); }
.toast.toast-error   { border-left-color: var(--danger); }
.toast.toast-warning { border-left-color: var(--warning); }
.toast.toast-info    { border-left-color: var(--info); }
.toast i { font-size: 1rem; flex-shrink: 0; }
.toast.toast-success i { color: var(--success); }
.toast.toast-error i   { color: var(--danger); }
.toast.toast-warning i { color: var(--warning); }
.toast.toast-info i    { color: var(--info); }

/* =====================================================
   LOADING / SPINNERS / SKELETONS
   ===================================================== */
.loading-spinner {
    width: 2.5rem;
    height: 2.5rem;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}
.spinner-sm {
    width: 1rem;
    height: 1rem;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
}
.skeleton {
    background: linear-gradient(90deg, #f1f5f9 0%, #e2e8f0 50%, #f1f5f9 100%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

/* =====================================================
   ANIMATIONS
   ===================================================== */
@keyframes fadeIn   { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn  { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }
@keyframes slideUp  { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes skeleton-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.animate-fade-in   { animation: fadeIn 0.4s ease-out forwards; }
.animate-slide-up  { animation: slideUp 0.4s ease-out forwards; }
.animate-scale-in  { animation: scaleIn 0.3s ease-out forwards; }

/* Scrollbar */
.scroll-thin::-webkit-scrollbar { width: 6px; height: 6px; }
.scroll-thin::-webkit-scrollbar-track { background: transparent; }
.scroll-thin::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
.scroll-thin::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
.sidebar-nav::-webkit-scrollbar,
.popup-body::-webkit-scrollbar { width: 6px; height: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb,
.popup-body::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb:hover,
.popup-body::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 1024px) {
    .menu-btn { display: inline-flex; }
    .sidebar {
        position: fixed;
        left: 0; top: 0;
        height: 100vh;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        box-shadow: 0 0 40px rgba(0,0,0,0.15);
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-backdrop.show { display: block; }
}

@media (max-width: 640px) {
    .wrap { padding: 1rem; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .stat-card { padding: 0.75rem; gap: 0.5rem; }
    .stat-value { font-size: 1.1rem; }
    .login-card { padding: 1.75rem; }
    .subscription-screen { padding: 2rem 1rem; }
    .subscription-header h1 { font-size: 1.5rem; }
    .plan-card { padding: 1.25rem; }
    .plan-price { font-size: 1.8rem; }
    .popup-footer { flex-direction: column-reverse; }
    .popup-footer button { width: 100%; }
    .pack-row { flex-wrap: wrap; }
    .sub-strip { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
}
