/* ============================================================
   Coffre Le39 — Thème sombre glassmorphism
   ============================================================ */

:root {
    --bg: #0b0f1a;
    --panel: rgba(255,255,255,0.06);
    --panel2: rgba(255,255,255,0.08);
    --stroke: rgba(255,255,255,0.10);
    --text: rgba(255,255,255,0.92);
    --muted: rgba(255,255,255,0.60);

    --navy: #0b2a4a;
    --navy2: #0a223a;

    --green: #30d158;
    --red: #ff453a;
    --amber: #ffd60a;

    --shadow: 0 12px 30px rgba(0,0,0,0.35);
    --radius: 18px;
}

body.day {
    --bg: #2c2c2e;
    --panel: rgba(255,255,255,0.09);
    --panel2: rgba(255,255,255,0.12);
    --stroke: rgba(255,255,255,0.16);
    --text: rgba(255,255,255,0.95);
    --muted: rgba(255,255,255,0.65);
    --shadow: 0 12px 30px rgba(0,0,0,0.22);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
                 "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: radial-gradient(1200px 600px at 20% -10%, rgba(56,189,248,0.12), transparent 60%),
                radial-gradient(900px 520px at 100% 0%, rgba(99,102,241,0.10), transparent 55%),
                var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Layout ------------------------------------------------ */

.wrap {
    max-width: var(--w);
    margin: 0 auto;
    padding: 18px 14px 40px;
}

header {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    justify-content: space-between;
    padding: 10px 4px 16px;
}

.title {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.title h1 {
    margin: 0;
    font-size: 22px;
    letter-spacing: -0.02em;
    font-weight: 700;
}

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

.pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid var(--stroke);
    background: rgba(255,255,255,0.04);
    border-radius: 999px;
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s, border-color 0.2s;
}

.pill:hover {
    background: rgba(255,255,255,0.10);
    border-color: rgba(255,255,255,0.22);
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 99px;
    background: var(--amber);
    box-shadow: 0 0 0 3px rgba(255,214,10,0.15);
}

.grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

/* --- Cards ------------------------------------------------- */

.card {
    width: 100%;
    border: 1px solid var(--stroke);
    background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.04));
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.cardHead {
    padding: 14px 16px;
    border-bottom: 1px solid var(--stroke);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.cardHead h2 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.82);
}

.cardBody { padding: 14px 16px 16px; }

.stack { display: flex; flex-direction: column; gap: 12px; }

/* --- Sous-coffres ------------------------------------------ */

.subvault {
    border: 1px solid var(--stroke);
    background: rgba(255,255,255,0.04);
    border-radius: 16px;
    overflow: hidden;
}

.subvaultHeader {
    background: linear-gradient(180deg, var(--navy), var(--navy2));
    color: white;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.subvaultName {
    font-weight: 800;
    letter-spacing: -0.02em;
    font-size: 16px;
    display: flex;
    gap: 10px;
    align-items: baseline;
    min-width: 120px;
}

.subvaultTotals {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
    text-align: right;
}

/* --- Bulles ------------------------------------------------ */

.bubble {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.18);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.bubble .lbl {
    color: rgba(255,255,255,0.78);
    font-weight: 700;
}

/* --- Tables ------------------------------------------------ */

.table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-variant-numeric: tabular-nums;
}

.table th,
.table td {
    padding: 10px 10px;
    border-bottom: 1px solid var(--stroke);
    vertical-align: middle;
}

.table th {
    text-align: left;
    font-size: 11px;
    color: var(--muted);
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.table td { font-size: 13px; }

.metal {
    font-weight: 800;
    letter-spacing: -0.01em;
}

.mainVal {
    font-weight: 800;
    letter-spacing: -0.02em;
    white-space: nowrap;
}

.subVal {
    display: block;
    margin-top: 3px;
    font-size: 11px;
    color: var(--muted);
    white-space: nowrap;
}

.pos { color: var(--green); }
.neg { color: var(--red); }

/* --- Table scroll wrapper ---------------------------------- */

.tableWrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
}

.tableWrap::-webkit-scrollbar { height: 8px; }
.tableWrap::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.18);
    border-radius: 999px;
    border: 2px solid rgba(0,0,0,0);
    background-clip: padding-box;
}

.table.minWide5 { min-width: 860px; }
.table.minWide4 { min-width: 560px; }

/* --- Flags / Devises --------------------------------------- */

.flagLine {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--stroke);
}

.flagLine:last-child { border-bottom: none; }

.flagLeft {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 210px;
}

.flag {
    width: 22px;
    height: 16px;
    border-radius: 4px;
    overflow: hidden;
    flex: 0 0 auto;
    box-shadow: 0 3px 10px rgba(0,0,0,0.25);
    border: 1px solid rgba(255,255,255,0.14);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.fxTxt {
    font-weight: 800;
    letter-spacing: -0.02em;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.fxSmall {
    color: var(--muted);
    font-size: 12px;
}

/* --- Spot tables ------------------------------------------- */

.spotTable th,
.spotTable td {
    padding: 10px 10px;
    border-bottom: 1px solid var(--stroke);
}

.spotTable th {
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.spotTable td { font-size: 13px; }

.wcol { width: 28%; }
.ccol { width: 24%; }

.money {
    font-weight: 800;
    letter-spacing: -0.02em;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.nowrap { white-space: nowrap; }

/* --- Infos / Insights -------------------------------------- */

.insightBox {
    padding: 12px 12px;
    border: 1px solid var(--stroke);
    border-radius: 16px;
    background: var(--panel);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.insightRow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.insightLbl {
    font-weight: 800;
    letter-spacing: -0.02em;
}

.insightBubble {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.16);
    font-size: 13px;
    font-weight: 900;
    letter-spacing: -0.02em;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* --- Error ------------------------------------------------- */

.err {
    padding: 14px 16px;
    border: 1px solid rgba(255,69,58,0.35);
    background: rgba(255,69,58,0.08);
    border-radius: 14px;
    color: rgba(255,255,255,0.9);
    margin-top: 10px;
}

/* --- Responsive -------------------------------------------- */

@media (max-width: 760px) {
    header { flex-direction: column; align-items: stretch; }
    .subvaultHeader { flex-direction: column; align-items: stretch; gap: 8px; }
    .subvaultTotals { justify-content: flex-start; text-align: left; }
    .flagLine { flex-direction: column; align-items: flex-start; gap: 6px; }
    .flagLeft { min-width: 0; }
    .table th, .table td { padding: 10px 8px; }
    .mainVal { font-size: 13px; }
}
