/* ============================================================
   GEOFIXE — Espace client (dashboard + billing) — V2 clair
   ============================================================ */

.app-page { background: var(--bg); }

/* Écran de chargement (espace client) */
.loading-screen {
    position: fixed; inset: 0; z-index: 300;
    background: var(--bg);
    display: flex; align-items: center; justify-content: center;
    transition: opacity .3s ease, visibility .3s ease;
}
.loading-screen.hidden { opacity: 0; visibility: hidden; pointer-events: none; }

/* ===== Header espace client ===== */
.app-header {
    position: sticky; top: 0; z-index: 100;
    background: rgba(250,250,248,.85);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--border);
}
.app-header__inner { height: var(--header-h); display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.app-header__actions { display: flex; align-items: center; gap: .5rem; }
.icon-btn {
    position: relative;
    width: 44px; height: 44px; border-radius: var(--r-full);
    display: grid; place-items: center; font-size: 1.15rem;
    background: var(--surface); border: var(--card-border);
    color: var(--ink); transition: border-color var(--t-fast), background var(--t-fast);
}
.icon-btn:hover { border-color: var(--brand); background: var(--brand-50); }
.notif-badge {
    position: absolute; top: 6px; right: 6px;
    min-width: 18px; height: 18px; padding: 0 4px;
    background: var(--warm); color: #fff;
    border-radius: var(--r-full); font-size: .68rem; font-weight: 700;
    display: none; align-items: center; justify-content: center;
}
.notif-badge.show { display: flex; }
.logout-btn {
    display: inline-flex; align-items: center; gap: .5rem;
    padding: .6rem 1rem; border-radius: var(--r-full);
    background: var(--surface); border: var(--card-border);
    font-weight: 600; font-size: .95rem; color: var(--ink-soft);
    transition: border-color var(--t-fast), color var(--t-fast);
}
.logout-btn:hover { border-color: #f6c9cf; color: #c0334a; }
.desktop-only { display: none; }
@media (min-width: 768px) { .desktop-only { display: inline-flex; } .mobile-only-logout { display: none; } }

/* ===== Layout ===== */
.dashboard-main { padding-block: clamp(1.5rem, 4vw, 2.5rem) 4rem; }

.welcome-section {
    display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between;
    margin-bottom: 1.5rem;
}
.welcome-title { font-size: clamp(1.5rem, 4vw, 2rem); }
.welcome-subtitle { color: var(--muted); margin-top: .25rem; }
.quick-actions { display: flex; gap: .6rem; flex-wrap: wrap; }
.quick-action-btn {
    display: inline-flex; align-items: center; gap: .5rem;
    padding: .7rem 1.1rem; border-radius: var(--r-full);
    background: var(--surface); border: var(--card-border);
    font-weight: 600; font-size: .92rem; color: var(--ink-soft);
    transition: all var(--t-fast);
}
.quick-action-btn:hover { border-color: var(--brand); color: var(--brand-600); }
.quick-action-btn a { color: inherit; }

/* Accès facturation en haut (mobile uniquement) — style carte blanche */
.billing-fab {
    display: flex; align-items: center; gap: .85rem;
    background: var(--surface);
    color: var(--ink);
    border: var(--card-border);
    border-radius: var(--r-lg); padding: 1rem 1.25rem;
    margin-bottom: 1.5rem; box-shadow: var(--shadow-sm);
}
.billing-fab-icon { font-size: 1.5rem; }
.billing-fab-text { flex: 1; font-weight: 700; }
.billing-fab-text small { display: block; font-weight: 500; color: var(--muted); font-size: .8rem; }
.billing-fab-arrow { font-size: 1.2rem; color: var(--brand); }
@media (min-width: 900px) { .billing-fab { display: none; } }
/* Sur mobile, le raccourci du bas est masqué (évite le doublon) */
@media (max-width: 899px) { .billing-shortcut { display: none; } }

/* ===== Stats ===== */
.stats-heading { font-size: 1rem; color: var(--muted); margin-bottom: .8rem; font-family: var(--font-body); font-weight: 600; }
.stats-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; margin-bottom: 1.75rem; }
@media (min-width: 560px) { .stats-grid { grid-template-columns: repeat(3, 1fr); } }
.stat-card {
    background: var(--surface); border: var(--card-border);
    border-radius: var(--r-lg); padding: 1.25rem; box-shadow: var(--shadow-sm);
    display: flex; flex-direction: column; gap: .5rem;
}
.stat-icon { font-size: 1.5rem; }
.stat-value { font-family: var(--font-display); font-weight: 800; font-size: 1.8rem; color: var(--ink); line-height: 1; }
.stat-label { color: var(--muted); font-size: .9rem; }
.stat-trend { font-size: .8rem; color: var(--faint); display: flex; align-items: center; gap: .35rem; }

/* ===== Grille principale ===== */
.dashboard-main-grid { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
@media (min-width: 900px) { .dashboard-main-grid { grid-template-columns: 1.6fr 1fr; align-items: start; } }
.dashboard-col-main, .dashboard-col-side { display: flex; flex-direction: column; gap: 1.5rem; }

.dashboard-section {
    background: var(--surface); border: var(--card-border);
    border-radius: var(--r-lg); padding: 1.5rem; box-shadow: var(--shadow-sm);
}
.section-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.1rem; }
.section-title { font-size: 1.15rem; display: flex; align-items: center; gap: .55rem; }
.section-action {
    display: inline-flex; align-items: center; gap: .35rem;
    font-weight: 600; font-size: .88rem; color: var(--brand-600);
}
.section-action:hover { color: var(--brand-700); }

/* ===== Carte numéro ===== */
.number-card-main { display: grid; gap: 1.25rem; }
.number-status { display: inline-flex; align-items: center; gap: .45rem; font-size: .85rem; font-weight: 600; color: var(--trust); }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--trust-bright); box-shadow: 0 0 0 4px var(--trust-100); }
.number-main { font-family: var(--font-display); font-weight: 800; font-size: clamp(1.6rem, 5vw, 2.2rem); color: var(--ink); letter-spacing: .03em; margin: .5rem 0 .15rem; }
.number-location { color: var(--muted); }
.number-actions { display: flex; gap: .6rem; margin-top: 1rem; flex-wrap: wrap; }
.number-action-btn {
    display: inline-flex; align-items: center; gap: .45rem;
    padding: .7rem 1.1rem; border-radius: var(--r-full); font-weight: 600; font-size: .92rem;
    transition: all var(--t-fast);
}
.number-action-btn.primary { background: var(--brand); color: #fff; box-shadow: var(--shadow-brand); }
.number-action-btn.primary:hover { background: var(--brand-600); }
.number-action-btn.secondary { background: var(--surface); border: 1px solid var(--border-strong); color: var(--ink); }
.number-action-btn.secondary:hover { border-color: var(--brand); color: var(--brand-600); }
.number-features { display: grid; gap: .7rem; padding-top: 1.1rem; border-top: 1px solid var(--border); }
.feature-item { display: flex; align-items: center; gap: .6rem; color: var(--ink-soft); font-size: .95rem; }
.feature-item--toggle { justify-content: space-between; }
.notif-switch { position: relative; display: inline-block; width: 42px; height: 24px; margin-left: auto; }
.notif-switch input { opacity: 0; width: 0; height: 0; }
.notif-slider { position: absolute; inset: 0; background: var(--border-strong); border-radius: var(--r-full); cursor: pointer; transition: background var(--t); }
.notif-slider::before { content: ""; position: absolute; height: 18px; width: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform var(--t); box-shadow: var(--shadow-xs); }
.notif-switch input:checked + .notif-slider { background: var(--brand); }
.notif-switch input:checked + .notif-slider::before { transform: translateX(18px); }

/* ===== Activité ===== */
.activity-list, .full-activity-list { display: flex; flex-direction: column; gap: .5rem; }
.activity-item {
    display: flex; align-items: center; gap: .85rem;
    padding: .8rem; border-radius: var(--r-md); border: var(--card-border);
}
.activity-item__icon { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-100); flex: none; }
.activity-item__main { flex: 1; min-width: 0; }
.activity-item__title { font-weight: 600; color: var(--ink); }
.activity-item__sub { font-size: .85rem; color: var(--muted); }
.activity-loading, .qr-code-loading { display: flex; flex-direction: column; align-items: center; gap: .8rem; padding: 2rem 0; color: var(--muted); }
.loading-spinner { width: 28px; height: 28px; border: 3px solid var(--surface-2); border-top-color: var(--brand); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== QR Code ===== */
.qr-code-content { display: flex; flex-direction: column; gap: 1.25rem; align-items: center; text-align: center; }
.qr-code-container { width: 100%; display: grid; place-items: center; min-height: 180px; }
.qr-code-display img { width: 200px; height: 200px; border-radius: var(--r-md); border: var(--card-border); padding: 8px; background: #fff; }
.qr-code-error { color: #c0334a; }
.qr-code-title { font-size: 1.05rem; }
.qr-code-description { color: var(--muted); font-size: .9rem; margin-top: .35rem; }
.qr-code-actions { display: flex; gap: .6rem; flex-wrap: wrap; justify-content: center; margin-top: 1rem; }
.qr-action-btn { display: inline-flex; align-items: center; gap: .45rem; padding: .65rem 1rem; border-radius: var(--r-full); font-weight: 600; font-size: .9rem; }
.qr-action-btn.primary { background: var(--brand); color: #fff; }
.qr-action-btn.secondary { background: var(--surface-2); color: var(--ink); border: var(--card-border); }

/* Raccourci facturation (desktop) */
.billing-shortcut { padding: 0; overflow: hidden; }
.billing-shortcut-link { display: flex; align-items: center; gap: 1rem; padding: 1.3rem 1.5rem; }
.billing-shortcut-icon { font-size: 1.6rem; }
.billing-shortcut-content { flex: 1; }
.billing-shortcut-content h3 { font-size: 1.05rem; }
.billing-shortcut-content p { color: var(--muted); font-size: .88rem; }
.billing-shortcut-arrow { color: var(--brand); font-size: 1.2rem; }
.billing-shortcut-link:hover .billing-shortcut-arrow { transform: translateX(3px); transition: transform var(--t); }

/* Support */
.support-section { margin-top: 1.5rem; text-align: center; }
.support-title { font-size: 1.2rem; display: inline-flex; gap: .5rem; align-items: center; justify-content: center; }
.support-description { color: var(--muted); margin: .4rem 0 1rem; }
.support-options { display: flex; justify-content: center; }
.support-btn { display: inline-flex; align-items: center; gap: .7rem; padding: .85rem 1.4rem; border-radius: var(--r-md); background: var(--surface-2); border: var(--card-border); text-align: left; }
.support-btn:hover { border-color: var(--brand); }
.support-btn-content strong { display: block; }
.support-btn-content small { color: var(--muted); }

/* ===== Modales & panneaux ===== */
.modal-overlay {
    position: fixed; inset: 0; z-index: 200;
    background: rgba(27,24,48,.5); backdrop-filter: blur(4px);
    display: none; align-items: center; justify-content: center; padding: 1.25rem;
}
.modal-overlay.open, .modal-overlay.show, .modal-overlay.active { display: flex; }
.modal-content {
    background: var(--surface); border-radius: var(--r-xl);
    width: 100%; max-width: 640px; max-height: 88vh; overflow-y: auto;
    box-shadow: var(--shadow-lg);
}
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); }
.modal-header h2, .modal-header h3 { font-size: 1.15rem; }
.modal-close { width: 34px; height: 34px; border-radius: 50%; background: var(--surface-2); border: var(--card-border); color: var(--muted); font-size: 1.1rem; }
.modal-close:hover { background: var(--brand-100); color: var(--brand-600); }
.modal-body { padding: 1.5rem; }
.activity-stats { display: flex; gap: 1rem; padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); }
.stat-item { flex: 1; text-align: center; }
.stat-number { display: block; font-family: var(--font-display); font-weight: 800; font-size: 1.5rem; color: var(--ink); }
.stat-text { font-size: .82rem; color: var(--muted); }

/* Panneau notifications */
.notification-panel {
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 210;
    width: min(380px, 90vw); background: var(--surface);
    box-shadow: var(--shadow-lg); transform: translateX(100%);
    transition: transform .3s var(--ease); display: flex; flex-direction: column;
}
.notification-panel.open, .notification-panel.show, .notification-panel.active { transform: translateX(0); }
.notification-header { display: flex; align-items: center; justify-content: space-between; padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); }
.close-notifications { width: 34px; height: 34px; border-radius: 50%; background: var(--surface-2); border: var(--card-border); color: var(--muted); }
.notification-list { overflow-y: auto; padding: .75rem; display: flex; flex-direction: column; gap: .5rem; }
.notification-item { display: flex; gap: .8rem; padding: .9rem; border-radius: var(--r-md); border: var(--card-border); }
.notification-item.unread { background: var(--brand-50); border-color: var(--brand-100); }
.notification-icon { font-size: 1.2rem; }
.notification-title { font-weight: 700; color: var(--ink); font-size: .95rem; }
.notification-text { font-size: .88rem; color: var(--muted); margin: .15rem 0; }
.notification-time { font-size: .78rem; color: var(--faint); }
.notification-unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); margin-left: auto; flex: none; }

/* Modale d'accueil */
.welcome-modal-overlay {
    position: fixed; inset: 0; z-index: 220;
    background: rgba(27,24,48,.55); backdrop-filter: blur(4px);
    display: none; align-items: center; justify-content: center; padding: 1.25rem;
}
.welcome-modal-overlay.open, .welcome-modal-overlay.show, .welcome-modal-overlay.active { display: flex; }
.welcome-modal { background: var(--surface); border-radius: var(--r-xl); max-width: 480px; width: 100%; overflow: hidden; box-shadow: var(--shadow-lg); }
.welcome-modal-header { text-align: center; padding: 2rem 1.5rem 1rem; }
.welcome-modal-badge { width: 64px; height: 64px; margin: 0 auto 1rem; border-radius: 50%; background: var(--brand-100); display: grid; place-items: center; font-size: 1.8rem; }
.welcome-modal-title { font-size: 1.35rem; }
.welcome-modal-subtitle { color: var(--muted); margin-top: .4rem; }
.welcome-modal-body { padding: 1rem 1.5rem; display: flex; flex-direction: column; gap: 1rem; }
.welcome-step { display: flex; gap: .9rem; align-items: flex-start; }
.welcome-step-icon { font-size: 1.4rem; flex: none; }
.welcome-step-text strong { display: block; }
.welcome-step-text span { color: var(--muted); font-size: .9rem; }
.welcome-modal-footer { padding: 1.25rem 1.5rem 1.75rem; }
.welcome-modal-btn { width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: .5rem; padding: .95rem; border-radius: var(--r-full); background: var(--brand); color: #fff; font-weight: 600; box-shadow: var(--shadow-brand); }
.welcome-modal-btn:hover { background: var(--brand-600); }

/* ===== BILLING ===== */
.billing-main { padding-block: clamp(1.5rem, 4vw, 2.5rem) 4rem; }
.billing-section { background: var(--surface); border: var(--card-border); border-radius: var(--r-lg); padding: 1.5rem; box-shadow: var(--shadow-sm); margin-bottom: 1.5rem; }
.plan-name { font-size: 1.3rem; }
.price-amount { font-family: var(--font-display); font-weight: 800; font-size: 2rem; color: var(--ink); }
.subscription-status { display: inline-flex; align-items: center; gap: .45rem; padding: .35rem .8rem; border-radius: var(--r-full); font-weight: 600; font-size: .85rem; background: var(--trust-100); color: var(--trust); }
.subscription-status.loading { background: var(--surface-2); color: var(--muted); }
.billing-detail-row { display: flex; justify-content: space-between; padding: .6rem 0; border-bottom: 1px solid var(--border); }
.billing-label { color: var(--muted); }
.billing-value { font-weight: 600; color: var(--ink); }
.action-btn { display: inline-flex; align-items: center; gap: .5rem; padding: .75rem 1.2rem; border-radius: var(--r-full); font-weight: 600; font-size: .92rem; transition: all var(--t-fast); }
.action-btn.primary { background: var(--brand); color: #fff; box-shadow: var(--shadow-brand); }
.action-btn.secondary { background: var(--surface); border: 1px solid var(--border-strong); color: var(--ink); }
.action-btn.secondary:hover { border-color: var(--brand); color: var(--brand-600); }
.action-btn.danger { background: var(--surface); border: 1px solid #f6c9cf; color: #c0334a; }
.action-btn.danger:hover { background: #fdecee; }
.payment-card { display: flex; align-items: center; gap: 1rem; padding: 1.25rem; border: var(--card-border); border-radius: var(--r-md); background: var(--surface-2); }
.card-brand { font-weight: 700; }
.invoices-list { display: flex; flex-direction: column; gap: .5rem; }
.invoice-item { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .85rem 1rem; border: var(--card-border); border-radius: var(--r-md); }
.invoice-item:hover { border-color: var(--brand); }
.form-input { width: 100%; background: var(--surface); border: 1.5px solid var(--border-strong); border-radius: var(--r-md); padding: .8rem 1rem; font: inherit; color: var(--ink); }
.form-input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--ring); }
.modal-btn { padding: .75rem 1.3rem; border-radius: var(--r-full); font-weight: 600; }
.modal-btn.primary { background: var(--brand); color: #fff; }
.modal-btn.secondary { background: var(--surface-2); color: var(--ink-soft); border: var(--card-border); }

/* ===== Billing : actions abonnement ===== */
.subscription-actions {
    display: flex; flex-direction: column; align-items: center;
    gap: .7rem; margin-top: 1.5rem;
}
.subscription-actions .action-btn { width: 100%; max-width: 340px; justify-content: center; }
/* Labels à deux lignes (annuler / réactiver) */
.btn-label-group { display: flex; flex-direction: column; align-items: center; line-height: 1.2; }
.btn-label-main { font-size: .92rem; font-weight: 600; }
.btn-label-sub  { font-size: .72rem; font-weight: 400; opacity: .75; }
.btn-label-sub:empty { display: none; }

/* Carte abonnement : ventilation HT/TVA */
.plan-tax-breakdown { font-size: .85rem; color: var(--muted); margin-top: .25rem; }

/* ===== Modale changement de plan ===== */
.plan-switch-list { display: grid; gap: .7rem; }
.plan-switch {
    text-align: left; width: 100%;
    background: var(--surface); border: 2px solid var(--border-strong);
    border-radius: var(--r-md); padding: 1rem 1.1rem; cursor: pointer;
    display: flex; align-items: center; gap: .9rem;
    transition: border-color var(--t), box-shadow var(--t), background var(--t);
}
.plan-switch:hover { border-color: var(--brand); }
.plan-switch.is-selected { border-color: var(--brand); background: var(--brand-50); box-shadow: 0 0 0 3px var(--ring); }
.plan-switch.is-current { opacity: .6; cursor: default; }
.plan-switch__radio { width: 20px; height: 20px; flex: none; border-radius: 50%; border: 2px solid var(--border-strong); }
.plan-switch.is-selected .plan-switch__radio { border-color: var(--brand); background: var(--brand); box-shadow: inset 0 0 0 4px #fff; }
.plan-switch__body { flex: 1; }
.plan-switch__name { font-weight: 700; color: var(--ink); }
.plan-switch__price { color: var(--ink-soft); font-size: .9rem; }
.plan-switch__tag { font-size: .72rem; font-weight: 700; color: var(--brand-600); background: var(--brand-100); padding: .15rem .5rem; border-radius: var(--r-full); }
