/* ==========================================================================
   PORTEFEUILLE — feuille dédiée (refonte du 21/10/2026)
   --------------------------------------------------------------------------
   La page portait 392 lignes de style en ligne et sa propre copie de la
   palette. Elle reprend la direction « route de nuit » : carte de compte en
   dégradé ambre, cartes de chiffres en panneaux, onglets, formulaire de
   transfert, objectif d'épargne et historique. Le socle hub.css porte la
   coquille et la barre latérale.
   ========================================================================== */

:root {
    --wallet-display: 'Barlow Condensed', 'Inter', system-ui, sans-serif;
    --wallet-ligne: rgba(var(--rgb-white), 0.07);
    --wallet-ombre: 0 22px 50px rgba(0, 0, 0, 0.45);
}

[hidden] { display: none !important; }

/* ==========================================================================
   1. EN-TÊTE
   ========================================================================== */

.page-header { margin-bottom: var(--space-5); }
.page-header h1 {
    font-family: var(--wallet-display);
    font-size: clamp(2rem, 4vw, 2.8rem);
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -0.01em;
    text-transform: uppercase;
    color: var(--text-primary);
}
.page-header h1 span {
    background: linear-gradient(100deg, var(--accent-ambre), var(--accent-green));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.page-header p {
    margin-top: 4px;
    color: var(--text-secondary);
    font-size: var(--font-md);
}

/* ==========================================================================
   2. CARTE DU PORTEFEUILLE
   ========================================================================== */

.wallet-card {
    position: relative;
    overflow: hidden;
    padding: clamp(24px, 4vw, 40px);
    margin-bottom: var(--space-4);
    border-radius: var(--radius-2xl);
    border: 1px solid rgba(var(--rgb-ambre), 0.22);
    background:
        radial-gradient(620px 320px at 8% -10%, rgba(var(--rgb-ambre), 0.22), transparent 62%),
        radial-gradient(480px 280px at 100% 110%, rgba(var(--rgb-teal), 0.12), transparent 62%),
        linear-gradient(150deg, rgba(var(--rgb-bg-card), 0.96), rgba(var(--rgb-bg-sidebar), 0.96));
    box-shadow: var(--wallet-ombre);
}
.wallet-card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-ambre), var(--accent-green));
}
.wallet-card::after {
    content: '';
    position: absolute;
    right: -80px;
    bottom: -110px;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(var(--rgb-ambre), 0.16), transparent 65%);
    pointer-events: none;
}
.wallet-card > * { position: relative; z-index: 1; }
.wallet-icon-wrapper {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    margin-bottom: var(--space-3);
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--accent-ambre), var(--accent-orange));
    color: #1b1202;
    font-size: 1.4rem;
    box-shadow: 0 10px 26px rgba(var(--rgb-ambre), 0.28);
}
.wallet-label {
    font-size: var(--font-2xs);
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.wallet-balance {
    margin-top: 2px;
    font-family: var(--wallet-display);
    font-size: clamp(2.6rem, 6vw, 4.2rem);
    font-weight: 800;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
    overflow-wrap: anywhere;
}
.wallet-balance .currency {
    font-size: 0.45em;
    margin-left: 6px;
    color: var(--accent-ambre);
}
.wallet-change {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: var(--space-3);
    font-size: var(--font-sm);
    color: var(--text-secondary);
}
.wallet-change.positive { color: var(--accent-green); }
.wallet-change.negative { color: var(--accent-red); }
.wallet-change.neutre { color: var(--text-muted); }
.wallet-note {
    margin-top: var(--space-2);
    font-size: var(--font-xs);
    color: var(--text-muted);
}
.wallet-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-4);
}
.btn-wallet {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 18px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    background: rgba(var(--rgb-white), 0.03);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: var(--font-sm);
    font-weight: 700;
    cursor: pointer;
    transition: transform var(--transition-rapide), border-color var(--transition-rapide), color var(--transition-rapide);
}
.btn-wallet:hover { transform: translateY(-2px); color: var(--text-primary); border-color: rgba(var(--rgb-ambre), 0.4); }
.btn-wallet.primary {
    border: 0;
    background: linear-gradient(135deg, var(--accent-ambre), var(--accent-orange));
    color: #1b1202;
}
.btn-wallet.gold {
    border-color: rgba(var(--rgb-yellow), 0.4);
    background: rgba(var(--rgb-yellow), 0.08);
    color: var(--accent-yellow);
}
.btn-wallet.outline:hover { border-color: var(--accent-ambre); color: var(--accent-ambre); }
.btn-wallet:focus-visible { outline: var(--focus-ring-outline); outline-offset: 2px; }

/* ==========================================================================
   3. CARTES DE CHIFFRES
   ========================================================================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}
.stat-card {
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    border: 1px solid var(--wallet-ligne);
    background: linear-gradient(165deg, rgba(var(--rgb-bg-card), 0.85), rgba(var(--rgb-bg-sidebar), 0.85));
    transition: transform var(--transition-rapide), border-color var(--transition-rapide);
}
.stat-card:hover { transform: translateY(-2px); border-color: rgba(var(--rgb-ambre), 0.3); }
.stat-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    margin-bottom: var(--space-2);
    border-radius: var(--radius-sm);
    background: rgba(var(--rgb-ambre), 0.1);
    border: 1px solid rgba(var(--rgb-ambre), 0.2);
    font-size: 1.1rem;
}
.stat-value {
    font-family: var(--wallet-display);
    font-size: var(--font-4xl);
    font-weight: 800;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
    overflow-wrap: anywhere;
}
.stat-label {
    margin-top: 2px;
    font-size: var(--font-2xs);
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.stat-note {
    margin-top: 6px;
    font-size: var(--font-xs);
    line-height: 1.5;
    color: var(--text-muted);
}
.stat-card.green .stat-value { color: var(--accent-green); }
.stat-card.red .stat-value { color: var(--accent-red); }
.stat-card.blue .stat-value { color: var(--accent-blue); }
.stat-card.gold .stat-value { color: var(--accent-yellow); }

/* ==========================================================================
   4. RÈGLES ET REFUS
   ========================================================================== */

.regles-hub {
    padding: var(--space-4);
    margin-bottom: var(--space-4);
    border-radius: var(--radius-lg);
    border: 1px dashed var(--border-color);
    background: rgba(var(--rgb-white), 0.02);
}
.regles-hub h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 var(--space-2);
    font-size: var(--font-md);
    color: var(--text-secondary);
}
.regles-hub ul {
    margin: 0;
    padding-left: 18px;
    font-size: var(--font-xs);
    line-height: 1.8;
    color: var(--text-muted);
}
.regles-hub code {
    padding: 1px 6px;
    border-radius: var(--radius-xs);
    background: rgba(var(--rgb-white), 0.06);
    color: var(--accent-ambre);
    font-size: 0.95em;
}

.zone-refus {
    margin: 0 0 var(--space-3);
    padding: 11px 14px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(var(--rgb-red), 0.3);
    background: rgba(var(--rgb-red), 0.08);
    color: var(--accent-red);
    font-size: var(--font-sm);
    line-height: 1.55;
}
.note-indisponible {
    margin: 0 0 var(--space-4);
    padding: 12px 16px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(var(--rgb-yellow), 0.28);
    background: rgba(var(--rgb-yellow), 0.07);
    color: var(--text-secondary);
    font-size: var(--font-sm);
    line-height: 1.6;
}
.note-indisponible i { color: var(--accent-yellow); }

/* ==========================================================================
   5. ONGLETS ET FORMULAIRES
   ========================================================================== */

.tabs {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}
.tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: var(--font-sm);
    font-weight: 700;
    cursor: pointer;
    transition: color var(--transition-rapide), border-color var(--transition-rapide), background-color var(--transition-rapide);
}
.tab-btn:hover { color: var(--text-primary); border-color: rgba(var(--rgb-ambre), 0.4); }
.tab-btn.active {
    color: var(--text-primary);
    border-color: rgba(var(--rgb-ambre), 0.55);
    background: rgba(var(--rgb-ambre), 0.12);
}
.tab-btn:focus-visible { outline: var(--focus-ring-outline); outline-offset: 2px; }
.tab-btn .badge {
    padding: 1px 8px;
    border-radius: var(--radius-full);
    background: rgba(var(--rgb-white), 0.06);
    font-size: var(--font-2xs);
}
.tab-btn.active .badge { background: rgba(var(--rgb-ambre), 0.2); color: var(--accent-ambre); }

.tab-content { display: none; }
.tab-content.active { display: block; }
.tab-content h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 var(--space-3);
    font-size: var(--font-lg);
    color: var(--text-primary);
}

.form-group { display: flex; flex-direction: column; gap: 7px; margin-bottom: var(--space-3); }
.form-group label {
    display: flex;
    gap: 6px;
    font-size: var(--font-2xs);
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--text-secondary);
}
.form-group label .required { color: var(--accent-red); }
.form-input,
.form-select {
    width: 100%;
    box-sizing: border-box;
    padding: 11px 13px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-primary);
    font-family: inherit;
    font-size: var(--font-md);
}
.form-input::placeholder { color: var(--text-muted); opacity: 0.8; }
.form-input:focus-visible,
.form-select:focus-visible {
    outline: none;
    border-color: var(--accent-ambre);
    box-shadow: var(--focus-ring);
}
.form-select { cursor: pointer; }
.form-select option { background: var(--bg-card); color: var(--text-primary); }

.wallet-subnote {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--font-xs);
    color: var(--text-muted);
}
.wallet-block { margin-top: var(--space-3); }
.wallet-section-note {
    margin: 0 0 var(--space-3);
    font-size: var(--font-xs);
    line-height: 1.6;
    color: var(--text-muted);
}

.transfer-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    margin-bottom: var(--space-4);
    border-radius: var(--radius-md);
    border: 1px solid var(--wallet-ligne);
    background: rgba(var(--rgb-white), 0.02);
}
.transfer-preview .label { font-size: var(--font-sm); color: var(--text-muted); }
.transfer-preview .amount {
    font-family: var(--wallet-display);
    font-size: var(--font-3xl);
    font-weight: 800;
    color: var(--accent-ambre);
    font-variant-numeric: tabular-nums;
}

.btn-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 18px;
    border: 0;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--accent-ambre), var(--accent-orange));
    color: #1b1202;
    font-family: inherit;
    font-size: var(--font-sm);
    font-weight: 800;
    cursor: pointer;
    transition: transform var(--transition-rapide), opacity var(--transition-rapide);
}
.btn-submit:hover:not(:disabled) { transform: translateY(-2px); }
.btn-submit:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-submit:focus-visible { outline: var(--focus-ring-outline); outline-offset: 3px; }
.btn-submit.danger {
    background: rgba(var(--rgb-red), 0.1);
    border: 1px solid rgba(var(--rgb-red), 0.3);
    color: var(--accent-red);
}
.btn-submit.danger:hover:not(:disabled) { background: rgba(var(--rgb-red), 0.16); }

/* ==========================================================================
   6. OBJECTIF D'ÉPARGNE
   ========================================================================== */

.objectif-carte {
    padding: var(--space-4);
    margin-bottom: var(--space-3);
    border-radius: var(--radius-lg);
    border: 1px solid var(--wallet-ligne);
    background: rgba(var(--rgb-bg-card), 0.6);
}
.objectif-ligne {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 0;
    border-bottom: 1px solid var(--wallet-ligne);
    font-size: var(--font-sm);
}
.objectif-ligne:last-of-type { border-bottom: 0; }
.objectif-ligne .label { color: var(--text-muted); }
.objectif-ligne .value {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
    text-align: right;
}
.barre-objectif {
    height: 8px;
    margin-top: var(--space-3);
    border-radius: var(--radius-full);
    background: rgba(var(--rgb-white), 0.07);
    overflow: hidden;
}
.barre-objectif > span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent-ambre), var(--accent-green));
    transition: width var(--transition-lente) var(--courbe-douce);
}
#objectifNote { margin-top: 8px; }

/* ==========================================================================
   7. HISTORIQUE
   ========================================================================== */

.history-list {
    max-height: 560px;
    overflow-y: auto;
    padding-right: 4px;
}
.history-list::-webkit-scrollbar { width: 8px; }
.history-list::-webkit-scrollbar-thumb {
    background: rgba(var(--rgb-ambre), 0.25);
    border-radius: var(--radius-full);
}
.history-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    border-bottom: 1px solid var(--wallet-ligne);
}
.history-item:last-child { border-bottom: 0; }
.history-item:hover { background: rgba(var(--rgb-white), 0.025); }
.history-icon {
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: rgba(var(--rgb-white), 0.03);
    font-size: 1rem;
}
.history-icon.earn { border-color: rgba(var(--rgb-green), 0.3); background: rgba(var(--rgb-green), 0.08); }
.history-icon.spend { border-color: rgba(var(--rgb-red), 0.3); background: rgba(var(--rgb-red), 0.08); }
.history-info { flex: 1 1 200px; min-width: 0; }
.history-title { font-size: var(--font-md); font-weight: 700; color: var(--text-primary); }
.history-subtitle,
.history-source,
.history-date {
    font-size: var(--font-xs);
    color: var(--text-muted);
    line-height: 1.5;
    overflow-wrap: anywhere;
}
.history-amount {
    margin-left: auto;
    font-size: var(--font-md);
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.history-amount.earn { color: var(--accent-green); }
.history-amount.spend { color: var(--accent-red); }
.history-amount.neutre { color: var(--text-muted); }

/* ==========================================================================
   8. ÉTATS VIDES ET NOTIFICATIONS
   ========================================================================== */

.empty-state {
    padding: var(--space-6) var(--space-4);
    text-align: center;
    border-radius: var(--radius-lg);
    border: 1px dashed var(--border-color);
    background: rgba(var(--rgb-white), 0.02);
    color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 2.2rem; opacity: 0.4; margin-bottom: 8px; }
.empty-state h4 { margin: 0 0 4px; font-size: var(--font-md); color: var(--text-secondary); }
.empty-state p { margin: 0; font-size: var(--font-xs); line-height: 1.6; }

/* ==========================================================================
   9. PETITS ÉCRANS ET MOUVEMENT RÉDUIT
   ========================================================================== */

@media (max-width: 768px) {
    .wallet-card { padding: var(--space-5); border-radius: var(--radius-xl); }
    .wallet-actions { flex-direction: column; }
    .btn-wallet { justify-content: center; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .tabs { flex-direction: column; }
    .tab-btn { justify-content: center; }
    .history-item { flex-wrap: wrap; }
    .history-amount { margin-left: 0; }
}
@media (max-width: 480px) {
    .wallet-balance { font-size: var(--font-6xl); }
    .stats-grid { grid-template-columns: 1fr; }
    .objectif-ligne { flex-direction: column; align-items: flex-start; gap: 2px; }
    .objectif-ligne .value { text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
    .wallet-card, .stat-card, .btn-wallet, .btn-submit, .tab-btn { transition: none !important; }
    .btn-wallet:hover, .btn-submit:hover, .stat-card:hover { transform: none; }
    .barre-objectif > span { transition: none; }
}
